* chore: rebuild ADR index as a generated artifact and enforce lifecycle invariants
The ADR index in docs/adr/README.md was hand-maintained with nothing checking
it, and had drifted to 40 of 65 ADRs. The absent rows included the entire
capability family (857/894/959/1016/1143/1213/1244) and ADR-1239 (EoS) itself,
so the decisions a reader most needed were the ones they could not find.
Make the index a derived artifact, matching the repo's existing generated-file
idiom (lint:generated-sync), and enforce the corpus' lifecycle invariants:
- scripts/gen-adr-index.cjs generates the index between markers and validates
the status vocabulary (Accepted/Proposed/Superseded/Legacy/Retired),
successor links, id/filename agreement, and supersession symmetry.
- Wire --check into lint:generated-sync so drift fails CI.
Correct the lifecycle metadata the gate surfaced, without flipping any status:
- ADR-1239 (EoS) declared it subsumed ADR-1016/58/3660/894; none recorded it.
Add reciprocal "Subsumed by" pointers + dated amendments. Subsumption keeps
the target Accepted -- these are live adapters, not dead decisions.
- ADR-857/894 carry dated status caveats: they read Proposed while the
capability system shipped and epic #857 is closed. Ratification is a
maintainer act and is deliberately left open.
- Link ADR-0005/0007/0012/3524 -> ADR-0174 and ADR-0010 -> ADR-0009; record
the reciprocal Supersedes on ADR-0009.
- ADR-218 declared itself "ADR-0175" -- an unfinished rename.
- The 0011 PRD moves from the non-canonical "Draft" to "Legacy".
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* test: capture stderr via spawnSync; record ADR-0010 draft supersession
Two fixes surfaced by the first gsd-test run and by regenerating the index:
- tests/adr-index-gate.test.cjs used execFileSync, which only surfaces stderr
through the thrown error on non-zero exit. The `--write` path exits 0 while
reporting outstanding violations on stderr, so the helper always saw ''.
spawnSync captures both streams on both outcomes.
- The hand-maintained index recorded 0010-skill-surface-budget-module.md as
"earlier draft superseded by ADR-0011" while the file itself still said
Proposed. Deriving the index from the files would have dropped that
assertion and resurrected a superseded draft as a live decision, so it is
recorded at its source, with the reciprocal Supersedes on ADR-0011.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix: drop the dead sdk/ model-catalog candidate retired by ADR-0174
src/model-catalog.cts resolved model-catalog.json through three candidates, the
second being sdk/shared/model-catalog.json three levels up. That was the legacy
source-repo fallback kept by the #3288 fix ("check the co-located path FIRST,
before the legacy source-repo path").
ADR-0174 then retired the @opengsd/gsd-sdk package boundary and deleted the sdk/
tree (11918dcc3), so the candidate can no longer resolve in any layout: a source
repo has no sdk/, and an install layout points it at ~/.claude/sdk/shared/, which
the installer never writes -- the original #3288 bug. It was dead weight implying
a package boundary this repo no longer has.
No test depends on it: the #3288 regression tests in tests/install.test.cjs write
their own synthetic old-path fixture and assert it throws.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* docs: ratify nine shipped ADRs; record why ten others stay Proposed
The corpus carried 19 Proposed ADRs, most describing architecture that had
already shipped. A Proposed label on live architecture tells contributors and
agents the decision is an unbuilt idea -- the capability system and EoS were
both being misread that way.
Audited all 19 against the shipped tree and GitHub. Each candidate flip then had
to survive two independent reviewers instructed to refute it.
Ratified Proposed -> Accepted, each with a dated Ratification section carrying
the verified evidence (file:line, symbols, tests, issue state):
857 capability system 894 declaration format 1244 capability ecosystem
1577 injection boundary 1610 size-budget ratchet 1990 existing-code onboarding
15 cross-AI convergence 22 plan-drift guard 0011 default reviewers
Held ten, each now carrying a "Why this is still Proposed" section naming the
blocker and its unblock condition, so the audit is not repeated:
2264 its own headline acceptance criterion is unmet in the tree
230 live branch protection contradicts the decided spec (1 approval, not 2)
660 the namesake release/<version> re-cut is manual, not automated
959 issue #2346 is approved and plans its graduation as its own ADR
1213 the shipped writer's return shape differs from the decided interface
443 the orchestrator override path has no live caller
1143 / 1606 each states its own bar for acceptance; neither is met
612 / 1671 legitimately open
Shipped code proved necessary but not sufficient: eight ADRs had every named
module, symbol, and test present with their epics closed, and still failed the
bar. That lesson is written into README.md's ratification procedure.
Also corrected ADR-857's "Supersedes (generalizes)" to "Subsumes": taken
literally it would have marked two live seams dead -- ADR-0011 (surface.cts:348)
and ADR-58 (runtime-artifact-install-plan.cts:82). Both keep Accepted status and
gain Subsumed-by pointers.
Index: Active 39->48, Proposed 19->10, Superseded/Legacy 7. 65 total.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix: harden gen-adr-index against hostile titles and non-ADR filenames (#2356)
Three findings from the pre-PR orthogonal security review, all confirmed:
- An ADR title containing the literal ADR-INDEX:END marker was emitted verbatim
into its table cell, relocating the splice boundary so the NEXT --write
spliced against the wrong marker and truncated README.md. Titles now render
through cellText(), which escapes pipes and angle brackets -- making an HTML
comment (and any other HTML) unformable from ADR-authored text.
- A docs/adr/*.md without a numeric prefix crashed on match(...)[1] of null.
Such a file is also invisible to the index -- the very failure this gate
exists to prevent -- so it is now reported as a naming-convention violation
naming the file and the fix.
- Tests leaked their mkdtemp dirs. They now use helpers.createTempDir/cleanup
via t.after(); helpers.cleanup carries the Windows-EBUSY retry budget that a
raw fs.rmSync lacks (caught by local/no-raw-rmsync-in-tests).
Adds five regression tests: marker hijack, HTML injection, pipe cell-break,
non-conforming filename, and splice stability across repeated writes.
Refs #2356
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix: close two gate false-passes; read ## Supersedes sections (#2356)
Second round of confirmed findings from the pre-PR orthogonal code review. Both
false-passes matter more than a false-fail: a gate that silently misses a
violation is worse than no gate, because it is trusted.
- A relation field mixing a link with a bare id silently dropped the bare claim:
the check tested `rel.links.length` (does this field have ANY link?) instead
of whether THAT id was linked. `Supersedes: [ADR-0001](...), ADR-0011` passed
clean -- accepting exactly the ambiguous bare reference the rule forbids. Now
each bare id is checked against the ids actually linked in the same field, so
a repeat in trailing prose stays quiet while an unlinked claim is flagged.
- The ratification guard (`statusToken !== 'Accepted'`) skipped BOTH relation
directions, which killed the IN check entirely: `supersedes.in` is only ever
populated on an ADR whose status IS `Superseded`, so a dangling `Superseded by
X` where X never claims it always passed. The guard now applies to OUT only --
a prospective claim must not obligate its target, but an ADR's statement about
ITSELF is always owed a reciprocal.
- Fixing that surfaced a parser gap: ADR-0174 declares its supersessions in a
`## Supersedes` table SECTION, not a header field, and headerBlock() stops at
the first `##`. The repo's best-documented supersession was invisible. Section
form is now parsed for both relations.
- Replaced a vacuous test: the em-dash negation case passed whether or not
NEGATED_RELATION_RE matched (a mutation to /$^/ survived). It now carries a
link that would create a failing asymmetric relation if negation did not fire.
Also removes docs/adr/9401-test-target.md -- a synthetic fixture a reviewer
created in the worktree while reproducing a finding, swept in by `git add -A`.
Adds regression tests for each: mixed link+bare, linked-and-repeated-in-prose,
dangling superseded-by from a non-Accepted ADR, and the ADR-0174 section shape.
Refs #2356
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix: escape backslashes before pipes in the ADR index cell renderer (#2356)
CodeQL js/incomplete-sanitization (high) on scripts/gen-adr-index.cjs: cellText()
escaped `|` -> `\|` without first escaping the backslash. Markdown's escape
character is the backslash, so the input `\|` became `\\|`, which renders as a
literal backslash followed by an UNESCAPED pipe -- re-opening the cell break the
pipe escape exists to prevent. Order is load-bearing: escape the escape
character first, then everything that emits one.
Same class as the index-marker hijack fixed earlier: ADR-authored text breaking
out of the cell it is rendered into.
Adds a regression test asserting a `\|`-bearing title leaves exactly the row's
own 5 unescaped delimiters and cannot forge a Status cell. Uses split(/\r?\n/)
per local/no-crlf-fragile-split -- a literal "\n" split is CRLF-fragile on the
Windows CI leg.
Refs #2356
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
15 KiB
ADR-1143: Claude orchestration capability — Workflow tool (ultracode) as a runtime-gated loop execution backend [Proposed]
- Status: Proposed
- Date: 2026-06-12
- Issue: #1143
- Builds on: ADR-857 — host/core vs plug-in split, loop extension points,
runtimeCompat, federated config - Blocked by: #857 being released (Proposed → Accepted + capability infrastructure shipped). Not actionable until then.
- Relates to: #853 (Claude Code backgrounded agents cannot nest subagents), existing BETA skill
gsd-ultraplan-phase
Why this is still Proposed (audited 2026-07-17)
Confirmed shipped, on-tree: the capability is real and registered, not vaporware. capabilities/claude-orchestration/capability.json exists with detection + emission (detectWorkflowBackend / emitWorkflowScript) in src/claude-orchestration.cts (compiled to gsd-core/bin/lib/claude-orchestration.cjs), federated config (claude_orchestration.enabled / execution_backend / min_agent_sdk_version), and 1,552 lines of tests across tests/claude-orchestration.test.cjs, tests/claude-orchestration-command-router.test.cjs, and tests/fix-2285-claude-orchestration-wiring.test.cjs. The previously-fatal wiring bug, #2285 ("claude-orchestration capability (#1143) registered as active but never wired into execute-phase orchestrator prompt"), is closed COMPLETED (2026-07-15) — one day before this audit — and the owning feature issue #1143 is also closed COMPLETED.
The blocker. The ADR sets its own bar for ratification in its own Amendment (above): "flipping to Accepted follows maintainer sign-off on the E2E behaviour once exercised on Claude Code with the Workflow tool present." No such exercise is recorded anywhere in issues, PRs, or tests. Every test in the three files above operates at the contract or CLI-subprocess layer — asserting the shape of an emitted script or the return value of resolve-wave-dispatch — none constructs or executes an actual Workflow-tool run (grep -rn "Workflow(" tests/claude-orchestration*.test.cjs tests/fix-2285-*.test.cjs returns no hits). Two further gaps sit inside the ADR's own Decision section: (1) Decision §1's claimed net effect — "wave parallelism, the plan-checker, and the verifier are restored" — is narrower than what shipped: capability.json's own description says "the plan-checker and verifier remain inline until separately wired — this capability delivers the parallel-execution backend, not those gates"; (2) Decision §3's fold-in of the gsd-ultraplan-phase skill into the capability's skills[] has not happened — capability.json still shows "skills": [], and no follow-up issue for the migration the Amendment promises exists (searched via gh issue list --search, no result).
Unblock condition. Ratify once: (a) a real Claude Code session with the Workflow tool present and claude_orchestration.enabled=true drives an execute-phase wave through the Workflow backend, and the result is recorded (issue comment, PR, or a test that actually builds/executes a Workflow script rather than asserting emitted-script shape) — that is the maintainer sign-off the ADR itself asks for; and (b) the Decision section's "plan-checker and verifier restored" language is reconciled with the shipped scope (either corrected to match, or backed by a tracked issue for the deferred wiring capability.json already discloses). The skills[] migration (item 3) is lower priority since it is openly disclosed as deferred rather than silently dropped, but should carry a tracked issue number before ratification so it doesn't quietly vanish.
Context
Claude Code ships two orchestration primitives GSD does not yet treat as first-class:
-
ultraplan(/ultraplan <objective>,claude --teleport) — hands a planning task to a Claude Code web session running in plan mode; the plan is drafted in the cloud, reviewed/commented in the browser, then approved back to the terminal (which archives the web session). GSD already wraps this as the BETA skillgsd-ultraplan-phase(gsd-core/workflows/ultraplan-phase.md), which constructs a plan prompt, triggers/ultraplan, and relies on the user manually running/gsd:import --from <file>to bring the plan back. -
ultracode(/effort ultracode, or anultracode:prompt prefix) — setsxhighreasoning plus automatic Workflow orchestration. It is the trigger for the Workflow tool (Agent SDK ≥ v0.3.149): a deterministic JavaScript orchestrator that fans subagents out withagent(),parallel()(barrier),pipeline()(no barrier), andphase(), supportingisolation: 'worktree', a shared tokenbudget, customagentType, andresumeFromRunId. It can be activated per-session via/effort,--settings, or an Agent SDK control request ("ultracode": true). GSD does not use the Workflow tool at all.
Why this matters for the loop
GSD's execute-phase is wave-based: plans carry a wave number, waves run sequentially, and plans within a wave run in parallel when their files_modified sets do not overlap. Today GSD realizes that by dispatching, one Agent call per message, a backgrounded gsd-executor in a worktree.
On Claude Code this degrades. Backgrounded agents on Claude Code have no Agent/Task tool, so they cannot nest subagents (#853). The autonomous loop therefore falls back to inline sequential execution — and with it silently drops wave parallelism, the plan-checker, and the verifier — on the single runtime most GSD users run. The degradation is structural and outside GSD's control to fix at the agent layer.
The Workflow tool sidesteps #853 precisely because it is invoked from the main loop, not from a backgrounded agent: the script is the orchestrator and spawns the subagents itself. Its primitives map almost 1:1 onto GSD's existing wave model, and it adds three things GSD's hand-rolled fan-out lacks: determinism, a shared token budget, and resume.
Post ADR-857, GSD now has a home for exactly this kind of runtime-specific, preview-grade, toggleable feature: a Capability with runtimeCompat, a federated config slice, a tier, and loop-hook registration at the stable extension points. Before 857 there was nowhere clean to put runtime-gated loop behavior without forking core prose; after 857 it is a data manifest plus a registry regen.
Decision
Introduce a Claude orchestration Capability — capabilities/claude-orchestration/, role: feature, runtimeCompat: claude, default-off, BETA — that adopts Claude Code's orchestration primitives as optional, runtime-gated GSD surfaces. It is blocked on #857 being released and ships only after the capability infrastructure is Accepted.
1. Workflow tool as an optional loop execution backend (primary, NEW)
When the active runtime exposes the Workflow tool, execute-phase may emit a generated Workflow script in place of manual one-agent-per-message dispatch. The translation preserves GSD's existing model:
| GSD execute-phase concept | Workflow primitive |
|---|---|
| Wave (barrier between waves) | parallel() barrier; or pipeline() when plans flow through stages without a cross-plan barrier |
| Plan executor | agent(brief, { agentType: 'gsd-executor', isolation: 'worktree' }) |
files_modified overlap forces sequential |
overlap forces the plan into a later pipeline stage (same rule, declaratively) |
| Cost discipline | the Workflow budget pool |
Resume / gsd-undo |
resumeFromRunId keyed to the phase manifest |
| Orchestrator-only STATE.md / ROADMAP.md writes | unchanged — only the orchestrator (the script's return) writes shared files; executors stay in their worktrees |
Net effect on Claude Code: wave parallelism, the plan-checker, and the verifier are restored — the capability path is not a backgrounded agent, so #853 does not apply — and GSD gains determinism, a shared budget, and resume it does not have today.
2. Registration at ADR-857 loop extension points
The capability registers hooks at execute:wave:pre, execute:wave:post, and execute:post, resolved through gsd_run loop render-hooks <point>. Activation is gated by:
- Runtime/tool detection — the active runtime must actually expose the Workflow tool (Claude Code / Agent SDK ≥ the pinned minimum). Detection miss → no-op.
- Federated config — a
claude_orchestration.*slice withexecution_backend: auto | workflow | inline(defaultauto, which selectsworkflowonly when the tool is present, elseinline).
When neither gate passes, the loop runs exactly as it does today. This is the central safety property: the inline/manual path remains the default and the only path on non-Claude runtimes and on Claude versions without the Workflow tool.
3. Fold ultraplan under the same capability
The existing gsd-ultraplan-phase BETA skill and commands/gsd/ultraplan-phase.md become capability-owned at plan:*. Plan-offload (ultraplan) and execute-orchestration (ultracode/Workflow) then share one runtime gate, one federated config slice, and one BETA boundary — instead of ultraplan living as a stray BETA skill while a second preview surface is added elsewhere. This also lets a future iteration close ultraplan's manual /gsd:import --from round-trip behind the same capability without touching core.
4. (Stretch) Other fan-out points opt into the same backend
map-codebase (parallel mappers), project/phase research (parallel researchers), and plan-review-convergence (parallel reviewers) are already manual parallel-shaped dispatches. Behind the same toggle and gate they can adopt the Workflow backend incrementally. Out of scope for the first cut; recorded so the capability is named for the general seam, not just execute-phase.
Resolved design details
Why a capability and not core
The Workflow tool is Claude Code / Agent SDK-specific and preview-grade. ADR-857 is explicit that the five-step loop plus shared-infrastructure skills are the privileged core and "every other feature is a Capability — a plug-in selectable at install and toggleable after restart." A runtime-specific, BETA execution backend is the textbook case for role: feature + runtimeCompat: claude + tier. Shipping it in core would re-introduce exactly the runtime-coupling 857 removed.
Fallback is the contract, not an afterthought
The capability must be byte-for-byte transparent when absent: identical artifacts, commits, and STATE/ROADMAP writes whether a wave ran via the Workflow backend or the inline path. A parity regression test asserting this on a runtime without the Workflow tool is a release gate, not a nicety — it is what lets the capability be default-off and low-risk.
Maintenance posture
The capability tracks two moving Claude-Code preview surfaces. Containment: one capability + BETA gate (mirroring today's gsd-ultraplan-phase BETA isolation), a pinned minimum Agent-SDK/Workflow-tool version in the runtime gate, and inline fallback on any detection miss. A preview-API change can degrade the capability to inline; it cannot break the core loop.
Relationship to cross-AI delegation and plan-review-convergence
These existing multi-model features (execute-phase cross_ai_delegation, the convergence reviewer loop) are model/runtime delegation, not intra-runtime fan-out orchestration. They are orthogonal: cross-AI routes a plan to a different CLI; the Workflow backend parallelizes plans within the current Claude Code runtime. They compose rather than conflict.
Consequences
- Positive: restores loop parallelism + plan-checker + verifier on Claude Code (undoing the #853 inline degradation); adds determinism, shared token budget, and resume to GSD execution; consolidates two Claude preview surfaces behind one gated capability; sets a reusable pattern for the other fan-out points.
- Negative / cost: another preview surface to track; a Workflow-script emitter and runtime/tool detection to maintain; BETA-grade until the upstream tool stabilizes.
- Neutral: no effect on non-Claude runtimes by construction; no behavior change until explicitly enabled.
Governance note: This ADR is a draft design accompanying feature request #1143. Per CONTRIBUTING, it is PR'd only after the issue receives
approved-feature, and the capability is implemented only after #857 is released.
Amendment (2026-07-06): BETA v1 implementation landed
#857 is released (CLOSED); the capability infrastructure is live. The BETA v1
of this capability has shipped as capabilities/claude-orchestration/ with the
scope agreed in the Decision, refined to the lowest-risk first slice:
- Detection + emission live as pure, fail-closed functions in
gsd-core/bin/lib/claude-orchestration.cjs(sourcesrc/claude-orchestration.cts):detectWorkflowBackend(gate ladder: enabled → Claude runtime → execution_backend ≠ inline → host dispatch nested+background → valid Agent SDK → SDK ≥claude_orchestration.min_agent_sdk_version, default0.3.149) andemitWorkflowScript(waves →parallel()stage barriers, plans →agent({ agentType: 'gsd-executor', isolation: 'worktree' }),files_modifiedoverlap → separate sequential stages,resumeFromRunIdwired to the phase run id, sharedbudget(tokens)pool). All interpolated values are validated as script-safe identifiers or JSON-quoted (review Finding 1). - Loop registration is at the two wired points the loop host contract
actually renders:
execute:wave:post into:executor(Workflow-backend guidance) andplan:post into:planner(ultraplan ownership declaration).execute:wave:preandexecute:preare declared in the contract but not wired today, so the capability registers atwave:post(the constraintexternal-jobalso documents). - Config is federated (
claude_orchestration.enableddefault false /activationKey,execution_backendenumauto|workflow|inlinedefaultauto,min_agent_sdk_version); the keys live only in the registry, so uninstall removes them cleanly. - ultraplan ownership is declared in the manifest (
plan:postcontribution); full install-profile migration of thegsd-ultraplan-phaseskill into the capability'sskills[]is deferred to a follow-up (it triggers the CLUSTERS / profile membership gate and is a heavier, install-machinery change).
Status remains Proposed — the BETA is default-off and the end-to-end Workflow execution path (actual orchestration via the Workflow tool inside Claude Code) is not verifiable outside that runtime. The capability is structurally complete and tested at the contract level; flipping to Accepted follows maintainer sign-off on the E2E behaviour once exercised on Claude Code with the Workflow tool present.