agents opus
Prompt-driven
What's new in 6.2.0
Agent and hook references were refreshed through Claude Code 2.1.285. They distinguish execution surfaces, plugin-ignored fields, and event-specific hook contracts — see Reference files.
Quick reference
| Field | Value |
|---|---|
| Command | /brewcode:agents |
| Input | free-form prompt; empty defaults to read-only status |
| Specialist | brewcode:agent-creator |
| List source | .claude/agents/, ~/.claude/agents/, ${CLAUDE_PLUGIN_ROOT}/agents/ (shipped, read-only) |
| Model | opus |
When to use
- Check the status of all agents across project and global scopes
- Create a new agent from a plain-English description
- Improve an existing agent’s trigger phrases or system prompt
- Review an agent for quality, focus, and trigger coverage
- Sync agent files against real code/CLAUDE.md/rules after a repo, session, or commit changed (memory sync)
- Batch-create or batch-improve a set of agents in one pass
Examples
/brewcode:agents
/brewcode:agents status of my agents
/brewcode:agents create a backend validator agent
/brewcode:agents improve reviewer
/brewcode:agents sync
/brewcode:agents синк по текущей сессии
How it works
- Input gate
Reads the complete free-text prompt. Empty input defaults to read-only status. An explicitly requested menu opens the menu; other prompts resolve a mode and target.
- Auto-mode select
Announces
Mode: <mode> (agents) — chosen because …based on keywords, intent, and target presence in the prompt. - Resolve material decisions once
Reuse supplied prompt/history answers. Read-only runs ask nothing unless you request a menu. Before writes, bundle unresolved decisions that change scope or output into one AskUserQuestion call, with at most four questions.
- Dispatch
Create, improve, and sync delegate through Agent to brewcode:agent-creator with bounded ownership and relevant context. Review uses the project’s reviewer or general-purpose fallback. Sync fans out one file per owner. After create/improve, the coordinator checks only the written file against the shared sync reference and applies verified corrections.
- Real status
Four blocks, never a flat list: inventory by scope (shipped plugin, read-only / plugin source, workspace-only / project / global — counts, names, load path), state (enabled or disabled via the
_name.mdtoggle marker, model), overlaps and conflicts (same name shadowed across scopes, duplicate triggers or descriptions), and health flags (missing README or frontmatter, agents missingBashintools:). - Final output
Prints a detection + result table: mode chosen, target, file path, model, scope, and CLAUDE.md update status. Suggests next steps such as
/reload-pluginsand a test invocation phrase.
Modes
| Mode | Trigger | Action |
|---|---|---|
| status | default for any “show me” intent — “статус”, “что есть”, “состояние” | Inventory by scope, state, overlaps, health flags |
| list | explicit only — “list” / “список” / “перечисли” | Globs *.md across .claude/agents/, ~/.claude/agents/, ${CLAUDE_PLUGIN_ROOT}/agents/ (shipped, read-only), plus brewcode/agents/ only inside the plugin workspace (test -d brewcode/.claude-plugin) |
| create | ”создай” / “create” / “new” / “добавь” / “scaffold” | Scaffolds a new agent file via agent-creator; asks scope, model, CLAUDE.md update |
| improve | ”улучши” / “improve” / “refactor” / “fix” / “почини”, or a bare existing <name|path> | Tunes description triggers and system prompt quality |
| review | ”ревью” / “review” / “validate” / “проверь корректность” | Single reviewer — the project’s agent from .claude/agents/, else general-purpose — two-phase: review, then double-check the findings |
| sync | sync, синк, memory sync, актуализируй, обнови знания, приведи в соответствие с кодом | Memory sync: rewrites agent files against ground truth via the shared reference; non-growth guaranteed |
| batch | auto-detected fan-out flag | Not a menu item — auto-detected from plural form, “все” / “all”, or multiple names/paths; triggers parallel delegation when creating or improving multiple agents |
Reference files
agent-creator and hook-creator used to carry all of this inline; it now lives in this skill’s
own references/ directory and each agent reads only the file it needs, on demand. 11 files, each
under 200 lines.
| File | Used by | Holds |
|---|---|---|
| agent-frontmatter-fields.md | agent-creator | AG file format, frontmatter field reference (incl. experimental.cacheTtl) |
| agent-scope-and-tools.md | agent-creator | Available tools, model precedence, scope rules |
| agent-context-and-execution.md | agent-creator | Subagent context inheritance, execution modes, resource limits |
| agent-template.md | agent-creator | Description budget, system-prompt structure, guardrails, validation checklist |
| agent-known-issues.md | agent-creator | Known bugs, limitations, version history, debugging |
| hooks-events.md | hook-creator | Session lifecycle order, 33-event table, matcher pattern syntax |
| hooks-io-contract.md | hook-creator | Stdin fields, message-routing matrix, exit codes, output schemas |
| hooks-types-config.md | hook-creator | 5 hook types and their config fields, precedence |
| hooks-env.md | hook-creator | Env vars, sensitive-path prompt, project-root resolution |
| hooks-templates.md | hook-creator | Bash/JS hook skeletons, fail-safe design rules, pre-ship checklist |
| hooks-changes.md | hook-creator | Changes through 2.1.285 and known contract limits |
Delegation
Ordinary subagents receive bounded context through the Agent prompt and cannot use AskUserQuestion; unresolved user decisions return to the main caller. Conversation forks retain parent history and tools. A skill’s context: fork is an ordinary subagent, not a conversation fork. Upstream nested-agent depth support does not override this project’s main-caller ownership of delegation, decisions, and acceptance. A partial maxTurns return is unfinished work, even when files were written; inspect checkpoint evidence before resuming or declaring completion.
Plugin agents ignore frontmatter hooks, mcpServers, permissionMode, and initialPrompt. Place plugin hooks in hooks/hooks.json; use the appropriate local/session surface when those agent fields are required. Local files and CLI JSON also have different supported fields. The hook references cover 33 events and five handler types with event-specific output and type support.
Why the rule exists
A big task handed to one agent = an agent gone for an hour: you cannot observe it, cannot correct it, and it usually drifts off-target.
One subagent = ONE bounded unit — here, ONE agent definition: roughly 5 files, roughly 10 steps. “Create the whole roster” is never one task; a batch is split into N spawns fired in ONE message, one agent-creator per agent file.
Every spawn prompt carries six fields. A bare one-line task is never enough:
| Field | Content |
|---|---|
| GOAL | the overall task and why it exists — the point beyond the file edit |
| ROLE | what this agent owns; what it must NOT touch |
| SCOPE | exact paths/commands in bounds + explicit out-of-bounds |
| CONTEXT | what is already done, by whom, what runs in parallel — trimmed to what THIS agent needs |
| CONSUMER | who or what uses the result next, and the shape it must fit |
| DONE | acceptance criteria + the exact report shape you want back |
For create, that means the specialist is told the scope and model were already decided (do not re-ask), which agents already exist and must not be duplicated, how many siblings run in parallel, and that its description line drops verbatim into the CLAUDE.md agents table row written right after it finishes.
Create / improve parameters
| Parameter | Options | Notes |
|---|---|---|
| Scope | Project / Global / Plugin | Project → .claude/agents/; Global → ~/.claude/agents/; Plugin → brewcode/agents/, offered only when test -d brewcode/.claude-plugin succeeds (the dev/plugin workspace) — elsewhere the option is dropped, since it would write a stray <cwd>/brewcode/agents/ |
| Model | sonnet / opus / haiku / inherit, or a verified supported model id | Inherit uses the caller’s model; choose from the current supported catalog rather than an assumed alias |
| CLAUDE.md update | yes / no | Adds or updates the agent row in the agents table; appends a new section if none exists |
| Improve focus | triggers / system prompt / both / full review | Asked for improve mode only |
| Description | Canonical budget ≤150 tokens, approximately 600 characters | Drives discovery; ≤100 characters is an optional brevity target, not a second required cap |
| Specialist | brewcode:agent-creator | Handles file scaffolding and prompt engineering; never writes under ${CLAUDE_PLUGIN_ROOT} — the installed plugin copy is read-only |
improve resolves the target across the writable scopes (project / global / plugin workspace) only.
A name that only matches under the shipped, read-only ${CLAUDE_PLUGIN_ROOT}/agents/ is reported and
the skill stops — it is never copied or edited.
Sync mode
| Scope | Meaning |
|---|---|
repo (default) | Whole working tree |
session | This conversation only — decisions, user corrections, bugs hit |
commit | git show/git diff <ref>, default HEAD |
Announced as Sync scope: <scope> — <evidence> | targets: <N> agents. Implemented in brewcode/skills/skills/references/mode-sync.md (steps S1-S6) via the constant SYNC_REF = ${CLAUDE_SKILL_DIR}/../skills/references/mode-sync.md — the same file /brewcode:skills sync runs, so the two rosters cannot drift apart.
Non-growth directive: each synced file ends <= its original line count; total delta <= 0. Any positive delta needs per-line justification. Order: DELETE first, then FIX, then ADD last.
Auto-dispatch after create/improve: once a create or improve completes, the same reference runs again scoped to only the file just written — S3 ground truth through S5 verdicts, folded into one row of the final report. No second agent-creator spawn: the coordinator applies every verdict itself with targeted Edit calls, since S4 fan-out is skipped for this scoped pass. A clean file reports one line: sync: no drift.
| Verdict | Action |
|---|---|
| STALE | Fix to minimal true form |
| DEAD | Delete, plus anything that only existed to explain it |
| DUPLICATE | Keep the single best location |
| OBVIOUS | Delete |
| DRIFT | Compress prose to a table row |
| MISSING | Add <= 1 line, only if verified against a real source and its absence costs a real failure |
Report: per-target table (File | Lines before → after | Fixed | Deleted | Added | Key change), stale facts corrected, added items with source, skipped agents, total delta.
rules
skills
memory-sync-setup
brewcode
GitHub source
Updating plugins
/brewtools:plugin-update to check and update the brewcode plugin suite in one command.
See the FAQ for details.