From a24863d3ecbe39cdd689588e7b4106d00250f50b Mon Sep 17 00:00:00 2001 From: bradygaster Date: Sun, 15 Mar 2026 06:14:12 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20SDK=20init=20trio=20=E2=80=94=20#337=20c?= =?UTF-8?q?onfig=20sync,=20#338=20Ralph=20in=20init,=20#339=20remove=20@co?= =?UTF-8?q?pilot=20routing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - #339: Remove all @copilot references from routing.md templates (4 copies) - Removed @copilot from routing table, issue routing section, triage guidance section, and rule #8 - #338: Add Ralph to the agents array in CLI init alongside Scribe - Ralph was created during init but never listed in InitOptions.agents - #337: Wire addAgentToConfig() in cast.ts after casting agents - Function existed in SDK but was never called during cast flow - Now syncs all new agents into squad.config.ts routing rules Closes #337, closes #338, closes #339 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .squad-templates/routing.md | 25 +++++-------------------- packages/squad-cli/src/cli/core/cast.ts | 7 ++++++- packages/squad-cli/src/cli/core/init.ts | 5 +++++ packages/squad-cli/templates/routing.md | 25 +++++-------------------- packages/squad-sdk/templates/routing.md | 25 +++++-------------------- templates/routing.md | 25 +++++-------------------- 6 files changed, 31 insertions(+), 81 deletions(-) diff --git a/.squad-templates/routing.md b/.squad-templates/routing.md index 490b128e1..65e0e9f45 100644 --- a/.squad-templates/routing.md +++ b/.squad-templates/routing.md @@ -12,35 +12,21 @@ How to decide who handles what. | Code review | {Name} | Review PRs, check quality, suggest improvements | | Testing | {Name} | Write tests, find edge cases, verify fixes | | Scope & priorities | {Name} | What to build next, trade-offs, decisions | -| Async issue work (bugs, tests, small features) | @copilot 🤖 | Well-defined tasks matching capability profile | | Session logging | Scribe | Automatic — never needs routing | ## Issue Routing | Label | Action | Who | |-------|--------|-----| -| `squad` | Triage: analyze issue, evaluate @copilot fit, assign `squad:{member}` label | Lead | +| `squad` | Triage: analyze issue, assign `squad:{member}` label | Lead | | `squad:{name}` | Pick up issue and complete the work | Named member | -| `squad:copilot` | Assign to @copilot for autonomous work (if enabled) | @copilot 🤖 | ### How Issue Assignment Works -1. When a GitHub issue gets the `squad` label, the **Lead** triages it — analyzing content, evaluating @copilot's capability profile, assigning the right `squad:{member}` label, and commenting with triage notes. -2. **@copilot evaluation:** The Lead checks if the issue matches @copilot's capability profile (🟢 good fit / 🟡 needs review / 🔴 not suitable). If it's a good fit, the Lead may route to `squad:copilot` instead of a squad member. -3. When a `squad:{member}` label is applied, that member picks up the issue in their next session. -4. When `squad:copilot` is applied and auto-assign is enabled, `@copilot` is assigned on the issue and picks it up autonomously. -5. Members can reassign by removing their label and adding another member's label. -6. The `squad` label is the "inbox" — untriaged issues waiting for Lead review. - -### Lead Triage Guidance for @copilot - -When triaging, the Lead should ask: - -1. **Is this well-defined?** Clear title, reproduction steps or acceptance criteria, bounded scope → likely 🟢 -2. **Does it follow existing patterns?** Adding a test, fixing a known bug, updating a dependency → likely 🟢 -3. **Does it need design judgment?** Architecture, API design, UX decisions → likely 🔴 -4. **Is it security-sensitive?** Auth, encryption, access control → always 🔴 -5. **Is it medium complexity with specs?** Feature with clear requirements, refactoring with tests → likely 🟡 +1. When a GitHub issue gets the `squad` label, the **Lead** triages it — analyzing content, assigning the right `squad:{member}` label, and commenting with triage notes. +2. When a `squad:{member}` label is applied, that member picks up the issue in their next session. +3. Members can reassign by removing their label and adding another member's label. +4. The `squad` label is the "inbox" — untriaged issues waiting for Lead review. ## Rules @@ -51,4 +37,3 @@ When triaging, the Lead should ask: 5. **"Team, ..." → fan-out.** Spawn all relevant agents in parallel as `mode: "background"`. 6. **Anticipate downstream work.** If a feature is being built, spawn the tester to write test cases from requirements simultaneously. 7. **Issue-labeled work** — when a `squad:{member}` label is applied to an issue, route to that member. The Lead handles all `squad` (base label) triage. -8. **@copilot routing** — when evaluating issues, check @copilot's capability profile in `team.md`. Route 🟢 good-fit tasks to `squad:copilot`. Flag 🟡 needs-review tasks for PR review. Keep 🔴 not-suitable tasks with squad members. diff --git a/packages/squad-cli/src/cli/core/cast.ts b/packages/squad-cli/src/cli/core/cast.ts index 382a81e24..ca6a3ee8b 100644 --- a/packages/squad-cli/src/cli/core/cast.ts +++ b/packages/squad-cli/src/cli/core/cast.ts @@ -6,7 +6,7 @@ import { mkdir, writeFile, readFile } from 'node:fs/promises'; import { existsSync } from 'node:fs'; import { join } from 'node:path'; -import { getRoleById, generateCharterFromRole } from '@bradygaster/squad-sdk'; +import { getRoleById, generateCharterFromRole, addAgentToConfig } from '@bradygaster/squad-sdk'; // ── Types ────────────────────────────────────────────────────────── @@ -532,6 +532,11 @@ export async function createTeam(teamRoot: string, proposal: CastProposal): Prom await writeFile(join(castingDir, 'policy.json'), JSON.stringify(policy, null, 2) + '\n'); filesCreated.push(join(castingDir, 'policy.json')); + // Sync new agents into squad.config.ts (if present) + for (const member of allMembers) { + await addAgentToConfig(teamRoot, member.name.toLowerCase(), member.role); + } + return { teamRoot, membersCreated, filesCreated }; } diff --git a/packages/squad-cli/src/cli/core/init.ts b/packages/squad-cli/src/cli/core/init.ts index 63f4d1e5d..bcbf34f39 100644 --- a/packages/squad-cli/src/cli/core/init.ts +++ b/packages/squad-cli/src/cli/core/init.ts @@ -163,6 +163,11 @@ export async function runInit(dest: string, options: RunInitOptions = {}): Promi name: 'scribe', role: 'scribe', displayName: 'Scribe', + }, + { + name: 'ralph', + role: 'ralph', + displayName: 'Ralph', } ], configFormat: options.sdk ? 'sdk' : 'markdown', diff --git a/packages/squad-cli/templates/routing.md b/packages/squad-cli/templates/routing.md index 490b128e1..65e0e9f45 100644 --- a/packages/squad-cli/templates/routing.md +++ b/packages/squad-cli/templates/routing.md @@ -12,35 +12,21 @@ How to decide who handles what. | Code review | {Name} | Review PRs, check quality, suggest improvements | | Testing | {Name} | Write tests, find edge cases, verify fixes | | Scope & priorities | {Name} | What to build next, trade-offs, decisions | -| Async issue work (bugs, tests, small features) | @copilot 🤖 | Well-defined tasks matching capability profile | | Session logging | Scribe | Automatic — never needs routing | ## Issue Routing | Label | Action | Who | |-------|--------|-----| -| `squad` | Triage: analyze issue, evaluate @copilot fit, assign `squad:{member}` label | Lead | +| `squad` | Triage: analyze issue, assign `squad:{member}` label | Lead | | `squad:{name}` | Pick up issue and complete the work | Named member | -| `squad:copilot` | Assign to @copilot for autonomous work (if enabled) | @copilot 🤖 | ### How Issue Assignment Works -1. When a GitHub issue gets the `squad` label, the **Lead** triages it — analyzing content, evaluating @copilot's capability profile, assigning the right `squad:{member}` label, and commenting with triage notes. -2. **@copilot evaluation:** The Lead checks if the issue matches @copilot's capability profile (🟢 good fit / 🟡 needs review / 🔴 not suitable). If it's a good fit, the Lead may route to `squad:copilot` instead of a squad member. -3. When a `squad:{member}` label is applied, that member picks up the issue in their next session. -4. When `squad:copilot` is applied and auto-assign is enabled, `@copilot` is assigned on the issue and picks it up autonomously. -5. Members can reassign by removing their label and adding another member's label. -6. The `squad` label is the "inbox" — untriaged issues waiting for Lead review. - -### Lead Triage Guidance for @copilot - -When triaging, the Lead should ask: - -1. **Is this well-defined?** Clear title, reproduction steps or acceptance criteria, bounded scope → likely 🟢 -2. **Does it follow existing patterns?** Adding a test, fixing a known bug, updating a dependency → likely 🟢 -3. **Does it need design judgment?** Architecture, API design, UX decisions → likely 🔴 -4. **Is it security-sensitive?** Auth, encryption, access control → always 🔴 -5. **Is it medium complexity with specs?** Feature with clear requirements, refactoring with tests → likely 🟡 +1. When a GitHub issue gets the `squad` label, the **Lead** triages it — analyzing content, assigning the right `squad:{member}` label, and commenting with triage notes. +2. When a `squad:{member}` label is applied, that member picks up the issue in their next session. +3. Members can reassign by removing their label and adding another member's label. +4. The `squad` label is the "inbox" — untriaged issues waiting for Lead review. ## Rules @@ -51,4 +37,3 @@ When triaging, the Lead should ask: 5. **"Team, ..." → fan-out.** Spawn all relevant agents in parallel as `mode: "background"`. 6. **Anticipate downstream work.** If a feature is being built, spawn the tester to write test cases from requirements simultaneously. 7. **Issue-labeled work** — when a `squad:{member}` label is applied to an issue, route to that member. The Lead handles all `squad` (base label) triage. -8. **@copilot routing** — when evaluating issues, check @copilot's capability profile in `team.md`. Route 🟢 good-fit tasks to `squad:copilot`. Flag 🟡 needs-review tasks for PR review. Keep 🔴 not-suitable tasks with squad members. diff --git a/packages/squad-sdk/templates/routing.md b/packages/squad-sdk/templates/routing.md index 490b128e1..65e0e9f45 100644 --- a/packages/squad-sdk/templates/routing.md +++ b/packages/squad-sdk/templates/routing.md @@ -12,35 +12,21 @@ How to decide who handles what. | Code review | {Name} | Review PRs, check quality, suggest improvements | | Testing | {Name} | Write tests, find edge cases, verify fixes | | Scope & priorities | {Name} | What to build next, trade-offs, decisions | -| Async issue work (bugs, tests, small features) | @copilot 🤖 | Well-defined tasks matching capability profile | | Session logging | Scribe | Automatic — never needs routing | ## Issue Routing | Label | Action | Who | |-------|--------|-----| -| `squad` | Triage: analyze issue, evaluate @copilot fit, assign `squad:{member}` label | Lead | +| `squad` | Triage: analyze issue, assign `squad:{member}` label | Lead | | `squad:{name}` | Pick up issue and complete the work | Named member | -| `squad:copilot` | Assign to @copilot for autonomous work (if enabled) | @copilot 🤖 | ### How Issue Assignment Works -1. When a GitHub issue gets the `squad` label, the **Lead** triages it — analyzing content, evaluating @copilot's capability profile, assigning the right `squad:{member}` label, and commenting with triage notes. -2. **@copilot evaluation:** The Lead checks if the issue matches @copilot's capability profile (🟢 good fit / 🟡 needs review / 🔴 not suitable). If it's a good fit, the Lead may route to `squad:copilot` instead of a squad member. -3. When a `squad:{member}` label is applied, that member picks up the issue in their next session. -4. When `squad:copilot` is applied and auto-assign is enabled, `@copilot` is assigned on the issue and picks it up autonomously. -5. Members can reassign by removing their label and adding another member's label. -6. The `squad` label is the "inbox" — untriaged issues waiting for Lead review. - -### Lead Triage Guidance for @copilot - -When triaging, the Lead should ask: - -1. **Is this well-defined?** Clear title, reproduction steps or acceptance criteria, bounded scope → likely 🟢 -2. **Does it follow existing patterns?** Adding a test, fixing a known bug, updating a dependency → likely 🟢 -3. **Does it need design judgment?** Architecture, API design, UX decisions → likely 🔴 -4. **Is it security-sensitive?** Auth, encryption, access control → always 🔴 -5. **Is it medium complexity with specs?** Feature with clear requirements, refactoring with tests → likely 🟡 +1. When a GitHub issue gets the `squad` label, the **Lead** triages it — analyzing content, assigning the right `squad:{member}` label, and commenting with triage notes. +2. When a `squad:{member}` label is applied, that member picks up the issue in their next session. +3. Members can reassign by removing their label and adding another member's label. +4. The `squad` label is the "inbox" — untriaged issues waiting for Lead review. ## Rules @@ -51,4 +37,3 @@ When triaging, the Lead should ask: 5. **"Team, ..." → fan-out.** Spawn all relevant agents in parallel as `mode: "background"`. 6. **Anticipate downstream work.** If a feature is being built, spawn the tester to write test cases from requirements simultaneously. 7. **Issue-labeled work** — when a `squad:{member}` label is applied to an issue, route to that member. The Lead handles all `squad` (base label) triage. -8. **@copilot routing** — when evaluating issues, check @copilot's capability profile in `team.md`. Route 🟢 good-fit tasks to `squad:copilot`. Flag 🟡 needs-review tasks for PR review. Keep 🔴 not-suitable tasks with squad members. diff --git a/templates/routing.md b/templates/routing.md index 490b128e1..65e0e9f45 100644 --- a/templates/routing.md +++ b/templates/routing.md @@ -12,35 +12,21 @@ How to decide who handles what. | Code review | {Name} | Review PRs, check quality, suggest improvements | | Testing | {Name} | Write tests, find edge cases, verify fixes | | Scope & priorities | {Name} | What to build next, trade-offs, decisions | -| Async issue work (bugs, tests, small features) | @copilot 🤖 | Well-defined tasks matching capability profile | | Session logging | Scribe | Automatic — never needs routing | ## Issue Routing | Label | Action | Who | |-------|--------|-----| -| `squad` | Triage: analyze issue, evaluate @copilot fit, assign `squad:{member}` label | Lead | +| `squad` | Triage: analyze issue, assign `squad:{member}` label | Lead | | `squad:{name}` | Pick up issue and complete the work | Named member | -| `squad:copilot` | Assign to @copilot for autonomous work (if enabled) | @copilot 🤖 | ### How Issue Assignment Works -1. When a GitHub issue gets the `squad` label, the **Lead** triages it — analyzing content, evaluating @copilot's capability profile, assigning the right `squad:{member}` label, and commenting with triage notes. -2. **@copilot evaluation:** The Lead checks if the issue matches @copilot's capability profile (🟢 good fit / 🟡 needs review / 🔴 not suitable). If it's a good fit, the Lead may route to `squad:copilot` instead of a squad member. -3. When a `squad:{member}` label is applied, that member picks up the issue in their next session. -4. When `squad:copilot` is applied and auto-assign is enabled, `@copilot` is assigned on the issue and picks it up autonomously. -5. Members can reassign by removing their label and adding another member's label. -6. The `squad` label is the "inbox" — untriaged issues waiting for Lead review. - -### Lead Triage Guidance for @copilot - -When triaging, the Lead should ask: - -1. **Is this well-defined?** Clear title, reproduction steps or acceptance criteria, bounded scope → likely 🟢 -2. **Does it follow existing patterns?** Adding a test, fixing a known bug, updating a dependency → likely 🟢 -3. **Does it need design judgment?** Architecture, API design, UX decisions → likely 🔴 -4. **Is it security-sensitive?** Auth, encryption, access control → always 🔴 -5. **Is it medium complexity with specs?** Feature with clear requirements, refactoring with tests → likely 🟡 +1. When a GitHub issue gets the `squad` label, the **Lead** triages it — analyzing content, assigning the right `squad:{member}` label, and commenting with triage notes. +2. When a `squad:{member}` label is applied, that member picks up the issue in their next session. +3. Members can reassign by removing their label and adding another member's label. +4. The `squad` label is the "inbox" — untriaged issues waiting for Lead review. ## Rules @@ -51,4 +37,3 @@ When triaging, the Lead should ask: 5. **"Team, ..." → fan-out.** Spawn all relevant agents in parallel as `mode: "background"`. 6. **Anticipate downstream work.** If a feature is being built, spawn the tester to write test cases from requirements simultaneously. 7. **Issue-labeled work** — when a `squad:{member}` label is applied to an issue, route to that member. The Lead handles all `squad` (base label) triage. -8. **@copilot routing** — when evaluating issues, check @copilot's capability profile in `team.md`. Route 🟢 good-fit tasks to `squad:copilot`. Flag 🟡 needs-review tasks for PR review. Keep 🔴 not-suitable tasks with squad members.