@hegemonart/get-design-done 1.26.0 → 1.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +74 -0
  4. package/README.md +10 -8
  5. package/SKILL.md +3 -0
  6. package/agents/README.md +29 -0
  7. package/package.json +2 -2
  8. package/reference/peer-cli-capabilities.md +151 -0
  9. package/reference/peer-protocols.md +266 -0
  10. package/reference/registry.json +14 -0
  11. package/reference/runtime-models.md +3 -3
  12. package/scripts/install.cjs +100 -1
  13. package/scripts/lib/bandit-router.cjs +214 -7
  14. package/scripts/lib/budget-enforcer.cjs +69 -1
  15. package/scripts/lib/event-stream/index.ts +14 -1
  16. package/scripts/lib/event-stream/types.ts +125 -1
  17. package/scripts/lib/install/runtimes.cjs +58 -0
  18. package/scripts/lib/peer-cli/acp-client.cjs +375 -0
  19. package/scripts/lib/peer-cli/adapters/codex.cjs +101 -0
  20. package/scripts/lib/peer-cli/adapters/copilot.cjs +79 -0
  21. package/scripts/lib/peer-cli/adapters/cursor.cjs +78 -0
  22. package/scripts/lib/peer-cli/adapters/gemini.cjs +81 -0
  23. package/scripts/lib/peer-cli/adapters/qwen.cjs +72 -0
  24. package/scripts/lib/peer-cli/asp-client.cjs +587 -0
  25. package/scripts/lib/peer-cli/broker-lifecycle.cjs +406 -0
  26. package/scripts/lib/peer-cli/registry.cjs +434 -0
  27. package/scripts/lib/peer-cli/spawn-cmd.cjs +149 -0
  28. package/scripts/lib/runtime-detect.cjs +1 -1
  29. package/scripts/lib/session-runner/index.ts +362 -0
  30. package/scripts/lib/session-runner/types.ts +60 -0
  31. package/scripts/validate-frontmatter.ts +159 -1
  32. package/skills/peer-cli-add/SKILL.md +170 -0
  33. package/skills/peer-cli-customize/SKILL.md +110 -0
  34. package/skills/peers/SKILL.md +101 -0
@@ -5,14 +5,14 @@
5
5
  },
6
6
  "metadata": {
7
7
  "description": "Get Design Done — 5-stage agent-orchestrated design pipeline with 9 connections, handoff-first workflow, bidirectional Figma write-back, 22+ specialized agents, queryable knowledge layer (intel store, dependency analysis, learnings extraction), and a self-improvement loop (reflector, frontmatter + budget feedback, global-skills layer). v1.20.0 ships the SDK foundation: gdd-state MCP server (11 typed tools), lockfile-safe STATE.md mutations, event stream, and resilience primitives (jittered-backoff, rate-guard, error-classifier, iteration-budget) for rate-limit + 429 + context-overflow recovery. Full CI/CD pipeline (Node 22/24 × Linux/macOS/Windows) and release automation (auto-tag + GitHub Release + release-time smoke test).",
8
- "version": "1.26.0"
8
+ "version": "1.27.1"
9
9
  },
10
10
  "plugins": [
11
11
  {
12
12
  "name": "get-design-done",
13
13
  "source": "./",
14
14
  "description": "Agent-orchestrated 5-stage design pipeline: Brief → Explore → Plan → Design → Verify. 22+ specialized agents, 9 connections (Figma, Refero, Preview, Storybook, Chromatic, Figma Writer, Graphify, Pinterest, Claude Design), Claude Design handoff, bidirectional Figma write-back, and a queryable intel store (.design/intel/) for dependency and learnings queries. Standalone commands: style, darkmode, compare, figma-write, graphify, handoff, analyze-dependencies, skill-manifest, extract-learnings. Embeds NNG heuristics, WCAG thresholds, typographic systems, motion framework, and anti-pattern catalog. Ships with a full CI/CD pipeline (Node 22/24 × Linux/macOS/Windows) and release automation. Optimization layer (v1.0.4.1, retroactive): gdd-router + gdd-cache-manager skills, PreToolUse budget-enforcer hook, tier-aware agent frontmatter, lazy checker gates, streaming synthesizer, /gdd:warm-cache + /gdd:optimize commands, and cost telemetry at .design/telemetry/costs.jsonl — targeting 50-70% per-task token-cost reduction with no quality-floor regression. v1.20.0 SDK foundation: gdd-state MCP server (11 typed tools), lockfile-safe STATE.md mutations, event stream at .design/telemetry/events.jsonl, resilience primitives (jittered-backoff, rate-guard, error-classifier, iteration-budget) with rate-limit + 429 + context-overflow recovery, and TypeScript toolchain.",
15
- "version": "1.26.0",
15
+ "version": "1.27.1",
16
16
  "author": {
17
17
  "name": "hegemonart"
18
18
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "get-design-done",
3
3
  "short_name": "gdd",
4
- "version": "1.26.0",
4
+ "version": "1.27.1",
5
5
  "description": "Agent-orchestrated 5-stage design pipeline: Brief → Explore → Plan → Design → Verify. 22+ specialized agents, 9 connections (Figma, Refero, Preview, Storybook, Chromatic, Figma Writer, Graphify, Pinterest, Claude Design), handoff-first workflow via Claude Design bundles, bidirectional Figma write-back (annotations, Code Connect), queryable intel store (`.design/intel/`) for O(1) design surface lookups, and self-improvement loop (reflector agent, frontmatter + budget feedback, global-skills layer at `~/.claude/gdd/global-skills/`). Standalone commands: style, darkmode, compare, figma-write, graphify, handoff, analyze-dependencies, skill-manifest, extract-learnings, reflect, apply-reflections. Embeds NNG heuristics, WCAG thresholds, typographic systems, motion framework, and anti-pattern catalog. Ships with a full CI/CD pipeline (Node 22/24 × Linux/macOS/Windows, lint + schema + frontmatter + stale-ref + shellcheck + gitleaks + injection-scan + blocking size-budget) and release automation (auto-tag + GitHub Release + release-time smoke test). Optimization layer (v1.0.4.1, retroactive): gdd-router + gdd-cache-manager skills, PreToolUse budget-enforcer hook, tier-aware agent frontmatter, lazy checker gates, streaming synthesizer, /gdd:warm-cache + /gdd:optimize commands, and cost telemetry at .design/telemetry/costs.jsonl — targeting 50-70% per-task token-cost reduction with no quality-floor regression. v1.20.0 SDK foundation: gdd-state MCP server (11 typed tools), lockfile-safe STATE.md mutations, event stream at .design/telemetry/events.jsonl, resilience primitives (jittered-backoff, rate-guard, error-classifier, iteration-budget) with rate-limit + 429 + context-overflow recovery, and TypeScript toolchain.",
6
6
  "author": {
7
7
  "name": "hegemonart",
package/CHANGELOG.md CHANGED
@@ -4,6 +4,80 @@ All notable changes to get-design-done are documented here. Versions follow [sem
4
4
 
5
5
  ---
6
6
 
7
+ ## [1.27.1] — 2026-04-30
8
+
9
+ Phase 27 wiring patch — closes the production-integration gaps left by v1.27.0's "structural ship". v1.27.0 landed all peer-CLI library code + tests + docs but the helpers were exported without callers, so `delegate_to:` on agent frontmatter was validated and then ignored at runtime. v1.27.1 wires the four integration points so delegation actually fires for users who set `delegate_to:` AND allowlist the peer.
10
+
11
+ ### Fixed
12
+
13
+ - **`session-runner.run()` now invokes `tryDelegate` (Plan 27-06 wiring)** — when `opts.delegateTo` is set to a `<peer>-<role>` value AND the registry can route AND the peer is in `.design/config.json#peer_cli.enabled_peers`, the prompt runs on the peer-CLI and `run()` returns the peer result. On peer-absent / peer-error / null result, falls through transparently to the local Anthropic SDK loop (D-07). Previously the `tryDelegate` helper existed in the file but `run()` never called it.
14
+
15
+ - **Real `appendEvent('peer_call_started|complete|failed', ...)` emission (Plan 27-08 wiring)** — replaced the stderr-only placeholder in session-runner with three real event-emission calls. Events flow through Phase 22's `appendEvent()` API using the constants registered in v1.27.0, tagged with `runtime_role: 'peer'` and `peer_id`. Reflector cross-runtime cost-arbitrage (Plan 26-06) now sees peer telemetry. `GDD_PEER_DEBUG=1` continues to mirror the failed events to stderr for live tailing.
16
+
17
+ - **`install.cjs` interactive peer-detection nudge (Plan 27-11 wiring)** — after a successful (non-uninstall, non-dry-run) install in a TTY, scans `peerBinary` paths via `detectInstalledPeers()`. If 1+ peer detected, prompts via `@clack/prompts` with `confirm()` (default: NO). On yes, writes `.design/config.json#peer_cli.enabled_peers`. New `--no-peer-prompt` flag suppresses the prompt entirely (CI-friendly). Silent skip when zero peers detected. Default-NO preserves the opt-in trust contract (D-11).
18
+
19
+ ### Out of scope (known, deferred)
20
+
21
+ - **Bandit `pullWithDelegate` caller (Plan 27-07 wiring)** — `pullWithDelegate` and `updateWithDelegate` ship in the bandit module surface (v1.27.0) but no production caller invokes them yet. Wiring requires `gdd-router` SKILL.md change (procedural, not code) which is out of scope for a wiring patch. Phase 28+ territory once the integration shape is decided. The `delegate?` dimension stays exported as a library extension for ad-hoc use.
22
+
23
+ ### Tests
24
+
25
+ - Existing 23 peer-CLI session-runner / events / end-to-end tests pass after wiring.
26
+ - Existing 33 install.cjs + peer-detect tests pass after the nudge addition.
27
+ - Full Phase 27 surface tests stay green; no new test files (this is a wiring patch, not a new surface).
28
+
29
+ ---
30
+
31
+ ## [1.27.0] — 2026-04-30
32
+
33
+ Phase 27 Peer-CLI Delegation Layer milestone — closes the **outbound** half of multi-runtime. Phase 24 made gdd installable on 14 runtimes; Phase 21 made the same pipeline run on each; Phase 26 made tier→model resolve correctly per runtime. v1.27.0 adds the missing piece: gdd agents OPTIONALLY delegate to local peer CLIs (Codex via App Server Protocol; Gemini/Cursor/Copilot/Qwen via Agent Client Protocol) when measurably cheaper or higher-quality for the role. Falls back to in-process Anthropic SDK when peer is unavailable. Honors Phase 26 tier maps + Phase 22 event chain + Phase 23.5 bandit posterior — `delegate?` becomes another arm in `(agent_type × tier × delegate)` Thompson sampling, no new ML.
34
+
35
+ ### Added
36
+
37
+ - **ACP client** — `scripts/lib/peer-cli/acp-client.cjs` (Plan 27-01, commit `4a2d201`). Line-delimited JSON-RPC over stdio for Gemini/Cursor/Copilot/Qwen. `initialize` handshake, `prompt` method, notification stream, 16 MiB line-buffer overflow guard. 7 tests pass.
38
+ - **ASP client** — `scripts/lib/peer-cli/asp-client.cjs` (Plan 27-02, commit `06fcdf6`). Codex App Server Protocol. `threadStart` + `threadResume` + `turn` lifecycle. `service_name = "gdd_peer_delegation"`. Error path resolves with `{status:"error"}` rather than throwing. 12 tests pass.
39
+ - **spawn-cmd Windows fix + broker-lifecycle** — `scripts/lib/peer-cli/spawn-cmd.cjs` + `broker-lifecycle.cjs` (Plan 27-03, commit `f9228cf`). `.cmd` EINVAL workaround per cc-multi-cli `transport-decisions.md` (D-04). Long-lived broker per `(peer, workspace)` over Unix socket on POSIX, named pipe on Windows (D-03). 18 tests pass.
40
+ - **Per-peer adapters** — `scripts/lib/peer-cli/adapters/{codex,gemini,cursor,copilot,qwen}.cjs` (Plan 27-04, commit `d58ab4f`). 5 thin wrappers with role→prompt-prefix maps + slash-command translation. 39 tests pass.
41
+ - **Registry + capability matrix** — `scripts/lib/peer-cli/registry.cjs` + `reference/peer-cli-capabilities.md` (Plan 27-05, commit `6ef4d27`). `findPeerFor(role, tier)` central dispatch, per-peer health probe, deterministic alphabetical tie-break. Per-peer capability matrix (D-05): codex→execute, gemini→research/exploration, cursor→debug/plan, copilot→review/research, qwen→write. 32 tests pass.
42
+ - **Agent `delegate_to:` frontmatter + session-runner peer-first dispatch** — `scripts/validate-frontmatter.ts` + `scripts/lib/session-runner/index.ts` (Plan 27-06, commit `4644d8e`). Optional additive frontmatter field; values are `<peer>-<role>` per capability matrix or `none` (explicit opt-out). Session-runner tries delegate first; transparent fallback on peer-absent OR peer-error per D-07. 8 tests pass.
43
+ - **Bandit posterior `delegate?` context dimension** — `scripts/lib/bandit-router.cjs` (Plan 27-07, commit `824bcf5`). Arm space expands from `(agent_type, touches_size_bin)` to `(agent_type, touches_size_bin, delegate)` where `delegate ∈ {none, gemini, codex, cursor, copilot, qwen}`. Bootstrap: existing priors carry forward as the `none` arm; 5 delegation arms start neutral. Reward signal unchanged (two-stage lexicographic). 12 tests pass.
44
+ - **Event chain `runtime_role` + `peer_id` + `peer_call_*` event types** — `scripts/lib/event-stream/types.ts` + `index.ts` + `scripts/lib/budget-enforcer.cjs` (Plan 27-08, commit `fd561ed`). Additive Phase 22 extension — every event optionally tags `runtime_role: "host" | "peer"` (defaults `"host"` for back-compat) and `peer_id`. 3 new event types: `peer_call_started`, `peer_call_complete`, `peer_call_failed`. costs.jsonl cost rows tag the same fields so Phase 26's reflector cost-arbitrage extends naturally. 8 tests pass.
45
+ - **`/gdd:peers` capability matrix command** — `skills/peers/SKILL.md` (Plan 27-09, commit `51ae40e`). Single-command discoverability — markdown table with peer × installed? × allowlisted? × claimed roles × posterior delta vs local.
46
+ - **`peer-cli-customize` + `peer-cli-add` skills** — `skills/peer-cli-customize/SKILL.md` + `skills/peer-cli-add/SKILL.md` (Plan 27-10, commit `4f07daf`). Customize rewires per-agent `delegate_to:` mappings; add walks the verification ladder for adding a brand-new peer (Apache 2.0 attribution comment in each — see NOTICE).
47
+ - **`peerBinary?` field on runtimes + detection helpers** — `scripts/lib/install/runtimes.cjs` (Plan 27-11, commit `0e2fb92`). 5 peer-capable runtimes (codex, gemini, cursor, copilot, qwen) gain platform-aware `peerBinary` paths. `listPeerCapableRuntimes()` and `detectInstalledPeers()` exported for `/gdd:peers` and the install-time nudge. 8 tests pass.
48
+
49
+ ### Tests
50
+
51
+ - 11 new test files (148 total new test cases) covering protocol clients, registry, adapters, frontmatter delegation, bandit dimension, event tagging, peer detection, end-to-end peer-call flow, and the phase-27 baseline.
52
+ - Phase 24/25/26 baseline tests refactored to be **version-agnostic** (D-12) — they read `package.json#version` dynamically and assert all 4 manifests align. No more literal-version hardcodes that break every closeout (Phase 26 lesson applied).
53
+
54
+ ### Decisions
55
+
56
+ D-01 through D-14 — see `.planning/phases/27-peer-cli-delegation/CONTEXT.md` for the full decision register. Highlights:
57
+
58
+ - **D-01 / D-02** — ACP for 4 peers, ASP for Codex. Port shapes from cc-multi-cli (Apache 2.0) with `NOTICE` attribution; do NOT vendor their hub (Claude-as-host assumption is incompatible with our any-runtime-as-host model).
59
+ - **D-03 / D-04** — Long-lived broker per `(peer, workspace)`. Windows `.cmd` EINVAL workaround documented in `spawn-cmd.cjs` so future maintainers don't "clean it up".
60
+ - **D-05** — Per-peer capability matrix is the dispatch source-of-truth. Roles a peer doesn't claim → registry refuses dispatch.
61
+ - **D-06 / D-07** — `delegate_to:` is additive optional; `none` is explicit opt-out; fallback on peer-absent OR peer-error is transparent to the calling skill.
62
+ - **D-08** — Bandit posterior gains `delegate?` dimension. 6× context expansion (~78 → ~468 contexts). Bootstrap discipline: existing priors carry forward as `delegate=none`; 5 delegation arms start neutral.
63
+ - **D-09** — Event chain extension is additive; `runtime_role` defaults `"host"` for back-compat; only the new `peer_call_*` events MUST carry `"peer"`.
64
+ - **D-10 / D-11** — `/gdd:peers` is single-command discoverability; install-time nudge is OPT-IN (default empty `enabled_peers`); `--no-peer-prompt` flag suppresses for CI.
65
+ - **D-12** — Version-agnostic baseline tests (Phase 26 closeout lesson). `phase-NN-baseline.test.cjs` no longer hardcodes literal versions.
66
+ - **D-14** — `NOTICE` Apache 2.0 attribution for cc-multi-cli ships with v1.27.0 (mandatory per Apache 2.0 §4 for derivative-shape code).
67
+
68
+ ### Documentation
69
+
70
+ - `docs/PEER-DELEGATION.md` (new) — ops guide covering when delegation fires, how to disable per-peer, fallback diagnostics, broker lifecycle troubleshooting, and Windows `.cmd` quirks.
71
+ - `reference/peer-protocols.md` (new) — ACP + ASP protocol cheat sheet for protocol authors and skill writers.
72
+ - `agents/README.md` — new `Peer-CLI delegation (delegate_to)` section documenting the field, valid values, opt-in gating, telemetry hookup, and cross-references.
73
+ - `NOTICE` (new) — Apache 2.0 attribution for cc-multi-cli's `acp-client.mjs`, `asp-client.mjs`, `transport-decisions.md`, and `customize` / `multi-cli-anything` skill patterns.
74
+
75
+ ### Known gaps
76
+
77
+ - Plan 27-11's interactive post-install peer-detection prompt (the `npx get-design-done` UX nudge: "I see you have Codex + Gemini installed — wire them as peers? [y/N]") is documented in CONTEXT.md D-11 but not yet wired into `scripts/install.cjs`. The detection helper (`detectInstalledPeers()`) IS shipped — what's missing is the `@clack/prompts` interactive integration. Users can manually populate `.design/config.json#peer_cli.enabled_peers` for now; `/gdd:peers` shows the current state. Tracked for Phase 28 hygiene or a 1.27.x patch if demand warrants.
78
+
79
+ ---
80
+
7
81
  ## [1.26.0] — 2026-04-29
8
82
 
9
83
  Phase 26 Headless Model Resolver milestone — closes the model-selection gap left by Phase 24's distribution headlessness. `default-tier: opus|sonnet|haiku` frontmatter now actually does something on the 13 non-Claude runtimes the multi-runtime installer ships to. Three layers gain runtime-awareness without a breaking change: the agent frontmatter (additive `reasoning-class` alias), the router output (additive `resolved_models` field), and the cost telemetry (per-runtime price tables + runtime-tagged events.jsonl rows). The phase ships **structure** — adapter layer, resolvers, schemas, contracts — not editorial picks for which model each runtime treats as opus/sonnet/haiku; those come from runtime adapter authors with provenance citations baked into `reference/runtime-models.md`.
package/README.md CHANGED
@@ -87,20 +87,22 @@ Use it when you care that tokens match, contrast passes WCAG, motion feels cohes
87
87
 
88
88
  You do not need to be a designer to benefit from it. The pipeline carries the design discipline into the agent workflow: it extracts context, asks only for missing decisions, grounds the work in references, and catches the issues people usually find too late.
89
89
 
90
- ### v1.26.0 Highlights — Headless Model Resolver
90
+ ### v1.27.0 Highlights — Peer-CLI Delegation Layer
91
91
 
92
- Closes the model-selection gap left by v1.24.0's distribution headlessness: `default-tier: opus|sonnet|haiku` frontmatter now actually does something on the 13 non-Claude runtimes the multi-runtime installer ships to. Three layers gain runtime-awareness without a breaking change agent frontmatter, router output, and cost telemetry all keep their existing fields and gain new additive ones.
92
+ Closes the **outbound** half of multi-runtime: gdd agents now OPTIONALLY delegate to local peer CLIs (Codex via App Server Protocol; Gemini/Cursor/Copilot/Qwen via Agent Client Protocol) when measurably cheaper or higher-quality for the role. Falls back to in-process Anthropic SDK when peer is unavailable. Honors v1.26.0's tier maps + v1.22.0's event chain + v1.23.5's bandit posterior `delegate?` becomes another arm in `(agent_type × tier × delegate)` Thompson sampling.
93
93
 
94
- - **Per-runtime tier→model adapter** — `reference/runtime-models.md` is the single source of truth for all 14 runtimes (claude, codex, gemini, qwen, kilo, copilot, cursor, windsurf, antigravity, augment, trae, codebuddy, cline, opencode). Each row carries `tier_to_model`, `reasoning_class_to_model`, and a provenance array (source URL + retrieval timestamp + last-validated cycle). Strict pure-JS validator at `scripts/lib/install/parse-runtime-models.cjs` no `ajv` dependency at the parser layer.
95
- - **`tier-resolver.cjs` + `runtime-detect.cjs`** translates `opus|sonnet|haiku` frontmatter into the concrete model name a specific runtime understands (`gpt-5` under codex, `gemini-2.5-pro` under gemini, `claude-opus-4-7` under claude). Non-blocking fallback chain: runtime entry claude row + warning event null + fail event. Runtime detection reuses Phase 24's env-var lookup chain single source of truth lives in `scripts/lib/install/runtimes.cjs`.
96
- - **`resolved_models` router field** — the router's JSON output now carries a per-agent map of concrete model IDs for the active runtime, alongside the legacy `model_tier_overrides` (which keeps its `opus|sonnet|haiku` enum for back-compat across all 14 runtimes). Strict superset over v1.25.0 same back-compat discipline as Phase 25's `complexity_class` next to `path`. Installer also drops a `models.json` per runtime config-dir so runtime harnesses can read the map at session start without parsing markdown.
97
- - **Per-runtime price tables + cost arbitrage** — `reference/model-prices.md` becomes a router that links to per-runtime sub-tables (`reference/prices/{claude,codex,gemini,qwen,…}.md`). The shared `scripts/lib/budget-enforcer.cjs` backend reads them by runtime. events.jsonl cost rows tag `runtime`; the cost-aggregator rolls up per-runtime AND per-tier. Reflector surfaces a structured cross-runtime arbitrage proposal when one runtime's spend exceeds another's by >50% on the same `(agent, tier)`.
98
- - **`reasoning-class` runtime-neutral alias** — additive `reasoning-class: high|medium|low` frontmatter alias for `default-tier`. Both may coexist; equivalence is enforced (`high ↔ opus`, `medium ↔ sonnet`, `low ↔ haiku`). v1.26 ships the alias with full equivalence semantics and does **not** deprecate `default-tier` — long-term winner is data-gated by adoption signal through Phase 28.
94
+ - **ACP + ASP protocol clients** — `scripts/lib/peer-cli/{acp-client,asp-client}.cjs` ship line-delimited JSON-RPC over stdio with 16 MiB line-buffer overflow guards. ACP serves Gemini/Cursor/Copilot/Qwen; ASP serves Codex (thread-oriented, multi-turn). Protocol shapes adapted from `greenpolo/cc-multi-cli` (Apache 2.0, see `NOTICE`). Long-lived broker per `(peer, workspace)` over Unix socket / named pipe cold-spawn cost amortized across delegated calls in a cycle.
95
+ - **5 per-peer adapters + central registry** `scripts/lib/peer-cli/adapters/{codex,gemini,cursor,copilot,qwen}.cjs` thin-wrap the protocol clients with roleprompt-prefix maps and slash-command translation. Central dispatch via `registry.cjs#findPeerFor(role, tier)` consults the locked capability matrix (codex→execute; gemini→research/exploration; cursor→debug/plan; copilot→review/research; qwen→write).
96
+ - **`delegate_to:` agent frontmatter** — additive optional field; values are `<peer>-<role>` per matrix or `none` for explicit opt-out. Session-runner tries delegate first; transparent fallback on peer-absent OR peer-error. `peer_call_failed` event logs to `events.jsonl` for reflector telemetry. v1.27.0 ships the field but no agent in the fleet uses it yet opt-in per agent via `/gdd:run-skill peer-cli-customize`.
97
+ - **Bandit posterior `delegate?` dimension** — Phase 23.5's `(agent_type, touches_size_bin)` arm space expands to `(agent_type, touches_size_bin, delegate)` where `delegate ∈ {none, gemini, codex, cursor, copilot, qwen}`. Existing priors carry forward as the `none` arm (no behavior change for unconfigured agents); 5 delegation arms start neutral. Reward signal unchanged (two-stage lexicographic). The bandit measures and learns which delegations actually pay off over cycles.
98
+ - **Event chain `runtime_role` + `peer_id` tags** — additive Phase 22 extension. `events.jsonl` rows optionally tag `runtime_role: "host" | "peer"` (defaults `"host"` for back-compat) and `peer_id`. 3 new event types: `peer_call_started`, `peer_call_complete`, `peer_call_failed`. costs.jsonl threads the same fields so v1.26's cross-runtime cost-arbitrage reflector extends to host-vs-peer arbitrage naturally.
99
+ - **`/gdd:peers` discoverability + skills for setup** — `/gdd:peers` shows a single-command capability matrix (peer × installed? × allowlisted? × claimed roles × posterior delta vs local). `peer-cli-customize` rewires per-agent `delegate_to:` mappings; `peer-cli-add` walks the verification ladder for adding a brand-new peer (model-ID `-preview`-suffix trap, Windows `.cmd` quirks, 3-file footprint). Install-time peer-detection helpers (`detectInstalledPeers()`) ship in `runtimes.cjs` ready for the interactive nudge (deferred to a 1.27.x patch).
99
100
 
100
- See [docs/MULTI-RUNTIME-MODELS.md](docs/MULTI-RUNTIME-MODELS.md) for the ops guide (adding a runtime, fallback chain, cost roll-up).
101
+ See [docs/PEER-DELEGATION.md](docs/PEER-DELEGATION.md) for the ops guide (when delegation fires, fallback diagnostics, broker lifecycle, Windows quirks) and [reference/peer-protocols.md](reference/peer-protocols.md) for the ACP + ASP protocol cheat sheet.
101
102
 
102
103
  ### Previous releases
103
104
 
105
+ - **v1.26.0** — Headless Model Resolver (per-runtime tier→model map, `resolved_models` router field, per-runtime price tables, `reasoning-class` runtime-neutral alias).
104
106
  - **v1.25.0** — Pipeline Hardening (prototype gate + STATE `<prototyping>` block, router S/M/L/XL `complexity_class`, quality-gate Stage 4.5, Stop-hook turn closeout).
105
107
  - **v1.24.0** — Multi-Runtime Installer (`@clack/prompts` interactive multi-select for all 14 runtimes, idempotent + foreign-AGENTS.md-safe, scripted CI surface preserved 1:1).
106
108
  - **v1.23.5** — No-Regret Adaptive Layer (Thompson sampling bandit + AdaNormalHedge ensemble + MMR rerank; single-user via informed-prior bootstrap, no opt-in telemetry).
package/SKILL.md CHANGED
@@ -89,6 +89,9 @@ Each stage produces artifacts in `.design/` inside the current project.
89
89
  | `skill-manifest [--refresh]` | `get-design-done:skill-manifest` | List or refresh the local skill manifest used by the router for discovery |
90
90
  | `quality-gate` | `get-design-done:quality-gate` | Phase 25 — parallel lint/type/test/visual command runner; classifies failures via quality-gate-runner agent |
91
91
  | `turn-closeout` | `get-design-done:turn-closeout` | Phase 25 — Stop-hook mirror skill; finalizes per-turn STATE blocks and emits closeout events |
92
+ | `peers` | `get-design-done:peers` | Phase 27 — `/gdd:peers` capability matrix command; shows installed peer-CLIs (codex/gemini/cursor/copilot/qwen), allowlist status, claimed roles, posterior delta vs local |
93
+ | `peer-cli-customize` | `get-design-done:peer-cli-customize` | Phase 27 — rewire role→peer mappings on a per-agent basis (edits frontmatter `delegate_to:` directly) |
94
+ | `peer-cli-add` | `get-design-done:peer-cli-add` | Phase 27 — guided ladder for adding a brand-new peer (verification ladder + adapter scaffolding + capability-matrix update) |
92
95
  | `watch-authorities [--refresh] [--since <date>] [--feed <name>] [--schedule <cadence>]` | `get-design-done:gdd-watch-authorities` | Run design-authority-watcher — fetch curated feeds, diff snapshot, classify new entries → `.design/authority-report.md` (consumed by `/gdd:reflect`) |
93
96
  | `benchmark <component\|--wave N\|--list\|--refresh component>` | `get-design-done:gdd-benchmark` | Harvest + synthesize per-component design specs from 18 design systems → `reference/components/<name>.md` |
94
97
  | `benchmark <component\|--wave N\|--list\|--refresh component>` | `get-design-done:gdd-benchmark` | Harvest + synthesize per-component design specs from 18 design systems → `reference/components/<name>.md` |
package/agents/README.md CHANGED
@@ -124,6 +124,35 @@ Downstream consumers (`skills/router/SKILL.md`, `hooks/budget-enforcer.ts`, `scr
124
124
 
125
125
  ---
126
126
 
127
+ ## Peer-CLI delegation (delegate_to)
128
+
129
+ Phase 27 introduces an **optional** frontmatter field `delegate_to:` that lets an agent OPT IN to running on a peer CLI (Codex via ASP; Gemini/Cursor/Copilot/Qwen via ACP) instead of the in-process Anthropic SDK call.
130
+
131
+ | Property | Value |
132
+ |----------|-------|
133
+ | Field | `delegate_to: <peer>-<role> \| none` |
134
+ | Required | NO — optional, additive |
135
+ | Default | absent = use local Anthropic call (existing behavior) |
136
+ | Valid values | `gemini-research`, `gemini-exploration`, `codex-execute`, `cursor-debug`, `cursor-plan`, `copilot-review`, `copilot-research`, `qwen-write`, or `none` (explicit opt-out) |
137
+ | Validator | `scripts/validate-frontmatter.ts` (Plan 27-06) — checks format + cross-references the capability matrix in `scripts/lib/peer-cli/registry.cjs`. Mismatched `<peer>-<role>` values that aren't in the matrix → validation error. |
138
+
139
+ **Behavior at runtime:**
140
+ - When session-runner spawns an agent with `delegate_to: gemini-research`, it tries `peer-cli/registry.dispatch('research', tier, prompt, opts)` first. On null result (peer absent OR peer error per D-07) it transparently falls back to the local Anthropic call. The skill never sees the peer failure.
141
+ - `delegate_to: none` explicitly skips registry dispatch (security-sensitive agents).
142
+ - Absent field = same as not setting it = local Anthropic call (unchanged behavior).
143
+
144
+ **Opt-in gating:** Even with `delegate_to:` set on an agent, dispatch only fires if the peer is in `.design/config.json#peer_cli.enabled_peers` allowlist (populated by the install-time nudge in Plan 27-11; default empty). This keeps cost surprises off — users explicitly authorize each peer.
145
+
146
+ **Telemetry:** Peer calls emit `peer_call_started` / `peer_call_complete` / `peer_call_failed` events in `events.jsonl`, tagged with `runtime_role: "peer"` and `peer_id` (Plan 27-08). Cost rows in `costs.jsonl` carry the same tags so reflector cross-runtime arbitrage (Phase 26) extends naturally.
147
+
148
+ **Cross-references:**
149
+ - `scripts/lib/peer-cli/registry.cjs` (Plan 27-05) — capability matrix + dispatch.
150
+ - `scripts/lib/peer-cli/adapters/{codex,gemini,cursor,copilot,qwen}.cjs` (Plan 27-04) — per-peer thin adapters.
151
+ - `reference/peer-cli-capabilities.md` (Plan 27-05) — full capability matrix doc.
152
+ - `.planning/phases/27-peer-cli-delegation/CONTEXT.md` D-06, D-07, D-11 — decision lineage.
153
+
154
+ ---
155
+
127
156
  ## Required Reading Pattern
128
157
 
129
158
  When an agent must read specific files before acting, the orchestrating stage embeds a `<required_reading>` block in the prompt it passes to `Task`. The block is part of the **prompt string**, not the agent file.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hegemonart/get-design-done",
3
- "version": "1.26.0",
3
+ "version": "1.27.1",
4
4
  "description": "A design-quality pipeline for AI coding agents: brief, plan, implement, and verify UI work against your design system.",
5
5
  "author": "Hegemon",
6
6
  "homepage": "https://github.com/hegemonart/get-design-done",
@@ -37,7 +37,7 @@
37
37
  "provenance": true
38
38
  },
39
39
  "scripts": {
40
- "test": "node --test --experimental-strip-types \"tests/**/*.cjs\" \"tests/**/*.ts\"",
40
+ "test": "node --test --experimental-strip-types \"tests/**/*.test.cjs\" \"tests/**/*.test.ts\"",
41
41
  "typecheck": "tsc --noEmit",
42
42
  "codegen:schemas": "node --experimental-strip-types scripts/codegen-schema-types.ts",
43
43
  "lint:md": "npx --yes markdownlint-cli2 \"**/*.md\" \"#node_modules\" \"#.planning\" \"#.claude\" \"#test-fixture/baselines\"",
@@ -0,0 +1,151 @@
1
+ # Peer-CLI Capabilities
2
+
3
+ Last verified: 2026-04-29
4
+
5
+ Authoritative capability matrix for the peer-CLI delegation layer (Phase 27).
6
+ The registry at `scripts/lib/peer-cli/registry.cjs` reads this map (encoded as
7
+ data in the `.cjs` source — this doc is the human-readable mirror) to decide
8
+ which peer-CLI claims which agent role and which protocol to speak.
9
+
10
+ If you change this matrix, you MUST also change `CAPABILITY_MATRIX` in
11
+ `scripts/lib/peer-cli/registry.cjs` and re-run `tests/peer-cli-registry.test.cjs`.
12
+ The two are version-locked by Phase 27 D-05.
13
+
14
+ ## Capability matrix
15
+
16
+ Each peer claims a fixed set of agent roles. The registry refuses to dispatch
17
+ a role to a peer that does not claim it — this prevents accidental
18
+ mis-delegations like "let's try `design-auditor` against Qwen" that produce
19
+ garbage output (Phase 27 CONTEXT D-05).
20
+
21
+ | Peer | Protocol | Claimed roles | Slash commands (within peer CLI) |
22
+ | --- | --- | --- | --- |
23
+ | `codex` | ASP | `execute` | `/exec` |
24
+ | `copilot` | ACP | `review`, `research` | `/review`, `/search` |
25
+ | `cursor` | ACP | `debug`, `plan` | `/debug`, `/plan` |
26
+ | `gemini` | ACP | `research`, `exploration` | `/search`, `/explore` |
27
+ | `qwen` | ACP | `write` | `/write` |
28
+
29
+ Slash-command translation lives in each per-peer adapter
30
+ (`scripts/lib/peer-cli/adapters/<peer>.cjs`, landed by Plan 27-04). The
31
+ registry never invokes slash commands directly — it routes the role and
32
+ delegates prompt-prefixing + slash translation to the adapter.
33
+
34
+ ## Tie-breaking when two peers claim the same role
35
+
36
+ `research` is claimed by both `gemini` and `copilot`. When the registry's
37
+ `findPeerFor('research', tier)` runs, it walks peers in alphabetical order
38
+ of peer ID — `codex` < `copilot` < `cursor` < `gemini` < `qwen` — and
39
+ returns the first one that passes the health probe. So `copilot` wins
40
+ `research` over `gemini` when both are installed and allowlisted.
41
+
42
+ Users can override this by removing one of the two from
43
+ `.design/config.json#peer_cli.enabled_peers` — the unlisted peer is treated
44
+ as absent regardless of installation status (Phase 27 D-11 opt-in gating).
45
+
46
+ ## Opt-in gating (D-11)
47
+
48
+ A peer is dispatched to ONLY when:
49
+
50
+ 1. The peer ID appears in `.design/config.json#peer_cli.enabled_peers`
51
+ (an array of allowlisted peer IDs). Default: `[]` — empty, nothing
52
+ dispatches.
53
+ 2. The peer's adapter module loads at `scripts/lib/peer-cli/adapters/<peer>.cjs`.
54
+ 3. The adapter's `peerBinary()` resolver returns a path that exists on disk.
55
+
56
+ Failure on any of the three → registry returns `null` and the caller
57
+ (session-runner, Plan 27-06) falls back to the local Anthropic SDK call.
58
+ This is the **transparent-fallback** contract from Phase 27 D-07: a missing
59
+ or broken peer must never break the cycle.
60
+
61
+ ## Per-peer notes
62
+
63
+ ### `codex` (ASP)
64
+
65
+ OpenAI Codex CLI invoked as `codex app-server`. Speaks the App Server
66
+ Protocol — thread-oriented, supports resume across calls (currently unused;
67
+ v1.27 always starts fresh threads).
68
+
69
+ - **Provenance:** runtime entry in `scripts/lib/install/runtimes.cjs` (`id: 'codex'`).
70
+ - **Example invocation:** registry routes `(role='execute', tier='opus', text='apply this diff')`
71
+ through `adapters/codex.cjs`, which in turn drives `asp-client.cjs`.
72
+ - **Known limitations:** Codex' app-server cold start is ~1-2s on macOS;
73
+ the broker (Plan 27-03) keeps the session warm across cycles to amortize.
74
+
75
+ ### `gemini` (ACP)
76
+
77
+ Google Gemini CLI invoked in ACP mode. One-shot prompt per call from the
78
+ host's perspective, but the adapter may multiplex many calls onto a single
79
+ broker session.
80
+
81
+ - **Provenance:** runtime entry in `scripts/lib/install/runtimes.cjs` (`id: 'gemini'`).
82
+ - **Example invocation:** registry routes `(role='research', tier='sonnet', text='find prior art for X')`
83
+ through `adapters/gemini.cjs`.
84
+ - **Known limitations:** rate-limit headers vary by Gemini auth tier. The
85
+ adapter surfaces a 429 as a peer-error → registry returns null → caller
86
+ falls back. No retry logic at the registry level.
87
+
88
+ ### `cursor` (ACP)
89
+
90
+ Cursor's `cursor` CLI in ACP mode. Strong on `debug` and `plan` roles
91
+ because Cursor's editor-side context tracking transfers well to those
92
+ workflows.
93
+
94
+ - **Provenance:** runtime entry in `scripts/lib/install/runtimes.cjs` (`id: 'cursor'`).
95
+ - **Known limitations:** Cursor' ACP mode requires an active Cursor login
96
+ on the host; an unauthenticated session surfaces as a connect-time error.
97
+
98
+ ### `copilot` (ACP)
99
+
100
+ GitHub Copilot CLI in ACP mode. Claims `review` and `research`. Tends to
101
+ win `research` against `gemini` on alphabetical tie-break — users who
102
+ prefer Gemini for research should remove `copilot` from `enabled_peers`.
103
+
104
+ - **Provenance:** runtime entry in `scripts/lib/install/runtimes.cjs` (`id: 'copilot'`).
105
+ - **Known limitations:** Copilot's `review` role expects a diff in the
106
+ prompt; the adapter handles the framing.
107
+
108
+ ### `qwen` (ACP)
109
+
110
+ Alibaba Qwen Code CLI in ACP mode. Claims `write` only. Useful when the
111
+ session-runner wants a long-form code-generation pass and the host runtime
112
+ is on a low tier.
113
+
114
+ - **Provenance:** runtime entry in `scripts/lib/install/runtimes.cjs` (`id: 'qwen'`).
115
+ - **Known limitations:** Qwen's ACP implementation is the newest of the
116
+ five; expect occasional protocol-version drift. The adapter pins
117
+ `protocolVersion: '2025-06-18'` per `acp-client.cjs` defaults.
118
+
119
+ ## Adding a new peer
120
+
121
+ To add a new peer-CLI to the matrix:
122
+
123
+ 1. Run the guided ladder in `skills/peer-cli-add/SKILL.md` (lands with
124
+ Plan 27-10). It walks the protocol-fit check, the role-claim audit, the
125
+ adapter scaffold, and the test coverage required.
126
+ 2. Append the peer to `CAPABILITY_MATRIX` in `scripts/lib/peer-cli/registry.cjs`
127
+ AND to the table at the top of this file. The two MUST stay in sync —
128
+ the test suite (`tests/peer-cli-registry.test.cjs`) asserts the matrix
129
+ shape.
130
+ 3. Add a `<peer>.cjs` adapter under `scripts/lib/peer-cli/adapters/`.
131
+ 4. Add a `peerBinary?: string` field on the corresponding entry in
132
+ `scripts/lib/install/runtimes.cjs` (Plan 27-11 introduces the field;
133
+ new peers added after that plan ships must include it).
134
+ 5. Update `tests/peer-cli-registry.test.cjs` and the phase-20 baseline locks.
135
+
136
+ To temporarily disable a peer without removing the adapter, drop the peer
137
+ ID from `.design/config.json#peer_cli.enabled_peers`. To permanently remove
138
+ a peer, reverse the steps above plus update `tests/phase-27-baseline.test.cjs`.
139
+
140
+ ## Cross-references
141
+
142
+ - `scripts/lib/peer-cli/registry.cjs` — central dispatch, single source of
143
+ truth for the capability matrix as code.
144
+ - `scripts/lib/peer-cli/adapters/*.cjs` — per-peer thin adapters
145
+ (Plan 27-04).
146
+ - `scripts/lib/peer-cli/{acp,asp}-client.cjs` — protocol clients
147
+ (Plans 27-01 / 27-02).
148
+ - `scripts/lib/peer-cli/broker-lifecycle.cjs` — long-lived session per
149
+ `(peer, workspace)` (Plan 27-03).
150
+ - Phase 27 CONTEXT.md — decision log including D-05 (this matrix),
151
+ D-07 (transparent fallback), D-11 (opt-in gating).