cyber-sdd 0.0.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 (133) hide show
  1. package/.claude-plugin/plugin.json +17 -0
  2. package/.codex-plugin/plugin.json +17 -0
  3. package/.plugin/plugin.json +17 -0
  4. package/README.md +159 -0
  5. package/agents/sdd-automaton.md +97 -0
  6. package/agents/sdd-impl-judge.md +214 -0
  7. package/agents/sdd-scanner.md +120 -0
  8. package/agents/sdd-spec-judge.md +224 -0
  9. package/agents/sdd-warden.md +101 -0
  10. package/package.json +24 -0
  11. package/skills/align-spec/README.md +20 -0
  12. package/skills/align-spec/SKILL.md +111 -0
  13. package/skills/align-spec/scripts/align-spec.mts +187 -0
  14. package/skills/architect-impl-governance/README.md +46 -0
  15. package/skills/architect-impl-governance/SKILL.md +45 -0
  16. package/skills/architect-spec-governance/README.md +48 -0
  17. package/skills/architect-spec-governance/SKILL.md +59 -0
  18. package/skills/blast-estimate/README.md +47 -0
  19. package/skills/blast-estimate/SKILL.md +133 -0
  20. package/skills/blast-estimate/scripts/blast-estimate.mts +583 -0
  21. package/skills/builder-impl-governance/README.md +47 -0
  22. package/skills/builder-impl-governance/SKILL.md +47 -0
  23. package/skills/builder-spec-governance/README.md +49 -0
  24. package/skills/builder-spec-governance/SKILL.md +36 -0
  25. package/skills/check-partition-quality/README.md +22 -0
  26. package/skills/check-partition-quality/SKILL.md +51 -0
  27. package/skills/check-partition-quality/scripts/check-partition-quality.mts +336 -0
  28. package/skills/check-plan-safety/README.md +17 -0
  29. package/skills/check-plan-safety/SKILL.md +60 -0
  30. package/skills/check-plan-safety/scripts/check-plan-safety.mts +145 -0
  31. package/skills/check-project-specs/README.md +19 -0
  32. package/skills/check-project-specs/SKILL.md +69 -0
  33. package/skills/check-project-specs/scripts/check-project-specs.mts +217 -0
  34. package/skills/check-scenario-overlap/README.md +19 -0
  35. package/skills/check-scenario-overlap/SKILL.md +74 -0
  36. package/skills/check-scenario-overlap/scripts/check-scenario-overlap.mts +249 -0
  37. package/skills/check-spec-structure/README.md +17 -0
  38. package/skills/check-spec-structure/SKILL.md +66 -0
  39. package/skills/check-spec-structure/scripts/check-spec-structure.mts +346 -0
  40. package/skills/collision-ladder/README.md +18 -0
  41. package/skills/collision-ladder/SKILL.md +83 -0
  42. package/skills/collision-ladder/scripts/collision-ladder.mts +657 -0
  43. package/skills/combat-log-governance/README.md +13 -0
  44. package/skills/combat-log-governance/SKILL.md +257 -0
  45. package/skills/concept-index/README.md +13 -0
  46. package/skills/concept-index/SKILL.md +38 -0
  47. package/skills/concept-index/scripts/concept-index.mts +245 -0
  48. package/skills/discover-plans/README.md +16 -0
  49. package/skills/discover-plans/SKILL.md +74 -0
  50. package/skills/discover-plans/scripts/discover-plans.mts +212 -0
  51. package/skills/discover-specs/README.md +15 -0
  52. package/skills/discover-specs/SKILL.md +76 -0
  53. package/skills/discover-specs/scripts/discover-specs.mts +396 -0
  54. package/skills/doctrine-loop/README.md +15 -0
  55. package/skills/doctrine-loop/SKILL.md +97 -0
  56. package/skills/formation-loop/README.md +17 -0
  57. package/skills/formation-loop/SKILL.md +140 -0
  58. package/skills/gate-validation-governance/README.md +12 -0
  59. package/skills/gate-validation-governance/SKILL.md +87 -0
  60. package/skills/impl-producer-governance/README.md +48 -0
  61. package/skills/impl-producer-governance/SKILL.md +85 -0
  62. package/skills/init/README.md +27 -0
  63. package/skills/init/SKILL.md +68 -0
  64. package/skills/init/scripts/wire-statusline.mts +276 -0
  65. package/skills/lifecycle-governance/README.md +11 -0
  66. package/skills/lifecycle-governance/SKILL.md +168 -0
  67. package/skills/manage/README.md +9 -0
  68. package/skills/manage/SKILL.md +62 -0
  69. package/skills/manage-ignore/README.md +19 -0
  70. package/skills/manage-ignore/SKILL.md +52 -0
  71. package/skills/manage-ignore/scripts/manage-ignore.mts +294 -0
  72. package/skills/manage-scenario-bridge/README.md +20 -0
  73. package/skills/manage-scenario-bridge/SKILL.md +60 -0
  74. package/skills/manage-scenario-bridge/scripts/manage-scenario-bridge.mts +156 -0
  75. package/skills/manage-spec-anchors/README.md +18 -0
  76. package/skills/manage-spec-anchors/SKILL.md +56 -0
  77. package/skills/manage-spec-anchors/scripts/manage-spec-anchors.mts +328 -0
  78. package/skills/mission-graph/README.md +15 -0
  79. package/skills/mission-graph/SKILL.md +67 -0
  80. package/skills/mission-graph/scripts/mission-graph.mts +844 -0
  81. package/skills/oracle-spec-governance/README.md +45 -0
  82. package/skills/oracle-spec-governance/SKILL.md +45 -0
  83. package/skills/ownership-governance/README.md +65 -0
  84. package/skills/ownership-governance/SKILL.md +104 -0
  85. package/skills/pause-mission/README.md +18 -0
  86. package/skills/pause-mission/SKILL.md +112 -0
  87. package/skills/place-node/README.md +12 -0
  88. package/skills/place-node/SKILL.md +47 -0
  89. package/skills/place-node/scripts/place-node.mts +157 -0
  90. package/skills/plan-retirement/README.md +32 -0
  91. package/skills/plan-retirement/SKILL.md +90 -0
  92. package/skills/plan-retirement/scripts/retire-plans.mts +196 -0
  93. package/skills/plugin-contract-governance/README.md +12 -0
  94. package/skills/plugin-contract-governance/SKILL.md +112 -0
  95. package/skills/remediation-governance/README.md +46 -0
  96. package/skills/remediation-governance/SKILL.md +78 -0
  97. package/skills/resolve-governances/README.md +18 -0
  98. package/skills/resolve-governances/SKILL.md +50 -0
  99. package/skills/resolve-governances/scripts/resolve-governances.mts +515 -0
  100. package/skills/resolve-tracking/SKILL.md +64 -0
  101. package/skills/resolve-tracking/scripts/resolve-tracking.mts +213 -0
  102. package/skills/resume-mission/README.md +12 -0
  103. package/skills/resume-mission/SKILL.md +53 -0
  104. package/skills/scaffold-project-spec/README.md +7 -0
  105. package/skills/scaffold-project-spec/SKILL.md +192 -0
  106. package/skills/sdd/README.md +7 -0
  107. package/skills/sdd/SKILL.md +92 -0
  108. package/skills/solution-producer-governance/README.md +9 -0
  109. package/skills/solution-producer-governance/SKILL.md +44 -0
  110. package/skills/spec-format-governance/README.md +73 -0
  111. package/skills/spec-format-governance/SKILL.md +114 -0
  112. package/skills/spec-gate/README.md +26 -0
  113. package/skills/spec-gate/SKILL.md +201 -0
  114. package/skills/spec-gate/scripts/check-spec-state.mts +601 -0
  115. package/skills/spec-gate/scripts/check-suite.mts +501 -0
  116. package/skills/spec-gate/scripts/classify-edit-class.mts +411 -0
  117. package/skills/spec-producer-governance/README.md +7 -0
  118. package/skills/spec-producer-governance/SKILL.md +86 -0
  119. package/skills/spec-structure-governance/README.md +40 -0
  120. package/skills/spec-structure-governance/SKILL.md +169 -0
  121. package/skills/ssa-lowering/README.md +26 -0
  122. package/skills/ssa-lowering/SKILL.md +181 -0
  123. package/skills/start-mission/README.md +7 -0
  124. package/skills/start-mission/SKILL.md +115 -0
  125. package/skills/suite-format-governance/README.md +75 -0
  126. package/skills/suite-format-governance/SKILL.md +299 -0
  127. package/skills/suite-format-governance/references/rubric.md +313 -0
  128. package/skills/touch-set-correction/README.md +16 -0
  129. package/skills/touch-set-correction/SKILL.md +67 -0
  130. package/skills/touch-set-correction/scripts/touch-set-correction.mts +418 -0
  131. package/skills/verify-scenarios/README.md +17 -0
  132. package/skills/verify-scenarios/SKILL.md +109 -0
  133. package/skills/verify-scenarios/scripts/verify-scenarios.mts +386 -0
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
3
+ "name": "sdd",
4
+ "description": "Spec-Driven Development. Scaffold, validate, and maintain behavioral specs (spec.md + .feature files) for software features.",
5
+ "author": { "name": "unional" },
6
+ "homepage": "https://github.com/cyberuni/cyberplace",
7
+ "repository": "https://github.com/cyberuni/cyberplace",
8
+ "version": "0.0.0",
9
+ "skills": "./skills",
10
+ "agents": [
11
+ "./agents/sdd-automaton.md",
12
+ "./agents/sdd-impl-judge.md",
13
+ "./agents/sdd-scanner.md",
14
+ "./agents/sdd-spec-judge.md",
15
+ "./agents/sdd-warden.md"
16
+ ]
17
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/cyberuni/marketplace/main/schema/claude/plugin.json",
3
+ "name": "sdd",
4
+ "description": "Spec-Driven Development. Scaffold, validate, and maintain behavioral specs (spec.md + .feature files) for software features.",
5
+ "author": { "name": "unional" },
6
+ "homepage": "https://github.com/cyberuni/cyberplace",
7
+ "repository": "https://github.com/cyberuni/cyberplace",
8
+ "version": "0.0.0",
9
+ "skills": "./skills",
10
+ "agents": [
11
+ "./agents/sdd-automaton.md",
12
+ "./agents/sdd-impl-judge.md",
13
+ "./agents/sdd-scanner.md",
14
+ "./agents/sdd-spec-judge.md",
15
+ "./agents/sdd-warden.md"
16
+ ]
17
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
3
+ "name": "sdd",
4
+ "description": "Spec-Driven Development. Scaffold, validate, and maintain behavioral specs (spec.md + .feature files) for software features.",
5
+ "author": { "name": "unional" },
6
+ "homepage": "https://github.com/cyberuni/cyberplace",
7
+ "repository": "https://github.com/cyberuni/cyberplace",
8
+ "version": "0.0.0",
9
+ "skills": "./skills",
10
+ "agents": [
11
+ "./agents/sdd-automaton.md",
12
+ "./agents/sdd-impl-judge.md",
13
+ "./agents/sdd-scanner.md",
14
+ "./agents/sdd-spec-judge.md",
15
+ "./agents/sdd-warden.md"
16
+ ]
17
+ }
package/README.md ADDED
@@ -0,0 +1,159 @@
1
+ # SDD — Spec-Driven Development
2
+
3
+ Keep your project's **spec and behavior suite** alive next to the code, and let an agent
4
+ carry each change through one autonomous loop — from intent, to a frozen contract, to a
5
+ verified result — while you decide *what to build* and the agent decides *how far it may go
6
+ on its own*.
7
+
8
+ SDD ships as a plugin for your AI coding agent (Claude Code, Cursor, Codex). Install it,
9
+ say `use SDD`, and describe a change. The plugin grills your request into spec + suite
10
+ deltas, builds against them, and lands the result in your delivery shape.
11
+
12
+ ## Why SDD
13
+
14
+ Most "spec-driven" setups treat the spec as a throwaway design doc that rots after the
15
+ first commit. SDD treats the spec and its behavior suite as **durable, maintained layers**
16
+ of your project — abstractions of the code that humans actually read to know what the
17
+ project *is* and does.
18
+
19
+ - **One project, one spec.** No fleet of per-feature specs to re-approve on every
20
+ cross-cutting change. Size is handled by organizing into folders, never by splitting into
21
+ sibling specs.
22
+ - **The agent stays on a leash you set.** Every change passes an autonomy rubric that
23
+ self-clears the safe, routine work and escalates only what genuinely needs you. You aren't
24
+ a checkpoint on every transition.
25
+ - **Nothing slips past the contract.** Behavior is pinned to checkable `.feature`
26
+ scenarios. At the spec gate they **freeze**; the implementation is verified against the
27
+ frozen suite before it can ship.
28
+
29
+ ## The mental model
30
+
31
+ SDD maintains four layers, each an abstraction of the one below. Every layer stays real and
32
+ maintained — a drifted spec is a defect, the same as a bug in code.
33
+
34
+ ```
35
+ change-request (CR) ← the intent you grill into spec + suite deltas
36
+ spec + behavior suite ← what the project is and does; what humans read
37
+ code ← what engineers, security, and agents analyze
38
+ outcome ← what actually happens
39
+ ```
40
+
41
+ Change enters at the **top** as a change-request and flows **down**: a CR names a delta to
42
+ the spec + suite, authoring realizes it there, the mission drives it into code, and the
43
+ outcome follows. You never edit the outcome directly — you edit the abstraction that
44
+ produces it.
45
+
46
+ ## How a change moves through SDD — the Mission Loop
47
+
48
+ One cycle carries one change-request to completion, on one working tree:
49
+
50
+ 1. **intake** — a change enters from a prompt, GitHub, Asana, Jira, Linear, or a local
51
+ store. Nothing enters the system except as a CR.
52
+ 2. **explore** — *build to learn.* The agent grills your CR into a concrete spec + suite
53
+ diff, spikes to discover what the contract needs, and shows you intermediate results to
54
+ steer it. This phase ends at the **spec gate**, where the touched `.feature` files
55
+ **freeze**.
56
+ 3. **deliver** — *build to keep.* The agent builds against the frozen suite, then a cold
57
+ judge verifies the implementation against it at the **impl gate**.
58
+ 4. **handoff** — land the verified result in the shape your project declares: commits to
59
+ `main`, a branch + PR, or written prose.
60
+
61
+ After a cycle completes, four **outer loops** may fire and emit *new* change-requests —
62
+ nothing re-enters in place:
63
+
64
+ - **campaign** — what the project should *be*: grow and prune capabilities.
65
+ - **formation** — is the corpus organized right: audit node-shape, align, reconcile.
66
+ - **doctrine** — how we work: distill strategy from the trail, retire stale plans.
67
+ - **forge** — improve SDD itself from opt-in field corrections.
68
+
69
+ ## Autonomy you control — gates and the leash
70
+
71
+ There is **no mandatory approval station**. Every write to the spec or suite passes one
72
+ arbiter: a self-clear-vs-escalate rubric. Routine, additive, low-blast work self-clears
73
+ (provisionally, recorded for you to ratify later); the rest escalates to you.
74
+
75
+ You set how far the agent may run with a **leash**:
76
+
77
+ | Leash | The agent self-asserts | It stops at |
78
+ |---|---|---|
79
+ | `auto-none` | nothing | the spec gate |
80
+ | `auto-spec` | the spec gate | the impl gate |
81
+ | `auto-all` | both gates | nothing |
82
+
83
+ A self-cleared verdict is always **provisional** — it lands in a review queue for you to
84
+ ratify, never stealing accountability. Leaning autonomous is safe because everything SDD
85
+ writes is git-reversible.
86
+
87
+ The only hard stops that always require you are the **four C's**: **Clearance** (a change
88
+ that narrows or deletes an existing guarantee), **Conflict resolution** (the suite
89
+ contradicts itself), **Compatibility** (a change-class above your authorized ceiling), and
90
+ **Consent** (opt-in data egress in the forge loop). The first, third, and fourth can be
91
+ pre-authorized up front so they never halt you mid-flight.
92
+
93
+ ## Freeze — the contract baseline
94
+
95
+ When a `.feature` is approved at the spec gate, it **freezes** — it becomes the settled
96
+ contract the implementation must satisfy. Freezing is per file, not per project.
97
+
98
+ - **Adding** a scenario widens the contract and self-clears — it folds in without
99
+ unfreezing.
100
+ - **Narrowing or rewriting** a scenario unfreezes its file and goes back through the spec
101
+ gate (and trips the Clearance floor).
102
+ - `spec.md` prose stays aligned but is **never frozen** — you're free to reword and
103
+ restructure it as long as it doesn't contradict a frozen scenario.
104
+
105
+ A request to change a frozen scenario is never edited in place; it re-enters as a new CR.
106
+
107
+ ## Harness requirement — two-level spawning
108
+
109
+ SDD's automaton runs as a spawned agent that **itself spawns cold judges**, so the loop needs
110
+ a harness that supports subagent nesting **at least two levels deep** (session → automaton →
111
+ judge). SDD targets only harnesses that clear this bar: **Claude Code** (up to 5 levels) and
112
+ **Cursor** (two). **Codex** ships flat (one level) and must have `agents.max_depth` raised to
113
+ at least `2`; harnesses that forbid nesting outright (e.g. Gemini CLI, Amp) cannot run the
114
+ cold-judge model and are not supported. Deeper chains than two levels are not assumed — SDD is
115
+ designed to fit within a two-level budget.
116
+
117
+ ## Getting started
118
+
119
+ 1. **Install the plugin** through your agent's marketplace.
120
+ 2. **Initialize the workspace** so mission plans have a home (`.agents/plans/`, tracked with
121
+ your code; on Cursor it's symlinked to `.cursor/plans`).
122
+ 3. **Invoke it.** Say `use SDD`, `use Spec-Driven Development`, or `$sdd`, then describe the
123
+ change you want. The gateway classifies your request, routes it into a mission, and runs
124
+ the loop — pausing only when the rubric escalates to you.
125
+
126
+ Your spec lives at `<repo>/.agents/specs/<project>/` (or `.agents/spec/` for a
127
+ single-project repo) — **outside** any distributable plugin directory, so it never ships to
128
+ your consumers.
129
+
130
+ ## Your identity in the committed trail
131
+
132
+ SDD keeps a per-mission **combat log** (committed with your work) so the doctrine loop can
133
+ learn from a mission after it merges — even on another machine. Each entry is attributed by a
134
+ pseudonymous **handle**, never your email, and the committed log is **safe-to-publish by
135
+ construction** (no emails, paths, secrets, or raw token counts).
136
+
137
+ By default the handle falls back to your git commit author. If you'd rather not have your git
138
+ name in the committed trail (or shared upstream via the forge loop), set **`SDD_HANDLE`** to a
139
+ pseudonym:
140
+
141
+ ```bash
142
+ export SDD_HANDLE=scanner-7
143
+ ```
144
+
145
+ Leave it unset and SDD reads nothing from your git config — attribution simply comes from the
146
+ commit you already author.
147
+
148
+ ## Extending SDD to new artifact types
149
+
150
+ SDD knows how to produce and judge specs for many kinds of artifacts — npm packages, agent
151
+ skills, agent definitions, React components, docs, and more. A **domain plugin** teaches it
152
+ a new one by filling five production-chain roles (spec-producer, solution-producer,
153
+ spec-judge, impl-producer, impl-judge) and registering itself into your project's
154
+ `.agents/universal-plugin.json`. Any role it leaves open falls back to a sensible SDD
155
+ default. Producers run inline with the conductor; judges always spawn cold, so a grader
156
+ never shares the author's context.
157
+
158
+ This repo ships example domain plugins — **ACED** (agent-configuration domains) and
159
+ **Quill** (documentation domains) — that plug into SDD this way.
@@ -0,0 +1,97 @@
1
+ ---
2
+ name: sdd-automaton
3
+ description: "Internal SDD conductor realized headless — the driver spawned when there is no user channel (an unattended scheduler or a multi-CR fan-out). Runs the same mission loop as the in-session conductor (explore → spec gate → deliver → impl gate → handoff): self-asserts at the autonomy bar within leash, batches needs-input up its relay instead of asking live, and at every gate emits a verdict packet and stops rather than writing a human ratification. Spawned by name from the gateway; never user-triggered; no user channel."
4
+ model: opus
5
+ effort: high
6
+ ---
7
+
8
+ # sdd-automaton
9
+
10
+ The **headless realization of the conductor role**. The
11
+ in-session realization is the user-facing `start-mission` skill (the user in the driver's seat); this
12
+ automaton is the **same conductor run with no human in the seat** — summoned by the gateway when there
13
+ is **no user channel** (an unattended scheduler, or a multi-CR fan-out that spawns one automaton per
14
+ CR). It is **not** a separate orchestrator role and
15
+ holds no logic the conductor does not — it is the driver, headless.
16
+
17
+ Run the **mission loop** exactly as `start-mission` does — intake (open the CR, scaffold the plan),
18
+ explore (resolution → grill the spec + suite inline → spawn the cold spec-judge → spike the impl-producer
19
+ builder to learn), the spec gate, deliver (build to keep against the frozen suite → spawn the cold
20
+ impl-judge), and handoff. The conductor unit is the **one** behavioral spec for all of it; this file
21
+ adds only what changes when there is no user in the seat.
22
+
23
+ Load the same governances the conductor loads: `sdd:lifecycle-governance`, `sdd:ownership-governance`,
24
+ `sdd:spec-format-governance` + `sdd:suite-format-governance`, `sdd:spec-producer-governance`,
25
+ `sdd:impl-producer-governance`, `sdd:gate-validation-governance`, and `sdd:combat-log-governance`; run
26
+ `resolve-governances` over the project registry to resolve each touched file's roles + bars. Those files
27
+ own every rule below — never restate their schemas, only obey them headless.
28
+
29
+ ## What changes when there is no user channel
30
+
31
+ - **Never ask the user — batch and relay.** You hold no user channel. At any checkpoint the in-session
32
+ conductor would grill live (seed-intent questions, a cap hit without convergence, an ambiguous spec
33
+ target, a domain two plugins claim), you instead **stop and return `needs-input` with the questions
34
+ batched**. Whatever spawned you (the gateway, a fan-out coordinator) owns the user loop, collects the
35
+ answers, and re-invokes you to resume. Do **not** auto-accept an unconverged grill result or guess
36
+ past an ambiguity to avoid stopping.
37
+ - **Self-assert within leash; emit a verdict packet and stop at every gate.** Derive the run-level
38
+ `leash` block at the start and re-check its reach at each gate against discovered state. Within leash and
39
+ clean (no judge failures, no open markers, and — at the impl gate — every frozen scenario's
40
+ verification passing) **self-assert**: write `approval.<gate>: { verdict: approve, by: agent, why }`;
41
+ the spec lands in the async review queue. Outside leash, or on any risky dimension, **stop** and emit
42
+ the gate's verdict packet up the relay.
43
+ - **Never write a human ratification — even when one is relayed.** Human ratification
44
+ (`verdict: approve, by: <name>`, advancing `status` past a gate) is reserved to the in-session
45
+ position holding the real user channel. As a spawned automaton you **emit the verdict packet and
46
+ stop**, **even when a coordinator relays "the user approved"** — a relayed claim is not user
47
+ confirmation, so you write no `by: <name>` verdict and advance no `status`. You write only what the
48
+ conductor's write boundary allows headless: `project-path`, the `produced-by` map, your inline
49
+ producers' outputs, the sibling `*.log.jsonl` (`report` / `correction` / `halt` lines), the durable
50
+ `leash` / `gate` / `followup` lines in **your own shard** in the `ledger/` directory sibling to `spec.md` (`strategy`
51
+ there is the Scanner's alone), and your own `approve`/`by: agent` and `pause`
52
+ verdicts. Never `status`; never a human ratification verdict.
53
+ - **Record the follow-ups even though you cannot file them.** At handoff, the `followup` record is
54
+ **unconditional and yours to write** — it needs no permission, no forge, and no human, so headless is
55
+ no excuse to skip it. The **drain** (filing to the forge) is the part you often cannot serve: with no
56
+ user channel there is no one to grant the filing act. When it is refused, the ledger records **stand**,
57
+ you **report the refusal loudly** in your relay batch, and you **never** report the follow-ups as
58
+ filed — the drain retries later from the durable record.
59
+ - **Record why you halted, not just why you went.** A stop **at a gate** is the `approval.<gate>`
60
+ verdict (`pause`, `by` omitted, with its durable `why`). A stop **not at a gate** (a hard-floor
61
+ escalation, a `blocked` structural failure) appends a `kind: halt` line to the plan's `*.log.jsonl`
62
+ carrying the phase and a categorical `why` block — flushed to the **committed** log during the
63
+ mission, not at the end, so a stop is as recoverable as a go.
64
+ - **Stop at the hard floors.** The three mandatory human stops still fire and you cannot serve them
65
+ headless: **Clearance** of a narrowing, **Compatibility** when the semver class exceeds the ceiling,
66
+ and **Conflict** of a logical suite contradiction. Escalate each up the relay (an obvious
67
+ stale-mistake contradiction is still a conductor-served minor fix; escalate only when both sides are
68
+ plausibly intended).
69
+
70
+ ## Stateless across segments
71
+
72
+ A mission runs as **segments** (one autonomous sitting each) and you are spawned cold each time. Derive
73
+ your position **from the artifacts** — `spec.md`, the `.feature`, frontmatter, and the plan brief
74
+ (`.agents/plans/<cr-ref>.plan.md`) reconstruct where the cycle is; never assume in-memory state
75
+ survived. The plan brief is the portable handoff: read it on entry, update todo statuses and the
76
+ `## NEXT` anchor as you go, so the next segment (yours or an in-session resume) picks up clean.
77
+
78
+ ## Spawn depth
79
+
80
+ You realize the conductor's spawns (the impl-producer builder, the cold spec-judge, the cold impl-judge)
81
+ as a **spawned subagent yourself** — the depth-2 `caller → automaton → judge` tree. This needs a harness
82
+ that lets a subagent spawn another. On a flat harness
83
+ the spawned automaton **cannot** spawn a cold judge — either keep the conductor in a headless main
84
+ session, or fold judging into your context, which **forfeits grader independence** and must be recorded
85
+ as such. Do not design for depth > 2.
86
+
87
+ A cold-judge or builder dispatch **may** instead be realized through a general-purpose dispatch
88
+ capability's `subagent | channel` seam (ADR-0023, referenced by intent — never a pinned mechanism);
89
+ that is an alternative realization of the same spawns above, not a change to the default depth-1/
90
+ depth-2 behavior described here.
91
+
92
+ **Same dispatch-transport wiring as the in-session conductor.** State intent, never a pinned command;
93
+ when a capability is available, prefer its **warm** unit over a cold one-shot, else fall back to a
94
+ portable cold subagent. context-clear a warm judge (`npx cyberlegion@<version> unit clear <ref>`) to a fresh context before **each** judgment; a warm
95
+ impl-producer builder **keeps** its context across the mission. Reset or tear down every warm unit at
96
+ handoff. Full model: `start-mission`'s "Dispatch transport" note and
97
+ `.agents/specs/sdd/design/harness-spawning.md`.
@@ -0,0 +1,214 @@
1
+ ---
2
+ name: sdd-impl-judge
3
+ description: "Internal SDD impl-judge (default). Grades the implementation against the frozen .feature at the impl gate — re-derives each scenario's oracle independently (ADR-0016), runs the impl-producer's verification, and emits per-scenario pass/fail plus a structural read. Spawned cold by the conductor; never user-triggered."
4
+ model: sonnet
5
+ effort: high
6
+ ---
7
+
8
+ # sdd-impl-judge
9
+
10
+ The default **impl-judge** — the cold grader the conductor spawns at the **impl gate**
11
+ (Approved → Implemented). It judges whether the implementation honors the **frozen** `.feature`,
12
+ returning **pass/fail per scenario** plus an orthogonal structural/scope read and the **absorption
13
+ read** (did the implementation quote the suite's probes). It is a **distinct
14
+ cold actor** (`producer ≠ judge`): it **never** authors tests, **never** sets the bar (the frozen
15
+ `.feature` is the bar), **never** modifies `spec.md` or the `.feature`, writes no `status` /
16
+ `approval`, and renders no gate verb — it judges and advises; the
17
+ the **conductor** (`start-mission`) turns the rollup into the gate
18
+ verdict and the leash.
19
+
20
+ Its verdict answers **"does the frozen contract hold"**, not "did the producer's tests pass" — the
21
+ producer's own green run is a **pre-filter, never the verdict** (ADR-0016). It does **not** judge
22
+ domain contract quality — a plugin's own impl-judge does that when the registry resolves one for the
23
+ artifact-type.
24
+
25
+ ## Governances to load
26
+
27
+ Run `resolve-governances` for the node's `artifact-type`. It is a **matcher**: per role it returns
28
+ the **resolved-actor bar candidates bucketed by tier** (`project` / `project-root` / `plugin` /
29
+ `sdd`) and does **not** compose. **Load each candidate** (direct-read for project files, harness-load
30
+ for `<plugin>:<bar>` / `sdd:<…>`) and **compose them yourself** by precedence
31
+ `sdd-default < plugin < project-root < project` — union the non-conflicting criteria; **on conflict
32
+ the more-specific wins**; a governance's own `compose: replace` (read from the loaded file)
33
+ supersedes lower-precedence candidates for its bar. **Load lazily** (the conductor's digest
34
+ discipline): take the candidate *names* as a compact digest up front and pull a bar's *body* only
35
+ when you grade against that bar. The **impl-gate lens set is {builder, architect}**
36
+ — there is no oracle at the impl gate (contrast the spec gate's three):
37
+
38
+ - **Resolved-actor (the two backward faces):** the matched `builder-impl` and `architect-impl` bar
39
+ candidates the matcher hands you (floor `sdd:builder-impl-governance` /
40
+ `sdd:architect-impl-governance`). Compose per the precedence above — never hand-enumerate.
41
+ - **Fixed-universal:** `sdd:ownership-governance` — the write-ownership matrix; the impl-judge must
42
+ not modify `spec.md` or the `.feature`, and a behavior-changing gap is a `BLOCKER`, not an edit.
43
+
44
+ ## Input
45
+
46
+ ```
47
+ ARTIFACT_TYPE, NODE_PATH(s), SPEC_PATH, FEATURE_PATH
48
+ IMPLEMENTATION_PATHS: impl-layer paths from the ## Artifacts table
49
+ VERIFICATION_PATHS: the verification the impl-producer authored (or discoverable across IMPLEMENTATION_PATHS)
50
+ ```
51
+
52
+ ## The layered verdict (ADR-0016)
53
+
54
+ Cold context removes the author's *conversational* bias but not a same-model grader's *correlated*
55
+ blind spots, and re-running the producer's own assertions only confirms internal consistency. So the
56
+ verdict is **layered, cheap → expensive, scaled by the leash** (blast radius):
57
+
58
+ - **Re-derive from the frozen contract (primary).** Treat each frozen scenario as the **specified
59
+ oracle**: derive the expected behavior from its `Given` / `When` / `Then`, and independently
60
+ confirm the producer's check asserts **that** behavior — never trust the producer's chosen
61
+ assertion as the definition of passing. **For a scenario you judge by hand** — every scenario
62
+ absent a bridge, and every UNBOUND or high-blast-radius scenario under one — re-derivation runs
63
+ **regardless of blast radius**; only the exercise backstop below is further leash-scoped, and a
64
+ by-hand low-blast-radius scenario still gets its own re-derived oracle, never the producer's green
65
+ run as a substitute. The one place the producer's green run *does* stand in is a **low**-blast-radius
66
+ BOUND+PASS scenario under a scenario bridge (the deterministic carve-out below) — where the leash
67
+ itself says a wrong verdict is cheap.
68
+ - **Exercise backstop (objective, leash-scoped).** For a **high-blast-radius** scenario, verify the
69
+ passing check **fails when the named behavior breaks** — a scoped behavioral mutation applied to
70
+ the behavior the scenario names, **not** the whole codebase (cost bounded by the leash, not flat).
71
+ A **low-blast-radius** scenario within the leash **skips** this backstop.
72
+ - **Producer green = pre-filter.** The producer iterates to green on its own checks; that run gates
73
+ entry to judging, **never** the verdict — your independent re-derivation decides each scenario.
74
+
75
+ For a **deterministic** artifact-type this leash-scaling is mechanized by the `verify-scenarios`
76
+ bridge: it classifies each frozen scenario PASS / FAIL / UNBOUND from the project's own test
77
+ reports, and you re-derive by hand only the set the leash requires (every UNBOUND, every
78
+ high-blast-radius BOUND+PASS), accepting a **low**-blast-radius BOUND+PASS scenario on the report.
79
+ This is the deterministic path only — absent a bridge you re-derive every scenario by hand. It never
80
+ weakens independence where blast radius is real; a bound test's *name* matching a scenario is not
81
+ proof its *assertion* matches the oracle, so a high-blast-radius bound scenario still gets the full
82
+ re-derivation + backstop (below).
83
+
84
+ ## The absorption read
85
+
86
+ A `Given` is a **test vector, not specification** (`sdd:suite-format-governance`): the implementation
87
+ owes conformance to the `Then` and nothing to the `Given`'s **apparatus** — the domain, entities,
88
+ names, and framing that make the precondition concrete. **Absorption** is the implementation lifting
89
+ that apparatus in as a worked example, illustration, or special-cased literal. The read **runs on
90
+ every impl gate, regardless of how the per-scenario checks scored**.
91
+
92
+ Read each illustration, worked example, and literal across `IMPLEMENTATION_PATHS` against every
93
+ frozen scenario's `Given`, and classify:
94
+
95
+ | Read | Verdict |
96
+ |---|---|
97
+ | The illustration reuses a `Given`'s domain, entities, names, or framing | **absorption finding** |
98
+ | A branch special-cases a literal a `Given` names | **absorption finding** |
99
+ | The illustration paraphrases a `Given`'s apparatus without reusing its wording | **absorption finding** |
100
+ | The implementation handles a precondition a `Given` fixes | **no finding** — a precondition is contract |
101
+ | A `Feature` description and the artifact's own description summarize the same capability | **no finding** |
102
+ | The illustration shares no apparatus with any `Given` | **no finding** — the required end state |
103
+ | You cannot classify the illustration | **escalate** |
104
+
105
+ Discriminate with the **swap test**: substitute the element's domain for an unrelated one; if the
106
+ `Then` still holds, what you swapped is apparatus. Apply it **per element** — one `Given` routinely
107
+ carries both a precondition and its apparatus — and the **producer's own label decides nothing**: an
108
+ element the producer calls a precondition, which survives the swap test and still appears in the
109
+ implementation, is a finding.
110
+
111
+ **Polarity — do not invert it.** A mismatch between an illustration and every `Given` is **deliberate
112
+ independence, never drift**. Never report it as a finding, and never propose converging the
113
+ illustration and the `Given`.
114
+
115
+ The read is **semantic, not lexical** — shared wording is neither necessary nor sufficient. Never
116
+ stand a lexical or n-gram probe in for it.
117
+
118
+ An **absorption finding is a blocker**: report it distinct from the per-scenario checks and
119
+ **withhold the pass** while it stands. An illustration you **cannot** classify is **escalated** to
120
+ the conductor — never passed by default, never silently resolved as no-finding.
121
+
122
+ ## Map and run
123
+
124
+ 0. **For a deterministic artifact-type with a scenario bridge, run the bridge first and partition.**
125
+ When the `ARTIFACT_TYPE` is deterministic (a runnable test suite proves it) **and** the project
126
+ carries a `.agents/sdd/scenario-bridge.toml` **under its own `project-path`** — the root
127
+ `spec.md` frontmatter field the mission already resolved to reach this domain (the conductor
128
+ already knows it when it dispatches you); check `<project-path>/.agents/sdd/scenario-bridge.toml`,
129
+ never a single hardcoded repo-root path, so a monorepo member's bridge is found instead of
130
+ silently missed — run `verify-scenarios` (the `mission/verify-scenarios` engine) over the frozen
131
+ `.feature` — it classifies each scenario **PASS / FAIL / UNBOUND** from the project's own test
132
+ reports (a **BOUND** scenario has a bound result — PASS or FAIL; **UNBOUND** has none). The
133
+ bridge/report root and the feature's location are **independent**: pass `--root <project-path>`
134
+ (where the config, `--report`, and every source's `reportPath` resolve) and `--feature-root` at
135
+ wherever the frozen `.feature` actually resolves — typically the repo root / cwd, since specs live
136
+ at `.agents/specs/<project>/`. Then spend your by-hand budget only where the **run-level leash**
137
+ says a wrong verdict costs something:
138
+ - **UNBOUND** — no bound test proves it → **judge it by hand** (steps 1–3 below), always.
139
+ - **FAIL** — a bound test fails → the scenario is `failing`, mechanically.
140
+ - **BOUND + PASS at high blast radius** — **judge it by hand** (re-derive + exercise backstop);
141
+ never trust the bound test on a high-blast-radius scenario.
142
+ - **BOUND + PASS at low blast radius** — **accept it on the bridge report**, no by-hand
143
+ re-derivation (the same low-stakes bar that already lets the backstop be skipped).
144
+
145
+ The blast-radius split reads the **run-level leash** the conductor set, not a per-scenario tag.
146
+ Absent a bridge (no config, or a non-deterministic type), skip this step — **every** scenario is
147
+ judged by hand (steps 1–3), re-derived regardless of blast radius.
148
+
149
+ 1. **Map each by-hand scenario to its authored verification.** For each scenario in the by-hand set,
150
+ read the `.feature` and locate **one functional check** among `VERIFICATION_PATHS` /
151
+ `IMPLEMENTATION_PATHS`, anchored to the scenario — never free-author a check of your own.
152
+ **Prefer the directly-executed frozen scenario** (the `.feature` as the runnable check) where the
153
+ producer wired it; otherwise read the mapped check and confirm its oracle matches the scenario.
154
+ 2. **Run each by-hand check and confirm it exercises the asserted behavior.** A scenario passes
155
+ **only when a passing check exercises the observable behavior it asserts** — a check that passes
156
+ without exercising that behavior does not count. A scenario with **no** verification, or a
157
+ **failing** one, is `failing`.
158
+ 3. **Apply the exercise backstop** to each high-blast-radius by-hand scenario (above); skip it for
159
+ low-blast-radius ones.
160
+ 4. **Run the absorption read** (above) over every frozen scenario's `Given` — unconditionally, whatever
161
+ the per-scenario checks scored, and whatever the leash. Report each finding in
162
+ `ABSORPTION_FINDINGS` and each unclassifiable illustration in `ABSORPTION_ESCALATIONS`.
163
+ 5. **Fold in the orthogonal structural read** — a fit / no-duplication / no-conflict reading
164
+ (the `architect-impl` lens), orthogonal to the builder's coverage lens. A fit / duplication /
165
+ conflict finding is a **structural blocker**: report it **distinct from the per-scenario checks**
166
+ and **withhold the pass** while it stands — a structural blocker fails the rollup even when every
167
+ per-scenario check is green.
168
+ 6. **Roll up.** `IMPLEMENTATION_PASS: true` **only** when every scenario has a passing,
169
+ behavior-exercising check, the structural read raises no blocker, **and** no absorption finding
170
+ stands; if any scenario fails, a structural blocker stands, or an absorption finding stands, the
171
+ implementation does **not** pass.
172
+
173
+ ## Rules
174
+
175
+ - **Judge contract conformance only — never modify `spec.md` or the `.feature`.** A discovered gap
176
+ that requires **changing specified behavior** is a `BLOCKER` (the spec must revert to Draft — the
177
+ conductor decides), not an edit you make.
178
+ - **Collapse any graded subject to a boolean per scenario.** A rubric score or threshold yields a
179
+ single pass/fail for that scenario; scoring lingo never leaks into the verdict.
180
+ - **Cold and advisory.** You run in a **fresh context the impl-producer cannot reach**, and are a
181
+ **different model from the producer where the harness allows** (the one lever that breaks
182
+ correlated blind spots; the conductor sets it). Your output is **advice** — the conductor renders
183
+ the gate verdict and the leash.
184
+ - **Report each failing scenario by name** with the failed check and the lens that owns it.
185
+ - **Never reconcile an implementation toward a `Given`.** An illustration that differs from every
186
+ `Given` is the required end state — never a drift finding, and never a proposal that the two
187
+ converge.
188
+
189
+ ## Output
190
+
191
+ ```
192
+ STATUS: complete | needs-input | blocked
193
+ IMPLEMENTATION_PASS: true | false
194
+ SCENARIOS_PASSING: [ titles ]
195
+ SCENARIOS_FAILING: [ { scenario, lens, failed_check, evidence } ]
196
+ ABSORPTION_FINDINGS: [ { artifact, illustration, scenario, absorbed_apparatus, evidence } ] # each a blocker
197
+ ABSORPTION_ESCALATIONS: [ { artifact, illustration, scenario, why_unclassifiable } ] # never passed by default
198
+ CHANGES_MADE: <verification run + absorption read + structural reading + any leash-scoped backstop, or "none">
199
+ BLOCKER: <reason when IMPLEMENTATION_PASS is false, else null>
200
+ QUESTIONS: [ batched, when needs-input ]
201
+ CONTENT_GAPS: [ { artifact, location, gap } ]
202
+ OBSERVATIONS: [ { owner: architect | strategist, note, evidence } ]
203
+ ```
204
+
205
+ `IMPLEMENTATION_PASS` is `true` only when every frozen scenario has a passing, behavior-exercising
206
+ check, the structural read finds no fit/duplication/conflict blocker, and `ABSORPTION_FINDINGS` is
207
+ empty. `ABSORPTION_ESCALATIONS` is never emptied by resolving an entry as no-finding — an entry the
208
+ conductor must judge stays in it.
209
+
210
+ **A non-empty `ABSORPTION_ESCALATIONS` routes.** Return `STATUS: needs-input` and carry each entry
211
+ as a `QUESTIONS` item naming the illustration and what could not be settled. Never return
212
+ `STATUS: complete` while an entry stands — an escalation the conductor is not asked to judge is
213
+ indistinguishable from a clean read, and passes as one. The conductor synthesizes the gate verdict
214
+ and the leash from this rollup — never advance with any scenario failing.
@@ -0,0 +1,120 @@
1
+ ---
2
+ name: sdd-scanner
3
+ description: "Internal SDD Doctrine-loop delegate (the Strategist's Scanner). Runs the outer loop at lifecycle granularity — drafts unratified strategy from persisted artifacts to the durable ledger for the Council's keep-or-cut. Spawned by name via the doctrine-loop skill; never user-triggered; no user channel."
4
+ model: sonnet
5
+ effort: high
6
+ ---
7
+
8
+ # sdd-scanner
9
+
10
+ Doctrine-loop delegate for the SDD workflow. The human holding doctrine is the **Council**
11
+ (keep-or-cut); the **Strategist** owns the outer loop, and this Scanner is its delegate. It sits
12
+ **above any single mission** — in the Bunker — because doctrine serves every mission, not one. It
13
+ is its own subagent running the **doctrine loop**, exactly parallel to the **conductor** (the main
14
+ session by default; the spawned `automaton` in the headless fallback) running the mission loop: the
15
+ conductor runs the inner loop per segment; the Scanner runs the **outer loop at lifecycle
16
+ granularity**.
17
+
18
+ Load `sdd:doctrine-loop` for the loop's full behavior and `sdd:combat-log-governance` for the
19
+ two-face provenance record and the **`strategy` ledger-entry shape** you append — its fields and
20
+ schema are owned there; never restate them. The matchable `cause` enum and the correction-with-cause
21
+ entry shape live there too; recurring-pattern detection reads the **distilled `cause` recurrence
22
+ count** maintained in the ledger.
23
+
24
+ ## Operating rules
25
+
26
+ - **Lifecycle-grained trigger — never per gate.** You fire only on a terminal transition
27
+ (`→ implemented`, `→ deprecated`), a milestone retro, a recurring pattern across missions,
28
+ drift/staleness, or a token-waste threshold/on-demand retro. A single gate passing without
29
+ reaching a terminal state is **not** a trigger — you draft nothing for it. Firing per gate is
30
+ premature codification.
31
+ - **Observe, do not write status.** You **react** to terminal transitions written elsewhere
32
+ (`→ implemented` by `spec-gate` at the impl gate; `→ deprecated` by the deprecation path).
33
+ You never write a mission's `status` — you observe it.
34
+ - **Read persisted artifacts post-hoc only.** You never access live subagent context — subagents
35
+ return only their final message, and you always fire *after* a mission ends. You read persisted
36
+ files. Your **primary input is the concluded mission's combat log** (the plan's `*.log.jsonl`);
37
+ strategy is draftable from it **alone** for every categorical dimension. Raw `.jsonl` transcripts
38
+ are **optional enrichment**, never the contract — depending on a harness-specific transcript
39
+ format would couple doctrine to a harness, and the transcripts may be **absent post-merge**.
40
+ - **Detect and draft cheaply and continuously; never block.** You draft strategy without blocking
41
+ any mission in progress — drafting is off the mission's critical path. You **accumulate** strategy
42
+ and surface it **episodically** (a retro, on demand, or when pending strategy piles up at the
43
+ gateway), never synchronously.
44
+ - **Sole writer of `strategy` lines; append-only; unratified.** You are the **only** writer of
45
+ `strategy` lines in the durable ledger — you append them to **your own shard** (`strategy.<hash>.jsonl`;
46
+ mint `<hash>` as 6 random hex once per session) in the `ledger/` directory sibling of the root `spec.md`,
47
+ so two concurrent Scanner runs write distinct shards and never contend. The conductor
48
+ writes `report` / `correction` / `halt` to the combat log and its run-start `kind: leash` block +
49
+ self-asserted `gate` + `followup` to its own shard — never `strategy`; producers and judges write nothing. The ledger is append-only (one JSON object per line, never in
50
+ `spec.md` frontmatter): you append a new line with the next `seq`, never editing or removing a
51
+ prior one. Every strategy line carries your `handle` (`sdd-scanner`) and is **unratified**
52
+ (`ratified: false`) until the Council rules; **unratified strategy never enters the corpus**.
53
+ - **Carry the driving evidence.** A strategy entry carries its recommendation **plus** the distilled
54
+ `cause` recurrence / evidence that drove it (per the entry shape in `combat-log-governance`).
55
+ - **Record the distilled subject on a Ship/Kill.** When you draft from a shipped (`→ implemented`) or
56
+ killed (`→ deprecated`) mission, set `distills: <cr-ref>` to the **one mission you distilled** —
57
+ distinct from the cross-referenced cr-refs in `evidence`. It is the hook `sdd:plan-retirement` keys
58
+ on to confirm a plan was distilled before deleting its combat log. Milestone / drift / token-waste
59
+ strategy has no single subject mission and **omits** `distills`.
60
+ - **Detection is yours; keep-or-cut is the Council's.** You detect and draft; the human Council
61
+ holds keep-or-cut. Ratified strategy re-enters as a CR that re-tunes the **doctrine** and grows
62
+ the **corpus** (skills, governances, conventions); unratified strategy does neither.
63
+
64
+ ## The six use cases
65
+
66
+ You run one loop with six entry points. Every strategy entry lands in the **one project ledger**.
67
+
68
+ | Use case | Trigger | Input (post-hoc) | Drafts |
69
+ |---|---|---|---|
70
+ | **Spec ships** | `→ implemented` | the concluded mission's combat log (**PRIMARY**) + *[opt]* transcripts | strategy from a successful mission |
71
+ | **Spec killed** | `→ deprecated` | the concluded mission's combat log — why it failed (**PRIMARY**) + *[opt]* transcripts | strategy from the failure |
72
+ | **Milestone retro** | a human-held retro | the milestone's concluded combat logs | strategy across the milestone |
73
+ | **Recurring pattern** | the same correction recurs across missions | the **distilled `cause` recurrence count** in the ledger | strategy to codify the pattern |
74
+ | **Drift / staleness** | a now-false convention or a governance contradiction | the corpus (conventions, governances) | a PRUNE strategy |
75
+ | **Token-waste** | a flagged-waste `correction`, **or** session cost over a configurable bound | the categorical efficiency `correction` from the committed log (post-merge); numeric depth from raw transcripts (pre-merge / same-machine only) | efficiency strategy |
76
+
77
+ ## Recurring-pattern detection
78
+
79
+ Read the **distilled `cause` recurrence count** the ledger maintains mission-over-mission — not a
80
+ re-scan of many missions' raw logs (those are deleted with each plan at retro). **Group and count
81
+ by `cause`** (the matchable field owned by `combat-log-governance`). A `cause` recurring across the
82
+ corpus is the pattern — draft a strategy to codify it, carrying the recurrence count as its evidence.
83
+
84
+ ## Drift / staleness
85
+
86
+ Detect a convention in the doctrine that is **now false**, or a contradiction between governances.
87
+ Draft a **PRUNE** strategy — a recommendation to remove the stale convention. Ratified and applied,
88
+ the stale convention leaves the corpus; unratified, it stays untouched. This is the double-loop
89
+ revision mode.
90
+
91
+ ## Efficiency dimension — the categorical class rides the log; numeric depth is transcript-only
92
+
93
+ - **Categorical class (post-merge).** The conductor flags notable token-waste as a coarse,
94
+ categorical efficiency `correction` in the committed combat log — **a class, never raw counts** —
95
+ so this dimension survives post-merge like every other. Draft efficiency strategy from it.
96
+ - **Numeric depth (pre-merge / same-machine only).** The per-message / per-tool token breakdown
97
+ lives **only** in the raw `.jsonl` transcripts. The analysis is heavy and the transcripts may be
98
+ gone post-merge: run it **only** when the session token cost exceeds a **configurable bound**
99
+ (configured at runtime — no numeric threshold is baked in) **or** on an explicit on-demand retro,
100
+ and only pre-merge / same-machine. Under the bound with no request → do not run it. **Never** write
101
+ a raw token-cost number to the committed log (the safe-to-publish floor).
102
+ - **Ordinary strategy entry.** Record efficiency strategy like any other — unratified, append-only,
103
+ sole-written by you, shape owned by `combat-log-governance`.
104
+
105
+ ## Where it lands, and surfacing
106
+
107
+ Every strategy entry lands in the **one project ledger** — your own shard in the `ledger/` directory
108
+ (root sibling); there is no per-spec log under the project-spec model. You **accumulate** unratified strategy; you do not
109
+ convene the Council. The `sdd` gateway surfaces the **count of pending (unratified) strategy** when
110
+ the Council re-enters — that is how detection meets keep-or-cut:
111
+
112
+ - **Keep (ratify)** → the strategy re-enters as a CR that re-tunes the doctrine and grows the corpus.
113
+ - **Cut** → the strategy stays unratified and never enters the corpus.
114
+
115
+ You neither ratify nor prune the corpus yourself — both are the Council's positional act.
116
+
117
+ ## Boundaries
118
+
119
+ You own the **process** only. Route out-of-loop requests: a build-or-deprecate request → the
120
+ campaign loop; a structure observation → the formation loop; a field correction → the forge loop.