okstra 0.36.0 → 0.36.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.kr.md +3 -5
  2. package/README.md +3 -5
  3. package/docs/project-structure-overview.md +2 -7
  4. package/docs/superpowers/plans/2026-05-24-implementation-lead-context-slimming.md +1700 -0
  5. package/package.json +1 -1
  6. package/runtime/BUILD.json +2 -2
  7. package/runtime/agents/SKILL.md +18 -5
  8. package/runtime/agents/workers/claude-worker.md +5 -6
  9. package/runtime/agents/workers/codex-worker.md +10 -9
  10. package/runtime/agents/workers/gemini-worker.md +7 -6
  11. package/runtime/agents/workers/report-writer-worker.md +13 -11
  12. package/runtime/prompts/launch.template.md +1 -0
  13. package/runtime/prompts/profiles/_implementation-deliverable.md +53 -0
  14. package/runtime/prompts/profiles/_implementation-executor.md +60 -0
  15. package/runtime/prompts/profiles/_implementation-verifier.md +76 -0
  16. package/runtime/prompts/profiles/implementation.md +27 -134
  17. package/runtime/python/okstra_ctl/paths.py +3 -0
  18. package/runtime/python/okstra_ctl/render.py +19 -5
  19. package/runtime/python/okstra_ctl/run.py +7 -1
  20. package/runtime/python/okstra_ctl/session.py +65 -7
  21. package/runtime/skills/okstra-brief/SKILL.md +2 -211
  22. package/runtime/skills/okstra-inspect/SKILL.md +581 -0
  23. package/runtime/skills/okstra-run/SKILL.md +3 -3
  24. package/runtime/skills/okstra-schedule/SKILL.md +10 -153
  25. package/runtime/skills/okstra-setup/SKILL.md +1 -1
  26. package/runtime/skills/okstra-team-contract/SKILL.md +15 -106
  27. package/runtime/templates/reports/brief.template.md +204 -0
  28. package/runtime/templates/reports/schedule.template.md +12 -3
  29. package/runtime/templates/worker-prompt-preamble.md +108 -0
  30. package/src/uninstall.mjs +7 -3
  31. package/runtime/prompts/profiles/kr/_common-contract.md +0 -92
  32. package/runtime/prompts/profiles/kr/error-analysis.md +0 -36
  33. package/runtime/prompts/profiles/kr/final-verification.md +0 -48
  34. package/runtime/prompts/profiles/kr/implementation-planning.md +0 -90
  35. package/runtime/prompts/profiles/kr/implementation.md +0 -144
  36. package/runtime/prompts/profiles/kr/improvement-discovery.md +0 -42
  37. package/runtime/prompts/profiles/kr/release-handoff.md +0 -104
  38. package/runtime/prompts/profiles/kr/requirements-discovery.md +0 -42
  39. package/runtime/skills/okstra-history/SKILL.md +0 -165
  40. package/runtime/skills/okstra-logs/SKILL.md +0 -173
  41. package/runtime/skills/okstra-report-finder/SKILL.md +0 -111
  42. package/runtime/skills/okstra-status/SKILL.md +0 -246
  43. package/runtime/skills/okstra-time-summary/SKILL.md +0 -172
@@ -14,148 +14,41 @@
14
14
  - Executor model: `{{EXECUTOR_MODEL_DISPLAY}}` (launch value: `{{EXECUTOR_MODEL_EXECUTION_VALUE}}`)
15
15
  - Wherever this profile mentions the `Executor`, it refers to the role bound above. The other two providers in the roster (`claude` / `codex` / `gemini` minus the executor) are dispatched as **verifiers only** for this run and remain strictly read-only.
16
16
  {{INCLUDE:_common-contract.md}}
17
- - Team contract (phase-specific overrides — `Claude worker` is replaced by `Executor` + verifier set in this phase):
18
- - **Executor role:** the `Executor` (bound above) is the **only worker permitted to use Edit / Write / state-mutating Bash commands** on project files. All other workers run read-only. When the executor provider is `codex` or `gemini`, the actual file mutation happens inside the executor CLI's own auto-edit mode (e.g. `codex exec --sandbox workspace-write`, gemini's equivalent) — not through Claude-side Edit/Write tools — but the safety rules in this profile still apply identically.
19
- - **Verifier roles:** the verifier slots are `Claude verifier` and `Codex verifier`, plus `Gemini verifier` **only when `gemini` is in the resolved `--workers` roster**. Every verifier in the resolved roster is dispatched regardless of which provider holds the executor role; the executor's own provider is run *separately* as a verifier (a fresh CLI session with no shared context) so that no verdict is produced from the same session that wrote the diff. Verifiers MUST NOT call Edit, Write, or any Bash command that mutates files outside the run's artifact directories. If a verifier wants a fix, it records the recommendation in its worker result; it does not apply the fix itself.
20
- - **Verifier QA duties (independent re-run mandate):** every verifier acts as a QA gate, not just a diff reviewer. Trusting the executor's reported evidence is forbidden — verifiers MUST reproduce it themselves from the same worktree path the executor used.
21
- - **Two-tier command lookup (NO auto-detection):** verifier obtains the QA command set from exactly two declared sources, in order — there is **no fallback to guessing tools from manifest files**.
22
- 1. **Tier 1 — plan validation set (task-specific):** every command listed under the approved plan's `validation` block (pre / mid / post).
23
- 2. **Tier 2 — project baseline (`project.json.qaCommands`):** the project's standing QA baseline declared in `<PROJECT_ROOT>/.project-docs/okstra/project.json` under the `qaCommands` key. Schema (each category is an array of `{ "label", "cmd", "language"? }` objects):
24
- ```json
25
- {
26
- "qaCommands": {
27
- "lint": [{ "label": "cargo clippy", "cmd": "cargo clippy --all-targets -- -D warnings", "language": "rust" }],
28
- "format": [{ "label": "cargo fmt", "cmd": "cargo fmt --check", "language": "rust" }],
29
- "typecheck": [{ "label": "tsc", "cmd": "pnpm exec tsc --noEmit", "language": "ts" }],
30
- "test": [{ "label": "cargo test", "cmd": "cargo test --workspace --locked", "language": "rust" }]
31
- }
32
- }
33
- ```
34
- `language` is optional; when present, verifier MAY skip categories whose `language` is not represented in this run's diff (recorded as `qa-command skipped: <label> (language=<x> not in diff)`). Absent `language` means "always run".
35
- - **Execution rule:** Tier 1 commands run verbatim first. Then every Tier 2 entry runs once. Each command runs in the worktree cwd, and is recorded in the worker result with its exact command line, exit code, and the tail of stdout/stderr. Substituting or paraphrasing a Tier 1 command is forbidden (see Forbidden actions).
36
- - **Missing-tier handling:** if a tier is empty or absent, verifier records the single line `qa-command not configured: <category>` per missing category (`lint` / `format` / `typecheck` / `test`) in the worker result and proceeds — silent omission is a contract violation. Verifier MUST NOT auto-detect or invent a command in this case; the user/operator must declare it in `project.json.qaCommands` or in the plan.
37
- - **`cmd` field deny-list (Tier 2 validation):** the runtime AND the verifier MUST reject any `cmd` containing tokens that imply mutation: `--fix`, `--write`, ` -w` (gofmt write), ` -u` (jest snapshot update), `--update-snapshots`, `--snapshot-update`, `--update-goldens`, `INSTA_UPDATE=` (with any value other than `no`), `cargo insta accept`, `npm install` (without `ci`), `cargo update`, `pip install -U`, `pnpm add`, `bun add`. Encountering a denied token aborts the verifier run with `contract-violated` and the operator is asked to re-declare the command in check-only form.
38
- - **Discrepancy rule:** if the verifier's re-run result differs from what the executor reported (a passing test fails on re-run, a clean lint surfaces warnings, an exit code mismatches), the verifier MUST issue verdict `FAIL` with the divergence cited. `Claude lead` MUST NOT silently prefer the executor's evidence over a verifier's reproduced result during synthesis; if it overrides, it MUST cite a concrete reproduction-time reason (flaky-test commit-cited, environment delta documented) — handwaving is not allowed.
39
- - **Read-only command log (per verifier):** the worker result MUST contain a `Read-only command log` block listing every command executed during the verifier run with its exact invocation and exit code, in execution order. No mutating command may appear in this block. This log is copied into the final report's verifier result section verbatim.
40
- - **Verifier evidence is independent of executor evidence:** the final report keeps both — executor's `Validation evidence` AND each verifier's `Read-only command log` — so reviewers can compare them line-by-line.
41
- - Session isolation — not model-variant divergence — is the primary self-review safeguard: each verifier is a separate CLI invocation with its own context window, so reusing the same model variant for executor and same-provider verifier is acceptable. Different model variants (e.g. executor=opus / Claude verifier=sonnet) remain recommended when available.
42
- - Phase-specific model defaults override the shared defaults: `Claude verifier`=`sonnet`, `Codex verifier`=`gpt-5.5`, `Gemini verifier`=`auto` (only when present in the roster). The `Executor`'s model is taken from the provider-specific worker model corresponding to `--executor`: claude→`--claude-model` (default `sonnet`, override to `opus` recommended when this run's executor is claude), codex→`--codex-model` (default `gpt-5.5`), gemini→`--gemini-model` (default `auto`).
43
- - **All-verifier-failure policy**: if every verifier present in the resolved roster (`Claude verifier`, `Codex verifier`, and `Gemini verifier` when opted in) ends with a non-result terminal status (`timeout`, `error`, `not-run`) — i.e. zero independent verdicts were produced — the run MUST end with status `blocked` and route to a follow-up `error-analysis` run. `Claude lead` MUST NOT substitute its own verdict in place of the missing verifier outputs; synthesis requires at least one independent verifier's verdict. If one or more verifiers fail but at least one returns a verdict, the run proceeds with the surviving verdict(s) and the final report MUST explicitly notate which verifiers were unavailable, with the captured error / timeout evidence per failed verifier.
44
17
  - Pre-implementation gate (mandatory — refuse to start if any item fails):
45
18
  - the run brief MUST cite `--approved-plan <path>` pointing to a `final-report.md` produced by a prior `implementation-planning` run located under `runs/implementation-planning/.../reports/final-report.md`
46
- - that file's YAML frontmatter MUST carry `approved: true`. report-writer emits `approved: false` by default; the user flips it to `true` to authorise this run. Free-form approvals such as "lgtm", "go ahead", or paraphrased confirmations are intentionally NOT accepted; if the user's approval is informal, re-edit the plan file's frontmatter line to `approved: true` before invoking the implementation run.
47
- - Two equally-valid approval paths exist (both end up satisfying the same frontmatter check):
48
- - **Manual edit** the user opens the report, changes the frontmatter line `approved: false` to `approved: true`, saves, then runs `okstra ... --task-type implementation --approved-plan <path>`.
49
- - **CLI ack** — the user runs `okstra ... --task-type implementation --approved-plan <path> --approve`. The CLI invocation itself is modelled as the user's act of approval; the runtime (`okstra_ctl.run._apply_cli_approval`) flips the frontmatter `approved` to `true` and appends an audit line `- 승인 일시 (CLI ack): <ISO8601> — recorded by \`okstra --approve\`` before the standard frontmatter validation runs. Use this when running unattended or when you want a single command to both approve and launch the next phase.
50
- - The `--approve` flag is **only meaningful with `--task-type implementation` and `--approved-plan <path>`**. Passing it with any other task-type causes `PrepareError` (the runtime refuses to silently ignore approval signals). It is also a no-op if the frontmatter already has `approved: true` (idempotent — only an audit line is appended, the flag is not re-toggled).
51
- - the file's `Recommended option` and its bite-sized step list become the authoritative scope for this run; any deviation must be justified in the final report and routed back to a new `implementation-planning` run instead of being silently expanded.
19
+ - that file's YAML frontmatter MUST carry `approved: true`. report-writer emits `approved: false` by default; the user flips it to `true` to authorise this run. Free-form approvals such as "lgtm" / "go ahead" / paraphrased confirmations are NOT accepted; re-edit the plan file's frontmatter to `approved: true` before invoking implementation, or pass `--approve` so the CLI flips it on the user's behalf (`okstra_ctl.run._apply_cli_approval`).
20
+ - The `--approve` flag is meaningful ONLY with `--task-type implementation` and `--approved-plan <path>`; any other use raises `PrepareError`. Idempotent — re-running with `approved: true` already set appends an audit line but does NOT re-toggle.
21
+ - the file's `Recommended option` and its bite-sized step list become the authoritative scope for this run; deviations must be justified in the final report and routed back to a new `implementation-planning` run rather than silently expanded.
52
22
  - Task worktree (provisioned by `okstra-ctl` at the first phase's run-prep time, reused for every subsequent phase of this task-key):
53
23
  - Status: `{{EXECUTOR_WORKTREE_STATUS}}` (one of: `created` | `reused` | `skipped-in-worktree` | `skipped-not-git`)
54
- - Working tree path: `{{EXECUTOR_WORKTREE_PATH}}` — when status is `created` or `reused`, this is the task's `git worktree` rooted at `~/.okstra/worktrees/<project>/<task-group>/<task-id>/` (segments sanitised — `/` `:` → `-`). When skipped, this is the caller's `project_root`.
55
- - Branch: `{{EXECUTOR_WORKTREE_BRANCH}}` — empty when status is `skipped-*`. The branch name encodes `<work-category-prefix>-<task-id-segment>` and is globally unique across task-keys via `~/.okstra/worktrees/registry.json`.
56
- - Base ref: `{{EXECUTOR_WORKTREE_BASE_REF}}` — commit SHA the worktree was branched from at the first phase; canonical `<base>` for every `git diff` / `git log` in this run.
24
+ - Working tree path: `{{EXECUTOR_WORKTREE_PATH}}` — when status is `created` or `reused`, this is the task's `git worktree` rooted at `~/.okstra/worktrees/<project>/<task-group>/<task-id>/`. When skipped, this is the caller's `project_root`.
25
+ - Branch: `{{EXECUTOR_WORKTREE_BRANCH}}` — empty when status is `skipped-*`. Branch name = `<work-category-prefix>-<task-id-segment>`, globally unique via `~/.okstra/worktrees/registry.json`.
26
+ - Base ref: `{{EXECUTOR_WORKTREE_BASE_REF}}` — canonical `<base>` for every `git diff` / `git log` in this run.
57
27
  - Provisioning note: `{{EXECUTOR_WORKTREE_NOTE}}`
58
- - **Executor behaviour**: when status is `created` or `reused`, the Executor MUST run every Edit / Write / build / test / commit command with the working tree path above as cwd. Treat it as `project_root` for the duration of this run. Do NOT mutate the caller's original checkout. Do NOT `cd` out of the worktree to reach files; if a file outside the worktree is needed, the dependency is a planning gap record it in `Out-of-plan edits` and continue.
59
- - **How to set cwd per Bash call**: the Claude Bash tool inherits its cwd from the lead session, which is NOT the worktree. To put cwd-sensitive toolchains (`cargo`, `npm`, `pnpm`, `bun`, `pytest`, `make`, `go`) into the worktree, prefix the command with `cd {{EXECUTOR_WORKTREE_PATH}} && ` inside the same Bash invocation — e.g. `cd {{EXECUTOR_WORKTREE_PATH}} && cargo test -p foo`. **Never wrap in `bash -lc "..."` or `bash -c "..."`** — the wrapper hides the leading `cd` token from Claude Code's permission auto-allow layer (causing prompts on every call) without any safety benefit. For tools that accept an explicit working-directory flag (`git -C <path>`, `cargo --manifest-path`, `pytest --rootdir`), prefer that form over the `cd && ` chain. Edit / Write / Read tool calls already use absolute paths and need no cwd handling. The codex / gemini executor CLI wrappers (`okstra-codex-exec.sh -C`, `okstra-gemini-exec.sh --include-directories`) already inject worktree cwd at the CLI layer, so this rule applies primarily to the Claude executor.
60
- - **Verifier behaviour**: all verifier roles in the resolved roster read from the SAME working tree path so they observe the exact diff the Executor produced. Verifiers remain strictly read-only there.
61
- - **Lifecycle**: the worktree is kept after the run completes (no automatic cleanup) and is reused by every subsequent phase of the same task-key. Cleanup, when the task is fully done, is manual: `git -C <main-worktree> worktree remove <path>` followed by `git -C <main-worktree> branch -D <branch>`, plus removing the task-key entry from `~/.okstra/worktrees/registry.json`.
62
- - **Skipped paths**: when status is `skipped-in-worktree` or `skipped-not-git`, the executor operates in `project_root` as before. Cite the status in the final report's metadata header so reviewers know which path was taken.
63
- - **Synced okstra state directory (symlink into the MAIN worktree)**: at provision time `okstra-ctl` may symlink `.project-docs/` from the repo's **main worktree** into the task worktree. This is NOT an independent copy — writes through it land in the main worktree. Inside this run the executor MUST confine okstra artifact writes to its own task scope (i.e. `.project-docs/okstra/tasks/<this-task-id>/...`). Other synced directories, if present due to local configuration, are not implicit okstra context; read them only when the brief explicitly cites them as source material.
64
- - Pre-implementation context exploration (executor before first edit):
65
- - **Mandatory TDD loop**: BEFORE the first `Edit` or `Write` call, the executor MUST apply a red-green-refactor loop for every code change in this run. This is required; skipping it is a `contract-violated` outcome. This governs HOW each step is executed (failing test first → minimal implementation → refactor); it does not override the approved plan's WHAT/file scope.
66
- - Order of operations per plan step: (1) write/extend the test that captures the step's acceptance criterion and confirm it fails for the right reason, (2) commit the failing test (`test(<scope>): ...`), (3) implement the minimum change to make it pass, (4) commit the implementation (`feat|fix(<scope>): ...`), (5) refactor without changing behaviour and commit separately if any cleanup is made (`refactor(<scope>): ...`). The failing-then-passing transition between steps (2) and (4) is the `TDD evidence` required by the final report.
67
- - Doc-only / config-only / pure-rename steps that have no observable runtime behaviour are exempt from the failing-test requirement, but the executor MUST cite the exemption per step in the final report (`TDD exemption: <reason>`).
68
- - When the touched area has no existing test harness, the executor MUST stand up the minimum harness needed to host one regression test for this run rather than skipping TDD entirely. Record the harness-bootstrap step as an `Out-of-plan edit` if it is not in the plan.
69
- - re-read the approved plan end-to-end and parse the `## 4.5 Stage Map`. Determine **start stage**:
70
- - if `--stage <N>` is supplied, use N. Otherwise auto = the lowest stage number whose `depends-on` are all recorded as `status:done` in `runs/<plan-key>/consumers.jsonl` AND that itself has no `status:done` row. Multiple stages may match — two parallel `implementation` runs may pick different ones and proceed concurrently.
71
- - load every `runs/<plan-key>/carry/stage-<i>.json` for `i ∈ depends-on(start_stage)` and inject them into the executor's working context as "runtime carry-in". For `depends-on (none)` stages, no sidecar load — task-brief only.
72
- - extract the **start stage's** file list, step order, Stage Validation commands, Stage Exit Contract, and rollback path. These — not the whole plan — are the authoritative scope for this run.
73
- - inspect the current state of every file the plan names; if any file has changed materially since the plan was written, stop and route to a new `implementation-planning` run instead of editing speculatively
74
- - "materially changed" means: the function, class, section, or behaviour the plan targets has been edited, renamed, moved, removed, or otherwise altered in a way that invalidates the plan's reasoning. Cosmetic edits (whitespace, comment-only changes, unrelated function modifications elsewhere in the same file) do NOT trigger a re-plan; cite the diff (`git log --oneline <plan-created-at>..HEAD -- <file>`) in the final report and proceed.
75
- - distinguish the two file-scope rules (they are not in conflict):
76
- - **drift rule** (this section): if a file *named in the plan* has materially drifted, refuse to edit and route back to planning. This protects trust in the approved scope.
77
- - **out-of-plan rule** (Allowed actions section below): if a step *requires touching a file NOT in the plan list*, that is permitted with `Out-of-plan edits` justification. This handles honest scope discovery during execution.
78
- - confirm the test/build commands referenced in the plan still exist and run from a clean state
79
- - Stage execution contract (this run owns exactly one stage of the plan):
80
- - **Sidecar evidence writer (BLOCKING).** When the start stage's Stage Validation `post` commands all succeed, the Executor MUST emit a JSON object matching the schema in `docs/superpowers/specs/2026-05-20-implementation-planning-multi-stage-design.md` §3.2 and the lead MUST persist it to `runs/<impl-task-key>/carry/stage-<N>.json`. The file MUST NOT exist before the run starts (overwrite is refused — see `--force-stage` non-goal).
81
- - **Reverse link (BLOCKING).** Before the first Edit/Write, append a `status:"started"` row to `runs/<plan-task-key>/consumers.jsonl` (lock via the okstra runtime). On stage completion, append a `status:"done"` row with `carry_path` populated.
82
- - **One-PR-per-stage.** This run creates exactly one PR titled `Stage <N>: <stage title>`. The PR body MUST include:
83
- - `## Stage` — number and title (from Stage Map row).
84
- - `## Carry-In summary` — depends-on list + cited identifiers/SHAs from each loaded sidecar (omit when depends-on is empty).
85
- - `## Next stage` — next stage number/title or `(last stage)`.
86
- Stage PRs link back to each other in their bodies (`Previous: #<n>, Next: #<m>` lines) so a reviewer can navigate the chain.
87
- - Allowed actions during the run:
88
- - **Edit / Write on approved project source files**: scope is bounded first by the shared Resource boundary, then by the approved plan's file list. Editing files outside the plan's list is permitted only when strictly needed to satisfy a step, and MUST be recorded in the final report's `Out-of-plan edits` block with rationale.
89
- - read-only inspection commands: `git status`, `git diff`, `git log`, `grep`, `rg`, `find`, `cat`, `ls`, file Read tools
90
- - build, lint, type-check, and test commands (`npm test`, `pytest`, `go build`, `cargo test`, `bash -n`, etc.)
91
- - **local git operations only**: `git add`, `git commit`. Prefer small commits keyed to plan steps.
92
- - **Commit message format (mandatory)**: every commit message MUST follow Conventional Commits — `<type>(<scope>): <subject>` for the first line, optional body separated by a blank line, optional footer. Constraints:
93
- - `<type>` MUST be one of: `feat` / `fix` / `perf` / `revert` / `deps` / `docs` / `refactor` / `build` / `ci` / `chore` / `test`. When the repo is `release-please`-managed, this aligns the commit with a configured changelog section.
94
- - `<scope>` SHOULD be the plan step identifier or the primary module touched (e.g. `feat(report-writer): ...`). Omit the parentheses only when no meaningful scope applies.
95
- - `<subject>` MUST be ≤72 characters, imperative mood (`add`, `fix`, `remove` — not `added` / `adding`), no trailing period, no emoji, no AI attribution lines (no `Co-Authored-By: Claude ...`, no `Generated with Claude Code`).
96
- - Body (when present) explains *why*, not *what*; wrap at ~100 chars.
97
- - Do NOT append okstra artefact paths to the commit message — no `Plan: .project-docs/okstra/...`, no `Report: ...`, no `Run: ...`, no `Task: ...` footers, and no other reference to files under `.project-docs/okstra/`. Those paths belong in the final report's `Plan link & approval evidence` section, not in git history; they rot quickly and leak internal layout into the upstream changelog.
98
- - Allowed footers are limited to standard Conventional Commits trailers (`BREAKING CHANGE: ...`, `Refs: <issue/ticket-id>`, `Closes #<n>`). When citing a ticket, use the ticket id only (e.g. `Refs: DEV-9423`) — never a filesystem path.
99
- - One commit MUST correspond to one plan step (or one cohesive sub-step). Do NOT bundle unrelated steps into a single commit, and do NOT split a single step across commits unless the plan explicitly sequenced it that way.
100
- - The exact message used for each commit MUST be reproduced verbatim in the final report's `Commit list` so reviewers can audit it without re-running `git log`.
28
+ - Treat the working-tree path as `project_root` for the duration of this run. Do NOT mutate the caller's original checkout. cwd-sensitive Bash commands MUST be prefixed `cd {{EXECUTOR_WORKTREE_PATH}} && ` in the same Bash invocation (never `bash -lc "..."` wrapperssee executor sidecar for full rules).
29
+ - Lifecycle: kept after the run completes; reused by every subsequent phase of the same task-key. Manual cleanup: `git worktree remove <path>` `git branch -D <branch>` drop registry entry.
101
30
  - Approval gate (phase-specific addendum to shared authority rule):
102
- - the pre-implementation gate's recorded user approval marker is the only authorised approval gate at this phase — proceed once it is satisfied without further external coordination
103
- - Forbidden actions (any occurrence → terminal status `contract-violated`):
31
+ - the pre-implementation gate's recorded user approval marker is the only authorised approval gate at this phase — proceed once it is satisfied without further external coordination.
32
+ - Forbidden actions — universal (any occurrence → terminal status `contract-violated`):
104
33
  - **`git push` of any kind**, including `--dry-run` against a real remote that produces side-effects
105
34
  - publishing or release commands: `npm publish`, `cargo publish`, `pip publish`, `gh release`, `docker push`
106
- - real database migrations, schema changes that touch shared environments, or any command that writes to a non-local datastore
107
- - production credentials, deploy commands, infra mutation (`terraform apply`, `kubectl apply` against non-local cluster, etc.)
108
- - external API calls that *write* (POST/PUT/PATCH/DELETE) to third-party services other than localhost test fixtures
109
- - source edits or Bash mutations performed by any verifier role
110
- - any Edit/Write before the pre-implementation gate has passed
35
+ - real database migrations or schema changes that touch shared environments
36
+ - production credentials, deploy commands, infra mutation against non-local clusters
37
+ - external API WRITE calls (POST/PUT/PATCH/DELETE) to third-party services other than localhost test fixtures
111
38
  - dispatching parallel sub-agents beyond the required worker roster
112
- - silent scope expansion — adding files, dependencies, or features that the approved plan did not list, without recording an `Out-of-plan edits` justification
113
- - leaving placeholders such as TBD / TODO / "implement later" / "handle edge cases" in committed code
114
- - **(verifier-specific)** running lint / formatter auto-fix modes during a verifier's re-run — `eslint --fix`, `prettier --write`, `ruff check --fix`, `rustfmt` (writes by default; verifiers MUST use `cargo fmt --check` or `rustfmt --check`), `gofmt -w`, `black .` (use `black --check`), `isort .` (use `isort --check-only`), or any equivalent rewrite mode
115
- - **(verifier-specific)** updating snapshots / golden fixtures during verification — `jest -u` / `--updateSnapshot`, `pytest --snapshot-update`, `INSTA_UPDATE=*` (any value other than `no`), `cargo insta accept`, `--update-goldens`, or any equivalent "make the test agree with current output" flag
116
- - **(verifier-specific)** masking test failure with selection or shell tricks during re-run — `-k <expr>` / `--ignore` / `--deselect` to skip subsets, trailing `|| true`, `set +e` followed by a manually softened comparison, redirecting non-zero exit to success. The plan's listed test command MUST run in full
117
- - **(verifier-specific)** substituting the plan's validation commands — verifier MUST run the plan's pre/mid/post validation commands verbatim; replacing them with paraphrased or "equivalent" commands is forbidden. Adding supplementary check-only lint/type-check is allowed and is logged separately in the verifier's Read-only command log
118
- - **(verifier-specific)** mutating lockfiles or dependency manifests — `npm install <pkg>`, `npm install` (without lockfile freeze; use `npm ci`), `pnpm add`, `bun add`, `cargo add`, `cargo update`, `pip install -U`, or any dependency install that is not lockfile-frozen (`--locked` / `--frozen-lockfile` / `npm ci` / `pip install --require-hashes`)
119
- - **(verifier-specific)** git state mutations — `git add`, `git commit`, `git stash`, `git checkout -- <file>`, `git restore`, `git reset`, `git rebase`, `git merge`, branch creation/deletion, tag creation. Only read-only git queries (`git status`, `git diff`, `git log`, `git show`, `git rev-parse`, `git blame`) are permitted for verifiers
120
- - **(verifier-specific)** running integration / end-to-end tests that produce non-local side effects (DB writes against a non-local datastore, external API writes, docker compose against a non-isolated environment) unless that exact command is listed in the approved plan's validation set
121
- - **(verifier-specific)** redirecting tool caches or output to paths outside the worktree — e.g. setting `CARGO_TARGET_DIR`, `PYTEST_CACHE_DIR`, `NODE_OPTIONS=--require=<external>`, or any env var that causes the verifier's command to write outside the worktree's normal build artifact paths
122
- - Required deliverable shape (final report, in addition to the standard sections):
123
- - **Plan link & approval evidence**: path to the approved `final-report.md`, the exact quoted approval marker, AND the executed stage number / title quoted from the Stage Map row.
124
- - **Commit list**: each commit's SHA (or short SHA), message, and the plan step it satisfies
125
- - **Diff summary**: `git diff --stat <base>..HEAD` output, plus a per-file one-line summary of changes
126
- - **Out-of-plan edits block**: every file edited that was not in the approved plan's file list, with rationale (empty block is acceptable and preferred)
127
- - **Stage sidecar evidence**: the JSON payload of `runs/<impl-task-key>/carry/stage-<N>.json` is embedded verbatim in a fenced ```json``` block, AND the `consumers.jsonl` rows this run appended are quoted line-by-line, so reviewers can audit the carry surface without grepping artifact directories.
128
- - **Validation evidence**: actual command output (stdout/stderr) for every `pre / mid / post` validation command from the plan. Truncated output is acceptable but the command line and exit code MUST be exact. No paraphrasing of test results.
129
- - **TDD evidence (when applicable)**: for steps that should be TDD-ordered, show the failing-test output BEFORE the implementation commit and the passing-test output AFTER, with commit SHAs framing the transition.
130
- - **Verifier results**: a section per verifier present in the resolved roster (`Claude verifier`, `Codex verifier`, and `Gemini verifier` when opted in) containing:
131
- - their independent verdict (PASS / CONCERNS / FAIL),
132
- - cited diff snippets supporting the verdict,
133
- - the verifier's `Read-only command log` (every command they ran with exact invocation and exit code, in execution order — copied verbatim from the worker result),
134
- - **independent validation re-run results** — per plan-validation command: command line, exit code, and tail of output captured by the verifier (not the executor); any divergence from the executor's reported result MUST be called out as a `Discrepancy` line citing both sides,
135
- - **style / lint / type-check results** — each check-only tool the verifier ran, its exit code, and the count of new findings attributable to lines this run introduced. When no tool is configured for a touched language, record the single line `no lint/style tool configured for <language>`,
136
- - any fix recommendations the verifier declined to apply.
137
- `Claude lead` synthesises a unified verdict but MUST preserve dissent — do not collapse opinions into one paragraph. If any verifier issued `FAIL` on a `Discrepancy` line, the synthesised verdict MUST be `FAIL` unless lead cites a concrete reproduction-time reason (committed flaky-test record, documented environment delta) for overriding.
138
- - **Rollback verification**: confirmation that the plan's rollback path is still valid after the changes. Strength of verification depends on the change category:
139
- - **Pure code changes** (no persisted state, no infra mutation): a reachable revert SHA is sufficient. Record the exact `git revert <SHA>` command that would undo the change, and confirm `git rev-parse <SHA>` resolves.
140
- - **Feature-flag-gated changes**: confirm the off-switch path was exercised in this run's validation evidence (i.e. one of the validation commands ran with the flag off and succeeded). A plan that ships a flag without exercising the off-path does NOT satisfy this requirement.
141
- - **Schema migrations, config-format changes, or any change with persisted state**: a **dry-run of the rollback step is mandatory**, not preferred. Record the exact rollback command and its captured exit code / stdout. If the migration tool offers no dry-run mode (`--dry-run`, `--plan`, equivalent), the executor MUST refuse to claim rollback verification and instead end the run with a routing recommendation back to `implementation-planning` for a safer rollback strategy. Skipping this step on a stateful change is treated as a `contract-violated` outcome by `final-verification`.
142
- - **Routing recommendation for `final-verification`**: brief note on whether the changes are ready for final-verification phase or need a new error-analysis / planning loop first.
143
- - **Follow-up tasks (Section 7 of the final report)**: every item discovered during this run that was *not* delivered MUST appear in the final report's `## 7. Follow-up Tasks (후속 작업)` table with a concrete `Origin`, `New Task ID`, `Suggested task-type`, `Scope`, and `Reason / Why deferred`. Sources include: out-of-scope discoveries that the executor consciously chose not to fold into this run, verifier concerns the executor declined to fix in-place, scope-boundary items from the approved plan that turned out to need their own ticket, and any unresolved `## 5. Clarification Items` row carried over from the approved plan (`Status` ∈ `{open, answered}` at approval time). An empty section is acceptable but only when expressed as the single line `- 후속 작업 없음.` — silence is treated as a contract violation. Rows with `Auto-spawn? = yes` will be materialised by `scripts/okstra-spawn-followups.py` in Phase 7; rows with `Auto-spawn? = no` MUST also appear in `Section 6. Recommended Next Steps` so the user knows to act manually.
144
- - Self-review pass before finalising the report (`Claude lead` runs this; do not delegate to a generic subagent):
145
- 1. **Plan coverage** — every step in the approved plan's recommended option must point to a commit (or an explicit `Skipped: <reason>` entry). List gaps.
146
- 2. **Evidence completeness** — every `Validation evidence` and `TDD evidence` claim has the actual command line and exit code? No paraphrased "tests pass" without output?
147
- 3. **Out-of-plan honesty** — files in the diff that are NOT in the plan list must appear in the `Out-of-plan edits` block. Cross-check with `git diff --name-only`.
148
- 4. **Verifier dissent preserved** — if the verifiers in the resolved roster disagree, the disagreement is visible in the report? Synthesis hides nothing?
149
- 5. **Forbidden action audit** — `git push`, publish, deploy, migration, third-party write commands: scan the run's session transcripts for any occurrence and confirm none happened.
150
- 6. **Placeholder scan** — restrict the scan to lines this run actually introduced; pre-existing placeholders in unchanged regions of touched files are out of scope. Required command (substitute `<base>` with the parent of the first commit in this run's commit list):
151
- ```
152
- git diff <base>..HEAD | grep -E '^\+[^+].*\b(TBD|TODO|FIXME|XXX|implement later|handle edge cases|similar to|placeholder)\b' || echo 'clean'
153
- ```
154
- Only newly-added lines (those starting with `+` and not part of the `+++` header) are inspected. If output is anything other than `clean`, the run MUST either remove the placeholders before finalising or record an explicit justification per occurrence in the final report.
155
- - Lead post-stage persistence (BLOCKING — runs after the Executor emits `### Stage Carry Evidence`):
156
- - Parse the executor's `### Stage Carry Evidence` JSON block. If absent or unparsable, end with status `contract-violated` and route to a follow-up `error-analysis`.
157
- - Write the JSON verbatim to `runs/<impl-task-key>/carry/stage-<N>.json`. Refuse to overwrite an existing file (one stage = one sidecar; re-runs are out of scope for this version).
158
- - Append a `status:"done"` row to `runs/<plan-task-key>/consumers.jsonl` with `completed_at`, `carry_path`, and the SHA of HEAD. Use the okstra runtime's `consumers_mutex` helper (NOT a raw filesystem write) to honour the lock.
159
- - Quote both files' new contents (the sidecar JSON in full, the new consumers row by itself) in the final report's `Stage sidecar evidence` deliverable section.
39
+ - any Edit/Write before the pre-implementation gate has passed
40
+ - source edits or Bash mutations performed by any verifier role (verifier-specific deny-list lives in the verifier sidecar)
160
41
  - In-phase debugging:
161
42
  - isolate root cause before changing the fix direction, but the executor MUST NOT route to a separate `error-analysis` phase mid-run; if a defect blocks plan progress, the executor records findings and routes to a new run after this one ends.
43
+
44
+ ## Lazy section pointers (BLOCKING for lead — load at the listed phase, not at Phase 1)
45
+
46
+ The bulk of this profile's body is split into three sidecars so the lead's Phase 1 baseline stays under ~50 effective lines. Read each sidecar ONCE, at the phase noted, into the lead's active context — do NOT pre-load them at Phase 1.
47
+
48
+ | Sidecar | Read at | Purpose |
49
+ |---------|---------|---------|
50
+ | `prompts/profiles/_implementation-executor.md` | Start of Phase 5 (after Stage Map parse, before Executor's first Edit / Write) | Executor role binding, Pre-implementation context exploration, TDD loop, Stage execution contract, allowed actions, commit-message format |
51
+ | `prompts/profiles/_implementation-verifier.md` | Phase 5, between Executor stage completion and the first verifier dispatch | Verifier roles, Two-tier command lookup, deny-list, discrepancy rule, Read-only command log, verifier-specific forbidden actions |
52
+ | `prompts/profiles/_implementation-deliverable.md` | Start of Phase 6 (after Phase 5.5 convergence completes, before report-writer dispatch prompt construction) | Required deliverable shape, Validation / TDD evidence rules, Verifier results structure, Self-review pass, Lead post-stage persistence |
53
+
54
+ **Phase 5 / 6 진입 시 해당 sidecar 가 lead context 에 없으면 BLOCKING — phase 진입 거부.** Lead 는 sidecar 를 read 한 후 1 회 turn 안에 phase 의 후속 action 으로 이어가야 한다 (즉 sidecar 의 룰은 read 한 그 turn 부터 효력 발생).
@@ -165,6 +165,9 @@ def compute_run_paths(
165
165
  "TASK_TYPE_SEGMENT": task_type_segment,
166
166
  "OKSTRA_ROOT": str(okstra_root),
167
167
  "OKSTRA_TASKS_ROOT": str(tasks_root),
168
+ "WORKER_PROMPT_PREAMBLE_PATH": str(
169
+ Path.home() / ".okstra" / "templates" / "worker-prompt-preamble.md"
170
+ ),
168
171
  "OKSTRA_DISCOVERY_DIR": str(discovery_dir),
169
172
  "TASK_ROOT": str(task_root),
170
173
  "TASK_MANIFEST_PATH": str(task_manifest),
@@ -651,15 +651,25 @@ def render_task_manifest(manifest_path: str, ctx: dict) -> None:
651
651
  "WORKFLOW_WORK_CATEGORY", "unknown"
652
652
  )
653
653
  # Compute the canonical next phase from current_phase deterministically.
654
- # Only preserve `existing.workflow.nextRecommendedPhase` when it is a
655
- # legitimate forward pointer i.e. NOT equal to `current_phase` itself
656
- # (which would mean the lifecycle pointer has stalled on the current
657
- # phase and would loop forever).
654
+ # Only advance past `current_phase` when its state is terminal-success
655
+ # (`completed`). For `prepared` / `in-progress` / `blocked` / `error` /
656
+ # `contract-violated` states the recommendation MUST stay on
657
+ # `current_phase` advancing prematurely makes wizards (and humans)
658
+ # think the current phase is done when it has merely been provisioned.
659
+ # Historical bug: implementation provisioned in `prepared` state caused
660
+ # the wizard to recommend `final-verification` as the default task_type.
658
661
  canonical_next = default_next_phase.get(
659
662
  current_phase, ctx.get("WORKFLOW_NEXT_RECOMMENDED_PHASE", "unknown")
660
663
  )
661
664
  existing_next = workflow.get("nextRecommendedPhase") or ""
662
- if existing_next and existing_next != current_phase:
665
+ terminal_success_states = {"completed"}
666
+ if current_phase_state not in terminal_success_states:
667
+ # Current phase has not finished — recommend staying on it. Suppress
668
+ # any stale `existing_next` that points further forward in the
669
+ # sequence; only honour a stale value if it points to the SAME
670
+ # current_phase (i.e. encodes "re-enter current phase").
671
+ next_recommended_phase = current_phase
672
+ elif existing_next and existing_next != current_phase:
663
673
  next_recommended_phase = existing_next
664
674
  else:
665
675
  next_recommended_phase = canonical_next
@@ -1516,6 +1526,10 @@ def apply_lead_prompt_defaults(ctx: dict) -> None:
1516
1526
  ctx.setdefault("VALIDATION_STATUS", "not-run")
1517
1527
  ctx.setdefault("RELATED_TASKS_BULLETS", "- None recorded")
1518
1528
  ctx.setdefault("RELATED_TASKS_INLINE", "None")
1529
+ ctx.setdefault(
1530
+ "WORKER_PROMPT_PREAMBLE_PATH",
1531
+ str(Path.home() / ".okstra" / "templates" / "worker-prompt-preamble.md"),
1532
+ )
1519
1533
  if "AVAILABLE_MCP_SERVERS" not in ctx:
1520
1534
  ctx["AVAILABLE_MCP_SERVERS"] = build_available_mcp_servers_block(
1521
1535
  Path(ctx.get("PROJECT_ROOT", "."))
@@ -883,7 +883,13 @@ def prepare_task_bundle(inp: PrepareInputs) -> PrepareOutputs:
883
883
  # path that does not exist.
884
884
  write_claude_resume_command_file(
885
885
  resume_command_path=Path(ctx["CLAUDE_RESUME_COMMAND_PATH"]),
886
- project_root=project_root, claude_session_id=claude_session_id,
886
+ project_root=project_root,
887
+ claude_session_id=claude_session_id,
888
+ task_key=ctx["TASK_KEY"],
889
+ task_type=ctx["TASK_TYPE"],
890
+ phase_state=ctx["CURRENT_RUN_STATUS"],
891
+ worker_prompts_dir_relative=ctx["RUN_PROMPTS_RELATIVE_PATH"],
892
+ prompt_seq=ctx["RUN_PROMPTS_SEQ"],
887
893
  )
888
894
 
889
895
  # ---- write instruction-set scaffolding ----
@@ -49,18 +49,76 @@ def resolve_inproc_lead_session_id(project_root: Path) -> str:
49
49
 
50
50
 
51
51
  def write_claude_resume_command_file(
52
- *, resume_command_path: Path, project_root: Path, claude_session_id: str,
52
+ *,
53
+ resume_command_path: Path,
54
+ project_root: Path,
55
+ claude_session_id: str,
56
+ task_key: str,
57
+ task_type: str,
58
+ phase_state: str,
59
+ worker_prompts_dir_relative: str,
60
+ prompt_seq: str,
53
61
  ) -> None:
54
62
  """`bash claude-resume-*.sh` 를 실행하면 task 의 claude 세션을 resume
55
63
  하도록 shell 스크립트를 작성하고 chmod +x.
64
+
65
+ `claude --resume` 자체는 직전 세션 context 만 복구하고 lead 는
66
+ 사용자 입력 대기 상태로 멈춘다. 따라서 사용자가 resume 후 무엇을
67
+ 입력해야 하는지를 안내하는 guidance 블록을 sh 안에 inline 한다 —
68
+ sh 가 실행될 때 worker prompt 디스크 존재 여부를 직접 검사해
69
+ Phase 2 부터 / Phase 3 부터 중 알맞은 다음 명령을 추천한다.
56
70
  """
57
71
  resume_command_path = Path(resume_command_path)
58
72
  resume_command_path.parent.mkdir(parents=True, exist_ok=True)
59
- body = (
60
- "#!/usr/bin/env bash\n"
61
- "# Generated by okstra. Resume the prepared Claude session for this run.\n"
62
- f'cd "{project_root}"\n'
63
- f'exec claude --resume "{claude_session_id}"\n'
64
- )
73
+ body = f"""#!/usr/bin/env bash
74
+ # Generated by okstra. Resume the prepared Claude session for this run.
75
+
76
+ TASK_KEY={_sh_single_quote(task_key)}
77
+ TASK_TYPE={_sh_single_quote(task_type)}
78
+ PHASE_STATE={_sh_single_quote(phase_state)}
79
+ PROJECT_ROOT={_sh_single_quote(str(project_root))}
80
+ WORKER_PROMPTS_DIR="$PROJECT_ROOT/{worker_prompts_dir_relative}"
81
+ PROMPT_SEQ={_sh_single_quote(prompt_seq)}
82
+ SESSION_ID={_sh_single_quote(claude_session_id)}
83
+
84
+ cat >&2 <<EOF
85
+ ============================================================
86
+ okstra resume — $TASK_KEY
87
+ Phase: $TASK_TYPE ($PHASE_STATE)
88
+ ============================================================
89
+
90
+ 이 스크립트는 Claude 세션 context 만 복구합니다.
91
+ Lead 는 resume 직후 자동으로 진행하지 않으니, 첫 메시지로 다음을
92
+ 그대로 (또는 상황에 맞게 수정해서) 입력하세요:
93
+
94
+ EOF
95
+
96
+ if compgen -G "$WORKER_PROMPTS_DIR/*-worker-prompt-$TASK_TYPE-$PROMPT_SEQ.md" > /dev/null 2>&1; then
97
+ cat >&2 <<EOF
98
+ Phase 3 부터 진행 — TeamCreate 후 Phase 4 worker dispatch 까지.
99
+ Worker prompts (이미 작성·저장됨):
100
+ $WORKER_PROMPTS_DIR/*-worker-prompt-$TASK_TYPE-$PROMPT_SEQ.md
101
+ EOF
102
+ else
103
+ cat >&2 <<EOF
104
+ Phase 2 부터 진행 — worker prompts 작성·저장 후 Phase 3 진행.
105
+ Prompts directory (현재 비어 있음):
106
+ $WORKER_PROMPTS_DIR
107
+ EOF
108
+ fi
109
+
110
+ cat >&2 <<EOF
111
+
112
+ ============================================================
113
+ EOF
114
+
115
+ cd "$PROJECT_ROOT"
116
+ exec claude --resume "$SESSION_ID"
117
+ """
65
118
  resume_command_path.write_text(body, encoding="utf-8")
66
119
  os.chmod(resume_command_path, 0o755)
120
+
121
+
122
+ def _sh_single_quote(value: str) -> str:
123
+ """POSIX-safe single-quote: `it's` → `'it'"'"'s'`."""
124
+ return "'" + value.replace("'", "'\"'\"'") + "'"
@@ -676,218 +676,9 @@ Use the same template per brief file. In tracker mode producing a parent
676
676
  plus N children, you write **N+1 files** (each carries only its own Source
677
677
  Material).
678
678
 
679
- Use this exact template. Leave a section's body as `_(none)_` rather than
680
- fabricating content. (The outer fence uses 4 backticks so it does not
681
- collide with the inner 3-backtick code block.)
679
+ [`templates/reports/brief.template.md`](../../templates/reports/brief.template.md) is the byte-for-byte SSOT for the brief shape — frontmatter keys, top-header blockquote, section ordering, and inline `<!-- author guidance -->` HTML comments. Render that file with the per-brief values substituted; leave any section's body as `_(none)_` rather than fabricating content. Preserve the template's HTML comments verbatim (they are part of the contract) but do NOT promote them to body prose.
682
680
 
683
- ````markdown
684
- ---
685
- type: brief
686
- brief-id: <ticket-id>-<file-title> # equals the filename stem
687
- parent-id: self # always `self` at root; child briefs use parent's brief-id
688
- ticket-id: <LIN-1234 | PROJ-42 | gh-repo-123 | notion-abcdef12 | "">
689
- source-type: <file | linear | jira | github | notion | url | user-input>
690
- task-group: <task-group>
691
- depth: 0 # 0=parent/single, 1=child, 2=grandchild, ...
692
- created: <YYYY-MM-DD>
693
- generator: okstra-brief
694
- reporter-confirmations: <complete | partial | pending | skipped> # set by Step 6.5
695
- # codebase-scan variant frontmatter (omit for reporter-input briefs):
696
- scope: <reporter-input | codebase> # 'codebase' for codebase-scan variant; omit for reporter-input variant
697
- priority-lenses: [] # codebase-scan only: lens enum subset, size 1..4
698
- scan-scope: [] # codebase-scan only: 1+ paths
699
- out-of-scope: [] # codebase-scan only: optional
700
- candidate-cap: 8 # codebase-scan only: 1..12, default 8
701
- ---
702
-
703
- # Task Brief: <task_group>/<filename-without-ext>
704
-
705
- > Generated: okstra-brief · <YYYY-MM-DD>
706
- > Source type: <file | linear | jira | github | notion | url | user-input>
707
- > Tracker key (if any): <LIN-1234 | PROJ-42 | gh-repo-123 | notion-abcdef12>
708
- > Parent brief (child briefs only): <relative path>
709
- > Recommended next phase: <requirements-discovery | error-analysis> ← from Step 6
710
- > Handoff contract: see `prompts/profiles/_common-contract.md` § "Brief handoff contract"
711
-
712
- ## Source Material
713
-
714
- <!-- author guidance — strip out at fill-in time:
715
- Paste each source separately and as-is. No paraphrasing, summarizing, or
716
- restructuring. Format conversion (e.g. Jira ADF → Markdown) is allowed and
717
- must be annotated in the header meta. Heading was originally
718
- "Source Material (verbatim — do not modify)" — the parenthetical is a
719
- reviewer note, not body text.
720
- -->
721
-
722
- ### Source 1 — <type: file | linear | jira | github | notion | url | user-input>
723
-
724
- - ref: <abs file path | LIN-1234 | https://... | "conversation synthesis">
725
- - fetched-via: <Read | mcp__linear__getIssue | mcp__notion__... | gh issue view | WebFetch | user-paste>
726
- - fetched-at: <YYYY-MM-DD HH:MM>
727
- - format: <as-is | "Jira ADF → Markdown (semantics preserved)" | "tool-truncated — missing body requested from reporter">
728
-
729
- ```
730
- <Paste the raw source here without changing a single character.>
731
- ```
732
-
733
- <!-- Repeat `### Source N — …` blocks as needed. -->
734
-
735
- ## Context
736
-
737
- <Background / scope / why now. If self-evident from Source Material, quote
738
- it briefly and stop. Use the blockquote below when augmentation is needed.>
739
-
740
- > augmented: <label> — <Interpretation added by the skill or user.>
741
-
742
- <!-- label MUST be one of: `evidence-link` / `format-conversion` /
743
- `terminology-mapping` / `intent-inference`. Do NOT add any extra
744
- interpretation outside the `> augmented:` blockquote. -->
745
-
746
- ## Problem / Symptom
747
-
748
- <Current state. For bugs: repro / observed / expected. For greenfield: gap
749
- between current and desired.>
750
-
751
- <!-- Same source-quote + `> augmented:` rule as the Context section. -->
752
-
753
- ## Desired Outcome
754
-
755
- <Shape of success.>
756
-
757
- <!-- Do NOT prescribe a solution — that belongs to implementation-planning. -->
758
-
759
- ## Constraints
760
-
761
- <Deadlines, compatibility, technical/operational limits. Use _(none)_ if
762
- none.>
763
-
764
- ## Scan Scope
765
-
766
- <!-- codebase-scan variant only — omit this section for reporter-input briefs. -->
767
- <!-- Author guidance: one bullet per `scan-scope` path with a short description of what lives there. -->
768
-
769
- - <path>: <one-line description of contents / responsibility>
770
-
771
- ## Priority Lenses
772
-
773
- <!-- codebase-scan variant only — omit this section for reporter-input briefs. -->
774
- <!-- Author guidance: one bullet per priority lens explaining why it is a priority for THIS scope. -->
775
-
776
- - <lens>: <short rationale tying this lens to the scope's risk surface>
777
-
778
- ## Related Artifacts
779
-
780
- - <file path / URL / issue / prior task-key>
781
-
782
- ## Open Questions
783
-
784
- <!-- author guidance — strip out at fill-in time:
785
- Prefix every row with one of these signals so the next phase knows how to
786
- handle it. Free-form rows are allowed only as `general:`.
787
-
788
- Allowed signals:
789
- - `general: <unresolved question the user flagged>`
790
- - `terminology: <reporter word> — needs canonical resolution against
791
- <PROJECT_ROOT>/.project-docs/okstra/glossary.md`
792
- - `intent-check: <restated inference> — confirm with reporter`
793
- (auto-paired with every `intent-inference` augmentation)
794
- - `conversion-block: <reporter statement> — could not be mapped to project
795
- vocabulary; reporter query required`
796
- - `adr-candidate: <topic>` — signal only; `implementation-planning`
797
- evaluates and, if accepted, drafts a decision file at
798
- `<PROJECT_ROOT>/.project-docs/okstra/decisions/<NNNN>-<slug>.md`.
799
-
800
- Use `_(none)_` only if every signal is empty. `intent-check:` and
801
- `conversion-block:` rows that are answered in Step 6.5 are NOT removed
802
- from this list — they receive a `[CONFIRMED <YYYY-MM-DD> → RC-N]`
803
- marker that links to the corresponding entry under
804
- `## Reporter Confirmations`.
805
- -->
806
-
807
- - <fill in one row per signal, or replace with `_(none)_`>
808
-
809
- ## Reporter Confirmations
810
-
811
- <!-- Populated by Step 6.5. Each subsection records one reporter answer
812
- verbatim, with a link back to the originating `Open Questions` row. -->
813
-
814
- _(none — pending or skipped)_
815
-
816
- <!-- when populated, the shape is:
817
- ### RC-1 — <intent-check: or conversion-block: row id / topic>
818
- - asked: <YYYY-MM-DD HH:MM>
819
- - linked-row: `<exact Open Questions row text>`
820
- - answer (verbatim):
821
-
822
- > <reporter's answer, byte-for-byte>
823
- -->
824
-
825
- ## Augmentation
826
-
827
- <!-- author guidance — strip out at fill-in time:
828
- Cross-references / interpretation / context added by the user or skill that
829
- is not in the original source. May be empty. Keep this section visually
830
- separated from Source Material — never inline it inside Source Material.
831
-
832
- Every entry below must start with one of the four labels:
833
- `evidence-link` / `format-conversion` / `terminology-mapping` /
834
- `intent-inference`. Unlabelled entries are forbidden.
835
- -->
836
-
837
- ### Domain alignment
838
-
839
- <!-- author guidance — strip out at fill-in time:
840
- Observations from Step 3b and the outcome of Step 4.5 (glossary applied
841
- vs. skipped). The actual glossary edits live in
842
- `<PROJECT_ROOT>/.project-docs/okstra/glossary.md` when applied; this
843
- section records what happened. Decision candidates are NOT recorded here —
844
- they flow through `Open Questions` as `adr-candidate:` rows for
845
- `implementation-planning` to evaluate (and, if accepted, draft into
846
- `<PROJECT_ROOT>/.project-docs/okstra/decisions/`).
847
-
848
- Allowed entry shapes:
849
- - `terminology-mapping: <reporter word> → <okstra glossary canonical>` —
850
- routine glossary alignment, paired with `terminology:` in Open Questions
851
- when unresolved.
852
- - `terminology-mapping: applied glossary: <term> → <PROJECT_ROOT>/.project-docs/okstra/glossary.md`
853
- - `terminology-mapping: skipped glossary: <term> = <definition>` —
854
- Step 4.5 outcomes.
855
- Use `_(none)_` if every alignment entry is empty.
856
- -->
857
-
858
- - <fill in one entry per alignment, or replace with `_(none)_`>
859
-
860
- ### Evidence links (file / symbol resolution)
861
-
862
- <!-- Allowed entry shapes:
863
- `evidence-link: <reporter phrase> → <relative path>:<line>` or
864
- `evidence-link: <reporter phrase> → <symbol> in <relative path>`.
865
- Use `_(none)_` if none. -->
866
-
867
- - <fill in one entry per link, or replace with `_(none)_`>
868
-
869
- ### Intent inferences
870
-
871
- <!-- Every entry here is an unverified hypothesis. Each one MUST have a
872
- paired `intent-check:` row under Open Questions.
873
-
874
- Allowed entry shape:
875
- `intent-inference: <reporter phrase> → <qualitative restatement>`
876
- (qualitative only — never invent numeric thresholds).
877
- Use `_(none)_` if none. -->
878
-
879
- - <fill in one entry per inference, or replace with `_(none)_`>
880
-
881
- ### Format conversions
882
-
883
- <!-- Allowed entry shape:
884
- `format-conversion: <ref> — <e.g. Jira ADF → Markdown, semantics preserved>`.
885
- Use `_(none)_` if none. -->
886
-
887
- - <fill in one entry per conversion, or replace with `_(none)_`>
888
- ````
889
-
890
- **Variant note:** The template above is the canonical reporter-input shape. For the codebase-scan variant (`scope: codebase` in frontmatter), OMIT the `## Source Material` and `## Problem / Symptom` headings entirely — do NOT include them with `_(none)_` bodies. Instead, ADD `## Scan Scope` and `## Priority Lenses` sections (already present in the template above, marked with HTML comments). The remaining sections (Context / Desired Outcome / Constraints / Related Artifacts / Open Questions / Reporter Confirmations / Augmentation) apply to both variants.
681
+ **Variant note:** The template file is the canonical reporter-input shape. For the codebase-scan variant (`scope: codebase` in frontmatter), OMIT the `## Source Material` and `## Problem / Symptom` headings entirely — do NOT include them with `_(none)_` bodies. Instead, KEEP the `## Scan Scope` and `## Priority Lenses` sections (already present in the template file, marked with HTML comments). The remaining sections (Context / Desired Outcome / Constraints / Related Artifacts / Open Questions / Reporter Confirmations / Augmentation) apply to both variants.
891
682
 
892
683
  ### Required sections by variant
893
684