Agent Workflows
Pre-built ADWs (trigger → deploy)
- Feature Build: decompose → build → test → review → PR
- Bug Fix: reproduce → diagnose → fix → verify → commit
- Chore: apply → lint → test → auto-merge
- Code Review: read diff → analyze → report
- Research Spike: research → summarize → recommend
The 5-part agent contract — name · soul · job · keys · stop
Define every agent as five load-bearing parts in .claude/agents/<name>.md (frontmatter
name / description / tools:; body ## SOUL / ## JOB / ## KEYS / ## STOP). Exactly
five — a sixth ("metrics dashboard", "personality archetype") only dilutes the soul.
- Name — kebab-case handle you'll type 100×. Lowercase, dashes, no cuteness.
- Soul — 4–6 sentences of permanent identity: voice, what it cares about, what it
refuses to do. Inherited every run — this is what kills generic output. Fix voice by
editing the SOUL file, never the prompt (prompt fixes evaporate at session close).
- Job — ONE sentence mission with an explicit "do NOT" clause. Won't fit one sentence →
not scoped, split it. "Sort unread mail into URGENT/RESPOND/FYI/IGNORE, draft 2-line
replies for URGENT" is a job; "help with my inbox" is a wish.
- Keys — which tools + folders it may touch (set via
tools:). Tight by default,
loosened on purpose — fewest tools that do the job, add one back only when needed.
- Stop — how it knows it's done, as something it can literally check ("3 files exist in
/drafts/[date]/, summary printed"). Vague = wandering; measurable = clean exit.
Scoping formula — scope · steps · guardrails · report-back
Every brief carries four ingredients: exact scope (which files/folder, nothing wider); steps
in order in plain words; guardrails (explicit "must not"); report-back (what it shows you so
you stay the approver). Test: could you hand the brief to a new assistant and walk away? If
not, it's not scoped yet.
Promotion ladder — hand-run → /loop → scheduled
An agent earns automation after 5 clean hand-run executions in a row — not 3, not "it
worked once." Trust is an observation count; runs 1–2 could be luck, by 4–5 you've seen the
weird-data week.
- L1 hand-run — you type the command. Every agent starts here.
- L2
/loop — runs while your session is open, Esc reachable. Where most agents live
for weeks; the test track. (/loop auto-expires after 7 days.)
- L3 scheduled — runs on the server, laptop closed. Only for proven, boring,
drafted-output agents. Anything that sends / posts / pays / deletes stays L2 or gets a
human-approval hook baked in.
- Graduation checklist: confirm 5 logged clean runs · lock SOUL+JOB (unchanged across them) ·
add a heartbeat log line per run · set a weekly log-review cadence.
4-way break diagnostic
"My agent doesn't work" is almost always one of four — and 4 of the 5 are FILE problems, not
prompt problems. Open the .md first, the chat second.
- Soul drift ("doesn't sound like me") → SOUL too thin. Rewrite with real voice samples
- Scope creep ("did too much") → KEYS gave unneeded tools + JOB lacked a "do NOT". Strip
tools, add the DO-NOT line.
- Wandering ("ran 20 min, produced mush") → no / vague STOP. Add a measurable stop + a
tool-or-time budget ("if >5 tool calls, pause and ask").
- Silent failure ("said done, nothing there") → a hook blocked it, or wrong path/perms.
ls the real folder yourself; check the hook log + KEYS. Add a self-verify to STOP.
- Bonus — context bleed (tone shifts mid-run): the orchestrator forwarded too much
history; brief subagents with only the input they need.
Rules
- Keep the roster to 3–5 agents; delete any not run in 30 days.
- Every external action keeps a human approval gate; silence defaults to reject.
- Bottle a wrapper into
.claude/commands/<name>.md (with $ARGUMENTS) only after it runs
cleanly twice — the slash command is the celebration, not the attempt.
1---2name: agent-workflow3description: Use when defining, scoping, promoting, or debugging an agent or ADW — the 5-part agent contract, scoping formula, promotion ladder, and 4-way break diagnostic.4---56# Agent Workflows78## Pre-built ADWs (trigger → deploy)91. Feature Build: decompose → build → test → review → PR102. Bug Fix: reproduce → diagnose → fix → verify → commit113. Chore: apply → lint → test → auto-merge124. Code Review: read diff → analyze → report135. Research Spike: research → summarize → recommend1415## The 5-part agent contract — name · soul · job · keys · stop16Define every agent as five load-bearing parts in `.claude/agents/<name>.md` (frontmatter17`name` / `description` / `tools:`; body `## SOUL` / `## JOB` / `## KEYS` / `## STOP`). Exactly18five — a sixth ("metrics dashboard", "personality archetype") only dilutes the soul.19201. **Name** — kebab-case handle you'll type 100×. Lowercase, dashes, no cuteness.212. **Soul** — 4–6 sentences of permanent identity: voice, what it cares about, what it22 refuses to do. Inherited every run — this is what kills generic output. Fix voice by23 editing the SOUL file, never the prompt (prompt fixes evaporate at session close).243. **Job** — ONE sentence mission with an explicit "do NOT" clause. Won't fit one sentence →25 not scoped, split it. "Sort unread mail into URGENT/RESPOND/FYI/IGNORE, draft 2-line26 replies for URGENT" is a job; "help with my inbox" is a wish.274. **Keys** — which tools + folders it may touch (set via `tools:`). Tight by default,28 loosened on purpose — fewest tools that do the job, add one back only when needed.295. **Stop** — how it knows it's done, as something it can literally check ("3 files exist in30 /drafts/[date]/, summary printed"). Vague = wandering; measurable = clean exit.3132## Scoping formula — scope · steps · guardrails · report-back33Every brief carries four ingredients: exact scope (which files/folder, nothing wider); steps34in order in plain words; guardrails (explicit "must not"); report-back (what it shows you so35you stay the approver). Test: could you hand the brief to a new assistant and walk away? If36not, it's not scoped yet.3738## Promotion ladder — hand-run → /loop → scheduled39An agent earns automation after **5 clean hand-run executions in a row** — not 3, not "it40worked once." Trust is an observation count; runs 1–2 could be luck, by 4–5 you've seen the41weird-data week.42- **L1 hand-run** — you type the command. Every agent starts here.43- **L2 `/loop`** — runs while your session is open, `Esc` reachable. Where most agents live44 for weeks; the test track. (`/loop` auto-expires after 7 days.)45- **L3 scheduled** — runs on the server, laptop closed. Only for proven, boring,46 drafted-output agents. Anything that sends / posts / pays / deletes stays L2 or gets a47 human-approval hook baked in.48- Graduation checklist: confirm 5 logged clean runs · lock SOUL+JOB (unchanged across them) ·49 add a heartbeat log line per run · set a weekly log-review cadence.5051## 4-way break diagnostic52"My agent doesn't work" is almost always one of four — and 4 of the 5 are FILE problems, not53prompt problems. Open the `.md` first, the chat second.541. **Soul drift** ("doesn't sound like me") → SOUL too thin. Rewrite with real voice samples55 + banned words.562. **Scope creep** ("did too much") → KEYS gave unneeded tools + JOB lacked a "do NOT". Strip57 tools, add the DO-NOT line.583. **Wandering** ("ran 20 min, produced mush") → no / vague STOP. Add a measurable stop + a59 tool-or-time budget ("if >5 tool calls, pause and ask").604. **Silent failure** ("said done, nothing there") → a hook blocked it, or wrong path/perms.61 `ls` the real folder yourself; check the hook log + KEYS. Add a self-verify to STOP.62- Bonus — **context bleed** (tone shifts mid-run): the orchestrator forwarded too much63 history; brief subagents with only the input they need.6465## Rules66- Keep the roster to 3–5 agents; delete any not run in 30 days.67- Every external action keeps a human approval gate; silence defaults to reject.68- Bottle a wrapper into `.claude/commands/<name>.md` (with `$ARGUMENTS`) only after it runs69 cleanly twice — the slash command is the celebration, not the attempt.