|
| 1 | +# Agent Pattern Cheat-Sheet (project-agnostic, English canonical) |
| 2 | + |
| 3 | +Lookup-style add-on to your repo's `.claude/CLAUDE.md`. Read this before |
| 4 | +prompting any multi-agent work. Companion knowledge files under |
| 5 | +`.claude/EN/knowledge/` and `.claude/EN/agents/`. |
| 6 | + |
| 7 | +> Source: distilled from `AdaWorldAPI/WoA` `.claude/CLAUDE.md` §3.5 + §3.6 |
| 8 | +> as of 2026-05-17. Reference implementations: `WoA` (Python), `woa-rs` |
| 9 | +> (Rust), `lance-graph` (Rust, most mature), `ndarray` (Rust, compact). |
| 10 | +
|
| 11 | +--- |
| 12 | + |
| 13 | +## 1. Compressed baseline |
| 14 | + |
| 15 | +``` |
| 16 | +12 workers + 1 coordinator · autoattended · full authorization · auto-resolve · log all issues |
| 17 | +plan/preflight → review → correct → sprint → review code → fix P0 → commit → repeat |
| 18 | +``` |
| 19 | + |
| 20 | +## 2. Agent ensemble — Function · Activation · Card |
| 21 | + |
| 22 | +| Function | Activation | Card | |
| 23 | +|---|---|---| |
| 24 | +| Worker-Impl | Sprint Phase 3 spawn out of `SPRINT-N-PLAN.md`-bundle row | `.claude/EN/agents/worker-template.md` | |
| 25 | +| Meta-Agent (13th) | Phase 2 plan review + Phase 4 code review + continuous inbox-drain | `.claude/EN/agents/meta-agent.md` | |
| 26 | +| PP-13 brutally-honest-tester | "about to commit" / "PR diff touches code" | `.claude/EN/agents/brutally-honest-tester.md` | |
| 27 | +| PP-14 convergence-architect | PRE-PLAN divergent ideation (optional, see knowledge/autoattended-multi-agent-pattern.md §3) | — | |
| 28 | +| PP-15 baton-handoff-auditor | "cross-crate types" / "DTO match" / "lib.rs / mod.rs touch" / "sprint handover" / "ID collision" | `.claude/EN/agents/baton-handoff-auditor.md` | |
| 29 | +| PP-16 preflight-drift-auditor | "before sprint spawn" / "preflight check" / "verify spec against main" | `.claude/EN/agents/preflight-drift-auditor.md` | |
| 30 | + |
| 31 | +Full specs in `.claude/EN/agents/<role>.md`. Pattern theory in |
| 32 | +`.claude/EN/knowledge/autoattended-multi-agent-pattern.md`. Coordination |
| 33 | +primitives in `.claude/EN/knowledge/a2a-workarounds.md`. |
| 34 | + |
| 35 | +--- |
| 36 | + |
| 37 | +## 3. Reading-Depth-Ladder |
| 38 | + |
| 39 | +Anti-skim discipline as a lookup. **Default bias: read too deep rather |
| 40 | +than too shallow.** If in doubt, upgrade the depth; never downgrade. |
| 41 | + |
| 42 | +| Depth | When appropriate | Guardrail / Proof-of-Depth | |
| 43 | +|---|---|---| |
| 44 | +| `grep` (anti) | **NEVER** as primary read. Only as a symbol locator AFTER or PARALLEL to a real read. | If you grepped: declare `depth=grep`, **never** `depth=full`. Grep is not a substitute for reading. | |
| 45 | +| `sed -n` / `awk '/re/'` / `head` / `tail`-only (anti) | **NEVER** as primary read. Partial-range tools deliver lines without section context — hallucination trap. | If you used `sed -n '10,20p'`: declare `depth=sed-partial`, NOT `depth=full`. Use `Read(offset, limit)` with a clear anchor or read the whole file. Never claim a 5-line snippet means "file X read". | |
| 46 | +| `skim` | Huge file, you need ONE section located | Find anchor → read that section in full. Never claim you know the whole file. Output: only claims about the read section. | |
| 47 | +| `read` | File < ~500 lines, standard read | Top to bottom, no skips. For larger files: offset/limit chunks but actually read every chunk. | |
| 48 | +| `thorough read` (twice-full) | Iron Rules, INVARIANTS, RFCs, schema migrations, patches before live-apply | Read twice: once for comprehension, once for verification. Self-check: can I name 3 sections? | |
| 49 | +| `troubleshooting` | Known bug + error message | Error → grep symbol → READ function in full → READ caller(s). No spot-fix without call-site context. | |
| 50 | +| `fan-out research` | Cross-file pattern, refactor planning, audit across >5 files | Spawn an Explore subagent OR write a suspect list, then read each file fully. Inventory file as output. Never trust in-context inference alone. | |
| 51 | + |
| 52 | +### When → minimum depth |
| 53 | + |
| 54 | +| If you are about to… | …then at minimum | |
| 55 | +|---|---| |
| 56 | +| Read memory files (CONTEXT / JOURNAL / TODO) at session start | `thorough read` | |
| 57 | +| Read `.claude/CLAUDE.md` / `BOOT.md` / RFCs / INVARIANTS | `thorough read` | |
| 58 | +| Touch a schema / migration file | `thorough read` + check downstream drift detectors | |
| 59 | +| Open an unknown file for the first time | at least `read`, preferably `thorough` | |
| 60 | +| Pure symbol lookup ("where is `foo` defined?") | `grep` OK but then read the definition in full | |
| 61 | +| Triage a bug report | `troubleshooting` (error → grep → read function + caller) | |
| 62 | +| Plan a refactor / wave / audit | `fan-out research` (inventory file mandatory) | |
| 63 | +| You are unsure which depth | upgrade one rung | |
| 64 | + |
| 65 | +--- |
| 66 | + |
| 67 | +## 4. Lie-Detector — shallowness + drift detection |
| 68 | + |
| 69 | +> **P0 rule:** No claims without thorough comprehension of the subject |
| 70 | +> AND all adjacent context. |
| 71 | +> |
| 72 | +> **Cognitive frame (Kahneman/Tversky + Dunning-Kruger):** the problem is |
| 73 | +> NOT vagueness ("about 60 lessons") — that is **honest uncertainty** |
| 74 | +> (System 2 reporting in). The problem is **overconfidence**: a specific |
| 75 | +> claim without the read that would support it. System-1 "easy-path" |
| 76 | +> heuristic yields a plausible-sounding answer BEFORE System 2 verifies. |
| 77 | +> |
| 78 | +> **Trigger heuristic:** vague answer ("not sure") = honest → no trigger. |
| 79 | +> Confident false answer = lie-detector fires. Confident correct answer |
| 80 | +> without proof-of-read = also fires (luck vs. hallucination is |
| 81 | +> distinguishable only via LD-1..5). |
| 82 | +
|
| 83 | +Five concrete tests, cheap to expensive: |
| 84 | + |
| 85 | +| # | Test | How | Honest agent | Shallow agent | |
| 86 | +|---|---|---|---|---| |
| 87 | +| LD-1 | **Sentinel-Token** | Brief ends with: "If you have read this fully, begin your first reply with `<TOKEN>`" | replays token verbatim | token missing / wrong / paraphrased | |
| 88 | +| LD-2 | **Proof-of-Read with SHA** | Output must contain: `Read: file=X sha256=Y lines=Z depth=full` | SHA + line count match | SHA missing, wrong, or `<computed>` placeholder | |
| 89 | +| LD-3 | **3-sections name challenge** | "Name 3 sections from file X (heading + approx. line span)" | 3 concrete headings, plausible spans | vague theme labels, no real headings | |
| 90 | +| LD-4 | **Negative-knowledge test** | "Does file X say anything about topic Y?" — where Y is NOT in the file | "no, not contained" | hallucinates plausible-sounding content | |
| 91 | +| LD-5 | **Line-range quote** | "Quote lines N-M from file X verbatim" | exact quote OR "range does not exist (file only K lines)" | paraphrases, deviates, or refuses without reason | |
| 92 | + |
| 93 | +### Drift signals (passive detection, meta-agent duty) |
| 94 | + |
| 95 | +| Signal | What meta sees | Action | |
| 96 | +|---|---|---| |
| 97 | +| `depth=grep` on a semantic task | HANDOVER field mismatch | Re-dispatch with mandatory `depth=full` | |
| 98 | +| `depth=sed-partial` or `depth=head-only` on a semantic task | Partial-range tool abused as primary read | Re-dispatch; require SHA over the whole file | |
| 99 | +| `depth=full` without `sha256` | Proof field gap | Stop; agent must back-fill proof | |
| 100 | +| FINDING cites a non-existent section | LD-3 equivalent failed post-facto | P0 re-dispatch; tighten sentinel requirement | |
| 101 | +| FINDING is word-identical to a sibling agent's without cross-read note | Lockstep drift (both LLMs defaulted without real read) | Spot-check LD-5 on one of the two | |
| 102 | +| Opening output enumerates lessons with confidence ("62 lessons") WITHOUT proof-of-read on JOURNAL | Overconfidence trigger | Hard stop: agent must produce SHA + 3 L-numbers by name. Approximate count would have been OK (= honest uncertainty). | |
| 103 | +| Conjecture section contains what INVARIANTS clearly decided | INVARIANTS drift (not read) | Mandatory `thorough` re-read of INVARIANTS | |
| 104 | + |
| 105 | +**Burden of proof on suspicion lies with the agent:** never "explain |
| 106 | +away" suspicion — either produce the proof or honestly downgrade to |
| 107 | +`depth=skim/grep`. |
| 108 | + |
| 109 | +--- |
| 110 | + |
| 111 | +## 5. Cross-references |
| 112 | + |
| 113 | +- 6-step orchestrator loop, sprint sizing, 4-savant scope partition, |
| 114 | + worker iron rules → `.claude/EN/knowledge/autoattended-multi-agent-pattern.md` |
| 115 | +- File-blackboard, branch pub/sub, role-teleportation, structured |
| 116 | + handovers → `.claude/EN/knowledge/a2a-workarounds.md` |
| 117 | +- Worker brief slots → `.claude/EN/agents/worker-template.md` |
| 118 | +- Meta-agent role + inbox protocol → `.claude/EN/agents/meta-agent.md` |
| 119 | +- Post-impl quality gate → `.claude/EN/agents/brutally-honest-tester.md` |
| 120 | +- Cross-boundary audit → `.claude/EN/agents/baton-handoff-auditor.md` |
| 121 | +- Pre-spawn drift check → `.claude/EN/agents/preflight-drift-auditor.md` |
0 commit comments