thoth-agents 0.4.2 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/LICENSE +30 -0
  2. package/README.md +86 -58
  3. package/dist/agents/prompt-sections.d.ts +5 -3
  4. package/dist/agents/prompt-utils.d.ts +1 -1
  5. package/dist/agents/worker.d.ts +2 -0
  6. package/dist/{chunk-STCURXAQ.js → chunk-MRFCA3U2.js} +33 -67
  7. package/dist/{chunk-EFGSGPYM.js → chunk-OW6I7ZUU.js} +391 -416
  8. package/dist/chunk-V7HSGRMB.js +1016 -0
  9. package/dist/{chunk-WCLUZZHI.js → chunk-VUNYH263.js} +1580 -351
  10. package/dist/cli/claude-code-paths.d.ts +2 -2
  11. package/dist/cli/codex-install.d.ts +5 -2
  12. package/dist/cli/codex-paths.d.ts +2 -2
  13. package/dist/cli/index.js +47 -11
  14. package/dist/cli/operations/pi.d.ts +1 -0
  15. package/dist/cli/pi-effort.d.ts +1 -1
  16. package/dist/cli/pi-external-package.d.ts +24 -0
  17. package/dist/cli/pi-git-source.d.ts +1 -0
  18. package/dist/cli/pi-install.d.ts +92 -15
  19. package/dist/cli/pi-managed-write.d.ts +3 -0
  20. package/dist/cli/pi-model-config.d.ts +17 -0
  21. package/dist/cli/pi-native-probe.d.ts +2 -0
  22. package/dist/cli/pi-paths.d.ts +2 -0
  23. package/dist/cli/pi-resources.d.ts +3 -1
  24. package/dist/cli/pi-tool-config.d.ts +32 -0
  25. package/dist/cli/tui/index.js +3 -3
  26. package/dist/cli/types.d.ts +2 -0
  27. package/dist/config/constants.d.ts +4 -8
  28. package/dist/config/schema.d.ts +7 -36
  29. package/dist/harness/adapters/claude-code.d.ts +2 -4
  30. package/dist/harness/core/agent-pack.d.ts +52 -42
  31. package/dist/harness/core/memory-governance.d.ts +2 -2
  32. package/dist/harness/core/sdd.d.ts +159 -319
  33. package/dist/harness/writers/pi-agent.d.ts +3 -1
  34. package/dist/index.js +12 -6
  35. package/dist/pi/tools-panel.d.ts +51 -0
  36. package/dist/pi.d.ts +44 -2
  37. package/dist/pi.js +471 -9
  38. package/dist/utils/subprocess.d.ts +1 -0
  39. package/package.json +23 -6
  40. package/pi/.thoth-agents-assets.json +5 -6
  41. package/pi/agents/thoth-designer.md +23 -8
  42. package/pi/agents/thoth-explorer.md +29 -9
  43. package/pi/agents/thoth-librarian.md +30 -8
  44. package/pi/agents/thoth-oracle.md +18 -10
  45. package/pi/agents/thoth-worker.md +96 -0
  46. package/plugin/.claude-plugin/.thoth-agents-plugin-assets.json +7 -12
  47. package/plugin/.claude-plugin/plugin.json +2 -2
  48. package/plugin/.codex-plugin/plugin.json +2 -2
  49. package/plugin/agents/designer.md +13 -5
  50. package/plugin/agents/explorer.md +16 -5
  51. package/plugin/agents/librarian.md +15 -4
  52. package/plugin/agents/oracle.md +13 -7
  53. package/plugin/agents/orchestrator.md +82 -91
  54. package/plugin/agents/worker.md +76 -0
  55. package/plugin/skills/plan-reviewer/SKILL.md +39 -141
  56. package/plugin/skills/thoth-archive/SKILL.md +50 -47
  57. package/plugin/skills/thoth-archive/scripts/archive.mjs +287 -654
  58. package/plugin/skills/thoth-constitution/SKILL.md +23 -42
  59. package/plugin/skills/thoth-constitution/templates/constitution.md +54 -44
  60. package/plugin/skills/thoth-init/SKILL.md +19 -29
  61. package/plugin/skills/thoth-init/scripts/init.mjs +73 -66
  62. package/plugin/skills/thoth-sdd/SKILL.md +164 -117
  63. package/plugin/skills/thoth-sdd/references/phases/checklist.md +2 -22
  64. package/plugin/skills/thoth-sdd/references/phases/clarify.md +14 -12
  65. package/plugin/skills/thoth-sdd/references/phases/converge.md +2 -13
  66. package/plugin/skills/thoth-sdd/references/phases/explore.md +3 -8
  67. package/plugin/skills/thoth-sdd/references/phases/implement.md +58 -57
  68. package/plugin/skills/thoth-sdd/references/phases/plan.md +2 -18
  69. package/plugin/skills/thoth-sdd/references/phases/specify.md +2 -33
  70. package/plugin/skills/thoth-sdd/references/phases/tasks.md +4 -45
  71. package/plugin/skills/thoth-sdd/references/phases/verify.md +4 -22
  72. package/plugin/skills/thoth-sdd/scripts/validate.mjs +610 -1232
  73. package/plugin/skills/thoth-sdd/templates/change.md +94 -0
  74. package/skills/README.md +11 -13
  75. package/skills/plan-reviewer/SKILL.md +39 -141
  76. package/skills/thoth-archive/SKILL.md +50 -47
  77. package/skills/thoth-archive/scripts/archive.mjs +287 -654
  78. package/skills/thoth-constitution/SKILL.md +23 -42
  79. package/skills/thoth-constitution/templates/constitution.md +54 -44
  80. package/skills/thoth-init/SKILL.md +19 -29
  81. package/skills/thoth-init/scripts/init.mjs +73 -66
  82. package/skills/thoth-sdd/SKILL.md +164 -117
  83. package/skills/thoth-sdd/references/phases/checklist.md +2 -22
  84. package/skills/thoth-sdd/references/phases/clarify.md +14 -12
  85. package/skills/thoth-sdd/references/phases/converge.md +2 -13
  86. package/skills/thoth-sdd/references/phases/explore.md +3 -8
  87. package/skills/thoth-sdd/references/phases/implement.md +58 -57
  88. package/skills/thoth-sdd/references/phases/plan.md +2 -18
  89. package/skills/thoth-sdd/references/phases/specify.md +2 -33
  90. package/skills/thoth-sdd/references/phases/tasks.md +4 -45
  91. package/skills/thoth-sdd/references/phases/verify.md +4 -22
  92. package/skills/thoth-sdd/scripts/validate.mjs +610 -1232
  93. package/skills/thoth-sdd/templates/change.md +94 -0
  94. package/thoth-agents.schema.json +9 -77
  95. package/dist/agents/deep.d.ts +0 -2
  96. package/dist/agents/quick.d.ts +0 -2
  97. package/dist/chunk-2U5MBLLV.js +0 -312
  98. package/pi/agents/thoth-deep.md +0 -81
  99. package/pi/agents/thoth-quick.md +0 -81
  100. package/plugin/agents/deep.md +0 -68
  101. package/plugin/agents/quick.md +0 -68
  102. package/plugin/skills/plan-reviewer/templates/plan-review.md +0 -65
  103. package/plugin/skills/thoth-sdd/templates/archive-report.md +0 -25
  104. package/plugin/skills/thoth-sdd/templates/checklist.md +0 -27
  105. package/plugin/skills/thoth-sdd/templates/plan.md +0 -46
  106. package/plugin/skills/thoth-sdd/templates/spec.md +0 -62
  107. package/plugin/skills/thoth-sdd/templates/tasks.md +0 -58
  108. package/plugin/skills/thoth-sdd/templates/verify-report.md +0 -28
  109. package/skills/plan-reviewer/templates/plan-review.md +0 -65
  110. package/skills/thoth-sdd/templates/archive-report.md +0 -25
  111. package/skills/thoth-sdd/templates/checklist.md +0 -27
  112. package/skills/thoth-sdd/templates/plan.md +0 -46
  113. package/skills/thoth-sdd/templates/spec.md +0 -62
  114. package/skills/thoth-sdd/templates/tasks.md +0 -58
  115. package/skills/thoth-sdd/templates/verify-report.md +0 -28
@@ -1,48 +1,48 @@
1
- import type { AgentRoleName } from './agent-pack';
2
- import type { MemoryDispatchContract } from './memory-governance';
3
- export type SddRoute = 'direct' | 'accelerated' | 'full';
1
+ export type SddUnderstandingPhaseId = 'explore' | 'specify' | 'clarify';
2
+ export type SddClassification = 'small' | 'substantial';
4
3
  export type SddIntent = 'documentation' | 'mechanical' | 'behavior' | 'architecture';
5
- export type SddScope = 'local' | 'multi-file' | 'cross-cutting';
6
- export type SddClarity = 'clear' | 'partial' | 'uncertain';
4
+ export type SddScope = 'local' | 'coordinated' | 'cross-cutting';
5
+ export type SddUncertainty = 'low' | 'medium' | 'high';
7
6
  export type SddRisk = 'low' | 'medium' | 'high';
8
- export type SddFinalVerificationRisk = 'trivial-deterministic' | 'architecture' | 'security' | 'cross-cutting-regression' | 'persistent-diagnosis' | 'contradictory-evidence' | 'high-failure-cost' | 'material-uncertainty';
9
- export type SddFinalVerificationOwner = 'orchestrator' | 'oracle';
10
- export interface SddFinalVerificationDecision {
11
- verificationRequired: true;
12
- owner: SddFinalVerificationOwner;
13
- oracleRequired: boolean;
14
- freshOracleRequired: boolean;
7
+ export type SddClarificationOutcome = 'not-needed' | 'resolved' | 'unresolved';
8
+ export type SddPhaseId = SddUnderstandingPhaseId | 'plan' | 'checklist' | 'tasks' | 'plan-review' | 'implement' | 'verify' | 'converge' | 'archive';
9
+ export type SddPhaseActivation = 'required' | 'conditional';
10
+ export type SddVerificationOwner = 'orchestrator' | 'oracle';
11
+ export interface SddUnderstandingPhaseContract {
12
+ id: SddUnderstandingPhaseId;
13
+ order: number;
14
+ requiredForClassification: true;
15
+ artifactRequired: false;
16
+ agentRequired: false;
17
+ interviewRequired: false;
18
+ objective: string;
19
+ }
20
+ export interface SddUnderstandingEvidence {
21
+ completed: readonly SddUnderstandingPhaseId[];
22
+ clarification: SddClarificationOutcome;
15
23
  }
16
- export type SddPlanningMode = 'none' | 'fast-forward' | 'gated';
17
- export type SddValidationGate = 'specify' | 'plan' | 'tasks' | 'checklist' | 'ready' | 'closeout';
18
- export type SddArtifactRevisionPolicy = 'none' | 'revalidate-affected-downstream';
19
- export interface SddRoutingInput {
20
- intent: SddIntent;
24
+ export interface SddChangeClassificationInput {
21
25
  scope: SddScope;
22
- clarity: SddClarity;
23
- contractRisk: SddRisk;
24
- failureCost: SddRisk;
25
- requestedRoute?: SddRoute;
26
- sddRequested?: boolean;
26
+ uncertainty: SddUncertainty;
27
+ risk: SddRisk;
28
+ understanding: SddUnderstandingEvidence;
27
29
  }
28
- export interface SddRoutingDecision {
29
- route: SddRoute;
30
- requiresUserInput: boolean;
30
+ export interface SddClassificationDecision {
31
+ classification: SddClassification;
32
+ scope: SddScope;
33
+ uncertainty: SddUncertainty;
34
+ risk: SddRisk;
35
+ planningRequired: boolean;
36
+ recordRequired: boolean;
37
+ independentVerificationRequired: boolean;
31
38
  reasons: string[];
32
39
  }
33
- export type SddPhaseId = 'explore' | 'specify' | 'clarify' | 'plan' | 'checklist' | 'tasks' | 'plan-review' | 'implement' | 'verify' | 'converge' | 'archive';
34
- export type SddPhaseActivation = 'required' | 'conditional';
35
- export type SddPhaseOwner = AgentRoleName | 'adaptive-implementation' | 'adaptive-verification';
36
40
  export interface SddPhaseContract {
37
41
  id: SddPhaseId;
38
42
  order: number;
39
- availableFor: SddRoute[];
40
- requiredFor: SddRoute[];
41
43
  activation: SddPhaseActivation;
42
44
  prerequisites: SddPhaseId[];
43
45
  producesArtifact: boolean;
44
- defaultAgentRole: SddPhaseOwner;
45
- eligibleAgentRoles: AgentRoleName[];
46
46
  reason: string;
47
47
  condition?: string;
48
48
  }
@@ -51,390 +51,230 @@ export interface SddPhaseProtocol {
51
51
  objective: string;
52
52
  requiredInputs: string[];
53
53
  instructions: string[];
54
- allowedWrites: string[];
55
54
  outputSchema: string[];
56
55
  doneWhen: string[];
57
56
  blockingConditions: string[];
58
- handoff: string[];
59
- }
60
- export interface SddPhaseDispatchInput {
61
- phase: SddPhaseId;
62
- route: SddRoute;
63
- changeName: string;
64
- inputArtifacts?: string[];
65
- requirements?: string[];
66
- boundaries?: string[];
67
- verification?: string[];
68
- memory: MemoryDispatchContract;
69
57
  }
70
- export type SddArtifactId = 'spec' | 'plan' | 'tasks' | 'requirements-checklist' | 'research' | 'data-model' | 'contracts' | 'quickstart' | 'plan-review' | 'verify-report' | 'archive-report';
71
- export interface SddArtifactContract {
72
- id: SddArtifactId;
73
- path: string;
74
- producedBy: SddPhaseId;
75
- consumes: SddArtifactId[];
76
- requiredFor: SddRoute[];
58
+ export interface SddFinalVerificationDecision {
59
+ verificationRequired: true;
60
+ independent: boolean;
61
+ owner: SddVerificationOwner;
77
62
  }
78
63
  export interface SddWorkflowContract {
79
- artifactRoot: string;
64
+ recordRoot: string;
65
+ recordPath: string;
66
+ understandingPhases: SddUnderstandingPhaseContract[];
80
67
  phases: SddPhaseContract[];
81
- routePolicies: SddRouteExecutionPolicy[];
82
- routingRules: string[];
68
+ classificationRules: string[];
83
69
  artifactRules: string[];
84
70
  verificationRules: string[];
85
71
  }
86
- export interface SddRouteExecutionPolicy {
87
- route: SddRoute;
88
- planningMode: SddPlanningMode;
89
- validationGates: SddValidationGate[];
90
- optionalArtifactsByDefault: boolean;
91
- routineUserPauses: boolean;
92
- artifactRevisionPolicy: SddArtifactRevisionPolicy;
93
- }
72
+ export declare const SDD_UNDERSTANDING_PHASES: readonly [{
73
+ readonly id: "explore";
74
+ readonly order: 0;
75
+ readonly requiredForClassification: true;
76
+ readonly artifactRequired: false;
77
+ readonly agentRequired: false;
78
+ readonly interviewRequired: false;
79
+ readonly objective: "Inspect proportionally to understand current behavior, constraints, and uncertainty.";
80
+ }, {
81
+ readonly id: "specify";
82
+ readonly order: 1;
83
+ readonly requiredForClassification: true;
84
+ readonly artifactRequired: false;
85
+ readonly agentRequired: false;
86
+ readonly interviewRequired: false;
87
+ readonly objective: "State the intended outcome, non-goals, and observable acceptance proportionally.";
88
+ }, {
89
+ readonly id: "clarify";
90
+ readonly order: 2;
91
+ readonly requiredForClassification: true;
92
+ readonly artifactRequired: false;
93
+ readonly agentRequired: false;
94
+ readonly interviewRequired: false;
95
+ readonly objective: "Resolve material uncertainty with evidence or a safe assumption; ask only when needed.";
96
+ }];
94
97
  export declare const SDD_PHASES: readonly [{
95
98
  readonly id: "explore";
96
99
  readonly order: 0;
97
- readonly availableFor: ["full"];
98
- readonly requiredFor: ["full"];
99
100
  readonly activation: "required";
100
101
  readonly prerequisites: [];
101
102
  readonly producesArtifact: false;
102
- readonly defaultAgentRole: "explorer";
103
- readonly eligibleAgentRoles: ["explorer"];
104
- readonly reason: "Resolve broad repository uncertainty before requirements are fixed.";
103
+ readonly reason: "Every change begins with proportionate repository and intent discovery.";
105
104
  }, {
106
105
  readonly id: "specify";
107
106
  readonly order: 1;
108
- readonly availableFor: ["accelerated", "full"];
109
- readonly requiredFor: ["accelerated", "full"];
110
107
  readonly activation: "required";
111
108
  readonly prerequisites: ["explore"];
112
- readonly producesArtifact: true;
113
- readonly defaultAgentRole: "orchestrator";
114
- readonly eligibleAgentRoles: ["orchestrator"];
115
- readonly reason: "Define the user-visible requirements and acceptance contract.";
109
+ readonly producesArtifact: false;
110
+ readonly reason: "Settle outcome and acceptance before risk-aware classification.";
116
111
  }, {
117
112
  readonly id: "clarify";
118
113
  readonly order: 2;
119
- readonly availableFor: ["accelerated", "full"];
120
- readonly requiredFor: [];
121
- readonly activation: "conditional";
114
+ readonly activation: "required";
122
115
  readonly prerequisites: ["specify"];
123
116
  readonly producesArtifact: false;
124
- readonly defaultAgentRole: "orchestrator";
125
- readonly eligibleAgentRoles: ["orchestrator"];
126
- readonly reason: "Resolve only material ambiguity that would change the solution.";
127
- readonly condition: "Activate when unresolved decisions cannot be handled by a safe local assumption.";
117
+ readonly reason: "Material uncertainty must be resolved or explicitly block classification.";
128
118
  }, {
129
119
  readonly id: "plan";
130
120
  readonly order: 3;
131
- readonly availableFor: ["accelerated", "full"];
132
- readonly requiredFor: ["accelerated", "full"];
133
121
  readonly activation: "required";
134
- readonly prerequisites: ["specify"];
122
+ readonly prerequisites: ["explore", "specify", "clarify"];
135
123
  readonly producesArtifact: true;
136
- readonly defaultAgentRole: "orchestrator";
137
- readonly eligibleAgentRoles: ["orchestrator"];
138
- readonly reason: "Translate requirements into an executable technical approach.";
124
+ readonly reason: "Substantial changes need a decision-ready technical approach in the sole record.";
139
125
  }, {
140
126
  readonly id: "checklist";
141
127
  readonly order: 4;
142
- readonly availableFor: ["accelerated", "full"];
143
- readonly requiredFor: [];
144
128
  readonly activation: "conditional";
145
- readonly prerequisites: ["specify", "plan"];
129
+ readonly prerequisites: ["plan"];
146
130
  readonly producesArtifact: true;
147
- readonly defaultAgentRole: "orchestrator";
148
- readonly eligibleAgentRoles: ["orchestrator"];
149
- readonly reason: "Audit requirement quality when risk justifies an explicit checklist.";
150
- readonly condition: "Activate for high-risk, compliance-sensitive, or ambiguity-prone requirements.";
131
+ readonly reason: "Audit acceptance only when risk or ambiguity justifies it.";
132
+ readonly condition: "Use for elevated risk, compliance, or acceptance ambiguity.";
151
133
  }, {
152
134
  readonly id: "tasks";
153
135
  readonly order: 5;
154
- readonly availableFor: ["accelerated", "full"];
155
- readonly requiredFor: ["accelerated", "full"];
156
136
  readonly activation: "required";
157
- readonly prerequisites: ["specify", "plan"];
137
+ readonly prerequisites: ["plan"];
158
138
  readonly producesArtifact: true;
159
- readonly defaultAgentRole: "orchestrator";
160
- readonly eligibleAgentRoles: ["orchestrator"];
161
- readonly reason: "Produce dependency-ordered implementation slices with verification.";
139
+ readonly reason: "Shape useful implementation slices and acceptance coverage.";
162
140
  }, {
163
141
  readonly id: "plan-review";
164
142
  readonly order: 6;
165
- readonly availableFor: ["accelerated", "full"];
166
- readonly requiredFor: [];
167
143
  readonly activation: "conditional";
168
144
  readonly prerequisites: ["tasks"];
169
145
  readonly producesArtifact: true;
170
- readonly defaultAgentRole: "oracle";
171
- readonly eligibleAgentRoles: ["oracle"];
172
- readonly reason: "Offer independent blocker-only plan review after explicit or bounded recommended-default selection once planning passes ready.";
173
- readonly condition: "Activate after ready when review is selected explicitly or by the bounded recommended default after three answerless attempts.";
146
+ readonly reason: "Offer optional independent plan review after readiness.";
147
+ readonly condition: "Run only when selected; it never authorizes implementation.";
174
148
  }, {
175
149
  readonly id: "implement";
176
150
  readonly order: 7;
177
- readonly availableFor: ["direct", "accelerated", "full"];
178
- readonly requiredFor: ["direct", "accelerated", "full"];
179
151
  readonly activation: "required";
180
- readonly prerequisites: ["tasks"];
152
+ readonly prerequisites: ["clarify"];
181
153
  readonly producesArtifact: false;
182
- readonly defaultAgentRole: "adaptive-implementation";
183
- readonly eligibleAgentRoles: ["orchestrator", "designer", "quick", "deep"];
184
- readonly reason: "Choose root, designer, quick, or deep from task-shaped net gain independently from the SDD route.";
154
+ readonly reason: "Implement within accepted intent using one writer and focused checks.";
185
155
  }, {
186
156
  readonly id: "verify";
187
157
  readonly order: 8;
188
- readonly availableFor: ["direct", "accelerated", "full"];
189
- readonly requiredFor: ["direct", "accelerated", "full"];
190
158
  readonly activation: "required";
191
159
  readonly prerequisites: ["implement"];
192
160
  readonly producesArtifact: true;
193
- readonly defaultAgentRole: "adaptive-verification";
194
- readonly eligibleAgentRoles: ["orchestrator", "oracle"];
195
- readonly reason: "Keep verification mandatory while selecting root for trivial deterministic Direct checks and a fresh Oracle for material-risk Direct or artifact-backed judgment.";
161
+ readonly reason: "Verify actual outcomes and residual risk independently when required.";
196
162
  }, {
197
163
  readonly id: "converge";
198
164
  readonly order: 9;
199
- readonly availableFor: ["accelerated", "full"];
200
- readonly requiredFor: [];
201
165
  readonly activation: "conditional";
202
166
  readonly prerequisites: ["verify"];
203
167
  readonly producesArtifact: true;
204
- readonly defaultAgentRole: "orchestrator";
205
- readonly eligibleAgentRoles: ["orchestrator"];
206
- readonly reason: "Append traceable remaining work to tasks.md before another implementation loop.";
207
- readonly condition: "Activate only when verification finds actionable defects.";
168
+ readonly reason: "Record bounded corrective work only when verification finds actionable gaps.";
169
+ readonly condition: "Use only for actionable defects within settled intent.";
208
170
  }, {
209
171
  readonly id: "archive";
210
172
  readonly order: 10;
211
- readonly availableFor: ["accelerated", "full"];
212
- readonly requiredFor: ["accelerated", "full"];
213
173
  readonly activation: "required";
214
174
  readonly prerequisites: ["verify"];
215
175
  readonly producesArtifact: true;
216
- readonly defaultAgentRole: "orchestrator";
217
- readonly eligibleAgentRoles: ["orchestrator"];
218
- readonly reason: "Transactionally sync declared durable deltas and close verified work with a dated audit trail.";
219
- }];
220
- export declare const SDD_ARTIFACT_GRAPH: readonly [{
221
- readonly id: "spec";
222
- readonly path: "spec.md";
223
- readonly producedBy: "specify";
224
- readonly consumes: [];
225
- readonly requiredFor: ["accelerated", "full"];
226
- }, {
227
- readonly id: "plan";
228
- readonly path: "plan.md";
229
- readonly producedBy: "plan";
230
- readonly consumes: ["spec"];
231
- readonly requiredFor: ["accelerated", "full"];
232
- }, {
233
- readonly id: "tasks";
234
- readonly path: "tasks.md";
235
- readonly producedBy: "tasks";
236
- readonly consumes: ["spec", "plan"];
237
- readonly requiredFor: ["accelerated", "full"];
238
- }, {
239
- readonly id: "requirements-checklist";
240
- readonly path: "checklists/requirements.md";
241
- readonly producedBy: "checklist";
242
- readonly consumes: ["spec"];
243
- readonly requiredFor: [];
244
- }, {
245
- readonly id: "research";
246
- readonly path: "research.md";
247
- readonly producedBy: "plan";
248
- readonly consumes: ["spec"];
249
- readonly requiredFor: [];
250
- }, {
251
- readonly id: "data-model";
252
- readonly path: "data-model.md";
253
- readonly producedBy: "plan";
254
- readonly consumes: ["spec"];
255
- readonly requiredFor: [];
256
- }, {
257
- readonly id: "contracts";
258
- readonly path: "contracts/";
259
- readonly producedBy: "plan";
260
- readonly consumes: ["spec"];
261
- readonly requiredFor: [];
262
- }, {
263
- readonly id: "quickstart";
264
- readonly path: "quickstart.md";
265
- readonly producedBy: "plan";
266
- readonly consumes: ["spec", "plan"];
267
- readonly requiredFor: [];
268
- }, {
269
- readonly id: "plan-review";
270
- readonly path: "plan-review.md";
271
- readonly producedBy: "plan-review";
272
- readonly consumes: ["spec", "plan", "tasks"];
273
- readonly requiredFor: [];
274
- }, {
275
- readonly id: "verify-report";
276
- readonly path: "verify-report.md";
277
- readonly producedBy: "verify";
278
- readonly consumes: ["spec", "plan", "tasks"];
279
- readonly requiredFor: ["accelerated", "full"];
280
- }, {
281
- readonly id: "archive-report";
282
- readonly path: "archive-report.md";
283
- readonly producedBy: "archive";
284
- readonly consumes: ["spec", "plan", "tasks", "verify-report"];
285
- readonly requiredFor: ["accelerated", "full"];
286
- }];
287
- export declare const SDD_ROUTE_EXECUTION_POLICIES: readonly [{
288
- readonly route: "direct";
289
- readonly planningMode: "none";
290
- readonly validationGates: [];
291
- readonly optionalArtifactsByDefault: false;
292
- readonly routineUserPauses: false;
293
- readonly artifactRevisionPolicy: "none";
294
- }, {
295
- readonly route: "accelerated";
296
- readonly planningMode: "fast-forward";
297
- readonly validationGates: ["specify", "ready", "closeout"];
298
- readonly optionalArtifactsByDefault: false;
299
- readonly routineUserPauses: true;
300
- readonly artifactRevisionPolicy: "revalidate-affected-downstream";
301
- }, {
302
- readonly route: "full";
303
- readonly planningMode: "gated";
304
- readonly validationGates: ["specify", "plan", "tasks", "ready", "closeout"];
305
- readonly optionalArtifactsByDefault: false;
306
- readonly routineUserPauses: true;
307
- readonly artifactRevisionPolicy: "revalidate-affected-downstream";
176
+ readonly reason: "Fail closed on incomplete work or verification, then transactionally archive.";
308
177
  }];
309
178
  export declare const SDD_PHASE_PROTOCOLS: readonly [{
310
179
  readonly id: "explore";
311
- readonly objective: "Resolve repository uncertainty before requirements are fixed.";
312
- readonly requiredInputs: ["User request and known scope", "Repository instructions and relevant starting anchors", "Questions that materially affect specification"];
313
- readonly instructions: ["Inspect only enough repository context to make downstream requirements decision-ready.", "Separate confirmed behavior, constraints, assumptions, and unresolved material decisions.", "Return distilled evidence instead of raw searches or full-file content."];
314
- readonly allowedWrites: ["None; exploration is read-only."];
315
- readonly outputSchema: ["relevant paths and symbols", "current behavior and constraints", "material uncertainties and safe assumptions", "recommended specification anchors"];
316
- readonly doneWhen: ["The root can dispatch specification without repeating repository discovery."];
317
- readonly blockingConditions: ["A material product choice remains human-owned and cannot be safely assumed."];
318
- readonly handoff: ["The root passes the relevant paths, constraints, accepted assumptions, and unresolved decisions to specify."];
180
+ readonly objective: "Understand current behavior and constraints in proportion to the request.";
181
+ readonly requiredInputs: ["User intent and known repository context"];
182
+ readonly instructions: ["Inspect repository evidence in proportion to the request to identify behavior, constraints, risks, and safe assumptions.", "Root owns completing understanding and acceptance; specific discovery ownership determines who gathers evidence, even when generic guidance permits direct exploration.", "Give each evidence assignment one precise question and result. Independent questions may run in parallel within native capacity; dependent questions wait until the upstream output is accepted by root. Do not duplicate discovery.", "Complete this phase before specifying. No document, agent, or interview is forced in this phase."];
183
+ readonly outputSchema: ["confirmed facts", "constraints", "safe assumptions", "material uncertainty"];
184
+ readonly doneWhen: ["The next step can state intended outcomes without repeating discovery."];
185
+ readonly blockingConditions: ["A material human-owned decision cannot safely be inferred."];
319
186
  }, {
320
187
  readonly id: "specify";
321
- readonly objective: "Create a testable, implementation-neutral feature contract in spec.md.";
322
- readonly requiredInputs: ["User intent and accepted scope", "Explore handoff when the route is full", "Project constitution and existing public contracts when relevant"];
323
- readonly instructions: ["Record intent and scope as Why, Impact, and Affected capabilities before prescribing any contract.", "Define prioritized independent stories and map each story to its FR-### and SC-### contracts with Covers metadata.", "Inspect each affected canonical capability before choosing durable metadata: ADDED is only for genuinely new behavior; MODIFIED and REMOVED preserve exact existing titles; RENAMED names the exact previous title; only ADDED is valid when the capability is absent.", "Give every normative MUST or SHALL requirement a descriptive title and declare it INTERNAL or as an ADDED, MODIFIED, REMOVED, or RENAMED durable capability delta; treat an ADDED warning on an existing capability as a required semantic-overlap review.", "Classify every success criterion as buildable or outcome; both remain measurable, but only buildable criteria require implementation task coverage.", "Capture assumptions, acceptance scenarios, edge cases, dependencies, and explicit non-goals.", "Use a clarification marker only when no safe default exists and the answer materially changes scope or behavior."];
324
- readonly allowedWrites: ["openspec/changes/<feature>/spec.md"];
325
- readonly outputSchema: ["spec.md path", "requirements summary", "open clarifications"];
326
- readonly doneWhen: ["Every accepted FR and SC is testable, materially unambiguous, mapped to a story, and implementation-neutral."];
327
- readonly blockingConditions: ["A material unresolved choice prevents a truthful acceptance contract."];
328
- readonly handoff: ["Pass accepted scope, requirements, assumptions, and clarification decisions to plan."];
188
+ readonly objective: "State the intended outcome and observable acceptance proportionally.";
189
+ readonly requiredInputs: ["User intent", "Explore findings and constraints"];
190
+ readonly instructions: ["Define outcomes, non-goals, and meaningful edge cases in concise working notes.", "Do not persist a document before classification; only substantial work creates the one ID-named record.", "No document, agent, or interview is forced in this phase."];
191
+ readonly outputSchema: ["intent", "non-goals", "observable acceptance"];
192
+ readonly doneWhen: ["Acceptance expresses the requested outcome without material ambiguity."];
193
+ readonly blockingConditions: ["Acceptance depends on an unresolved material human decision."];
329
194
  }, {
330
195
  readonly id: "clarify";
331
- readonly objective: "Resolve only material ambiguity and write accepted answers back into spec.md.";
332
- readonly requiredInputs: ["spec.md", "The unresolved material decision"];
333
- readonly instructions: ["Ask a targeted question only when repository evidence and safe assumptions cannot resolve it.", "Update the canonical specification with the accepted decision instead of creating a parallel answer document."];
334
- readonly allowedWrites: ["openspec/changes/<feature>/spec.md"];
335
- readonly outputSchema: ["resolved decision", "updated spec anchor", "remaining risks"];
336
- readonly doneWhen: ["The material ambiguity is resolved in the canonical spec."];
337
- readonly blockingConditions: ["The required human decision has not been provided."];
338
- readonly handoff: ["Pass the updated spec and accepted decision to plan."];
196
+ readonly objective: "Resolve material ambiguity without imposing routine interviews.";
197
+ readonly requiredInputs: ["Explore evidence", "Specified outcome", "Any material uncertainty"];
198
+ readonly instructions: ["Use evidence or a safe bounded assumption when it preserves user intent.", "Ask only for a material human-owned decision that cannot safely be inferred; no interview is forced.", "An unresolved material clarification blocks classification.", "No document, agent, or interview is forced in this phase."];
199
+ readonly outputSchema: ["resolved decision or none-needed disposition", "remaining material blockers"];
200
+ readonly doneWhen: ["No material intent remains unresolved."];
201
+ readonly blockingConditions: ["The required human clarification has not been provided."];
339
202
  }, {
340
203
  readonly id: "plan";
341
- readonly objective: "Translate the accepted specification into an executable technical approach.";
342
- readonly requiredInputs: ["spec.md", "Relevant repository evidence and constraints", "Project constitution"];
343
- readonly instructions: ["Make each technical choice traceable to a requirement or repository constraint.", "Name affected components, interfaces, files, risks, migrations, and verification strategy.", "Create research, data model, contracts, or quickstart artifacts only when they reduce implementation risk.", "Read active constitution principles for the plan; do not amend or run constitution lifecycle validation unless an explicit constitution amendment is itself in scope."];
344
- readonly allowedWrites: ["openspec/changes/<feature>/plan.md", "Optional research.md, data-model.md, contracts/, and quickstart.md under the same change"];
345
- readonly outputSchema: ["plan.md path", "technical decisions", "affected surfaces"];
346
- readonly doneWhen: ["A competent implementer can execute the plan without guessing about critical architecture or constraints."];
347
- readonly blockingConditions: ["The plan contradicts spec.md, the constitution, or confirmed repository constraints."];
348
- readonly handoff: ["Pass the accepted plan, affected surfaces, dependencies, and verification strategy to tasks."];
204
+ readonly objective: "Plan substantial work in its one persistent record.";
205
+ readonly requiredInputs: ["Settled understanding", "Substantial classification", "Accepted outcomes"];
206
+ readonly instructions: ["Substantial classification only creates the `.thoth/changes/<id>/<id>.md` record.", "Capture interfaces, mutable surfaces, durable deltas, dependencies, risks, and verification seams.", "Plan each useful work unit with concrete inputs, outputs, and dependencies.", "Record each unit's owner, owned writes, interface boundaries, focused checks with PASS evidence, and return milestone and stop condition.", "Validate the plan before tasks exist; tasks are checked later for acceptance coverage."];
207
+ readonly outputSchema: ["technical approach", "affected interfaces", "risks", "verification seams"];
208
+ readonly doneWhen: ["A competent implementer can proceed without guessing at critical constraints."];
209
+ readonly blockingConditions: ["The approach contradicts accepted intent or unresolved material choices remain."];
349
210
  }, {
350
211
  readonly id: "checklist";
351
- readonly objective: "Audit requirement quality when risk justifies an explicit checklist.";
352
- readonly requiredInputs: ["spec.md", "Risk or compliance reason for the audit"];
353
- readonly instructions: ["Evaluate requirement completeness, clarity, consistency, measurability, and scenario coverage.", "Record the risk or ambiguity activation reason and add only the applicable security, accessibility, compliance, performance, migration, or domain lenses.", "Record checked revalidation after requirement-affecting changes, or an evidence-backed no-op when nothing relevant changed.", "Do not turn the checklist into implementation tests or QA execution steps."];
354
- readonly allowedWrites: ["openspec/changes/<feature>/checklists/requirements.md"];
355
- readonly outputSchema: ["checklist path", "passed items", "unresolved requirement gaps"];
356
- readonly doneWhen: ["Every checklist item has an evidence-backed state."];
357
- readonly blockingConditions: ["A high-risk requirement gap remains unresolved before task generation."];
358
- readonly handoff: ["Pass unresolved gaps back to specify; otherwise pass readiness to tasks."];
212
+ readonly objective: "Audit acceptance only when risk warrants a focused review.";
213
+ readonly requiredInputs: ["Substantial record", "Risk or ambiguity rationale"];
214
+ readonly instructions: ["Assess completeness, consistency, measurability, and relevant domain coverage in the same record.", "Correct material gaps without creating a second checklist artifact."];
215
+ readonly outputSchema: ["activation rationale", "resolved or remaining acceptance gaps"];
216
+ readonly doneWhen: ["Material acceptance gaps have an evidence-backed disposition."];
217
+ readonly blockingConditions: ["A material high-risk acceptance gap remains unresolved."];
359
218
  }, {
360
219
  readonly id: "tasks";
361
- readonly objective: "Produce dependency-ordered, independently verifiable implementation slices.";
362
- readonly requiredInputs: ["spec.md", "plan.md", "Optional planning support artifacts"];
363
- readonly instructions: ["Cover every FR and buildable SC with concrete tasks, exact paths, dependencies, and verification; outcome SC remain verification targets but do not require fake implementation tasks.", "Put test-first work before its corresponding implementation when behavior changes.", "Mark [P] only for proven non-overlapping mutable surfaces; otherwise state why no safe parallel work exists.", "Do not create ceremonial tasks for trivial edits or combine unrelated mutable surfaces."];
364
- readonly allowedWrites: ["openspec/changes/<feature>/tasks.md"];
365
- readonly outputSchema: ["tasks.md path", "requirement coverage", "dependency order"];
366
- readonly doneWhen: ["Every FR and buildable SC has executable task coverage and every task has a verification step."];
367
- readonly blockingConditions: ["A task requires an unresolved requirement, architecture choice, or hidden prerequisite."];
368
- readonly handoff: ["After ready, pass spec.md, plan.md, tasks.md, dependencies, and verification commands to the explicitly or bounded-default selected plan-review path, or implement when the user explicitly proceeds without review."];
220
+ readonly objective: "Record useful implementation slices and acceptance coverage.";
221
+ readonly requiredInputs: ["Accepted outcomes", "Validated plan", "Known dependencies"];
222
+ readonly instructions: ["Record one task row per outcome in the same ID-named record; each row names one independently acceptable outcome.", "Use the validator-compatible `- [ ] AC-n: ...` row with indented details and name concrete inputs, outputs, dependencies, owner, owned writes, interface boundaries, focused checks with PASS evidence, a meaningful return milestone, and a stop condition for each unit.", "Write `none` for owned writes on read-only work.", "Split phases with separately acceptable outcomes before dispatch; keep tiny cohesive mechanical work together and do not split mechanically by file or test step.", "Independent, precise Explorer questions may run in parallel within native capacity. Dependent questions wait for accepted evidence; root accepts producer outputs before consumers start, and discovery is not duplicated.", "Cover every accepted outcome with concrete work; test-first for behavior changes.", "Tasks and ready gates enforce coverage; the plan gate does not depend on tasks."];
223
+ readonly outputSchema: ["pending work", "acceptance coverage", "dependency order"];
224
+ readonly doneWhen: ["Each outcome has an executable task or bounded implementation seam."];
225
+ readonly blockingConditions: ["A task depends on unresolved material intent or hidden prerequisites."];
369
226
  }, {
370
227
  readonly id: "plan-review";
371
- readonly objective: "Perform the explicitly or recommended-default selected read-only blocker review before Accelerated or Full implementation.";
372
- readonly requiredInputs: ["spec.md", "plan.md", "tasks.md", "Optional active requirements checklist", "Project constitution", "Review selection after the ready gate, from an explicit answer or the bounded recommended fallback"];
373
- readonly instructions: ["At the ready gate, make at most three total attempts when the native review question returns answerless; after the third answerless result, treat Review plan with Oracle (Recommended) as selected, while any explicit Proceed without review answer wins.", "Load the bundled plan-reviewer skill and review executability, completeness, correctness, and coherence without redesigning the plan.", "Require task coverage for every FR and buildable SC; assess outcome SC as measurable verification targets without manufacturing implementation tasks.", "For every declared parallel group, independently assess semantic independence, each lane path union and owner, real cross-lane data flow, prerequisites and barrier, and whether native capacity supports dispatch-before-wait waves with refill; require a truthful sequential fallback when concurrency is unavailable or unproven.", "Return exact [OKAY] or [REJECT] semantics, default to [OKAY], and report at most three true blockers with the smallest fixes.", "After [REJECT], root must repair actionable same-intent planning artifacts, revalidate affected gates, and start a fresh Oracle approval round until [OKAY]; stop instead on a material human-owned blocker.", "Provide the reviewed artifact set so root can persist plan-review.md with SHA-256 freshness evidence; Oracle never writes it.", "Keep plan-review approval separate from implementation confirmation and mandatory final verify."];
374
- readonly allowedWrites: ["None; Oracle is read-only. Root persists plan-review.md when review runs."];
375
- readonly outputSchema: ["status: [OKAY] or [REJECT]", "zero to three blocker findings with smallest fixes", "non-blocking cautions", "requirement coverage percentage", "parallel executability disposition when tasks declare groups or an evidence-backed None reason", "constitution alignment", "reviewed artifact freshness manifest input"];
376
- readonly doneWhen: ["Oracle has returned an exact status and every true blocker has a concrete remediation anchor."];
377
- readonly blockingConditions: ["[REJECT] blocks the review path until root repairs planning blockers, the user explicitly proceeds without review, or an explicit override is recorded."];
378
- readonly handoff: ["On [OKAY], root persists review evidence and summarizes the approved scope, approach, ownership, verification, and material risks before asking Implement (Recommended) or Stop.", "For an answerless implementation question, root makes at most three total attempts; after the third answerless result, implementation counts as selected, while any explicit Stop answer wins.", "[OKAY] alone does not authorize implementation before that explicit choice or bounded fallback resolves.", "A plan-review result never satisfies mandatory final verify."];
228
+ readonly objective: "Offer optional independent blocker review after the ready plan.";
229
+ readonly requiredInputs: ["Ready substantial record", "Selected review disposition"];
230
+ readonly instructions: ["At ready, first show the user a concise plan summary (goal, acceptance, units, risks), then always offer “Review plan with Oracle (Recommended)” or “Implement directly without review”; record the plan-review choice as EXPLICIT_REVIEW for an explicit review answer, EXPLICIT_SKIP for an explicit direct answer, or DEFAULT_REVIEW_AFTER_3 only when the third confirmed empty return selects review. Keep selection provenance separate from implementation authorization; silence never means EXPLICIT_SKIP.", "For every orchestrator choice with a meaningful safe recommendation, after its first and second confirmed empty native returns repeat the same question and do no dependent work; after the third confirmed empty native return choose the recommendation. Explicit answers and Stop win. Pending, unavailable, failed, interrupted or host-prohibited questions do not count. If higher-priority host or tool rules prevent asking or repeating, obey them and report the limitation rather than claiming three returns or an explicit selection.", "Never fabricate facts or secrets; recommend safe deferral when needed information or material intent is unresolved, and keep dependent work blocked.", "Review scope, approach, risks, and acceptance coverage without redesigning settled intent.", "Return actionable blockers and cautions; a pass is not implementation authorization or final verification.", "After [OKAY], preserve the separate Implement (Recommended) / Stop authorization decision; honor applicable prior explicit authorization, and let explicit Stop supersede it.", "A plan review does not substitute for fresh final verification."];
231
+ readonly outputSchema: ["status", "blockers", "cautions"];
232
+ readonly doneWhen: ["The selected review has a current, evidence-backed disposition."];
233
+ readonly blockingConditions: ["A blocking finding remains unresolved."];
379
234
  }, {
380
235
  readonly id: "implement";
381
- readonly objective: "Execute the accepted task slice with one writer and focused verification.";
382
- readonly requiredInputs: ["User request or assigned tasks.md slice", "Accepted spec.md and plan.md when present", "Exact implementation boundaries and verification commands", "Implementation owner decision (orchestrator, designer, quick, or deep), exact mutable surface, requirement anchors, and task-shape/net-gain rationale"];
383
- readonly instructions: ["The root marks selected artifact-backed tasks [~] before implementation and marks them [x] only after task-specific evidence is verified; Direct or no-artifact work has no task state.", "The SDD route governs artifacts and gates, not implementation ownership; choose root or a specialist from explicit safe user direction and demonstrated task-shaped net gain.", "When root owns implementation, retain the accepted mutable surface with no child dispatch; when a specialist owns implementation, send one bounded dispatch with the exact surface, requirements, and verification.", "Use test-first or TDD execution for behavior changes and preserve one writer per mutable surface.", "Balance specialization, context isolation, independent work, quality, latency, and total cost against sequential dependency, shared mutable state, accumulated context, rediscovery, and coordination overhead.", "Only after deciding delegation creates net gain, select designer for user-facing UI/UX, quick for known narrow low-risk work, and deep for coupled multi-file, edge-case-heavy, migration, concurrency, shared-contract, or high-risk work.", "Record the owner decision, rationale, exact mutable surface, requirement anchors, and verification before implementation or dispatch.", "Proven independent surfaces may use separate writers with non-overlapping files; overlapping or compatibility-coupled surfaces use one deep writer and ordered handoffs.", "Quick and designer must escalate before expanding into deep-risk or compatibility-coupled scope.", "Edit only the assigned implementation surface and report justified deviations from the accepted plan.", "When evidence refines the same intent, return it to root so canonical artifacts are updated and only affected downstream artifacts and gates are revalidated.", "Start a new change instead of expanding the active one when the intent changes."];
384
- readonly allowedWrites: ["Assigned product and test files", "Root only: task checkbox transitions in openspec/changes/<feature>/tasks.md; child writers must not edit task state."];
385
- readonly outputSchema: ["status: completed | partial | failed", "per-task outcome", "files changed", "executed verification and results", "deviations, issues, and remaining work"];
386
- readonly doneWhen: ["The assigned task slice is complete and its focused checks pass with concrete evidence."];
387
- readonly blockingConditions: ["A task needs scope expansion, a material unresolved decision, or fails repeatedly without a safe bounded recovery."];
388
- readonly handoff: ["Pass changed files, per-task evidence, deviations, and verification results into the route- and risk-aware final-verification decision."];
236
+ readonly objective: "Implement the accepted small request or authorized substantial slice.";
237
+ readonly requiredInputs: ["Settled user intent or authorized record", "Exact mutable boundaries", "Focused checks"];
238
+ readonly instructions: ["Use one writer per mutable surface and choose an owner from task shape.", "Work only from accepted inputs and named dependencies within the assigned outcome and interface boundaries.", "Return bounded progress for root acceptance before dependent work starts.", "Use test-first (TDD); observe red before green for behavior changes, then verify call sites, shared contracts, and edge cases.", "Stop on a missing interface, ownership conflict, or new independent outcome.", "Return completed bounded progress and the smallest blocker for root reassessment before expansion.", "Do not create process tooling, reports, evidence generators, or temporary artifacts."];
239
+ readonly outputSchema: ["outcome", "changed files", "checks", "residual risks"];
240
+ readonly doneWhen: ["The assigned outcome is implemented and focused checks have run."];
241
+ readonly blockingConditions: ["Scope, risk, or material intent changes before safe completion."];
389
242
  }, {
390
243
  readonly id: "verify";
391
- readonly objective: "Judge the implementation against accepted requirements using executed evidence.";
392
- readonly requiredInputs: ["Implemented change or task results", "spec.md, plan.md, and tasks.md for artifact-backed routes", "Changed files and project verification commands"];
393
- readonly instructions: ["Trivial deterministic Direct work may use root-owned focused verification; materially risky Direct plus Accelerated and Full final verification use a fresh independent Oracle, and no implementation writer self-approves.", "Run or inspect the smallest sufficient executed checks; static confidence alone is not evidence.", "Judge completeness, correctness, and coherence independently so a passing test cannot hide missing or contradictory scope.", "Build a compliance matrix from every accepted requirement to code and executed checks.", "Record every outcome SC as PASS with concrete observed evidence or RISK with an explicit residual-risk entry.", "For accelerated and full routes, the root persists the read-only oracle result as verify-report.md."];
394
- readonly allowedWrites: ["Root persistence only: openspec/changes/<feature>/verify-report.md for accelerated and full routes"];
395
- readonly outputSchema: ["verdict: pass | fail", "compliance matrix", "executed checks and results", "critical issues with remediation anchors", "warnings and residual risks"];
396
- readonly doneWhen: ["Every accepted requirement is represented in the compliance matrix and the verdict matches the evidence."];
397
- readonly blockingConditions: ["Missing required evidence, incomplete tasks, failed checks, or unresolved critical issues force a fail verdict."];
398
- readonly handoff: ["On fail, hand off actionable findings to converge; on pass, hand off the accepted verify-report.md to archive for artifact-backed routes."];
244
+ readonly objective: "Verify actual outcomes with independence proportional to risk.";
245
+ readonly requiredInputs: ["Accepted outcomes", "Actual change and executed checks"];
246
+ readonly instructions: ["Judge the actual diff, executed checks, and residual risks; verify completeness, correctness, coherence, and behavior.", "Substantial or materially risky work requires a fresh independent Oracle; no writer self-approves.", "For substantial work, record acceptance evidence, checks, source digests, and reviewed-record digest in the same record."];
247
+ readonly outputSchema: ["verdict", "acceptance evidence", "checks", "residual risks"];
248
+ readonly doneWhen: ["Every accepted outcome has evidence or an explicit residual risk."];
249
+ readonly blockingConditions: ["A failed check, missing evidence, or critical issue remains."];
399
250
  }, {
400
251
  readonly id: "converge";
401
- readonly objective: "Convert verified implementation gaps into traceable remaining tasks without editing product code.";
402
- readonly requiredInputs: ["Failed verify result and remediation anchors", "spec.md, plan.md, and tasks.md", "Current maximum task and phase identifiers"];
403
- readonly instructions: ["Use an append-only update: add one new Convergence phase to tasks.md and never rewrite, renumber, reorder, or delete existing tasks.", "Classify each gap as missing, partial, contradicts, or unrequested; append one traceable task per actionable gap, ordered by severity and linked to its source requirement.", "Must not edit product code; implementation belongs to the next implement pass.", "If there is no actionable gap, leave tasks.md byte-for-byte unchanged."];
404
- readonly allowedWrites: ["Append-only changes to openspec/changes/<feature>/tasks.md"];
405
- readonly outputSchema: ["outcome: tasks-appended | converged", "appended task IDs and source requirements", "next implementation scope"];
406
- readonly doneWhen: ["Every actionable verification gap is represented by a new traceable task, or the implementation is confirmed converged."];
407
- readonly blockingConditions: ["The verify findings lack enough evidence or source anchors to create truthful tasks."];
408
- readonly handoff: ["On tasks-appended, return to implement and then verify; on converged, re-run verify before archive."];
252
+ readonly objective: "Turn actionable verification gaps into bounded corrective work.";
253
+ readonly requiredInputs: ["Failed verification", "Settled intent"];
254
+ readonly instructions: ["Record acceptance-linked follow-up in the same record when one exists.", "If scope or risk changes materially, reopen understanding and classification.", "Do not create a separate convergence report."];
255
+ readonly outputSchema: ["bounded follow-up", "verification seam"];
256
+ readonly doneWhen: ["Each actionable gap has a safe next action or the work is confirmed converged."];
257
+ readonly blockingConditions: ["Findings lack evidence or require material new intent."];
409
258
  }, {
410
259
  readonly id: "archive";
411
- readonly objective: "Close a verified artifact-backed change with a durable audit trail.";
412
- readonly requiredInputs: ["Completed spec.md, plan.md, and tasks.md", "verify-report.md with verdict pass", "Change name and current date"];
413
- readonly instructions: ["Confirm all tasks are complete, verify-report.md records pass, and there are no unresolved critical issues.", "Create archive-report.md with verification lineage, completed scope, residual warnings, and final archive path.", "After oracle pass, transactionally synchronize only explicitly declared durable deltas from spec.md into openspec/specs.", "Stage and back up canonical writes so handled failures roll back within the active process; this is not crash-atomic across forced process or operating-system termination.", "Move the complete change to openspec/changes/archive/YYYY-MM-DD-<feature>/.", "An INTERNAL requirement never updates openspec/specs; undeclared prose is never merged."];
414
- readonly allowedWrites: ["openspec/changes/<feature>/archive-report.md", "Declared durable requirement updates under openspec/specs/", "Move openspec/changes/<feature>/ to openspec/changes/archive/YYYY-MM-DD-<feature>/"];
415
- readonly outputSchema: ["status: archived | blocked", "archive path", "canonical specifications updated", "audit summary and verification lineage"];
416
- readonly doneWhen: ["Declared durable deltas are transactionally synchronized, the audit report records the result, and the complete change directory is present at the dated archive path."];
417
- readonly blockingConditions: ["Archive is blocked unless all tasks are complete, verify-report.md has verdict pass, and no unresolved critical issue remains."];
418
- readonly handoff: ["Return the archive path and audit summary to the root for final synthesis."];
260
+ readonly objective: "Transactionally apply declared deltas and archive a verified record.";
261
+ readonly requiredInputs: ["Complete substantial record", "Fresh independent pass", "Current archive date"];
262
+ readonly instructions: ["Fail-closed behavior blocks incomplete tasks, acceptance evidence, authorization, or independent verification.", "Apply only declared durable deltas transactionally and preserve unaffected specifications.", "Move `.thoth/changes/<id>/<id>.md` to `.thoth/changes/archive/YYYY-MM-DD-<id>/<id>.md`; keep the filename stable."];
263
+ readonly outputSchema: ["archive path", "updated specifications", "residual risks"];
264
+ readonly doneWhen: ["Declared deltas and verified record are archived without collisions or history loss."];
265
+ readonly blockingConditions: ["A closeout gate fails, destination collides, or a symlinked ancestor exists."];
419
266
  }];
420
- export declare const SDD_WORKFLOW_CONTRACT: SddWorkflowContract;
421
- export declare function classifySddRoute(input: SddRoutingInput): SddRoutingDecision;
267
+ export declare function classifySddChange(input: SddChangeClassificationInput): SddClassificationDecision;
422
268
  export declare function getSddWorkflowContract(): SddWorkflowContract;
423
- export declare function getSddRouteExecutionPolicy(route: SddRoute): SddRouteExecutionPolicy;
424
- export declare function getSddArtifactGraph(): SddArtifactContract[];
425
269
  export declare function getSddPhase(id: SddPhaseId): SddPhaseContract;
426
270
  export declare function getSddPhaseProtocol(id: SddPhaseId): SddPhaseProtocol;
427
- export declare function getSddPhaseProtocolsForRole(role: AgentRoleName): SddPhaseProtocol[];
428
- export declare function renderSddPhaseDispatchEnvelope(input: SddPhaseDispatchInput): string;
429
- export declare function renderSddPhaseDispatchTemplate(): string;
430
- export declare function getSddFinalVerificationDecision({ route, risk, }: {
431
- route: SddRoute;
432
- risk: SddFinalVerificationRisk;
433
- }): SddFinalVerificationDecision;
434
- export declare function getSddPhaseOwner(route: SddRoute, phaseId: SddPhaseId, verificationRisk?: SddFinalVerificationRisk): SddPhaseOwner;
435
- export declare function getRequiredSddPhaseOrder(route: SddRoute): SddPhaseId[];
436
- export declare function canEnterSddPhase({ route, completed, target, }: {
437
- route: SddRoute;
271
+ export declare function getSddRequiredPhaseOrder(classification: Pick<SddClassificationDecision, 'classification'>): SddPhaseId[];
272
+ export declare function canEnterSddPhase({ classification, completed, target, }: {
273
+ classification: Pick<SddClassificationDecision, 'classification'>;
438
274
  completed: readonly SddPhaseId[];
439
275
  target: SddPhaseId;
440
276
  }): boolean;
277
+ export declare function getSddFinalVerificationDecision({ classification, risk, }: {
278
+ classification: SddClassification;
279
+ risk: SddRisk;
280
+ }): SddFinalVerificationDecision;