perf(workflows): load shipped mode playbooks as inline skills - #1739
Conversation
The shipped workflow declared MODE ISOLATION -- exactly one of ~20 mode playbooks runs per invocation -- but loaded all of them, plus the full planning ontology and policy, into every run's ambient prompt. Convert the 21 mode playbooks and the two planning reference files into gh-aw inline `## skill:` blocks, dispatched from a mode->skill table in Execute Mode. Files stay at their current paths and the imports: list is unchanged, so `gh aw add bradygaster/squad/workflows/squad.md@latest` keeps resolving. Ambient prompt: 72.6 KB -> 16.3 KB (-77.5%), verified by running gh-aw's own extractor over the assembled prompt. Also: * Fix a policy bug: squad.md forbade HTML comments as machine state while the docs made `<!-- squad-policy: lean -->` the primary config mechanism. gh-aw strips HTML comments before the agent sees the issue body, so it never worked. Now a plain `Squad-Policy:` directive line. BREAKING for anyone using the old comment syntax. * Prefix the shared planning files with `squad-` for consistency. * Extend allowed-files in squad-implement-worker.md by 17 entries, including C/C++ headers (previously *.c/*.cpp were allowed but headers were not) and .NET project/build files. * Make the gh-aw test suite runnable on Windows. It could not load at all (CRLF vs the `/^---\n/` frontmatter regex), so these assertions were passing vacuously on non-Linux machines. * Fix extractModeTable: a 3-column regex against a 2-column table matched only 12 of 24 rows, so mode-dispatch coverage was silently half-blind. * Add an extraction-semantics suite. A skill block closed implicitly at the next H2 DISCARDS trailing content, which silently dropped the ontology, the policy and the entire router body while still compiling clean. Guarded by a zero-discarded-bytes assertion. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ddaabd96-8df5-4998-8695-23b0dc1d896f
🛫 PR Readiness Check
PR Scope: 🔧 Infrastructure
|
| Status | Check | Details |
|---|---|---|
| ✅ | Single commit | 1 commit — clean history |
| ✅ | 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 | No source files changed — changeset not required |
| ✅ | Scope clean | No .squad/ or docs/proposals/ files |
| ✅ | No merge conflicts | No merge conflicts |
| ❌ | Copilot threads resolved | 1 unresolved Copilot thread(s) — fix and resolve before merging |
| ✅ | CI passing | All checks passing |
Files Changed (7 files, +391 −88)
| File | +/− |
|---|---|
.github/agents.md |
+8 −4 |
test-fixtures/planning/aspiregregator/README.md |
+1 −1 |
test/gh-aw-quality.test.ts |
+245 −33 |
workflows/shared/squad-planning-ontology.md |
+6 −0 |
workflows/shared/squad-planning-policy.md |
+17 −5 |
workflows/squad-implement-worker.md |
+17 −0 |
workflows/squad.md |
+97 −45 |
Total: +391 −88
This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.
🟡 Impact Analysis — PR #1739Risk tier: 🟡 MEDIUM 📊 Summary
🎯 Risk Factors
📦 Modules Affectedci-workflows (1 file)
root (5 files)
tests (1 file)
This report is generated automatically for every PR. See #733 for details. |
There was a problem hiding this comment.
Pull request overview
This PR reduces the always-loaded gh-aw ambient prompt by converting shipped mode playbooks (and planning reference material) into inline ## skill: blocks, then dispatching them via a mode→skill table in Execute Mode. It also updates planning policy selection syntax and strengthens tests around prompt assembly/extraction behavior and cross-platform line endings.
Changes:
- Converted shipped mode playbooks in
workflows/squad.mdinto inline skills and added an explicit mode→skill dispatch table inExecute Mode. - Updated planning policy selection from HTML comments to visible
Squad-Policy:/Squad-Setting:directive lines and refreshed related docs. - Expanded
allowed-filesfor the implement worker and added/updated tests to enforce inline-skill extraction invariants and CRLF normalization.
Show a summary per file
| File | Description |
|---|---|
| workflows/squad.md | Adds mode→skill dispatch table and wraps each mode playbook as an inline skill; updates policy resolution guidance. |
| workflows/squad-implement-worker.md | Expands the safe-outputs allowed-files allowlist with additional extensions. |
| workflows/shared/squad-planning-policy.md | Renames planning policy reference file and wraps it as an inline skill block (schema/reference content). |
| workflows/shared/squad-planning-ontology.md | Renames planning ontology reference file and wraps it as an inline skill block. |
| test/gh-aw-quality.test.ts | Normalizes CRLF in markdown reads; fixes mode-table parsing; adds inline-skill extraction regression tests and guards POSIX-shell-dependent suites. |
| test-fixtures/planning/aspiregregator/README.md | Updates fixture docs to reference the renamed planning ontology file. |
| .github/agents.md | Updates documentation to use visible policy directive lines instead of HTML comments. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 7/7 changed files
- Comments generated: 1
- Review effort level: Lite
| | `plan activate` | `squad-plan-activate` | | ||
| | `implement` | `squad-implement` | | ||
|
|
||
| **Planning modes only** — before running the mode skill, also load `squad-planning-policy` (policy resolution) and `squad-planning-ontology` (artifact schemas and the lifecycle state machine). The non-planning modes (Cast, Connect, Adopt, Cast Member, Retire, Status, Implement) must not load them. |
Summary
workflows/squad.mddeclares MODE ISOLATION — exactly one of ~20 mode playbooks executes per invocation — but it was loading all of them, plus the full planning ontology and policy, into every run's ambient prompt.This converts the 21 mode playbooks and the two planning reference files into gh-aw inline
## skill:blocks, dispatched from a mode→skill table inExecute Mode.Ambient prompt: 72.6 KB → 16.3 KB (−77.5%). Headroom against gh-aw's 100 KB ceiling goes from 27.6 KB to ~84 KB.
Scope is deliberately limited to the workflows we ship (top-level
workflows/). Nothing in.github/workflows/— the ones Squad uses in this repo — was touched.Distribution is unchanged
Files stay at their current paths and the
imports:list still resolves, so this keeps working:workflows/shared/squad.mdwas deliberately not renamed — it's documented as a standalone import path, so prefixing it would break existing consumers.Policy selection in an issue body changes:
This fixes a real bug rather than introducing churn:
squad.mdforbade HTML comments as machine state while the docs made the commented form the primary config mechanism — and gh-aw strips HTML comments before the agent ever sees the issue body, so it never worked. Docs updated in.github/agents.md.Also in here
shared/planning-{ontology,policy}.md→shared/squad-planning-*.mdfor consistency. Done asgit mv(98% / 80% similarity), with all 8 referencing sites updated.allowed-files+17 entries insquad-implement-worker.md: C/C++ headers (*.h,*.hpp— previously*.c/*.cppwere allowed but headers weren't, so C/C++ work was half-blocked), .NET project/build files (*.csproj,*.fsproj,*.sln,*.slnx,*.props,*.targets), plusphp,kt,kts,swift,sql,vue,svelte,cjs,gradle. Still an explicit allowlist — no wildcard.nuget.configintentionally excluded as a supply-chain surface.Test changes worth reviewing
Three of these are findings, not just maintenance:
/^---\n/frontmatter regex doesn't match CRLF, and.gitattributesdoesn't pin*.mdto LF. The file failed to load, so ~86 assertions were passing vacuously on non-Linux machines. Fixed with areadText()CRLF-normalizing helper.extractModeTablewas half-blind. A 3-column regex against a 2-column table matched only 12 of 24 rows. Fixed; coverage doubled, and it immediately caught a mode (Plan Accept (fast-path)) whose parenthetical broke heading matching.inline skill extractionsuite. This one matters: a skill block closed implicitly at the next##heading discards trailing content. My first pass at wrapping the ontology silently dropped ~29 KB — the ontology, the policy, and the entire router body — and still compiled clean with all tests green. Now guarded by a zero-discarded-bytes assertion plus byte conservation, required-ambient-sections, and an ambient size budget.Verification
gh-aw-quality.test.tsgoing fail→pass (finding feat: worktree awareness, Scribe auto-commit, and decision consolidation #1 above). The 16 remaining failures are pre-existing Windows issues (path separators, hard-coded/bin/sh) and reproduce identically on the unmodified tree.template-syncflagged once but is flaky under parallel load — passes in isolation (252 tests) and did not recur on a second full run.npm run buildpasses.gh aw compile --strict→ exit 0, against a real mirror atbradygaster/aspiregregator-squad-test. Lock resolves the renamed imports correctly.extract_inline_skills.cjsover the assembled prompt.No changeset: this touches no
packages/*/src/.Not yet done
A live end-to-end run in the test repo, to confirm skills actually load lazily at runtime rather than merely compiling. That needs secrets configured in the test repo and is queued as follow-up. Everything verified so far proves the workflow compiles and extracts correctly — not that a real run dispatches a single skill.
I'd also suggest promoting the consumer-install harness into
scripts/or CI. The content-discard bug above was caught by hand; that shouldn't be the mechanism.