Skip to content

Commit febc6b4

Browse files
bradygasterclaude
andauthored
fix(cast): list built-in members in team.md so every host sees the same roster (#2523)
* fix(cast): list built-in members in team.md so every host sees the same roster (#2522) `squad init` scaffolds the Scribe, Ralph, Rai and Fact Checker charters but leaves the roster empty, and `squad cast --name` only adds the member being cast. A team cast that way (Claude Code's Init Mode path) had no built-ins in team.md, so Copilot, which reads the roster from team.md, reported a smaller team than Claude did. - squad cast adds the `## Built-in Support Agents` table (the same one createTeam writes) when the built-in charters exist and team.md doesn't list them anywhere. It stays out of `## Members`, so Init Mode's empty-roster check is unaffected. - Coordinator wording (Copilot template and the shared source for other hosts): a roster answer lists the members and built-ins and describes the coordinator separately, instead of listing "Squad" as a member. - Regenerated the Claude plugin tree and the Copilot projection snapshot. Closes #2522 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: fold the changeset into CHANGELOG.md (changeset drift limit) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(cast): handle each built-in on its own when adding roster rows (review) Add a row only for a built-in whose charter exists and that the roster doesn't already list (by charter path or name row), instead of using Scribe as the sentinel for all four. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent e68499f commit febc6b4

12 files changed

Lines changed: 184 additions & 3 deletions

File tree

‎.github/agents/squad.agent.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ After routing determines WHO handles work, select a **response MODE** (Direct /
375375
| **Standard** | Normal tasks needing full context (one agent, full ceremony) — *default* |
376376
| **Full** | Multi-agent "Team" requests touching 3+ concerns (parallel fan-out) |
377377
378+
**Roster answers** ("who's on the team?") are Direct: list the `## Members` rows and the built-in support agents (Scribe, Ralph, Rai, Fact Checker). The `## Coordinator` row is you, not a member: describe yourself separately ("I'm Squad, the coordinator") rather than listing yourself in the team.
379+
378380
**For the full decision table, exemplar prompts, mode-upgrade rules, the Lightweight Spawn Template, and explore-agent usage:** invoke the `skill` tool on **`coordinator-response-mode`** to load the complete protocol.
379381
380382
### Per-Agent Model Selection

‎.squad-templates/squad.agent.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ After routing determines WHO handles work, select a **response MODE** (Direct /
375375
| **Standard** | Normal tasks needing full context (one agent, full ceremony) — *default* |
376376
| **Full** | Multi-agent "Team" requests touching 3+ concerns (parallel fan-out) |
377377
378+
**Roster answers** ("who's on the team?") are Direct: list the `## Members` rows and the built-in support agents (Scribe, Ralph, Rai, Fact Checker). The `## Coordinator` row is you, not a member: describe yourself separately ("I'm Squad, the coordinator") rather than listing yourself in the team.
379+
378380
**For the full decision table, exemplar prompts, mode-upgrade rules, the Lightweight Spawn Template, and explore-agent usage:** invoke the `skill` tool on **`coordinator-response-mode`** to load the complete protocol.
379381
380382
### Per-Agent Model Selection

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ Claude Code is the first host after GitHub Copilot where Squad uses the host's o
8181
- **Squad's own tools no longer prompt in Claude Code.** In a demo dry run, a fresh `squad init --client claude` project hit 13 permission prompts while casting the team, and the coordinator ended up hand-writing charters and asking the user to run `squad cast` themselves. `squad init` and `squad upgrade` now add a scoped allowlist to `.claude/settings.json`: the `squad_state` tools the coordinator uses, by name (never the experimental backend's approval tools), and `squad cast`, `squad client sync`, `squad lockout reject` and `squad lockout status` (the steps that release a lockout, `assign`, `submit`, `approve` and `override`, still ask), as `squad …` and, when `.mcp.json` runs Squad's own launcher, as `node .squad/squad.mjs …`. Nothing else is allowed, and `squad cast` now refuses to write through a symbolic link. Your own rules come first and are never touched; Squad records the rules it added in `.claude/.squad-permissions.json`, and rollback removes only those, and `"claudePermissions": "off"` in `.squad/config.json` turns it off. Claude Code applies project allow rules only after the folder is trusted (the trust prompt on your first interactive `claude` run there). `squad init` now says so, and if a cast is still denied the coordinator stops and asks instead of retrying variants or hand-writing the team.
8282
- **`squad_decide` says where a git-branch backend stored the decision.** In a live run on the `orphan` backend, the coordinator told the user the decision was in `.squad/decisions/inbox/…`, but it was only on the `squad-state` branch. The tool result now says the path is a key on that branch, so the coordinator reports it correctly.
8383
- **A decision made in Claude Code reaches teammates on Copilot.** In a live run with one squad and two people, Alex on Claude Code recorded "API errors are JSON `{error, code}`". Blake on Copilot CLI was then told no error convention existed. Claude's coordinator had left the decision in the inbox, but Copilot's reads only the merged `decisions.md`. The non-Copilot coordinators now spawn Scribe in the same turn for a decision the user states. In a re-run, Blake saw both of Alex's decisions with their authors, and Alex saw Blake's.
84+
- **Claude Code and Copilot report the same roster.** In a live run on one squad, Claude cast the team with `squad cast`, which added only the cast members to `team.md`. Claude still listed Scribe, Ralph, Rai and Fact Checker, but Copilot, which reads the roster from `team.md`, showed three specialists and listed the coordinator ("Squad") as a member. `squad cast` now adds the built-in support agents' table when the roster doesn't list them, and the coordinators describe themselves separately in roster answers (#2522).
8485
- **Claude Code gets only its own Init Mode skill.** The Claude projection and plugin no longer include Copilot's template `init-mode` and `coordinator-init-mode` skills. Those skills wait for a confirmation through an `ask_user` tool Claude Code doesn't have and write the team by hand, which contradicts Claude's coordinator. Claude Code picks skills by their descriptions, so a request like "set up my team" could have loaded one of them. The coordinator uses `squad-coordinator-init-mode`, which is the only one live runs loaded. A Squad-generated copy left in `.claude/skills/` is removed on the next `squad upgrade`. Copilot is unchanged.
8586
- **The reviewer gate runs on its own and means it.** In the same dry run, the coordinator declared a bug fix done without the lead's review even though `routing.md` named the lead as the approval gate; when asked, the lead listed six known gaps against the issue and still approved; and a reviewer's own fix went unreviewed. The non-Copilot coordinators now send every code or test change to the reviewer before calling it done, unasked; the reviewer is never an author, judges against the issue and the team's recorded decisions (a known gap against either is a REJECT, not an advisory), and code a reviewer writes needs a different reviewer. The coordinator also names a recorded decision when it shapes the work ("Per the team decision of <date>: …").
8687
- **Coordinators wait for a human's sign-off.** When `team.md` or `routing.md` says a human must sign off on work (a release, tag, publish, merge or deploy), the Claude, Kiro, OpenCode, Cursor, Codex and Antigravity coordinators no longer treat the request itself as the sign-off. They name the rule and the human, ask whether you are that human or have their sign-off, go ahead only on an explicit yes, and record it in the decisions inbox. In a non-interactive run they stop at the gate. Seen in a live test: asked to "cut the 1.0.0 release", the Claude coordinator used to bump, tag and run `npm publish` itself.

‎packages/squad-cli/src/cli/commands/cast.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { LocalAgentSource } from '@bradygaster/squad-sdk/config/agent-source';
2525
import { resolveSquadPaths, resolveExternalStateDir } from '@bradygaster/squad-sdk/resolution';
2626
import { BOLD, RESET, info, success } from '../core/output.js';
2727
import { fatal, fatalNoSquad } from '../core/errors.js';
28+
import { ensureBuiltinSupportSection } from '../core/cast.js';
2829

2930
const storage = new FSStorageProvider();
3031

@@ -212,6 +213,24 @@ function updateTeamMdWithAgent(squadDir: string, name: string, role: string, slu
212213
storage.writeSync(teamPath, updated);
213214
}
214215

216+
/**
217+
* `squad init` creates the built-in charters but leaves the roster empty, and casting one member at
218+
* a time only adds that member's row. List the built-ins in `team.md` too, so every host reading the
219+
* roster sees the same team (#2522). Only built-ins whose charter exists get a row.
220+
*/
221+
function ensureBuiltinRoster(squadDir: string): void {
222+
const installed = new Set(
223+
['scribe', 'ralph', 'rai', 'fact-checker']
224+
.filter((id) => storage.existsSync(path.join(squadDir, 'agents', id, 'charter.md'))),
225+
);
226+
if (installed.size === 0) return;
227+
const teamPath = path.join(squadDir, 'team.md');
228+
const existing = storage.readSync(teamPath);
229+
if (existing === undefined) return;
230+
const updated = ensureBuiltinSupportSection(existing, installed);
231+
if (updated !== existing) storage.writeSync(teamPath, updated);
232+
}
233+
215234
function updateRoutingMdWithAgent(squadDir: string, name: string, role: string): void {
216235
const routingPath = path.join(squadDir, 'routing.md');
217236
const row = `| ${role} | ${name} | — |`;
@@ -391,6 +410,7 @@ export async function runCastAdd(cwd: string, options: CastAddOptions): Promise<
391410
}
392411

393412
updateTeamMdWithAgent(squadDir, rawName, displayRole, slug);
413+
ensureBuiltinRoster(squadDir);
394414
updateRoutingMdWithAgent(squadDir, rawName, displayRole);
395415
await updateCastingStateWithAgent(squadDir, rawName, displayRole, slug);
396416
await addAgentToConfig(teamRoot, slug, displayRole);

‎packages/squad-cli/src/cli/core/cast.ts‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,50 @@ function buildSupportTable(): string {
550550
`;
551551
}
552552

553+
/** The `## Built-in Support Agents` rows, keyed by built-in ID (matches `buildSupportTable`). */
554+
const BUILTIN_SUPPORT_ROWS: ReadonlyArray<{ id: string; name: string; row: string }> = [
555+
{ id: 'scribe', name: 'Scribe', row: '| Scribe | Decision Merger | `.squad/agents/scribe/charter.md` | 📋 Silent |' },
556+
{ id: 'ralph', name: 'Ralph', row: '| Ralph | Work Monitor | `.squad/agents/ralph/charter.md` | 🔄 Monitor |' },
557+
{ id: 'rai', name: 'Rai', row: '| Rai | RAI Reviewer | `.squad/agents/rai/charter.md` | 🛡️ RAI |' },
558+
{ id: 'fact-checker', name: 'Fact Checker', row: "| Fact Checker | Devil's Advocate & Verification Agent | `.squad/agents/fact-checker/charter.md` | 🔍 Verifier |" },
559+
];
560+
561+
/**
562+
* Add a `## Built-in Support Agents` table to `team.md` for the built-ins that are installed
563+
* (`installedIds`, e.g. those whose charter exists) but not yet on the roster, placed where
564+
* `createTeam` puts it (before `## Coding Agent` or `## Project Context`, else at the end). Each
565+
* built-in is checked on its own: one already listed anywhere (by charter path or a `| Name |` row,
566+
* under `## Members` or elsewhere) is not repeated, and one that isn't installed gets no row. A
567+
* roster that already has the section (or a legacy `## Support Identities` one) is left to
568+
* `createTeam`, which owns it. Idempotent. Kept out of `## Members` so Init Mode's "empty roster"
569+
* check still counts only cast members (#2522).
570+
*/
571+
export function ensureBuiltinSupportSection(content: string, installedIds: ReadonlySet<string>): string {
572+
if (content.includes('## Built-in Support Agents') || content.includes('## Support Identities')) {
573+
return content;
574+
}
575+
const missing = BUILTIN_SUPPORT_ROWS.filter(({ id, name }) =>
576+
installedIds.has(id)
577+
&& !content.includes(`.squad/agents/${id}/charter.md`)
578+
&& !new RegExp(`^\\|\\s*${name}\\s*\\|`, 'm').test(content));
579+
if (missing.length === 0) return content;
580+
const section = [
581+
'## Built-in Support Agents',
582+
'',
583+
'| Name | Role | Charter | Status |',
584+
'|------|------|---------|--------|',
585+
...missing.map(({ row }) => row),
586+
'',
587+
].join('\n');
588+
for (const heading of ['## Coding Agent', '## Project Context']) {
589+
const idx = content.indexOf(`\n${heading}`);
590+
if (idx !== -1) {
591+
return `${content.slice(0, idx + 1)}${section}\n${content.slice(idx + 1)}`;
592+
}
593+
}
594+
return `${content.trimEnd()}\n\n${section}`;
595+
}
596+
553597
function replaceSection(content: string, headings: string[], replacement: string): string {
554598
for (const heading of headings) {
555599
const headingIndex = content.indexOf(heading);

‎packages/squad-cli/templates/squad.agent.md.template‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ After routing determines WHO handles work, select a **response MODE** (Direct /
375375
| **Standard** | Normal tasks needing full context (one agent, full ceremony) — *default* |
376376
| **Full** | Multi-agent "Team" requests touching 3+ concerns (parallel fan-out) |
377377

378+
**Roster answers** ("who's on the team?") are Direct: list the `## Members` rows and the built-in support agents (Scribe, Ralph, Rai, Fact Checker). The `## Coordinator` row is you, not a member: describe yourself separately ("I'm Squad, the coordinator") rather than listing yourself in the team.
379+
378380
**For the full decision table, exemplar prompts, mode-upgrade rules, the Lightweight Spawn Template, and explore-agent usage:** invoke the `skill` tool on **`coordinator-response-mode`** to load the complete protocol.
379381

380382
### Per-Agent Model Selection

‎packages/squad-sdk/src/client/adapters/coordinator.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ You are the Squad coordinator. You route work to a team of specialists and keep
136136
137137
## Behavioral contract (same as Copilot)
138138
139-
10. **Response Mode Selection.** Pick the lightest mode that is correct, biasing upward when unsure: **Direct** (you answer from known facts, no spawn: status, roster, "who owns X", trivial questions); **Lightweight** (one specialist, minimal context: typo, small read-only lookup); **Standard** (one or more specialists with full charter/decision context: normal feature/bug work, plus the reviewer gate in item 12 for any code or test change); **Full** (multi-agent fan-out plus reviewer gate and Scribe: cross-cutting or risky work). Acknowledge immediately before spawning: one line naming who you are launching and why, then spawn.
139+
10. **Response Mode Selection.** Pick the lightest mode that is correct, biasing upward when unsure: **Direct** (you answer from known facts, no spawn: status, roster, "who owns X", trivial questions; a roster answer lists the \`## Members\` rows and the built-in support agents, and describes you, the coordinator, separately rather than as a member); **Lightweight** (one specialist, minimal context: typo, small read-only lookup); **Standard** (one or more specialists with full charter/decision context: normal feature/bug work, plus the reviewer gate in item 12 for any code or test change); **Full** (multi-agent fan-out plus reviewer gate and Scribe: cross-cutting or risky work). Acknowledge immediately before spawning: one line naming who you are launching and why, then spawn.
140140
11. **Scribe spawn protocol and drop-box pattern.** Agents never write \`${S}/decisions.md\` directly: decisions go to \`${S}/decisions/inbox/\` (via \`squad_decide\`). **A decision the user states for the team** ("record a team decision", "from now on…") is not left in the inbox: right after \`squad_decide\`, spawn Scribe (background) in the same turn to merge it, because \`decisions.md\` is what teammates on other hosts (Copilot reads only the merged file) and fresh sessions read. After a substantive batch of work (or when the inbox is non-empty at session end), spawn **Scribe** (background/last) with its charter to: run \`squad_state_health\`; list the inbox; merge each entry into \`decisions.md\` (demote headings beneath a dated \`###\` entry, de-duplicate), re-read to verify, then delete only processed inbox entries; archive old decisions only through the state tools/\`squad nap\`, never by hand-deleting history. Scribe never commits mutable state, and neither Scribe nor you writes session logs or orchestration logs (retired; Scribe's charter rules them out). If a required state tool is unavailable, report it; do not fall back to unsafe direct writes.
141141
12. **Reviewer rejection protocol and strict lockout.** Work that needs review goes to a reviewer (Lead, Tester or Rai as appropriate) before it is declared done. Every code or test change needs review, as does anything \`routing.md\` sends to a reviewer or approval gate: spawn that reviewer yourself, unasked, before you call the work done, ready or mergeable. The reviewer is never an author of the work. The reviewer returns APPROVE or REJECT with reasons, judged against the request's stated requirements (the issue text) and the team's recorded decisions; it cannot see these rules, so put this standard in its spawn prompt: a known gap against either is a REJECT, never an advisory; any change the reviewer requires makes it a REJECT (there is no "approve with required changes"); advisories are only for things neither asks for. A reviewer who rejects does not fix the work, and neither do you: you never edit the work yourself. If a reviewer writes code anyway, that code needs a different reviewer. On REJECT the original author is **locked out** from revising that artifact: reassign the revision to a different member (or escalate to the Lead/architect); a locked-out author may not self-revise or re-submit. Re-review is required after the revision. If reviewers and authors deadlock, escalate to the user with both positions. Record verdicts via \`squad_decide\`.
142142
13. **Rai (RAI Reviewer).** Rai performs Responsible-AI review: targeted ("RAI check", "is this safe to ship?"), pre-ship for user-facing artifacts, and pre-merge. Verdicts: 🟢 Green (proceed), 🟡 Yellow (advisory, proceed with recommendations attached), 🔴 Red (blocks shipping: triggers the reviewer rejection protocol with Rai naming a fix agent and re-reviewing). Rai runs in the background by default (non-blocking) and becomes a blocking gate only on Red; findings state WHAT is wrong, WHY it matters and HOW to fix it. Policy and audit trail: \`${S}/rai/policy.md\`, \`${S}/rai/audit-trail.md\` (append via state tools).

‎packages/squad-sdk/templates/squad.agent.md.template‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ After routing determines WHO handles work, select a **response MODE** (Direct /
375375
| **Standard** | Normal tasks needing full context (one agent, full ceremony) — *default* |
376376
| **Full** | Multi-agent "Team" requests touching 3+ concerns (parallel fan-out) |
377377

378+
**Roster answers** ("who's on the team?") are Direct: list the `## Members` rows and the built-in support agents (Scribe, Ralph, Rai, Fact Checker). The `## Coordinator` row is you, not a member: describe yourself separately ("I'm Squad, the coordinator") rather than listing yourself in the team.
379+
378380
**For the full decision table, exemplar prompts, mode-upgrade rules, the Lightweight Spawn Template, and explore-agent usage:** invoke the `skill` tool on **`coordinator-response-mode`** to load the complete protocol.
379381

380382
### Per-Agent Model Selection

0 commit comments

Comments
 (0)