thoth-agents 0.2.2 → 0.2.3

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.
@@ -35,7 +35,15 @@ If any required item is missing:
35
35
  - Recommend running the `sdd-init` skill first.
36
36
  - Do NOT attempt to create the structure in that skill.
37
37
 
38
- If all required items exist, continue normally.
38
+ If the required items exist but the project is stale (`config.yaml` is missing
39
+ one or more mechanism sections / toggles, or `openspec/memory/constitution.md`
40
+ is absent):
41
+
42
+ - Recommend running the `sdd-init` skill to additively realign the project.
43
+ - Do NOT attempt to backfill the missing pieces in that skill.
44
+
45
+ If all required items exist and no mechanism pieces are missing, continue
46
+ normally.
39
47
 
40
48
  ## Directory Structure
41
49
 
@@ -49,8 +57,12 @@ openspec/
49
57
  └── {change-name}/
50
58
  ├── proposal.md
51
59
  ├── specs/
52
- │ └── {domain}/spec.md
60
+ │ └── {domain}/spec.md # clarified in place by the clarify phase
53
61
  ├── design.md
62
+ ├── research.md # optional sub-artifact (gated)
63
+ ├── data-model.md # optional sub-artifact (gated)
64
+ ├── contracts/ # optional sub-artifact subdir (gated)
65
+ ├── quickstart.md # optional sub-artifact (gated)
54
66
  ├── tasks.md
55
67
  └── verify-report.md
56
68
  ```
@@ -62,9 +74,12 @@ openspec/
62
74
  | Proposal | `openspec/changes/{change-name}/proposal.md` | Intent, scope, approach |
63
75
  | Delta specs | `openspec/changes/{change-name}/specs/{domain}/spec.md` | Use one file per domain |
64
76
  | Main specs | `openspec/specs/{domain}/spec.md` | Source of truth after archive |
65
- | Design | `openspec/changes/{change-name}/design.md` | Architecture and file plan |
77
+ | Design | `openspec/changes/{change-name}/design.md` | Architecture and file plan; always produced |
78
+ | Sub-artifacts (optional, gated) | `openspec/changes/{change-name}/{research.md,data-model.md,contracts/,quickstart.md}` | Optional design sub-artifacts; gated by `rules.design.sub_artifacts` + `complexity_threshold` |
66
79
  | Tasks | `openspec/changes/{change-name}/tasks.md` | Checkbox checklist updated by apply |
67
80
  | Verify report | `openspec/changes/{change-name}/verify-report.md` | Compliance matrix and evidence |
81
+ | Requirements checklist | `openspec/changes/{change-name}/checklists/requirements.md` | Domain-typed requirement-quality gate, consumed before tasks |
82
+ | Constitution | `openspec/memory/constitution.md` | Semver-versioned native principles + Sync-Impact Report |
68
83
 
69
84
  `apply-progress` and `archive-report` are durable SDD artifacts, but they are
70
85
  primarily persisted through thoth-mem topic keys when the mode includes
@@ -94,7 +109,13 @@ above for filesystem artifact recovery.
94
109
 
95
110
  - `proposal.md` explains why the change exists.
96
111
  - `spec.md` uses RFC 2119 keywords and Given/When/Then scenarios (full pipeline only).
112
+ - The `clarify` phase (full pipeline only) resolves residual spec ambiguity in
113
+ place between `spec` and `design`, editing the delta `spec.md` files under the
114
+ same path and re-saving the `sdd/{change-name}/spec` key; it produces no new
115
+ artifact.
97
116
  - `design.md` explains how the change will be implemented (full pipeline only).
117
+ It MAY be accompanied by optional, gated sub-artifacts (`research.md`,
118
+ `data-model.md`, `contracts/`, `quickstart.md`).
98
119
  - `tasks.md` is phase-based and uses Markdown checkboxes.
99
120
  - `verify-report.md` maps acceptance criteria to executed evidence: spec
100
121
  scenarios in full pipeline, proposal success criteria in accelerated pipeline.
@@ -105,6 +126,12 @@ persistence mode includes OpenSpec.
105
126
 
106
127
  ## `config.yaml` Shape
107
128
 
129
+ `rules:` carries one section per phase or mechanism. A section is EITHER a
130
+ bare list of guidance strings OR a mapping. When a phase needs both human
131
+ guidance and machine-relevant scalar toggles, the guidance list lives under a
132
+ `guidance:` subkey alongside the scalars (mixing bare `- item` sequence entries
133
+ with `key: value` scalars under the same key is invalid YAML).
134
+
108
135
  ```yaml
109
136
  schema: spec-driven
110
137
 
@@ -113,17 +140,30 @@ context: |
113
140
 
114
141
  rules:
115
142
  proposal:
116
- - Proposal-specific guidance
117
- specs:
118
- - Require RFC 2119 keywords
119
- - Require Given/When/Then scenarios
143
+ - Include rollback plan for risky changes
144
+ - Identify affected modules/packages
145
+ spec:
146
+ - Use RFC 2119 keywords (MUST, SHALL, SHOULD, MAY)
147
+ - Use Given/When/Then scenarios
120
148
  design:
121
- - Document architecture decisions with rationale
149
+ guidance:
150
+ - Document architecture decisions with rationale
151
+ - Require a File Changes section
152
+ sub_artifacts: false # optional design sub-artifacts (default off)
153
+ complexity_threshold: # author-evaluated eligibility triggers (OR)
154
+ affected_domains: 3
155
+ affected_files: 12
156
+ external_research: true
122
157
  tasks:
123
- - Use phased checklists with hierarchical numbering
158
+ guidance:
159
+ - Group tasks by phase with hierarchical numbering
160
+ - Require a per-task Verification block
161
+ tdd: false # TDD ordering flag (sdd-tasks-format)
162
+ traceability: true # require [USN] + Spec: tag + Independent Test per task
163
+ parallel_markers: false # [P] emission + executing-plans consumption (default off)
124
164
  apply:
125
- - Match repository conventions
126
- tdd: false
165
+ guidance:
166
+ - Follow existing code patterns and conventions
127
167
  test_command: ''
128
168
  verify:
129
169
  test_command: ''
@@ -131,6 +171,176 @@ rules:
131
171
  coverage_threshold: 0
132
172
  archive:
133
173
  - Warn before destructive merges
174
+
175
+ # --- mechanism sections (spec-kit-rigor) ---
176
+ constitution:
177
+ path: openspec/memory/constitution.md
178
+ enforce_check: true # Constitution Check gate blocks on violation
179
+ version_policy: semver # MAJOR=remove/redefine, MINOR=add, PATCH=clarify
180
+ consistency:
181
+ enforce_block: true # CRITICAL findings block plan-review
182
+ require_coverage_percentage: true
183
+ requirements_quality:
184
+ enforce_block: true # incomplete checklist blocks tasks phase
185
+ dimensions: [completeness, clarity, measurability, testability]
186
+ clarification:
187
+ max_markers_per_spec: 3 # [NEEDS CLARIFICATION] cap enforced by plan-reviewer
188
+ handoffs:
189
+ surface_hints: true # surface SddPhaseContract.handoffHints at transitions
134
190
  ```
135
191
 
136
192
  Treat `rules` entries as mandatory phase-specific constraints whenever present.
193
+ Missing `enforce_*` keys default to enforcing; a section that sets its
194
+ `enforce_*` key to `false` downgrades the corresponding block to a report.
195
+
196
+ ## Parallel Task Markers
197
+
198
+ `sdd-tasks` MAY annotate a task with an optional `[P]` marker placed AFTER the
199
+ `N.M` number (`- [ ] 2.1 [P] Title`), never before it. Placement after the
200
+ number keeps the `tasks-validator` `TASK_NUMBERING` regex green with no
201
+ validator change. `[P]` declares the task is dependency-free of the other
202
+ `[P]`-marked tasks in the SAME phase and targets the same execution agent;
203
+ `executing-plans` consumes a contiguous `[P]` run as one explicit parallel batch
204
+ (recommending worktree isolation for overlapping writers). Both emission and
205
+ consumption are gated by `rules.tasks.parallel_markers` (default off);
206
+ back-compat: an absent marker or disabled toggle executes exactly as today.
207
+
208
+ ## Constitution Governance
209
+
210
+ The project constitution lives at `openspec/memory/constitution.md` and holds
211
+ NATIVE thoth-agents principles (delegate-first coordination, read-only role
212
+ boundaries, governed persistence, multi-harness parity, evidence-led
213
+ verification). It is NOT spec-kit's articles; only the mechanics of versioned
214
+ governance are adopted.
215
+
216
+ - **Version**: a semantic version `MAJOR.MINOR.PATCH` in the header, with
217
+ `Ratified` and `Last-Amended` dates. `sdd-init` bootstraps it at `1.0.0`
218
+ when absent and preserves the existing content and version when present
219
+ (idempotent).
220
+ - **Semver bump policy** (manual, performed by the editor): MAJOR = a principle
221
+ is removed or redefined; MINOR = a principle is added or guidance materially
222
+ expanded; PATCH = clarification or wording. There is no runtime parser, so
223
+ the policy is enforced by prose, not tooling.
224
+ - **Sync-Impact Report**: an in-file `## Sync-Impact Report` section (newest
225
+ entry on top) listing version, change type, principles touched, and the
226
+ downstream gates/artifacts affected.
227
+ - **Constitution Check gate**: a procedural gate owned jointly by `sdd-design`
228
+ (self-review while authoring) and `plan-reviewer` (independent enforcement).
229
+ It reuses the existing `oracle-review` gate plumbing — no new `gate` enum
230
+ value. On a detected violation it BLOCKS advancement; the block is
231
+ overridable only through an explicit user decision delivered via the harness
232
+ blocking-input surface (AskUserQuestion-equivalent), and the override MUST be
233
+ logged with the violated principle. Gated by `rules.constitution`; when
234
+ `enforce_check: false`, the check does not block and the skip is noted.
235
+
236
+ ### Constitution Amendment
237
+
238
+ The AMENDMENT side of the lifecycle is performed by the `sdd-constitution`
239
+ skill. It executes a guided, human-confirmed semver bump (reusing the Semver
240
+ bump policy above), updates the `Last-Amended` date, and PREPENDS one
241
+ `## Sync-Impact Report` entry in the format
242
+ `- X.Y.Z | change type | principles touched | downstream gates/artifacts affected`
243
+ (newest entry on top).
244
+
245
+ - The ONLY writable target of the amendment is
246
+ `openspec/memory/constitution.md`.
247
+ - The bump is human-confirmed via the harness blocking-input surface
248
+ (AskUserQuestion-equivalent) BEFORE any version is written. There is no
249
+ runtime parser and no auto-bump; the level is never selected automatically.
250
+ - When no principle change is warranted the skill performs a reported no-op and
251
+ writes nothing.
252
+ - It preserves all existing content and ALL prior Sync-Impact Report entries;
253
+ it only prepends the new entry and updates the version/date fields.
254
+
255
+ ### Read-Only Assets and Report-Only Propagation
256
+
257
+ When the plugin is INSTALLED in a harness (OpenCode / Codex), bundled skills are
258
+ READ-ONLY assets. The `sdd-constitution` skill MUST NOT edit, create, or delete
259
+ any other `SKILL.md`, any file under `src/`, or any template — its single
260
+ writable target is the end-user `openspec/memory/constitution.md`.
261
+
262
+ Because the enforcement gates (`sdd-design`, `plan-reviewer`) read the
263
+ constitution LIVE, there are NO static principle copies to realign. Propagation
264
+ is therefore report-only: the Sync-Impact Report entry DOCUMENTS which
265
+ downstream gates consume the changed principles, and the skill FLAGS any
266
+ in-flight change `design.md` / `tasks.md` that reference now-changed principles
267
+ for HUMAN re-review instead of editing them.
268
+
269
+ ### Amendment Auto-Suggest (shared snippet)
270
+
271
+ `sdd-verify` and `sdd-archive` REFERENCE this single canonical snippet (they do
272
+ NOT inline it) to surface a report-only amendment suggestion.
273
+
274
+ > **Constitution amendment auto-suggest (report-only).** A completed change is
275
+ > "governance-touching" when ANY holds: its `proposal.md` Impact/Affected
276
+ > Areas, `design.md`, `tasks.md`, or delta `spec.md` reference
277
+ > `openspec/memory/constitution.md`, "the constitution," or a named principle;
278
+ > OR it modifies `src/skills/_shared/openspec-convention.md` (Constitution
279
+ > Governance) or `openspec/memory/constitution.md`; OR any artifact names a
280
+ > constitution principle by title. When governance-touching, surface a
281
+ > NON-BLOCKING suggestion: "This change touched governance/principles —
282
+ > consider running `sdd-constitution` to record a constitution amendment." This
283
+ > suggestion is advisory only; it MUST NOT block verification or archival.
284
+
285
+ ### config.yaml mechanism-section backfill
286
+
287
+ `sdd-init` realignment backfills the `config.yaml` mechanism sections
288
+ (`constitution`, `consistency`, `requirements_quality`, `clarification`,
289
+ `handoffs`) and the `rules.tasks.traceability` / `rules.verify` toggles
290
+ additively, mirroring the constitution idempotency above.
291
+
292
+ - It MUST detect per-section absence independently and merge ONLY the absent
293
+ sections / toggles into the existing `config.yaml`.
294
+ - It MUST NOT overwrite any value that is already present; every existing key
295
+ and value is preserved verbatim.
296
+ - It MUST report which sections / toggles were added.
297
+ - It is idempotent: re-running on a project whose `config.yaml` already carries
298
+ every mechanism section / toggle is a reported no-op.
299
+
300
+ ## Consistency Severity and Coverage Model
301
+
302
+ `plan-reviewer` performs cross-artifact consistency analysis across
303
+ proposal<->spec<->design<->tasks IN ADDITION to its executability review (it is
304
+ NOT a new phase). Each finding carries a severity of `CRITICAL`, `HIGH`,
305
+ `MEDIUM`, or `LOW`.
306
+
307
+ - **Blocking gate**: any `CRITICAL` finding BLOCKS advancement past plan
308
+ review; non-CRITICAL findings are reported but do not block. The block is
309
+ overridable only through an explicit, logged user decision via the harness
310
+ blocking-input surface. Gated by `rules.consistency.enforce_block`.
311
+ - **Requirement-coverage percentage**: `(distinct spec requirements named by
312
+ >=1 task Spec: tag) / (total ### Requirement: headings across all delta
313
+ specs)`, e.g. 8 of 10 covered -> 80%. The percentage MUST appear in the
314
+ review output (gated by `rules.consistency.require_coverage_percentage`).
315
+
316
+ ## Requirements-Quality Checklist
317
+
318
+ `sdd-spec` generates a domain-typed requirements-quality checklist at
319
+ `openspec/changes/{change-name}/checklists/requirements.md` ("unit tests for
320
+ English"). It has one `## Domain: {domain}` section per authored delta domain,
321
+ each with checkbox items across four dimensions: completeness, clarity,
322
+ measurability, testability. Items use the task checkbox states (`- [ ]` /
323
+ `- [x]` / `- [-] waived: reason`). The spec->tasks transition is GATED on every
324
+ item being `- [x]` or explicitly waived; an incomplete checklist blocks
325
+ (overridable + logged) unless `rules.requirements_quality.enforce_block: false`.
326
+
327
+ ## Clarification Discipline
328
+
329
+ Spec authoring may use `[NEEDS CLARIFICATION: <question>]` markers for genuine
330
+ unresolved decision forks, capped at `rules.clarification.max_markers_per_spec`
331
+ (default 3) per spec file. Follow an informed-guess-first policy: when an
332
+ ambiguity has a defensible default, apply it and record it in the spec's
333
+ `## Assumptions` section rather than emitting a marker; reserve markers for
334
+ forks with no defensible default. `plan-reviewer` flags any spec file exceeding
335
+ the cap.
336
+
337
+ ## Handoff Hints
338
+
339
+ `SddPhaseContract` (in `src/harness/core/sdd.ts`) carries an optional
340
+ `handoffHints?: string[]`; a phase declares what the next phase must preserve
341
+ (accepted scope, recorded assumptions, coverage/architecture decisions). The
342
+ field is OPTIONAL — phases without hints stay valid and existing consumers run
343
+ unchanged. SDD skills SURFACE the upstream phase's `handoffHints` in their prose
344
+ at the transition; when absent, no handoff text is surfaced. Gated by
345
+ `rules.handoffs.surface_hints` (when `false`, hints are not surfaced while the
346
+ contract field stays valid).
@@ -89,6 +89,17 @@ Before dispatching a task or same-agent batch:
89
89
 
90
90
  1. Select the next ready task, or the next consecutive ready tasks that target
91
91
  the same execution agent and can safely be handled in one dispatch.
92
+ - **`[P]` parallel batch (toggle-gated)**: when `rules.tasks.parallel_markers`
93
+ is enabled, consume contiguous `[P]`-marked tasks WITHIN the same phase that
94
+ target the same execution role as one explicit parallel batch (an upgrade of
95
+ the implicit same-agent grouping, not a cross-role scheduler). For
96
+ `[P]` tasks that touch overlapping files, recommend worktree isolation per
97
+ concurrent writer (or serialize them) to avoid write conflicts; a harness
98
+ without concurrent dispatch treats the `[P]` batch as an annotated
99
+ sequential batch and reports the capability gap.
100
+ - **Back-compat fallback**: when `parallel_markers` is off OR no `[P]` markers
101
+ are present, fall back to today's implicit consecutive + same-agent grouping
102
+ unchanged.
92
103
  2. Edit the canonical tasks artifact and change each selected task from
93
104
  `- [ ]` to `- [~]`.
94
105
  3. If the mode is `thoth-mem` or `hybrid`, re-persist the updated tasks
@@ -125,7 +136,25 @@ Every dispatch prompt MUST include these 6 parts:
125
136
  `BOUNDARIES` must not contradict accepted proposal or spec scope. Use it to
126
137
  limit the current assigned task, not to redefine the approved change scope.
127
138
 
128
- #### C. Receive and Verify
139
+
140
+ #### B.1 Traceability Fields (optional, back-compatible)
141
+
142
+ When a task carries the optional `sdd-tasks` traceability fields, SURFACE them
143
+ during dispatch:
144
+
145
+ - `[USN-<n>]` story id and `Priority:` (P1/P2/P3) — include in the dispatch
146
+ `CONTEXT`/`TASKS` so the executing agent knows the story grouping and priority.
147
+ - `Independent Test:` — pass into the dispatch `VERIFICATION` as the in-isolation
148
+ acceptance check for that task.
149
+ - `Spec:` trace tag — include as the requirement the task implements.
150
+
151
+ These fields are OPTIONAL. A legacy `tasks.md` whose tasks lack `[USN]`,
152
+ priority, `Independent Test`, or `Spec:` MUST still execute without error: treat
153
+ the absent fields as optional and proceed using the task title and
154
+ `Verification` block alone. Never fail or block a task solely because a
155
+ traceability field is missing.
156
+
157
+ #### C. Receive and Verify
129
158
 
130
159
  Read the sub-agent return envelope and respond by status:
131
160
 
@@ -188,7 +217,13 @@ After the task list is complete:
188
217
  smallest sufficient checks: typecheck, tests, lint, and build when
189
218
  appropriate.
190
219
  2. Report a completion summary with evidence.
191
- 3. If the work is SDD-backed, suggest `sdd-verify` as the next step.
220
+ 3. If the work is SDD-backed, hand off to the bounded verify-loop rather
221
+ than a single verify shot: dispatch `sdd-verify` as an iterative gate and
222
+ branch on its verdict — `fail` triggers a targeted fix scoped by the
223
+ report's remediation anchors and a re-verify; `pass with warnings` and a
224
+ bound-exhausting `fail` escalate to the user; a clean `pass` proceeds to
225
+ archive. The loop is capped by the 3-round bound defined in the
226
+ orchestrator SDD wording (the canonical source of the round number).
192
227
 
193
228
  ## Return Envelope Contract
194
229
 
@@ -77,7 +77,87 @@ Check only what affects executability:
77
77
  10. Task boundaries or non-goals do not contradict accepted proposal/spec
78
78
  scope.
79
79
 
80
- ## Decision Rules
80
+ ## Cross-Artifact Consistency Analysis
81
+
82
+ In addition to the executability review above, perform cross-artifact
83
+ consistency analysis across proposal <-> spec <-> design <-> tasks. This is NOT
84
+ a new pipeline phase; it rides inside this plan-review gate. All checks below
85
+ are gated by the corresponding `openspec/config.yaml rules:` sections; a section
86
+ that disables enforcement downgrades its block to a report.
87
+
88
+ ### Severity model
89
+
90
+ Every consistency finding carries one severity:
91
+
92
+ - `CRITICAL` — a spec requirement with no mapping in tasks, an orphan task with
93
+ no spec/proposal basis, scope drift contradicting the accepted proposal, or a
94
+ direct contradiction between artifacts.
95
+ - `HIGH` / `MEDIUM` / `LOW` — weaker inconsistencies, ambiguity, or
96
+ presentation issues that are worth reporting but are not on their own
97
+ blocking.
98
+
99
+ Detect and report at least: requirements present in the spec but absent from
100
+ design or tasks; tasks with no spec basis; scope drift from the proposal; and
101
+ contradictory statements between artifacts.
102
+
103
+ ### Requirement-coverage percentage
104
+
105
+ Compute and REPORT a requirement-coverage percentage in the review output
106
+ (gated by `rules.consistency.require_coverage_percentage`):
107
+
108
+ ```
109
+ coverage % = (distinct spec requirements named by >=1 task `Spec:` tag)
110
+ / (total `### Requirement:` headings across all delta specs)
111
+ ```
112
+
113
+ Parse `Spec:` trace tags from `tasks.md` and `### Requirement:` headings from
114
+ `openspec/changes/{change}/specs/*/spec.md`. Example: 8 of 10 requirements
115
+ covered -> report `80%`. When no `Spec:` tags are present (legacy tasks), report
116
+ coverage against what is present rather than failing.
117
+
118
+ ### [NEEDS CLARIFICATION] cap enforcement
119
+
120
+ Flag any spec file containing more than `rules.clarification.max_markers_per_spec`
121
+ (default 3) `[NEEDS CLARIFICATION: ...]` markers. Exactly 3 is within the cap
122
+ and is NOT flagged; 4 or more is flagged as carrying too much unresolved
123
+ ambiguity to proceed cleanly.
124
+
125
+ ### Constitution Check
126
+
127
+ Evaluate the design and plan against EACH principle in
128
+ `openspec/memory/constitution.md` (delegate-first coordination, read-only role
129
+ boundaries, governed persistence, multi-harness parity, evidence-led
130
+ verification). Report the specific violated principle(s). Gated by
131
+ `rules.constitution.enforce_check`; when disabled, note the skip in the output
132
+ and do not block.
133
+
134
+ ### TDD ordering check
135
+
136
+ When `rules.tasks.tdd` is enabled, verify that within each phase every
137
+ implementation task that has a corresponding test task is PRECEDED by that test
138
+ task. Report a TDD-ordering finding for any implementation task that precedes
139
+ its test task. When `tasks.tdd` is disabled, impose no ordering constraint.
140
+
141
+ ## Blocking Consistency and Constitution Gate
142
+
143
+ - Any `CRITICAL` consistency finding OR any Constitution violation BLOCKS
144
+ advancement past plan review (gated by `rules.consistency.enforce_block` and
145
+ `rules.constitution.enforce_check` respectively).
146
+ - Non-CRITICAL findings are reported but do not block on their own.
147
+ - The block is overridable ONLY through an explicit user decision delivered via
148
+ the harness blocking-input surface (the AskUserQuestion-equivalent primitive).
149
+ The override MUST be logged with the finding identity / violated principle and
150
+ the user's choice before advancement proceeds. If the harness lacks a
151
+ blocking-input primitive, report an unsupported-capability limitation rather
152
+ than silently downgrading the block.
153
+ - Express a blocking outcome through the existing `[REJECT]` token (or a listed
154
+ CRITICAL finding); a clean analysis adds no friction and proceeds via `[OKAY]`.
155
+
156
+ See `_shared/openspec-convention.md` (Consistency Severity and Coverage Model,
157
+ Constitution Governance, Clarification Discipline) for the canonical, harness-
158
+ agnostic definitions these checks implement.
159
+
160
+ ## Decision Rules
81
161
 
82
162
  - Default to `[OKAY]`.
83
163
  - Use `[REJECT]` only for true blockers.
@@ -84,6 +84,11 @@ scaffolding as user prompts.
84
84
  context already answer.
85
85
  11. Enforce scope faithfulness: scope calibration must not silently shrink the
86
86
  user's stated intent.
87
+ 12. Alignment note: a genuine decision fork left unresolved at interview is not
88
+ settled here — downstream it becomes either a `[NEEDS CLARIFICATION]`
89
+ marker or a recorded entry in the spec's `## Assumptions` section
90
+ (informed-guess-first). This note is alignment only; the interview does not
91
+ own the clarification cap or the Assumptions gate.
87
92
 
88
93
  ### Phase 3: Complexity Assessment
89
94
 
@@ -142,7 +147,7 @@ user to confirm it:
142
147
  - 1 dimension is High in logic depth, context span, or discovery need
143
148
  - But contract sensitivity and failure cost are not High
144
149
 
145
- **Full SDD** (`sdd-explore -> propose -> spec -> design -> tasks`) — when any of:
150
+ **Full SDD** (`sdd-explore -> propose -> spec -> clarify -> design -> tasks`) — when any of:
146
151
  - Contract sensitivity is High
147
152
  - Failure cost is High
148
153
  - 2 or more dimensions are High
@@ -180,8 +185,10 @@ Collect this choice with the active blocking user input surface rather than
180
185
  plain prose.
181
186
 
182
187
  When the user selects a mode that includes OpenSpec (`openspec` or `hybrid`),
183
- verify that `openspec/` is initialized. If it is not, recommend running the
184
- `sdd-init` skill before proceeding.
188
+ verify that `openspec/` is initialized AND not stale. If it is not initialized,
189
+ or it exists but is stale (`config.yaml` missing one or more mechanism sections
190
+ / toggles, or `openspec/memory/constitution.md` absent), recommend running the
191
+ `sdd-init` skill before proceeding so it can additively realign the project.
185
192
 
186
193
  Once route, persistence mode, and initialization are confirmed, hand off to the
187
194
  corresponding SDD pipeline phase. The handoff MUST include:
@@ -57,9 +57,13 @@ The orchestrator passes the artifact store mode (`thoth-mem`, `openspec`, or
57
57
  to `openspec/changes/archive/YYYY-MM-DD-{change-name}/`.
58
58
  6. Create an audit trail report summarizing merged domains, archive location,
59
59
  verification lineage, and any mode-based skips.
60
- 7. In `thoth-mem` mode, do not create or move `openspec/` artifacts; record the
60
+ 7. Apply the governance-touched heuristic from
61
+ `_shared/openspec-convention.md` > Constitution Governance > Amendment
62
+ Auto-Suggest. When it matches, surface the shared report-only
63
+ `sdd-constitution` suggestion. This is advisory and MUST NOT block archival.
64
+ 8. In `thoth-mem` mode, do not create or move `openspec/` artifacts; record the
61
65
  archive result only in the audit trail.
62
- 8. If the selected mode includes thoth-mem, persist the audit trail with:
66
+ 9. If the selected mode includes thoth-mem, persist the audit trail with:
63
67
 
64
68
  Use the memory tool binding for `mem_save` with the canonical SDD topic key
65
69
  and required metadata fields: `title`, `topic_key`, `type`, `project`,
@@ -74,6 +78,7 @@ Return:
74
78
  - `Topic Key`: `sdd/{change-name}/archive-report`
75
79
  - `Merged Specs`: list of domains updated in `openspec/specs/`
76
80
  - `Audit Summary`: concise bullets
81
+ - `Constitution Suggestion`: surfaced or none
77
82
  - `Status`: archived or blocked
78
83
 
79
84
  ## Rules
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: sdd-clarify
3
+ description: Resolve residual spec ambiguity in place before design, with a bounded taxonomy-driven clarification pass.
4
+ ---
5
+
6
+ # SDD Clarify Skill
7
+
8
+ Resolve residual ambiguity that survives `sdd-spec` by writing clarified
9
+ resolutions back into the authoritative delta spec, before `sdd-design`
10
+ consumes it.
11
+
12
+ ## Shared Conventions
13
+
14
+ - [../_shared/openspec-convention.md](../_shared/openspec-convention.md)
15
+ - [../_shared/persistence-contract.md](../_shared/persistence-contract.md)
16
+ - [../_shared/thoth-mem-convention.md](../_shared/thoth-mem-convention.md)
17
+
18
+ ## Persistence Mode
19
+
20
+ The orchestrator passes the artifact store mode (`thoth-mem`, `openspec`, or
21
+ `hybrid`). Follow the persistence contract for read/write rules per mode.
22
+
23
+ - `thoth-mem`: persist to thoth-mem only — do NOT create or modify
24
+ `openspec/` files.
25
+ - `openspec`: write files only — do NOT call thoth-mem save tools.
26
+ - `hybrid`: persist to both (default).
27
+
28
+ ## When to Use
29
+
30
+ - The delta specs are authored and residual ambiguity (unresolved
31
+ `[NEEDS CLARIFICATION]` markers or taxonomy-classified gaps) must be resolved
32
+ before design.
33
+ - A `full` SDD pipeline run reaches the `clarify` phase between `spec` and
34
+ `design`. The phase is full-pipeline only; accelerated and direct pipelines
35
+ skip it.
36
+
37
+ ## Prerequisites
38
+
39
+ - `change-name`
40
+ - The spec artifact must exist (recoverable under `sdd/{change-name}/spec`).
41
+ - `openspec/changes/{change-name}/checklists/requirements.md` must exist.
42
+
43
+ ## Workflow
44
+
45
+ 1. Read the shared conventions.
46
+ 2. Recover `sdd/{change-name}/spec` using the recall funnel in the persistence
47
+ contract (`mem_recall(mode="compact")` -> `mem_recall(mode="context")` ->
48
+ `mem_get(...)`), and read the delta spec file(s) under
49
+ `openspec/changes/{change-name}/specs/{domain}/spec.md`.
50
+ 3. **Taxonomy scan** — scan the recovered spec against the ambiguity taxonomy to
51
+ produce resolution candidates:
52
+ - ambiguous quantifiers (e.g. "fast", "several", "most")
53
+ - undefined terms (domain nouns with no pinned meaning)
54
+ - missing error/edge behavior (no failure/edge path specified)
55
+ - unresolved decision forks (competing options with no default)
56
+ - underspecified data shapes (fields, types, or cardinality not pinned)
57
+ - unstated non-functional bounds (latency, size, concurrency, limits)
58
+ - plus every unresolved `[NEEDS CLARIFICATION]` marker already in the spec.
59
+ 4. **Bounded Q&A** — resolve candidates capped at
60
+ `rules.clarification.max_markers_per_spec` (default 3) per spec file. With
61
+ more than the cap, resolve at most the cap's worth, prioritizing the
62
+ highest-impact ambiguities; leave the rest as explicit markers for a later
63
+ pass. Prefer an informed-guess default recorded in `## Assumptions` over a
64
+ blocking question when a defensible default exists.
65
+ 5. **Write-back in place** — replace each resolved `[NEEDS CLARIFICATION]`
66
+ marker / ambiguous statement with its resolved decision directly in the same
67
+ delta spec file(s) (inline, or folded into the spec's `## Assumptions`
68
+ section when the resolution is a recorded default). Do NOT create a new
69
+ artifact (`clarifications.md`, `spec-clarified.md`, etc.). In
70
+ `hybrid`/`thoth-mem` mode, re-save the edited spec under the SAME canonical
71
+ key `sdd/{change-name}/spec` (upsert) — no `spec-clarified` key.
72
+ 6. **Re-validate** `openspec/changes/{change-name}/checklists/requirements.md`
73
+ against the clarified spec: flip items that were waived or open due to a
74
+ now-resolved ambiguity, and declare `handoffHints` for design (the resolved
75
+ decisions and the re-validated checklist state design must preserve). Do not
76
+ advance past design with an unresolved checklist.
77
+
78
+ ## Boundary
79
+
80
+ `sdd-clarify` targets only **post-spec residual** ambiguity. It MUST NOT
81
+ re-run or duplicate the upfront `requirements-interview`, and MUST NOT re-ask
82
+ questions already resolved during requirements discovery. It edits only the
83
+ spec and its requirements checklist; it produces no new permanent artifact.
84
+
85
+ ## Output Format
86
+
87
+ Return:
88
+
89
+ - `Change`
90
+ - `Artifact`: clarified delta spec path(s) (edited in place)
91
+ - `Topic Key`: `sdd/{change-name}/spec`
92
+ - `Resolved`: list of ambiguities resolved (marker/taxonomy class -> resolution)
93
+ - `Next Step`: `sdd-design`
94
+
95
+ ## Rules
96
+
97
+ - Write resolutions back into the authoritative spec in place; never leave a
98
+ resolved ambiguity standing as unresolved.
99
+ - Reuse the canonical `sdd/{change-name}/spec` topic key (upsert); introduce no
100
+ new artifact or key.
101
+ - Cap resolutions at `rules.clarification.max_markers_per_spec` per spec file.
102
+ - Re-validate `checklists/requirements.md` before handing off to design.
103
+ - Do not duplicate `requirements-interview`; resolve only residual post-spec
104
+ ambiguity.
105
+ - Use the recall funnel from the persistence contract for every SDD dependency.