Skip to content

Latest commit

 

History

History
118 lines (78 loc) · 4.02 KB

patterns.md

File metadata and controls

118 lines (78 loc) · 4.02 KB

Crucible Patterns

Five orchestration patterns. Each maps to a command; P2b runs via /crucible:build --codex-impl (recipe details in the crucible-companion skill).


P1 — Find → Adversarial Verify

Commands: /crucible:review, /crucible:ship

Claude identifies issues. The configured verifier — Codex, Gemini, Antigravity/AGY, or both via /crucible:config --verifier or a per-run --verifier — tries to refute each one. A finding is kept when the verifier fails to refute it (refuted === false); verifier errors count as no data, never as refutation.

Claude finds N findings
  └─▶ parallel: configured verifier(s) try to refute each
        │
        ▼
  Keep only: refuted === false and no error sentinel

Use when: reviewing a diff, PR review, quick code check before committing.


P2 — Plan → Implement → Verify

Command: /crucible:build

antigravity selects the minimal skill set for the task. Claude implements. Configured verifier(s) check that the output meets the spec.

antigravityNode → skill selection
  └─▶ Claude implements (with selected skills)
        └─▶ configured verifier(s) check correctness

Use when: implementing a new feature, refactoring a module.


P2b — Parallel Codex Implementation

Command: /crucible:build --codex-impl — the --codex-impl flag is defined by /crucible:build and runs the P2b recipe from the crucible-companion skill.

Two Codex nodes independently implement the same spec in isolated git worktrees. Claude acts as the jury, picking the better implementation.

parallel:
  Codex node 1 (worktree A) → implements
  Codex node 2 (worktree B) → implements
      │
      ▼
  Claude judges: picks best, explains why

Use when: you want a non-Claude perspective on implementation, or when the best approach is unclear.


P3 — Loop-Until-Dry

Command: /crucible:audit

Iterates find→verify rounds until a round adds zero new confirmed findings. Capped at 4 rounds to prevent runaway cost.

round 0: find → verify → N confirmed, tracked in seen set
round 1: find (skip seen) → verify → M new confirmed
round 2: find → 0 new → STOP

Each finding gets a stable ID. seen set prevents re-discovering the same issue.

Use when: security audit, preparing for a major release, deep code review.


P4 — 3-Model Judge Panel

Command: /crucible:bench

All three models propose a solution independently. Then all three judge each other's proposals. The proposal with the highest average score wins.

parallel generation:
  Claude (bias: simplest)
  Claude (bias: de-risk hardest unknown)
  Codex (bias: most robust)
  Gemini/AGY (bias: preferred approach)

parallel judging (score 0..10):
  each candidate judged by: Claude + Codex + Google-family verifier
  average score = (valid_juror_scores) / count

winner = highest avg, with best ideas from runners-up grafted in

Jurors that error (_codex_error, _gemini_error, _antigravity_error) are excluded from averages — never counted as 0.

Use when: architectural decision, complex implementation with multiple valid approaches, "what would three different AI companies do?"


Error handling

Sentinel Meaning Action
_codex_error: true Codex CLI failed or timed out Exclude from averages, treat as no data
_gemini_error: true Gemini CLI failed or timed out Exclude from averages, treat as no data
_antigravity_error: true Antigravity/AGY CLI failed or timed out Exclude from averages, treat as no data
_crucible_error: true No verifier CLI available (auto mode, none detected) Continue only as unverified Claude-only output; surface a clear warning to the user

A single-model error never fails the whole workflow. Crucible degrades gracefully.

Filter sentinels before aggregating results:

const valid = results.filter(r => r && !r._codex_error && !r._gemini_error && !r._antigravity_error && !r._crucible_error)