@open-agent-toolkit/cli 0.1.53 → 0.1.54

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.
@@ -1,199 +1,200 @@
1
- # Handoff Plan Template
1
+ # External Implementation Plan Template
2
2
 
3
- Every plan is written for an executor model that has **zero context**: it has not seen the advisor session, the audit, the other plans, or any prior conversation. It may be a smaller/cheaper model. Assume it is competent at following explicit instructions and weak at filling gaps, recovering from ambiguity, or knowing when to stop.
3
+ Use this template for plans written by `oat-repo-improve`. Every plan must stand alone for an executor that has zero context from the advisor session, source review, backlog discussion, or sibling plans.
4
4
 
5
- Three properties make a plan executable by a weaker model:
5
+ External plans are durable reference artifacts. They are deliberately not canonical OAT `plan.md` files and must not contain OAT phase IDs, task IDs, lifecycle readiness, review tables, or implementation bookkeeping.
6
6
 
7
- 1. **Self-contained context** — everything needed is in the file: paths, code excerpts, conventions, commands.
8
- 2. **Verification gates** — every step ends with a command and its expected result. The executor never has to _judge_ whether it succeeded.
9
- 3. **Hard boundaries and escape hatches** — explicit out-of-scope list, and "STOP and report" conditions instead of letting the model improvise when reality doesn't match the plan.
7
+ ## File Contract
10
8
 
11
- File naming: `plans/NNN-short-slug.md`, numbered in recommended execution order.
9
+ Write plans under `.oat/repo/reference/external-plans/` as:
12
10
 
11
+ `YYYY-MM-DD-<short-slug>.md`
12
+
13
+ Use this frontmatter:
14
+
15
+ ```yaml
16
+ ---
17
+ oat_generated: true
18
+ oat_external_plan: true
19
+ oat_external_plan_source: repo-audit|maintainability-review|backlog-review|backlog-directory|backlog-item
20
+ oat_external_plan_sources:
21
+ - <repo-relative source artifact or scope>
22
+ oat_external_plan_commit: <short SHA>
23
+ oat_backlog_items: []
24
+ oat_issue_url: null
25
+ created: '<ISO 8601 UTC>'
13
26
  ---
27
+ ```
14
28
 
15
- ## Template
29
+ `oat_backlog_items` contains backlog IDs represented by the plan. Keep it empty when none apply. Set `oat_issue_url` only after confirmed issue publication. Never record absolute workstation paths in durable frontmatter.
16
30
 
17
- ```markdown
18
- # Plan NNN: <Imperative title — what will be true after this plan>
19
-
20
- > **Executor instructions**: Follow this plan step by step. Run every
21
- > verification command and confirm the expected result before moving to the
22
- > next step. If anything in the "STOP conditions" section occurs, stop and
23
- > report — do not improvise. When done, update the status row for this plan
24
- > in `plans/README.md` — unless a reviewer dispatched you and told you they
25
- > maintain the index.
26
- >
27
- > **Drift check (run first)**: `git diff --stat <planned-at SHA>..HEAD -- <in-scope paths>`
28
- > If any in-scope file changed since this plan was written, compare the
29
- > "Current state" excerpts against the live code before proceeding; on a
30
- > mismatch, treat it as a STOP condition.
31
+ ## Plan Template
31
32
 
32
- ## Status
33
+ ````markdown
34
+ # <Imperative title: what will be true after execution>
33
35
 
34
- - **Priority**: P1 | P2 | P3
35
- - **Effort**: S | M | L
36
- - **Risk**: LOW | MED | HIGH
37
- - **Depends on**: plans/NNN-\*.md (or "none")
38
- - **Category**: bug | security | perf | tests | tech-debt | migration | dx | docs | direction
39
- - **Planned at**: commit `<short SHA>`, <YYYY-MM-DD>
40
- - **Issue**: <GitHub issue URL only when published via `--issues`; omit otherwise>
36
+ > [!NOTE]
37
+ > This is an external implementation plan, not a canonical OAT project
38
+ > `plan.md`. Execute it directly, or import it for tracked OAT execution with
39
+ > `oat-project-import-plan <this-file>`.
40
+ >
41
+ > Begin with the drift check. Follow the steps and verification gates in order.
42
+ > If a STOP condition occurs, stop and report instead of improvising.
41
43
 
42
- ## Why this matters
44
+ ## Outcome
43
45
 
44
- 2–5 sentences. The problem, its concrete cost, and what improves when this
45
- lands. Written so the executor (and a human reviewer) understands the intent —
46
- intent is what lets a correct judgment call happen when a detail is off.
46
+ State the observable end result in 2–5 sentences. Explain why it matters and preserve the source intent in language an executor and reviewer can understand without opening the source artifact.
47
47
 
48
- ## Current state
48
+ ## Source and live evidence
49
49
 
50
- The facts the executor needs, inlined never "as discussed" or "see audit":
50
+ - Source artifact or scope: `<repo-relative path or scope>`
51
+ - Planned at: commit `<short SHA>` on `<YYYY-MM-DD>`
52
+ - Related backlog items: `<ID and title, or none>`
53
+ - Verified evidence:
54
+ - `<file:line or command evidence>` — what it establishes
51
55
 
52
- - The relevant files, each with one line on its role:
53
- - `src/orders/api.ts` — order-list endpoint; contains the N+1 (lines 130–160)
54
- - Excerpts of the code as it exists today (short, with `file:line` markers),
55
- enough that the executor can confirm it's looking at the right thing.
56
- - The repo conventions that apply here, with a pointer to one exemplar file:
57
- "Error handling follows the Result pattern — see `src/lib/result.ts` and its
58
- use in `src/users/api.ts:40-60`. Match it."
59
- - Any documented vocabulary or design constraints the plan must honor, inlined
60
- from the intent/design docs found in recon: the relevant `CONTEXT.md` terms
61
- the executor should use in names and comments, the `DESIGN.md` tokens/components
62
- to reuse, or the ADR whose decision this work must stay consistent with. Quote
63
- the specific lines — the executor has not read those docs.
56
+ Distinguish source assertions from facts verified against the live repository. Do not copy stale evidence forward.
64
57
 
65
- ## Commands you will need
58
+ ## Drift check
66
59
 
67
- | Purpose | Command | Expected on success |
68
- | --------- | ----------------------- | ------------------- |
69
- | Install | `pnpm install` | exit 0 |
70
- | Typecheck | `pnpm typecheck` | exit 0, no errors |
71
- | Tests | `pnpm test -- <filter>` | all pass |
72
- | Lint | `pnpm lint` | exit 0 |
60
+ Run before editing:
61
+
62
+ ```bash
63
+ git diff --stat <planned-at SHA>..HEAD -- <in-scope paths>
64
+ ```
65
+ ````
73
66
 
74
- (Exact commands from this repo verified during recon, not guessed.)
67
+ If an in-scope file changed, compare the plan's current-state evidence with the live code. A material mismatch is a STOP condition unless the plan explicitly explains how to reconcile it.
75
68
 
76
- ## Suggested executor toolkit
69
+ ## Repository conventions
77
70
 
78
- (Optional include only when relevant skills/tools plausibly exist in the
79
- executor's environment. Skip the section otherwise.)
71
+ - Build: `<exact command>` `<expected success>`
72
+ - Typecheck: `<exact command or not applicable>`
73
+ - Test: `<exact command>` → `<expected success>`
74
+ - Lint/format check: `<exact non-mutating command>`
75
+ - Implementation pattern: `<exemplar file and the convention to match>`
76
+ - Git/PR convention: `<observed convention; do not push/open a PR unless instructed>`
80
77
 
81
- - Skills the executor should invoke if available, and for what:
82
- "use `vercel-react-best-practices` when writing the memoization in step 3".
83
- - Reference docs worth reading before starting, by path or URL.
78
+ Only include commands verified from repository instructions or configuration.
84
79
 
85
80
  ## Scope
86
81
 
87
- **In scope** (the only files you should modify):
82
+ ### In scope
88
83
 
89
- - `src/orders/api.ts`
90
- - `src/orders/api.test.ts` (create)
84
+ - `<exact file, directory, symbol, or behavior>`
91
85
 
92
- **Out of scope** (do NOT touch, even though they look related):
86
+ ### Out of scope
93
87
 
94
- - `src/orders/legacy-api.ts`deprecated path, scheduled for deletion;
95
- changing it wastes effort and risks the v1 clients still pinned to it.
96
- - Any change to the public response shape — clients depend on it.
88
+ - `<specific adjacent concern>` `<why it must remain untouched>`
97
89
 
98
- ## Git workflow
90
+ ## Current state
91
+
92
+ Describe the minimum facts needed to execute safely:
99
93
 
100
- (Filled from recon match the repo's observed conventions.)
94
+ - role of each relevant file or module;
95
+ - short current-state excerpts with `file:line` markers when exact code shape matters;
96
+ - applicable decisions, vocabulary, data contracts, or design constraints;
97
+ - dependencies and assumptions established during vetting.
101
98
 
102
- - Branch: `advisor/NNN-<slug>` (or the repo's branch-naming convention if one is evident)
103
- - Commit per step or per logical unit; message style: <match repo, e.g. conventional commits — include an example from `git log`>
104
- - Do NOT push or open a PR unless the operator instructed it.
99
+ ## Implementation steps
105
100
 
106
- ## Steps
101
+ ### 1. <Imperative step title>
107
102
 
108
- ### Step 1: <imperative title>
103
+ Name exact files and symbols. Describe the target behavior or code shape and any boundary that must remain stable.
109
104
 
110
- What to do, precisely. Reference exact files/symbols. Include the target code
111
- shape when it's load-bearing (the pattern to produce, not necessarily every
112
- line).
105
+ **Verify:** `<command>` `<expected output>`
113
106
 
114
- **Verify**: `<command>` <expected output>
107
+ ### 2. <Imperative step title>
115
108
 
116
- ### Step 2: ...
109
+ Continue in dependency order. Keep each step independently checkable and leave the repository in a coherent state.
117
110
 
118
- (Each step small enough to verify independently. Order steps so the codebase
119
- is never broken between steps when possible — e.g. add new path, switch
120
- callers, then remove old path.)
111
+ **Verify:** `<command>` `<expected output>`
121
112
 
122
113
  ## Test plan
123
114
 
124
- - New tests to write, in which file, covering which cases (list them:
125
- happy path, the specific bug/regression this plan fixes, named edge cases).
126
- - Which existing test to use as the structural pattern:
127
- "model after `src/users/api.test.ts`".
128
- - Verification: `<test command>` all pass, including N new tests.
115
+ - Tests to add or change, with exact paths and named cases.
116
+ - Existing test to use as the structural pattern.
117
+ - Regression or failure mode each test proves.
118
+ - Focused command and expected result.
119
+ - Full relevant suite and expected result.
129
120
 
130
121
  ## Done criteria
131
122
 
132
- Machine-checkable. ALL must hold:
123
+ - [ ] All in-scope behavior matches the stated outcome.
124
+ - [ ] Focused tests pass with the expected cases.
125
+ - [ ] Required build, typecheck, lint, and full relevant tests pass.
126
+ - [ ] `git status --short` contains no unexplained or out-of-scope files.
127
+ - [ ] Documentation or migration notes named by the plan are complete.
133
128
 
134
- - [ ] `pnpm typecheck` exits 0
135
- - [ ] `pnpm test` exits 0; new tests for <X> exist and pass
136
- - [ ] `grep -rn "<old pattern>" src/` returns no matches
137
- - [ ] No files outside the in-scope list are modified (`git status`)
138
- - [ ] `plans/README.md` status row updated
129
+ Replace generic criteria with machine-checkable commands or observable assertions specific to the plan.
139
130
 
140
131
  ## STOP conditions
141
132
 
142
- Stop and report back (do not improvise) if:
133
+ Stop and report instead of improvising when:
143
134
 
144
- - The code at the locations in "Current state" doesn't match the excerpts
145
- (the codebase has drifted since this plan was written).
146
- - A step's verification fails twice after a reasonable fix attempt.
147
- - The fix appears to require touching an out-of-scope file.
148
- - You discover the assumption "<key assumption>" is false.
135
+ - live state materially contradicts the verified evidence or drift assumptions;
136
+ - a required change crosses an out-of-scope boundary;
137
+ - a named verification gate fails twice after one bounded correction;
138
+ - a load-bearing dependency, API, ownership assumption, or migration precondition is false;
139
+ - the work would expose, copy, or rotate a credential without explicit authority.
149
140
 
150
- ## Maintenance notes
141
+ Add plan-specific STOP conditions for its actual risks.
151
142
 
152
- For the human/agent who owns this code after the change lands:
143
+ ## Review focus
153
144
 
154
- - What future changes will interact with this (e.g. "if pagination is added
155
- to this endpoint, the batching in step 2 must be revisited").
156
- - What a reviewer should scrutinize in the PR.
157
- - Any follow-up explicitly deferred out of this plan (and why).
158
- ```
145
+ - What a reviewer should inspect most closely.
146
+ - Compatibility or regression risks.
147
+ - Follow-ups intentionally deferred and why.
159
148
 
160
- ---
149
+ ````
161
150
 
162
- ## Index file: `plans/README.md`
151
+ ## Multi-Plan Index
163
152
 
164
- Written once by the advisor after all plans, updated by executors:
153
+ When one run writes multiple plans, create `YYYY-MM-DD-<source-mode>-plan-index.md`:
165
154
 
166
155
  ```markdown
167
- # Implementation Plans
156
+ ---
157
+ oat_generated: true
158
+ oat_external_plan_index: true
159
+ oat_external_plan_source: <source mode>
160
+ oat_external_plan_sources:
161
+ - <source artifact or scope>
162
+ oat_external_plan_commit: <short SHA>
163
+ created: '<ISO 8601 UTC>'
164
+ ---
165
+
166
+ # External Plan Index: <run title>
168
167
 
169
- Generated by the oat-repo-improve skill on <date>. Execute in the order below unless
170
- dependencies say otherwise. Each executor: read the plan fully before starting,
171
- honor its STOP conditions, and update your row when done.
168
+ This index records selection and ordering. It is not an executable plan and is
169
+ not an `oat-project-import-plan` target.
172
170
 
173
- ## Execution order & status
171
+ ## Selection
174
172
 
175
- | Plan | Title | Priority | Effort | Depends on | Status |
176
- | ---- | ----- | -------- | ------ | ---------- | ------ |
177
- | 001 | ... | P1 | S | — | TODO |
178
- | 002 | ... | P1 | M | 001 | TODO |
173
+ - Selected: <why these candidates were chosen>
174
+ - Deferred/rejected: <material candidates and rationale>
175
+ - Unaudited or out of scope: <boundaries>
179
176
 
180
- Status values: TODO | IN PROGRESS | DONE | BLOCKED (with one-line reason) | REJECTED (with one-line rationale — finding fixed independently or approach abandoned)
177
+ ## Recommended order
178
+
179
+ | Order | Plan | Source item/finding | Depends on | Tracking | Rationale |
180
+ | --- | --- | --- | --- | --- | --- |
181
+ | 1 | [Title](./YYYY-MM-DD-slug.md) | <ID/title or finding> | — | <backlog ID and/or issue URL, or none> | <reason> |
181
182
 
182
183
  ## Dependency notes
183
184
 
184
- - 002 requires 001 because <reason>.
185
+ - <Dependency or parallel-lane explanation.>
186
+ ````
185
187
 
186
- ## Findings considered and rejected
188
+ Do not use a repository-wide `README.md` as the index. Do not ask executors to mutate the index; execution tracking belongs to the chosen execution workflow.
187
189
 
188
- - <finding>: not worth doing because <one line>. (So nobody re-audits it.)
189
- ```
190
+ ## Quality Gate
190
191
 
191
- ## Quality bar — check before finishing each plan
192
+ Before finishing each plan, confirm:
192
193
 
193
- - Could a model that has never seen this repo execute this with only the plan file and the repo? If any step requires knowledge from the advisor session, inline that knowledge.
194
- - Is every verification a command with an expected result, not a judgment ("make sure it works")?
195
- - Does every step name exact files and symbols, not "the relevant module"?
196
- - Are the STOP conditions specific to this plan's actual risks, not boilerplate?
197
- - Would a reviewer reading only "Why this matters" + "Done criteria" understand what they're approving?
198
- - No secret values anywhere in the file locations and credential types only.
199
- - "Planned at" SHA is filled in and the in-scope paths in the drift check match the Scope section.
194
+ - It can be executed with only the plan and repository.
195
+ - Every source claim used for implementation was verified live.
196
+ - It has one coherent shippable outcome and verification boundary. Independent outcomes are separate plans; inseparable project-sized work is escalated to an OAT project/import decision.
197
+ - Every step names exact files/symbols and ends in a command with an expected result.
198
+ - Scope and STOP conditions are specific enough to prevent plausible but unauthorized expansion.
199
+ - Frontmatter source paths are repo-relative and backlog IDs are exact.
200
+ - No secret value, workstation-only absolute path, OAT task ID, or lifecycle bookkeeping appears.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: oat-repo-maintainability-review
3
- version: 1.2.0
4
- description: Use when you need a structured maintainability analysis for a repository or directory target with actionable findings.
3
+ version: 1.3.0
4
+ description: Use when you need a structured maintainability analysis for a repository or directory target with actionable findings and an optional external-plan handoff.
5
5
  argument-hint: '[--scope repo|directory] [--target <path>] [--mode auto|tracked|local|inline] [--output <path>] [--focus <areas>] [--analysis-mode full] [--fan-out]'
6
6
  disable-model-invocation: true
7
7
  user-invocable: true
@@ -42,11 +42,12 @@ Analyze repository maintainability and developer experience using a deterministi
42
42
  - ` OAT ▸ REPO MAINTAINABILITY REVIEW`
43
43
  - `━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`
44
44
  - Print step indicators before major work:
45
- - `[1/5] Resolving scope, arguments, and output policy...`
46
- - `[2/5] Collecting repository evidence...`
47
- - `[3/5] Running dimension analysis (single-agent or multi-agent)...`
48
- - `[4/5] Synthesizing findings and scoring...`
49
- - `[5/5] Rendering artifact and summary...`
45
+ - `[1/6] Resolving scope, arguments, and output policy...`
46
+ - `[2/6] Collecting repository evidence...`
47
+ - `[3/6] Running dimension analysis (single-agent or multi-agent)...`
48
+ - `[4/6] Synthesizing findings and scoring...`
49
+ - `[5/6] Rendering artifact and summary...`
50
+ - `[6/6] (Optional) Handing selected findings to repo improve...` — only print after the user accepts the offer
50
51
  - For long-running fan-out or large scans, print start + completion lines.
51
52
  - Print a resolved run-options summary before evidence collection begins.
52
53
 
@@ -58,6 +59,7 @@ Analyze repository maintainability and developer experience using a deterministi
58
59
  4. Gather evidence across required dimensions.
59
60
  5. Synthesize findings into prioritized recommendations.
60
61
  6. Render artifact or return inline output.
62
+ 7. Offer a scoped external-plan handoff when a file artifact exists.
61
63
 
62
64
  ### Output Policy Resolution
63
65
 
@@ -190,9 +192,22 @@ Final user-facing summary must include:
190
192
  - Artifact path (`inline-only` when no file is emitted)
191
193
  - Execution mode (`single-agent` or `multi-agent`)
192
194
 
195
+ ### Optional Repo Improve Handoff
196
+
197
+ When tracked or local output produced a file artifact, offer one bounded next step after the completion summary:
198
+
199
+ > Want to turn selected findings from this maintainability review into self-contained external implementation plans with `oat-repo-improve`?
200
+
201
+ If the user accepts, invoke `oat-repo-improve` in `maintainability-review` mode and pass the exact artifact path. That skill must use this artifact as its candidate source and perform only bounded live-evidence verification; it must not repeat a full repository audit. The user selects which findings become plans.
202
+
203
+ If output was inline-only, explain that the handoff requires a file-backed review artifact. Offer to render the completed review to the normal tracked/local destination before invoking `oat-repo-improve`; do not silently create it.
204
+
205
+ The maintainability-review skill never writes external plans itself. `oat-repo-improve` is the sole owner of `.oat/repo/reference/external-plans/` output for this flow.
206
+
193
207
  ## Success Criteria
194
208
 
195
209
  - Output includes required sections and metadata.
196
210
  - Findings include scoring fields and evidence.
197
211
  - Result includes now/next/later execution guidance.
198
212
  - Required arguments are explicitly resolved before analysis execution.
213
+ - File-backed runs offer an optional, source-scoped `oat-repo-improve maintainability-review <artifact>` handoff without re-auditing the repository.
@@ -10,6 +10,7 @@ assignee: null
10
10
  created: '{ISO 8601 UTC}'
11
11
  updated: '{ISO 8601 UTC}'
12
12
  associated_issues: []
13
+ external_plans: [] # repo-relative .oat/repo/reference/external-plans/*.md paths
13
14
  oat_template: true
14
15
  oat_template_name: backlog-item
15
16
  ---
@@ -60,6 +60,14 @@ doctor` surfaces this drift.
60
60
  recent commits against open items: work that shipped without a close-out
61
61
  should be closed retroactively with a note.
62
62
 
63
+ ## External Plan Reverse Links
64
+
65
+ Backlog item frontmatter may include `external_plans`, a YAML string array of
66
+ repo-relative paths under `.oat/repo/reference/external-plans/`.
67
+ `oat-repo-improve` owns additions to this field after a plan write succeeds.
68
+ Preserve existing links, deduplicate additions, and never link a failed or
69
+ partial write. These are durable source-to-plan references, not project status.
70
+
63
71
  ## Project Kickoff Handoffs
64
72
 
65
73
  `handoffs/` holds one-shot kickoff prompts — consumable context for turning a
@@ -9,7 +9,9 @@ This directory owns append-mostly reference material.
9
9
 
10
10
  - `decisions/` stores file-per-record decisions and the generated decision index.
11
11
  - `project-summaries/` stores archived project summaries.
12
- - `external-plans/` stores imported provider or external plans.
12
+ - `external-plans/` stores imported provider plans and external implementation
13
+ plans generated by `oat-repo-improve`. Improve owns plan generation; project
14
+ import optionally normalizes one selected file into an OAT project.
13
15
  - Create research, brainstorm, and deck folders on demand when a workflow needs them.
14
16
  - Do not put active roadmap, current-state, or backlog records directly under `reference/`.
15
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-agent-toolkit/cli",
3
- "version": "0.1.53",
3
+ "version": "0.1.54",
4
4
  "private": false,
5
5
  "description": "Open Agent Toolkit CLI",
6
6
  "homepage": "https://github.com/voxmedia/open-agent-toolkit/tree/main/packages/cli",
@@ -34,7 +34,7 @@
34
34
  "ora": "^9.0.0",
35
35
  "yaml": "2.8.2",
36
36
  "zod": "^3.25.76",
37
- "@open-agent-toolkit/control-plane": "0.1.53"
37
+ "@open-agent-toolkit/control-plane": "0.1.54"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/node": "^22.10.0",
@@ -1,96 +0,0 @@
1
- # Closing the Loop — execute, reconcile, issues
2
-
3
- The advisor's job doesn't end at the plan. This file covers the three follow-through flows: dispatching an executor and reviewing its work (`execute`), keeping the plan backlog alive (`reconcile`), and publishing plans where work gets picked up (`--issues`).
4
-
5
- The founding rule survives unchanged: **the advisor never edits source code.** In `execute`, a _separate executor subagent_ edits code in an isolated git worktree; the advisor dispatches, reviews, and renders a verdict — like a tech lead who doesn't push commits to your branch.
6
-
7
- ---
8
-
9
- ## `execute <plan>` — dispatch and review
10
-
11
- ### Preconditions (check all before dispatching)
12
-
13
- - The repo is a git repository (worktree isolation requires it). If not: stop and say so.
14
- - The plan file exists and its dependencies show DONE in `plans/README.md`. If not: stop, name the missing dependency.
15
- - Run the plan's drift check yourself. If in-scope files changed since `Planned at`, reconcile the plan first (see below) — don't hand a stale plan to an executor.
16
-
17
- ### Dispatch
18
-
19
- Spawn **one** `general-purpose` subagent with `isolation: "worktree"`. Executor model: default `sonnet`; use what the user named if they named one (`execute 003 haiku`).
20
-
21
- The subagent prompt must contain:
22
-
23
- 1. **The full plan file text, inlined.** The worktree contains only committed files — if `plans/` is uncommitted, the executor can't read it. Never assume; always inline.
24
- 2. The executor preamble:
25
-
26
- > You are the executor for the implementation plan below. Follow it step by
27
- > step. Run every verification command and confirm the expected result before
28
- > moving on. Touch only the files listed as in scope. If any STOP condition
29
- > occurs, stop immediately and report. Do not improvise around obstacles.
30
- > Commit your work in the worktree following the plan's git workflow section.
31
- > One override: SKIP the plan's instruction to update `plans/README.md` —
32
- > your reviewer maintains the index. Before reporting, audit every claim in
33
- > your report against an actual tool result from this session — only report
34
- > what you can point to evidence for; if a verification failed or was
35
- > skipped, say so plainly. When finished, reply with exactly the report
36
- > format below.
37
-
38
- 3. The report format:
39
-
40
- ```
41
- STATUS: COMPLETE | STOPPED
42
- STEPS: per step — done/skipped + verification command result
43
- STOPPED BECAUSE: (only if STOPPED) which STOP condition, what was observed
44
- FILES CHANGED: list
45
- NOTES: anything the reviewer should know (deviations, surprises, judgment calls)
46
- ```
47
-
48
- ### Review (the advisor's real job here)
49
-
50
- Note on fresh worktrees: they share git history but not `node_modules` or build artifacts — the executor must install dependencies first, and check tooling that resolves from `dist/` may need one build even though the plan's command table (recon'd in the main tree) didn't mention it. Expect this; it isn't a deviation.
51
-
52
- Review like a tech lead reviewing a PR against the spec — never fix anything yourself:
53
-
54
- 1. **Re-run every done criterion** in the worktree. Don't trust the executor's report — verify.
55
- 2. **Scope compliance**: `git -C <worktree> diff --stat` against the plan's in-scope list. Any file outside scope fails review, full stop.
56
- 3. **Read the full diff.** Judge it against "Why this matters" (does it solve the actual problem?) and the repo conventions named in the plan (does it look like the rest of the codebase?).
57
- 4. **Audit the new tests.** Executors game criteria — a test that asserts nothing meaningful passes `pnpm test` and proves nothing. Read what the tests assert.
58
-
59
- ### Verdict
60
-
61
- **Documented deviations are judged on merit, not reflex-blocked.** "Do not improvise" exists to stop silent drift; an executor that hits a real obstacle (e.g. the plan's approach breaks existing test mocks), adapts minimally, and explains it in NOTES has done the right thing. Approve it if the adaptation serves the plan's intent and stays in scope; treat _undocumented_ deviations as review failures.
62
-
63
- | Verdict | When | Action |
64
- | ----------- | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
65
- | **APPROVE** | Criteria pass, scope clean, quality holds | Update index status to DONE. Present to the user: diff summary, worktree path and branch, anything from NOTES. **Merging is the user's decision — never merge, push, or commit to their branch.** |
66
- | **REVISE** | Fixable gaps | SendMessage to the same executor with specific, actionable feedback ("criterion 3 fails: X; the error handling in `api.ts:90` swallows the error — use the Result pattern per the plan"). **Max 2 revision rounds**, then BLOCK. |
67
- | **BLOCK** | STOP condition hit, scope violated unrecoverably, or revisions exhausted | Mark BLOCKED in the index with the reason. Refine or rewrite the plan with what was learned. Tell the user what happened and what changed in the plan. |
68
-
69
- Running verification commands inside the executor's worktree is fine — it's isolated and disposable. The no-mutating-commands rule protects the user's working tree, not the worktree.
70
-
71
- ---
72
-
73
- ## `reconcile` — keep `plans/` alive
74
-
75
- Process what happened since the last session. Read `plans/README.md` and every plan file, then per status:
76
-
77
- - **DONE** — spot-check that the done criteria still hold on the current HEAD (cheap ones only). Mark verified in the index. Don't delete plan files — they're the record.
78
- - **BLOCKED** — read the reason. Investigate the underlying obstacle in the codebase. Either rewrite the plan around it (new number if the approach changed fundamentally, in-place refresh otherwise) or mark REJECTED with one line of rationale.
79
- - **IN PROGRESS** (stale) — flag it to the user; an executor probably died mid-run. Check the worktree if one exists.
80
- - **TODO** — run the drift check. If drifted: re-verify the finding still exists (it may have been fixed in passing), then refresh the "Current state" excerpts and `Planned at` SHA. If the finding is gone, mark REJECTED ("fixed independently").
81
-
82
- Finish with a short report: what's verified done, what was refreshed, what's rejected, and what's executable right now.
83
-
84
- ---
85
-
86
- ## `--issues` — publish plans as GitHub issues
87
-
88
- Modifier on any planning invocation (`/oat-repo-improve --issues`, `/oat-repo-improve security --issues`). The flag is the user's authorization to create issues — never create them without it.
89
-
90
- 1. Preflight: `gh auth status` succeeds and the repo has a GitHub remote. If either fails, write the plan files as normal and say why issues were skipped.
91
- 2. Visibility check: `gh repo view --json visibility`. If the repo is **public**, warn the user that issues are publicly visible and get explicit confirmation before publishing any plan that describes a security vulnerability, credential location, or other sensitive finding.
92
- 3. Show the list of titles about to become issues; confirm once if interactive.
93
- 4. Per plan: `gh issue create --title "<plan title>" --body-file <plan file>`. Labels: `improve` plus the category — apply only if the labels exist or can be created without erroring; skip labels rather than fail.
94
- 5. Record each issue URL in the plan's Status block (`- **Issue**: <url>`) and the index.
95
-
96
- The plan file remains the source of truth; the issue is distribution. The self-containment rule pays off here — the issue body needs no edits to make sense to whoever (or whatever) picks it up.