compound-workflow 1.0.1 → 1.1.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.
package/README.md CHANGED
@@ -62,10 +62,10 @@ flowchart LR
62
62
  | Step | Intent | Command | Output / note |
63
63
  |------|--------|---------|---------------|
64
64
  | Clarify what to build | Dialogue only; no code | `/workflow:brainstorm [topic]` | `docs/brainstorms/` |
65
- | Define how (fidelity + confidence) | Plan only; no code | `/workflow:plan [description or brainstorm path]` | `docs/plans/` |
66
- | Execute | File-based todos; risk-tier testing; no auto-ship | `/workflow:work <plan-path>` | `todos/` |
67
- | Ready the queue | Priority and dependencies for pending todos | `/workflow:triage` | — |
68
- | Validate quality | Evidence-based review; no fixes by default | `/workflow:review [PR, branch, or current]` | pass / pass-with-notes / fail |
65
+ | Define how (fidelity + confidence) | Plan only; no code; include agentic access + validation contract | `/workflow:plan [description or brainstorm path]` | `docs/plans/` |
66
+ | Execute | File-based todos; risk-tier testing; evidence-backed completion; no auto-ship | `/workflow:work <plan-path>` | `todos/` |
67
+ | Ready the queue | Priority/dependencies + executable agentic contract checks for pending todos | `/workflow:triage` | — |
68
+ | Validate quality | Evidence-based review + agentic executability checks; no fixes by default | `/workflow:review [PR, branch, or current]` | pass / pass-with-notes / fail |
69
69
  | Capture learnings | One solution doc for future use | `/workflow:compound [context]` | `docs/solutions/` |
70
70
  | Log and improve | Session log + optional aggregate review | `/metrics` + `/assess weekly 7` (or monthly) | `docs/metrics/daily/`, weekly/monthly |
71
71
 
@@ -75,19 +75,19 @@ flowchart LR
75
75
 
76
76
  #### 2. Define how (plan)
77
77
 
78
- **Intent:** Plan only; no code; fidelity + confidence. **Command:** `/workflow:plan [description or brainstorm path]`. **Output:** `docs/plans/`.
78
+ **Intent:** Plan only; no code; fidelity + confidence; include an agentic access + validation contract. **Command:** `/workflow:plan [description or brainstorm path]`. **Output:** `docs/plans/`.
79
79
 
80
80
  #### 3. Execute (work)
81
81
 
82
- **Intent:** File-based todos; risk-tier testing; no auto-ship. **Command:** `/workflow:work <plan-path>`. **Output:** `todos/`.
82
+ **Intent:** File-based todos; risk-tier testing; success-criteria evidence + quality gates before completion; no auto-ship. **Command:** `/workflow:work <plan-path>`. **Output:** `todos/`.
83
83
 
84
84
  #### 4. Ready the queue (triage)
85
85
 
86
- **Intent:** Priority and dependencies for pending todos. **Command:** `/workflow:triage`. **Output:** —.
86
+ **Intent:** Priority/dependencies for pending todos and readiness checks for agentic executability. **Command:** `/workflow:triage`. **Output:** —.
87
87
 
88
88
  #### 5. Validate quality (review)
89
89
 
90
- **Intent:** Evidence-based review; no fixes by default. **Command:** `/workflow:review [PR|branch|current]`. **Output:** pass / pass-with-notes / fail.
90
+ **Intent:** Evidence-based review + agentic validation coverage checks; no fixes by default. **Command:** `/workflow:review [PR|branch|current]`. **Output:** pass / pass-with-notes / fail.
91
91
 
92
92
  #### 6. Capture learnings (compound)
93
93
 
@@ -147,6 +147,10 @@ Full “when to use what” and reference standards: [src/AGENTS.md](src/AGENTS.
147
147
 
148
148
  - **Brainstorm and plan do not write code.** Output is documents only.
149
149
 
150
+ - **Todo completion requires evidence:** acceptance/success criteria plus quality gates must be recorded before `complete`.
151
+
152
+ - **Quality gate fallback:** if `lint_command` or `typecheck_command` is missing from repo config, workflow asks once for run-provided commands and continues only if they pass.
153
+
150
154
  - Add a separate shipping command if you want automated commit/PR and quality gates.
151
155
 
152
156
  ---
@@ -161,7 +165,7 @@ Full “when to use what” and reference standards: [src/AGENTS.md](src/AGENTS.
161
165
 
162
166
  ## Configuration and optional bits
163
167
 
164
- **Repo configuration:** Commands read a **Repo Config Block** (YAML) in `AGENTS.md` for `default_branch`, `dev_server_url`, `test_command`, etc. Run **`/install`** once; then edit `AGENTS.md` to set the Repo Config Block.
168
+ **Repo configuration:** Commands read a **Repo Config Block** (YAML) in `AGENTS.md` for `default_branch`, `dev_server_url`, `test_command`, `lint_command`, `typecheck_command`, etc. Run **`/install`** once; then edit `AGENTS.md` to set the Repo Config Block.
165
169
 
166
170
  **agent-browser:** `/test-browser` uses the agent-browser CLI only. Install: `npm install -g agent-browser` then `agent-browser install`. See [src/.agents/commands/test-browser.md](src/.agents/commands/test-browser.md).
167
171
 
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"compound-workflow","version":"1.0.1","description":"Clarify → plan → execute → verify → capture. One Install action for Cursor, Claude, and OpenCode.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/cjerochim/compound-workflow.git"},"bin":{"compound-workflow":"scripts/install-cli.mjs"},"files":["src","scripts",".cursor-plugin",".claude-plugin","skills"],"engines":{"node":">=18"},"devDependencies":{"@semantic-release/git":"^10.0.1","@semantic-release/npm":"^13.1.4","semantic-release":"^25.0.3"}}
1
+ {"name":"compound-workflow","version":"1.1.1","description":"Clarify → plan → execute → verify → capture. One Install action for Cursor, Claude, and OpenCode.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/cjerochim/compound-workflow.git"},"bin":{"compound-workflow":"scripts/install-cli.mjs"},"files":["src","scripts",".cursor-plugin",".claude-plugin","skills"],"scripts":{"check:pack-readme":"node scripts/check-pack-readme.mjs"},"engines":{"node":">=18"},"devDependencies":{"@semantic-release/git":"^10.0.1","@semantic-release/npm":"^13.1.4","semantic-release":"^25.0.3"}}
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { execFileSync } from "node:child_process";
4
+ import os from "node:os";
5
+ import path from "node:path";
6
+
7
+ const cacheDir =
8
+ process.env.npm_config_cache ?? path.join(os.tmpdir(), `npm-cache-${process.pid}`);
9
+
10
+ let output;
11
+
12
+ try {
13
+ output = execFileSync("npm", ["pack", "--dry-run", "--json", "--cache", cacheDir], {
14
+ encoding: "utf8",
15
+ });
16
+ } catch (error) {
17
+ const stderr = error?.stderr?.toString?.() ?? error.message;
18
+ console.error("Failed to run `npm pack --dry-run --json`.");
19
+ console.error(stderr);
20
+ process.exit(1);
21
+ }
22
+
23
+ let report;
24
+ try {
25
+ report = JSON.parse(output);
26
+ } catch (error) {
27
+ console.error("Failed to parse npm pack JSON output.");
28
+ console.error(error.message);
29
+ process.exit(1);
30
+ }
31
+
32
+ const files = Array.isArray(report) && report[0]?.files ? report[0].files : [];
33
+ const hasRootReadme = files.some((file) => /^readme(?:\.[^/]+)?$/i.test(file.path));
34
+
35
+ if (!hasRootReadme) {
36
+ console.error("Package guard failed: root README is missing from the packed tarball.");
37
+ console.error("Add a root README (for example `README.md`) and ensure it is not excluded.");
38
+ process.exit(1);
39
+ }
40
+
41
+ console.log("Package guard passed: root README is present in npm pack output.");
@@ -184,10 +184,29 @@ function hasCommand(cmd) {
184
184
 
185
185
  const SKILLS_SYMLINK_PATH = ".agents/compound-workflow-skills";
186
186
 
187
+ function symlinkPointsTo(linkPath, expectedTargetAbs) {
188
+ try {
189
+ const stat = fs.lstatSync(linkPath);
190
+ if (!stat.isSymbolicLink()) return false;
191
+ const rawTarget = fs.readlinkSync(linkPath);
192
+ const linkTargetAbs = path.resolve(path.dirname(linkPath), rawTarget);
193
+ return realpathSafe(linkTargetAbs) === realpathSafe(expectedTargetAbs);
194
+ } catch {
195
+ return false;
196
+ }
197
+ }
198
+
199
+ function removePathIfExists(linkPath) {
200
+ try {
201
+ fs.rmSync(linkPath, { recursive: true, force: true });
202
+ } catch {}
203
+ }
204
+
187
205
  function ensureSkillsSymlink(targetRoot, dryRun) {
188
206
  const agentsDir = path.join(targetRoot, ".agents");
189
207
  const linkPath = path.join(agentsDir, "compound-workflow-skills");
190
208
  const targetRel = path.join("..", "node_modules", "compound-workflow", "src", ".agents", "skills");
209
+ const targetAbs = path.resolve(path.dirname(linkPath), targetRel);
191
210
 
192
211
  if (dryRun) {
193
212
  console.log("[dry-run] Would create", SKILLS_SYMLINK_PATH, "symlink");
@@ -199,16 +218,15 @@ function ensureSkillsSymlink(targetRoot, dryRun) {
199
218
  let needCreate = true;
200
219
  try {
201
220
  const stat = fs.lstatSync(linkPath);
202
- if (stat.isSymbolicLink()) {
203
- fs.realpathSync(linkPath);
204
- needCreate = false;
221
+ if (stat.isSymbolicLink() && symlinkPointsTo(linkPath, targetAbs)) needCreate = false;
222
+ else if (!stat.isSymbolicLink()) {
223
+ console.warn("Skipped", SKILLS_SYMLINK_PATH, "because it exists and is not a symlink");
224
+ return;
205
225
  }
206
226
  } catch (_) {}
207
227
 
208
228
  if (needCreate) {
209
- try {
210
- fs.unlinkSync(linkPath);
211
- } catch (_) {}
229
+ removePathIfExists(linkPath);
212
230
  const type = process.platform === "win32" ? "dir" : "dir";
213
231
  fs.symlinkSync(targetRel, linkPath, type);
214
232
  console.log("Created", SKILLS_SYMLINK_PATH, "-> package skills");
@@ -223,6 +241,7 @@ function ensureCursorDirSymlink(targetRoot, cursorSubdir, pkgSubdir, dryRun, lab
223
241
 
224
242
  const linkPath = path.join(cursorDir, cursorSubdir);
225
243
  const targetRel = path.join("..", "node_modules", "compound-workflow", "src", ".agents", pkgSubdir);
244
+ const targetAbs = path.resolve(path.dirname(linkPath), targetRel);
226
245
 
227
246
  if (dryRun) {
228
247
  console.log("[dry-run] Would create .cursor/" + cursorSubdir, "symlink (Cursor)");
@@ -232,16 +251,15 @@ function ensureCursorDirSymlink(targetRoot, cursorSubdir, pkgSubdir, dryRun, lab
232
251
  let needCreate = true;
233
252
  try {
234
253
  const stat = fs.lstatSync(linkPath);
235
- if (stat.isSymbolicLink()) {
236
- fs.realpathSync(linkPath);
237
- needCreate = false;
254
+ if (stat.isSymbolicLink() && symlinkPointsTo(linkPath, targetAbs)) needCreate = false;
255
+ else if (!stat.isSymbolicLink()) {
256
+ console.warn("Skipped", ".cursor/" + cursorSubdir, "because it exists and is not a symlink");
257
+ return;
238
258
  }
239
259
  } catch (_) {}
240
260
 
241
261
  if (needCreate) {
242
- try {
243
- fs.unlinkSync(linkPath);
244
- } catch (_) {}
262
+ removePathIfExists(linkPath);
245
263
  const type = process.platform === "win32" ? "dir" : "dir";
246
264
  fs.symlinkSync(targetRel, linkPath, type);
247
265
  console.log("Created", ".cursor/" + cursorSubdir, "->", label || pkgSubdir, "(Cursor)");
@@ -280,19 +298,19 @@ function ensureCursorSkills(targetRoot, dryRun) {
280
298
  for (const name of skillNames) {
281
299
  const linkPath = path.join(skillsDir, name);
282
300
  const targetRel = path.join("..", "..", "..", "node_modules", "compound-workflow", "src", ".agents", "skills", name);
301
+ const targetAbs = path.resolve(path.dirname(linkPath), targetRel);
283
302
  let needCreate = true;
284
303
  try {
285
304
  const stat = fs.lstatSync(linkPath);
286
- if (stat.isSymbolicLink()) {
287
- fs.realpathSync(linkPath);
288
- needCreate = false;
305
+ if (stat.isSymbolicLink() && symlinkPointsTo(linkPath, targetAbs)) needCreate = false;
306
+ else if (!stat.isSymbolicLink()) {
307
+ console.warn("Skipped", ".cursor/skills/" + name, "because it exists and is not a symlink");
308
+ continue;
289
309
  }
290
310
  } catch (_) {}
291
311
 
292
312
  if (needCreate) {
293
- try {
294
- fs.unlinkSync(linkPath);
295
- } catch (_) {}
313
+ removePathIfExists(linkPath);
296
314
  fs.symlinkSync(targetRel, linkPath, type);
297
315
  console.log("Created", ".cursor/skills/" + name, "-> package skill (Cursor)");
298
316
  }
@@ -147,6 +147,34 @@ Select one: `High | Medium | Low`
147
147
 
148
148
  If confidence is `Low`, ask 1-2 focused clarifying questions before finalizing the plan.
149
149
 
150
+ #### Solution Scope (REQUIRED)
151
+
152
+ Select one: `partial_fix | full_remediation | migration`
153
+
154
+ - `partial_fix`: intentionally scoped fix with known follow-up gaps.
155
+ - `full_remediation`: complete resolution for the defined problem boundary.
156
+ - `migration`: phased or structural transition from an existing implementation/state to a new one.
157
+
158
+ If unclear, ask one focused clarification before finalizing the plan.
159
+
160
+ #### Spike Need Evaluation (REQUIRED for risky work)
161
+
162
+ Determine whether spikes are needed before finalizing implementation structure.
163
+
164
+ Risky work trigger set (extended):
165
+
166
+ - Any high-risk domain trigger (security, payments, privacy, schema/data migrations or backfills, production infra/deployment risk, hard-to-reverse changes)
167
+ - `confidence: low`
168
+ - `solution_scope: migration`
169
+ - Open questions that include implementation feasibility unknowns
170
+
171
+ If risky work is detected:
172
+
173
+ - Spike evaluation is mandatory.
174
+ - Declare `spikes_needed: yes|no`.
175
+ - If `spikes_needed: yes`, include explicit Spike Candidates with upfront dependency and priority modeling (see Step 3.5).
176
+ - If `spikes_needed: no`, include a short rationale + risk mitigation note explaining why direct implementation is safe.
177
+
150
178
  #### Research Mode
151
179
 
152
180
  Decide whether to run external research.
@@ -170,6 +198,9 @@ Required announcement format:
170
198
  ```
171
199
  Fidelity selected: <Low|Medium|High>
172
200
  Confidence: <High|Medium|Low>
201
+ Solution scope: <partial_fix|full_remediation|migration>
202
+ Spike evaluation: required|not-required
203
+ Spikes needed: yes|no|n/a
173
204
 
174
205
  Why this fidelity:
175
206
  1) ...
@@ -252,6 +283,50 @@ Think like a product manager - what would make this issue clear and actionable?
252
283
  - [ ] Gather supporting materials (error logs, screenshots, design mockups)
253
284
  - [ ] Prepare code examples or reproduction steps if applicable, name the mock filenames in the lists
254
285
 
286
+ ### 2.5. Solution Scope Contract (REQUIRED for all plans)
287
+
288
+ Every plan MUST include an explicit scope contract so `/workflow:work` can enforce intent.
289
+
290
+ Required contract fields:
291
+
292
+ - `solution_scope`: one of `partial_fix | full_remediation | migration`
293
+ - `completion_expectation`: explicit definition of done for this plan
294
+ - `non_goals`: explicitly out of scope for this plan
295
+
296
+ Rules:
297
+
298
+ - If `solution_scope: partial_fix`, include a **Remaining Gaps** checklist (`- [ ]`) with expected follow-up work.
299
+ - If `solution_scope: migration`, include migration strategy, rollout safety checks, and rollback triggers/steps.
300
+ - If `solution_scope: full_remediation`, define the remediation boundary so completion is unambiguous.
301
+
302
+ Placement:
303
+
304
+ - Put `solution_scope` in frontmatter.
305
+ - Put `completion_expectation` and `non_goals` in a dedicated section (recommended: `## Scope Contract`) in the plan body.
306
+
307
+ ### 2.6. Agentic Access & Validation Contract (REQUIRED for all plans)
308
+
309
+ Every plan MUST include an explicit contract describing how an agent will execute and verify the work without hidden assumptions.
310
+
311
+ Required fields (per implementation phase/checklist group):
312
+
313
+ - `Access Preconditions`: required services, credentials, fixtures, feature flags, env vars
314
+ - `Access Method`: how the agent obtains required access in this repo/runtime
315
+ - `Validation Path`: concrete commands/routes/checks the agent can run
316
+ - `Evidence Required`: exact outputs/artifacts/logs used to prove success criteria
317
+ - `Quality Gates`: `test_command`, `lint_command`, `typecheck_command` (configured or run-provided)
318
+
319
+ Rules:
320
+
321
+ - If any required access dependency is unknown, add a Discussion Point or Spike Candidate so it is triaged before execution.
322
+ - A plan is not execution-ready until this contract is present and actionable.
323
+ - Avoid placeholders like "validate manually" without a concrete agent-runnable path.
324
+
325
+ Placement:
326
+
327
+ - Add a dedicated section in the plan body: `## Agentic Access & Validation Contract`.
328
+ - Reference this section from implementation phases/todos so `/workflow:work` can enforce it directly.
329
+
255
330
  ### 3. Incorporate SpecFlow (if Step 1.7 ran)
256
331
 
257
332
  If SpecFlow was run in Step 1.7:
@@ -259,9 +334,9 @@ If SpecFlow was run in Step 1.7:
259
334
  - [ ] Review SpecFlow analysis results
260
335
  - [ ] Ensure any identified gaps or edge cases are reflected in the issue structure and acceptance criteria
261
336
 
262
- ### 3.5. Discussion Points & Spike Candidates (REQUIRED when Open questions ≠ none)
337
+ ### 3.5. Discussion Points & Spike Candidates
263
338
 
264
- When you declared Open questions in Step 1.5 (other than "none"), the plan file MUST include one or both of these sections with checkboxes so `/workflow:work` and `file-todos` can create pending todos for triage:
339
+ When you declared Open questions in Step 1.5 (other than "none"), and/or when risky-work spike evaluation requires spikes, the plan file MUST include one or both sections below with checkboxes so `/workflow:work` and `file-todos` can create pending todos for triage:
265
340
 
266
341
  - **## Discussion Points (resolve/decide)** — Decisions to make (no code). Use `- [ ]` items (e.g. "Decide: X or Y?", "Confirm constraint Z").
267
342
  - **## Spike Candidates (timeboxed)** — Timeboxed investigations to de-risk. Use `- [ ] Spike: <short description>` items.
@@ -270,10 +345,34 @@ Rules:
270
345
 
271
346
  - If an unknown blocks implementation feasibility, prefer listing it under **Spike Candidates**.
272
347
  - If confidence is `Low`, include at least one checkbox in one of these sections.
348
+ - If risky-work spike evaluation declared `spikes_needed: yes`, include at least one Spike Candidate checkbox.
273
349
  - These sections may appear after the main implementation content (e.g. after Acceptance Criteria or References) or in a dedicated "Unknowns & decisions" area; ensure they are in the written plan file when Open questions exist.
274
350
 
351
+ Required Spike Candidate metadata (per candidate, documented directly under each checkbox item):
352
+
353
+ - `Initial priority: p1|p2|p3`
354
+ - `Depends on: <issue ids or none>`
355
+ - `Unblocks: <build todo(s) or plan section(s)>`
356
+ - `Timebox: <duration>`
357
+ - `Deliverable: <options/recommendation/next build todos>`
358
+ - `Parallelizable: yes|no`
359
+
360
+ If a spike unblocks implementation work, mark it as a blocking spike in the candidate text so triage/work can front-load it.
361
+
275
362
  **When presenting Discussion Points (to the user or during triage):** (1) List a **concise numbered summary** of the points. (2) Walk through **each point one by one**; for each, discuss and align with the user; only then move on. Do not resolve all points in one turn.
276
363
 
364
+ Example Spike Candidate:
365
+
366
+ ```markdown
367
+ - [ ] Spike: Validate tenant-safe migration sequence for billing events
368
+ - Initial priority: p1
369
+ - Depends on: none
370
+ - Unblocks: "Implement migration executor + backfill safety checks"
371
+ - Timebox: 4h
372
+ - Deliverable: 3 options + recommendation + follow-up build todos
373
+ - Parallelizable: yes
374
+ ```
375
+
277
376
  ### 4. Choose Implementation Detail Level
278
377
 
279
378
  Select how comprehensive you want the issue to be. Fidelity should drive this choice.
@@ -307,12 +406,24 @@ title: [Issue Title]
307
406
  type: [feat|fix|refactor]
308
407
  status: active
309
408
  date: YYYY-MM-DD
409
+ solution_scope: [partial_fix|full_remediation|migration]
310
410
  ---
311
411
 
312
412
  # [Issue Title]
313
413
 
314
414
  [Brief problem/feature description]
315
415
 
416
+ ## Scope Contract
417
+
418
+ - Completion expectation: [explicit done definition]
419
+ - Non-goals:
420
+ - [out of scope item 1]
421
+ - [out of scope item 2]
422
+
423
+ ### Remaining Gaps (required if solution_scope = partial_fix)
424
+
425
+ - [ ] [gap to handle later]
426
+
316
427
  ## Constraints
317
428
 
318
429
  [Key constraints (technical, scope, or policy)]
@@ -339,6 +450,17 @@ date: YYYY-MM-DD
339
450
  - [ ] How to verify requirement 1
340
451
  - [ ] How to verify requirement 2
341
452
 
453
+ ## Agentic Access & Validation Contract
454
+
455
+ - Access Preconditions: [services/fixtures/env needed]
456
+ - Access Method: [how agent gets access in this repo]
457
+ - Validation Path: [commands/routes/checks]
458
+ - Evidence Required: [logs/output/artifacts]
459
+ - Quality Gates:
460
+ - test: [command]
461
+ - lint: [command or "ask once if not configured"]
462
+ - typecheck: [command or "ask once if not configured"]
463
+
342
464
  ## References
343
465
 
344
466
  - Related issue: #[issue_number]
@@ -367,6 +489,7 @@ title: [Issue Title]
367
489
  type: [feat|fix|refactor]
368
490
  status: active
369
491
  date: YYYY-MM-DD
492
+ solution_scope: [partial_fix|full_remediation|migration]
370
493
  ---
371
494
 
372
495
  # [Issue Title]
@@ -375,6 +498,17 @@ date: YYYY-MM-DD
375
498
 
376
499
  [Comprehensive description]
377
500
 
501
+ ## Scope Contract
502
+
503
+ - Completion expectation: [explicit done definition]
504
+ - Non-goals:
505
+ - [out of scope item 1]
506
+ - [out of scope item 2]
507
+
508
+ ### Remaining Gaps (required if solution_scope = partial_fix)
509
+
510
+ - [ ] [gap to handle later]
511
+
378
512
  ## Problem Statement / Motivation
379
513
 
380
514
  [Why this matters]
@@ -417,6 +551,17 @@ date: YYYY-MM-DD
417
551
 
418
552
  [What to monitor; how to test and validate]
419
553
 
554
+ ## Agentic Access & Validation Contract
555
+
556
+ - Access Preconditions: [services/fixtures/env needed]
557
+ - Access Method: [how agent gets access in this repo]
558
+ - Validation Path: [commands/routes/checks]
559
+ - Evidence Required: [logs/output/artifacts]
560
+ - Quality Gates:
561
+ - test: [command]
562
+ - lint: [command or "ask once if not configured"]
563
+ - typecheck: [command or "ask once if not configured"]
564
+
420
565
  ## References & Research
421
566
 
422
567
  - Similar implementations: [file_path:line_number]
@@ -446,6 +591,7 @@ title: [Issue Title]
446
591
  type: [feat|fix|refactor]
447
592
  status: active
448
593
  date: YYYY-MM-DD
594
+ solution_scope: [partial_fix|full_remediation|migration]
449
595
  ---
450
596
 
451
597
  # [Issue Title]
@@ -454,6 +600,17 @@ date: YYYY-MM-DD
454
600
 
455
601
  [Executive summary]
456
602
 
603
+ ## Scope Contract
604
+
605
+ - Completion expectation: [explicit done definition]
606
+ - Non-goals:
607
+ - [out of scope item 1]
608
+ - [out of scope item 2]
609
+
610
+ ### Remaining Gaps (required if solution_scope = partial_fix)
611
+
612
+ - [ ] [gap to handle later]
613
+
457
614
  ## Problem Statement
458
615
 
459
616
  [Detailed problem analysis]
@@ -542,6 +699,17 @@ date: YYYY-MM-DD
542
699
 
543
700
  [Test scenarios by dimension: env, role, data, edge cases]
544
701
 
702
+ ## Agentic Access & Validation Contract
703
+
704
+ - Access Preconditions: [services/fixtures/env needed]
705
+ - Access Method: [how agent gets access in this repo]
706
+ - Validation Path: [commands/routes/checks]
707
+ - Evidence Required: [logs/output/artifacts]
708
+ - Quality Gates:
709
+ - test: [command]
710
+ - lint: [command or "ask once if not configured"]
711
+ - typecheck: [command or "ask once if not configured"]
712
+
545
713
  ## Resource Requirements
546
714
 
547
715
  [Team, time, infrastructure needs]
@@ -634,6 +802,12 @@ Apply best practices for clarity and actionability, making the issue easy to sca
634
802
  - [ ] Title is searchable and descriptive
635
803
  - [ ] Labels accurately categorize the issue
636
804
  - [ ] All template sections are complete
805
+ - [ ] `solution_scope`, completion expectation, and non-goals are explicitly documented
806
+ - [ ] `## Agentic Access & Validation Contract` is present and executable (no hidden/manual-only steps)
807
+ - [ ] If `solution_scope = partial_fix`, Remaining Gaps checklist is present and actionable
808
+ - [ ] If `solution_scope = migration`, migration safety checks + rollback triggers are specified
809
+ - [ ] If risky-work triggers apply, Spike Evaluation is present with `spikes_needed: yes|no`
810
+ - [ ] If `spikes_needed = yes`, each spike candidate has priority/dependency/timebox/deliverable/parallelizable metadata
637
811
  - [ ] Links and references are working
638
812
  - [ ] Acceptance criteria are measurable
639
813
  - [ ] Add names of files in pseudo code examples and todo lists
@@ -651,14 +825,19 @@ Write the complete plan file to `docs/plans/YYYY-MM-DD-<type>-<slug>-plan.md`. T
651
825
 
652
826
  **When Open questions were declared (Step 1.5):** The written plan MUST include at least one of: `## Discussion Points (resolve/decide)` with `- [ ]` items, or `## Spike Candidates (timeboxed)` with `- [ ] Spike: ...` items. If confidence is `Low`, at least one checkbox is required in one of these sections. This ensures `file-todos` can create pending discussion/spike todos for `/workflow:triage`.
653
827
 
828
+ **When risky-work Spike Evaluation declared `spikes_needed: yes`:** The written plan MUST include `## Spike Candidates (timeboxed)` with at least one spike checkbox and required per-candidate metadata (`Initial priority`, `Depends on`, `Unblocks`, `Timebox`, `Deliverable`, `Parallelizable`) so ordering can be defined in plan, confirmed in triage, and enforced in work.
829
+
830
+ **Execution-readiness gate:** If the written plan is missing the required `## Agentic Access & Validation Contract`, do not mark it as ready for `/workflow:work`; fix the plan first.
831
+
654
832
  Confirm: "Plan written to docs/plans/[filename]"
655
833
 
656
- **Non-interactive mode:** When the invocation is non-interactive (e.g., `workflow:plan` run by automation, CI, or with an explicit non-interactive flag/convention), skip AskQuestion calls and do not present Post-Generation Options. For determinism, the repo should define the flag or convention (e.g., in `AGENTS.md` Repo Config Block or a documented env var). Still **declare** Fidelity, Confidence, Research mode, and Open questions in the required announcement format before writing the plan. Use these defaults when user input is unavailable: fidelity = Medium, confidence = Medium, research mode = local + external for Medium/High risk topics else local only. Proceed directly to writing the plan file and then exit or return the plan path as output.
834
+ **Non-interactive mode:** When the invocation is non-interactive (e.g., `workflow:plan` run by automation, CI, or with an explicit non-interactive flag/convention), skip AskQuestion calls and do not present Post-Generation Options. For determinism, the repo should define the flag or convention (e.g., in `AGENTS.md` Repo Config Block or a documented env var). Still **declare** Fidelity, Confidence, Solution scope, Spike evaluation, Spikes needed, Research mode, and Open questions in the required announcement format before writing the plan. Use these defaults when user input is unavailable: fidelity = Medium, confidence = Medium, solution_scope = full_remediation, spike evaluation = not-required unless risky-work triggers are present, spikes needed = n/a when spike evaluation is not required, research mode = local + external for Medium/High risk topics else local only. Proceed directly to writing the plan file and then exit or return the plan path as output.
657
835
 
658
836
  **Required in plan frontmatter:** Add these fields to the plan file:
659
837
 
660
838
  - `fidelity: low|medium|high`
661
839
  - `confidence: high|medium|low`
840
+ - `solution_scope: partial_fix|full_remediation|migration`
662
841
 
663
842
  ## Output Format
664
843
 
@@ -35,6 +35,7 @@ If empty, default to `current`.
35
35
  2. Resolve:
36
36
  - `default_branch` (fallback: `main`, then `master`)
37
37
  - `lint_command` (used in Phase 3)
38
+ - `typecheck_command` (used in Phase 3)
38
39
 
39
40
  State what you resolved or assumed.
40
41
 
@@ -43,13 +44,42 @@ State what you resolved or assumed.
43
44
  1. Determine target type from `$ARGUMENTS`: PR/URL, branch name, or `current`.
44
45
  2. If reviewing a PR and `gh` is available:
45
46
  - Fetch title/body/files via `gh pr view --json`
46
- - Checkout the branch (direct checkout or via worktree)
47
+ - Resolve target branch metadata before selecting isolation context
47
48
  3. If target is a branch (not current):
48
- - Ensure you are on the correct branch, or offer a worktree via `skill: git-worktree`
49
- 4. If you are not on the target branch and user requested that target, offer a worktree via `skill: git-worktree`.
49
+ - Resolve isolation context before running review passes
50
+ 4. If you are not on the target branch and user requested that target, do not continue until isolation preflight is complete.
50
51
 
51
52
  Prefer reviewing the currently checked-out branch. Only switch branches or create worktrees when the user explicitly requests a different target.
52
53
 
54
+ ### Phase 1.5: Isolation Preflight Gate (HARD GATE for non-current targets)
55
+
56
+ No diff analysis, lint, or reviewer-agent passes may run before this gate passes for non-current targets.
57
+
58
+ Policy:
59
+
60
+ - Target `current`: gate passes immediately on current checkout.
61
+ - Target PR/branch not currently checked out:
62
+ - Default path: use `skill: git-worktree` for isolated review context.
63
+ - Opt-out path: explicit user confirmation to review without worktree, then switch to the requested non-default branch context.
64
+
65
+ Gate completion record (REQUIRED for non-current targets):
66
+
67
+ - `target_type: pr|branch|current`
68
+ - `isolation_mode: worktree|direct-checkout`
69
+ - `review_context_path` (worktree path) or `review_branch` (direct checkout)
70
+ - `gate_status: passed`
71
+
72
+ Never run non-current review from the default branch checkout without completing this gate.
73
+
74
+ ### Phase 1.6: Preflight Violation Recovery (REQUIRED)
75
+
76
+ If review activity started before the isolation gate was complete:
77
+
78
+ - Disclose the violation.
79
+ - Stop analysis immediately.
80
+ - Return to Phase 1.5 and complete the gate.
81
+ - Resume only after `gate_status: passed`.
82
+
53
83
  Protected artifacts:
54
84
 
55
85
  - Never suggest deleting or ignoring `docs/plans/` or `docs/solutions/`.
@@ -71,6 +101,13 @@ Protected artifacts:
71
101
 
72
102
  - `Task learnings-researcher(<target context>)` (related prior solutions)
73
103
  - `Task lint(<changed files context>)` only if `lint_command` is configured in the Repo Config Block
104
+ - Verify agentic executability from plan/todo artifacts when available:
105
+ - access prerequisites are explicit
106
+ - validation commands are explicit and reproducible
107
+ - success-criteria evidence is traceable in todo Work Logs
108
+ - For type-checking coverage:
109
+ - if `typecheck_command` is configured, run it (or verify recent evidence if command execution is not feasible in this context)
110
+ - if not configured, report "typecheck command not configured" as a note and recommend adding it to Repo Config Block
74
111
 
75
112
  **Conditional passes** (run when they apply):
76
113
 
@@ -83,6 +120,7 @@ Then perform the main review synthesis across:
83
120
  - change summary (surface area, high-risk files)
84
121
  - correctness
85
122
  - tests/verification adequacy
123
+ - agentic validation adequacy (can another agent execute and verify deterministically?)
86
124
  - risk and failure modes
87
125
  - operational considerations (monitoring, rollback)
88
126
  - readability/maintainability
@@ -98,6 +136,10 @@ Provide:
98
136
  - evidence (file references or commands/output)
99
137
  - recommended action (concise)
100
138
  - What ran vs skipped (selected agents/passes)
139
+ - Validation coverage summary:
140
+ - tests: pass|fail|not-run
141
+ - lint: pass|fail|not-configured|not-run
142
+ - typecheck: pass|fail|not-configured|not-run
101
143
 
102
144
  ### Phase 5: Handoff Options
103
145
 
@@ -32,15 +32,24 @@ This command does not implement fixes. It approves and organizes work so `/workf
32
32
  - set `priority` (`p1|p2|p3`)
33
33
  - set `dependencies` (issue_ids)
34
34
  - ensure Acceptance Criteria is testable
35
+ - ensure the todo includes an explicit `Agentic Execution Contract`:
36
+ - access preconditions
37
+ - validation commands/routes/checks
38
+ - evidence expectations
39
+ - quality gate commands (`test`, `lint`, `typecheck`)
40
+ - if lint/typecheck commands are missing in repo config, mark Recommended Action with "ask once for run-provided commands before completion"
35
41
  - add/update tags for searchability
36
42
  - **When multiple todos have `tags: [discussion]`:** (1) List a **concise numbered summary** of the discussion points. (2) Walk through **each point one by one**; for each, discuss and align with the user before approving or deferring; only then move on. Do not resolve all discussion points in one turn.
37
43
  - **If the todo has `tags: [discussion]`:** Recommended Action must state the concrete decision task (what info is needed, who decides, done-when). Approve only when the outcome is a clear, executable decision task; otherwise defer.
38
- - **If the todo has `tags: [spike]`:** Recommended Action must include a timebox and deliverable (e.g. "2–4h spike; deliver: options + recommendation + next build todos"). Set `dependencies` so that any build todos that depend on this spike's outcome list this todo's `issue_id`; when approving, ensure dependent build todos remain blocked until the spike is complete (they depend on the spike's `issue_id`). Approve only when the spike scope and deliverable are clear; otherwise defer.
44
+ - **If the todo has `tags: [spike]`:** Recommended Action must include a timebox and deliverable (e.g. "2–4h spike; deliver: options + recommendation + next build todos"). Confirm or adjust plan-provided spike metadata (initial priority, depends_on, unblocks, parallelizable). Set `dependencies` so that any build todos that depend on this spike's outcome list this todo's `issue_id`; when approving, ensure dependent build todos remain blocked until the spike is complete (they depend on the spike's `issue_id`). Approve only when the spike scope and deliverable are clear; otherwise defer.
45
+ - **Blocking spikes first:** If a spike unblocks downstream build todos, prioritize approving that spike before its dependents. Do not approve dependent build todos as executable ahead of unresolved blocking spikes.
46
+ - **Parallel spike readiness:** If multiple spike todos are independent (no dependency edges between them), they may be approved together for parallel execution.
39
47
  3. Decision:
40
- - **approve now** -> rename `*-pending-*` -> `*-ready-*` and set frontmatter `status: ready`
48
+ - **approve now** -> rename `*-pending-*` -> `*-ready-*` and set frontmatter `status: ready` (only when Acceptance Criteria and Agentic Execution Contract are executable)
41
49
  - **defer** -> rename `*-pending-*` -> `*-deferred-*` and set frontmatter `status: deferred` (keep priority, typically `p3`). Ensure Recommended Action, Findings, and Work Log have enough context for future reference. Deferred items are not executed until re-triaged to `ready`.
50
+ - **blocked follow-up** -> when work returns a blocked todo, keep it as `pending` (rename from `*-ready-*` when needed), add `tags: [blocker]`, and require blocker options + recommendation in Work Log before re-approval.
42
51
  4. Output:
43
- - list approved `ready` todos (unblocked first)
52
+ - list approved `ready` todos (blocking spikes first, then other unblocked items)
44
53
  - list remaining pending todos
45
54
  - list deferred todos (parked for reference; not in executable queue)
46
55
  - list blocked todos with missing dependencies
@@ -64,6 +64,7 @@ The input must be a plan file path.
64
64
  - `test_command`
65
65
  - `test_fast_command` (optional)
66
66
  - `lint_command` (optional)
67
+ - `typecheck_command` (optional)
67
68
  - `format_command` (optional)
68
69
 
69
70
  If not present, ask once for the project's test command and suggest adding it to `AGENTS.md`.
@@ -88,20 +89,59 @@ The input must be a plan file path.
88
89
  - Prefer `test_command` and optional `test_fast_command` from `AGENTS.md`.
89
90
  - If missing, ask once for the repo's test command and suggest adding it to `AGENTS.md`.
90
91
 
91
- 2. **Setup Environment**
92
+ 1.6. **Agentic Access + Validation Preflight (HARD GATE)**
93
+
94
+ Before any implementation commands:
95
+
96
+ - Verify each `ready` todo has an executable Agentic Execution Contract:
97
+ - access preconditions are explicit
98
+ - validation path is explicit (commands/routes/checks)
99
+ - evidence expectations are explicit
100
+ - quality gate commands are explicit or marked for ask-once fallback
101
+ - If a todo lacks this contract, move it to `pending` for triage before coding.
102
+
103
+ Ask-once fallback policy for missing lint/typecheck config:
104
+
105
+ - If `lint_command` and/or `typecheck_command` is missing from `AGENTS.md`, ask once in this run for run-provided commands.
106
+ - Record run-provided commands in the first active todo Work Log entry.
107
+ - Continue only when provided commands run successfully.
108
+ - If commands are not provided or fail, do not mark related todos complete.
109
+
110
+ 1.75. **Resolve Plan Scope Contract (REQUIRED)**
111
+
112
+ Before any environment setup or implementation, resolve the plan's scope contract:
113
+
114
+ - `solution_scope`: `partial_fix | full_remediation | migration`
115
+ - `completion_expectation`: explicit definition of done
116
+ - `non_goals`: explicitly out of scope
117
+
118
+ If any scope-contract field is missing:
119
+
120
+ - Pause execution and ask the user to update the plan via `/workflow:plan`, or provide explicit values now.
121
+ - Record the resolved values in the first todo Work Log entry before coding.
122
+
123
+ Scope implications:
124
+
125
+ - `partial_fix`: maintain an explicit remaining-gaps list while executing.
126
+ - `migration`: identify migration verification + rollback checks before executing todos.
127
+ - `full_remediation`: complete all known gaps in the scoped area before completion.
128
+
129
+ 2. **Setup Environment (HARD GATE)**
92
130
 
93
131
  Determine how to isolate the work for this plan.
94
132
 
95
- Default: use a worktree (recommended). The user may opt out.
133
+ No implementation commands or code edits may run before this gate passes.
134
+
135
+ Default: use a worktree. Opt-out requires explicit user confirmation.
96
136
 
97
137
  1) Resolve your current branch (this is the default worktree base):
98
138
 
99
139
  - If you are already on a branch that clearly matches this plan, continue.
100
140
  - Otherwise, continue anyway — the current active branch remains the reference/base for a new worktree unless the user explicitly requests a different base.
101
141
 
102
- 2) Ask the user (opt-out prompt):
142
+ 2) Ask the user (required decision prompt):
103
143
 
104
- - "Use a worktree for this work? (default: Yes; recommended for isolation)"
144
+ - "Use a worktree for this work? (default: Yes; required unless you explicitly opt out)"
105
145
  - Options:
106
146
  - Yes (worktree)
107
147
  - No (stay in current checkout; create/switch to a feature branch)
@@ -127,7 +167,24 @@ The input must be a plan file path.
127
167
 
128
168
  4) If worktree is not chosen (opt-out):
129
169
 
170
+ - Require explicit user confirmation of the opt-out.
130
171
  - Create or switch to a feature branch (never work directly on the default branch).
172
+ - Record the execution branch in a visible place.
173
+
174
+ Gate completion record (REQUIRED before Phase 2):
175
+
176
+ - `worktree_decision: yes|no`
177
+ - `worktree_path: <path>` when yes, else `execution_branch: <branch>`
178
+ - `gate_status: passed`
179
+
180
+ 2.5. **Preflight Violation Recovery (REQUIRED)**
181
+
182
+ If implementation starts before the hard gate above is completed:
183
+
184
+ - Immediately disclose the violation.
185
+ - Stop all implementation actions.
186
+ - Return to Step 2 and complete the gate record.
187
+ - Resume only after `gate_status: passed`.
131
188
 
132
189
  3. **Create Todo List**
133
190
 
@@ -171,13 +228,19 @@ The input must be a plan file path.
171
228
 
172
229
  1. **Task Execution Loop**
173
230
 
174
- **When a worktree was created for this run:** All implementation edits (file reads/writes) and all terminal commands (run tests, install, lint, etc.) MUST be performed with the worktree directory as the working context: use the worktree path for file paths and set terminal cwd to the worktree root. Do not make code changes in the main repo checkout.
231
+ All implementation edits (file reads/writes) and all terminal commands (run tests, install, lint, etc.) MUST use the execution context resolved in Step 2.
232
+
233
+ - If `worktree_decision: yes`: use the worktree path for file paths and set terminal cwd to the worktree root. Do not make code changes in the main repo checkout.
234
+ - If `worktree_decision: no`: use the recorded execution branch context only (never default branch).
175
235
 
176
236
  Todo selection rules (default):
177
237
 
178
238
  - Consider only `todos/*-ready-*.md` items. Do not execute `pending` or `deferred` todos.
179
239
  - Skip blocked todos:
180
240
  - blocked if `dependencies` is non-empty and any dependency does not have a corresponding `*-complete-*.md` file.
241
+ - Prioritize blocking spikes first:
242
+ - if a ready spike todo unblocks downstream implementation todos, execute that spike before dependent build todos.
243
+ - independent ready spikes may run in parallel when environment/worktree setup supports it.
181
244
  - Prioritize by priority then id:
182
245
  - `p1` before `p2` before `p3`
183
246
  - lower `issue_id` first
@@ -230,6 +293,7 @@ The input must be a plan file path.
230
293
  - tests run
231
294
  - results
232
295
  - next steps
296
+ - status context (`ready`, `pending`, `complete`)
233
297
 
234
298
  Discovery + scope changes (ask each time):
235
299
 
@@ -243,11 +307,14 @@ The input must be a plan file path.
243
307
 
244
308
  **Validation Gate (per todo)**
245
309
 
246
- Before marking a todo complete, you MUST prove the acceptance criteria are met.
310
+ Before marking a todo complete, you MUST prove acceptance/success criteria are met.
247
311
 
248
312
  For each todo:
249
- - Re-state the acceptance criteria being validated (1–3 bullets)
313
+ - Re-state the acceptance/success criteria being validated (1–3 bullets)
250
314
  - Run the smallest verification that proves it (tests, command output, UI check)
315
+ - Run lint/typecheck quality gates for changed scope:
316
+ - `lint_command` when configured, else run the ask-once run-provided lint command
317
+ - `typecheck_command` when configured, else run the ask-once run-provided typecheck command
251
318
  - Record evidence in the todo Work Log:
252
319
  - commands run + results
253
320
  - files changed (paths)
@@ -257,6 +324,10 @@ The input must be a plan file path.
257
324
  - stop and fix immediately, or
258
325
  - if blocked, follow the Blocker Protocol.
259
326
 
327
+ Scope contract checks:
328
+ - If `solution_scope: partial_fix`, update remaining gaps in todo Work Log as they are discovered.
329
+ - If `solution_scope: migration`, record migration validation evidence and rollback readiness evidence before marking migration todos complete.
330
+
260
331
  **Blocker Protocol (pause implementation)**
261
332
 
262
333
  Trigger: you cannot proceed safely due to ambiguity, missing info, failing approach, or environment/tooling issue.
@@ -265,6 +336,7 @@ The input must be a plan file path.
265
336
  - Pause implementation. Do not “push through” with guesses.
266
337
  - Timebox investigation to reach options (not a full rewrite).
267
338
  - Produce at least 3 viable options.
339
+ - Immediately move the active todo back to `pending`, add/ensure `tags: [blocker]`, and record blocker status in Work Log.
268
340
 
269
341
  Output format (always):
270
342
  - Blocker summary (1–2 sentences)
@@ -277,6 +349,7 @@ The input must be a plan file path.
277
349
  - Convert the decision into explicit todos (implementation/investigation/deferral).
278
350
  - If the chosen option is to run a timeboxed investigation or prototype, follow the **Spike Protocol** below.
279
351
  - Record the decision + rationale in the todo Work Log.
352
+ - Re-approve the todo through `/workflow:triage` before returning it to `ready`.
280
353
 
281
354
  **Spike Protocol (allocate a spike)**
282
355
 
@@ -284,9 +357,9 @@ The input must be a plan file path.
284
357
 
285
358
  Steps:
286
359
 
287
- 1. **Spike todo:** Create a new `todos/*-pending-*.md` todo tagged `tags: [spike]` (or convert the current blocked todo to a spike todo). Fill Problem Statement, Proposed Solutions (options), and Acceptance Criteria (deliverable). If triage has not been run, recommend `/workflow:triage` to approve the spike and set timebox + deliverable; then treat the spike as `ready` once approved.
360
+ 1. **Spike todo:** Create a new `todos/*-pending-*.md` todo tagged `tags: [spike]` (or convert the current blocked todo to a spike todo). Fill Problem Statement, Proposed Solutions (options), and Acceptance Criteria (deliverable). Carry forward any plan metadata (initial priority, depends_on, unblocks, parallelizable). If triage has not been run, recommend `/workflow:triage` to approve the spike and set timebox + deliverable; then treat the spike as `ready` once approved.
288
361
  2. **Isolated execution:** Recommend a dedicated spike worktree. Use `skill: git-worktree` with branch name `spike/<todo_id>-<slug>` (e.g. `spike/003-auth-approach`). Run worktree bootstrap per the git-worktree skill. Execute the spike in that worktree so build work is not mixed with exploration.
289
- 3. **Research subagents (per spike):** Run in parallel when useful:
362
+ 3. **Research subagents (per spike):** Run mandatory baseline research in parallel:
290
363
  - Always (when agents exist): Task repo-research-analyst(context), Task learnings-researcher(context)
291
364
  - Conditional: Task framework-docs-researcher(topic), Task best-practices-researcher(topic), Task git-history-analyzer(context) when touching existing behavior or framework choices
292
365
  4. **Spike deliverable (required in spike todo Work Log):**
@@ -294,7 +367,7 @@ The input must be a plan file path.
294
367
  - Recommendation (one option + why)
295
368
  - Concrete next steps: create or update build todos (or plan checkbox to flip) so the main plan can proceed
296
369
  - **Should we compound this?** yes/no + one-line why (if yes, recommend `/workflow:compound` with spike context after the spike is complete)
297
- 5. **Multiple spikes:** If there are N approved spike todos and they are independent, create N worktrees (one per spike, under configured `worktree_dir`). Run one spike per worktree; when the environment supports multiple agents, spikes may run in parallel.
370
+ 5. **Multiple spikes:** If there are N approved spike todos and they are independent, create N worktrees (one per spike, under configured `worktree_dir`). Run one spike per worktree; when the environment supports multiple agents, spikes may run in parallel. If spikes have dependency edges, execute them in dependency order.
298
371
  6. **After spike completion:** Mark the spike todo complete (`*-complete-*.md`). If the deliverable said "compound: yes", recommend running `/workflow:compound` with the spike context so the learning is captured in `docs/solutions/` with `tags: [..., spike]`.
299
372
 
300
373
  2. **Follow Existing Patterns**
@@ -343,9 +416,13 @@ The input must be a plan file path.
343
416
  - `test_command` (required when available)
344
417
  - `test_fast_command` (optional)
345
418
  - `lint_command` (optional)
419
+ - `typecheck_command` (optional)
346
420
  - `format_command` (optional)
347
421
 
348
- If `test_command` is not configured, ask once for the project's test command and suggest adding it to `AGENTS.md`.
422
+ Ask-once fallback:
423
+
424
+ - If `test_command` is not configured, ask once for the project's test command and suggest adding it to `AGENTS.md`.
425
+ - If `lint_command` or `typecheck_command` is not configured, ask once for run-provided commands and use them for this run.
349
426
 
350
427
  2. **Consider Reviewer Agents** (Optional)
351
428
 
@@ -358,10 +435,14 @@ The input must be a plan file path.
358
435
  3. **Final Validation**
359
436
  - All todo files created for this plan are marked complete
360
437
  - All tests pass
361
- - Linting/formatting checks pass (if configured)
438
+ - Linting/typechecking/formatting checks pass (configured or run-provided via ask-once fallback)
362
439
  - Code follows existing patterns
363
440
  - UI validation completed (if applicable)
364
441
  - No console errors or warnings
442
+ - Scope contract satisfied:
443
+ - `partial_fix`: remaining gaps are materialized as `pending` or `deferred` todos before completion
444
+ - `migration`: migration verification and rollback checks are documented as passing
445
+ - `full_remediation`: scoped remediation goals are complete per `completion_expectation`
365
446
 
366
447
  4. **Update Plan Status**
367
448
 
@@ -409,7 +490,7 @@ If the user wants to ship (commits/PR/screenshots), handle that as a separate ex
409
490
 
410
491
  - Follow existing patterns
411
492
  - Write tests for new code
412
- - Run linting/formatting as configured in `AGENTS.md`
493
+ - Run linting/typechecking/formatting as configured in `AGENTS.md` (or run-provided via ask-once fallback)
413
494
  - Use reviewer agents for complex/risky changes only
414
495
 
415
496
  ### Ship Complete Features
@@ -423,11 +504,14 @@ If the user wants to ship (commits/PR/screenshots), handle that as a separate ex
423
504
  Before marking work complete, verify:
424
505
 
425
506
  - [ ] All clarifying questions asked and answered
507
+ - [ ] Hard gate completed before implementation (`worktree_decision`, execution context, `gate_status: passed`)
426
508
  - [ ] All todo files created for this plan are marked complete
427
509
  - [ ] Tests pass (run `test_command`)
428
- - [ ] Linting/formatting passes (run `lint_command` / `format_command` if configured)
510
+ - [ ] Linting/typechecking/formatting passes (run `lint_command` / `typecheck_command` / `format_command`; ask once if lint/typecheck is not configured)
429
511
  - [ ] Code follows existing patterns
430
512
  - [ ] UI validation completed (if applicable; use `/test-browser` when useful)
513
+ - [ ] Scope contract satisfied (`solution_scope`, `completion_expectation`, `non_goals`)
514
+ - [ ] For `partial_fix`, unresolved work is captured as `pending/deferred` todos
431
515
  - [ ] If shipping is requested, capture any required artifacts (screenshots, release notes) per repo conventions
432
516
 
433
517
  ## When to Use Reviewer Agents
@@ -446,6 +530,7 @@ For most features: tests + linting + following patterns is sufficient.
446
530
 
447
531
  - **Analysis paralysis** - Don't overthink, read the plan and execute
448
532
  - **Skipping clarifying questions** - Ask now, not after building wrong thing
533
+ - **Skipping the worktree hard gate** - No implementation before Step 2 gate passes
449
534
  - **Ignoring plan references** - The plan has links for a reason
450
535
  - **Testing at the end** - Test continuously or suffer later
451
536
  - **Forgetting todo updates** - Update todo files and plan checkboxes or lose track of progress
@@ -63,6 +63,7 @@ Required sections:
63
63
  - Findings
64
64
  - Proposed Solutions
65
65
  - Recommended Action
66
+ - Agentic Execution Contract
66
67
  - Acceptance Criteria
67
68
  - Work Log
68
69
 
@@ -80,6 +81,8 @@ dependencies: ["001"] # issue_ids this is blocked by
80
81
 
81
82
  **Deferred:** Items with `status: deferred` are not planned for the current development cycle. Keep Problem Statement, Findings, and Work Log so the item can be re-triaged or picked up later. Only `*-ready-*.md` todos are executed; `pending` and `deferred` are non-executable.
82
83
 
84
+ **Blocker handling:** Do not introduce a new `blocked` status. When execution is blocked, move the todo from `ready` back to `pending`, add `tags: [blocker]`, and record options + recommendation in Work Log before triage re-approval.
85
+
83
86
  ## Common Workflows
84
87
 
85
88
  ### Create a New Todo
@@ -117,16 +120,23 @@ Default mapping rules:
117
120
  - include the plan path in `Resources`
118
121
  - include a "Plan checkbox" pointer when derived from a checkbox (exact text)
119
122
  - otherwise include a short "Plan section" pointer (heading name or anchor)
123
+ - include an `Agentic Execution Contract` with access preconditions, validation commands, evidence expectations, and quality gate commands
120
124
  - write Acceptance Criteria that is testable
121
125
  6. **Discussion Points and Spike Candidates:** If the plan has sections `## Discussion Points (resolve/decide)` or `## Spike Candidates (timeboxed)`:
122
126
  - Checkboxes under **Discussion Points** → create `todos/*-pending-*.md` with `tags: [discussion]` and `status: pending`.
123
127
  - Checkboxes under **Spike Candidates** (including items like `- [ ] Spike: ...`) → create `todos/*-pending-*.md` with `tags: [spike]` and `status: pending`.
128
+ - For each spike candidate, carry plan metadata into the todo when present:
129
+ - `Initial priority` -> todo `priority` (initial value; triage may adjust)
130
+ - `Depends on` -> todo `dependencies` when issue ids are known; otherwise keep as a note in `Recommended Action`
131
+ - `Unblocks` -> include in `Recommended Action` so triage/work can front-load blocking spikes
132
+ - `Timebox`, `Deliverable`, `Parallelizable` -> copy into `Recommended Action` or `Findings`
124
133
  - These items require triage before execution; do not default them to `ready` unless the plan is explicitly approved and triage has been run.
125
134
 
126
135
  Status and priority defaults:
127
136
 
128
137
  - `status`: `ready` when the plan is approved and the todo is not from Discussion Points or Spike Candidates; otherwise `pending`. Todos with `tags: [discussion]` or `tags: [spike]` default to `pending`.
129
138
  - `priority`: `p2` unless clearly urgent/high-risk
139
+ - If a spike is marked as unblocking implementation work, default initial priority to `p1` when no explicit priority is provided.
130
140
 
131
141
  Dependencies:
132
142
 
@@ -144,6 +154,9 @@ Plan sync expectations:
144
154
  - read Problem Statement + Findings
145
155
  - choose a recommended action
146
156
  - set priority and dependencies
157
+ - verify `Agentic Execution Contract` is executable (no hidden/manual-only prerequisite)
158
+ - if lint/typecheck commands are not configured in AGENTS, set triage note: "ask once for run-provided lint/typecheck commands before completion"
159
+ - for `tags: [spike]`, confirm/adjust carried plan metadata (`Initial priority`, `Depends on`, `Unblocks`, `Timebox`, `Deliverable`, `Parallelizable`)
147
160
  3. Decision:
148
161
  - **Approve:** rename `*-pending-*` -> `*-ready-*`, set frontmatter `status: ready`
149
162
  - **Defer:** rename `*-pending-*` -> `*-deferred-*`, set frontmatter `status: deferred` (typically `p3`). Keep Work Log/Findings so the item is referenceable later; it will not appear in the executable queue until re-triaged to `ready`.
@@ -160,16 +173,21 @@ Consider only `*-ready-*.md` todos. Ignore `pending` and `deferred`.
160
173
  3. Update the Work Log each session with:
161
174
  - actions (file references + commands)
162
175
  - tests run
176
+ - lint/typecheck commands run (configured or run-provided)
163
177
  - results
164
178
  - learnings
179
+ - status context (`ready`, `pending`, `complete`)
165
180
  4. Check off Acceptance Criteria as you complete items.
166
181
 
167
182
  ### Complete a Todo
168
183
 
169
184
  1. Verify all acceptance criteria are checked.
170
- 2. Add a final Work Log entry.
171
- 3. Rename `*-ready-*` -> `*-complete-*`.
172
- 4. Update frontmatter `status: ready` -> `status: complete`.
185
+ 2. Verify success criteria evidence is recorded in Work Log (commands + outputs/artifacts).
186
+ 3. Verify lint/typecheck evidence is recorded (configured commands or run-provided commands for this run).
187
+ 4. If blocked, move todo back to `pending`, add/ensure `tags: [blocker]`, and record options + recommendation before triage.
188
+ 5. Add a final Work Log entry.
189
+ 6. Rename `*-ready-*` -> `*-complete-*`.
190
+ 7. Update frontmatter `status: ready` -> `status: complete`.
173
191
 
174
192
  ## Distinctions
175
193
 
@@ -61,6 +61,17 @@ Risk: Low / Medium / High
61
61
 
62
62
  To be filled during triage. Clear, actionable plan for resolving this todo.
63
63
 
64
+ ## Agentic Execution Contract
65
+
66
+ - Access Preconditions: <services, credentials, fixtures, flags, env>
67
+ - Access Method: <how the agent gets access in this repo/runtime>
68
+ - Validation Commands: <commands/routes/checks>
69
+ - Evidence Targets: <logs/output/artifacts that prove success>
70
+ - Quality Gate Commands:
71
+ - Test: <command>
72
+ - Lint: <command or "ask once if not configured">
73
+ - Typecheck: <command or "ask once if not configured">
74
+
64
75
  ## Technical Details
65
76
 
66
77
  Affected files, related components, data changes, or architectural considerations.
@@ -79,6 +90,8 @@ Testable checklist items for verifying completion.
79
90
 
80
91
  - [ ] Acceptance criteria item 1
81
92
  - [ ] Acceptance criteria item 2
93
+ - [ ] Success criteria evidence captured in Work Log
94
+ - [ ] Lint and typecheck evidence captured (configured or run-provided)
82
95
 
83
96
  ## Work Log
84
97
 
@@ -92,11 +105,19 @@ Actions:
92
105
  - Changes made (include file references)
93
106
  - Commands executed
94
107
  - Tests run
108
+ - Quality gates run (lint/typecheck)
109
+ - Status transition (`ready` -> `pending` with `tags: [blocker]` when blocked, or `ready` -> `complete` when done)
95
110
 
96
111
  Learnings:
97
112
  - What worked / what didn't
98
113
  - Key insights
99
114
 
115
+ Blocker Decision (only when blocked):
116
+ - Blocker summary:
117
+ - Constraints discovered:
118
+ - Options considered (>=3):
119
+ - Recommendation:
120
+
100
121
  ---
101
122
 
102
123
  (Add more entries as work progresses)
package/src/AGENTS.md CHANGED
@@ -53,7 +53,14 @@ Use the canonical command names (`/workflow:plan`, `/workflow:work`, `/workflow:
53
53
  - **Brainstorm = WHAT, Plan = HOW.** `/workflow:plan` must not re-litigate decisions already captured in `docs/brainstorms/`.
54
54
  - **Local grounding is mandatory.** Every plan must cite at least 1–3 internal file path/line refs (existing patterns) and any relevant `docs/solutions/**` learnings.
55
55
  - **Fidelity + confidence are required declarations** in every plan file: always output the Fidelity/Confidence/Research-mode block; the chosen template must include the required sections for that fidelity (Low/Medium/High).
56
+ - **Solution scope contract is mandatory in every plan.** Plans must declare `solution_scope` (`partial_fix|full_remediation|migration`) plus explicit completion expectation and non-goals so `/workflow:work` can enforce intent.
56
57
  - **SpecFlow is a validation gate, not a rewrite engine.** High fidelity required; Medium recommended; Low optional. Output must translate into acceptance criteria/edge cases, not new scope.
58
+ - **Isolation preflight is a hard gate.** `/workflow:work` must complete and record worktree/isolation preflight before any implementation commands. `/workflow:review` must do the same for non-current PR/branch targets before analysis.
59
+ - **Spike governance is explicit and ordered.** Risky plans must evaluate spike need, spike candidates must declare initial priority/dependencies/unblocks/timebox/deliverable, triage confirms those assumptions, and `/workflow:work` executes blocking spikes before dependent build todos.
60
+ - **Agentic access/testability is mandatory in planning.** Every plan must include an executable access + validation contract so work/review can run deterministically.
61
+ - **Todo completion requires evidence.** A todo may move to `complete` only after success criteria evidence and quality gate evidence are recorded in Work Log.
62
+ - **Blockers change todo state immediately.** Blocked work must move from `ready` back to `pending` with `tags: [blocker]` and an options+recommendation decision record.
63
+ - **Quality gates are enforced with ask-once fallback.** If `lint_command` or `typecheck_command` is missing, ask once per run and continue only when commands are provided and pass.
57
64
  - **Skills are invoked only by trigger.** `document-review` only when user selects "Review and refine" (or explicit request); guardrail skills (PII/financial/audit/data) only when the feature touches that domain.
58
65
  - **No new files/directories by default** beyond `docs/plans/...` for planning output.
59
66
  - **Plan file is the artifact.** Post-generation options are actions on the artifact; they do not change the workflow shape.
@@ -65,6 +72,7 @@ Use the canonical command names (`/workflow:plan`, `/workflow:work`, `/workflow:
65
72
 
66
73
  - `Fidelity selected`: `Low | Medium | High`
67
74
  - `Confidence`: `High | Medium | Low`
75
+ - `solution_scope`: `partial_fix | full_remediation | migration`
68
76
  - Why this fidelity (2-4 reasons)
69
77
  - Research mode used (`local only` or `local + external`)
70
78
  - Open questions (if any)
@@ -106,6 +114,7 @@ Suggested keys (examples):
106
114
  - `test_command: npm test`
107
115
  - `test_fast_command: npm test -- --watch=false --runInBand`
108
116
  - `lint_command: npm run lint`
117
+ - `typecheck_command: npm run typecheck`
109
118
  - `format_command: npm run format`
110
119
  - `project_tracker: github` (or `linear`)
111
120
  - `worktree_dir: .worktrees` (optional; where worktrees are created)
@@ -123,6 +132,7 @@ dev_server_url: http://localhost:3000
123
132
  test_command: npm test
124
133
  test_fast_command: npm test -- --watch=false
125
134
  lint_command: npm run lint
135
+ typecheck_command: npm run typecheck
126
136
  format_command: npm run format
127
137
  project_tracker: github
128
138
  worktree_dir: .worktrees