PLUGIN brewcode / Skills

teams-setup opus generator

A generic agent takes any task and is expert at none, and a frontend task routed to the wrong specialist loses domain context and picks the wrong tools. A domain team gives each area its own owner. /brewcode:teams-setup install analyzes the codebase, proposes a team (Minimal / Balanced / Maximum), creates each agent with quorum-reviewed scaffolding, and writes a trace.jsonl log that upgrade uses to tune the team.

Terminal animation: install a payments team for a sample repo, run a task across the owning agents, then read the per-agent status table
Illustrative animation: install a team, describe a task, owning agents take it in parallel, status shows health per agent. Project and agent names are invented.

View README on GitHub (opens in a new tab)

Quick reference

FieldValue
Command/brewcode:teams-setup
Arguments[prompt] [status|install|upgrade|enable|disable|uninstall|purge] [name] [--unattended]
No-arg defaultstatus of the first existing team; install of a team named default when none exists
Modelopus
Output.claude/agents/*.md + .claude/teams/<name>/ (team.md, trace.jsonl, trace-ops.sh)

[name] is positional after the canonical modes. In a bare mode [name] pair the verb comes first, so install enable creates a team named enable; in a sentence the name comes from the text (“disable the payments team” names payments).

When to use

ScenarioCommand
New project onboarding/brewcode:teams-setup install my-team
A domain keeps producing poor results/brewcode:teams-setup upgrade my-team
Check team health/brewcode:teams-setup status my-team
Pause or remove a teamdisable, uninstall, purge

Modes

ModeDoes
statusRead-only health report: success rates, open issues, insights
installAnalyze, propose, create agents, review, set up framework
upgradeRead trace data, tune or replace underperformers
enableRestore parked <agent>.md.disabled files
disablePark agent files; nothing deleted
uninstallArchive trace entries, remove inactive agents
purgeDelete agents and .claude/teams/<name>/; one confirmation

Under --unattended, upgrade does plumbing only (migration, re-copied scripts, header restamp, verify) and leaves tuning interactive (note="tuning not run"); see how the flag works.

Example

/brewcode:teams-setup install api-team "focus on REST API, auth and database layers"
/brewcode:teams-setup status api-team
/brewcode:teams-setup upgrade api-team

install ends with the full Team Status table: agents, tasks tracked, success rate, open issues.

How it works

  1. Parse + confirm

    Mode, name and prompt are extracted; the plan is shown before any change.

  2. Analyze

    3-5 Explore agents map structure, stack, CI/CD and domain boundaries in parallel.

  3. Propose

    Pick Minimal (5), Balanced (10-12) or Maximum (15-20) and a model for the domain agents.

  4. Create

    One agent-creator per agent file, in batches of 3-4; one intent-guard is added outside the batches.

  5. Review

    3 reviewers, 2/3 quorum, verification, fix, re-verify. Skip with --skip-review.

  6. Framework + status

    team.md, trace.jsonl and trace-ops.sh are written and checked by verify-team.sh.

Good to know

  • Each domain profile has six ordered headings: Mission, Owned surfaces, Exclusions, Must-load references, Unique invariants, Unique verification.
  • team.md stores intent_guard_policy=required|legacy-absent. A new team gets exactly one review-only intent-guard; upgrade never adds it to a legacy-absent roster.
  • enable and disable take effect next session, because agent discovery is read at session start.
  • Team names use ASCII letters, digits, - and _, with no leading dash; accented letters are rejected.
  • upgrade on a team with no tracking data classifies every agent Inactive: run some tasks first. status on an unknown name stops with Team not found.
  • The -setup suffix marks a skill that installs a mechanism (a roster in .claude/agents/) you use afterwards instead of the skill. All seven canonical modes are implemented.
  • Delegation: see Delegation.

Technical details

Mode details: enable, disable, purge #

disable renames each roster member’s .claude/agents/<agent>.md to <agent>.md.disabled. Claude Code stops discovering it; the body stays byte-identical and trace data are untouched. In team.md the parked rows get Status: disabled and the header is restamped by a script that also updates the cells verify-team.sh pins to it (Agent defaults, the intent-guard Updated and Version). verify-team.sh reports DISABLED per parked member and still passes. enable reverses it: the rows return to active and the header is restamped. When the header has a missing or out-of-order row, the restamp writes nothing and the skill suggests upgrade.

intent-guard is skipped (SKIP:intent-guard (shared with superreview-setup)), as is any agent another generator owns. disable hard-fails when it cannot parse the ## Agents table, and roster ids must match ^[a-z0-9][a-z0-9-]*$.

purge removes <agent>.md and <agent>.md.disabled, then .claude/teams/<name>/ including trace-archive.jsonl. It keeps .claude/agents/intent-guard.md (shared with /brewcode:superreview-setup) and stops when the team name does not exist. Mode keywords are guarded: purge is never read as a team name.

Flow details and step codes #
CodeStep
C1Project analysis, 3-5 Explore agents
C2 / C2.5Proposal, 3 variants, user confirmation; model choice (opus / sonnet / haiku / mixed)
C2.6team.md + trace.jsonl + trace-ops.sh, before any agent
C3agent-creator x N, batches of 3-4; then brewtools:text-optimize in light mode (-l --allow-dirty) on each batch when brewtools is available, keeping the six headings, never on intent-guard.md
C3-IGrequired: emit or reuse intent-guard; legacy-absent: nothing
C4Final roster + verify-team.sh; copies trace-ops.sh, stops if the copy fails
C5-C9Quorum review, 2/3 consensus, cross-check against files, fix critical and important findings, re-verify (max 2 cycles)
E1 / E2Optional CLAUDE.md Teams section; final status (purge: summary)

Run the review alone with /brewcode:teams-setup upgrade <name> --review.

intent-guard #

A fixed review-only member outside the domain-agent count; choosing “Custom” cannot drop it. It is an anti-drift check: it compares what was ASKED with what was DELIVERED and reports the delta. It is not a code reviewer.

PolicyRosterUpgrade
requiredExactly one intent-guard rowPreserve it, never duplicate
legacy-absentZero rowsPreserve absence, never create
PropertyValue
ToolsRead-only: Read, Glob, Grep, Bash
Modelsonnet, fixed by its template
InvocationExplicit, by name, at review time only; never an implementation owner
SourcesFive tiers; tier 1 (ticket, thread, verbatim request) wins; sources are never invented
EvidenceTranscript, file names, git diff --stat, manifests, doc headings; no builds or tests
OutputALIGNED / MINOR DRIFT / MAJOR DRIFT plus up to 10 findings

teams-setup never writes the file. It runs superreview-setup/scripts/generate.sh emit-agent, which prints INTENT_GUARD: CREATED|REUSE|MIGRATED <path>. A usable existing file (non-empty, name: intent-guard, no unresolved placeholders) is reused untouched; on CREATED, one agent-creator pass tailors three seeded blocks (project invariants, drift examples, evidence commands).

It is excluded from quorum review, implementation ownership, the uninstall inactive sweep (it writes no trace) and text-optimize. verify-team.sh only warns on a legacy team missing the row; a listed row with no file is a FAIL.

Agents owned by another generator #

.claude/agents/ is project-global, so a roster can list an agent another setup generated. The owner comes from the generated_by stamp; the name task-tracker always belongs to /brewtools:task-board-setup.

StepBehavior
installName dropped from every variant; an agent owned by another team is reported as taken and a distinct name is proposed
enable / disableSkipped, never moved
verify-team.shFOREIGN warning, counted in FOREIGN_AGENTS:<N>, still passes
upgradeDrops the roster row; the file is never touched
purgeKeeps the file (kept: owned by <plugin>:<skill>)

A legacy roster that lists task-tracker: run upgrade <name> once to remove the row.

Tracing and upgrading old teams #

Every agent logs what it took, refused, completed or failed to .claude/teams/<name>/trace.jsonl; status and upgrade read nothing else. Agents call a project-local tracer:

bash ".claude/teams/<name>/trace-ops.sh" add ".claude/teams/<name>" "$SID" "<agent>" "track" "took" "<task>"

The path is repo-relative because ${CLAUDE_PLUGIN_ROOT} is not substituted in .claude/agents/ files.

Teams created before 4.0.0 trace nothing

Their agents point at a dead plugin path, so status reports 0 tasks and upgrade classifies the roster as Inactive. Run /brewcode:teams-setup upgrade <name> once: the copy of trace-ops.sh is idempotent. verify-team.sh warns and prints the fix.

Guardrails in every team agent #
GuardrailApplies toSays
Return ContractEvery team agentVerdict first, at most 30 lines, path:line, no bodies or logs; bulk goes to .claude/reports/<YYYYMMDD-HHMMSS>_<name>/. /brewtools:agent-return-setup enforces it by token budget
Scope FitCode, script, SQL, schema, infra domainsBuild for today’s scale; one simplicity pass at the end
Etalon-firstSame domainsCopy the closest well-built counterpart in the repo, in addition to conventions
Anti-drift reviewintent-guard onlySee intent-guard

agent-creator removes Scope Fit and Etalon-first together for research, docs and review-only members. verify-team.sh warns, never fails, on a legacy team missing the Return Contract; upgrade re-adds it.

Framework files, versions, health #
FilePurpose
team.mdRoster, domains, missions, status. At most 2800 characters and 700 o200k_base tokens for 13 domain rows; each row past 13 adds 80 characters and 20 tokens (20 agents: 3360 / 840). intent-guard not counted
trace.jsonlAppend-only JSONL: tasks, issues, insights
trace-ops.shTracer copied at install, re-copied on upgrade; deleted by purge, kept by uninstall
trace-archive.jsonlWritten by uninstall; deleted by purge

Version stamps: team.md rows Version, Content version, Generated by, Last update (rewritten by one restamp script in upgrade, enable and disable, together with the cells verify-team.sh pins to them); agent frontmatter doc_type, version, generated_by, last_updated. detect-mode.sh reads .claude-plugin/plugin.json and exits 1 (ERROR:cannot resolve plugin version) rather than stamping a fake value. /brewcode:setup-status flags older stamps.

HealthCriteriaAction
Green>70% success, activeNone
Yellow30-70% success or many refusalsTune via upgrade
Redunder 30% success or inactiveReplace or remove via upgrade

Agents accept a task only after three checks (domain, duplicate, best fit) and refuse with a colleague suggestion otherwise. Name and base role are immutable (delete and recreate); character and instructions are tunable. Other skills resolve agents in this order: team agent > project agent > plugin specialist > system agent (Explore, Plan, general-purpose). A refusing agent is re-delegated to the next level, max 2 retries, then system agents. intent-guard is outside this chain under required.

agents

Create individual domain agents with the same scaffolding.

setup-status

Dashboard across every -setup skill; upgrade brings the stale ones current.

Brewcode overview

All brewcode skills.

Update: /brewtools:plugin-update, /reload-plugins, then /brewcode:setup-status upgrade - FAQ