fix: auto-scaffold Fact Checker agent during init and cast (#1222)#1223
Conversation
…er#1222) The Fact Checker role landed in v0.10.0 (bradygaster#789) with catalog entry, charter template, skill, AGENT_TEMPLATES map entry, and template manifest entry — but was never wired into the user-facing onboarding flow. Users running 'squad init' got Scribe/Ralph/Rai but never saw Fact Checker as a default or cast option. This mirrors how Rai was wired: - init.ts: adds 'fact-checker' to the default agents: array passed to sdkInitSquad() - cast.ts: adds factCheckerMember(), factCheckerCharter(), hasFactChecker branches in castTeam(), and the roster banner line Smoke-tested locally: 'squad init' in a clean repo now produces .squad/agents/fact-checker/charter.md alongside scribe/ralph/Rai. Closes bradygaster#1222 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🛫 PR Readiness Check
PR Scope: 📦🔧 Mixed (product + infrastructure)
|
| Status | Check | Details |
|---|---|---|
| ❌ | Single commit | 2 commits — consider squashing before review |
| ✅ | Not in draft | Ready for review |
| ✅ | Branch up to date | Up to date with dev |
| ❌ | Copilot review | No Copilot review yet — it may still be processing |
| ✅ | Changeset present | Changeset file found |
| ✅ | Scope clean | No .squad/ or docs/proposals/ files |
| ✅ | No merge conflicts | No merge conflicts |
| ❌ | Copilot threads resolved | 3 unresolved Copilot thread(s) — fix and resolve before merging |
| ❌ | CI passing | 7 check(s) still running |
Files Changed (4 files, +185 −0)
| File | +/− |
|---|---|
.changeset/fix-fact-checker-auto-scaffold.md |
+16 −0 |
packages/squad-cli/src/cli/core/cast.ts |
+86 −0 |
packages/squad-cli/src/cli/core/init.ts |
+5 −0 |
packages/squad-cli/src/cli/core/upgrade.ts |
+78 −0 |
Total: +185 −0
This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.
🟡 Impact Analysis — PR #1223Risk tier: 🟡 MEDIUM 📊 Summary
🎯 Risk Factors
📦 Modules Affectedroot (1 file)
squad-cli (3 files)
This report is generated automatically for every PR. See #733 for details. |
🏗️ Architectural Review
Automated architectural review — informational only. |
There was a problem hiding this comment.
Pull request overview
This PR fixes a gap in the CLI onboarding flow by ensuring the built-in Fact Checker agent is scaffolded by default during squad init and automatically added during squad cast, aligning user-visible behavior with the existing SDK role/catalog + template support.
Changes:
- Adds
fact-checkerto the defaultagents:list passed tosdkInitSquad()sosquad initscaffolds the agent automatically. - Extends
squad castteam generation to auto-add a Fact Checker when absent, include a built-in charter path, and show it in the cast summary banner. - Adds a changeset for a patch release of
@bradygaster/squad-cli.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/squad-cli/src/cli/core/init.ts | Adds Fact Checker to default init scaffolding agent list. |
| packages/squad-cli/src/cli/core/cast.ts | Adds Fact Checker built-in member/charter wiring and default inclusion + summary banner. |
| .changeset/fix-fact-checker-auto-scaffold.md | Patch changeset documenting the CLI onboarding fix. |
| function factCheckerMember(): CastMember { | ||
| return { name: 'Fact Checker', role: 'Fact Checker', scope: 'Claim verification, hallucination detection, counter-hypothesis analysis, source validation', emoji: '🔍' }; | ||
| } |
| charter = ralphCharter(); | ||
| } else if (member.name === 'Rai' && !hasRai) { | ||
| charter = RaiCharter(); | ||
| } else if (member.name === 'Fact Checker' && !hasFactChecker) { | ||
| charter = factCheckerCharter(); | ||
| } else { | ||
| charter = generateCharter(member); |
| const hasRai = proposal.members.some(m => /Rai/i.test(m.name)); | ||
| if (!hasRai) allMembers.push(RaiMember()); | ||
|
|
||
| const hasFactChecker = proposal.members.some(m => /fact.?checker/i.test(m.name)); | ||
| if (!hasFactChecker) allMembers.push(factCheckerMember()); | ||
|
|
|
@bradygaster — heads-up, this is the fix for #1222 (fact-checker not auto-scaffolded by init/cast). Patch-bump only, all v0.10.0-shipped fact-checker pieces stay; just wires them into the user-facing onboarding flow. CHANGELOG gate should pass cleanly now that #1220 added me to (Teams was down again when I tried — posting here.) |
…ygaster#1222) Extends the bradygaster#1222 fix to the third code path. \squad upgrade\ was intentionally silent on agents (preserves user state). For users upgrading from v0.9.x or earlier (no Rai) or v0.10.0 (no fact-checker), this means they'd never get the built-in agents unless they re-ran \squad init\ (which would overwrite other state). Adds \�nsureBuiltinAgents()\ to \ unEnsureChecks()\. Idempotent — only scaffolds when the agent directory is absent. Never overwrites existing charters or history files. Sources content from the shipped \ emplates/{Rai,fact-checker}-charter.md\ templates (already present via TEMPLATE_MANIFEST). Scribe and Ralph are intentionally NOT scaffolded by upgrade — they predate this fix in every squad, and their charters are inlined in cast.ts (no shipped template file). Smoke tested locally: - Set up a simulated v0.9.4 squad (scribe + ralph only) - Ran \squad upgrade\ → 'scaffolded 2 built-in agent(s): Rai, fact-checker' - Ran upgrade again → no re-scaffold (idempotent) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Extended this PR to cover the third code path —
He's right — without it, anyone on v0.10.0 upgrading to v0.10.1 (this fix) would never get What this commit adds (
|
…#1299) (#1300) * fix(docs): tell coordinator to roster Fact Checker on first-time cast (#1299) squad init correctly creates .squad/agents/fact-checker/ on disk (per merged PR #1223). But when the user opens copilot --agent squad and the coordinator runs first-time casting, it OMITS Fact Checker from the team.md ## Members table while including Scribe, Ralph, and Rai. Root cause: .squad-templates/squad.agent.md had two gaps: 1. Line 56 said "team size (typically 4-5 + Scribe)" — naming only Scribe 2. Rai had a dedicated ## Rai section with explicit "Rai always appears in team.md" instruction — Fact Checker had no equivalent section So the model added Rai (because instructed to) but had no instruction to add Fact Checker, even though the agent dir was scaffolded on disk. Fix: * Update team-size line to name all 4 always-on built-ins: Scribe + Ralph + Rai + Fact Checker * Add full ## Fact Checker — Verification & Devil's Advocate section mirroring the Rai pattern: roster-entry instruction, dual operating mode (per #789 + #1254), trigger phrase table, confidence ratings, DA brief structure, boundaries, state location Sync via sync-templates.mjs --sync propagates squad.agent.md changes to all 4 mirror targets: .squad-templates/, templates/, packages/squad-cli/ templates/, packages/squad-sdk/templates/, .github/agents/. Tests: new test/squad-agent-roster.test.ts runs against all 4 template targets and asserts: * The "Determine team size" line names all 4 built-ins * A ## Fact Checker section exists with "always appears in team.md" * The section declares dual operating mode (anchors #789 + #1254 design so a future PR can't accidentally split Fact Checker and Devil's Advocate again — cf. closed PR #1294) * Existing Ralph + Rai sections still present 16/16 pass. Closes #1299 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * doc(squad.agent.md): clarify Fact Checker is exempt from casting + correct on-demand reference path Reviewer follow-ups on #1300: 1. Team-size phrasing — the line read 'typically 4-5 + Scribe + Ralph + Rai + Fact Checker' which a model could parse as arithmetic (4-5 + 4 = 8-9, but it could also collapse). Rewrote it to make the composition explicit: '4-5 cast (user-domain) agents + 4 always-on built-ins = 8-9 total roster entries'. 2. Cast-exemption parity — Scribe, Ralph, and Rai each have an explicit 'exempt from casting' bullet but Fact Checker did not. Added the matching bullet right after Rai's. 3. Bad on-demand reference path — the FC section pointed at '.squad/templates/fact-checker-charter.md'. That file IS shipped (TEMPLATE_MANIFEST destination 'templates/fact-checker-charter.md') but only AFTER 'squad init' or 'squad upgrade' has populated .squad/templates/. A reader of squad.agent.md on an un-initialized repo (or in .github/agents/ on the cloud agent surface) would follow a dead link. Repointed to the '.squad/agents/fact-checker/charter.md' instance that ensureBuiltinAgents creates as part of the same init/upgrade path — that's where the rich charter actually lives at runtime per #1299 + #1301. All 4 mirrored copies re-synced via scripts/sync-templates.mjs. fact-checker-role.test.ts: 8/8 pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <Copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Tamir Dresher <tamirdresher@users.noreply.github.com>
Fix #1222: Auto-scaffold Fact Checker agent during
squad initandsquad castCloses #1222.
Root cause
The Fact Checker role landed in v0.10.0 (#789) with:
packages/squad-sdk/src/roles/catalog-engineering.ts:552(id:fact-checker, emoji: 🔍)packages/squad-cli/templates/fact-checker-charter.mdtemplates/skills/fact-checking/SKILL.mdAGENT_TEMPLATESmap entry —packages/squad-sdk/src/config/init.ts:209packages/squad-cli/src/cli/core/templates.ts:151…but was never wired into the user-facing onboarding flow. The default
agents:array passed tosdkInitSquad()only hardcodedscribe,ralph, andRai.cast.tshad zero references tofact-checker.Users running
squad init(orsquad init+squad cast) got Scribe/Ralph/Rai always-on but never saw Fact Checker.Fix
Mirrors how Rai was wired in v0.10.0:
init.ts:218-237— addsfact-checkerto the defaultagents:array passed tosdkInitSquad(). Nowsquad initproduces.squad/agents/fact-checker/charter.mdalongside the existing always-on agents.cast.ts:497-501— addsfactCheckerMember()andfactCheckerCharter()functions.cast.ts:618-619— addshasFactCheckerdetection and pushesfactCheckerMember()if absent.cast.ts:632-633— addsfactCheckerCharter()branch in the charter-selection switch.cast.ts:803-805— adds the🔍 Fact Checker — (advisory)banner line.Smoke test (local build)
Verified — init output shows
✓ .squad\agents\fact-checker\charter.mdand the charter file exists.Changeset
Patch bump for
@bradygaster/squad-cli(no SDK change — bug was purely in CLI wiring).Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com