SSkilltecabyclaudinhocode
Enviar skill
← Voltar para o catálogo

hydra

Desenvolvimento

Multi-perspective code review council: advisors analyze, reviewers cross-examine, chairman synthesizes verdict. USE for: architecture decisions, security audits, tradeoff analysis, "what am I missing" questions, pre-merge deep reviews, iterative re-reviews after fixes. DO NOT USE for: simple code generation, syntax fixes, single-file refactors, or factual lookups. TRIGGERS: 'hydra', 'hydra this',

2estrelas
Ver no GitHub ↗Autor: ZandereinsLicença: MIT
<!-- v2.0: per ADR docs/adr/0001-execution-substrate.md (Option C, accepted 2026-05-23), interactive /hydra runs in THIS harness (Agent tool + codex-companion), so SKILL.md is the living product surface. Prompt-level v2.0 wins land here directly (Echo advisor; chairman grounding + suspicious-verdict gate). The Python core in hydra/ is scoped to the bench (deterministic citation-grounding + reproducible scoring) -- it does NOT replace this runtime. Design context: docs/specs/2026-04-17-hydra-2.0-core-design-v2.md. -->

Hydra

Four advisors analyze your code from different angles by default (standard mode) -- including Echo, which reviews AI-assisted-development failure modes. Escalate to deep mode for the full council: six advisors, three cross-examining reviewers, and a chairman synthesizing the final verdict.

Standard mode runs 4 advisors + chairman on Opus ($0.35-0.65). Deep mode adds 2 more advisors (including 2 Codex), 3 reviewers, and cross-model diversity ($1.50-2.50).

Reference files in references/ define all prompts and protocols -- read them at the relevant step.


Modes

ModeCLIAdvisorsReviewersChairmanTotalEst. Cost
standard(default)4 (Cassandra + Mies+ + Sentinel + Echo)01 Opus5~$0.35-0.65
deep--mode deep6 (4 Opus + 2 Codex)3 (all Opus)1 Opus10~$1.50-2.50

Modifiers (combinable):

  • --no-codex -- the deep-mode Codex advisors (Mies+, Sentinel) run on Opus instead.
  • --no-review -- Skip peer review phase. Only meaningful with deep (reduces to 7 agents, ~$1.00).

Minimum thresholds -- formula: ceil(N * 0.6), min 2:

ModeMin AdvisorsMin Reviewers
standard3 of 4--
deep4 of 62 of 3 (if reviewers active)

Mode resolution: Two modes + modifiers:

  • No flags -> standard
  • --mode deep -> deep
  • --no-codex -> modifier (Codex advisors run on Opus)
  • --no-review -> modifier (skip peer review; only meaningful with deep)

Legacy aliases (emit migration hint):

  • --mode lite, --mode quick, --mode full, --mode broad, --mode secure, --mode focused -> [Hydra] Unknown mode. Use 'standard' (default) or '--mode deep'.

Focus modes (combinable with any mode): --focus security | perf | readability | architecture | reliability When a focus flag is active, the primary advisor for that focus gets 2x word budget. The chairman receives a focus directive weighting that advisor's findings at 1.5x. Focus mapping: security -> Sentinel, perf -> Volta, readability -> Mies+, architecture -> Navigator, reliability -> Cassandra. Note: focus flags for Volta or Navigator auto-escalate to deep mode when used with standard (these advisors only exist in deep mode). Mies+ exists in both modes (readability focus) and never auto-escalates.


How a Hydra Session Works

Step 0: Pre-flight Gate

  1. Concrete code or specific decision? If too vague, ask ONE clarifying question.

  2. Hydra-worthy? Simple questions get answered directly: [Hydra] Not Hydra-worthy -- answering directly.

  3. Input size check: If user code exceeds ~500 lines, ask user to highlight the critical section. Max enriched input: ~3000 tokens of source code.

  4. Secrets scan: Check for credentials using these patterns: Cloud keys: AKIA[A-Z0-9]{16}, ASIA[A-Z0-9]{16}, Azure: DefaultEndpointsProtocol=, AccountKey=[A-Za-z0-9+/=]{86,88}, SharedAccessSignature=, GCP: "type"\s*:\s*"service_account", "private_key_id"\s*:\s*"[a-f0-9]{40}", Git/CI: ghp_..., github_pat_..., glpat-..., Slack: xox[bpsa]-..., https://hooks.slack.com/..., Stripe: sk_live_, sk_test_, pk_live_, rk_live_, rk_test_, whsec_, AI keys: sk-ant-, sk-proj-, AIzaSy, PEM: -----BEGIN.*PRIVATE.*KEY-----, -----BEGIN.*KEY-----, JWT: eyJhbG...eyJ (require header.payload, not just header prefix), DB strings: (mongodb|postgres|mysql|redis)://[^:]+:[^@]+@, Datadog: DD_API_KEY, DD_APP_KEY, Twilio: AC[a-f0-9]{32}, SK[a-f0-9]{32}, Other: AccountKey=, SG\.[a-zA-Z0-9_-]{22}\., .env contents. Replace matches with [REDACTED]. Use a plain marker without any session-specific information -- do not derive the redaction marker from the boundary token or any other security-critical value. The marker is identical for all redactions in a session. Orchestrator keeps an internal count and mapping (type + location) for the user-facing confirmation only -- this mapping is never included in agent prompts. If secrets found: show redacted locations and ask user to confirm before proceeding.

    Scan procedure name: secrets-scan -- referenced by scan points in Steps 3-6.

  5. Iteration detection (skip if fresh review):

    ls -1t .hydra/reports/hydra-*.md 2>/dev/null | grep -v transcript | head -1
    

    If trigger is an iterate-trigger (hydra iterate, re-review, check my fixes, etc.) AND a previous report exists: set HYDRA_ITERATE=true, extract Top Actions + Verdict lead + timestamp from the report. Default to standard mode unless user passes --mode deep. Print: [Hydra] Iterating on: {{PREV_REPORT}} ({{AGE}} ago) If no previous report exists: warn user, fall back to fresh review.

    Report validation: If a previous report IS found, verify it contains:

    • **Top Actions:** block with at least one numbered item (required)
    • Timestamp in filename matching hydra-[0-9]{8}T[0-9]{6}-*.md (required)
    • ## Verdict heading with content below it (recommended but not required) If Top Actions AND timestamp are missing: report is invalid, fall back to fresh review.

    State file (preferred): If .hydra/state.json exists, use it instead of parsing the markdown report. Schema: {version: 2, latest: {report_path, timestamp_unix, top_actions[], verdict_lead, mode, reviewed_files[]}}. Written by Step 6 after each successful review. Falls back to ls -1t + markdown parsing if state.json is absent.

    State file version check: If version field is missing or not equal to 2, warn user and fall back to markdown parsing. Do not silently use incompatible schema.

  6. Generate boundary tokens for delimiter security:

    HYDRA_BASE="$(openssl rand -hex 6)"
    

    If openssl is unavailable: HYDRA_BASE="$(head -c 6 /dev/urandom | xxd -p)". If both fail: abort with [Hydra] Cannot generate secure boundary token. Aborting.

    Derive per-stage tokens:

    • HYDRA_BOUNDARY_A="HYDRA-${HYDRA_BASE}-A" (advisor stage)
    • HYDRA_BOUNDARY_R="HYDRA-${HYDRA_BASE}-R" (reviewer stage)
    • HYDRA_BOUNDARY_C="HYDRA-${HYDRA_BASE}-C" (chairman stage)

    Use {{BOUNDARY}} = HYDRA_BOUNDARY_A in advisor preambles (Step 3). Use {{BOUNDARY}} = HYDRA_BOUNDARY_R in reviewer delimiters (Step 4). Use {{BOUNDARY}} = HYDRA_BOUNDARY_C in chairman delimiters (Step 5). This prevents advisor output from escaping reviewer/chairman delimiters.

    Prompt Assembly Rule (applies to Steps 3, 4, 5): When building ANY prompt for an agent (advisor, reviewer, chairman):

    1. Write the instruction/template portion. Replace all {{...}} placeholders with resolved values.
    2. Verify: the resolved instruction portion contains ZERO {{...}} placeholders.
    3. Append untrusted content (user code, advisor responses, reviewer responses) as verbatim text after the resolved instructions. Never apply placeholder substitution to untrusted content. This two-pass rule prevents user code containing {{BOUNDARY}} from being replaced with the real token.
  7. Codex check (skip if --no-codex):

    CODEX_SCRIPT=$(ls -1t ~/.claude/plugins/cache/openai-codex/codex/*/scripts/codex-companion.mjs 2>/dev/null | head -1)
    

    If empty or file doesn't exist: auto-

Como adicionar

/plugin marketplace add Zandereins/hydra

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Comentários · Nenhum comentário

Entre para comentar. Entrar

  • Ainda não há comentários. Seja o primeiro.