@hegemonart/get-design-done 1.25.0 → 1.27.0

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 (58) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +96 -0
  4. package/README.md +12 -6
  5. package/SKILL.md +3 -0
  6. package/agents/README.md +89 -0
  7. package/agents/design-reflector.md +43 -0
  8. package/agents/gdd-intel-updater.md +34 -1
  9. package/hooks/budget-enforcer.ts +143 -4
  10. package/package.json +1 -1
  11. package/reference/model-prices.md +40 -19
  12. package/reference/peer-cli-capabilities.md +151 -0
  13. package/reference/peer-protocols.md +266 -0
  14. package/reference/prices/antigravity.md +21 -0
  15. package/reference/prices/augment.md +21 -0
  16. package/reference/prices/claude.md +42 -0
  17. package/reference/prices/cline.md +23 -0
  18. package/reference/prices/codebuddy.md +21 -0
  19. package/reference/prices/codex.md +25 -0
  20. package/reference/prices/copilot.md +21 -0
  21. package/reference/prices/cursor.md +21 -0
  22. package/reference/prices/gemini.md +25 -0
  23. package/reference/prices/kilo.md +21 -0
  24. package/reference/prices/opencode.md +23 -0
  25. package/reference/prices/qwen.md +25 -0
  26. package/reference/prices/trae.md +23 -0
  27. package/reference/prices/windsurf.md +21 -0
  28. package/reference/registry.json +121 -1
  29. package/reference/runtime-models.md +446 -0
  30. package/reference/schemas/runtime-models.schema.json +123 -0
  31. package/scripts/install.cjs +8 -0
  32. package/scripts/lib/bandit-router.cjs +214 -7
  33. package/scripts/lib/budget-enforcer.cjs +514 -0
  34. package/scripts/lib/cost-arbitrage.cjs +294 -0
  35. package/scripts/lib/event-stream/index.ts +14 -1
  36. package/scripts/lib/event-stream/types.ts +125 -1
  37. package/scripts/lib/install/installer.cjs +188 -11
  38. package/scripts/lib/install/parse-runtime-models.cjs +267 -0
  39. package/scripts/lib/install/runtimes.cjs +101 -0
  40. package/scripts/lib/peer-cli/acp-client.cjs +375 -0
  41. package/scripts/lib/peer-cli/adapters/codex.cjs +101 -0
  42. package/scripts/lib/peer-cli/adapters/copilot.cjs +79 -0
  43. package/scripts/lib/peer-cli/adapters/cursor.cjs +78 -0
  44. package/scripts/lib/peer-cli/adapters/gemini.cjs +81 -0
  45. package/scripts/lib/peer-cli/adapters/qwen.cjs +72 -0
  46. package/scripts/lib/peer-cli/asp-client.cjs +587 -0
  47. package/scripts/lib/peer-cli/broker-lifecycle.cjs +406 -0
  48. package/scripts/lib/peer-cli/registry.cjs +434 -0
  49. package/scripts/lib/peer-cli/spawn-cmd.cjs +149 -0
  50. package/scripts/lib/runtime-detect.cjs +96 -0
  51. package/scripts/lib/session-runner/index.ts +215 -0
  52. package/scripts/lib/session-runner/types.ts +60 -0
  53. package/scripts/lib/tier-resolver.cjs +311 -0
  54. package/scripts/validate-frontmatter.ts +297 -2
  55. package/skills/peer-cli-add/SKILL.md +170 -0
  56. package/skills/peer-cli-customize/SKILL.md +110 -0
  57. package/skills/peers/SKILL.md +101 -0
  58. package/skills/router/SKILL.md +51 -2
@@ -0,0 +1,101 @@
1
+ ---
2
+ name: gdd-peers
3
+ description: "Discover peer-CLI capability matrix — which of {codex, gemini, cursor, copilot, qwen} are installed, allowlisted in .design/config.json, and (if Phase 23.5 has data) their cost/quality delta vs local. Single command, no flags. Read by users investigating delegation setup."
4
+ argument-hint: ""
5
+ tools: Read, Bash
6
+ ---
7
+
8
+ # gdd-peers
9
+
10
+ ## Role
11
+
12
+ You are a deterministic discovery skill. You do not spawn agents and do not delegate to peers. You read `scripts/lib/install/runtimes.cjs`, `scripts/lib/peer-cli/registry.cjs`, `.design/config.json`, and (optionally) `.design/intel/bandit-posterior.json`, then emit a single Markdown table summarizing peer-CLI status.
13
+
14
+ ## Invocation Contract
15
+
16
+ - **Input**: none. The skill takes no arguments.
17
+ - **Output**: a Markdown capability-matrix table to stdout. No JSON wrapper. The table is the entire output.
18
+
19
+ ## Procedure
20
+
21
+ ### 1. Load runtime matrix
22
+
23
+ Read `scripts/lib/install/runtimes.cjs` and extract the 14 runtime entries. The 5 peer-capable entries (`codex`, `gemini`, `cursor`, `copilot`, `qwen`) carry a `peerBinary?` field (added in Plan 27-11). Collect their IDs and binary paths.
24
+
25
+ ### 2. Load capability matrix
26
+
27
+ Read `scripts/lib/peer-cli/registry.cjs`. The exported `describeCapabilities()` returns the per-peer claimed-roles map. The capability matrix is the source of truth for which roles each peer can take.
28
+
29
+ Use the canonical declared matrix:
30
+
31
+ | Peer | Roles claimed | Protocol |
32
+ |---------|--------------------------|----------|
33
+ | codex | execute | ASP |
34
+ | gemini | research, exploration | ACP |
35
+ | cursor | debug, plan | ACP |
36
+ | copilot | review, research | ACP |
37
+ | qwen | write | ACP |
38
+
39
+ ### 3. Detect installation
40
+
41
+ For each peer, run `which <peerBinary>` (POSIX) or `where <peerBinary>` (Windows). If exit 0 → installed. If exit non-zero → not installed.
42
+
43
+ ### 4. Read allowlist
44
+
45
+ Read `.design/config.json`. The path is `peer_cli.enabled_peers` — an array of peer-IDs. Default: `[]` (empty, opt-in required). If the file or path is missing, treat as empty.
46
+
47
+ ### 5. (Optional) Read posterior win-rate
48
+
49
+ If `.design/intel/bandit-posterior.json` exists, look up the per-peer last-N-cycle delta (cost or correctness, whichever is the bandit's primary signal). For each peer, compute the average reward delta vs the `delegate=none` arm. Render as `-12% cost (last 5 cycles)` or `(no data yet)` when fewer than 3 cycles of evidence exist.
50
+
51
+ If the posterior file does not exist, surface "(no data yet)" for every peer.
52
+
53
+ ### 6. Render the table
54
+
55
+ Emit the table in this exact shape:
56
+
57
+ ```
58
+ ## Peer-CLI Capability Matrix
59
+
60
+ | Peer | Installed | Allowlisted | Claimed roles | Posterior delta vs local |
61
+ |---------|-----------|-------------|--------------------------|--------------------------|
62
+ | codex | ✓ | ✓ | execute | -12% cost (last 5 cycles)|
63
+ | gemini | ✓ | ✓ | research, exploration | -8% |
64
+ | cursor | ✗ | ✗ | debug, plan | (not installed) |
65
+ | copilot | ✓ | ✗ | review, research | (opt-in disabled) |
66
+ | qwen | ✓ | ✓ | write | (no data yet) |
67
+
68
+ > Tip: Enable peers via `.design/config.json#peer_cli.enabled_peers`.
69
+ > See `reference/peer-cli-capabilities.md` for the full capability matrix.
70
+ > See `skills/peer-cli-customize/SKILL.md` to rewire role→peer mappings per agent.
71
+ ```
72
+
73
+ Rules for the third column ("Posterior delta vs local"):
74
+ - If `Installed = ✗` → `(not installed)`.
75
+ - Else if `Allowlisted = ✗` → `(opt-in disabled)`.
76
+ - Else if posterior data has fewer than 3 cycles → `(no data yet)`.
77
+ - Else compute and render the delta.
78
+
79
+ ### 7. Done
80
+
81
+ The table IS the output. No follow-up prose. Users can act on the data:
82
+ - See "(opt-in disabled)" → enable in `.design/config.json`.
83
+ - See "(not installed)" → install the peer CLI.
84
+ - See concrete deltas → trust the bandit's recommendation, or override per-agent via `skills/peer-cli-customize`.
85
+
86
+ ## Cross-references
87
+
88
+ - `scripts/lib/peer-cli/registry.cjs` (Plan 27-05) — capability matrix data source.
89
+ - `scripts/lib/install/runtimes.cjs` (Plan 27-11) — `peerBinary` field per runtime.
90
+ - `reference/peer-cli-capabilities.md` (Plan 27-05) — full capability matrix doc.
91
+ - `skills/peer-cli-customize/SKILL.md` (Plan 27-10) — rewire role→peer mappings.
92
+ - `skills/peer-cli-add/SKILL.md` (Plan 27-10) — add a brand-new peer.
93
+ - `.planning/phases/27-peer-cli-delegation/CONTEXT.md` D-10 — decision lineage.
94
+
95
+ ## Record
96
+
97
+ After execution, append one JSONL line to `.design/skill-records.jsonl`:
98
+
99
+ ```json
100
+ {"skill": "gdd-peers", "ts": "<ISO timestamp>", "peers_detected": ["codex", "gemini"], "peers_allowlisted": ["codex"], "had_posterior": false}
101
+ ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: gdd-router
3
- description: "Routes a /gdd command to fast|quick|full path + S|M|L|XL complexity_class and returns {path, complexity_class, model_tier_overrides, estimated_cost_usd, cache_hits}. Deterministic — no model call. Invoked once at command entry before any Agent spawn. Read by hooks/budget-enforcer.js."
3
+ description: "Routes a /gdd command to fast|quick|full path + S|M|L|XL complexity_class and returns {path, complexity_class, model_tier_overrides, resolved_models, estimated_cost_usd, cache_hits}. Deterministic — no model call. Invoked once at command entry before any Agent spawn. Read by hooks/budget-enforcer.js."
4
4
  argument-hint: "<intent-string> [<target-artifacts-csv>]"
5
5
  tools: Read, Bash, Grep
6
6
  ---
@@ -20,16 +20,37 @@ You are a deterministic routing skill. You do not spawn agents. You read `.desig
20
20
  "path": "fast",
21
21
  "complexity_class": "M",
22
22
  "model_tier_overrides": {"design-verifier": "haiku"},
23
+ "resolved_models": {
24
+ "design-reflector": "gpt-5",
25
+ "design-context-checker": "gpt-5-nano",
26
+ "design-verifier": "gpt-5-nano"
27
+ },
23
28
  "estimated_cost_usd": 0.034,
24
29
  "cache_hits": ["design-context-builder:abc123"]
25
30
  }
26
31
  ```
27
32
  - `path` enum: `fast` (single Haiku + no checkers), `quick` (Sonnet mappers + Haiku verify), `full` (Opus planners + full quality gates). Stays unchanged for back-compat per D-05.
28
33
  - `complexity_class` enum: `S | M | L | XL` (Phase 25 / D-04, D-05). Additive to `path` — existing consumers reading only `path` keep working. Mapping is documented in the Path Selection Heuristic table below.
29
- - `model_tier_overrides` merges agent frontmatter `default-tier` with `.design/budget.json.tier_overrides` — budget.json wins per D-04.
34
+ - `model_tier_overrides` merges agent frontmatter `default-tier` with `.design/budget.json.tier_overrides` — budget.json wins per D-04. Enum stays `opus|sonnet|haiku` for back-compat across all 14 runtimes; consumers that need the **concrete** model name for the active runtime read `resolved_models` instead.
35
+ - `resolved_models` is a per-agent map of concrete model IDs for the runtime in use (Phase 26 / D-07). Keys are agent names; values are runtime-specific model strings (e.g. `"gpt-5"` under codex, `"gemini-2.5-pro"` under gemini, `"claude-opus-4-7"` under claude) or `null` when the resolver can supply no model (missing tier-map row, missing tier on the row). Additive to `model_tier_overrides` — existing consumers reading the tier-name map keep working unchanged; new consumers (budget-enforcer cost computation, cost telemetry, bandit posterior store) read `resolved_models` for runtime-correct cost. See **Runtime-aware model resolution** below for the computation contract.
30
36
  - `estimated_cost_usd` is the sum of per-spawn estimates using the D-06 formula and `reference/model-prices.md`.
31
37
  - `cache_hits` is a list of `{agent}:{input-hash}` strings that exist in `.design/cache-manifest.json` and are within TTL; emitting a hit lets the hook short-circuit that spawn per D-05.
32
38
 
39
+ ### Output schema versioning
40
+
41
+ The router output contract is additive across phases. The current shape (Phase 26, v1.26.0) carries:
42
+
43
+ | Field | Added in | Status |
44
+ |-------|----------|--------|
45
+ | `path` | v1.10.1 (10.1-01) | stable |
46
+ | `model_tier_overrides` | v1.10.1 (10.1-01) | stable, enum unchanged |
47
+ | `estimated_cost_usd` | v1.10.1 (10.1-01) | stable |
48
+ | `cache_hits` | v1.10.1 (10.1-01) | stable |
49
+ | `complexity_class` | v1.25.0 (25-02) | stable, additive |
50
+ | `resolved_models` | v1.26.0 (26-04) | stable, additive |
51
+
52
+ Existing consumers reading any subset of the older fields keep working unchanged across these bumps — the schema is a strict superset at every phase boundary. New fields are documented inline in this skill rather than in a separate JSON-schema file (the SKILL is the contract — same convention Phase 25 followed for `complexity_class`).
53
+
33
54
  ## Path Selection Heuristic
34
55
 
35
56
  The router emits both `path` (legacy 3-tier enum) and `complexity_class` (Phase 25 4-tier enum). The canonical mapping is:
@@ -70,6 +91,34 @@ for each agent in planned spawn graph:
70
91
  return total
71
92
  ```
72
93
 
94
+ ## Runtime-aware model resolution
95
+
96
+ The router emits `resolved_models` alongside `model_tier_overrides` so downstream consumers (budget-enforcer cost computation, Phase 22 cost telemetry, Phase 23.5 bandit posterior store) can read the **concrete model ID** for the active runtime without re-deriving it from the tier name. The resolution is per-agent and additive — `model_tier_overrides` keeps its `opus|sonnet|haiku` enum for back-compat across all 14 runtimes, and `resolved_models` runs the runtime-specific translation on top of it.
97
+
98
+ Computation contract (per D-07):
99
+
100
+ ```
101
+ runtime = runtimeDetect.detect() ?? 'claude'
102
+ for each agent in planned spawn graph:
103
+ tier = resolve_tier(agent) # same merge as model_tier_overrides
104
+ resolved_models[agent] = tierResolver.resolve(runtime, tier)
105
+ # → concrete model string OR null
106
+ ```
107
+
108
+ Implementation surfaces (Phase 26 / Wave A):
109
+
110
+ - `scripts/lib/runtime-detect.cjs` — `detect() → runtime-id | null`. Reads the same `*_CONFIG_DIR` / `*_HOME` env-vars Phase 24's installer uses (single source of truth in `scripts/lib/install/runtimes.cjs`). Returns `null` when no recognized runtime env-var is set; the router falls back to `'claude'` so the resolver always has a runtime ID to work with.
111
+ - `scripts/lib/tier-resolver.cjs` — `resolve(runtime, tier, opts?) → model | null`. Translates `opus|sonnet|haiku` to the concrete model the runtime understands using the `reference/runtime-models.md` mapping (Phase 26 / Wave A). Fallback chain (D-04): runtime-specific entry → `claude` row default with `tier_resolution_fallback` event → `null` with `tier_resolution_failed` event. Never throws; `null` is a valid output the consumer must handle.
112
+
113
+ Per-agent emission rules:
114
+
115
+ - One key per agent in the planned spawn graph (same key set the cost-estimation loop iterates over). Keys MUST match agent names exactly so consumers can join `resolved_models` against `model_tier_overrides` and the spawn graph by name.
116
+ - Value is the concrete model string returned by `tier-resolver.resolve(runtime, tier)`.
117
+ - When the resolver returns `null` (missing tier-map row, missing tier, garbage input), the value is JSON `null` — NOT omitted, NOT the empty string. Consumers (budget-enforcer, telemetry) MUST handle `null`: typically by skipping the cost row for that spawn and emitting their own diagnostic event, never by crashing.
118
+ - When `complexity_class` is `S` and the router itself short-circuits (see **S-class short-circuit** above), no payload is emitted at all and `resolved_models` does not exist for that invocation — the budget-enforcer's "no router decision payload" branch already handles this case.
119
+
120
+ Back-compat assertion: a router invocation in a Claude runtime (or any environment where `runtime-detect.detect()` returns `null` and the router falls back to `'claude'`) produces `resolved_models` values that are the canonical Anthropic model IDs (`claude-opus-4-7`, `claude-sonnet-4-6`, `claude-haiku-4-5`) for the corresponding tiers. Pre-Phase-26 consumers that ignore `resolved_models` see the same `model_tier_overrides` they always saw (Plan 26-09 owns the runtime fixture diff that asserts this).
121
+
73
122
  ## Cache-Hit Detection
74
123
 
75
124
  Delegate to `skills/cache-manager/SKILL.md` (Plan 10.1-02). The router lists candidate `{agent}:{input-hash}` tuples; the cache-manager confirms freshness against TTL from `budget.json.cache_ttl_seconds`.