okstra 0.202.0 → 0.204.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 (258) hide show
  1. package/README.md +3 -3
  2. package/dist/cli-registry.mjs +7 -7
  3. package/dist/cli-registry.mjs.map +1 -1
  4. package/dist/commands/lifecycle/install.mjs +50 -124
  5. package/dist/commands/lifecycle/install.mjs.map +1 -1
  6. package/dist/commands/memory/memory.mjs +41 -8
  7. package/dist/commands/memory/memory.mjs.map +1 -1
  8. package/dist/lib/install-assets.mjs +3 -0
  9. package/dist/lib/install-assets.mjs.map +1 -1
  10. package/dist/lib/runtime-manifest.mjs +2 -1
  11. package/dist/lib/runtime-manifest.mjs.map +1 -1
  12. package/dist/lib/types.d.mts +2 -1
  13. package/docs/architecture/storage-model.md +14 -11
  14. package/docs/architecture.md +25 -19
  15. package/docs/cli.md +15 -12
  16. package/docs/contributor-change-matrix.md +3 -2
  17. package/docs/performance-improvement-plan-v2.md +2 -3
  18. package/docs/project-structure-overview.md +35 -9
  19. package/docs/task-process/README.md +1 -1
  20. package/docs/task-process/common-flow.md +1 -1
  21. package/docs/task-process/final-verification.md +3 -1
  22. package/docs/task-process/implementation.md +1 -1
  23. package/docs/task-process/release-handoff.md +36 -39
  24. package/package.json +1 -2
  25. package/runtime/BUILD.json +2 -2
  26. package/runtime/agents/common.json +28 -0
  27. package/runtime/agents/operations/code-review.json +6 -0
  28. package/runtime/agents/operations/report-translation.json +6 -0
  29. package/runtime/agents/operations/schedule-verification.json +6 -0
  30. package/runtime/agents/roles/analyser.json +18 -0
  31. package/runtime/agents/roles/critic.json +18 -0
  32. package/runtime/agents/roles/designer.json +18 -0
  33. package/runtime/agents/roles/implementer.json +20 -0
  34. package/runtime/agents/roles/leader.json +20 -0
  35. package/runtime/agents/roles/planner.json +18 -0
  36. package/runtime/agents/roles/report-writer.json +19 -0
  37. package/runtime/agents/roles/translator.json +19 -0
  38. package/runtime/agents/roles/verifier.json +18 -0
  39. package/runtime/bin/lib/okstra/usage.sh +5 -5
  40. package/runtime/prompts/duties/acceptance-critic.json +32 -0
  41. package/runtime/prompts/duties/acceptance-verifier.json +32 -0
  42. package/runtime/prompts/duties/analysis-worker.json +32 -0
  43. package/runtime/prompts/duties/code-reviewer.json +32 -0
  44. package/runtime/prompts/duties/diagnosis-worker.json +32 -0
  45. package/runtime/prompts/duties/direction-selection-worker.json +32 -0
  46. package/runtime/prompts/duties/discovery-worker.json +32 -0
  47. package/runtime/prompts/duties/implementation-executor.json +32 -0
  48. package/runtime/prompts/duties/implementation-verifier.json +32 -0
  49. package/runtime/prompts/duties/lead.json +32 -0
  50. package/runtime/prompts/duties/planning-worker.json +36 -0
  51. package/runtime/prompts/duties/report-writer.json +32 -0
  52. package/runtime/prompts/duties/reverification-worker.json +32 -0
  53. package/runtime/prompts/duties/schedule-verifier.json +32 -0
  54. package/runtime/prompts/duties/scope-critic.json +32 -0
  55. package/runtime/prompts/duties/technical-verification-worker.json +32 -0
  56. package/runtime/prompts/duties/translator.json +32 -0
  57. package/runtime/prompts/launch.template.md +2 -1
  58. package/runtime/prompts/lead/adapters/cmux.md +1 -1
  59. package/runtime/prompts/lead/convergence.md +4 -4
  60. package/runtime/prompts/lead/okstra-lead-contract.md +113 -4
  61. package/runtime/prompts/lead/plan-body-verification.md +6 -6
  62. package/runtime/prompts/lead/report-writer.md +3 -3
  63. package/runtime/prompts/profiles/_common-contract.md +2 -2
  64. package/runtime/prompts/profiles/_implementation-executor.md +4 -1
  65. package/runtime/prompts/profiles/_implementation-verifier.md +2 -2
  66. package/runtime/prompts/profiles/change-impact-analysis.json +31 -0
  67. package/runtime/prompts/profiles/change-impact-analysis.md +0 -20
  68. package/runtime/prompts/profiles/error-analysis.json +39 -0
  69. package/runtime/prompts/profiles/error-analysis.md +0 -25
  70. package/runtime/prompts/profiles/feature-analysis.json +31 -0
  71. package/runtime/prompts/profiles/feature-analysis.md +0 -20
  72. package/runtime/prompts/profiles/final-verification.json +30 -0
  73. package/runtime/prompts/profiles/final-verification.md +3 -22
  74. package/runtime/prompts/profiles/forbidden-actions.json +4 -3
  75. package/runtime/prompts/profiles/implementation-option-selection.json +31 -0
  76. package/runtime/prompts/profiles/implementation-option-selection.md +0 -20
  77. package/runtime/prompts/profiles/implementation-planning.json +40 -0
  78. package/runtime/prompts/profiles/implementation-planning.md +4 -29
  79. package/runtime/prompts/profiles/implementation.json +30 -0
  80. package/runtime/prompts/profiles/implementation.md +1 -20
  81. package/runtime/prompts/profiles/improvement-discovery.json +31 -0
  82. package/runtime/prompts/profiles/improvement-discovery.md +0 -20
  83. package/runtime/prompts/profiles/project-analysis.json +31 -0
  84. package/runtime/prompts/profiles/project-analysis.md +0 -20
  85. package/runtime/prompts/profiles/release-handoff.json +5 -0
  86. package/runtime/prompts/profiles/release-handoff.md +71 -73
  87. package/runtime/prompts/profiles/requirements-discovery.json +39 -0
  88. package/runtime/prompts/profiles/requirements-discovery.md +0 -25
  89. package/runtime/prompts/profiles/technical-verification.json +39 -0
  90. package/runtime/prompts/profiles/technical-verification.md +0 -25
  91. package/runtime/prompts/wizard/prompts.ko.json +12 -17
  92. package/runtime/python/okstra_ctl/adapters/hosts/antigravity/relay.md +1 -0
  93. package/runtime/python/okstra_ctl/adapters/hosts/claude-code/adapter.py +3 -0
  94. package/runtime/python/okstra_ctl/adapters/hosts/claude-code/manifest.json +1 -1
  95. package/runtime/python/okstra_ctl/adapters/hosts/claude-code/relay.md +4 -3
  96. package/runtime/python/okstra_ctl/adapters/hosts/claude-code/worker-session.md +108 -0
  97. package/runtime/python/okstra_ctl/adapters/hosts/codex/relay.md +1 -0
  98. package/runtime/python/okstra_ctl/adapters/hosts/grok/relay.md +2 -0
  99. package/runtime/python/okstra_ctl/adapters/hosts/kimi/relay.md +2 -0
  100. package/runtime/python/okstra_ctl/adapters/providers/antigravity/adapter.py +8 -1
  101. package/runtime/python/okstra_ctl/adapters/providers/claude/adapter.py +8 -0
  102. package/runtime/python/okstra_ctl/adapters/providers/codex/adapter.py +23 -6
  103. package/runtime/python/okstra_ctl/adapters/providers/grok/adapter.py +6 -2
  104. package/runtime/python/okstra_ctl/agent/invocation.py +168 -113
  105. package/runtime/python/okstra_ctl/agent/prompt_cli/cli.py +120 -0
  106. package/runtime/python/okstra_ctl/agent/prompt_cli/materialize.py +107 -2
  107. package/runtime/python/okstra_ctl/agent/prompt_cli/run_identity.py +0 -49
  108. package/runtime/python/okstra_ctl/analysis_packet.py +4 -1
  109. package/runtime/python/okstra_ctl/application/open_worker.py +6 -1
  110. package/runtime/python/okstra_ctl/assignment_resolver.py +16 -5
  111. package/runtime/python/okstra_ctl/cmux.py +69 -20
  112. package/runtime/python/okstra_ctl/code_review_target.py +16 -8
  113. package/runtime/python/okstra_ctl/conformance.py +43 -0
  114. package/runtime/python/okstra_ctl/consumers.py +6 -3
  115. package/runtime/python/okstra_ctl/container.py +31 -8
  116. package/runtime/python/okstra_ctl/context_cost.py +11 -15
  117. package/runtime/python/okstra_ctl/contract_refreeze.py +156 -0
  118. package/runtime/python/okstra_ctl/convergence_provenance.py +7 -1
  119. package/runtime/python/okstra_ctl/design_prep.py +34 -1
  120. package/runtime/python/okstra_ctl/dispatch_core.py +53 -27
  121. package/runtime/python/okstra_ctl/domain/host.py +5 -0
  122. package/runtime/python/okstra_ctl/domain/worker_runtime.py +10 -0
  123. package/runtime/python/okstra_ctl/error_report.py +4 -3
  124. package/runtime/python/okstra_ctl/execution_manifest.py +71 -18
  125. package/runtime/python/okstra_ctl/handoff.py +167 -277
  126. package/runtime/python/okstra_ctl/implementation_stage.py +9 -0
  127. package/runtime/python/okstra_ctl/initial_prompt_materialization.py +113 -0
  128. package/runtime/python/okstra_ctl/lead_progress.py +1 -1
  129. package/runtime/python/okstra_ctl/legacy_model_selection.py +2 -2
  130. package/runtime/python/okstra_ctl/manager_cli.py +92 -4
  131. package/runtime/python/okstra_ctl/manager_launch.py +1 -1
  132. package/runtime/python/okstra_ctl/manager_paths.py +14 -3
  133. package/runtime/python/okstra_ctl/manager_store.py +210 -3
  134. package/runtime/python/okstra_ctl/manager_sync.py +4 -1
  135. package/runtime/python/okstra_ctl/manager_view.py +2 -1
  136. package/runtime/python/okstra_ctl/model_discovery.py +30 -0
  137. package/runtime/python/okstra_ctl/model_io/lines.py +14 -1
  138. package/runtime/python/okstra_ctl/model_io/renderers.py +4 -3
  139. package/runtime/python/okstra_ctl/models.py +1 -1
  140. package/runtime/python/okstra_ctl/next_phase.py +16 -6
  141. package/runtime/python/okstra_ctl/operation_invocation.py +86 -0
  142. package/runtime/python/okstra_ctl/option_comparison.py +168 -0
  143. package/runtime/python/okstra_ctl/path_hints.py +9 -0
  144. package/runtime/python/okstra_ctl/paths.py +3 -0
  145. package/runtime/python/okstra_ctl/profile_show.py +42 -1
  146. package/runtime/python/okstra_ctl/registry/host_discovery.py +20 -12
  147. package/runtime/python/okstra_ctl/registry/host_registry.py +11 -0
  148. package/runtime/python/okstra_ctl/render.py +50 -0
  149. package/runtime/python/okstra_ctl/report_contract.py +1 -1
  150. package/runtime/python/okstra_ctl/report_html/view_models/release_handoff.py +21 -3
  151. package/runtime/python/okstra_ctl/report_synthesis_packet.py +177 -17
  152. package/runtime/python/okstra_ctl/report_translation.py +2 -1
  153. package/runtime/python/okstra_ctl/report_translation_dispatch.py +69 -9
  154. package/runtime/python/okstra_ctl/role_requirements.py +142 -129
  155. package/runtime/python/okstra_ctl/rollup.py +3 -1
  156. package/runtime/python/okstra_ctl/run.py +76 -29
  157. package/runtime/python/okstra_ctl/schedule_semantics.py +17 -6
  158. package/runtime/python/okstra_ctl/stage_fix_carry.py +23 -4
  159. package/runtime/python/okstra_ctl/stage_integrate.py +178 -18
  160. package/runtime/python/okstra_ctl/stage_map.py +16 -2
  161. package/runtime/python/okstra_ctl/stage_targets.py +209 -43
  162. package/runtime/python/okstra_ctl/team.py +22 -13
  163. package/runtime/python/okstra_ctl/time_report.py +2 -1
  164. package/runtime/python/okstra_ctl/usage_report.py +3 -1
  165. package/runtime/python/okstra_ctl/wizard/confirmation.py +3 -9
  166. package/runtime/python/okstra_ctl/wizard/ids.py +1 -1
  167. package/runtime/python/okstra_ctl/wizard/registry.py +1 -1
  168. package/runtime/python/okstra_ctl/wizard/state.py +3 -5
  169. package/runtime/python/okstra_ctl/wizard/steps_plan.py +3 -23
  170. package/runtime/python/okstra_ctl/worker_prompt_contract.py +5 -1
  171. package/runtime/python/okstra_ctl/worker_prompt_headers.py +35 -7
  172. package/runtime/python/okstra_ctl/worker_prompt_policy.py +66 -48
  173. package/runtime/python/okstra_ctl/workflow.py +1 -1
  174. package/runtime/python/okstra_ctl/worktree/__init__.py +3 -1
  175. package/runtime/python/okstra_ctl/worktree/naming.py +9 -0
  176. package/runtime/python/okstra_ctl/worktree_registry.py +38 -9
  177. package/runtime/python/okstra_token_usage/pricing.py +6 -4
  178. package/runtime/schemas/agent-common-v1.schema.json +34 -0
  179. package/runtime/schemas/agent-duty-v1.schema.json +38 -0
  180. package/runtime/schemas/agent-operation-v1.schema.json +11 -0
  181. package/runtime/schemas/agent-profile-v1.schema.json +46 -0
  182. package/runtime/schemas/agent-role-v1.schema.json +29 -0
  183. package/runtime/schemas/final-report-v2.0.schema.json +118 -97
  184. package/runtime/schemas/final-report-v3.0.schema.json +118 -97
  185. package/runtime/skills/okstra-brief-gen/SKILL.md +84 -4
  186. package/runtime/skills/okstra-chat/SKILL.md +2 -2
  187. package/runtime/skills/okstra-code-review/SKILL.md +23 -9
  188. package/runtime/skills/okstra-container-build/SKILL.md +10 -10
  189. package/runtime/skills/okstra-inspect/SKILL.md +1 -1
  190. package/runtime/skills/okstra-inspect/facets/cost.md +1 -1
  191. package/runtime/skills/okstra-inspect/facets/error-zip.md +9 -9
  192. package/runtime/skills/okstra-inspect/facets/errors.md +16 -16
  193. package/runtime/skills/okstra-inspect/facets/logs.md +7 -7
  194. package/runtime/skills/okstra-inspect/facets/recap.md +2 -2
  195. package/runtime/skills/okstra-inspect/facets/report.md +1 -1
  196. package/runtime/skills/okstra-inspect/facets/status.md +4 -3
  197. package/runtime/skills/okstra-inspect/facets/time.md +11 -10
  198. package/runtime/skills/okstra-manager/SKILL.md +18 -2
  199. package/runtime/skills/okstra-pr-gen/SKILL.md +6 -5
  200. package/runtime/skills/okstra-rollup/SKILL.md +5 -5
  201. package/runtime/skills/okstra-run/SKILL.md +31 -12
  202. package/runtime/skills/okstra-schedule-gen/SKILL.md +19 -14
  203. package/runtime/skills/okstra-setup/SKILL.md +12 -10
  204. package/runtime/skills/okstra-setup/references/project-config.md +7 -6
  205. package/runtime/skills/okstra-usage/SKILL.md +1 -1
  206. package/runtime/skills/okstra-user-response/SKILL.md +1 -1
  207. package/runtime/templates/manager/view.template.html +1 -0
  208. package/runtime/templates/report-writer-prompt-preamble.md +8 -0
  209. package/runtime/templates/reports/brief.template.md +14 -4
  210. package/runtime/templates/reports/html/i18n/en.json +5 -4
  211. package/runtime/templates/reports/html/i18n/ko.json +5 -4
  212. package/runtime/templates/reports/html/tasks/release-handoff.template.html +8 -5
  213. package/runtime/templates/reports/i18n/en.json +1 -1
  214. package/runtime/templates/reports/md/tasks/release-handoff.template.md +1 -1
  215. package/runtime/templates/reports/release-handoff-input.template.md +6 -4
  216. package/runtime/templates/translator-prompt-preamble.md +36 -0
  217. package/runtime/validators/checks/validate-assets-01.py +7 -8
  218. package/runtime/validators/validate-brief.py +70 -0
  219. package/runtime/validators/validate-implementation-plan-stages.py +2 -1
  220. package/runtime/validators/validate-run.py +59 -9
  221. package/runtime/validators/validate-schedule.py +9 -0
  222. package/docs/for-ai/README.md +0 -68
  223. package/docs/for-ai/skills/okstra-brief-gen.md +0 -262
  224. package/docs/for-ai/skills/okstra-chat.md +0 -34
  225. package/docs/for-ai/skills/okstra-code-review.md +0 -57
  226. package/docs/for-ai/skills/okstra-container-build.md +0 -129
  227. package/docs/for-ai/skills/okstra-inspect.md +0 -262
  228. package/docs/for-ai/skills/okstra-manager.md +0 -86
  229. package/docs/for-ai/skills/okstra-memory.md +0 -126
  230. package/docs/for-ai/skills/okstra-pr-gen.md +0 -49
  231. package/docs/for-ai/skills/okstra-rollup.md +0 -114
  232. package/docs/for-ai/skills/okstra-run.md +0 -250
  233. package/docs/for-ai/skills/okstra-schedule-gen.md +0 -240
  234. package/docs/for-ai/skills/okstra-setup.md +0 -167
  235. package/docs/for-ai/skills/okstra-usage.md +0 -29
  236. package/docs/for-ai/skills/okstra-user-response.md +0 -72
  237. package/runtime/agents/workers/claude-worker.md +0 -128
  238. package/runtime/agents/workers/report-writer-worker.md +0 -37
  239. package/runtime/agents/workers/translator-worker.md +0 -63
  240. package/runtime/prompts/duties/acceptance-critic.md +0 -44
  241. package/runtime/prompts/duties/acceptance-verifier.md +0 -44
  242. package/runtime/prompts/duties/analysis-worker.md +0 -44
  243. package/runtime/prompts/duties/code-reviewer.md +0 -44
  244. package/runtime/prompts/duties/common.md +0 -39
  245. package/runtime/prompts/duties/diagnosis-worker.md +0 -44
  246. package/runtime/prompts/duties/direction-selection-worker.md +0 -44
  247. package/runtime/prompts/duties/discovery-worker.md +0 -44
  248. package/runtime/prompts/duties/implementation-executor.md +0 -44
  249. package/runtime/prompts/duties/implementation-verifier.md +0 -44
  250. package/runtime/prompts/duties/lead.md +0 -44
  251. package/runtime/prompts/duties/planning-worker.md +0 -52
  252. package/runtime/prompts/duties/report-writer.md +0 -44
  253. package/runtime/prompts/duties/reverification-worker.md +0 -44
  254. package/runtime/prompts/duties/schedule-verifier.md +0 -44
  255. package/runtime/prompts/duties/scope-critic.md +0 -44
  256. package/runtime/prompts/duties/technical-verification-worker.md +0 -44
  257. package/runtime/prompts/duties/translator.md +0 -44
  258. package/runtime/python/okstra_ctl/pane_title.py +0 -154
@@ -1,240 +0,0 @@
1
- # okstra-schedule-gen AI Manual
2
-
3
- ## Source
4
-
5
- - Skill source: [`skills/okstra-schedule-gen/SKILL.md`](../../../skills/okstra-schedule-gen/SKILL.md)
6
- - Schedule template: [`templates/reports/schedule.template.md`](../../../templates/reports/schedule.template.md)
7
- - Schedule validator: [`validators/validate-schedule.py`](../../../validators/validate-schedule.py)
8
- - Stage Map read side: [`scripts/okstra_project/state.py`](../../../scripts/okstra_project/state.py)
9
- - Selection semantics: [`scripts/okstra_ctl/schedule_semantics.py`](../../../scripts/okstra_ctl/schedule_semantics.py)
10
- - Work-category source of truth: [`scripts/okstra_ctl/work_categories.py`](../../../scripts/okstra_ctl/work_categories.py)
11
- - workStatus inference reference: [`skills/okstra-inspect/SKILL.md`](../../../skills/okstra-inspect/SKILL.md)
12
-
13
- ## Purpose and invocation
14
-
15
- `okstra-schedule-gen` gathers non-done tasks in a task group and produces one client-facing work schedule from user-selected unfinished implementation stages.
16
-
17
- Public invocation:
18
-
19
- ```text
20
- /okstra-schedule-gen [task-group]
21
- ```
22
-
23
- This is a host skill, not a schedule-generation shell command. Use `stage-map` and `validate-schedule.py` only as backend contracts inside the skill.
24
-
25
- Output location:
26
-
27
- ```text
28
- <PROJECT_ROOT>/.okstra/tasks/<task-group-segment>/schedule/<task-group-segment>-plan-<YYYY-MM-DD_HH-MM-SS>.md
29
- ```
30
-
31
- Do not use it for single-task status analysis or phase execution. Use `okstra-inspect status` and `okstra-run` for those jobs.
32
-
33
- ## Preflight and task-group resolution
34
-
35
- Run one literal-token preflight call:
36
-
37
- ```bash
38
- okstra preflight --runtime claude-code
39
- ```
40
-
41
- On `Okstra preflight: failed`, show `Reason` and `Recovery`, then stop. On
42
- `Okstra preflight: ready`, carry the fixed `Project root` line. Resolve an
43
- explicit task-group from the invocation or host request. If none is unambiguous,
44
- run `okstra model-io task-selection-input --project-root <projectRoot>` and ask
45
- the user to choose from the fixed `Task` rows; never guess. Then run
46
- `okstra model-io schedule-input --project-root <projectRoot> --task-group <group>`
47
- and use only its fixed task metadata rows.
48
-
49
- On zero matches, report that the task group was not found and do not create a file.
50
-
51
- ## Candidate filter
52
-
53
- `workStatus` is used only to decide which tasks are candidates. When it is missing or empty, use the `okstra-inspect` `status.4` inference table.
54
-
55
- - Exclude resolved `done` tasks.
56
- - Include every other resolved state.
57
- - If no task remains, report that all tasks are done and do not create a file.
58
-
59
- Do not render `workStatus` as the detailed task status. The per-task `Status` value is `<taskType> / <currentPhase>`.
60
-
61
- ## Source-aware Stage Map resolution
62
-
63
- For every candidate task, call:
64
-
65
- ```bash
66
- okstra stage-map <task-key> --text
67
- ```
68
-
69
- The successful fixed response carries `Status`, `Task key`, `Task root`, `State`,
70
- `Source plan path`, and lossless numbered `Stages`, `Done stages`, and `Planning`
71
- count/name/value rows.
72
-
73
- Handle each result explicitly:
74
-
75
- - `Status: ready`, `State: ready`: use exactly `Source plan path`; do not pick a report by mtime or `latestReportRecordPath`. Select only stages not present in the done-stage rows.
76
- - `Status: ready`, `State: missing`: record an empty source and empty stage sets, mark the task `[NEEDS-PLANNING]`, and emit no forward Work Breakdown, Gantt, or day total for it.
77
- - `Status: error` or another state: stop before drafting and report `Failure stage` and `Failure reason`. A corrupt or conflicting source must never fall back to a guessed report.
78
-
79
- A valid selected set is dependency-closed: every transitive prerequisite of a selected stage is either also selected or present in `doneStages`. Completed prerequisites remain evidence only and are never scheduled forward.
80
-
81
- If a ready task has no unfinished stages, render `_Complete — no remaining stage_` and omit forward effort.
82
-
83
- ## Stage selection
84
-
85
- Offer up to three dependency-closed cumulative bundles in topological order, plus all remaining stages. A custom set is accepted only after closing it over unfinished prerequisites; completed prerequisites are preserved separately.
86
-
87
- Skip the picker when the remaining work has only one possible bundle and use all unfinished stages. Record the final stage numbers as `selectedStages`.
88
-
89
- ## Temporary selection contract
90
-
91
- Write a paired draft and selection input with one timestamp:
92
-
93
- ```text
94
- .okstra/tasks/<task-group-segment>/schedule/.draft/<timestamp>.md
95
- .okstra/tasks/<task-group-segment>/schedule/.draft/<timestamp>.selection.json
96
- ```
97
-
98
- The selection file is a temporary verification input. It freezes the exact source, full stage map, completed stages, and user-selected forward work so both validators judge the same facts instead of re-resolving mutable task state.
99
-
100
- Schema version 1:
101
-
102
- ```json
103
- {
104
- "schemaVersion": 1,
105
- "tasks": [
106
- {
107
- "taskKey": "demo:group:DEV-1",
108
- "taskId": "DEV-1",
109
- "state": "ready",
110
- "sourcePlanPath": "/absolute/path/final-report-implementation-planning-001.data.json",
111
- "selectedStages": [2, 3],
112
- "doneStages": [1],
113
- "stages": [
114
- {
115
- "stageNumber": 1,
116
- "title": "Prepare port",
117
- "dependsOn": [],
118
- "stepCount": 2
119
- },
120
- {
121
- "stageNumber": 2,
122
- "title": "Build adapter",
123
- "dependsOn": [1],
124
- "stepCount": 3
125
- },
126
- {
127
- "stageNumber": 3,
128
- "title": "Wire consumer",
129
- "dependsOn": [2],
130
- "stepCount": 2
131
- }
132
- ]
133
- }
134
- ]
135
- }
136
- ```
137
-
138
- Include every candidate task. A `missing` task has an empty `sourcePlanPath`, `selectedStages`, `doneStages`, and `stages`. Convert the CLI stage-row keys to the camel-case selection boundary exactly as shown.
139
-
140
- ## Phase classification
141
-
142
- Only these canonical categories are valid:
143
-
144
- | workCategory | Default phase |
145
- |---|---|
146
- | `bugfix` | Phase 1 for High or Med-High risk; otherwise Phase 2 |
147
- | `feature` | Phase 2 |
148
- | `improvement` | Phase 2 |
149
- | `refactor` | Phase 3 |
150
- | `ops` | Phase 3 |
151
-
152
- Priority overrides category: P0 maps to Phase 1, P1/P2 to Phase 2, and P3 to Phase 3. An unknown or missing raw category falls back to Phase 2 with a one-line rationale naming the raw value. Do not invent another category.
153
-
154
- ## Template contract
155
-
156
- Follow `schedule.template.md` exactly. The required top-level order is:
157
-
158
- 1. `## At a Glance`
159
- 2. `## Executive Summary`
160
- 3. `## Task Dependency Graph`
161
- 4. optional `## Gantt Chart`
162
- 5. `## Phase 1: Critical Fixes`
163
- 6. `## Phase 2: Enhancements`
164
- 7. `## Phase 3: Architecture`
165
- 8. `## Execution Priority Matrix`
166
- 9. `## Cross-Task Dependencies & Shared Concerns`
167
- 10. `## Risk Mitigation Strategy`
168
- 11. `## Recommended Immediate Actions`
169
- 12. optional final `## Glossary`
170
-
171
- Keep an empty required section and render `_none_`. Headings and field labels stay as English template literals; body prose is Korean.
172
-
173
- Each scheduled task uses this stage-level Work Breakdown shape:
174
-
175
- ```markdown
176
- | Stage | Title | Steps | Depends On | Days |
177
- |---:|---|---:|---|---:|
178
- | 2 | Build adapter | 3 | 1 (done) | 2.0 ~ 3.0 |
179
- | 3 | Wire consumer | 2 | 2 | 1.0 ~ 2.0 |
180
- ```
181
-
182
- Use the template's Effort Sizing Criteria values without redefining them. Allocate a task's range across selected stages in `stepCount` proportion: round every stage except the last to 0.5 day and let the last absorb the remainder. The stage ranges must sum to the task range, and finite task ranges must sum to the displayed total. XXL, missing, and complete tasks contribute no forward total.
183
-
184
- An unrepresentable half-day allocation is a validation error. Do not substitute a fallback allocation algorithm; revise the task sizing or selected-stage scope.
185
-
186
- ## Gantt contract
187
-
188
- Render a plain fenced relative-day Gantt when the selected stages have finite day ranges. Every forward row is identified by stage and repeats its Work Breakdown range:
189
-
190
- ```text
191
- DEV-1 Stage 2 ████ days=2.0~3.0
192
- DEV-1 Stage 3 ████ days=1.0~2.0
193
- ```
194
-
195
- A row is labelled `Stage <n>` when exactly one task is scheduled and `<TASK-ID> Stage <n>` when more than one is; the annotation is `days=<lower>~<upper>`. Spell the stage out — `S1` is an opaque code that costs the reader a lookup and saves five characters. Do not emit a row for a completed, unselected, missing, or unknown stage. Bar length is arithmetic: one column is half a day, so a bar runs `lower / 0.5` filled cells `█` then `(upper - lower) / 0.5` open cells `░`.
196
-
197
- Skip the chart only when no forward task has a finite day signal, and state the concrete reason. Do not use calendar dates, Mermaid, PlantUML, Graphviz, or another graph language.
198
-
199
- A host-supplied directive or the first `## Directive` in the configured analysis material may override the render/skip heuristic, but it cannot override stage selection, dependency closure, or validated day arithmetic.
200
-
201
- ## Client-facing boundary
202
-
203
- Assume the team has the required authority. Exclude approval waits, permission checks, stakeholder coordination, decision checklists, and internal blocker codes from forward engineering work. Gantt duration and totals represent engineering work only.
204
-
205
- Resolve opaque source-report codes inline or in the optional final Glossary. Decision-item codes do not belong in the schedule.
206
-
207
- ## Two validation gates
208
-
209
- Run both gates against the same draft and temporary selection contract.
210
-
211
- 1. Deterministic gate:
212
-
213
- ```bash
214
- python3 ~/.okstra/lib/validators/validate-schedule.py <draft> --selection-json <selection>
215
- ```
216
-
217
- 2. Only after that command passes, create a new `.okstra/agent-invocations/schedule-verification/<invocation-id>.instructions.md` with the draft, selection JSON, and checks, but not the lead's reasoning. Run `okstra agent-prompt materialize --purpose schedule-verification --audience schedule-verifier ...` and verify the returned metadata before dispatch. A native host call uses the verified prompt body plus `hostModelValue`; a deterministic provider process uses `okstra worker-dispatch`, the prompt path, and `modelExecutionValue`. The verifier checks narrative coherence, phase rationale, executable order, engineering-only scope, and contradictions with the structured rows.
218
-
219
- Capture the raw verifier return under the purpose directory's `.tmp/`, then run `okstra agent-prompt materialize-result`, `complete`, and `verify-completion` in order. Parse only the verified `returnedBody`; an inline or unverified response cannot pass the narrative gate.
220
-
221
- If either gate finds a defect, revise the same draft in place and restart from the deterministic gate. Allow at most two revision rounds across both gates. Never publish a draft that has not passed both gates in that order.
222
-
223
- After both gates pass:
224
-
225
- 1. Move the same draft content to the collision-safe final path; do not re-render it.
226
- 2. Re-read it and run the installed format validator on the final path, falling back to the repository validator only when needed.
227
- 3. Delete the temporary selection file only after final validation passes.
228
- 4. Report completion in Korean with the output path, included/excluded counts, finite total range, and lead-plus-verifier mode.
229
-
230
- ## Forbidden patterns
231
-
232
- - Guessing a planning report after `stage-map` reports a structured error.
233
- - Treating `workStatus` as the detailed schedule status.
234
- - Scheduling completed or non-selected stages.
235
- - Publishing a Gantt row without its `Stage <n>` label and `days=` range, or abbreviating that label to `S<n>`.
236
- - Drawing stage order in `## Task Dependency Graph` — that graph carries cross-task edges only; stage order lives in the Work Breakdown's `Depends On` column.
237
- - Dispatching narrative validation before deterministic `--selection-json` validation.
238
- - Re-rendering after validation instead of promoting the same draft.
239
- - Deleting the selection contract before final validation.
240
- - Publishing after more than two unsuccessful revision rounds.
@@ -1,167 +0,0 @@
1
- # okstra-setup AI Manual
2
-
3
- ## Source
4
-
5
- - Skill source: [`skills/okstra-setup/SKILL.md`](../../../skills/okstra-setup/SKILL.md)
6
- - CLI registry: [`src/cli-registry.mjs`](../../../src/cli-registry.mjs)
7
- - project registration impl: `src/commands/lifecycle/setup.mjs`
8
- - install/ensure-installed impl: `src/commands/lifecycle/install.mjs`
9
-
10
- ## Purpose
11
-
12
- `okstra-setup` handles two things.
13
-
14
- 1. Machine-level runtime install: `~/.okstra/`, `~/.claude/skills/`, `~/.claude/agents/`
15
- 2. Project-level registration: `<PROJECT_ROOT>/.okstra/project.json`
16
-
17
- It is not a day-to-day task-running skill. If a task is already prepared, route to `okstra-run` or `okstra-inspect`.
18
-
19
- ## When to use
20
-
21
- Use it when:
22
-
23
- - The user asks for "okstra setup", "setup okstra", "initialize okstra", "okstra init", "first time setup".
24
- - `~/.okstra/version` is missing or looks stale.
25
- - The current project has no `.okstra/project.json`.
26
-
27
- Do not use it when:
28
-
29
- - The user wants to start a task run. Use `okstra-run` instead.
30
- - The user wants to view status/history/report. Use `okstra-inspect` instead.
31
- - `.okstra/project.json` already exists and only day-to-day usage is needed.
32
-
33
- ## Pre-run checks
34
-
35
- Tell the user that Node 18+ and Python 3.10+ are required. If it is unclear whether the current working directory is inside the project that will host the okstra metadata, confirm the project root first.
36
-
37
- Install command:
38
-
39
- ```bash
40
- npx -y okstra@latest install --runtime claude-code
41
- ```
42
-
43
- Treat this command as idempotent. Even if already installed, re-run it to align the runtime, skill, and agent payload with the current package version (agent payload = the `~/.claude/agents/<worker>.md` worker definitions + the `~/.okstra/installed-agents.json` manifest). If it fails, show the stderr to the user verbatim. Do not fall back to the legacy `okstra-install.sh`.
44
-
45
- ## Command invocation rule
46
-
47
- After `okstra install`, every subsequent command must begin with the literal `okstra` token.
48
-
49
- Allowed forms:
50
-
51
- ```bash
52
- okstra preflight
53
- okstra setup --yes --project-root /abs/project --project-id my-project
54
- okstra doctor --runtime claude-code
55
- ```
56
-
57
- Forms to avoid:
58
-
59
- - `export PYTHONPATH=...`
60
- - `eval "$(okstra paths --shell)"`
61
- - shell variables like `$PROJECT_ROOT`
62
- - `$(...)` command substitution
63
- - okstra calls wrapped in `if`, `&&`, `||`
64
-
65
- Because `okstra <subcmd>` bootstraps its own Python path, do not use `okstra paths --shell` in this skill. If you need the okstra home, run `okstra paths --field home` as a separate call and carry the printed path.
66
-
67
- ## Project root resolution
68
-
69
- Run first:
70
-
71
- ```bash
72
- okstra preflight
73
- ```
74
-
75
- Handle the result:
76
-
77
- - `Okstra preflight: ready`: already a registered project. Show `Project root`, `Project JSON`, and `Project ID` to the user and confirm whether to keep it.
78
- - `Okstra preflight: failed` with `Stage: resolve`: get an absolute project root from the user and re-run `okstra preflight --cwd /abs/path`.
79
- - `Okstra preflight: failed` with `Stage: project_json_missing`: proceed with the normal create path.
80
- - any other failure stage: show `Reason` verbatim and follow `Recovery`.
81
-
82
- ## Create or keep project.json
83
-
84
- If `<PROJECT_ROOT>/.okstra/project.json` exists, show `projectId` and `projectRoot` and confirm whether to keep or overwrite. The default is keep. Changing the existing `projectId` requires deleting the file, so do not overwrite automatically.
85
-
86
- If the file does not exist, ask for a project id. The answer must be non-empty and contain at least one alphanumeric character. Calling `okstra setup --yes` with an empty value fails, so re-ask.
87
-
88
- Create command:
89
-
90
- ```bash
91
- okstra setup --yes --project-root /abs/project --project-id my-project
92
- ```
93
-
94
- `okstra setup` also refreshes the okstra-managed citation-guidance block in
95
- `<PROJECT_ROOT>/CLAUDE.md` and `AGENTS.md` when those files already exist (it never
96
- creates them). The block tells agents not to carry okstra-internal references — report
97
- section numbers, `C-NNN` clarification ids, run/stage ids, `.okstra/...` paths — into
98
- writing that is not an okstra report, where the reader cannot resolve them. The command
99
- reports the files it touched in its JSON `citationGuidance` array; a failure there is a
100
- `warning:` line, not a non-zero exit. Tell the user which guidance files were updated so
101
- they can review the appended block.
102
-
103
- ## Optional configuration
104
-
105
- Per the source, Step 3.5 is optional configuration performed only when the user explicitly wants it — read `references/project-config.md` in the skill directory for the detailed procedure. If the defaults are enough, skip it and go to doctor.
106
-
107
- Optional settings:
108
-
109
- - `worktreeSyncDirs`: a list of project-relative directories to symlink into the task worktree. The default is `.project-docs`, `.scratch`, `graphify-out`, `.claude`.
110
- - `qaCommands`: check-only lint/format/typecheck/test commands the implementation verifier runs.
111
- - `qaEnv`: the replica/test DB, local app URL, env file, and surface patterns
112
- Okstra uses to attempt Tier 3 automatically; real DB/API verification remains
113
- a user-owned advisory when the environment is unavailable or the result is
114
- non-PASS.
115
- - PR body template: `okstra config set pr-template-path "<path>" --scope project|global`
116
- - final report language: `okstra config set report-language <language-tag> --scope project` (`en`, `ko`, `fr`, `pt-BR`, …; default `en`)
117
- - `architecture.style`: the project's declared architecture — `hexagonal`,
118
- `layered`, or `none` (default `none` when absent, unrecognized, or
119
- unreadable). `okstra setup` never writes it; hand-add it to `project.json`
120
- and the upsert preserves it. Declaring a style promotes that architecture's
121
- placement rules from advisory to a binding planning + verification
122
- constraint — under `hexagonal` an extracted variation point must be a port,
123
- under `layered` the dependency direction is worker-judged with no machine
124
- check. See section F of `references/project-config.md`.
125
- - `reviewRulePacks`: absolute paths to the project's own review rule packs (a
126
- team PR-review skill's `SKILL.md`). Without a declaration a pack applies only
127
- when the task brief cites its exact path; declared here it applies to every
128
- run, and the two channels are a union. Read by `implementation-planning`, the
129
- executor preflight, the implementation verifier, and `final-verification`.
130
- `okstra setup` never writes it. `okstra doctor --phase <phase>` fails when a
131
- declared path is not readable. See section G of
132
- `references/project-config.md`.
133
-
134
- If `qaCommands.cmd` contains a token implying mutation, the verifier refuses it. The actual authority for the deny-list is `scripts/okstra_ctl/qa_commands.py`.
135
-
136
- ## Automatic Claude settings symlink
137
-
138
- `okstra setup` provisions `<PROJECT_ROOT>/.claude/settings.local.json` as a symlink to `~/.okstra/templates/settings.local.json`. If an existing regular file is present, it backs it up as `.bak.<timestamp>` and then places the symlink. If a failure message appears, the user must manually merge the existing project-specific rules.
139
-
140
- ## Verify
141
-
142
- Run last:
143
-
144
- ```bash
145
- okstra doctor --runtime claude-code
146
- ```
147
-
148
- If every check is OK, report setup complete. If any check fails, show the output verbatim and let the user decide whether to reinstall or skip.
149
-
150
- ## Completion message
151
-
152
- Keep it short and include the following.
153
-
154
- - runtime location: `~/.okstra` (also show the `version stamp: x.y.z` line from the install summary)
155
- - project metadata: `<PROJECT_ROOT>/.okstra/project.json`
156
- - `projectId`
157
- - next step: `/okstra-run`
158
-
159
- ## Common failure handling
160
-
161
- | Symptom | Handling |
162
- |---|---|
163
- | `command not found: npx` | Point to installing Node 18+ |
164
- | `--project-id is required` | Re-ask for the project id and re-run with a non-empty value |
165
- | `projectId mismatch` | Confirm with the user which id is canonical. Do not delete automatically |
166
- | `.okstra/` write EACCES | Explain the ownership/writability problem |
167
- | `.claude/settings.local.json` symlink warning | Show the backup file and symlink state to the user and guide a manual merge |
@@ -1,29 +0,0 @@
1
- # okstra-usage AI Manual
2
-
3
- ## Purpose
4
-
5
- Use `okstra-usage` for a project-wide historical resource snapshot. It is not a
6
- single-task inspection (`okstra-inspect`) and not a cross-task status/report
7
- digest (`okstra-rollup`).
8
-
9
- ## Call
10
-
11
- Run preflight, resolve a positive day count (default 30), then call exactly once:
12
-
13
- ```bash
14
- okstra usage-report --days 30 --project-root <projectRoot> --text
15
- ```
16
-
17
- ## Render contract
18
-
19
- Render the numbered `By task type` rows and fixed totals without recomputing them.
20
- Show Runs, returned collection rate as Coverage, Raw tokens, Billable, Cost, CPU, and Wall. Surface numbered
21
- unavailable-reason and unmatched-model rows. Missing usage is excluded data, not
22
- zero usage.
23
-
24
- ## Boundaries
25
-
26
- - One task's elapsed/context detail: `okstra-inspect`.
27
- - Task-group/project status and report digest: `okstra-rollup`.
28
- - HTML dashboards, budgets, forecasts, and task/model/worker drill-downs are not
29
- part of this MVP.
@@ -1,72 +0,0 @@
1
- # okstra-user-response AI Manual
2
-
3
- ## Sources
4
-
5
- - Skill source: [`skills/okstra-user-response/SKILL.md`](../../../skills/okstra-user-response/SKILL.md)
6
- - Response core: [`scripts/okstra_ctl/user_response.py`](../../../scripts/okstra_ctl/user_response.py)
7
-
8
- ## Purpose
9
-
10
- `okstra-user-response` answers unresolved `C-*` clarification items and records explicit plan decisions without hand-editing a report or sidecar. The user selects or writes every answer. Publication changes only the user-owned `runs/<task-type>/user-responses/` sidecar.
11
-
12
- The model-facing reads are fixed text. Do not use the automation-compatible JSON reads to drive a conversation. Do not open the final-report record directly.
13
-
14
- | Command | Purpose |
15
- |---|---|
16
- | `okstra user-response list-view --home <home> --project <projectId> --limit 3` | List tasks that still need clarification answers or a plan decision. |
17
- | `okstra user-response show-view --report <reportPath> --project-root <projectRoot>` | Show open questions, choices, impact, why asked, linked plan items, cited artifacts, approval context, plan candidates, and current state after validating project ownership. |
18
- | `okstra user-response begin --report <reportPath> --task-key <taskKey>` | Open a typed transaction and return an opaque id. |
19
- | `okstra user-response answer ...` | Add one validated answer to the draft. |
20
- | `okstra user-response plan-decision ...` | Record an explicit plan decision. |
21
- | `okstra user-response legacy-report-authoring ...` | Record contract 2.0 report-authoring permission. |
22
- | `okstra user-response finalize --transaction <transaction>` | Merge and atomically publish the sidecar. |
23
-
24
- The legacy `list` and `show` JSON commands remain for automation compatibility. They are not model-facing reads.
25
-
26
- ## Flow
27
-
28
- 1. Run `okstra preflight --runtime <host-runtime>` for the current harness. On `Okstra preflight: failed`, show `Reason` and `Recovery`, then stop. On `Okstra preflight: ready`, carry `Project root`, `Project ID`, `Runtime`, and `Relay contract`, then run `okstra paths --field home`.
29
- 2. Read the relay `Wizard interaction relay` JSON. When `native-single` is available and the option count fits `nativeLimits`, call `interactions.native-single.function` (`AskUserQuestion` / `ask_user_question` / `request_user_input` from that field). Do not print a numbered list in chat while the native tool is available. Emit the question as the last thing in that turn; text emitted after the call renders below the question. Otherwise render a numbered Markdown list. Do not substitute one host function name for another. Copy the view's `Picker:` `- Label:` / `Description:` pairs into that function in that order. Do not rebuild labels from the `Options:` dump. `--option-number` is the 1-based `Option N:` index, which is the same order as `Picker:`. The HTML report's `<select>` uses the same `option.answer` values. Pass only the `list-view` `Picker:` rows, the report `Picker:` rows, or the two confirmation labels. Do not append `Enter directly`. Claude Other, Grok `z`, and Codex's free-form row are `Enters an answer`; on a numbered list, so is a next message that is not a listed label or its 1-based number. Do not ask a second question for the custom value.
30
- 3. Select a task from `list-view` through that host picker. A host free-text row or unmatched next message is the report path or task key.
31
- 4. Read only `show-view --report <reportPath> --project-root <projectRoot>` for report facts. The view also prints `Why asked`, `Linked plan items`, and `Cited artifacts`.
32
- 5. Read every cited `path:line` under the project root and every linked plan-item definition before asking. Do not search beyond that list. Investigation explains; it never changes `options[]`.
33
- 6. Ask one open clarification at a time in the user's language through the host picker. The question body is why, what is already decided, the fork, and what stays blocked. Do not lead with `Kind`, `Blocks`, `Expected form`, or `C-NNN`. Keep the row id in parentheses at the end.
34
- 7. Echo the complete response and confirm through the host picker (`Record as shown` / `Change an answer`). Do not ask them to type `confirmed`.
35
- 8. Begin the transaction, add answers and decisions, then finalize it.
36
-
37
- Each `options[]` row displays `{role, answer, rationale, scopeImpact, addedWork, directionChange, disposition}`. Contract 3.0 additionally displays `reach`, `scopeEffects`, and row-level `approvalContext`. Option descriptions use this order: If you pick this (`addedWork`). What it reverses (`directionChange`). Scope (`reach` or `scopeImpact`). Why it is on the board (`rationale`). If the view says `not stated in the report`, repeat that text and never invent a value. A quote from a cited file may follow those axes; it does not replace them.
38
-
39
- When the user selects a predefined option, pass only the fixed view's one-based option number. Python resolves that option's `disposition`, answer, reach, and scope effects from the validated report:
40
-
41
- ```bash
42
- okstra user-response answer --transaction <transaction> --clarification-id <C-NNN> --kind <kind> --option-number <N>
43
- ```
44
-
45
- Every value, rationale, and reason body file must be a regular file under `<projectRoot>/.okstra/tmp/user-response/`; external files and symbolic links are rejected. For direct input, write the user's exact words there and use the mutually exclusive direct form:
46
-
47
- ```bash
48
- okstra user-response answer --transaction <transaction> --clarification-id <C-NNN> --kind <kind> --disposition <answer|reframe> --value-file <value.md> [--rationale-file <rationale.md>]
49
- ```
50
-
51
- Record a plan decision only when the user states it explicitly. Any reason file stays in that same temporary directory:
52
-
53
- ```bash
54
- okstra user-response plan-decision --transaction <transaction> --status approved [--implementation-option <candidate-name>]
55
- okstra user-response plan-decision --transaction <transaction> --status <revision-requested|rejected> --reason-file <reason.md>
56
- ```
57
-
58
- The implementation option must match a candidate printed by `show-view`. A report with no open clarification can still require this decision.
59
-
60
- Contract 2.0 alone supports legacy report-authoring permission. Its reason file stays in that same temporary directory:
61
-
62
- ```bash
63
- okstra user-response legacy-report-authoring --transaction <transaction> --status <approved|denied> --reason-file <reason.md>
64
- ```
65
-
66
- Finish with:
67
-
68
- ```bash
69
- okstra user-response finalize --transaction <transaction>
70
- ```
71
-
72
- Do not decode the transaction id. Do not inspect transaction state. Do not hand-edit report records, rendered reports, or sidecars.
@@ -1,128 +0,0 @@
1
- ---
2
- name: claude-worker
3
- description: |
4
- Use this agent when dispatched as a Claude worker for okstra cross-verification tasks. Provides broad reasoning analysis with direct MCP tool access (no CLI fallback).
5
-
6
- <example>
7
- Context: The okstra skill is orchestrating a multi-agent cross-verification run.
8
- user: "okstra this task bundle"
9
- assistant: "Spawning claude-worker agent to get Claude analysis."
10
- <commentary>The okstra skill dispatches this agent as part of the worker roster.</commentary>
11
- </example>
12
-
13
- <example>
14
- Context: A cross-verification needs Claude perspective on broad reasoning.
15
- user: "cross verify this implementation"
16
- assistant: "Running claude-worker for independent Claude analysis."
17
- <commentary>Cross-verification tasks require independent AI worker outputs.</commentary>
18
- </example>
19
- model: inherit
20
- color: blue
21
- tools: ["Bash", "Read", "Write", "Edit", "Glob", "Grep", "TodoWrite", "WebFetch", "WebSearch"]
22
- ---
23
-
24
- This is the Claude host-native execution adapter for a materialized Okstra
25
- invocation. The final prompt's duty contract owns the role boundary,
26
- responsibility, and prohibited actions. This file owns Claude tool usage,
27
- artifact persistence, and liveness procedure only. Do not shell out to another
28
- model CLI, and refuse a dispatch whose prompt has no adjacent verified
29
- invocation metadata. Consume the stored `executionLabel`; do not infer a role
30
- from the provider name. `lead` is a compatibility alias for `leader`.
31
-
32
- ## Execution Rules
33
-
34
- 1. The summon message you were invoked with carries the absolute path of your dispatch prompt document — it is not the prompt itself. Read that document COMPLETELY before doing anything else: the `Read` tool returns up to 2000 lines per call, so continue with `offset` until you have seen the last line of the file. Every later rule that says "the lead prompt" means that document. If the summon carries no path, immediately return:
35
- `CLAUDE_PROMPT_PATH_MISSING: dispatch prompt document path was not provided`
36
-
37
- 2. Extract the absolute `Project Root` from the lead prompt (look for a line starting with `**Project Root:**` or `Project Root:`). If it is missing, immediately return:
38
- `CLAUDE_PROJECT_ROOT_MISSING: absolute Project Root was not provided in the lead prompt`
39
-
40
- 3. The document already lives at its own `Assigned worker prompt history path:` — the lead persisted and verified it before dispatch. Do NOT rewrite it. Check that the path you were summoned with matches that header (resolve a relative header value against `Project Root`); on a mismatch, return:
41
- `CLAUDE_PROMPT_PATH_MISSING: summon path does not match the document's assigned prompt history path`
42
-
43
- 4. Anchor all file operations to the absolute `Project Root` from the lead prompt. Use absolute paths — do NOT rely on inherited cwd. Never use `cd` to change directory.
44
- - **Executor exception (implementation phase only):** when this worker is dispatched as the `Executor` and the lead prompt provides an `EXECUTOR_WORKTREE_PATH` that differs from the session's inherited cwd, cwd-sensitive Bash commands (`cargo *`, `npm *`, `pnpm *`, `bun *`, `pytest`, `make *`, `go *`, language-toolchain test/build commands) MUST be prefixed with `cd <EXECUTOR_WORKTREE_PATH> && ` in the same Bash invocation — e.g. `cd /Users/.../worktrees/foo && cargo test -p bar`. Do NOT wrap the whole thing in `bash -lc "..."` or `bash -c "..."`; pass the chained command directly to the Bash tool so the leading `cd` token remains visible to the permission layer. The `cd` is scoped to the single Bash subshell and does not mutate the session's shell state, so this does not conflict with the "never use cd" rule above (which prevents the worker from drifting the session cwd across calls).
45
- - **Executor coding-conventions preflight (BLOCKING, before your first `Edit` / `Write`):** when dispatched as the `Executor`, you MUST run the coding-conventions preflight defined in the executor sidecar (`prompts/profiles/_implementation-executor.md` → "Pre-implementation context exploration") before writing any code. Use this worker prompt's `**Coding preflight pack:**` anchor header; read that pack's `overview.md` and `clean-code.md`, then follow the routed pack's language → framework → architecture stages, iterating every rule and loading every matching resource (for example `frameworks/node-server.md` and `architectures/hexagonal.md` when their conditions match). The preflight pack is a runtime resource, not an auto-invoked skill; read the files via the Read tool by absolute path.
46
- - **Executor post-write gates (BLOCKING, before your final commit / before claiming done):** the same dispatch prompt carries two gate blocks the lead appends after the preflight — `Pre-commit diff review sweep` (`prompts/profiles/_implementation-diff-review.md`) and `Implementation self-check` (`prompts/profiles/_implementation-self-check.md`). Execute both and record their coverage lines in your worker result exactly as the blocks specify. The codex/antigravity wrappers refuse to launch when an executor prompt lacks these blocks (`*_POSTWRITE_GATE_MISSING`); this worker runs in-process with no wrapper gate, so the contract lands on you directly — if either block is missing, record a typed `tool-failure` through `okstra error-log append-observed` and tell the lead to re-dispatch with the blocks included.
47
- - **Verifier QA-gate exception:** verifier roles MAY use the same `cd <WORKTREE> && <cmd>` shape when executing project-declared `qaCommands` (lint / format / typecheck / test) from `project.json`, since those commands are cwd-sensitive by nature. Outside the QA gate, verifiers still read with absolute paths only — do NOT use `cd` for file inspection.
48
- - **Shell commands must not be able to prompt:** this worker runs inside the host session, so its Bash calls see the user's own shell, where `cp`, `mv`, and `rm` are commonly aliased to their `-i` form. The confirmation that alias raises has nobody to answer it and the dispatch hangs until it is killed. Invoke these as `command cp` / `command mv` / `command rm` — alias expansion is skipped and the tool behaves exactly as written. Do not reach for `-f` instead; it also changes what the tool does on failure (`rm -f` reports success on a path that never existed).
49
- - **No extra chaining beyond `cd && cmd`:** the permission matcher only allows the exact two-segment shape `cd <PATH> && <single-command>`. Do NOT append additional pipes, semicolons, redirects, or `&&` chains — e.g. `cd ... && cargo test ... 2>&1 | tail -20; echo "exit:$?"` will trigger a permission prompt every dispatch because the trailing `| tail`, `; echo`, and `2>&1` tokens disqualify the prefix match against `Bash(cargo:*)`. Let Claude Code capture the full stdout/stderr and exit code natively — do not post-process with `tail`, `head`, or `echo "exit:$?"`. If output truncation is genuinely needed, run the command first and read the result in a separate tool call.
50
-
51
- 5. **MCP usage**: The canonical list of MCP servers and tools available for this run lives in the analysis packet's `Available MCP Servers` section. If the section is absent or says none, treat MCP as unavailable for this run; never infer tools from host configuration. When the task requires inspection of an external system covered by a listed server, call the tool directly by name (e.g. `mcp__<server>__<tool>`). Do NOT shell out via `claude --mcp-cli call ...` or run the tool name as a Bash command — those are not valid invocation paths. If a server you need is not listed, record `MCP not available for this run` in your worker output rather than guessing a tool name.
52
-
53
- 6. If your dispatch prompt carries a `**Phase 1.5 Grilling Log:** <abs-path>` anchor header (the lead injects it only on `improvement-discovery` runs), the file it points to is the authoritative scope and lens definition. Read it at the absolute path from the anchor — do NOT synthesize the path from `<RUN_DIR>`. Use its `Resolved scope` and `Resolved lenses` blocks and do NOT re-interpret the brief's raw `scan-scope` / `priority-lenses` fields. Findings that violate the resolved lens whitelist or scope are rejected by `validators/validate_improvement_report.py`.
54
-
55
- ## Required Reading Before Any Analysis
56
-
57
- Before producing any output, you MUST:
58
-
59
- 1. Extract `**Worker Preamble Path:**` and `**Worker Error Contract Path:**` from the lead prompt and Read both selected files end-to-end with one full-file `Read` each. The preamble owns audience procedure; the error contract owns typed error-log write rules. Never replace the selected path with a hard-coded analysis preamble.
60
- 2. Read every primary input file the lead enumerated under `## Inputs` (or equivalent heading) end-to-end, following the selected preamble. Analysis workers normally receive `analysis-packet.md`; implementation workers receive their role sidecar and approved deliverable inputs.
61
- 3. When the prompt carries `**Evidence ledger:** required-v1`, follow the selected preamble's `Evidence read ledger` procedure for every claim-evidence file you open. Do not invent a separate audit-row format here.
62
-
63
- **Heartbeat — write the audit sidecar EARLY and APPEND per stage (BLOCKING).** This worker runs as an in-process Agent, a cmux surface, or a CLI wrapper subprocess, so the lead has no `BashOutput`-style liveness signal while it waits for your return — the audit sidecar is the only signal that survives a silent hang.
64
-
65
- - **Where:** the absolute path in `**Audit sidecar path:**`.
66
- - **Start (before the per-file reads):** immediately after extracting `Project Root` and the assigned paths, `Write` just the heading line (`# Claude Worker Audit — <task-key>`) plus one `- PROGRESS: started <ISO-8601-UTC>` line.
67
- - **Append per stage** (`Edit` or heredoc `>>`): `read-<filename>`, `analysis-start`, `findings-draft-start`, `findings-draft-complete`, `write-result-start`.
68
- - **Cadence MUST NOT exceed 5 minutes:** if a single analysis stage runs longer, emit a `- PROGRESS: in-stage:<stage> <ISO-8601-UTC>` line. A 5-minute-stale sidecar mtime is the canonical "this worker has hung" signal for the operator.
69
- - **Enforcement:** the Phase 7 validator (`validate_session_conformance.py`) parses these `- PROGRESS:` lines post-hoc and fails the run when the first stage is not `started`, `write-result-start` is missing despite an existing result file, timestamps regress/unparse, or consecutive lines are more than 5 minutes (+60s grace) apart.
70
-
71
- ## Worker Output Structure
72
-
73
- Follow the output contract selected for your audience. Analysis workers use the analysis preamble's sections 1–5 plus optional Section 6; implementation executor/verifier workers use the implementation preamble plus their role sidecar. Set `workerId: "claude"`.
74
-
75
- ## Stop Condition (BLOCKING)
76
-
77
- When Lead dispatches you with `run_in_background: true`, its `Agent()` call returns `Spawned successfully` **immediately** and does NOT block on your completion — Lead detects your completion by self-scheduled polling of your worker-results file (see `team-contract` "Worker-completion detection"). Therefore you MUST write your worker-results file at the canonical Result Path before returning: that file's appearance is the ONLY completion signal Lead uses. Lingering after your worker-results file is on disk extends Phase 4 wall-clock time for the entire run and delays convergence. Be deliberate about stopping.
78
-
79
- After your `Write` to the assigned worker-results file (path provided by Lead as `**Result Path:**` — the canonical anchor header defined in `team-contract` "Worker Prompt Composition" — or derived under `runs/<task-type>/worker-results/claude-worker-<task-type>-<seq>.md`) succeeds:
80
-
81
- 1. Return your final assistant message **immediately**. Begin every return with your model identity, per the preamble §"Return message to the lead", then the status line — for an analysis dispatch:
82
- ```
83
- **Model:** Claude worker, <modelExecutionValue>
84
- Worker results written to <abs path>. Sections 1–5 complete. Findings: <n>.
85
- ```
86
- The `**Model:**` line precedes whatever you return — analysis status above, or a convergence reverify verdict summary.
87
- 2. Do NOT perform additional `Read`, `Grep`, `Glob`, MCP, or self-review tool calls after the file is written.
88
- 3. Do NOT rewrite the worker-results file with `Write` more than once. If a correction is genuinely required, perform a single `Edit` and then return immediately.
89
- 4. The only exception is recording a `tool-failure` with the typed error-log command when a post-Write failure is itself the failure being reported — return immediately after that command.
90
-
91
- **Enforced:** `validators/validate-run.py` `validate_team_state` fails a run whose worker carries a terminal status with no saved result file at its assigned Result Path (and no saved prompt history at its assigned prompt path).
92
-
93
- If you find yourself thinking "let me double-check section 3" or "I should read one more file to be safer" after the Write succeeded — stop. Convergence (Phase 5.5) and the Report writer worker (Phase 6) will reconcile gaps across all three workers; over-investing in single-worker depth at the expense of returning quickly is a net loss for the run.
94
-
95
- ## Error reporting
96
-
97
- Record your own tool failures per the file selected by `**Worker Error Contract Path:**`: extract `**Errors log path:**` from the dispatch prompt (return `CLAUDE_WORKER_ERRORS_PATH_MISSING` without proceeding if absent), then invoke its typed `okstra error-log append-observed` command. This worker has no external CLI, so MCP and Bash failures use the same typed protocol.
98
-
99
- ## Notes
100
-
101
- - Return error messages as-is on failure.
102
- - Do not summarize or modify your own analysis output beyond the structured sections above.
103
-
104
- ## Stage evidence emission (BLOCKING, implementation task only)
105
-
106
- When this run's `task_type` is `implementation` and you are acting as the **Executor**, after the Stage Validation `post` commands all return exit code 0 you MUST emit a single JSON document matching `docs/superpowers/specs/2026-05-20-implementation-planning-multi-stage-design.md` §3.2:
107
-
108
- ```json
109
- {
110
- "schemaVersion": 1,
111
- "sourcePlanPath": "<approved-plan path>",
112
- "stageNumber": <int>,
113
- "stageTitle": "<from Stage Map>",
114
- "completedAt": "<ISO-8601 with tz>",
115
- "stageCommitRange": { "base": "<sha>", "head": "<sha>" },
116
- "filesChanged": ["<rel/path>", "..."],
117
- "newIdentifiers": ["<name>", "..."],
118
- "stepResults": [{"step": <int>, "status": "done", "commit": "<sha>"}],
119
- "validationsPassed": ["<label>", "..."],
120
- "notes": []
121
- }
122
- ```
123
-
124
- Emit this as a fenced ```json``` block in your worker result under the heading `### Stage Carry Evidence`. The host-native Okstra lead is responsible for persisting the block as `runs/<impl-task-key>/carry/stage-<N>.json` — you do not write the file yourself.
125
-
126
- This applies only when `task_type` is `implementation`. For other task types, skip this block entirely.
127
-
128
- **Enforced:** `scripts/okstra_ctl/implementation_outcome.py` `_load_carry` / `_carry_passed` read the persisted `carry/stage-<N>.json`; a stage with no carry block never reaches `done`, and `validators/validate_session_conformance.py` `_check_progress_checkpoints` requires the `phase-5-stage-complete` line the lead can only write by parsing this block.