thoth-agents 0.1.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 (128) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +339 -0
  3. package/dist/agents/deep.d.ts +2 -0
  4. package/dist/agents/designer.d.ts +2 -0
  5. package/dist/agents/explorer.d.ts +2 -0
  6. package/dist/agents/index.d.ts +8 -0
  7. package/dist/agents/librarian.d.ts +2 -0
  8. package/dist/agents/oracle.d.ts +2 -0
  9. package/dist/agents/orchestrator.d.ts +15 -0
  10. package/dist/agents/prompt-dialects.d.ts +28 -0
  11. package/dist/agents/prompt-sections.d.ts +47 -0
  12. package/dist/agents/prompt-utils.d.ts +25 -0
  13. package/dist/agents/quick.d.ts +2 -0
  14. package/dist/cli/codex-config-io.d.ts +31 -0
  15. package/dist/cli/codex-install.d.ts +41 -0
  16. package/dist/cli/codex-paths.d.ts +29 -0
  17. package/dist/cli/config-io.d.ts +22 -0
  18. package/dist/cli/config-manager.d.ts +4 -0
  19. package/dist/cli/custom-skills.d.ts +48 -0
  20. package/dist/cli/index.d.ts +3 -0
  21. package/dist/cli/index.js +4579 -0
  22. package/dist/cli/install.d.ts +3 -0
  23. package/dist/cli/model-key-normalization.d.ts +1 -0
  24. package/dist/cli/paths.d.ts +21 -0
  25. package/dist/cli/providers.d.ts +120 -0
  26. package/dist/cli/skill-manifest.d.ts +32 -0
  27. package/dist/cli/skills.d.ts +26 -0
  28. package/dist/cli/system.d.ts +6 -0
  29. package/dist/cli/types.d.ts +58 -0
  30. package/dist/config/constants.d.ts +17 -0
  31. package/dist/config/index.d.ts +5 -0
  32. package/dist/config/loader.d.ts +33 -0
  33. package/dist/config/schema.d.ts +279 -0
  34. package/dist/config/utils.d.ts +10 -0
  35. package/dist/delegation/project-id.d.ts +10 -0
  36. package/dist/delegation/types.d.ts +39 -0
  37. package/dist/harness/adapters/codex-surfaces.d.ts +219 -0
  38. package/dist/harness/adapters/codex.d.ts +8 -0
  39. package/dist/harness/adapters/opencode.d.ts +10 -0
  40. package/dist/harness/codex-plugin-paths.d.ts +1 -0
  41. package/dist/harness/core/agent-pack.d.ts +88 -0
  42. package/dist/harness/core/memory-governance.d.ts +33 -0
  43. package/dist/harness/core/sdd.d.ts +100 -0
  44. package/dist/harness/core/skills.d.ts +183 -0
  45. package/dist/harness/generate-codex-plugin.d.ts +9 -0
  46. package/dist/harness/registry.d.ts +6 -0
  47. package/dist/harness/types.d.ts +85 -0
  48. package/dist/harness/writers/codex-plugin-package.d.ts +26 -0
  49. package/dist/harness/writers/codex-toml.d.ts +10 -0
  50. package/dist/harness/writers/skill-layout.d.ts +15 -0
  51. package/dist/hooks/auto-update-checker/cache.d.ts +7 -0
  52. package/dist/hooks/auto-update-checker/checker.d.ts +28 -0
  53. package/dist/hooks/auto-update-checker/constants.d.ts +11 -0
  54. package/dist/hooks/auto-update-checker/index.d.ts +18 -0
  55. package/dist/hooks/auto-update-checker/types.d.ts +23 -0
  56. package/dist/hooks/chat-headers.d.ts +16 -0
  57. package/dist/hooks/delegate-task-retry/guidance.d.ts +2 -0
  58. package/dist/hooks/delegate-task-retry/hook.d.ts +8 -0
  59. package/dist/hooks/delegate-task-retry/index.d.ts +4 -0
  60. package/dist/hooks/delegate-task-retry/patterns.d.ts +11 -0
  61. package/dist/hooks/foreground-fallback/index.d.ts +73 -0
  62. package/dist/hooks/index.d.ts +10 -0
  63. package/dist/hooks/json-error-recovery/hook.d.ts +18 -0
  64. package/dist/hooks/json-error-recovery/index.d.ts +1 -0
  65. package/dist/hooks/phase-reminder/index.d.ts +26 -0
  66. package/dist/hooks/post-read-nudge/index.d.ts +18 -0
  67. package/dist/hooks/skill-sync.d.ts +10 -0
  68. package/dist/hooks/thoth-mem/index.d.ts +46 -0
  69. package/dist/hooks/thoth-mem/protocol.d.ts +7 -0
  70. package/dist/index.d.ts +5 -0
  71. package/dist/index.js +6509 -0
  72. package/dist/mcp/context7.d.ts +7 -0
  73. package/dist/mcp/exa.d.ts +6 -0
  74. package/dist/mcp/grep-app.d.ts +7 -0
  75. package/dist/mcp/index.d.ts +7 -0
  76. package/dist/mcp/thoth.d.ts +3 -0
  77. package/dist/mcp/types.d.ts +12 -0
  78. package/dist/sdd/artifact-governance/artifact-loader.d.ts +55 -0
  79. package/dist/sdd/artifact-governance/index.d.ts +6 -0
  80. package/dist/sdd/artifact-governance/tasks-validator.d.ts +17 -0
  81. package/dist/sdd/artifact-governance/types.d.ts +52 -0
  82. package/dist/thoth/client.d.ts +14 -0
  83. package/dist/thoth/index.d.ts +2 -0
  84. package/dist/tools/ast-grep/cli.d.ts +15 -0
  85. package/dist/tools/ast-grep/constants.d.ts +25 -0
  86. package/dist/tools/ast-grep/downloader.d.ts +5 -0
  87. package/dist/tools/ast-grep/index.d.ts +10 -0
  88. package/dist/tools/ast-grep/tools.d.ts +3 -0
  89. package/dist/tools/ast-grep/types.d.ts +30 -0
  90. package/dist/tools/ast-grep/utils.d.ts +4 -0
  91. package/dist/tools/index.d.ts +2 -0
  92. package/dist/tools/lsp/client.d.ts +42 -0
  93. package/dist/tools/lsp/config-store.d.ts +29 -0
  94. package/dist/tools/lsp/config.d.ts +4 -0
  95. package/dist/tools/lsp/constants.d.ts +25 -0
  96. package/dist/tools/lsp/index.d.ts +4 -0
  97. package/dist/tools/lsp/tools.d.ts +5 -0
  98. package/dist/tools/lsp/types.d.ts +35 -0
  99. package/dist/tools/lsp/utils.d.ts +34 -0
  100. package/dist/utils/agent-variant.d.ts +47 -0
  101. package/dist/utils/env.d.ts +1 -0
  102. package/dist/utils/file-io.d.ts +3 -0
  103. package/dist/utils/frontmatter-yaml.d.ts +4 -0
  104. package/dist/utils/index.d.ts +7 -0
  105. package/dist/utils/internal-initiator.d.ts +6 -0
  106. package/dist/utils/logger.d.ts +1 -0
  107. package/dist/utils/polling.d.ts +21 -0
  108. package/dist/utils/subprocess.d.ts +24 -0
  109. package/dist/utils/tmux-session-manager.d.ts +63 -0
  110. package/dist/utils/tmux.d.ts +32 -0
  111. package/dist/utils/zip-extractor.d.ts +1 -0
  112. package/package.json +81 -0
  113. package/src/skills/_shared/openspec-convention.md +131 -0
  114. package/src/skills/_shared/persistence-contract.md +162 -0
  115. package/src/skills/_shared/thoth-mem-convention.md +124 -0
  116. package/src/skills/executing-plans/SKILL.md +245 -0
  117. package/src/skills/plan-reviewer/SKILL.md +115 -0
  118. package/src/skills/requirements-interview/SKILL.md +212 -0
  119. package/src/skills/sdd-apply/SKILL.md +89 -0
  120. package/src/skills/sdd-archive/SKILL.md +87 -0
  121. package/src/skills/sdd-design/SKILL.md +92 -0
  122. package/src/skills/sdd-init/SKILL.md +148 -0
  123. package/src/skills/sdd-propose/SKILL.md +89 -0
  124. package/src/skills/sdd-spec/SKILL.md +93 -0
  125. package/src/skills/sdd-tasks/SKILL.md +142 -0
  126. package/src/skills/sdd-verify/SKILL.md +99 -0
  127. package/src/skills/thoth-mem-agents/SKILL.md +355 -0
  128. package/thoth-agents.schema.json +470 -0
@@ -0,0 +1,245 @@
1
+ ---
2
+ name: executing-plans
3
+ description: Execute SDD task lists with real-time progress tracking, sub-agent dispatch, and verification checkpoints.
4
+ metadata:
5
+ author: thoth-agents
6
+ version: '1.0'
7
+ ---
8
+
9
+ # Executing Plans Skill
10
+
11
+ Use this skill to execute an existing SDD task list end to end while keeping
12
+ task progress durable, ordered, and verifiable.
13
+
14
+ ## Shared Conventions
15
+
16
+ - [../_shared/openspec-convention.md](../_shared/openspec-convention.md)
17
+ - [../_shared/persistence-contract.md](../_shared/persistence-contract.md)
18
+ - [../_shared/thoth-mem-convention.md](../_shared/thoth-mem-convention.md)
19
+
20
+ ## Progress Tracking Invariants
21
+
22
+ The orchestrator owns task progress tracking.
23
+
24
+ - The orchestrator marks `- [ ]` to `- [~]` before dispatching execution work.
25
+ - The orchestrator marks `- [~]` to `- [x]` only after successful results are
26
+ received and verified.
27
+ - The orchestrator marks `- [-]` with a clear reason when a task is skipped or
28
+ fails after escalation.
29
+ - Sub-agents execute assigned work and return structured results. They do not
30
+ own checkbox updates.
31
+ - Same-agent execution batches are allowed when consecutive ready tasks share
32
+ dependencies, scope, and verification context.
33
+ - For a same-agent batch, keep checkbox state per task: mark each batched task
34
+ `- [~]` before dispatch, and later mark each task `- [x]` or `- [-]` only
35
+ from task-specific evidence in the returned result.
36
+ - Never proceed without updating the current task state first.
37
+ - Re-read the canonical tasks artifact after each edit to confirm persistence.
38
+ - Persistence mode determines target stores: `openspec` → file only,
39
+ `thoth-mem` → memory only, `hybrid` → both. Never skip a store that the
40
+ active mode requires.
41
+ - The artifact governance validator is outside this skill's responsibility.
42
+ If present, it is a report-only checkpoint after `sdd-tasks` and before a
43
+ future `sdd-apply` entrypoint; it does not change checkbox state or task
44
+ ownership.
45
+ - `openspec/` files are coordination artifacts, not source code. The
46
+ orchestrator may read and edit them directly for progress tracking and state
47
+ management only when the active mode includes openspec artifacts.
48
+ - Keep visible task state on the active progress tracking surface while
49
+ preserving the canonical task artifact. Use the visible progress surface
50
+ when available, plus the same canonical `tasks.md` and/or thoth-mem artifacts.
51
+ - Task state updates are NOT optional and NOT deferred — they happen in
52
+ real-time as execution proceeds.
53
+ - Every state transition (pending→in-progress, in-progress→completed,
54
+ in-progress→skipped) MUST be persisted BEFORE moving on.
55
+ - Real-time tracking is a hard invariant, not a best practice. Deferred updates
56
+ are a protocol violation, and batch dispatches must still record each task's
57
+ state transition before and after the delegated work.
58
+
59
+ ## When to Use
60
+
61
+ - Executing an SDD task list
62
+ - Resuming work from a previous session
63
+ - Multi-task implementation with an existing change already defined
64
+
65
+ ## Workflow
66
+
67
+ ### Phase 1: Load
68
+
69
+ 1. Determine the artifact store mode from config before reading or writing any
70
+ SDD artifacts.
71
+ 2. Load task artifacts using mode-aware retrieval:
72
+ - `openspec`/`hybrid`: scan `openspec/changes/` for active changes and read
73
+ `tasks.md`.
74
+ - `thoth-mem`: recover tasks via 3-layer recall
75
+ (`search` → `timeline` → `get_observation`) using topic key
76
+ `sdd/{change-name}/tasks`.
77
+ 3. Find the first unchecked task in state `- [ ]` or `- [~]`.
78
+ 4. Build a mental model of the plan: total tasks, remaining work,
79
+ parallelizable work, and dependency order.
80
+ 5. Load remaining SDD context using mode-aware retrieval in
81
+ [../_shared/persistence-contract.md](../_shared/persistence-contract.md).
82
+
83
+ ### Phase 2: Execute Ready Work
84
+
85
+ #### A. Mark In-Progress
86
+
87
+ Before dispatching a task or same-agent batch:
88
+
89
+ 1. Select the next ready task, or the next consecutive ready tasks that target
90
+ the same execution agent and can safely be handled in one dispatch.
91
+ 2. Edit the canonical tasks artifact and change each selected task from
92
+ `- [ ]` to `- [~]`.
93
+ 3. If the mode is `thoth-mem` or `hybrid`, re-persist the updated tasks
94
+ artifact with topic key `sdd/{change-name}/tasks`.
95
+ 4. Re-read `tasks.md` after the edit to confirm the change persisted.
96
+
97
+ #### B. Dispatch
98
+
99
+ Choose the semantic execution role based on task type. Preserve the role
100
+ boundary even when the active harness uses different invocation syntax:
101
+
102
+ | Need | Semantic role |
103
+ | --- | --- |
104
+ | Broad codebase discovery | explorer |
105
+ | External docs or APIs | librarian |
106
+ | Architecture or debugging | oracle |
107
+ | UI or UX work | designer |
108
+ | Simple, precise changes | quick |
109
+ | Complex, multi-file changes | deep |
110
+
111
+ Prefer one dispatch for consecutive ready tasks assigned to the same execution
112
+ role, especially repeated UI/UX work for designer, repeated narrow edits for
113
+ quick, or related implementation tasks for deep.
114
+
115
+ Every dispatch prompt MUST include these 6 parts:
116
+
117
+ 1. `TASKS` — exact task number(s) and title(s)
118
+ 2. `CONTEXT` — relevant proposal, spec, design, and prior-task state
119
+ 3. `REQUIREMENTS` — concrete outcomes and constraints
120
+ 4. `BOUNDARIES` — files, scope limits, and non-goals
121
+ 5. `VERIFICATION` — checks the sub-agent must run or report
122
+ 6. `RETURN ENVELOPE` — the exact structured response contract in this skill
123
+
124
+ #### C. Receive and Verify
125
+
126
+ Read the sub-agent return envelope and respond by status:
127
+
128
+ - `completed`: inspect the reported file changes, run verification checks, and
129
+ confirm every task's acceptance criteria were actually met.
130
+ - `failed`: assess the blocker, decide whether to retry with sharper guidance,
131
+ switch agents, or escalate.
132
+ - `partial`: assess what is already done, preserve that context, and dispatch a
133
+ focused follow-up for the remainder.
134
+
135
+ #### D. Mark Complete
136
+
137
+ After verified completion:
138
+
139
+ 1. Edit the canonical tasks artifact and change each verified task from
140
+ `- [~]` to `- [x]`. If a batched result only completed some tasks, update
141
+ only those tasks and keep the rest in progress, skipped, or retryable based
142
+ on evidence.
143
+ 2. If the mode is `thoth-mem` or `hybrid`, re-persist the updated tasks
144
+ artifact under `sdd/{change-name}/tasks`.
145
+ 3. Persist a progress checkpoint under `sdd/{change-name}/apply-progress` when
146
+ the mode includes thoth-mem.
147
+ 4. Re-read `tasks.md` after the edit to confirm the completed state persisted.
148
+
149
+ #### E. Auto-Continue
150
+
151
+ Immediately proceed to the next task.
152
+
153
+ Do not ask the user whether execution should continue unless one of these is
154
+ true:
155
+
156
+ - the work is truly blocked
157
+ - a critical failure prevents safe continuation
158
+ - the current task or batch has failed 3 consecutive times
159
+
160
+ ### Phase 3: Between Tasks
161
+
162
+ Between every task or same-agent batch:
163
+
164
+ 1. Re-read `tasks.md` because later tasks may depend on earlier outputs.
165
+ 2. Re-check that assumptions still hold.
166
+ 3. If a prior task introduced breakage, fix that before starting the next task.
167
+
168
+ ### Phase 4: Escalation Policy
169
+
170
+ - Attempt 1: re-dispatch the same task with explicit fix instructions and the
171
+ missing evidence called out.
172
+ - Attempt 2: switch to a different agent or fix directly when appropriate.
173
+ - Attempt 3: make one final targeted attempt with narrowed scope.
174
+ - After 3 consecutive failures, mark the task `- [-]` with a clear reason and
175
+ escalate to the user.
176
+
177
+ ### Phase 5: Completion
178
+
179
+ After the task list is complete:
180
+
181
+ 1. Run final verification using the project's configured instructions and the
182
+ smallest sufficient checks: typecheck, tests, lint, and build when
183
+ appropriate.
184
+ 2. Report a completion summary with evidence.
185
+ 3. If the work is SDD-backed, suggest `sdd-verify` as the next step.
186
+
187
+ ## Return Envelope Contract
188
+
189
+ Every execution sub-agent MUST return this exact structure:
190
+
191
+ ```markdown
192
+ ## Task Result
193
+
194
+ **Status**: completed | failed | partial
195
+ **Tasks**: {task number(s) and name(s)}
196
+
197
+ ### What was done
198
+ - {concrete change 1}
199
+ - {concrete change 2}
200
+
201
+ ### Per-task outcome
202
+ - `{task number}` — completed | failed | partial: {task-specific evidence}
203
+
204
+ ### Files changed
205
+ - `path/to/file.ts` — {what changed}
206
+
207
+ ### Verification
208
+ - {check 1}: passed | failed
209
+ - {check 2}: passed | failed
210
+
211
+ ### Issues (if any)
212
+ - {issue description} — {severity: critical | important | minor}
213
+
214
+ ### Failure reason (if failed)
215
+ {Why it failed, what was attempted, what blocked progress}
216
+
217
+ ### Skip reason (if skipped)
218
+ {Why it was skipped, what prerequisite is missing}
219
+ ```
220
+
221
+ Treat missing sections or vague summaries as incomplete execution results.
222
+
223
+ ## Recovery Protocol
224
+
225
+ To resume safely:
226
+
227
+ 1. Determine the artifact store mode from config.
228
+ 2. Recover task state using mode-aware retrieval:
229
+ - `openspec`: read `openspec/changes/{change-name}/tasks.md`.
230
+ - `thoth-mem`: recover `sdd/{change-name}/tasks` and
231
+ `sdd/{change-name}/apply-progress` via 3-layer recall
232
+ (`search` → `timeline` → `get_observation`).
233
+ - `hybrid`: do both recovery paths and prefer thoth-mem as the source of
234
+ truth if state diverges.
235
+ 3. Resume from the first task marked `- [ ]` or `- [~]`.
236
+
237
+ ## Guardrails
238
+
239
+ - Do not execute tasks out of dependency order.
240
+ - Do not mark a task complete without verification evidence.
241
+ - Do not skip SDD context recovery.
242
+ - Do not modify task-list structure; only update checkbox state and explicit skip
243
+ reasons.
244
+ - Do not continue past a blocked task without escalation.
245
+ - Do not claim completion without evidence.
@@ -0,0 +1,115 @@
1
+ ---
2
+ name: plan-reviewer
3
+ description: Review SDD task plans for execution blockers and return [OKAY] or [REJECT].
4
+ metadata:
5
+ author: thoth-agents
6
+ version: '1.0'
7
+ ---
8
+
9
+ # Plan Reviewer Skill
10
+
11
+ Verify that an SDD task plan is executable, references valid files, and is safe
12
+ to hand to implementation.
13
+
14
+ ## Shared Conventions
15
+
16
+ - [../_shared/openspec-convention.md](../_shared/openspec-convention.md)
17
+ - [../_shared/persistence-contract.md](../_shared/persistence-contract.md)
18
+ - [../_shared/thoth-mem-convention.md](../_shared/thoth-mem-convention.md)
19
+
20
+ ## Purpose
21
+
22
+ Review the tasks artifact for true execution blockers. Retrieve it according to
23
+ the persistence mode: read `openspec/changes/{change-name}/tasks.md` for
24
+ openspec/hybrid modes, use thoth-mem 3-layer recall for thoth-mem/hybrid modes,
25
+ or read from inline context for none mode.
26
+
27
+ The artifact governance validator is not part of this review. Plan-reviewer is
28
+ only the pre-execution approval gate for the task plan; it does not run the
29
+ validator, enforce its findings, or manage the future pre-`sdd-apply` handoff.
30
+ Invoke the semantic oracle role through the available role dispatch surface.
31
+
32
+ Focus on whether the plan can be executed as written, not whether you would have
33
+ designed it differently.
34
+
35
+ ## Inputs
36
+
37
+ - `change-name`
38
+ - `pipeline-type` (`accelerated` or `full`)
39
+ - `persistence-mode` (`thoth-mem`, `openspec`, `hybrid`, or `none`)
40
+ - Tasks artifact (retrieved per persistence mode: filesystem for openspec/hybrid,
41
+ thoth-mem for thoth-mem/hybrid, inline for none)
42
+ - **Full pipeline**: related spec and design artifacts when needed for dependency checks
43
+ - **Accelerated pipeline**: proposal artifact when needed for dependency checks
44
+
45
+ ## Task State Awareness
46
+
47
+ Recognize these checklist states in `tasks.md`:
48
+
49
+ - `- [ ]` pending
50
+ - `- [~]` in progress
51
+ - `- [x]` completed
52
+ - `- [-]` skipped with reason
53
+
54
+ Review executability of the remaining work. If a task is marked `- [-]`, ensure
55
+ the skip reason is explicit and does not hide a blocker.
56
+
57
+ ## Review Checklist
58
+
59
+ Check only what affects executability:
60
+
61
+ 1. Referenced file paths exist when they are supposed to already exist.
62
+ 2. New-file tasks use exact intended paths.
63
+ 3. Tasks reference exact file paths instead of vague areas.
64
+ 4. Each task includes a `Verification` section.
65
+ 5. Each `Verification` section includes both:
66
+ - `Run:`
67
+ - `Expected:`
68
+ 6. Dependency order is valid.
69
+ 7. The sequence is workable without hidden prerequisite steps.
70
+
71
+ ## Decision Rules
72
+
73
+ - Default to `[OKAY]`.
74
+ - Use `[REJECT]` only for true blockers.
75
+ - A rejection may list at most 3 issues.
76
+ - Do not reject for style preferences or optional improvements.
77
+ - Preserve the exact `[OKAY]` and `[REJECT]` tokens across every runtime; they
78
+ are portable review semantics, not runtime-specific syntax.
79
+
80
+ ## Output Format
81
+
82
+ If the plan is executable:
83
+
84
+ ```text
85
+ [OKAY]
86
+ - Brief confirmation that the plan is executable.
87
+ - Optional note on any non-blocking caution.
88
+ ```
89
+
90
+ If the plan has blockers:
91
+
92
+ ```text
93
+ [REJECT]
94
+ 1. <blocking issue>
95
+ 2. <blocking issue>
96
+ 3. <blocking issue>
97
+ ```
98
+
99
+ For each rejected issue, include:
100
+
101
+ - why it blocks execution
102
+ - the smallest concrete fix
103
+
104
+ ## Anti-Patterns
105
+
106
+ - No nitpicking.
107
+ - No style opinions.
108
+ - No design questioning.
109
+ - No expanding the scope of review beyond blockers.
110
+ - Do not return more than 3 rejection issues.
111
+
112
+ ## Review Standard
113
+
114
+ Approve when a competent implementer can execute the plan without guessing about
115
+ critical paths, missing files, or missing verification instructions.
@@ -0,0 +1,212 @@
1
+ ---
2
+ name: requirements-interview
3
+ description: Mandatory step-0 requirements discovery for non-trivial work before any implementation or SDD routing decisions.
4
+ metadata:
5
+ author: thoth-agents
6
+ version: '1.0'
7
+ ---
8
+
9
+ # Requirements Interview Skill
10
+
11
+ Use this skill as the mandatory step-0 entry point for non-trivial requests.
12
+ The goal is requirement clarity, scope calibration, and a user-approved
13
+ handoff path before implementation begins.
14
+
15
+ ## Shared Conventions
16
+
17
+ - [../_shared/openspec-convention.md](../_shared/openspec-convention.md)
18
+ - [../_shared/persistence-contract.md](../_shared/persistence-contract.md)
19
+ - [../_shared/thoth-mem-convention.md](../_shared/thoth-mem-convention.md)
20
+
21
+ ## HARD GATE
22
+
23
+ - Do not implement during the requirements interview.
24
+ - Do not write code.
25
+ - Do not patch files.
26
+ - Do not create formal SDD artifacts until the user approves the route.
27
+
28
+ ## Root Session Bootstrap
29
+
30
+ This skill is normally loaded by the root/main orchestrator at the start of a
31
+ new root session. When thoth-mem tools are available, the root/main
32
+ orchestrator MUST also load `thoth-mem-agents`, call `mem_session_start` with
33
+ the active project and session identity, and save the real user prompt with
34
+ `mem_save_prompt` before later delegation.
35
+
36
+ If thoth-mem tools or the required identity values are unavailable, disclose
37
+ that memory bootstrap could not run and continue without claiming memory was
38
+ saved. Do not save subagent prompts, generated handoffs, or interview
39
+ scaffolding as user prompts.
40
+
41
+ ## Blocking User Input Surface Requirement
42
+
43
+ - The interview flow MUST use the active harness blocking user input surface
44
+ for user-input prompts.
45
+ - Do not embed interview questions as plain prose in normal response text when
46
+ a blocking user input surface exists.
47
+ - Prefer one focused blocking input call at a time for the core interview loop.
48
+ - Use short headers (<=30 chars), concise option labels, and concrete
49
+ descriptions.
50
+ - Put the recommended option first and include `(Recommended)` in that label.
51
+ - Do not add an `Other` option manually when the active harness already adds or
52
+ supports custom input. Use the equivalent runtime option unless custom input
53
+ must be disabled.
54
+ - Use multi-select only when multiple simultaneous selections are genuinely
55
+ valid. Use the equivalent runtime option if one exists.
56
+
57
+ ## Workflow
58
+
59
+ ### Phase 1: Discovery Context Gathering
60
+
61
+ 1. Always use the semantic explorer role for codebase context. Use the
62
+ semantic librarian role for external APIs, dependency versions, library
63
+ migration, or public documentation.
64
+ 2. Collect only the minimum context needed to improve questions and reduce
65
+ user repetition.
66
+ 3. Prefer facts from the codebase and known references over asking the user
67
+ for information the environment can answer.
68
+
69
+ ### Phase 2: Requirements Interview
70
+
71
+ 1. Ask each interview question through the blocking user input surface.
72
+ 2. Ask 1 blocking input call at a time.
73
+ 3. Ask at most 5 total questions.
74
+ 4. Prefer multiple-choice questions when practical.
75
+ 5. Stop early when clarity is already sufficient.
76
+ 6. Focus on what the user truly needs, not only the first phrasing of the
77
+ request.
78
+ 7. Surface unstated assumptions and validate them with the user.
79
+ 8. Guide the user toward potentially better options when appropriate, but never
80
+ impose a decision.
81
+ 9. Always ask and confirm; never choose on the user's behalf.
82
+ 10. Do not ask for details that the codebase, task artifacts, or gathered
83
+ context already answer.
84
+
85
+ ### Phase 3: Complexity Assessment
86
+
87
+ Evaluate these 6 dimensions. Rate each as **Low**, **Medium**, or **High**:
88
+
89
+ | Dimension | Low | Medium | High |
90
+ | --- | --- | --- | --- |
91
+ | **Logic depth** | Copy, CSS, rename, simple wiring | Localized behavior tweak, validation, one workflow step | Algorithm, state-machine, or business-rule rewrite with many invariants |
92
+ | **Contract sensitivity** | Presentation only, internal refactor | User-visible behavior change in one flow | API, schema, data model, migration, auth, privacy, or public contract |
93
+ | **Context span** | Can be done in one bounded pass | Several dependent edits or choices to coordinate | Many sequential steps where earlier decisions must be remembered |
94
+ | **Discovery need** | Request and acceptance criteria are already clear | Some ambiguity, a few viable approaches | Goal is clear but solution requires investigation or tradeoff analysis |
95
+ | **Failure cost** | Mistakes are obvious and cheap to revert | Needs integration or regression checks | Subtle correctness bugs, customer-facing, data, or compliance impact |
96
+ | **Concern coupling** | Single concern | Two related concerns | Multiple independent concerns that could conflict |
97
+
98
+ ### Phase 4: Approach Proposal
99
+
100
+ 1. Present 2-3 viable options as recommendations, not decisions.
101
+ 2. For each option, give the main trade-offs and when it is a good fit.
102
+ 3. Mark one option as the current recommendation and explain why.
103
+ 4. Use the active harness blocking user input surface to confirm the preferred
104
+ approach before moving on.
105
+
106
+ ### Phase 5: User Approval Gate
107
+
108
+ Present:
109
+
110
+ - Summary of understanding
111
+ - Scope classification and why
112
+ - Recommended approach options
113
+ - Proposed handoff path
114
+
115
+ Then wait for explicit user confirmation.
116
+
117
+ Use the active harness blocking user input surface for this approval gate.
118
+
119
+ Nothing proceeds without explicit approval in this phase. The user is the sole
120
+ approver during requirements discovery. Do not request oracle review here.
121
+
122
+ ### Phase 6: Handoff
123
+
124
+ Recommend a route based on the complexity assessment, then wait for the
125
+ user to confirm it:
126
+
127
+ **Direct implementation** — when all of:
128
+ - No dimensions rated High
129
+ - At most one dimension rated Medium
130
+ - Contract sensitivity is Low
131
+ - Failure cost is Low
132
+
133
+ **Accelerated SDD** (`propose -> tasks`) — when:
134
+ - 2-3 dimensions are Medium, or
135
+ - 1 dimension is High in logic depth, context span, or discovery need
136
+ - But contract sensitivity and failure cost are not High
137
+
138
+ **Full SDD** (`propose -> spec -> design -> tasks`) — when any of:
139
+ - Contract sensitivity is High
140
+ - Failure cost is High
141
+ - 2 or more dimensions are High
142
+ - Discovery need is High and at least one other dimension is
143
+ Medium or High
144
+ - Concern coupling is High with risk of conflicting decisions
145
+
146
+ Quick decision heuristics:
147
+
148
+ 1. Cosmetic work routes direct regardless of file count.
149
+ 2. Dense logic rewrites route to at least accelerated SDD regardless
150
+ of file count.
151
+ 3. External contracts (API, schema, migration, auth, privacy) usually
152
+ need full SDD.
153
+ 4. If the model must remember decisions across many steps, write them
154
+ down — that means SDD.
155
+ 5. Tie-breaker: unsure between direct and accelerated, choose
156
+ accelerated. Unsure between accelerated and full, ask: 'Do we
157
+ need a durable behavior contract?' If yes, full SDD.
158
+
159
+ Before any SDD generation starts, present the artifact store policy choice:
160
+
161
+ ```text
162
+ How would you like to persist planning artifacts?
163
+ 1. none — No persistence. Ephemeral exploration, privacy-sensitive work, or when no backend is available. Results are inline only and not saved across sessions.
164
+ 2. thoth-mem — Memory only. Lightest token cost. No repo files.
165
+ 3. openspec — Repo files only. Visible and reviewable.
166
+ 4. hybrid — Both. Maximum durability, higher token cost.
167
+ Default: hybrid
168
+ ```
169
+
170
+ Collect this choice with the active blocking user input surface rather than
171
+ plain prose.
172
+
173
+ When the user selects a mode that includes OpenSpec (`openspec` or `hybrid`),
174
+ verify that `openspec/` is initialized. If it is not, recommend running the
175
+ `sdd-init` skill before proceeding.
176
+
177
+ Once route, persistence mode, and initialization are confirmed, hand off to the
178
+ corresponding SDD pipeline phase. The handoff MUST include:
179
+ - `pipeline-type`: `accelerated` or `full` (matching the confirmed route)
180
+ - `persistence-mode`: the user's chosen artifact store mode
181
+ - `change-name`: derived from the approved scope
182
+
183
+ Hand off to:
184
+
185
+ - **Propose**: [../sdd-propose/SKILL.md](../sdd-propose/SKILL.md)
186
+ - **Spec** (full SDD only): [../sdd-spec/SKILL.md](../sdd-spec/SKILL.md)
187
+ - **Design** (full SDD only): [../sdd-design/SKILL.md](../sdd-design/SKILL.md)
188
+ - **Tasks**: [../sdd-tasks/SKILL.md](../sdd-tasks/SKILL.md)
189
+
190
+ Do not silently choose the handoff route or artifact store mode. Recommend,
191
+ ask, and wait.
192
+
193
+ ## Guardrails
194
+
195
+ - Maximum 5 interview questions.
196
+ - Ask only one blocking input call at a time.
197
+ - Do not ask what codebase context can answer.
198
+ - Do not skip explicit user approval.
199
+ - Do not auto-select the handoff route.
200
+ - Do not auto-select the persistence mode.
201
+ - Never convert recommendations into unilateral decisions.
202
+ - Do not replace blocking input prompts with plain-text interview questions
203
+ when the harness exposes a blocking user input surface.
204
+
205
+ ## Anti-Patterns
206
+
207
+ - Question dumping
208
+ - Option inflation
209
+ - Premature implementation
210
+ - Silent route selection
211
+ - Silent persistence-mode selection
212
+ - Treating discovery as optional
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: sdd-apply
3
+ description: Execute assigned SDD tasks and return structured implementation results.
4
+ ---
5
+
6
+ # SDD Apply Skill
7
+
8
+ Implement assigned SDD tasks and return durable execution results to the
9
+ orchestrator.
10
+
11
+ ## Shared Conventions
12
+
13
+ - [../_shared/openspec-convention.md](../_shared/openspec-convention.md)
14
+ - [../_shared/persistence-contract.md](../_shared/persistence-contract.md)
15
+ - [../_shared/thoth-mem-convention.md](../_shared/thoth-mem-convention.md)
16
+
17
+ ## Persistence Mode
18
+
19
+ The orchestrator passes the artifact store mode (`thoth-mem`, `openspec`, or
20
+ `hybrid`). Follow the persistence contract for read/write rules per mode.
21
+
22
+ - `thoth-mem`: persist to thoth-mem only — do NOT create or modify
23
+ `openspec/` files.
24
+ - `openspec`: write files only — do NOT call thoth-mem save tools.
25
+ - `hybrid`: persist to both (default).
26
+
27
+ ## When to Use
28
+
29
+ - A change has a task plan and implementation should begin or resume
30
+ - A batch of checklist items must be executed and reported back to the
31
+ orchestrator
32
+
33
+ ## Prerequisites
34
+
35
+ - `change-name`
36
+ - `pipeline-type` (`accelerated` or `full`)
37
+ - Assigned task numbers or phase range
38
+ - Task artifact
39
+ - Spec and design artifacts (full pipeline only)
40
+ - Proposal artifact (accelerated pipeline — used as the acceptance reference)
41
+
42
+ ## Workflow
43
+
44
+ 1. Read the shared conventions.
45
+ 2. Recover artifacts with the retrieval protocol in
46
+ the persistence contract:
47
+ - **Always**: recover `tasks`
48
+ - **Full pipeline**: recover `spec` and `design`
49
+ - **Accelerated pipeline**: recover `proposal` (used as the acceptance reference)
50
+ 3. Read the affected code before editing anything.
51
+ 4. Execute only the assigned checklist items.
52
+ 5. In modes that include thoth-mem, persist an implementation progress report
53
+ with:
54
+
55
+ Use the memory tool binding for `mem_save` with the canonical SDD topic key
56
+ and required metadata fields: `title`, `topic_key`, `type`, `project`,
57
+ `scope`, and `content`.
58
+
59
+ 6. If the orchestrator requests it, include enough detail for it to update the
60
+ canonical tasks artifact and memory checkpoints accurately.
61
+
62
+ ## Response Format
63
+
64
+ Return a structured result to the orchestrator using the Task Result envelope:
65
+
66
+ **Status**: completed | failed | partial
67
+ **Task**: {task reference}
68
+
69
+ **What was done**: concrete list of changes
70
+ **Files changed**: paths with descriptions
71
+ **Verification**: check results (passed/failed)
72
+ **Issues**: problems encountered with severity
73
+ **Failure/Skip reason**: if applicable
74
+
75
+ Progress tracking (checkbox state updates) is managed by the orchestrator
76
+ via the harness-bound progress workflow in the `executing-plans` skill. Do not
77
+ update task checkboxes yourself.
78
+
79
+ ## Rules
80
+
81
+ - Read the acceptance contract before implementing: specs in full pipeline,
82
+ proposal in accelerated pipeline.
83
+ - Follow the design unless you explicitly report a justified deviation.
84
+ - Update only the tasks assigned in the current batch.
85
+ - Persist the progress artifact whenever the selected mode includes thoth-mem.
86
+ - Retrieve every SDD dependency with the mode-aware protocol in the
87
+ persistence contract.
88
+ - Return structured execution evidence to the orchestrator so it can manage task
89
+ state correctly.