Skip to content

docs(claude): align Claude Code spec, docs and matrix with the code; add host projection regression guards (#2440) - #2445

Merged
bradygaster merged 2 commits into
devfrom
squad/2440-claude-spec-code-agreement
Nov 9, 2026
Merged

bradygaster merged 2 commits into
devfrom
squad/2440-claude-spec-code-agreement

Conversation

@bradygaster

Copy link
Copy Markdown
Collaborator

Working as docs-devrel and architect (labels on #2440).

What

PR 1 of epic #2438 (Claude Code as a first-class host). The spec, docs and host feature matrix now agree with the code on Claude Code. The PR also adds the regression guards every later PR in the epic must keep green, and records the Phase 7 canonical-coordinator question as a Proposed ADR.

  • Task → Agent: Claude Code's subagent tool is now Agent. The rename covers the Claude dispatch section in coordinator.ts, harness-adapters §5 and §7.2, the architecture doc and five matrix cells. §7.2 also describes model, run_in_background and isolation: "worktree".

  • Harness-adapters §13: the spec claimed <!-- SQUAD:claude:START --> markers in .gitignore. apply.ts actually writes lines under a # squad:claude comment, and CLAUDE.md uses the squad:begin/squad:end block. The spec now describes both.

  • model-selection.claude: the old reason ("Task has no per-call model") was wrong. The cell now says Claude Code supports it and Squad's coordinator doesn't use it yet. It stays unsupported / expected-fail; making it supported is a coordinator change tracked in Claude host PR 3: Claude projection v2 (member subagents, skills, hooks, watch preset) (#2438 Phases 2, 3, 4, 6) #2442.

  • Docs:

  • Regression guards (test/host-projection-regression-guards.test.ts):

    1. A hash snapshot of everything squad init + squad upgrade writes for Copilot. Only the version and CRLF are normalized.
    2. squad upgrade and squad upgrade --force on a steady-state Copilot-only repo change no file.
    3. squad upgrade --client copilot changes only .squad/config.json and writes no Claude files.
    4. Adding Claude and then running uninstallClients(['claude']) leaves every Copilot file byte-identical.

    Byte-exact rollback of user files for all 7 hosts was already covered by the existing "Reviewer gate" test in clients.test.ts.

  • ADR-003 (Proposed): a host-neutral canonical coordinator. No implementation; merging this PR does not approve it.

Why

Closes #2440. This is Phase 0 and Phase 7 (decision only) of #2438. It merges first so PRs 2 and 3 (#2441, #2442) are built on correct spec text and checked by the guards.

How

  • The matrix page is generated: I edited host-feature-matrix.json and the renderer, then re-ran scripts/render-host-feature-matrix.mjs.
  • I checked that guard 1's snapshot matches dev's code: I reverted coordinator.ts to dev, re-ran the guard, and got the same snapshot. Copilot output is unchanged.
  • Guard 2 checks from a steady state on purpose. On dev, the first squad upgrade after init is never a no-op, even for Copilot-only repos (it adds workflows, casting files and .gitignore lines). The guard therefore runs init + one upgrade first.
  • ADR-003 is narrower than the epic's wording. In this repo the coordinator's source is already host-neutral (.squad-templates/). The Copilot-specific part is the workspace: users only get .github/agents/squad.agent.md, and every other host's digest is told to read it as authoritative.

Test results

  • npm run lint, eslint on the new test, markdownlint-cli2 and cspell on the changed docs: clean.
  • test/clients.test.ts and the new guard tests pass after rebasing onto the latest dev: 116 passed, 35 expected-fail.
  • The full suite on macOS has 26 failures in 8–9 files (upstream-*, memory-*, profile-fs-guard, export-import, gh-aw-bootstrap-workflow, upgrade-profile-teamroot, and two bridge tests in squad-20-host-feature-matrix). The same 26 fail on clean dev with these changes stashed. They're temp-path checks (for example "Path traversal" against the temp directory), not this change. CI (Ubuntu) is the reference.

⚠️ Quick Check

  • If SDK/CLI source files changed: completed the applicable Changeset step below

PR Readiness Checklist

Branch & Commit

  • Branch created from dev (not main)
  • Branch is up to date with dev
  • Verified diff contains only intended changes (13 files)
  • PR is not in draft mode
  • Commit history is clean (one commit)

Build & Test

  • npm run build passes
  • npm test passes: see Test results (failures match dev locally; relying on CI)
  • npm run lint passes
  • npm run lint:eslint passes (on the changed test files)
  • For migration PRs (>20 files): N/A

Changeset

  • Changeset added (.changeset/claude-agent-tool-dispatch.md, squad-sdk patch)

Docs

  • README section updated
  • Docs feature page (Claude Code section in client-compatibility.md)

Exports

  • package.json subpath exports updated: N/A, no new modules

Breaking Changes

None. Existing Claude Code installs see a wording-only diff in .claude/agents/squad.md on the next squad upgrade --client claude. Copilot output is unchanged (guard 1).

Waivers

None.

🤖 Generated with Claude Code

Copilot AI auto review requested due to automatic review settings November 9, 2026 17:25
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

🟠 Impact Analysis — PR #2445

Risk tier: 🟠 HIGH

📊 Summary

Metric Count
Files changed 13
Files added 4
Files modified 9
Files deleted 0
Modules touched 5

🎯 Risk Factors

  • 13 files changed (6-20 → MEDIUM)
  • 5 modules touched (5-8 → HIGH)

📦 Modules Affected

docs (5 files)
  • docs/specification/adr-003-host-neutral-canonical-coordinator.md
  • docs/specification/client-harness-adapters-v0.2.md
  • docs/src/content/docs/concepts/squad-2-0-architecture.md
  • docs/src/content/docs/reference/host-feature-matrix.md
  • docs/src/content/docs/scenarios/client-compatibility.md
root (3 files)
  • .changeset/claude-agent-tool-dispatch.md
  • README.md
  • test-fixtures/spec/suite-v0.2/host-feature-matrix.json
scripts (1 file)
  • scripts/render-host-feature-matrix.mjs
squad-sdk (1 file)
  • packages/squad-sdk/src/client/adapters/coordinator.ts
tests (3 files)
  • test/__snapshots__/host-projection-regression-guards.test.ts.snap
  • test/clients.test.ts
  • test/host-projection-regression-guards.test.ts

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

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🛫 PR Readiness Check

ℹ️ This comment updates on each push. Last checked: commit 13517eb

PR Scope: 📦🔧 Mixed (product + infrastructure)

⚠️ 3 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 All 3 Copilot thread(s) resolved
❌ CI passing 1 check(s) still running

Files Changed (13 files, +415 −30)

File +/−
.changeset/claude-agent-tool-dispatch.md +5 −0
README.md +2 −2
docs/specification/adr-003-host-neutral-canonical-coordinator.md +106 −0
docs/specification/client-harness-adapters-v0.2.md +20 −7
docs/src/content/docs/concepts/squad-2-0-architecture.md +1 −1
docs/src/content/docs/reference/host-feature-matrix.md +8 −8
docs/src/content/docs/scenarios/client-compatibility.md +35 −1
packages/squad-sdk/src/client/adapters/coordinator.ts +2 −2
scripts/render-host-feature-matrix.mjs +1 −1
test-fixtures/spec/suite-v0.2/host-feature-matrix.json +7 −7
test/__snapshots__/host-projection-regression-guards.test.ts.snap +41 −0
test/clients.test.ts +1 −1
test/host-projection-regression-guards.test.ts +186 −0

Total: +415 −30


This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.

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.

🟡 Changes recommended

Regression snapshots retain machine-specific paths that make hashes checkout-dependent, while Claude’s runtime flag contradicts its documented support and upgrade/rollback coverage remains missing.

3 open issues
What changed in this PR

This PR prepares Squad’s Claude Code host work by aligning documentation and generated instructions with current capabilities, adding regression guards, and recording the canonical-coordinator question without implementing it.

Changes:

  • Updates Claude dispatch terminology from Task to Agent and clarifies host capabilities and remaining gaps.
  • Adds Copilot projection snapshots, upgrade checks, and Claude install/uninstall preservation guards.
  • Adds ADR-003 with Proposed status; no coordinator migration is implemented.
File Description
test/​host-projection-regression-guards.test.ts Adds projection and upgrade regression guards.
test/​clients.test.ts Expects Claude’s Agent dispatch primitive.
test/​__snapshots__/​host-projection-regression-guards.test.ts.snap Records Copilot projection hashes.
test-fixtures/​spec/​suite-v0.2/​host-feature-matrix.json Corrects Claude capability descriptions.
scripts/​render-host-feature-matrix.mjs Clarifies shared-digest gaps in generated documentation.
README.md Broadens host messaging and qualifies model selection.
packages/​squad-sdk/​src/​client/​adapters/​coordinator.ts Updates Claude dispatch instructions and options.
docs/​src/​content/​docs/​scenarios/​client-compatibility.md Adds Claude setup and capability guidance.
docs/​src/​content/​docs/​reference/​host-feature-matrix.md Reflects updated matrix descriptions and gap notes.
docs/​src/​content/​docs/​concepts/​squad-2-0-architecture.md Updates the Claude dispatch tool name.
docs/​specification/​client-harness-adapters-v0.2.md Corrects Claude parameters and managed-file markers.
docs/​specification/​adr-003-host-neutral-canonical-coordinator.md Proposes options for a host-neutral canonical coordinator.
.changeset/​claude-agent-tool-dispatch.md Records the SDK’s generated Claude instruction change.

Review effort: Balanced (auto)

@bradygaster bradygaster left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Working as architect (Lead Architect). Advisory COMMENT, not approval; this API identity is also the PR author's.

Reviewed 7a19c26fe5cd7f760e4cba80e2ab6c700728b3af against #2440 / #2438. ADR-003 remains Proposed, with no migration implemented. No request to pull later-phase harness/hooks/member projection work into this PR.

Corrections: I independently reproduced the machine-dependent MCP snapshot failure and confirmed that guard 4 never upgrades an already-configured Claude install. Copilot has since posted both findings; please address its existing threads rather than creating duplicate work. The additional inline comment separates Squad's dispatch policy from the current host capability.

Validation in an isolated detached worktree:

  • npm run build --workspace packages/squad-sdk and npm run build --workspace packages/squad-cli: passed.
  • node node_modules/vitest/vitest.mjs run test/clients.test.ts test/host-projection-regression-guards.test.ts --reporter=dot: 115 passed, 35 expected failures, 1 failed (guard 1, only .mcp.json hash differs). Fixture/profile directories were redirected outside the checkout, under this review's session files. The built MCP launch spec includes absolute Node and CLI-entry paths, which the snapshot normalization retains.
  • node node_modules/vitest/vitest.mjs run test/squad-20-host-feature-matrix.test.ts -t 'host-feature-matrix.json integrity' --reporter=dot: 9 passed, 11 skipped.
  • node scripts/render-host-feature-matrix.mjs --check: passed.

No full-suite or live Claude/API run; CI's main test job was still running when checked. No fixes or changes to the author's worktree.

bradygaster added a commit that referenced this pull request Nov 9, 2026
…e, mark Claude perSpawnModel

Review feedback on #2445.

- Pin the squad_state launch spec to the exact-version npx form in the
  host projection guards. In a built checkout the real resolver writes the
  local node binary and checkout path into .mcp.json, so the Copilot
  snapshot depended on where the checkout lives. Regenerate the snapshot.
- Add guard 5: with user content in .mcp.json, .gitignore and CLAUDE.md,
  `squad upgrade --client claude` (plain and --force) on an existing Claude
  install changes nothing, user content survives, and removing Claude
  restores the user's bytes.
- Set hosts.claude.runtime.perSpawnModel to true (the Agent tool takes a
  per-call model) and regenerate the matrix page. The model-selection cell
  stays unsupported/expected-fail until the coordinator uses it.

Refs #2440

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bradygaster

Copy link
Copy Markdown
Collaborator Author

Thanks for the responses. Focused follow-up on 52984ea2 (52984ea25bca9a608dc192c9d66f49601c2ca2e4), checking only the delta from my original review:

  • Addressed: deterministic MCP snapshot. The suite now forces the pinned resolver path; the previously failing guard passes in a different, fully built checkout.
  • Addressed: existing-Claude upgrade/rollback coverage. New guard 5 calls runUpgrade again with plain and forced upgrades, checks the existing projection remains unchanged, and verifies original shared user-file bytes after uninstall.
  • Addressed: the matrix host-level per-spawn-model flag is corrected and the generated page agrees; Squad's model-selection cell correctly remains unsupported/expected-fail pending Claude host PR 3: Claude projection v2 (member subagents, skills, hooks, watch preset) (#2438 Phases 2, 3, 4, 6) #2442.
  • Still open, wording only: my documentation thread. Neither the new capability-table sentence nor the matching Claude dispatch wording changed in this delta. Please frame coordinator-only dispatch as Squad policy (or qualify the tested older host version), rather than an unconditional Claude limitation. No nested-dispatch implementation is requested. I have left only my own thread open and have not altered anyone else's resolution state.

Verified in an isolated detached worktree: both workspace builds passed; node node_modules/vitest/vitest.mjs run test/host-projection-regression-guards.test.ts test/squad-20-host-feature-matrix.test.ts -t 'host projection regression guards|host-feature-matrix.json integrity' --reporter=dot passed (14 passed, 11 skipped); node scripts/render-host-feature-matrix.mjs --check passed. Fixture/profile roots were isolated outside the checkout. No full-suite/live Claude rerun. Advisory follow-up, not a formal approval; author's worktree untouched.

bradygaster added a commit that referenced this pull request Nov 9, 2026
… a Claude Code limit

Review feedback on #2445. Current Claude Code releases allow nested
subagents, so the Claude dispatch section and the client-compatibility
row no longer claim subagents cannot spawn subagents. They state Squad's
policy instead: specialists are dispatched only from the coordinator.
Behavior is unchanged. The host-agnostic Ralph-mode sentence in the
shared digest is left as is (it applies to every host).

Refs #2440

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bradygaster
bradygaster force-pushed the squad/2440-claude-spec-code-agreement branch from 8981f10 to 2782111 Compare November 9, 2026 18:03
…add host projection regression guards

Phase 0 of #2438, plus the Phase 7 ADR as Proposed.

- Rename Claude Code's subagent tool from `Task` to `Agent` in the Claude
  dispatch section, harness-adapters §5/§7.2, the architecture doc and the
  host feature matrix; describe `model`, `run_in_background` and
  `isolation: "worktree"`. Describe coordinator-only dispatch as Squad's
  policy rather than a Claude Code limitation.
- Correct harness-adapters §13: Claude's `.gitignore` lines sit under a
  `# squad:claude` comment, and `CLAUDE.md` uses the squad:begin/end block.
- Restate the model-selection.claude cell: the host supports per-call and
  frontmatter models (runtime.perSpawnModel is now true); the cell stays
  unsupported until the digest gains the section (#2442).
- Add a Claude Code section to client-compatibility.md, make the README
  badge and model line host-aware, and note that shared-digest gaps are
  not host-specific.
- Add regression guards with a pinned squad_state launch spec: Copilot
  projection snapshot, no-diff steady-state upgrade, --client copilot
  touches only config.json, add/remove of Claude leaves Copilot files
  byte-identical, and upgrading an existing Claude install keeps user
  content and rolls back to the user's bytes.
- Add ADR-003 (Proposed) on a host-neutral canonical coordinator.

Closes #2440

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bradygaster
bradygaster force-pushed the squad/2440-claude-spec-code-agreement branch from 2782111 to aac2e3e Compare November 9, 2026 18:42
@bradygaster
bradygaster merged commit 9865671 into dev Nov 9, 2026
31 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.

Claude host PR 1: spec/code agreement, regression guards and canonical-coordinator ADR (#2438 Phases 0 + 7)

2 participants