Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
1aaead4
fix: auto-scaffold Fact Checker agent during init and cast (#1222)
tamirdresher Jun 7, 2026
010f6fc
fix(upgrade): auto-scaffold Rai + Fact Checker on squad upgrade (#1222)
tamirdresher Jun 7, 2026
d41b046
Merge pull request #1223 from tamirdresher/fix/1222-fact-checker-auto…
bradygaster Jun 7, 2026
e5c1800
fix(permissions): use 'approve-once' for Copilot CLI v1.0.54+ contrac…
bradygaster Jun 9, 2026
a081832
feat: Squad.Agents.AI - Microsoft Agent Framework adapter for the Squ…
tamirdresher Jun 9, 2026
28962e2
ci(Squad.Agents.AI): switch NuGet publish to Trusted Publishing (OIDC…
tamirdresher Jun 9, 2026
647f337
fix(Squad.Agents.AI): expose SessionConfig + default OnPermissionRequ…
tamirdresher Jun 10, 2026
cc37a2f
Squad.Agents.AI 0.2.0: bump to MAF 1.10.0-rc1 / SDK 1.0.0 GA — file-I…
tamirdresher Jun 10, 2026
39ee9c7
fix: address pre-existing Copilot review comments from PR #1212 (#1258)
bradygaster Jun 11, 2026
611a82b
fix: expose memory tools via MCP + route writes through governed pipe…
bradygaster Jun 11, 2026
eeb68f2
docs(skills): update path references from .squad/skills/ to .copilot/…
bradygaster Jun 11, 2026
c11274d
feat(init): prompt to add @copilot as a team member during squad init…
bradygaster Jun 11, 2026
5824b60
docs: align skills path + state-backend upgrade flow (#1241, #1226) (…
bradygaster Jun 11, 2026
152bbf0
Squad.Agents.AI 0.3.0: first-class subagent observability (#1265)
tamirdresher Jun 11, 2026
d3c2d84
chore(lockfile): sync package-lock with package.json after v0.10.0 bu…
tamirdresher Jun 11, 2026
f79b03a
fix(bump-build): also update package-lock workspace entries (#1267)
tamirdresher Jun 11, 2026
da17eef
fix: release pipeline version pinning (#1203, #1204) (#1250)
bradygaster Jun 11, 2026
ce15d6b
chore: include CHANGELOG.md in published npm tarball (#1257)
bradygaster Jun 11, 2026
c076ffb
Squad.Agents.AI 0.4.0: default-on subagent observability + Aspire-sty…
tamirdresher Jun 11, 2026
dfc5b94
Squad.Agents.AI 0.5.0: auto-inject --agent squad (CLI parity by defau…
tamirdresher Jun 11, 2026
edcc39d
Squad.Agents.AI 0.5.1: fix 0.5.0 regression — use --agent CLI flag (n…
tamirdresher Jun 11, 2026
217e0bd
Add squad registry add/list/remove for discovery-only peer squads (#1…
tamirdresher Jun 12, 2026
2ca906d
fix(cli): stop writing squad_state to ~/.copilot/mcp-config.json on e…
tamirdresher Jun 13, 2026
84ce747
fix(sdk): wire team.md/routing.md/casting state on \squad preset appl…
tamirdresher Jun 13, 2026
68e2774
fix(docs): tell coordinator to roster Fact Checker on first-time cast…
tamirdresher Jun 13, 2026
16c6b25
fix(sdk): plumb Fact Checker like Rai — rich charter at init + .squad…
tamirdresher Jun 13, 2026
76ba4e7
fix(skills): rename squad disambiguation skill to squad-help (superse…
tamirdresher Jun 13, 2026
918cbd4
fix(prompt): coordinator must probe for squad_state/memory tools befo…
tamirdresher Jun 13, 2026
608f858
feat(skills): make /squad a real slash command (user-invocable: true …
tamirdresher Jun 13, 2026
40f78f2
fix(skills): install bundled skills to .github/skills/ (closes #1126)…
tamirdresher Jun 13, 2026
6afd067
feat(sdk): bundle cross-squad-communication skill (#5 cross-squad pro…
tamirdresher Jun 13, 2026
b79e64a
fix(coordinator): route "spawn a squad" / "another squad" prompts thr…
tamirdresher Jun 13, 2026
89a1b96
fix(sdk,cli): bundle missing skills on init + strip fabricated tiered…
tamirdresher Jun 13, 2026
942270b
docs: add feature pages for preset, cross-squad discover/delegate, an…
tamirdresher Jun 14, 2026
f9f77c0
docs: add feature pages for remaining 8 v0.10 features (tiered-memory…
tamirdresher Jun 14, 2026
caef438
docs(state-backends): document pre-commit hook, post-upgrade flow, an…
tamirdresher Jun 14, 2026
ae6f4e7
docs: clarify that .squad/casting/* files are identity, not two-layer…
tamirdresher Jun 14, 2026
567f447
fix(state-backend): conditional .gitignore entries for two-layer/orph…
tamirdresher Jun 14, 2026
9917fa1
chore: promote v0.10.1 dev → main (38 commits including v0.10 stabili…
tamirdresher Jun 14, 2026
1e1a9d7
docs(blog): v0.10 stabilisation insider release post
tamirdresher Jun 14, 2026
286fa23
fix(docs): rephrase 'fenced code block' row in skill-security-scanner…
tamirdresher Jun 14, 2026
d4457ab
fix(blog): use American 'Stabilization' (cspell dict is en_US)
tamirdresher Jun 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(upgrade): auto-scaffold Rai + Fact Checker on squad upgrade (#1222)
Extends the #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>
  • Loading branch information
tamirdresher and Copilot committed Jun 7, 2026
commit 010f6fc06965c409595d54e4e649abadf21cedef
15 changes: 9 additions & 6 deletions .changeset/fix-fact-checker-auto-scaffold.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
"@bradygaster/squad-cli": patch
---

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

The Fact Checker role was added in v0.10.0 (#789) with its catalog entry, charter template, skill, AGENT_TEMPLATES map entry, and template manifest entry — but it 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.
The Fact Checker role was added in v0.10.0 (#789) with its catalog entry, charter template, skill, AGENT_TEMPLATES map entry, and template manifest entry — but it was never wired into the user-facing onboarding flow. Users running `squad init` got Scribe/Ralph/Rai but never saw Fact Checker. Users running `squad upgrade` from older versions never got Rai or Fact Checker scaffolded either (upgrade was intentionally silent on agents).

This change 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
This change wires Fact Checker (and Rai, as a defensive backfill) into three code paths:

- **`init.ts`** — adds `fact-checker` to the default `agents:` array passed to `sdkInitSquad()`. Fresh `squad init` now produces `.squad/agents/fact-checker/`.
- **`cast.ts`** — adds `factCheckerMember()`, `factCheckerCharter()`, `hasFactChecker` branches in `castTeam()`, and the roster banner line. Interactive `squad cast` now offers Fact Checker as an always-on background agent.
- **`upgrade.ts`** — new `ensureBuiltinAgents()` runs in `runEnsureChecks()`. Idempotently scaffolds `.squad/agents/Rai/` and `.squad/agents/fact-checker/` from shipped charter templates if missing. Never overwrites existing charters or history files. Scribe and Ralph are intentionally NOT scaffolded by upgrade (they predate this fix in all squads, and their charters are inlined in cast.ts).

Result: any squad — fresh init, interactive cast, or upgrade from any prior version — now ends up with Fact Checker available.

Result: `squad init` (with or without `cast`) now produces `.squad/agents/fact-checker/charter.md` alongside the existing always-on agents.
78 changes: 78 additions & 0 deletions packages/squad-cli/src/cli/core/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,13 @@ async function runEnsureChecks(dest: string, templatesDir: string, filesUpdated:
filesUpdated.push(...memoryFiles);
}

const builtinAgents = ensureBuiltinAgents(dest, templatesDir);
if (builtinAgents.length > 0) {
const uniqueAgentNames = Array.from(new Set(builtinAgents.map(p => path.basename(path.dirname(p)))));
success(`scaffolded ${uniqueAgentNames.length} built-in agent(s): ${uniqueAgentNames.join(', ')}`);
filesUpdated.push(...builtinAgents);
}

const skillCount = syncAllSkills(dest, templatesDir);
if (skillCount > 0) {
success(`synced ${skillCount} skills to .copilot/skills/`);
Expand Down Expand Up @@ -757,6 +764,77 @@ export function ensureMemoryGovernanceUpgradeDefaults(dest: string): string[] {
return created;
}

/**
* Scaffold always-on built-in agent charters (Rai, Fact Checker) that ship
* as templates but may be missing from older squads. Idempotent — only writes
* when the agent directory is absent. Never overwrites existing charters or
* history. Sources charter content from the shipped `templates/{name}-charter.md`
* files when available, falling back to a minimal placeholder otherwise.
*
* Scribe and Ralph are intentionally NOT scaffolded here — they should already
* exist in any squad that ran a prior init, and their charters are inlined in
* cast.ts (no shipped template file). Adding them here would risk overwriting
* customized versions on legacy squads.
*
* @param dest Root directory containing .squad/
* @param templatesDir Directory containing shipped charter templates
* @returns Paths (relative to dest) of created agent files
*/
export function ensureBuiltinAgents(dest: string, templatesDir: string): string[] {
const agentsDir = path.join(dest, '.squad', 'agents');
if (!storage.existsSync(agentsDir)) {
storage.mkdirSync(agentsDir, { recursive: true });
}

// Built-in agents that ship as charter templates. Each entry maps to:
// - dirName: case-preserving directory name under .squad/agents/
// - templateFile: filename under templatesDir (charter template)
// - displayName: shown in history.md header
const builtins: Array<{ dirName: string; templateFile: string; displayName: string }> = [
{ dirName: 'Rai', templateFile: 'Rai-charter.md', displayName: 'Rai' },
{ dirName: 'fact-checker', templateFile: 'fact-checker-charter.md', displayName: 'Fact Checker' },
];

const created: string[] = [];
for (const agent of builtins) {
const agentDir = path.join(agentsDir, agent.dirName);
const charterPath = path.join(agentDir, 'charter.md');
const historyPath = path.join(agentDir, 'history.md');

// Idempotent: skip if agent directory already exists. Never overwrite
// existing charters or history files (preserves user customization).
if (storage.existsSync(agentDir)) continue;

// Source charter content from the shipped template; fall back to a
// minimal placeholder if the template file is missing (defensive — should
// not happen in a well-formed install, but better than crashing upgrade).
const tplPath = path.join(templatesDir, agent.templateFile);
let charterContent: string;
if (storage.existsSync(tplPath)) {
charterContent = storage.readSync(tplPath) ?? '';
} else {
charterContent = `# ${agent.displayName}\n\n> Charter template not found in shipped templates. Run \`squad upgrade\` after reinstalling the CLI to repair.\n`;
}

try {
storage.mkdirSync(agentDir, { recursive: true });
storage.writeSync(charterPath, charterContent);
created.push(path.join('.squad', 'agents', agent.dirName, 'charter.md'));

storage.writeSync(historyPath, `# ${agent.displayName} — History\n\n## Learnings\n\nInitial scaffold via \`squad upgrade\`. Ready for work.\n`);
created.push(path.join('.squad', 'agents', agent.dirName, 'history.md'));
} catch (err: unknown) {
if (err instanceof Error && 'code' in err && ['EPERM', 'EACCES'].includes((err as NodeJS.ErrnoException).code ?? '')) {
warn(`Could not scaffold built-in agent ${agent.displayName} (read-only). Create .squad/agents/${agent.dirName}/ manually.`);
continue;
}
throw err;
}
}

return created;
}

/**
* Run the upgrade command
*/
Expand Down
Loading