Skip to content

fix: auto-scaffold Fact Checker agent during init and cast (#1222)#1223

Merged
bradygaster merged 2 commits into
bradygaster:devfrom
tamirdresher:fix/1222-fact-checker-auto-scaffold
Jun 7, 2026
Merged

fix: auto-scaffold Fact Checker agent during init and cast (#1222)#1223
bradygaster merged 2 commits into
bradygaster:devfrom
tamirdresher:fix/1222-fact-checker-auto-scaffold

Conversation

@tamirdresher

Copy link
Copy Markdown
Collaborator

Fix #1222: Auto-scaffold Fact Checker agent during squad init and squad cast

Closes #1222.

Root cause

The Fact Checker role landed in v0.10.0 (#789) with:

  • ✅ Catalog entry — packages/squad-sdk/src/roles/catalog-engineering.ts:552 (id: fact-checker, emoji: 🔍)
  • ✅ Charter template — packages/squad-cli/templates/fact-checker-charter.md
  • ✅ Fact-checking SKILL — templates/skills/fact-checking/SKILL.md
  • AGENT_TEMPLATES map entry — packages/squad-sdk/src/config/init.ts:209
  • ✅ Template manifest entry — packages/squad-cli/src/cli/core/templates.ts:151

…but was never wired into the user-facing onboarding flow. The default agents: array passed to sdkInitSquad() only hardcoded scribe, ralph, and Rai. cast.ts had zero references to fact-checker.

Users running squad init (or squad init + squad cast) got Scribe/Ralph/Rai always-on but never saw Fact Checker.

Fix

Mirrors how Rai was wired in v0.10.0:

  1. init.ts:218-237 — adds fact-checker to the default agents: array passed to sdkInitSquad(). Now squad init produces .squad/agents/fact-checker/charter.md alongside the existing always-on agents.

  2. cast.ts:497-501 — adds factCheckerMember() and factCheckerCharter() functions.

  3. cast.ts:618-619 — adds hasFactChecker detection and pushes factCheckerMember() if absent.

  4. cast.ts:632-633 — adds factCheckerCharter() branch in the charter-selection switch.

  5. cast.ts:803-805 — adds the 🔍 Fact Checker — (advisory) banner line.

Smoke test (local build)

$tmp = Join-Path $env:TEMP "factcheck-smoke"; mkdir $tmp; cd $tmp
git init -q && echo "# test" > README.md && git add -A && git commit -q -m init
node C:\path\to\squad\packages\squad-cli\dist\cli-entry.js init
ls .squad/agents/
# BEFORE: Rai/ ralph/ scribe/
# AFTER:  Rai/ fact-checker/ ralph/ scribe/  ← NEW

Verified — init output shows ✓ .squad\agents\fact-checker\charter.md and 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

…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>
Copilot AI review requested due to automatic review settings June 7, 2026 12:39
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

🛫 PR Readiness Check

ℹ️ This comment updates on each push. Last checked: commit 010f6fc

PR Scope: 📦🔧 Mixed (product + infrastructure)

⚠️ 4 item(s) to address before review

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.

@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

🟡 Impact Analysis — PR #1223

Risk tier: 🟡 MEDIUM

📊 Summary

Metric Count
Files changed 4
Files added 1
Files modified 3
Files deleted 0
Modules touched 2

🎯 Risk Factors

  • 4 files changed (≤5 → LOW)
  • 2 modules touched (2-4 → MEDIUM)

📦 Modules Affected

root (1 file)
  • .changeset/fix-fact-checker-auto-scaffold.md
squad-cli (3 files)
  • packages/squad-cli/src/cli/core/cast.ts
  • packages/squad-cli/src/cli/core/init.ts
  • packages/squad-cli/src/cli/core/upgrade.ts

This report is generated automatically for every PR. See #733 for details.

@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

🏗️ Architectural Review

⚠️ Architectural review: 1 warning(s).

Severity Category Finding Files
🟡 warning bootstrap-area 3 file(s) in the bootstrap area (packages/squad-cli/src/cli/core/) were modified. These files must maintain zero external dependencies. Review carefully. packages/squad-cli/src/cli/core/cast.ts, packages/squad-cli/src/cli/core/init.ts, packages/squad-cli/src/cli/core/upgrade.ts

Automated architectural review — informational only.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-checker to the default agents: list passed to sdkInitSquad() so squad init scaffolds the agent automatically.
  • Extends squad cast team 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.

Comment on lines +501 to +503
function factCheckerMember(): CastMember {
return { name: 'Fact Checker', role: 'Fact Checker', scope: 'Claim verification, hallucination detection, counter-hypothesis analysis, source validation', emoji: '🔍' };
}
Comment on lines 710 to 716
charter = ralphCharter();
} else if (member.name === 'Rai' && !hasRai) {
charter = RaiCharter();
} else if (member.name === 'Fact Checker' && !hasFactChecker) {
charter = factCheckerCharter();
} else {
charter = generateCharter(member);
Comment on lines 694 to +699
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());

@tamirdresher

Copy link
Copy Markdown
Collaborator Author

@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 APPROVED_AUTHORS. Ready when you are.

(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>
@tamirdresher

Copy link
Copy Markdown
Collaborator Author

Extended this PR to cover the third code path — squad upgrade. Spotted while reviewing with @tamirdresher:

"make sure the squad upgrade also knows to add the fact checker"

He's right — without it, anyone on v0.10.0 upgrading to v0.10.1 (this fix) would never get fact-checker either, because runUpgrade() is intentionally silent on agents (preserves user state).

What this commit adds (upgrade.ts)

New ensureBuiltinAgents() runs in runEnsureChecks():

  • Idempotent — only scaffolds when the agent directory is absent
  • Never overwrites existing charters or history files
  • Sources content from shipped templates/{Rai,fact-checker}-charter.md templates
  • Backfills Rai too (anyone upgrading from pre-0.10.0 also missed it)

What it intentionally does NOT scaffold

Scribe and Ralph — they predate this fix in every squad, and their charters are inlined in cast.ts (no shipped template file). Adding them here would risk overwriting customized versions on legacy squads.

Smoke test (local build)

# Simulate a v0.9.4 squad (scribe + ralph only, no Rai, no fact-checker)
$tmp = Join-Path $env:TEMP "upgrade-smoke"
mkdir $tmp; cd $tmp; git init -q
mkdir .squad/agents/{scribe,ralph} -Force
echo "# Scribe" > .squad/agents/scribe/charter.md
echo "# Ralph" > .squad/agents/ralph/charter.md
echo "<!-- version: 0.9.4 -->" > .github/agents/squad.agent.md
# ... (commit)

node /path/to/squad-cli/dist/cli-entry.js upgrade
# → ✓ scaffolded 2 built-in agent(s): Rai, fact-checker

# Run again
node /path/to/squad-cli/dist/cli-entry.js upgrade
# → (no built-in agent line — idempotent ✅)

Changeset updated to mention the upgrade path.

@bradygaster bradygaster merged commit d41b046 into bradygaster:dev Jun 7, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v0.10.0: Fact Checker agent not auto-scaffolded by squad init / cast

3 participants