okstra 0.147.0 → 0.148.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 (116) hide show
  1. package/README.md +21 -7
  2. package/docs/architecture/storage-model.md +34 -61
  3. package/docs/architecture.md +51 -49
  4. package/docs/cli.md +38 -21
  5. package/docs/for-ai/skills/okstra-run.md +13 -34
  6. package/docs/performance-improvement-plan-v2.md +2 -2
  7. package/docs/pr-template-usage.md +1 -1
  8. package/docs/project-structure-overview.md +10 -8
  9. package/docs/task-process/README.md +4 -4
  10. package/docs/task-process/common-flow.md +12 -12
  11. package/docs/task-process/final-verification.md +2 -2
  12. package/docs/task-process/implementation.md +1 -1
  13. package/docs/task-process/release-handoff.md +1 -1
  14. package/package.json +2 -2
  15. package/runtime/BUILD.json +2 -2
  16. package/runtime/agents/workers/antigravity-worker.md +2 -2
  17. package/runtime/agents/workers/claude-worker.md +1 -1
  18. package/runtime/agents/workers/codex-worker.md +2 -2
  19. package/runtime/agents/workers/grok-worker.md +256 -0
  20. package/runtime/agents/workers/kimi-worker.md +256 -0
  21. package/runtime/agents/workers/report-writer-worker.md +2 -2
  22. package/runtime/bin/lib/okstra/cli.sh +13 -1
  23. package/runtime/bin/lib/okstra/globals.sh +3 -0
  24. package/runtime/bin/lib/okstra/usage.sh +17 -12
  25. package/runtime/bin/okstra-grok-exec.sh +5 -0
  26. package/runtime/bin/okstra-kimi-exec.sh +5 -0
  27. package/runtime/bin/okstra-provider-exec.py +235 -0
  28. package/runtime/bin/okstra.sh +3 -0
  29. package/runtime/prompts/lead/adapters/antigravity.md +48 -0
  30. package/runtime/prompts/lead/adapters/claude-code.md +13 -11
  31. package/runtime/prompts/lead/adapters/codex.md +7 -7
  32. package/runtime/prompts/lead/okstra-lead-contract.md +1 -1
  33. package/runtime/prompts/lead/report-writer.md +1 -1
  34. package/runtime/prompts/profiles/_coding-conventions-preflight.md +1 -1
  35. package/runtime/prompts/profiles/_common-contract.md +4 -4
  36. package/runtime/prompts/profiles/_implementation-deliverable.md +2 -2
  37. package/runtime/prompts/profiles/_implementation-diff-review.md +1 -1
  38. package/runtime/prompts/profiles/_implementation-executor.md +12 -12
  39. package/runtime/prompts/profiles/_implementation-self-check.md +4 -4
  40. package/runtime/prompts/profiles/_implementation-verifier.md +3 -3
  41. package/runtime/prompts/profiles/change-impact-analysis.md +2 -0
  42. package/runtime/prompts/profiles/error-analysis.md +2 -0
  43. package/runtime/prompts/profiles/feature-analysis.md +2 -0
  44. package/runtime/prompts/profiles/final-verification.md +3 -1
  45. package/runtime/prompts/profiles/forbidden-actions.json +4 -4
  46. package/runtime/prompts/profiles/implementation-planning.md +3 -1
  47. package/runtime/prompts/profiles/implementation.md +2 -2
  48. package/runtime/prompts/profiles/improvement-discovery.md +3 -1
  49. package/runtime/prompts/profiles/project-analysis.md +2 -0
  50. package/runtime/prompts/profiles/release-handoff.md +7 -7
  51. package/runtime/prompts/profiles/requirements-discovery.md +2 -0
  52. package/runtime/prompts/wizard/prompts.ko.json +9 -1
  53. package/runtime/python/okstra_ctl/codex_dispatch.py +68 -87
  54. package/runtime/python/okstra_ctl/dispatch_core.py +4 -22
  55. package/runtime/python/okstra_ctl/lead_events.py +1 -1
  56. package/runtime/python/okstra_ctl/lead_runtime.py +13 -2
  57. package/runtime/python/okstra_ctl/models.py +156 -8
  58. package/runtime/python/okstra_ctl/path_hints.py +9 -25
  59. package/runtime/python/okstra_ctl/paths.py +1 -1
  60. package/runtime/python/okstra_ctl/render.py +172 -74
  61. package/runtime/python/okstra_ctl/report_html/common.py +38 -2
  62. package/runtime/python/okstra_ctl/report_html/filters.py +104 -0
  63. package/runtime/python/okstra_ctl/report_html/render.py +7 -0
  64. package/runtime/python/okstra_ctl/report_html/view_models/change_impact_analysis.py +2 -1
  65. package/runtime/python/okstra_ctl/report_html/view_models/error_analysis.py +2 -1
  66. package/runtime/python/okstra_ctl/report_html/view_models/feature_analysis.py +2 -1
  67. package/runtime/python/okstra_ctl/report_html/view_models/final_verification.py +2 -1
  68. package/runtime/python/okstra_ctl/report_html/view_models/implementation.py +2 -1
  69. package/runtime/python/okstra_ctl/report_html/view_models/implementation_planning.py +2 -1
  70. package/runtime/python/okstra_ctl/report_html/view_models/improvement_discovery.py +2 -1
  71. package/runtime/python/okstra_ctl/report_html/view_models/release_handoff.py +2 -1
  72. package/runtime/python/okstra_ctl/report_html/view_models/requirements_discovery.py +2 -1
  73. package/runtime/python/okstra_ctl/report_html/visualizations.py +32 -6
  74. package/runtime/python/okstra_ctl/run.py +264 -45
  75. package/runtime/python/okstra_ctl/runner_resolution.py +103 -0
  76. package/runtime/python/okstra_ctl/team.py +2 -7
  77. package/runtime/python/okstra_ctl/wizard.py +194 -21
  78. package/runtime/python/okstra_ctl/worker_artifacts.py +46 -0
  79. package/runtime/python/okstra_ctl/workers.py +3 -1
  80. package/runtime/python/okstra_ctl/workflow.py +4 -2
  81. package/runtime/python/okstra_token_usage/__init__.py +1 -0
  82. package/runtime/python/okstra_token_usage/collect.py +32 -23
  83. package/runtime/python/okstra_token_usage/pricing.py +35 -3
  84. package/runtime/schemas/final-report-v2.0.schema.json +2 -2
  85. package/runtime/skills/okstra-run/SKILL.md +31 -42
  86. package/runtime/templates/prd/pr-body.template.md +1 -1
  87. package/runtime/templates/reports/html/assets/base.css +6 -3
  88. package/runtime/templates/reports/html/base.template.html +22 -8
  89. package/runtime/templates/reports/html/macros/forms.html +2 -2
  90. package/runtime/templates/reports/html/macros/layout.html +5 -5
  91. package/runtime/templates/reports/html/macros/visualizations.html +11 -1
  92. package/runtime/templates/reports/html/tasks/change-impact-analysis.template.html +11 -11
  93. package/runtime/templates/reports/html/tasks/error-analysis.template.html +12 -12
  94. package/runtime/templates/reports/html/tasks/feature-analysis.template.html +9 -9
  95. package/runtime/templates/reports/html/tasks/final-verification.template.html +7 -7
  96. package/runtime/templates/reports/html/tasks/implementation-planning.template.html +12 -12
  97. package/runtime/templates/reports/html/tasks/implementation.template.html +7 -7
  98. package/runtime/templates/reports/html/tasks/improvement-discovery.template.html +6 -6
  99. package/runtime/templates/reports/html/tasks/project-analysis.template.html +11 -11
  100. package/runtime/templates/reports/html/tasks/release-handoff.template.html +5 -5
  101. package/runtime/templates/reports/html/tasks/requirements-discovery.template.html +8 -8
  102. package/runtime/templates/reports/report.js +21 -4
  103. package/runtime/templates/reports/settings.template.json +4 -0
  104. package/runtime/templates/reports/task-brief.template.md +7 -7
  105. package/runtime/validators/validate-run.py +11 -6
  106. package/runtime/validators/validate_session_conformance.py +2 -1
  107. package/src/cli-registry.mjs +4 -4
  108. package/src/commands/execute/codex-dispatch.mjs +7 -10
  109. package/src/commands/execute/render-bundle.mjs +3 -3
  110. package/src/commands/execute/run.mjs +17 -52
  111. package/src/commands/execute/wizard.mjs +4 -1
  112. package/src/commands/lifecycle/doctor.mjs +6 -3
  113. package/src/commands/lifecycle/install.mjs +31 -8
  114. package/src/lib/runtime-manifest.mjs +1 -1
  115. package/src/lib/runtime-resolver.mjs +2 -2
  116. package/src/lib/worker-agent-render.mjs +50 -0
package/README.md CHANGED
@@ -20,7 +20,7 @@
20
20
  <a id="purpose"></a>
21
21
  ## 1. Purpose
22
22
 
23
- `okstra` is a **structured task runner that cross-verifies work inside Claude Code using a lead + worker model**. A Claude lead drives phase progression and dispatches independent analysis workers—**Claude and Codex by default**, with Antigravity added only when explicitly requested—plus a dedicated report writer for final synthesis.
23
+ `okstra` is a **host-aware, multi-provider task runner that cross-verifies work with a lead + worker model**. The current Claude Code, Codex, or Antigravity host supplies the native lead session; every other selected provider runs through its registered CLI wrapper. Claude remains the compatibility default policy, not the owner of the lifecycle.
24
24
 
25
25
  The design rests on three principles:
26
26
 
@@ -28,6 +28,20 @@ The design rests on three principles:
28
28
  - **Persistent task identity**: a stable `<project-id>/<task-group>/<task-id>` task key carries context across phases, sessions, and model upgrades.
29
29
  - **Enforced lead/worker contract**: output schemas and validation procedures are bound to `templates/` + `validators/`, and the worker roster is fixed per phase.
30
30
 
31
+ Role assignments are persisted separately from the host runtime, but the lead provider is always derived from that runtime:
32
+
33
+ | Provider | Native host | CLI wrapper | Public roles |
34
+ |---|---|---|---|
35
+ | Claude | Claude Code | `okstra-claude-exec.sh` | lead, analysis, implementation, report writer |
36
+ | Codex | Codex | `okstra-codex-exec.sh` | lead, analysis, implementation, report writer |
37
+ | Antigravity | Antigravity CLI | `okstra-antigravity-exec.sh` | lead, analysis, and implementation |
38
+ | Grok | none | `okstra-grok-exec.sh` | read-only analyser and critic |
39
+ | Kimi | none | `okstra-kimi-exec.sh` | read-only analyser and critic |
40
+
41
+ Grok and Kimi are intentionally read-only in this release. Their wrappers, model aliases, installation, diagnostics, and usage-pricing paths are integrated, but a real authenticated local invocation still depends on the corresponding CLI being installed and configured.
42
+
43
+ The next direct-CLI candidates are Mistral Vibe and Qwen Code. DeepSeek V4, GLM-5.2, and MiniMax M2.7 remain API-adapter candidates because their current official coding-agent execution surfaces do not fit Okstra's wrapper contract as directly. Newly published provider models are exposed only after the corresponding local CLI reports them; this keeps model discovery separate from marketing availability.
44
+
31
45
  okstra is **not** a one-shot code review tool. It is for work that **spans multiple phases, needs input from multiple agents, and feeds each phase's output into the next phase**.
32
46
 
33
47
  <a id="structure"></a>
@@ -63,7 +77,7 @@ During `prepack`, `tools/build.mjs` rebuilds `runtime/` from `scripts/`, `skills
63
77
  ~/.okstra/ runtime home, created by `okstra install`
64
78
  ├── version package version stamp
65
79
  ├── lib/python/ okstra_project/, okstra_ctl/, okstra_token_usage/, lib/
66
- ├── bin/ okstra.sh, codex-exec, antigravity-exec, ...
80
+ ├── bin/ okstra.sh and Claude/Codex/Antigravity/Grok/Kimi wrappers
67
81
  ├── templates/ report assets and settings templates
68
82
  ├── prompts/ lead operating contracts (prompts/lead/*) + coding-preflight resource pack
69
83
  ├── installed-runtimes.json installed runtime adapter manifest
@@ -82,7 +96,7 @@ During `prepack`, `tools/build.mjs` rebuilds `runtime/` from `scripts/`, `skills
82
96
  └── okstra-*/SKILL.md 8 user-facing skills only (setup/brief/run/memory/inspect/schedule/container/manager)
83
97
 
84
98
  ~/.claude/agents/ automatically discovered by Claude Code (when `~/.claude` exists)
85
- └── {claude,codex,antigravity,report-writer}-worker.md worker subagent definitions
99
+ └── {claude,codex,antigravity,grok,kimi,report-writer}-worker.md worker definitions
86
100
  (required for Claude Code multi-agent dispatch)
87
101
 
88
102
  <project-root>/.okstra/
@@ -195,7 +209,7 @@ To start a task outside a Claude Code session:
195
209
  --task-brief ./brief.md
196
210
  ```
197
211
 
198
- `feature-analysis` is intentionally omitted from the standalone shell example. Start it with `/okstra-run`: the wizard collects its required feature target and passes that value through the internal Node render boundary. Standalone `okstra.sh` accepts neither `--analysis-target` nor `--evidence-inputs`.
212
+ `feature-analysis` is intentionally omitted from the standalone shell example. Start it with the in-host `okstra-run` skill: the wizard collects its required feature target and passes that value through the internal Node render boundary. Standalone `okstra.sh` accepts neither `--analysis-target` nor `--evidence-inputs`.
199
213
 
200
214
  This starts a new `claude` process in the lead role. For the complete argument list, see `okstra.sh --help` or [`docs/cli.md`](docs/cli.md).
201
215
 
@@ -208,10 +222,10 @@ Notable flags added in 0.7.0 / 0.8.0:
208
222
  Major workflow changes added to `main` after 0.8.0:
209
223
 
210
224
  - **Automatic isolated worktrees for every task type** — During preparation, `okstra-ctl` runs `git worktree add ~/.okstra/worktrees/<project-id>/<task-group-segment>/<task-id-segment>` once per task key to create an isolated working tree and a `<work-category-namespace>/<task-id-segment>` branch (for example, `feature/dev-9436` or `fix/dev-7311`). The user chooses the base ref with `--base-ref`, using the same choices as the release-handoff PR base picker: `main`, `dev`, `staging`, `preprod`, `prod`, or a custom value. It is required in the first phase; the okstra-run skill collects it through `AskUserQuestion`, while non-interactive callers must pass `--base-ref` explicitly. Later **non-`implementation`** phases for the same task key (`requirements-discovery` → `error-analysis` → `implementation-planning` → `final-verification` → `release-handoff`) reuse the same path and branch. `implementation` runs are **stage-isolated**: each run executes one stage in its own `.../<task>/stage-<N>/` worktree on a `<work-category-namespace>/<task>-s<N>` branch, so independent stages with `depends-on (none)` can run concurrently without sharing a tree. The registry reserves both task keys and **stage keys** with flock. Provisioning is skipped when the caller is already in another worktree or project_root is not a Git repository; stage isolation degrades to a flat path in those cases. Manual cleanup: `git worktree remove <path>` → `git branch -D <branch>` plus release/removal of the registry entry. Details: [`docs/architecture.md`](docs/architecture.md), in the *Task type* section, and [`docs/cli.md#--executor`](docs/cli.md#--executor).
211
- - **`release-handoff` lifecycle phase** — runs immediately after `final-verification` returns `verdict=accepted`. A Claude worker drafts candidate commit messages and a PR body, then the lead uses `AskUserQuestion` to ask, in order, for (1) an action (`commit only` / `commit + PR` / `skip`), (2) a PR base branch (`staging` / `preprod` / `prod` / `main` / `dev` / custom input), and (3) message handling (`use as-is` / `edit then proceed` / `cancel`). Only the Git/GitHub CLI commands selected through those menus are run. Force pushes, direct pushes to the base branch, hook bypasses (`--no-verify`), and release publication (`gh release`, `npm publish`, and similar commands) are prohibited. This phase does not edit source code. Profile: [`prompts/profiles/release-handoff.md`](prompts/profiles/release-handoff.md).
225
+ - **`release-handoff` lifecycle phase** — runs immediately after `final-verification` returns `verdict=accepted`. The current Okstra lead drafts the candidate messages and PR body inline, then uses the selected host adapter's user-prompt operation for the delivery choices. Only the Git/GitHub CLI commands selected through those menus are run. Force pushes, direct pushes to the base branch, hook bypasses (`--no-verify`), and release publication (`gh release`, `npm publish`, and similar commands) are prohibited. This phase does not edit source code. Profile: [`prompts/profiles/release-handoff.md`](prompts/profiles/release-handoff.md).
212
226
  - **Configurable PR body template** (release-handoff) — PR bodies are populated from a Markdown template selected in this order: one-time override (`--pr-template-path` or the okstra-run Step 6 prompt) → `prTemplatePath` in `<project_root>/.okstra/project.json` → `prTemplatePath` in `~/.okstra/config.json` → the skill default at `~/.claude/skills/templates/prd/pr-body.template.md`. Register a template with `okstra config set pr-template-path <path> [--scope project|global]`; project scope accepts a path relative to the project root, while global scope requires an absolute path or a path beginning with `~/`. `okstra config get pr-template-path --scope all` prints every scoped value and the effective winner. The default template contains `## Summary`, `## Changes`, `## Test plan`, and `## Linked issues`, plus HTML comment guidance that the lead removes immediately before PR creation.
213
227
  - **Profile worker-roster validation** — `--workers <csv>` and the okstra-run Step 6 worker prompt accept only the worker IDs declared in the selected profile's `Required workers:` block. Requesting a worker absent from the profile—for example, `codex` or `antigravity` for `release-handoff`—fails with a clear error, and the interactive prompt shows only workers accepted by that profile.
214
- - **Experimental Codex lead adapter** — `okstra codex-run <render-bundle args...>` prepares a `leadRuntime=codex` task bundle without launching Claude Code. `okstra codex-dispatch --project-root <dir> --run-manifest <path>` then executes the supported Codex-side roster subset: Codex and Antigravity CLI workers by default, with a Codex report writer available through `--enable-codex-report-writer --report-writer-codex-model <model>`. A successful Codex report-writer dispatch performs token/cost substitution, HTML view rendering, follow-up stub generation, and run validation in order. It shares the Claude lead path's manifest and schema and does not clone the project into a Codex-specific fork.
228
+ - **Host-aware lead adapters** — the same `okstra-run` skill resolves Claude Code to `leadRuntime=claude-code`, Codex to `leadRuntime=codex`, Antigravity CLI to `leadRuntime=antigravity`, and another explicit host to `external`. Claude Code keeps Claude assignments native, Codex keeps Codex assignments native, and Antigravity keeps Antigravity assignments native; every other selected provider runs through its registered CLI wrapper. The lead provider is derived from the host and cannot be replaced independently. `leadAssignment` and every `workerAssignments[]` row record provider, model, and `runner`. `okstra codex-run` and `okstra codex-dispatch` remain low-level artifact/dispatch commands.
215
229
  - **Multi-stage `implementation-planning` / `implementation`** — `implementation-planning` always produces a Stage Map and N stage sections. Each stage has no more than six steps, and stages with `depends-on (none)` can be implemented concurrently in separate `implementation` runs. Each `implementation` invocation runs a single stage, selected with `--stage <auto|N>`, and creates an evidence sidecar at `carry/stage-<N>.json` for automatic carry-in to the next stage. The `implementation-planning` run directory accumulates `consumers.jsonl` reverse links that record which run consumed each stage.
216
230
  - **AI-prepared design preparation (implementation-planning → implementation)** — `implementation-planning` detects which stages need design input (domain contract, DB/table schema, external interface, transaction/consistency, transformation mapping, lifecycle, rollout/observability, manual user test) and has the AI draft a concrete proposal first, instead of handing the user an empty design document. Each item is assessed as `ready`, `provisional`, `blocked`, or `not-applicable`; a simple task may declare `no-design-inputs`. Phase 7 materializes an Okstra-owned request under `design-prep-requests/`, and `okstra design-prep <list|show|write>` or the okstra-run wizard records the confirmed answer as an **append-only** revision under `design-prep-inputs/`—neither path ever edits the approved planning snapshot. Before creating its worktree, `implementation` resolves only the items its selected stage cites in `stageRefs`: safe `provisional` assumptions are injected into the executor prompt so work proceeds, while an unsafe open decision makes only that stage wait or replan. A markerless legacy plan continues with a `legacy-unassessed` warning. Storage authorities: [`docs/architecture/storage-model.md`](docs/architecture/storage-model.md). CLI: [`docs/cli.md#okstra-design-prep`](docs/cli.md#okstra-design-prep).
217
231
  - **Phase 6 plan-body verification (implementation-planning only)** — Immediately after the report-writer worker drafts the final report and before the user approval gate, the lead performs one post-verification round. It extracts `P-Opt-*`, `P-Step-*`, `P-Dep-*`, `P-Val-*`, and `P-Rb-*` plan items from the synthesized `## 5.5` implementation plan deliverables and asks every analyzer worker for an `AGREE`, `DISAGREE(a-e)`, or `SUPPLEMENT` verdict. The aggregate result is `passed`, `passed-with-dissent`, `blocked-by-disagreement`, or `aborted-non-result`. The frontmatter `approved` field is always published as `false`; a blocking result keeps it false and becomes a row in `## 1. Clarification Items`. For fast iteration, opt out with `--no-plan-verification`. Contract details: the "Plan-body verification mode" section of [`prompts/lead/convergence.md`](prompts/lead/convergence.md) and [`docs/cli.md#--no-plan-verification`](docs/cli.md#--no-plan-verification).
@@ -227,7 +241,7 @@ Major workflow changes added to `main` after 0.8.0:
227
241
  | Command | Purpose |
228
242
  |---|---|
229
243
  | `npx -y okstra@latest paths` | Print runtime paths (`--field <name>` or `--shell`) |
230
- | `npx -y okstra@latest doctor [--runtime claude-code\|codex\|all] [--phase <phase>]` | Diagnose runtime, skills, and Python imports. `codex` excludes Claude skill checks; `--phase` adds readiness checks for implementation, final-verification, release-handoff, and improvement-discovery |
244
+ | `npx -y okstra@latest doctor [--runtime claude-code\|codex\|antigravity\|external\|all] [--phase <phase>]` | Diagnose runtime, skills, and Python imports. `codex`, `antigravity`, and `external` exclude Claude skill checks; `--phase` adds readiness checks for implementation, final-verification, release-handoff, and improvement-discovery |
231
245
  | `npx -y okstra@latest ensure-installed` | Run an idempotent check and automatically reinstall stale assets (skills call this internally) |
232
246
  | `npx -y okstra@latest setup --project-id <id>` | Register the current project in `.okstra/project.json` |
233
247
  | `npx -y okstra@latest check-project` | Verify that the current project was registered with `setup` |
@@ -11,54 +11,27 @@ Files created by `okstra` are stored in the following three areas according to t
11
11
  This is the task's primary directory.
12
12
  The task manifest, task index, instruction set, runs, and history are collected under this root.
13
13
 
14
- ```text
15
- <target-project>/.okstra/tasks/<task-group>/<task-id>/
16
- ├── task-manifest.json
17
- ├── task-index.md
18
- ├── instruction-set/
19
- │ ├── analysis-profile.md
20
- │ ├── analysis-packet.md # analysis worker primary compact input
21
- │ ├── analysis-material.md
22
- │ ├── reference-expectations.md
23
- │ ├── task-brief.md
24
- │ ├── verification-target.md # final-verification only; canonical target snapshot
25
- │ ├── directive.txt # optional (mirrors --directive)
26
- │ ├── final-report-schema.json
27
- │ ├── final-report-template.md
28
- │ └── claude-execution-prompt.md
29
- ├── runs/
30
- │ └── <task-type>/
31
- │ ├── manifests/
32
- │ │ └── run-manifest-<task-type>-<seq>.json
33
- │ ├── state/
34
- │ │ └── team-state-<task-type>-<seq>.json
35
- │ ├── prompts/
36
- │ │ ├── claude-execution-prompt-<task-type>-<seq>.md
37
- │ │ ├── claude-worker-prompt-<task-type>-<seq>.md
38
- │ │ ├── codex-worker-prompt-<task-type>-<seq>.md
39
- │ │ ├── antigravity-worker-prompt-<task-type>-<seq>.md
40
- │ │ └── report-writer-worker-prompt-<task-type>-<seq>.md
41
- │ ├── reports/
42
- │ │ ├── final-report-<task-type>-<seq>.data.json
43
- │ │ ├── final-report-<task-type>-<seq>.md
44
- │ │ └── final-report-<task-type>-<seq>.html
45
- │ ├── design-prep-requests/ # implementation-planning only; deterministic Okstra-owned drafts
46
- │ ├── design-prep-inputs/ # implementation-planning only; append-only user/wizard responses
47
- │ ├── status/
48
- │ │ └── final-<task-type>-<seq>.status
49
- │ ├── sessions/
50
- │ │ └── claude-resume-<task-type>-<seq>.sh
51
- │ ├── logs/
52
- │ │ └── errors-<task-type>-<seq>.jsonl # optional, lead-only writer
53
- │ └── worker-results/
54
- ├── history/
55
- │ ├── timeline.json
56
- │ └── fix-cycles.jsonl # optional, created only when entering a fix cycle (append-only)
57
- ├── recap/
58
- │ └── recap-log.jsonl # optional, append-only before/after summaries and Q&A for recap (other artifacts unchanged)
59
- └── notes/
60
- └── <slug>-<YYYY-MM-DD>.md # optional, agent-authored notes written by `okstra recap note` (evidence/decision-draft/analysis); inert — never auto-read by a run, fed forward only via --clarification-response
61
- ```
14
+ - `<target-project>/.okstra/tasks/<task-group>/<task-id>/`
15
+ - `task-manifest.json`
16
+ - `task-index.md`
17
+ - `instruction-set/`
18
+ - `analysis-profile.md`, `analysis-packet.md`, `analysis-material.md`, `reference-expectations.md`, `task-brief.md`
19
+ - `verification-target.md` for final verification and optional `directive.txt`
20
+ - `final-report-schema.json`, `final-report-template.md`
21
+ - canonical `lead-execution-prompt.md` plus the `claude-execution-prompt.md` compatibility alias
22
+ - `runs/<task-type>/`
23
+ - `manifests/run-manifest-<task-type>-<seq>.json`
24
+ - `state/team-state-<task-type>-<seq>.json`
25
+ - `prompts/lead-execution-prompt-<task-type>-<seq>.md` and selected `<worker>-worker-prompt-<task-type>-<seq>.md` files
26
+ - `reports/final-report-<task-type>-<seq>.{data.json,md,html}`
27
+ - implementation-planning-only `design-prep-requests/` and `design-prep-inputs/`
28
+ - `status/final-<task-type>-<seq>.status`
29
+ - Claude compatibility launcher sessions under `sessions/claude-resume-<task-type>-<seq>.sh`
30
+ - optional lead-written `logs/errors-<task-type>-<seq>.jsonl`
31
+ - `worker-results/`
32
+ - `history/timeline.json` and optional append-only `history/fix-cycles.jsonl`
33
+ - optional append-only `recap/recap-log.jsonl`
34
+ - optional inert agent notes under `notes/<slug>-<YYYY-MM-DD>.md`; a run reads them only when explicitly carried through `--clarification-response`
62
35
 
63
36
  Actual directory segments may be normalized into slugs to create safe paths.
64
37
  However, the logical task key always retains the original input values in the form `project-id:task-group:task-id`.
@@ -76,10 +49,10 @@ The representative files below are all relative to the resolved run directory (`
76
49
 
77
50
  - `manifests/run-manifest-<task-type>-<seq>.json`
78
51
  - `state/team-state-<task-type>-<seq>.json`
79
- - `prompts/claude-execution-prompt-<task-type>-<seq>.md`
52
+ - `prompts/lead-execution-prompt-<task-type>-<seq>.md` *(canonical; the Claude-named snapshot remains a compatibility alias)*
80
53
  - `prompts/<worker>-worker-prompt-<task-type>-<seq>.md`
81
54
 
82
- Unless `--render-only` is used, the handed-off Claude session typically adds the following result files to the current run.
55
+ After the host-native lead takes over, the lead and its assigned workers add the following result files to the current run.
83
56
  - `sessions/claude-resume-<task-type>-<seq>.sh`
84
57
  - `reports/final-report-<task-type>-<seq>.data.json` *(schema v2 source of truth for both audiences; schema v1 remains readable for compatibility)*
85
58
  - `reports/final-report-<task-type>-<seq>.md`
@@ -102,7 +75,7 @@ Design-preparation storage has three separate authorities:
102
75
 
103
76
  The resolver selects the highest unique revision whose assessment fingerprint still matches the approved snapshot. Duplicate revision numbers and stale fingerprints are skipped with warnings rather than granted authority. A markerless legacy plan has no sidecars to migrate: it proceeds with the `legacy-unassessed` warning. This compatibility path does not rewrite its report.
104
77
  The final result files are not created by saving worker stdout. The report writer writes `final-report-<task-type>-<seq>.data.json`; Phase 7 derives the Markdown and HTML siblings deterministically. New bundles use `schemas/final-report-v2.0.schema.json` and `templates/reports/final-report-v2.template.md`: AI handoff Markdown and task-specific human HTML are rendered independently from the same v2 data.json. Existing schema v1 data uses `schemas/final-report-v1.0.schema.json` and the legacy `templates/reports/final-report.template.md` compatibility path. Rendering never modifies the source data or a pre-existing Markdown input.
105
- By contrast, `sessions/claude-resume-<task-type>-<seq>.sh` is an interruption-recovery helper that `okstra` creates before launching Claude.
78
+ For the standalone Claude launcher, `sessions/claude-resume-<task-type>-<seq>.sh` remains an interruption-recovery compatibility helper. In-host Codex runs use host task continuity plus the generic `leadSession` manifest identity.
106
79
 
107
80
  The resolved run directory collects execution history. It divides its contents into type-specific subdirectories such as `manifests/`, `state/`, `prompts/`, `reports/`, `status/`, `sessions/`, and `worker-results/`, then distinguishes each run-level artifact and result file with a `-<task-type>-<seq>` suffix (a three-digit, zero-padded per-category counter, such as `001` or `002`).
108
81
  Worker prompt history is retained not under `/tmp`, but always as a canonical artifact under `prompts/` for the current run.
@@ -168,7 +141,7 @@ Path segments are normalized into slugs. If a slug would be empty, as can happen
168
141
 
169
142
  ## Task manifest contract
170
143
 
171
- `task-manifest.json` is the canonical metadata file Claude uses to understand task continuity.
144
+ `task-manifest.json` is the canonical metadata file the active Okstra lead uses to understand task continuity.
172
145
  As a general rule, this manifest records the absolute `projectRoot` path only once and expresses the remaining generated paths as project-relative fields whenever possible.
173
146
 
174
147
  Examples of key fields:
@@ -205,12 +178,13 @@ Examples of key fields:
205
178
  - `inputs`
206
179
  - `artifacts`
207
180
  - `resultContract`
208
- - `claudeSession`
181
+ - `leadSession`
182
+ - `claudeSession` *(Claude-host compatibility only)*
209
183
  - `fixCycles` *(derived summary — `{count, openCycleId, latest:{cycle, symptom, targetReport, closedAt}}`; recalculated on every prepare)*
210
184
 
211
185
  This manifest serves the following purposes.
212
186
 
213
- - Let Claude understand task continuity before reading the brief
187
+ - Let the active lead understand task continuity before reading the brief
214
188
  - Establish which files should be read first
215
189
  - Establish how config files and deployment manifests should be interpreted against expected values
216
190
  - Establish the task key under which results accumulate
@@ -248,9 +222,7 @@ Each execution records the current run contract in the resolved `<run-dir>/manif
248
222
  `state/active-run-context-<task-type>-<seq>.json` is also the compact intake for lead Phase 1 starting with schemaVersion `2.0`. It stores only `identity` + `pathHints` and worker identities instead of repeated path strings, and the deterministic dispatcher hydrates it into the legacy active context shape when reading it.
249
223
 
250
224
  The path fields in `manifests/run-manifest-<task-type>-<seq>.json` are still stored as paths relative to the target project root for validator, team dispatch, and inspect compatibility.
251
- Immediately after `okstra` starts the Claude handoff, the current run status is usually recorded as `in-progress`.
252
- Claude then continues with saving the final results and updating status.
253
- Before launch, `okstra` also preallocates a session ID and creates, under the same run's `sessions/` directory, `claude-resume-<task-type>-<seq>.sh`.
225
+ An in-host prepare records the run as `prepared` and the task as `ready-for-lead`; the current native host session then owns execution. The standalone Claude launcher records `in-progress` after preparing its compatibility resume script.
254
226
 
255
227
  Main contents:
256
228
 
@@ -263,7 +235,8 @@ Main contents:
263
235
  - related tasks
264
236
  - selected workers
265
237
  - worker model assignments
266
- - claude session id
238
+ - lead session id and accounting mode
239
+ - Claude session id only on the Claude compatibility path
267
240
  - resume command relative path
268
241
  - expected report relative path
269
242
  - expected status relative path
@@ -297,9 +270,9 @@ The history generally includes the following.
297
270
  - `fixCycleId` *(only when attached to a fix cycle; field omitted otherwise)*
298
271
  Reruns of the same task type reuse the same resolved run directory family. Non-stage runs use `runs/<task-type>/`, while `implementation` and single-stage `final-verification` runs use `runs/<task-type>/stage-<N>/`. Sequence-specific artifacts live beneath that resolved run directory, and each execution accumulates as a separate history entry because `run-manifest-<task-type>-<seq>.json` and related artifact paths are separated by per-category sequence suffixes (`<task-type>-<seq>`). The cross-category identifier is the manifest's `runDateTimeSegment` ISO timestamp field.
299
272
 
300
- ## Claude operating contract
273
+ ## Lead operating contract
301
274
 
302
- After `okstra` runs, Claude should follow this default sequence when reading the current task.
275
+ After `okstra` prepares a run, the host-native Okstra lead follows this default sequence when reading the current task.
303
276
 
304
277
  1. If task browsing or task-id disambiguation is required, first read `.okstra/discovery/task-catalog.json`.
305
278
  2. If the current task key or task path is not specified, read `.okstra/discovery/latest-task.json` as the current-task pointer.
@@ -310,7 +283,7 @@ After `okstra` runs, Claude should follow this default sequence when reading the
310
283
  6. Read `task-index.md` only when a quick summary is needed.
311
284
  7. Lazily read `analysis-material.md`, `reference-expectations.md`, `task-brief.md`, and `final-report-template.md` when the packet is insufficient or when source citations/report writing require them.
312
285
  8. Consult `history/timeline.json` and previous run results if necessary.
313
- 9. As `Claude lead`, organize roles according to the current run's worker roster (`Claude worker`, `Codex worker`, and `Report writer worker` by default; `Antigravity worker` only when explicitly included).
286
+ 9. As `Okstra lead`, organize roles from `workerAssignments[]`. The host provider stays native; Claude, Codex, Antigravity, Grok, and Kimi assignments use their persisted `native-session` or `cli-wrapper` runner.
314
287
  10. Save each selected worker prompt under the current run's `prompts/` directory at the assigned worker prompt history path before dispatching the worker.
315
288
  Every selected initial analyser receives the same full-core semantic body for its task, including final-verification. Dispatch and Phase 7 validate the same normalized equality policy; implementation executor, report-writer, and `-reverify-r<N>-` prompts are separate audiences.
316
289
  11. In convergence Round 0, the lead groups findings by semantic meaning and ticket set, then writes `state/convergence-groups-<task-type>-<seq>.json`. The deterministic engine seeds the working queue and generates each roster-aware reverify plan; lightweight reverify reads only that persisted batch and its embedded evidence.
@@ -8,7 +8,7 @@
8
8
 
9
9
  ## At a glance
10
10
 
11
- `okstra` is a **task bundle preparation tool** for Claude Code's cross-verification workflow. It is not a single-file review tool. Instead, it organizes task briefs, profiles, prompts, run history, and project-level discovery metadata around a stable task key so Claude can reliably orchestrate lead and worker agents.
11
+ `okstra` is a **host-aware task bundle preparation tool** for multi-provider cross-verification. It is not a single-file review tool. Instead, it organizes task briefs, profiles, prompts, run history, and project-level discovery metadata around a stable task key so the current host-native lead can orchestrate provider workers consistently.
12
12
 
13
13
  Its core capabilities at a glance are:
14
14
 
@@ -16,13 +16,13 @@ Its core capabilities at a glance are:
16
16
  - **Profiles by task type**: Loads standard task-type profiles such as `requirements-discovery`, `error-analysis`, `implementation-planning`, `implementation`, `final-verification`, and `release-handoff` to render the instruction set.
17
17
  - **Run lifecycle**: Non-stage runs use `runs/<task-type>/` as the run directory, while `implementation` and single-stage `final-verification` use `runs/<task-type>/stage-<N>/`. Manifests, prompts, state, reports, sessions, worker results, and logs accumulate beneath the resolved run directory, and the filename suffix `-<task-type>-<seq>` separates reruns of the same phase.
18
18
  - **Single python authority**: All prepare wiring—resolving profiles/workers/models, computing paths, rendering, and central record_start—is concentrated in a single function, [`okstra_ctl.run.prepare_task_bundle()`](../scripts/okstra_ctl/run.py). `okstra.sh` and the `okstra-run` skill are thin callers of that same function and do not pass state through environment variables. Task identity, paths, and workflow state are recalculated from authoritative on-disk files every time.
19
- - **Claude handoff (two modes)**: (a) the traditional mode, where `okstra.sh` launches a new `claude` process; and (b) in-session mode, where the `okstra-run` skill prepares the task in the current Claude session and hands the lead role to that session. Both use the outputs of `prepare_task_bundle`, including the instruction set, unchanged.
20
- - **Required team contract**: The `Required workers:` block in each phase profile is authoritative for the roster. General analysis phases use Claude/Codex analyzers plus a report writer by default, while Antigravity is included only when allowed by both the profile and `--workers`. Lead-oriented phases such as `release-handoff` have separate rosters.
21
- - **User-home install + project-local task bundles**: One `npx okstra@latest install` command installs the runtime (`~/.okstra/{lib/python, bin, templates, prompts}`) and installs public skills to `~/.agents/skills/` by default. If `~/.claude` exists, it also installs Claude skills and four worker agent definitions (`~/.claude/agents/*-worker.md`). Only user entry-point skills are exposed in the skill list; lead/support operating contracts are installed as runtime resources under `~/.okstra/prompts/` and are not discoverable as skills. Global conversation memory is stored separately from projects under `~/.okstra/memory-book/`. Task bundles and discovery metadata are stored under `.okstra/` in the target project. **In addition, `<PROJECT_ROOT>/.claude/settings.local.json` is provisioned as a symlink to `~/.okstra/templates/settings.local.json`** (`okstra setup` or `okstra-ctl` prepare manages it idempotently; if a regular file already existed, it is preserved as `.bak.<timestamp>` before replacement).
19
+ - **Host-aware handoff**: Claude Code, Codex, and Antigravity keep their current native session as the lead. The standalone compatibility launcher still starts a new `claude` process by default, while the external adapter uses registered CLI wrappers. Every path consumes the same `prepare_task_bundle` outputs.
20
+ - **Required team contract**: The `Required workers:` block in each phase profile is authoritative for the roster. General analysis phases use Claude/Codex analysers plus a report writer by default, while Antigravity, Grok, and Kimi are included only when allowed by both the profile and `--workers`. Lead-oriented phases such as `release-handoff` have separate rosters.
21
+ - **User-home install + project-local task bundles**: One `npx okstra@latest install` command installs the runtime (`~/.okstra/{lib/python, bin, templates, prompts}`) and installs public skills to `~/.agents/skills/` by default. If `~/.claude` exists, it also installs Claude skills and six worker agent definitions (`~/.claude/agents/*-worker.md`). Only user entry-point skills are exposed in the skill list; lead/support operating contracts are installed as runtime resources under `~/.okstra/prompts/` and are not discoverable as skills. Global conversation memory is stored separately from projects under `~/.okstra/memory-book/`. Task bundles and discovery metadata are stored under `.okstra/` in the target project. **In addition, `<PROJECT_ROOT>/.claude/settings.local.json` is provisioned as a symlink to `~/.okstra/templates/settings.local.json`** (`okstra setup` or `okstra-ctl` prepare manages it idempotently; if a regular file already existed, it is preserved as `.bak.<timestamp>` before replacement).
22
22
  - **Resume and clarification**: Supports resuming the same task and responding to follow-up questions from the lead through `--task-key`, `--resume-clarification`, and `--clarification-response`.
23
23
  - **Dual-audience derived views and telemetry**: For schema v2, derives AI handoff Markdown and task-specific human-facing HTML independently from the same v2 data.json. Schema v1 and quick Markdown reports keep their compatibility renderer. Worker error sidecars, wrapper log sidecars, and token-usage/cost accounting remain separate audit inputs.
24
24
 
25
- Claude lead owns judgment policy and worker orchestration. `okstra` focuses on preparing the structured input bundle and output skeleton Claude needs to work reliably.
25
+ The host-native Okstra lead owns judgment policy and worker orchestration. `okstra` prepares one runtime-neutral task bundle and resolves every provider assignment to either the current native session or a registered CLI wrapper.
26
26
 
27
27
  ## Table of contents
28
28
 
@@ -30,8 +30,8 @@ Claude lead owns judgment policy and worker orchestration. `okstra` focuses on p
30
30
  - [What okstra does](#what-okstra-does)
31
31
  - [Runtime assets vs support assets](#runtime-assets-vs-support-assets)
32
32
  - [Architecture: python authority + thin callers](#architecture-python-authority--thin-callers)
33
- - [Claude execution behavior](#claude-execution-behavior)
34
- - [Claude prompt contract](#claude-prompt-contract)
33
+ - [Host runtime execution behavior](#host-runtime-execution-behavior)
34
+ - [Lead prompt contract](#lead-prompt-contract)
35
35
  - [Required team contract](#required-team-contract)
36
36
  - [Stable task identity](#stable-task-identity)
37
37
  - [Project self-registration](#project-self-registration)
@@ -42,7 +42,7 @@ Claude lead owns judgment policy and worker orchestration. `okstra` focuses on p
42
42
  - (See [cli.md](cli.md) for CLI arguments, options, and interactive input)
43
43
  - [Storage model & contracts](#storage-model--contracts) → [`architecture/storage-model.md`](architecture/storage-model.md)
44
44
  - Stable task root / per-run artifacts / `~/.okstra` indexes
45
- - Task manifest · task index · run manifest · timeline · Claude operating contract
45
+ - Task manifest · task index · run manifest · timeline · runtime-neutral operating contract
46
46
  - [Task brief usage](#task-brief-usage)
47
47
  - [Recommended workflow](#recommended-workflow)
48
48
  - [1. Write a draft](#1-write-a-draft)
@@ -68,10 +68,10 @@ Claude lead owns judgment policy and worker orchestration. `okstra` focuses on p
68
68
  ## Purpose
69
69
 
70
70
  This document is a task-key-oriented operations guide to using `okstra` in `Okstra`.
71
- Where `README.md` is the quick entry point, this document is the detailed reference for `okstra`'s execution contract, storage model, lifecycle, and Claude handoff rules.
71
+ Where `README.md` is the quick entry point, this document is the detailed reference for `okstra`'s execution contract, storage model, lifecycle, and host handoff rules.
72
72
 
73
73
  `okstra` is not a single-file review tool.
74
- `okstra` is a supporting tool that prepares stable task bundles, run history, and project-level discovery metadata so Claude Code can perform cross-verification.
74
+ `okstra` is a supporting tool that prepares stable task bundles, run history, and project-level discovery metadata so a supported host can perform cross-verification.
75
75
 
76
76
  ## What okstra does
77
77
 
@@ -80,11 +80,11 @@ okstra's prepare responsibilities are consolidated in a single Python entry poin
80
80
  - Verifies that okstra installation assets exist (`~/.agents/skills/okstra-*`, optional `~/.claude/skills/okstra-*` / `~/.claude/agents/*-worker.md`, `~/.okstra/bin/...`)
81
81
  - Self-registers `<PROJECT_ROOT>/.okstra/project.json` (or verifies that the projectId matches)
82
82
  - Loads task type → `prompts/profiles/<task-type>.md` and extracts recommended workers
83
- - Normalizes user worker/model overrides (display execution-value mapping for Claude/Codex/Antigravity/Report-writer)
83
+ - Normalizes user worker/model overrides through the provider registry (Claude, Codex, Antigravity, Grok, Kimi, and report-writer-capable providers)
84
84
  - Resolves task-brief / clarification-response paths (cwd first → PROJECT_ROOT fallback)
85
85
  - Computes the stable task root and all paths/sequences inside a per-task mutex (`~/.okstra/.locks/<task-key>.lock`), then persists them to `<run-dir>/manifests/run-context-<seq>.json`
86
86
  - Persists user input to `<run-dir>/manifests/run-inputs-<seq>.json`
87
- - Renders the instruction set (`analysis-profile.md`, `analysis-packet.md`, `analysis-material.md`, `task-brief.md`, `reference-expectations.md`, `final-report-template.md`, `final-report-schema.json`, optional `clarification-response.md`, optional `directive.txt`, final-verification-only `verification-target.md`, `claude-execution-prompt.md`) and writes a run prompt snapshot
87
+ - Renders the instruction set (`analysis-profile.md`, `analysis-packet.md`, `analysis-material.md`, `task-brief.md`, `reference-expectations.md`, `final-report-template.md`, `final-report-schema.json`, optional `clarification-response.md`, optional `directive.txt`, final-verification-only `verification-target.md`, canonical `lead-execution-prompt.md`, and its Claude-named compatibility alias) and writes a run prompt snapshot
88
88
  - Updates `task-manifest.json`, `task-index.md`, `run-manifest-*.json`, `history/timeline.json`, and `discovery/{latest-task,task-catalog}.json`
89
89
  - Writes a preassigned Claude session ID and `sessions/claude-resume-*.sh` (unless `--render-only` is used)
90
90
  - Records record_start in the central indexes (`~/.okstra/{active,recent}.jsonl`, `projects/<id>/{index.jsonl, meta.json}`)
@@ -92,9 +92,9 @@ okstra's prepare responsibilities are consolidated in a single Python entry poin
92
92
  The two callers of `prepare_task_bundle` are:
93
93
 
94
94
  1. **`scripts/okstra.sh`**: Parses and confirms CLI arguments → calls `prepare_task_bundle` → unless `--render-only` is used, launches `claude --model ... --session-id ... "$PROMPT"` via `exec`. It is a thin wrapper of about 160 lines.
95
- 2. **`okstra-run` skill**: Runs the [`okstra_ctl.wizard`](../scripts/okstra_ctl/wizard.py) state machine (`okstra wizard init|step|...` CLI) in the same Claude session to collect user input → calls `okstra render-bundle` (that is, `prepare_task_bundle(render_only=True)`) → the current session reads the rendered lead prompt and assumes the lead role. It does not launch a new Claude process. The wizard decides all branching, validation, and ordering, so the skill body is a roughly 30-line loop that displays either `AskUserQuestion` (`pick`) or a plain-text message (`text`) according to `Prompt.kind`.
95
+ 2. **`okstra-run` skill**: Runs the [`okstra_ctl.wizard`](../scripts/okstra_ctl/wizard.py) state machine (`okstra wizard init|step|...` CLI) in the current supported host to collect user input → calls `okstra render-bundle` (that is, `prepare_task_bundle(render_only=True)`) → the current session reads the rendered lead prompt and assumes the lead role. It does not launch a new provider process for the native lead. The wizard decides all branching, validation, and ordering, so the skill body displays either the host's picker (`pick`) or a plain-text message (`text`) according to `Prompt.kind`.
96
96
 
97
- The lead Claude owns judgment policy and worker orchestration. okstra's prepare stage only creates structured assets so that the lead starts with the correct input bundle and output skeleton.
97
+ The host-native Okstra lead owns judgment policy and worker orchestration. okstra's prepare stage only creates structured assets so that the lead starts with the correct input bundle and output skeleton.
98
98
 
99
99
  ## Runtime assets vs support assets
100
100
 
@@ -127,7 +127,7 @@ Runtime entry points are consolidated in Python packages. Bash and skills only c
127
127
 
128
128
  ### Bash entry points (thin)
129
129
 
130
- - [`scripts/okstra.sh`](../scripts/okstra.sh) — CLI parsing / interactive prompt / confirm-execution-plan / `prepare_task_bundle` invocation / `exec claude`.
130
+ - [`scripts/okstra.sh`](../scripts/okstra.sh) — standalone compatibility launcher: CLI parsing / interactive prompt / `prepare_task_bundle` invocation / default `exec claude`. In-host Claude Code, Codex, and Antigravity runs use `okstra-run` and keep their current native session.
131
131
  - [`scripts/lib/okstra/{cli,globals,interactive,project-resolver,usage}.sh`](../scripts/lib/okstra/) — CLI/interactive support only; contains no artifact-generation logic.
132
132
  - [`scripts/okstra-ctl.sh`](../scripts/okstra-ctl.sh) + [`scripts/lib/okstra-ctl/`](../scripts/lib/okstra-ctl/) — central control-center CLI (list / show / open / rerun / reconcile / etc.).
133
133
 
@@ -146,10 +146,11 @@ Runtime entry points are consolidated in Python packages. Bash and skills only c
146
146
  ### Skills (`skills/`) and lead resources (`prompts/`)
147
147
 
148
148
  - [`prompts/lead/okstra-lead-contract.md`](../prompts/lead/okstra-lead-contract.md) is the runtime-neutral lifecycle core: phase boundaries, artifacts, convergence, report ownership, and persistence semantics.
149
- - `prompts/lead/adapters/claude-code.md`, `prompts/lead/adapters/codex.md`, and `prompts/lead/adapters/external.md` map the same semantic operations to one selected host runtime. The generated launch prompt exposes the core path plus exactly one adapter path.
150
- - Runtime selection and worker-provider assignment remain independent. Milestone 1 keeps `claude-execution-prompt.md`, existing manifest role labels, model defaults, and worker rosters for compatibility; provider registry and front-door separation are later milestones.
149
+ - `prompts/lead/adapters/claude-code.md`, `prompts/lead/adapters/codex.md`, `prompts/lead/adapters/antigravity.md`, and `prompts/lead/adapters/external.md` map the same semantic operations to one selected host runtime. The generated launch prompt exposes the core path plus exactly one adapter path.
150
+ - Runtime metadata and role assignments are persisted separately, but the lead provider is derived from the host: Claude Code maps to Claude, Codex maps to Codex, and Antigravity CLI maps to Antigravity. New runs persist `hostRuntime`, `leadAssignment`, and `workerAssignments[]`; each assignment records its provider, model, execution value, and resolved `native-session` or `cli-wrapper` runner. `lead-execution-prompt.md` is canonical, while `claude-execution-prompt.md` is a byte-identical compatibility alias for historical consumers.
151
+ - Provider registry and front-door separation are implemented: the active Claude Code, Codex, or Antigravity host owns the native lead session, while non-host providers run through their registered CLI wrappers.
151
152
  - [`skills/okstra-setup/SKILL.md`](../skills/okstra-setup/SKILL.md) — **first-run bootstrap**. Runs `okstra install` and creates `project.json`.
152
- - [`skills/okstra-run/SKILL.md`](../skills/okstra-run/SKILL.md) — in-session entry point that **starts an okstra task in the current Claude session**. Calls `prepare_task_bundle` directly.
153
+ - [`skills/okstra-run/SKILL.md`](../skills/okstra-run/SKILL.md) — host-aware in-session entry point that starts an okstra task in the current Claude Code, Codex, or Antigravity session and calls `prepare_task_bundle` directly.
153
154
  - Thirteen skills are user-invocable: `skills/okstra-setup/SKILL.md`, `skills/okstra-brief-gen/SKILL.md`, `skills/okstra-run/SKILL.md`, `skills/okstra-manager/SKILL.md`, `skills/okstra-memory/SKILL.md`, `skills/okstra-inspect/SKILL.md`, `skills/okstra-rollup/SKILL.md`, `skills/okstra-usage/SKILL.md`, `skills/okstra-schedule-gen/SKILL.md`, `skills/okstra-container-build/SKILL.md`, `skills/okstra-pr-gen/SKILL.md`, `skills/okstra-user-response/SKILL.md`, and `skills/okstra-code-review/SKILL.md`. Only these are copied into the agent skill home. They cover brief authoring, phase execution, cross-project manager task coordination, global Memory Book storage/search, read-side status/history/report/time/logs/cost/errors/recap, task-group-level aggregation of run results (rollup), project-wide historical resource usage, schedule support, local container deployment, PR description generation, clarification-response submission, and census-based code review of a stage or branch diff. `okstra-manager` uses `okstra manager` CLI JSON/launch packets as the source of truth, and stores manager-owned plans, assignments, directives, snapshots, and events under `~/.okstra/managers/<manager-id>/`. `okstra-rollup` is a read-side layer that fans the single-task aggregators from `okstra-inspect` (time/errors/recap) out to a task group or the whole project catalog. The `okstra rollup` CLI owns deterministic aggregation, while the skill (LLM) writes only the synthesized report summary. `okstra-usage` is a separate read-only resource snapshot grouped by lifecycle task type; it does not replace single-task `okstra-inspect` detail or the status/report digest from `okstra-rollup`. The canonical definition of `okstra-inspect` read-side facets is the subcommand table in `skills/okstra-inspect/SKILL.md`. `okstra-inspect logs` provides a read-only inventory and cleanup guidance for the live-log sidecars that the Codex/Antigravity wrappers write on every dispatch at the resolved `<run-dir>/prompts/<worker>-prompt-<phase>-<seq>.log`; for stage executions, the stage-qualified `run_dir` includes `stage-<N>/`. `okstra-inspect cost` summarizes `okstra context-cost`; `okstra-inspect errors` collects a task's okstra-run error logs into a timestamped Markdown error report and prints a summary; and `okstra-inspect recap` answers free-form questions about `.okstra` artifacts in addition to summarizing phases before and after each task run.
154
155
  - Internal operating contracts—`context-loader` / `team-contract` / `convergence` / `report-writer` and the lead contract—have moved to `prompts/lead/*.md`. Language-specific coding preflight for implementation/verification workers has moved to `prompts/coding-preflight/*` (overview router + clean-code + three-stage language/framework/architecture selection). All are runtime resources installed under `~/.okstra/prompts/` and are not discoverable as skills. The generated launch prompt provides the lead with absolute paths, and reinstalling prunes the legacy exact-name skill directories `okstra-context-loader` / `okstra-team-contract` / `okstra-convergence` / `okstra-report-writer` / `okstra-coding-preflight` / `okstra`.
155
156
  - Plugin manifest: [`../../.claude-plugin/plugin.json`](../.claude-plugin/plugin.json) — referenced by the supplementary `npx skills@latest add Devonshin/okstra` channel. Use `npx okstra@latest install` for normal setup. The plugin manifest exposes only the thirteen user entry points (`okstra-setup`, `okstra-brief-gen`, `okstra-run`, `okstra-manager`, `okstra-memory`, `okstra-inspect`, `okstra-rollup`, `okstra-usage`, `okstra-schedule-gen`, `okstra-container-build`, `okstra-pr-gen`, `okstra-user-response`, `okstra-code-review`).
@@ -259,47 +260,48 @@ The following environment variables are read only as user settings, not for stat
259
260
 
260
261
  Other variables such as `PROJECT_ID`, `TASK_GROUP`, `RUN_*`, `FINAL_*`, and `CLAUDE_*` are not exported and do not leak into child processes.
261
262
 
262
- ## Claude execution behavior
263
+ ## Host runtime execution behavior
263
264
 
264
- In the current implementation, `okstra` executes Claude as follows.
265
+ The front door declares its host from harness context, never by looking for installed provider binaries. Claude Code selects the Claude native session; Codex selects the Codex native session. Other selected providers resolve to CLI wrappers. A lead provider that disagrees with an in-session host is rejected before dispatch so the manifest cannot claim a model that never ran.
266
+
267
+ The legacy standalone shell path remains Claude-specific:
265
268
 
266
269
  **Mode A — `okstra.sh` launches a new Claude process**
267
270
  - With `--render-only`, it exits after creating the instruction set without running Claude.
268
271
  - Without `--render-only`, the prepare stage preassigns a Claude session ID and creates `claude-resume-<task-type>-<seq>.sh` under the current run's `sessions/` directory.
269
- - It then runs `claude --model <lead> --session-id "$CLAUDE_SESSION_ID" "$PROMPT"` via `exec` from the target project root using the resolved `Claude lead` model execution value. (The former `--settings <runtime-settings>` argument was removed in 0.14.0; permissions are now provided by the `<PROJECT_ROOT>/.claude/settings.local.json` symlink.)
270
- - `okstra.sh` performs only the handoff; the Claude lead continues by saving the final report and updating run/task state.
272
+ - It then runs `claude --model <lead> --session-id "$CLAUDE_SESSION_ID" "$PROMPT"` via `exec` from the target project root using the standalone launcher's resolved Claude lead model. (The former `--settings <runtime-settings>` argument was removed in 0.14.0; permissions are now provided by the `<PROJECT_ROOT>/.claude/settings.local.json` symlink.)
273
+ - `okstra.sh` performs only this compatibility handoff; the launched session continues under the same Okstra lead contract. Codex-hosted runs do not pass through this shell path.
271
274
 
272
- **Mode B — the `okstra-run` skill hands off within the current Claude session**
273
- - Use this when the user is already in a Claude session and wants to start a new okstra task there.
274
- - The skill collects task candidates, task type, brief, and other input through `AskUserQuestion`, then calls `prepare_task_bundle(render_only=True)` to create the same instruction set on disk.
275
- - It does not launch a new Claude process. The current session reads the rendered lead prompt and immediately assumes the lead role.
275
+ **Mode B — the `okstra-run` skill hands off within the current host session**
276
+ - Use this when the user is already in Claude Code, Codex, or Antigravity and wants to start a new okstra task there.
277
+ - The skill relays the wizard through the host question/text interface and calls `prepare_task_bundle(render_only=True)` with the explicit host runtime.
278
+ - It does not launch another lead process. The current host-native session reads `lead-execution-prompt.md` and assumes the Okstra lead role.
276
279
 
277
280
  Both modes create identical artifacts (task-manifest, run-manifest, timeline, instruction set, and central-index registration), so subsequent `okstra-ctl` commands (list / show / rerun / reconcile) operate consistently without distinguishing between them.
278
- - The handed-off main Claude acts as the `Claude lead`, responsible for orchestration and final synthesis.
279
- - The default worker roles for the standard workflow are `Claude worker`, `Codex worker`, and `Report writer worker`; `Antigravity worker` is optional and is included only when explicitly requested through `--workers` or the profile.
280
- - Claude assigns worker responsibilities and makes the final judgment after reading the task bundle.
281
+ - The handed-off native host acts as the Okstra lead, responsible for orchestration and final synthesis.
282
+ - The default worker policy remains Claude + Codex analysis and a Claude report writer. Antigravity, Grok, and Kimi are profile-gated optional assignments; Grok and Kimi are read-only analyser/critic providers.
283
+ - The lead assigns worker responsibilities and makes the final judgment after reading the task bundle.
281
284
  - okstra Claude assets installed in the user home (`~/.claude/skills`, `~/.claude/agents`) instruct Claude to dispatch workers through `Agent(name: ...)`; workers automatically join the session's implicit team.
282
285
  - **Team lifecycle (Claude Code v2.1.178+)**: v2.1.178 removed the `TeamCreate` / `TeamDelete` tools and the `team_name` parameter from `Agent(...)`. When `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` (seeded into `settings.json` by `okstra install`), one implicit team per session is created automatically at startup. In Phase 3, the lead does not call a team-creation tool. It records only the `teamName` audit label and `teamCreate: { attempted: false, status: "implicit", splitPane: <true-if-TMUX-is-set> }`, then dispatches workers through `Agent(name: "<role>-worker", run_in_background: true)` (without team_name). Split-pane teammates appear when `$TMUX` is set and `teammateMode: auto`; outside tmux they run in-process, and both modes are valid. At run end, after Phase 7 token accounting, the lead checks for remaining tmux panes and asks whether to clean up worker teammates only for split-pane runs. If approved, `okstra-team-reconcile.sh` marks dead-pane stale-active members inactive and sends each completed teammate a `SendMessage` shutdown_request. There is no tool for deleting the implicit team; it disappears when the session ends. If the user keeps the teammates, they remain in the FleetView roster and the lead tells the user to remove them through Teams/FleetView (see *Run-end teammate teardown* in `prompts/profiles/_common-contract.md`). Phase 7 token accounting locates worker sessions by top-level `agentName` or nested `subagents/agent-a<name>-<hash>.jsonl` filenames when `teamCreate.status` is `implicit`/`skipped`/`error`.
283
286
 
284
- ## Claude prompt contract
287
+ ## Lead prompt contract
285
288
 
286
- The Claude launch prompt body is always rendered only from the `prompts/launch.template.md` template.
289
+ The canonical lead prompt body is rendered from `prompts/launch.template.md` to `lead-execution-prompt.md`. A selected runtime adapter maps its neutral operations to host primitives.
287
290
 
288
291
  - Prompt substitution is limited to scalar placeholder values such as the task key, session ID, and absolute/relative paths.
289
292
  - The selected profile body is rendered to `instruction-set/analysis-profile.md`.
290
293
  - The analysis material body is rendered to `instruction-set/analysis-material.md`.
291
294
  - The expected state for config/deployment is rendered to `instruction-set/reference-expectations.md`.
292
- - Claude must read these artifact files directly; long task-specific bodies must not be duplicated inline in the launch prompt.
295
+ - The lead must read these artifact files directly; long task-specific bodies must not be duplicated inline in the launch prompt.
293
296
 
294
297
  ## Required team contract
295
298
 
296
299
  The standard `okstra` workflow applies the following team contract consistently across runtime prompts, profiles, manifests, and skill documentation.
297
300
 
298
- - The main Claude is always the `Claude lead` and operates in synthesis-only mode.
299
- - The default required worker roles are `Claude worker`, `Codex worker`, and `Report writer worker`. `Antigravity worker` is optional and is included as required only when explicitly named by `--workers` or the profile's `- Workers:` section.
300
- - `Report writer worker` focuses on report structure and evidence organization, but `Claude lead` remains the final synthesis owner.
301
- - The default model contract is computed from central defaults. Fallbacks are `Claude lead`=`opus`, `Claude worker`=`opus`, `Codex worker`=`gpt-5.6-sol`, `Report writer worker`=`sonnet`, and `Antigravity worker`=`gemini-3.1-pro` (when opted in). `Report writer worker` no longer inherits the `Claude lead` model — it resolves from its own catalog `ROLE_DEFAULTS` entry because it does not vote in convergence; `--report-writer-model opus` or `OKSTRA_DEFAULT_REPORT_WRITER_MODEL` restores the previous behavior.
302
- - Because `Antigravity worker` is optional, it is attempted only in runs where it is explicitly included.
301
+ - The current host-native provider owns the synthesis-only lead session: Claude on Claude Code, Codex on Codex.
302
+ - Every selected worker comes from the profile roster and provider capability registry. The default analysis policy remains Claude + Codex + a report writer; Antigravity, Grok, and Kimi are attempted only when the profile and resolved roster include them.
303
+ - `Report writer worker` focuses on report structure and evidence organization, while the host-native lead remains the final synthesis owner. Claude is the default report-writer provider; Codex may be selected explicitly.
304
+ - Model defaults are provider and functional-role policy. Fallbacks include Claude lead/analyser=`opus`, Codex lead/analyser=`gpt-5.6-sol`, Claude report writer=`sonnet`, Antigravity=`gemini-3.1-pro`, Grok analyser=`grok-build-0.1`, and Kimi analyser=`kimi-k2.7-code`.
303
305
  - Before the final judgment, each required role in the current run's worker roster must have either a result or an explicit terminal status (`completed`, `timeout`, `error`, `not-run`).
304
306
  - Every attempted worker (`completed`, `timeout`, `error`) must have an assigned worker prompt history file under the current run's `prompts/` directory.
305
307
  - Worker timing begins at the atomic transition to `in-progress`, which records `workers[].startedAt` in `team-state.json`; prompt creation time is not a dispatch proxy. `okstra worker-state transition` and both dispatch adapters share `dispatch_state.transition_worker_status`, while `okstra worker-liveness --team-state ... --worker ...` reads that timestamp as the launch-grace authority.
@@ -595,17 +597,17 @@ There are two entry methods, and they produce identical artifacts.
595
597
  scripts/okstra.sh --task-type error-analysis --project-id <project-id> --task-group <task-group> --task-id <task-id> --task-brief <brief-path>
596
598
  ```
597
599
 
598
- On this path, `okstra.sh` finishes the prepare stage and then runs a new interactive Claude session via `exec` from the target project root. It performs only the handoff; the Claude lead continues by saving the final report. Because `sessions/claude-resume-<task-type>-<seq>.sh` is written immediately before execution, the same run can be resumed if the session is interrupted.
600
+ On this standalone compatibility path, `okstra.sh` finishes the prepare stage and then runs a new interactive Claude session via `exec` from the target project root. It performs only the handoff; the session continues under the Okstra lead contract. Because `sessions/claude-resume-<task-type>-<seq>.sh` is written immediately before execution, the same run can be resumed if interrupted. In-host Claude Code, Codex, and Antigravity paths retain the current native session instead.
599
601
 
600
- **Option B — hand off within the current Claude session (`okstra-run` skill)**
602
+ **Option B — hand off within the current host session (`okstra-run` skill)**
601
603
 
602
- If you are already using a Claude Code session, the current session can assume the Claude lead role without launching a new process. Example triggers: `"run okstra here"`, `"start error-analysis on this project"`.
604
+ If you are using Claude Code, Codex, or Antigravity, the current native session assumes the Okstra lead role without launching a replacement lead process. Example triggers: `"run okstra here"`, `"start error-analysis on this project"`.
603
605
 
604
606
  Skill flow:
605
607
 
606
- 1. The `okstra-run` skill activates and collects task candidates / task type / brief path with `AskUserQuestion`.
608
+ 1. The `okstra-run` skill activates and relays task candidates, task type, and brief path through the current host's question or text interface.
607
609
  2. It calls `okstra_ctl.run.prepare_task_bundle(render_only=True)` with the user's input—directly invoking the same Python function without passing through `okstra.sh`.
608
- 3. After the same instruction-set artifacts are written to disk, the current Claude reads the prompt and assumes the lead role.
610
+ 3. After the same instruction-set artifacts are written to disk, the current host reads the canonical lead prompt and assumes the lead role.
609
611
 
610
612
  See [`skills/okstra-run/SKILL.md`](../skills/okstra-run/SKILL.md) for the detailed procedure.
611
613
 
@@ -779,11 +781,11 @@ Generating a view never modifies the original final-report MD.
779
781
 
780
782
  ## Worker error collection (optional sidecar)
781
783
 
782
- Errors that occur while workers (Claude/Codex/Antigravity worker, Report writer, Claude lead) run can be collected into a single chronological log for later retrospectives.
784
+ Errors that occur while provider workers, the report writer, or the Okstra lead run can be collected into a single chronological log for later retrospectives.
783
785
 
784
786
  - Storage location: resolved `<run-dir>/logs/errors-<task-type>-<seq>.jsonl` (`<run-dir>` includes `stage-<N>/` for a stage-isolated run)
785
787
  - Append-only JSON Lines, isolated per run, so there is no separate rotation policy.
786
- - **Single writer**: To avoid concurrent-append collisions, only the `Claude lead` writes this file directly. `<seq>` is an independent three-digit zero-padded counter (`001`, `002`, …) scanned per category directory (`logs/`, `manifests/`, `state/`, and so on), so category values may differ within one run when a prior run recorded only some categories. The cross-category identifier for one run is the manifest's `runDateTimeSegment` ISO timestamp field.
788
+ - **Single writer**: To avoid concurrent-append collisions, only the active Okstra lead writes this file directly. `<seq>` is an independent three-digit zero-padded counter (`001`, `002`, …) scanned per category directory (`logs/`, `manifests/`, `state/`, and so on), so category values may differ within one run when a prior run recorded only some categories. The cross-category identifier for one run is the manifest's `runDateTimeSegment` ISO timestamp field.
787
789
  - Internal worker tool failures are reported in the worker-result manifest's `errors[]`, then dumped by the lead immediately after merge
788
790
  - Codex/Antigravity CLI failures, timeouts, and rate limits are observed directly by the lead through the wrapper
789
791
  - resultContract violations, schema mismatches, and missing required fields are observed directly during lead validation
@@ -852,16 +854,16 @@ Each validator blocks the phase with a `contract-violated` exit code when a cont
852
854
  - The task bundle's `instruction-set/reference-expectations.md` is generated alongside it as the config/deployment expected-state reference.
853
855
  - The current run session's resume helper is created at the resolved `<run-dir>/sessions/claude-resume-<task-type>-<seq>.sh`.
854
856
  - The run directory is organized into typed subdirectories such as `manifests/`, `state/`, `prompts/`, `reports/`, `status/`, `sessions/`, and `worker-results/`; prompt snapshots are prepared under `prompts/` first.
855
- - Claude creates workers and collects results.
856
- - The standard workflow uses a `Claude lead` with default workers `Claude worker`, `Codex worker`, and `Report writer worker`; `Antigravity worker` is optional and included only when explicitly requested.
857
- - Worker models can be overridden with `--lead-model`, `--claude-model`, `--codex-model`, `--antigravity-model`, and `--report-writer-model`; defaults are centrally managed through `OKSTRA_DEFAULT_*` environment variables. Fallback defaults are `Claude lead`=`opus`, `Claude worker`=`opus`, `Codex worker`=`gpt-5.6-sol`, `Report writer worker`=`sonnet`, and `Antigravity worker`=`gemini-3.1-pro`.
857
+ - The host adapter creates workers and collects results according to persisted runner assignments.
858
+ - The standard policy uses Claude and Codex analysers plus a report writer. Antigravity, Grok, and Kimi are optional and included only when the selected profile allows them.
859
+ - Worker models can be overridden through the legacy provider flags or generic `--worker-model provider=model`; lead and report-writer provider choices are explicit. Defaults are centrally managed through the provider registry and `OKSTRA_DEFAULT_*` environment variables.
858
860
  - For `--task-type implementation`, select the provider that takes the Executor role with `--executor <claude|codex|antigravity>` (or `OKSTRA_DEFAULT_EXECUTOR`, fallback `claude`). Only the Executor may mutate project files. The other two providers and the Executor's own provider are each dispatched as verifiers in separate CLI sessions (session isolation preserves the self-review safeguard). The Executor's model reuses the selected provider's worker-model flag (`--claude-model` / `--codex-model` / `--antigravity-model`). Provider / displayName / workerAgent / model are recorded in the run-manifest `teamContract.executor` block.
859
- - Worktree cwd injection by Executor: Codex / Antigravity executors pin cwd to the worktree at the CLI layer through wrappers (`okstra-codex-exec.sh -C` / `okstra-antigravity-exec.sh --include-directories`). Because the Bash tool has no per-call cwd argument, the Claude executor prefixes cwd-sensitive toolchain invocations (`cargo`/`npm`/`pnpm`/`bun`/`pytest`/`make`/`go`) with `cd {{EXECUTOR_WORKTREE_PATH}} && <cmd>` in the same Bash invocation. Wrapping in `bash -lc`/`bash -c` is prohibited because it hides the leading `cd` token and defeats permission auto-allow. Prefer working-directory flags such as `git -C` or `cargo --manifest-path` when available. See the *Executor Worktree* block in `prompts/profiles/implementation.md` and the Executor exception in `agents/workers/claude-worker.md` for details.
861
+ - Worktree targeting is runner-based. A native-session executor uses its host adapter's edit and command primitives against `EXECUTOR_WORKTREE_PATH`; a CLI-wrapper executor receives the worktree through its provider wrapper. Prefer explicit working-directory flags such as `git -C` or `cargo --manifest-path` when available.
860
862
  - The project-level current-task convenience pointer is `.okstra/discovery/latest-task.json`.
861
863
  - The project-level canonical task inventory is `.okstra/discovery/task-catalog.json`.
862
864
  - At `okstra install` time, okstra skill assets are seeded to `~/.agents/skills/` by default. If `~/.claude` exists, `~/.claude/skills/` + `~/.claude/agents/` are seeded as well (per-project seeding is no longer performed).
863
865
  - Seeded okstra Claude assets instruct Claude to dispatch workers into the session's implicit team with `Agent(name: ...)` (v2.1.178 removed `TeamCreate`/`TeamDelete`). Agent targets receive only skill Markdown.
864
- - Claude, not scripts, makes the final judgment.
866
+ - The host-native Okstra lead, not preparation scripts or a report writer, makes the final judgment.
865
867
  - A stable task key must be maintained to enable later bug tracking, corrections, and reverification.
866
868
  - Worker errors are collected in the optional sidecar at the resolved `<run-dir>/logs/errors-<task-type>-<seq>.jsonl`, with the lead as the sole writer. For a stage-isolated run, `<run-dir>` includes `stage-<N>/`. The entry-point helper is `scripts/okstra-error-log.py`.
867
869
  - Token-usage and cost accounting are handled by `scripts/okstra-token-usage.py` and the Node wrapper `okstra token-usage`.