Avengers — a design-then-build multi-agent workflow for Claude Code

A Claude Code plugin that runs specialised agents through a design → plan → build → review loop, with a long-term memory they share across runs:
| Agent | Role | Frontmatter default | Notes |
|---|
| Bruce | Rigorous design partner; final correctness review | claude-sonnet-5-5 | /avengers:avengers bumps this to opus (effort high) for HIGH-route debate and for review when unresolved critical-reasoning risk carries over |
| Tony | Bold design partner; final complexity review (Ponytail Review) | claude-sonnet-5-5 | Review pass runs on haiku |
| Thor | Neutral mediator when Bruce and Tony can't converge | opus | effort: high |
| Steve | Turns the converged design into an ordered, scrutinized plan | claude-sonnet-5-5 | |
| Reed | Implements the plan with bundled Ponytail; runs fix cycles | claude-sonnet-5-5 | |
| Friday | Memory librarian: filters, merges, and verifies past knowledge | claude-sonnet-5-5 | Only runs during /avengers:avengers migrate; read-only |
/avengers:avengers picks the actual per-step model by route (see commands/avengers.md) — the table above is each agent's frontmatter default, used when you call an agent directly.
How it works
- A deterministic router classifies the task as SMALL / MEDIUM / HIGH (risk flags override the complexity score).
- Bruce and Tony debate over a small, versioned canonical state using
ACCEPT / PATCH / BLOCK deltas. A dependency-free Node engine validates and applies each delta, so the agents never replay a transcript.
- If the debate runs out of calls or hits an unresolved
BLOCK, Thor summarises both positions and passes the decision to you.
- Steve plans from the final state, and Reed builds it.
- Bruce (correctness) and Tony (complexity) review the result and run a bounded fix loop.
The deterministic parts (patch validation, versioned approval, convergence, debate budgets, routing) live in tested code in scripts/state.js. The agents handle the parts that need judgment.
Token gate
A PostToolUse hook (hooks/hooks.json) runs scripts/truncate-tool-output.js on every Bash tool call. If combined stdout+stderr exceeds ~8,000 characters, it trims the output back to ~8,000 characters in total: the budget is split between stdout and stderr (a short stream passes through whole and gives its unused share to the other), and each stream that's over its share keeps its start and end with a [... N chars / ~M tokens omitted ...] marker in the middle — deterministic truncation, no summarization, no network calls. Any internal error, non-Bash tool, or already-small output leaves the original output untouched (fail open).
The hook runs for every Bash call in the session, not only during /avengers:avengers. To change that, set these in your environment or in the env block of settings.json:
AVENGERS_TRUNCATE=off turns the gate off, for when you need full logs.
AVENGERS_TRUNCATE_CHARS=20000 changes the ~8,000-character budget.
Skills: harvest and hint
After a successful run, /avengers:avengers checks whether the run produced reusable, repo-specific know-how (a procedure, a gotcha that cost a fix cycle, a verification recipe). If it did, it drafts a skill, or an edit to a similar existing one, and writes it to .claude/skills/<name>/SKILL.md only after you approve it. Most runs produce nothing.
A long skill list can bury the relevant skill in the middle of the context. To prevent that, a UserPromptSubmit hook runs scripts/skills.js on every prompt you send. It scores the skills in .claude/skills/ and ~/.claude/skills/ by their name, keywords and description, then adds up to 3 matches right next to your prompt. Matching is plain word matching with no AI and no network calls: ASCII terms must match whole words, and other text (such as Thai) matches as a substring. Any error adds nothing (fail open). /avengers:avengers runs the same match in Step 0 and passes the skill paths to Steve and Reed, because subagents don't see the hook.
AVENGERS_SKILL_HINT=off turns the hint off.
- Add a
keywords: [..] line to a skill's frontmatter to make matching sharper.
- Try it yourself:
node plugins/avengers/scripts/skills.js match "deploy to staging".
Memory vault (Obsidian-compatible)
Decisions, facts, and gotchas live as plain Markdown notes in a vault outside your repo, at ~/Documents/AvengersVault by default. Open that folder in Obsidian to browse, edit, and graph it; Obsidian is optional.