feat(prompt): slim squad.agent.md by extracting 3 sections to satellite skills (#1308 phase 1)#1311
Conversation
🛫 PR Readiness Check
PR Scope: 📦🔧 Mixed (product + infrastructure)
|
| Status | Check | Details |
|---|---|---|
| ❌ | Single commit | 5 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 merge conflicts | No merge conflicts |
| ✅ | Copilot threads resolved | 0 active Copilot thread(s) resolved (1 outdated skipped) |
| ❌ | CI passing | 7 check(s) still running |
Files Changed (22 files, +1053 −841)
| File | +/− |
|---|---|
.changeset/slim-squad-agent-md-phase1.md |
+90 −0 |
.github/agents/squad.agent.md |
+53 −162 |
.squad-templates/squad.agent.md |
+20 −160 |
.squad/skills/coordinator-init-mode/SKILL.md |
+83 −0 |
.squad/skills/coordinator-response-mode/SKILL.md |
+97 −0 |
.squad/skills/coordinator-source-of-truth/SKILL.md |
+45 −0 |
docs/src/content/docs/features/skill-security-scanner.md |
+2 −2 |
index.cjs |
+2 −1 |
packages/squad-cli/src/cli/core/templates.ts |
+18 −0 |
packages/squad-cli/templates/skills/coordinator-init-mode/SKILL.md |
+83 −0 |
packages/squad-cli/templates/skills/coordinator-response-mode/SKILL.md |
+97 −0 |
packages/squad-cli/templates/skills/coordinator-source-of-truth/SKILL.md |
+45 −0 |
packages/squad-cli/templates/squad.agent.md.template |
+20 −160 |
packages/squad-sdk/src/config/init.ts |
+3 −0 |
packages/squad-sdk/templates/skills/coordinator-init-mode/SKILL.md |
+83 −0 |
packages/squad-sdk/templates/skills/coordinator-response-mode/SKILL.md |
+97 −0 |
packages/squad-sdk/templates/skills/coordinator-source-of-truth/SKILL.md |
+45 −0 |
packages/squad-sdk/templates/squad.agent.md.template |
+20 −160 |
templates/squad.agent.md.template |
+20 −160 |
test/init-flow.test.cjs |
+57 −13 |
test/squad-agent-roster.test.ts |
+65 −15 |
test/version-stamping.test.cjs |
+8 −8 |
Total: +1053 −841
This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.
🟠 Impact Analysis — PR #1311Risk tier: 🟠 HIGH 📊 Summary
🎯 Risk Factors
📦 Modules Affectedci-workflows (1 file)
docs (1 file)
root (3 files)
squad-cli (5 files)
squad-sdk (5 files)
squad-state (3 files)
templates (1 file)
tests (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 reduces the always-loaded coordinator prompt size by extracting three large, low-cross-reference sections from squad.agent.md into on-demand “satellite” skills, leaving short trigger stubs behind so coordinator behavior stays the same while cutting cold-start prompt bytes.
Changes:
- Replaced the full Init Mode, Response Mode Selection, and Source of Truth Hierarchy sections in
squad.agent.mdwith short stubs that instruct the coordinator toskill(coordinator-*)before acting. - Added three new bundled skills (
coordinator-init-mode,coordinator-response-mode,coordinator-source-of-truth) to the CLI/SDK templates and wired them into the install manifests. - Updated
MANIFEST_SKILL_NAMESandTEMPLATE_MANIFESTsosquad init/upgradeinstalls the three new skills into.github/skills/.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| templates/squad.agent.md.template | Replaces the three extracted sections with stubs that instruct loading the new coordinator-* skills. |
| packages/squad-cli/templates/squad.agent.md.template | Mirrors the stub replacements for the CLI template copy. |
| packages/squad-sdk/templates/squad.agent.md.template | Mirrors the stub replacements for the SDK template copy. |
| .squad-templates/squad.agent.md | Canonical template updated with stubs; drives sync to other prompt mirrors. |
| .github/agents/squad.agent.md | Synced agent prompt copy updated with the same stubs (and remains aligned with the template). |
| packages/squad-cli/templates/skills/coordinator-init-mode/SKILL.md | New skill containing the full two-phase Init Mode protocol. |
| packages/squad-cli/templates/skills/coordinator-response-mode/SKILL.md | New skill containing the full response-mode decision table + lightweight spawn template. |
| packages/squad-cli/templates/skills/coordinator-source-of-truth/SKILL.md | New skill containing the full file-by-file “source of truth” table and rules. |
| packages/squad-sdk/templates/skills/coordinator-init-mode/SKILL.md | SDK mirror of the coordinator-init-mode skill. |
| packages/squad-sdk/templates/skills/coordinator-response-mode/SKILL.md | SDK mirror of the coordinator-response-mode skill. |
| packages/squad-sdk/templates/skills/coordinator-source-of-truth/SKILL.md | SDK mirror of the coordinator-source-of-truth skill. |
| packages/squad-sdk/src/config/init.ts | Adds the three new skills to MANIFEST_SKILL_NAMES. |
| packages/squad-cli/src/cli/core/templates.ts | Adds three new entries to TEMPLATE_MANIFEST to install the skills to .github/skills/.... |
| .changeset/slim-squad-agent-md-phase1.md | Changeset documenting the prompt slimming and wiring changes. |
| - New: `.squad/skills/coordinator-{source-of-truth,response-mode,init-mode}/SKILL.md` (canonical sources) | ||
| - Mirrored to `packages/squad-cli/templates/skills/` and `packages/squad-sdk/templates/skills/` |
There was a problem hiding this comment.
Good catch — addressed in commit 3a1ca20f.
The 3 canonical source dirs existed in my worktree but had never been git add-ed because .squad/ is gitignored in this repo (specific subpaths under it are exception-tracked, same as every other .squad/skills/* entry). The template mirrors at packages/squad-{cli,sdk}/templates/skills/coordinator-*/ shipped fine, but the canonical sources at .squad/skills/coordinator-*/SKILL.md weren't in the tree — which would have:
- Made the changeset claim untrue on
dev. - Broken
scripts/sync-skill-templates.mjson a fresh checkout — sync would silently drop the 3 new skills on next prebuild.
Force-added the 3 dirs (git add -f because of the .squad/ ignore rule). Verified node scripts/sync-skill-templates.mjs now lists coordinator-* among the 26 discovered skills and re-produces both template mirrors byte-identical.
…-init-mode skill CI failure on bradygaster#1311: test/squad-agent-roster.test.ts asserted the 'Determine team size' line is in squad.agent.md.template, but after bradygaster#1308 phase 1 that line moved into the coordinator-init-mode skill. Restructured the test into two describe blocks: 1. squad.agent.md.template — must still keep an Init Mode STUB that names the coordinator-init-mode satellite skill AND preserves the load-bearing eager-execution exception callout. This makes sure future edits can't accidentally drop the satellite reference. 2. coordinator-init-mode/SKILL.md (3 mirrors) — must contain the 'Determine team size' line naming all four built-ins, AND must mark each of Scribe/Ralph/Rai/Fact Checker as 'exempt from casting'. The regression coverage from bradygaster#1299 follows the content. 22/22 tests pass. Also addressed the changeset review comment: clarified that .squad/skills/coordinator-*/SKILL.md are the canonical source files in the squad repo (where every other bundled skill source lives), and they're copied to .github/skills/ on install/upgrade per bradygaster#1304. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…review on bradygaster#1311) Reviewer caught a real bug: the new coordinator-* skill source dirs existed in my worktree but had never been `git add`-ed because `.squad/` is gitignored on this repo (specific subpaths under it are exception-tracked). The template mirrors at packages/squad-{cli,sdk}/templates/skills/coordinator-*/ shipped fine, but the canonical sources at .squad/skills/coordinator-*/SKILL.md weren't in the tree — so: - The changeset claim that .squad/skills/coordinator-*/ is the canonical source was untrue on dev. - scripts/sync-skill-templates.mjs would not see the new skills when run from a fresh checkout, breaking the contributor workflow (canonical → mirrors). Sync would silently drop the 3 new skills on the next prebuild. Force-added the 3 dirs (`git add -f` because of the .squad/ ignore rule, same as every other tracked skill under .squad/skills/). Verified: `node scripts/sync-skill-templates.mjs` now lists coordinator-* among the 26 discovered skills and re-produces the 2 template mirrors byte-identical to the canonical sources. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
…es pre-release tail Two narrow fixes uncovered while smoke-testing the slim squad.agent.md PR (bradygaster#1311) and the 0.10.0-insider.1 release pipeline: 1. test/init-flow.test.cjs — after the Init Mode prose moved from squad.agent.md to the coordinator-init-mode satellite skill (bradygaster#1308 / PR bradygaster#1311), the structural assertions in 'Init Mode prompt structure (bradygaster#66)' had nothing to read in the parent file. They now follow the pointer via the new readSatelliteSkill() helper (which prefers the installed copy at .github/skills/<name>/SKILL.md and falls back to the source repo template at packages/squad-sdk/templates/skills/), so the same gates (STOP/WAIT, 'Look right?', numbered confirm-before- create flow, Phase 2 trigger) keep being enforced — just against the prompt the coordinator actually loads at runtime. 2. test/version-stamping.test.cjs + index.cjs — the version regex [0-9.]+(?:-[a-z]+)? truncated pre-release versions with a numeric tail (e.g. 0.10.0-insider.1 → 0.10.0-insider, 0.10.0-build.3 → 0.10.0-build). That made the test 'upgrade detects same version' fail locally on any contributor who built the package (pkg.version gets stamped 0.10.0-build.N during build). More importantly it made the legacy index.cjs upgrade re-run the full upgrade flow for npm- installed insider users (who have 0.10.0-insider.1 on disk) instead of printing 'Already up to date'. Widened to [0-9.]+(?:-[a-z]+(?:\.[0-9]+)?)? — matches everything we already accepted plus the .N tail used by npm pre-release dist-tags and the build-time stamping script. All 133 .cjs tests now pass (was 123 pass / 10 fail before). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Follow-up on smoke-testing this PR end-to-end: found a latent issue caused by the slim — the .cjs structural assertions in These tests don't run in the standard CI suite (vitest) — they run in Pushed
All 133 |
…es pre-release tail Two narrow fixes uncovered while smoke-testing the slim squad.agent.md PR (bradygaster#1311) and the 0.10.0-insider.1 release pipeline: 1. test/init-flow.test.cjs — after the Init Mode prose moved from squad.agent.md to the coordinator-init-mode satellite skill (bradygaster#1308 / PR bradygaster#1311), the structural assertions in 'Init Mode prompt structure (bradygaster#66)' had nothing to read in the parent file. They now follow the pointer via the new readSatelliteSkill() helper (which prefers the installed copy at .github/skills/<name>/SKILL.md and falls back to the source repo template at packages/squad-sdk/templates/skills/), so the same gates (STOP/WAIT, 'Look right?', numbered confirm-before- create flow, Phase 2 trigger) keep being enforced — just against the prompt the coordinator actually loads at runtime. 2. test/version-stamping.test.cjs + index.cjs — the version regex [0-9.]+(?:-[a-z]+)? truncated pre-release versions with a numeric tail (e.g. 0.10.0-insider.1 → 0.10.0-insider, 0.10.0-build.3 → 0.10.0-build). That made the test 'upgrade detects same version' fail locally on any contributor who built the package (pkg.version gets stamped 0.10.0-build.N during build). More importantly it made the legacy index.cjs upgrade re-run the full upgrade flow for npm- installed insider users (who have 0.10.0-insider.1 on disk) instead of printing 'Already up to date'. Widened to [0-9.]+(?:-[a-z]+(?:\.[0-9]+)?)? — matches everything we already accepted plus the .N tail used by npm pre-release dist-tags and the build-time stamping script. All 133 .cjs tests now pass (was 123 pass / 10 fail before). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…te skills (bradygaster#1308 phase 1) squad.agent.md is loaded as the agent prompt at every Copilot session start. v0.10.0-insider.1 ships it at 81 KB / 1137 lines and the v0.10 stabilisation pass alone added +10.6 KB / +114 lines. Every byte is paid at every session. Phase 1 fix: extract three low-cross-reference, high-byte sections to satellite skills the coordinator loads on demand via the skill tool — same pattern that worked for cross-squad-communication (bradygaster#1295). - coordinator-init-mode — Init Mode Phase 1 + Phase 2 (5.4 KB) - coordinator-source-of-truth — Source of Truth Hierarchy (4.4 KB) - coordinator-response-mode — Response Mode Selection + Lightweight Spawn Template (3.9 KB) Result: squad.agent.md 81 KB → 70 KB (-13.9 %, -140 lines). 19 skills installed at .github/skills/ (was 16). Behaviour unchanged — each removed section is replaced with a stub naming the trigger condition and instructing the coordinator to skill(coordinator-X) before acting. Sections that stay in squad.agent.md (intentional): - Team Mode + state-backend handshake + HARD RULE — handshake must fire before any state write - Routing table — hit on every user prompt - Hard trigger keyword-to-skill match paragraph (bradygaster#1307) — load-bearing - How to Spawn an Agent — referenced from every routing action - Coordinator Identity / Personal Squad / Memory Governance Tools — frequently re-read inline Wired changes: - New canonical sources at .squad/skills/coordinator-{x}/SKILL.md plus 2 template-dir mirrors - MANIFEST_SKILL_NAMES grows by 3 entries (16 → 19) - TEMPLATE_MANIFEST grows by 3 entries with ../.github/skills/ destinations (post-bradygaster#1304 install location) - .squad-templates/squad.agent.md replaces each section with a stub - 4 mirrored squad.agent.md copies re-synced via scripts/sync-templates.mjs --sync Tests: 287/287 pass. The existing 'should install every manifest-curated skill (regression: bradygaster#1289, bradygaster#1264)' already iterates MANIFEST_SKILL_NAMES, so it automatically asserts the 3 new skills install. Smoke test: fresh squad init produces 19 skills at .github/skills/ and squad.agent.md is 70 KB. Follow-ups (separate PRs) for the still-large sections: - Routing (9.2 KB) — extract action-cell verbiage, keep trigger table - Team Mode (5.5 KB) — extract worktree-awareness sub-sections - How to Spawn (3.2 KB) — extract role-emoji catalog Target after 2-3 follow-ups: ~45 KB coordinator file. Closes bradygaster#1308 (phase 1). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…-init-mode skill CI failure on bradygaster#1311: test/squad-agent-roster.test.ts asserted the 'Determine team size' line is in squad.agent.md.template, but after bradygaster#1308 phase 1 that line moved into the coordinator-init-mode skill. Restructured the test into two describe blocks: 1. squad.agent.md.template — must still keep an Init Mode STUB that names the coordinator-init-mode satellite skill AND preserves the load-bearing eager-execution exception callout. This makes sure future edits can't accidentally drop the satellite reference. 2. coordinator-init-mode/SKILL.md (3 mirrors) — must contain the 'Determine team size' line naming all four built-ins, AND must mark each of Scribe/Ralph/Rai/Fact Checker as 'exempt from casting'. The regression coverage from bradygaster#1299 follows the content. 22/22 tests pass. Also addressed the changeset review comment: clarified that .squad/skills/coordinator-*/SKILL.md are the canonical source files in the squad repo (where every other bundled skill source lives), and they're copied to .github/skills/ on install/upgrade per bradygaster#1304. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…review on bradygaster#1311) Reviewer caught a real bug: the new coordinator-* skill source dirs existed in my worktree but had never been `git add`-ed because `.squad/` is gitignored on this repo (specific subpaths under it are exception-tracked). The template mirrors at packages/squad-{cli,sdk}/templates/skills/coordinator-*/ shipped fine, but the canonical sources at .squad/skills/coordinator-*/SKILL.md weren't in the tree — so: - The changeset claim that .squad/skills/coordinator-*/ is the canonical source was untrue on dev. - scripts/sync-skill-templates.mjs would not see the new skills when run from a fresh checkout, breaking the contributor workflow (canonical → mirrors). Sync would silently drop the 3 new skills on the next prebuild. Force-added the 3 dirs (`git add -f` because of the .squad/ ignore rule, same as every other tracked skill under .squad/skills/). Verified: `node scripts/sync-skill-templates.mjs` now lists coordinator-* among the 26 discovered skills and re-produces the 2 template mirrors byte-identical to the canonical sources. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…es pre-release tail Two narrow fixes uncovered while smoke-testing the slim squad.agent.md PR (bradygaster#1311) and the 0.10.0-insider.1 release pipeline: 1. test/init-flow.test.cjs — after the Init Mode prose moved from squad.agent.md to the coordinator-init-mode satellite skill (bradygaster#1308 / PR bradygaster#1311), the structural assertions in 'Init Mode prompt structure (bradygaster#66)' had nothing to read in the parent file. They now follow the pointer via the new readSatelliteSkill() helper (which prefers the installed copy at .github/skills/<name>/SKILL.md and falls back to the source repo template at packages/squad-sdk/templates/skills/), so the same gates (STOP/WAIT, 'Look right?', numbered confirm-before- create flow, Phase 2 trigger) keep being enforced — just against the prompt the coordinator actually loads at runtime. 2. test/version-stamping.test.cjs + index.cjs — the version regex [0-9.]+(?:-[a-z]+)? truncated pre-release versions with a numeric tail (e.g. 0.10.0-insider.1 → 0.10.0-insider, 0.10.0-build.3 → 0.10.0-build). That made the test 'upgrade detects same version' fail locally on any contributor who built the package (pkg.version gets stamped 0.10.0-build.N during build). More importantly it made the legacy index.cjs upgrade re-run the full upgrade flow for npm- installed insider users (who have 0.10.0-insider.1 on disk) instead of printing 'Already up to date'. Widened to [0-9.]+(?:-[a-z]+(?:\.[0-9]+)?)? — matches everything we already accepted plus the .N tail used by npm pre-release dist-tags and the build-time stamping script. All 133 .cjs tests now pass (was 123 pass / 10 fail before). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… table CI failure on dev tip (567f447, Squad CI run 27488323855): test/docs-build.test.ts > 'all code blocks are properly fenced (even count of backticks)' → expected 1 to be 0 test/docs-build.test.ts > 'code blocks contain language specification or valid content' → expected 1 to be greater than 1 Root cause: a 4-backtick table cell intended to display a literal triple-backtick: | Inside a fenced code block (\\\\ \\\ \\\\) | Suppressed | made the regex /\\\/g see 5 triple-backtick occurrences across the file (instead of the 2 from the real bash example), tripping both the even-fence check and the line-count > 1 check. Rephrased the table to say 'three backticks' / 'single backtick' in prose — no embedded delimiters, no need to defend against the markdown fence escape mechanism. Reads cleaner anyway. Verified locally: 22/22 docs-build tests pass; npm run build in docs/ completes (171 files emitted; pagefind indexes 168 pages, 6911 words). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
df3ddfa to
28188c0
Compare
Phase 1 of #1308 — first batch of extractions
squad.agent.mdis loaded as the agent prompt at every Copilot session start. v0.10.0-insider.1 ships it at 81 KB / 1,137 lines and was steadily growing — the v0.10 stabilisation pass alone added +10.6 KB. Every byte is paid at every session.This PR extracts three low-cross-reference, high-byte sections to satellite skills the coordinator loads on demand via the
skilltool. Same pattern that worked forcross-squad-communication(#1295).coordinator-init-mode(Init Mode Phase 1 + Phase 2)coordinator-source-of-truth(Source of Truth Hierarchy table)coordinator-response-mode(Response Mode Selection + Lightweight Spawn Template)Result
squad.agent.md: 81 KB → 70 KB (-13.9 %, -140 lines).github/skills/(was 16, +3 newcoordinator-*)skill(coordinator-X)before actingSections that stay in
squad.agent.md(intentional)These are loaded on every prompt and/or are load-bearing for first-touch behaviour:
Wired changes
.squad/skills/coordinator-{source-of-truth,response-mode,init-mode}/SKILL.md(canonical sources)packages/squad-cli/templates/skills/andpackages/squad-sdk/templates/skills/MANIFEST_SKILL_NAMESgrows by 3 entries (16 → 19)TEMPLATE_MANIFESTgrows by 3 entries with../.github/skills/destinations (matching the post-fix(skills): install bundled skills to .github/skills/ (closes #1126) #1304 install location).squad-templates/squad.agent.mdreplaces each extracted section with a stubscripts/sync-templates.mjs --syncTests
should install every manifest-curated skill (regression: bradygaster/squad#1289, #1264)already importsMANIFEST_SKILL_NAMESand iterates it, so it automatically asserts the 3 new skills install — no manual edits needed.squad initproduces 19 skills at.github/skills/andsquad.agent.mdis 70 KB.Composability
Disjoint from all other open PRs (#1225 W6 preset install URL). Pure file moves + a few line replacements + 3 manifest entries.
Follow-ups (separate PRs)
The remaining high-bloat sections in
squad.agent.mdare stickier and need careful design:Target after 2-3 follow-ups: ~45 KB coordinator file (45 % total reduction from today's 81 KB).
Closes #1308 (phase 1).