@open-agent-toolkit/cli 0.3.19 → 0.3.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/README.md +2 -1
  2. package/assets/agents/oat-phase-implementer.md +26 -3
  3. package/assets/agents/oat-reviewer.md +8 -3
  4. package/assets/bundle-metadata.json +1 -1
  5. package/assets/docs/reference/cli-reference.md +12 -7
  6. package/assets/docs/reference/oat-directory-structure.md +1 -0
  7. package/assets/docs/reference/project-artifacts.md +56 -1
  8. package/assets/docs/reference/project-state-machine.md +41 -7
  9. package/assets/docs/skills/brainstorm.md +3 -2
  10. package/assets/docs/skills/index.md +13 -10
  11. package/assets/docs/workflows/advanced/autonomy.md +3 -1
  12. package/assets/docs/workflows/advanced/dispatch-ceiling.md +2 -2
  13. package/assets/docs/workflows/advanced/workflow-gates.md +17 -4
  14. package/assets/docs/workflows/approvals-and-automation.md +21 -10
  15. package/assets/docs/workflows/choose-workflow.md +17 -9
  16. package/assets/docs/workflows/ideas/index.md +1 -1
  17. package/assets/docs/workflows/ideas/lifecycle.md +3 -2
  18. package/assets/docs/workflows/projects/closeout/closeout-skills.md +80 -7
  19. package/assets/docs/workflows/projects/closeout/pr-flow.md +7 -1
  20. package/assets/docs/workflows/projects/execution/execution-skills.md +16 -3
  21. package/assets/docs/workflows/projects/execution/implementation-execution.md +1 -1
  22. package/assets/docs/workflows/projects/execution/picking-up-projects.md +11 -1
  23. package/assets/docs/workflows/projects/lifecycle.md +108 -9
  24. package/assets/docs/workflows/projects/planning/hill-checkpoints.md +6 -6
  25. package/assets/docs/workflows/projects/planning/planning-skills.md +9 -7
  26. package/assets/docs/workflows/projects/planning/starting-projects.md +57 -11
  27. package/assets/docs/workflows/projects/reviews/index.md +22 -1
  28. package/assets/docs/workflows/projects/reviews/review-flavors.md +5 -3
  29. package/assets/public-package-versions.json +4 -4
  30. package/assets/skills/oat-brainstorm/SKILL.md +34 -9
  31. package/assets/skills/oat-brainstorm/references/destinations.md +6 -3
  32. package/assets/skills/oat-docs/SKILL.md +7 -3
  33. package/assets/skills/oat-pjm-review-backlog/SKILL.md +2 -2
  34. package/assets/skills/oat-project-autonomous/SKILL.md +9 -3
  35. package/assets/skills/oat-project-autonomous/references/gate-inventory.md +151 -132
  36. package/assets/skills/oat-project-brief/SKILL.md +1 -1
  37. package/assets/skills/oat-project-brief/references/brief-contract.md +458 -9
  38. package/assets/skills/oat-project-brief/references/docs/autonomy-contract.md +151 -132
  39. package/assets/skills/oat-project-brief/references/docs/gate-approval-record.md +9 -0
  40. package/assets/skills/oat-project-capture/SKILL.md +2 -2
  41. package/assets/skills/oat-project-complete/SKILL.md +14 -5
  42. package/assets/skills/oat-project-discover/SKILL.md +3 -2
  43. package/assets/skills/oat-project-document/SKILL.md +12 -6
  44. package/assets/skills/oat-project-document/references/docs/autonomy-contract.md +151 -132
  45. package/assets/skills/oat-project-goal/SKILL.md +697 -0
  46. package/assets/skills/oat-project-goal/references/docs/autonomy-contract.md +412 -0
  47. package/assets/skills/oat-project-goal/references/docs/gate-approval-record.md +93 -0
  48. package/assets/skills/oat-project-implement/SKILL.md +1 -1
  49. package/assets/skills/oat-project-implement/references/completion-and-closeout.md +67 -0
  50. package/assets/skills/oat-project-implement/references/docs/autonomy-contract.md +151 -132
  51. package/assets/skills/oat-project-implement/references/docs/gate-approval-record.md +9 -0
  52. package/assets/skills/oat-project-implement/references/phase-execution.md +10 -3
  53. package/assets/skills/oat-project-implement/references/plan-and-resume.md +28 -1
  54. package/assets/skills/oat-project-lite/SKILL.md +1 -1
  55. package/assets/skills/oat-project-lite/references/docs/autonomy-contract.md +151 -132
  56. package/assets/skills/oat-project-new/SKILL.md +3 -3
  57. package/assets/skills/oat-project-next/SKILL.md +45 -15
  58. package/assets/skills/oat-project-next/references/docs/gate-approval-record.md +9 -0
  59. package/assets/skills/oat-project-plan/SKILL.md +14 -3
  60. package/assets/skills/oat-project-plan-writing/SKILL.md +6 -4
  61. package/assets/skills/oat-project-pr-final/SKILL.md +51 -1
  62. package/assets/skills/oat-project-pr-final/references/docs/autonomy-contract.md +151 -132
  63. package/assets/skills/oat-project-pr-progress/SKILL.md +97 -3
  64. package/assets/skills/oat-project-progress/SKILL.md +38 -5
  65. package/assets/skills/oat-project-progress/references/docs/gate-approval-record.md +9 -0
  66. package/assets/skills/oat-project-quick-start/SKILL.md +14 -9
  67. package/assets/skills/oat-project-quick-start/references/docs/autonomy-contract.md +151 -132
  68. package/assets/skills/oat-project-quick-start/references/docs/gate-approval-record.md +9 -0
  69. package/assets/skills/oat-project-reconcile/SKILL.md +31 -2
  70. package/assets/skills/oat-project-review-provide/SKILL.md +79 -13
  71. package/assets/skills/oat-project-review-receive/SKILL.md +70 -1
  72. package/assets/skills/oat-project-revise/SKILL.md +25 -1
  73. package/assets/skills/oat-project-summary/SKILL.md +60 -5
  74. package/assets/skills/oat-wave-execute/SKILL.md +2 -2
  75. package/assets/templates/state.md +1 -1
  76. package/dist/commands/project/closeout-check/closeout-invariant.d.ts +119 -3
  77. package/dist/commands/project/closeout-check/closeout-invariant.d.ts.map +1 -1
  78. package/dist/commands/project/closeout-check/closeout-invariant.js +454 -2
  79. package/dist/commands/project/closeout-check/index.d.ts +21 -3
  80. package/dist/commands/project/closeout-check/index.d.ts.map +1 -1
  81. package/dist/commands/project/closeout-check/index.js +190 -4
  82. package/dist/commands/project/complete-state/index.d.ts +2 -1
  83. package/dist/commands/project/complete-state/index.d.ts.map +1 -1
  84. package/dist/commands/project/complete-state/index.js +7 -1
  85. package/dist/commands/project/delivery/check.d.ts +66 -0
  86. package/dist/commands/project/delivery/check.d.ts.map +1 -0
  87. package/dist/commands/project/delivery/check.js +232 -0
  88. package/dist/commands/project/delivery/evidence.d.ts +171 -0
  89. package/dist/commands/project/delivery/evidence.d.ts.map +1 -0
  90. package/dist/commands/project/delivery/evidence.js +902 -0
  91. package/dist/commands/project/delivery/index.d.ts +7 -0
  92. package/dist/commands/project/delivery/index.d.ts.map +1 -0
  93. package/dist/commands/project/delivery/index.js +13 -0
  94. package/dist/commands/project/delivery/refresh.d.ts +110 -0
  95. package/dist/commands/project/delivery/refresh.d.ts.map +1 -0
  96. package/dist/commands/project/delivery/refresh.js +441 -0
  97. package/dist/commands/project/index.d.ts.map +1 -1
  98. package/dist/commands/project/index.js +2 -0
  99. package/dist/commands/project/log/append.d.ts +6 -0
  100. package/dist/commands/project/log/append.d.ts.map +1 -1
  101. package/dist/commands/project/log/append.js +6 -1
  102. package/dist/commands/project/new/scaffold.d.ts.map +1 -1
  103. package/dist/commands/project/new/scaffold.js +47 -1
  104. package/dist/commands/project/promote/promote.d.ts +15 -1
  105. package/dist/commands/project/promote/promote.d.ts.map +1 -1
  106. package/dist/commands/project/promote/promote.js +99 -15
  107. package/dist/commands/project/validate-plan/index.d.ts.map +1 -1
  108. package/dist/commands/project/validate-plan/index.js +10 -0
  109. package/dist/commands/project/validate-plan/profiles.d.ts +19 -4
  110. package/dist/commands/project/validate-plan/profiles.d.ts.map +1 -1
  111. package/dist/commands/project/validate-plan/profiles.js +153 -2
  112. package/dist/commands/shared/frontmatter.d.ts +1 -1
  113. package/dist/commands/shared/frontmatter.d.ts.map +1 -1
  114. package/dist/commands/shared/frontmatter.js +1 -0
  115. package/dist/commands/state/generate.d.ts.map +1 -1
  116. package/dist/commands/state/generate.js +35 -4
  117. package/dist/commands/tools/shared/pack-manifest.d.ts.map +1 -1
  118. package/dist/commands/tools/shared/pack-manifest.js +1 -0
  119. package/package.json +2 -2
@@ -7,7 +7,7 @@ disable-model-invocation: true
7
7
  user-invocable: true
8
8
  allowed-tools: Read, Write, Bash, Glob, Grep, AskUserQuestion, Task
9
9
  metadata:
10
- version: 1.0.0
10
+ version: 1.0.1
11
11
  ---
12
12
 
13
13
  # Brief Project
@@ -1,9 +1,8 @@
1
1
  # Brief Contract
2
2
 
3
3
  This is the shared contract for brief-family workflow modes. `brief` delivers
4
- once; `goal` (many milestones) will extend this contract and its sections are
5
- reserved below. Lifecycle skills and agent roles that read a brief project
6
- follow these rules; where a skill restates a rule, this file wins.
4
+ once; `goal` delivers in many milestones and extends this contract in section 12. Lifecycle skills and agent roles that read a brief or goal project follow
5
+ these rules; where a skill restates a rule, this file wins.
7
6
 
8
7
  ## 1. The Project Brief
9
8
 
@@ -21,7 +20,7 @@ Only the body differs. Sections, in order:
21
20
  | Decisions | One line and rationale per decision, including the alternatives rejected. |
22
21
  | Known Unknowns | Deliberately open questions, each with the phase that settles it. |
23
22
  | Delivery endpoint and authority | What "delivered" means, who approves what, what the agent decides alone. Recorded once and reused. |
24
- | Milestones | Reserved for goal mode; brief projects leave it empty. |
23
+ | Milestones | Goal mode's canonical milestone table (section 12.1); brief projects leave it empty. |
25
24
  | Phases | `## Phase pNN:` blocks (section 2). |
26
25
  | Parallelism | Declared phase groups (`oat_plan_parallel_groups`). |
27
26
  | Reviews | The review table, preserved row by row. |
@@ -146,6 +145,10 @@ During implementation:
146
145
 
147
146
  Exhausted correction rounds never convert blocking findings into acceptance.
148
147
 
148
+ Goal mode runs this ladder once for the brief and once for each amendment, and
149
+ reorders the end of the implementation ladder for milestone delivery (section
150
+ 12.5).
151
+
149
152
  ## 6. Execution precedence
150
153
 
151
154
  Project scheduling is separate from phase execution:
@@ -286,9 +289,455 @@ Promotion refuses, writing nothing, with:
286
289
  - `missing-phase-head`: an accepted phase has no completed record and no
287
290
  `**Head:**` anchor to synthesize from (the refused phases are listed).
288
291
 
289
- ## 12. Goal mode (reserved)
292
+ **Goal promotion.** A goal project promotes the same way, only at a settled
293
+ delivery boundary: `oat_milestone_status: delivered`, every `oat_deliveries`
294
+ entry `at_endpoint` or `superseded` (none `registering` or `open`), no pending
295
+ `oat_goal_recovery`, and no extracted phase. Promotion writes
296
+ `oat_promoted_from: goal`; the provenance line under `## Reviews` names
297
+ workflow mode goal; `oat_deliveries`, `oat_milestone_gates` and
298
+ `oat_goal_outcome_audit` stay in the promoted `state.md` and are copied into
299
+ `references/brief-archive.md` under the archived brief. The promoted-brief
300
+ resume and its `oat_promotion_pending_phases` readiness clause are shared;
301
+ there is no second readiness predicate. A goal that is not settled refuses,
302
+ writing nothing, with:
303
+
304
+ - `goal-milestone-active`: the active milestone is not `delivered`;
305
+ - `goal-delivery-unsettled`: a delivery is `registering` or `open` (the
306
+ unsettled delivery IDs are listed), or the milestone is `delivered` while
307
+ `oat_deliveries` is empty or missing: `delivered` means a registered delivery
308
+ exists (section 12.7), so an empty registry is contradictory, never vacuously
309
+ settled;
310
+ - `goal-recovery-pending`: `oat_goal_recovery` is not null;
311
+ - `extracted-phases`: as above, matching the migration's refusal of every
312
+ extracted phase.
313
+
314
+ ## 12. Goal mode
315
+
316
+ A goal project (`oat_workflow_mode: goal`, `oat_plan_source: goal`) is a brief
317
+ that delivers in milestones. Sections 1–11 apply to goal unless this section
318
+ says otherwise. `oat-project-goal` owns the brief, each milestone's
319
+ re-alignment and activation, and the terminal declaration; the review, delivery
320
+ and implement skills own the transitions named in section 12.3.
321
+
322
+ ### 12.1 Milestones table
323
+
324
+ The brief's `## Milestones` section holds one canonical table. One shared
325
+ reader (`readMilestoneMembership` in control-plane `state/milestones.ts`) reads
326
+ it for both project readers, the router, `oat project validate-plan` and the
327
+ delivery commands, so a membership error is reported once and never dropped.
328
+ The grammar is fence-aware (fenced and indented code is ignored):
329
+
330
+ - exactly one `## Milestones` heading; the section ends at the next line
331
+ starting with `#`;
332
+ - prose, blank lines and HTML comments in the section are ignored, and the
333
+ first `|` line opens the one table; a second table is malformed;
334
+ - the header's first two cells are exactly `Milestone` and `Phases`, followed by
335
+ a separator row of `---` cells; the scaffold renders exactly
336
+ `| Milestone | Phases |` and `| --------- | ------ |`;
337
+ - each row names one milestone ID (`m01`; `m1` normalizes to `m01`) and a
338
+ comma-separated list of phase IDs, each optionally in backticks (`p01`,
339
+ `p-rev1`), normalized on read;
340
+ - the list order is the milestone's ordered phase set; trailing columns after
341
+ `Phases` are ignored.
342
+
343
+ ```markdown
344
+ | Milestone | Phases |
345
+ | --------- | ------------------ |
346
+ | m01 | p01, p02, `p-rev1` |
347
+ | m02 | p03 |
348
+ ```
349
+
350
+ Membership is checked against the brief's full phase inventory. Every
351
+ executable phase, revision phases included, belongs to exactly one milestone. A
352
+ phase the journal marks `extracted` is exempt from `phase-without-milestone`.
353
+ The seven reader error codes:
354
+
355
+ | Code | Meaning |
356
+ | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
357
+ | `milestones-missing` | The brief has no `## Milestones` section. |
358
+ | `milestones-malformed` | A second heading or table, a non-canonical header, no separator row, a row naming no milestone ID, or a token that is not a phase ID. |
359
+ | `milestone-duplicate` | A milestone is declared more than once. |
360
+ | `milestone-empty` | A milestone row lists no phases. |
361
+ | `milestone-unknown-phase` | A row lists a phase the brief does not declare. |
362
+ | `phase-in-multiple-milestones` | A phase is listed twice, in one milestone or in two. |
363
+ | `phase-without-milestone` | An executable phase belongs to no milestone. |
364
+
365
+ `oat project validate-plan` applies the goal profile on top of the brief
366
+ profile: each reader code is reported as its `goal-` counterpart
367
+ (`goal-milestones-missing`, `goal-milestones-malformed`,
368
+ `goal-duplicate-milestone`, `goal-milestone-empty`,
369
+ `goal-milestone-unknown-phase`, `goal-phase-in-multiple-milestones`,
370
+ `goal-phase-without-milestone`), plus `goal-plan-source`,
371
+ `goal-shipped-milestone-changed` and `goal-delivered-scope-changed` (a
372
+ registered delivery's frozen scope or milestone no longer matches the table),
373
+ `goal-group-crosses-milestone` (a parallel group spans milestones) and
374
+ `goal-noncanonical-phase-id` (a persisted phase-ID list is not canonical).
375
+ Appending a correction phase to a milestone is permitted; removing or
376
+ reassigning a phase frozen in a registered delivery is refused.
377
+
378
+ ### 12.2 Milestone and goal state
379
+
380
+ `oat-project-goal` initializes and owns these `state.md` fields:
381
+
382
+ - `oat_milestone: mNN`, the active milestone;
383
+ - `oat_milestone_status: aligning | implementing | reviewing | delivering | delivered`;
384
+ - `oat_goal_status: active | declared_met`;
385
+ - `oat_goal_outcome_audit: null` until the terminal declaration (section 12.9);
386
+ - `oat_goal_recovery: null` until a recovery is opened (section 12.6);
387
+ - `oat_milestone_gates: { mNN: { plan, exit } }`, one entry per milestone;
388
+ - `oat_deliveries: []`, the delivery registry (section 12.7).
389
+
390
+ `oat_current_task_id` keeps the section 8 meaning, scoped to the active
391
+ milestone's ordered phase set.
392
+
393
+ ### 12.3 Transitions and owners
394
+
395
+ | From → To | Owner | Prerequisite |
396
+ | -------------------------------------- | ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
397
+ | new → aligning | `oat-project-goal` | scaffold rendered `oat_plan_source: goal` |
398
+ | aligning → implementing | `oat-project-goal` | artifact review passed, `plan` carrier `allowed`, approval, and the next phase and every member of the next dispatched group concrete |
399
+ | implementing → reviewing | implement milestone closeout | every unit in the milestone scope accepted; `exit` carrier `allowed` and fresh |
400
+ | reviewing → delivering | `oat-project-review-receive` | clean receive of the exact integrated review (`passed`) with scope, revisions and exit carrier still valid |
401
+ | reviewing → implementing | `oat-project-review-receive` | fixes queued from the integrated review |
402
+ | delivering → implementing | `oat-project-review-receive` | fixes queued from a delivery-time review |
403
+ | delivered \| delivering → implementing | `oat-project-revise` | inline feedback with an explicit active-milestone target; the appended `p-revN` joins the milestone row; delivery evidence invalidated (writes status and pointer) |
404
+ | delivering → reviewing | `oat-project-pr-progress` | `oat project delivery refresh` reports the integrated review or `exit` carrier stale for the active milestone's delivery |
405
+ | delivered → reviewing | `oat-project-pr-progress` | `oat-project-goal` hands back a stale `delivered` milestone (Step 5.5 item 3a) and refresh or check reports its registered delivery's integrated review or `exit` carrier not fresh; `oat_phase_status` is left for the next activation to reset |
406
+ | delivering → delivered | `oat-project-pr-progress` | delivery registered, members open, review fresh; for an already-registered delivery, a deliverable check of that `dNN` (no new registration) |
407
+ | delivered → aligning | `oat-project-goal` | learnings captured (section 12.10) and fresh observations establish the previous delivery at its agreed endpoint; the activation that follows also writes `oat_phase_status: in_progress` and projects `oat_pr_status`/`oat_pr_url` from the latest member's observed status |
408
+ | delivered → terminal | `oat-project-goal` (user declaration) | exhaustive outcome audit recorded (section 12.9) |
409
+
410
+ Review-provide records its Reviews event as `received` and never writes
411
+ `delivering`; `fixes_completed` is not a passed review. The router reads only
412
+ persisted state and never evaluates Git.
413
+
414
+ **`delivered` versus `at_endpoint`.** `delivered` means the milestone's
415
+ delivery is registered, open and review-ready. `at_endpoint` is the registry's
416
+ separately observed endpoint condition: an agreed endpoint of `open` holds when
417
+ every member is `open` or `merged`, `merged` when every member is `merged`.
418
+ Re-alignment may draft, review and approve the next milestone while awaiting
419
+ the endpoint; it never overwrites `oat_milestone` or writes `implementing`
420
+ until fresh observations show the previous delivery at its agreed endpoint.
421
+ For an agreed endpoint of `open`, the same observation permits activation.
422
+
423
+ ### 12.4 Approval evidence and gate carriers
424
+
425
+ **Approval write order.** The first approval of the brief is evidenced by
426
+ `plan.md` `oat_status: complete`, written once by `oat-project-goal` after the
427
+ first artifact review, gate and user approval. Every later approval (each
428
+ re-alignment's amendment) is evidenced only by that milestone's `plan` carrier:
429
+ `oat-project-goal` writes `oat_milestone_gates[mNN].plan` with `status: allowed`
430
+ only after that milestone's artifact review, its gate and its user approval,
431
+ in that order. A carrier written earlier is not approval, and `plan.md`
432
+ `oat_status` is never rewritten to signal a later approval.
433
+
434
+ **Carriers.** Each carrier keeps the gate approval record core (`status`,
435
+ `disposition`, `config_fingerprint`, `reviewed_head`, `decided_at`) and adds
436
+ `resolution` (`configured`, `no_gate`, `project_disabled`), a `subject`
437
+ binding, and derived `freshness` (`fresh | stale`) with `freshness_reason`.
438
+ Freshness is derived state, never a replacement `status` value.
439
+
440
+ - `plan` is the milestone-scoped plan gate for the brief or its amendment, run
441
+ by `oat-project-goal` through the configured `oat-project-goal` lifecycle
442
+ gate. Its subject is `{ kind: plan, scope: [the milestone's ordered phase
443
+ set], ref: <approved brief or amendment commit> }`. It binds the approved
444
+ brief or amendment and the milestone membership at activation, never a later
445
+ implementation head, so implementation bookkeeping does not invalidate it.
446
+ It carries `freshness` only when a producer marks it `stale`. An amendment
447
+ needs its own artifact review, gate resolution and approval.
448
+ - `exit` is the milestone-scoped implement exit gate, run by implement's
449
+ milestone closeout against the milestone scope and required `allowed` and
450
+ fresh before delivery. Its subject is `{ kind: code, scope: [ordered phase
451
+ set] }`. Every exit carrier producer writes `freshness: fresh`, `no_gate`
452
+ and `project_disabled` included; an exit carrier with no recorded freshness
453
+ is not fresh.
454
+
455
+ `reviewed_head` is nullable. A configured gate keeps the head it actually
456
+ reviewed. For `no_gate` and `project_disabled`, `reviewed_head` is null because
457
+ no review occurred; the resolution and the subject binding together say what
458
+ the outcome applies to. Changed gate configuration, override or subject
459
+ requires reevaluation and never inherits a fabricated reviewed SHA. The
460
+ project-level `oat_implement_exit_gate` is used only at terminal closeout.
461
+
462
+ ### 12.5 Goal exception to the shared ladder
463
+
464
+ For goal milestone delivery the end of the section 5 implementation ladder is
465
+ reordered: the milestone exit gate (`exit` carrier) runs **before** the
466
+ integrated delivery review, and queued fixes invalidate both the
467
+ integrated-review and the exit-gate evidence, so the gate runs again before the
468
+ next integrated review. Routing follows the missing evidence:
469
+
470
+ 1. queued fixes → `oat-project-implement` on the fix scope;
471
+ 2. a missing, blocked, stale or subject-mismatched exit carrier →
472
+ `oat-project-implement` scoped milestone closeout;
473
+ 3. with the carrier allowed and fresh, a missing or stale integrated review →
474
+ `oat-project-review-provide`;
475
+ 4. a produced, unreceived review → `oat-project-review-receive`;
476
+ 5. a received `passed` review with a fresh allowed carrier → delivery.
477
+
478
+ Per-phase reviews, the optional phase gate and the author self-check are
479
+ unchanged. Terminal closeout runs the ordinary post-implement sequence, with
480
+ one goal deferral: while `oat project closeout-check` still reports
481
+ `phase-uncovered`, a `summary` step before `pr` writes only project-directory
482
+ files and defers its repo-level ledger and decision-record writes until `pr`
483
+ has registered the terminal delivery (the summary skill's Step 6, Goal
484
+ terminal deferral).
485
+
486
+ ### 12.6 Explicit review scopes and recovery
487
+
488
+ **Explicit goal review scopes.** A goal integrated review request carries an
489
+ explicit milestone or delivery identity and its ordered phase set, for example
490
+ `code m01: p01, p02, p-rev1` or `code m01/d01: p01, p02, p-rev1`. That exact
491
+ semantic set is preserved in review provenance (`oat_review_phase_ids`); the Git
492
+ range may be wider and the review discloses the intervening changes. Membership
493
+ is never derived by first–last expansion or commit labels: with m01 owning
494
+ `p01, p02, p-rev1` and m02 owning `p03`, a `p01-p-rev1` range would mislabel
495
+ `p03`. Pre-fan-in member reviews are member evidence only; delivery evidence
496
+ uses integration heads. A late correction is assigned explicitly to its
497
+ recovery milestone without moving the active one, and frozen delivery scopes
498
+ stay immutable: appending a correction phase never mutates an earlier
499
+ delivery's scope.
500
+
501
+ **Scope cell.** A goal integrated review's `## Reviews` Scope cell is exactly
502
+ the milestone ID (`mNN`) or, for a registered delivery, the delivery ID
503
+ (`dNN`). The ordered phase set lives in the artifact's `oat_review_phase_ids`
504
+ and the request context, never in the Scope cell (readers tolerate a cell of
505
+ the form `<id>: …`). The newest `code` row for that label governs; a registered
506
+ delivery's recorded `integrated_review` governs only while it names that row's
507
+ artifact, and a clean receive rewrites it (`artifact`, `scope`,
508
+ `disposition: passed`).
509
+
510
+ **Recovery record.** Interrupted recovery is persisted as
511
+ `oat_goal_recovery: { milestone, delivery_id, phase_ids, stage,
512
+ review_artifact }`, where `delivery_id` and `review_artifact` may be null and
513
+ `stage` is `implementing | exit_gate | reviewing | receiving | delivering`.
514
+ Recovery of an older delivery never changes `oat_milestone`, its status or the
515
+ active execution pointer; resume uses the record until it is cleared. Only the
516
+ root commits shared routing, registry, gate and acceptance records.
517
+
518
+ | Owner | Recovery action |
519
+ | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
520
+ | `oat-project-review-receive` | Creates the record (stage `implementing`) when fixes target an older delivery; on a clean receive advances it to `delivering`, or back to `implementing` when fixes are queued. |
521
+ | `oat-project-revise` | For inline feedback on an older delivery: creates or advances the record (stage `implementing`) with a phase-only `p-revN` assigned to that milestone; never writes the active pointer or status. For an active-milestone target it writes `oat_milestone_status: implementing` and the pointer (the `delivered \| delivering → implementing` row of section 12.3): the one status write revise owns. |
522
+ | `oat-project-implement` | Fixes accepted → `exit_gate`; scoped closeout carrier `allowed` and fresh → `reviewing`. |
523
+ | `oat-project-review-provide` | Artifact recorded `received` → `receiving`, with `review_artifact` set. |
524
+ | `oat-project-pr-progress` | For the active milestone's stale delivery: writes `oat_milestone_status: reviewing` and the record, stage by the missing-evidence order of section 12.5, and stops before registration. For an older milestone's delivery: writes only the record. Clears it once the targeted delivery is refreshed fresh; for the active milestone's own delivery, clearing the record and writing `oat_milestone_status: delivered` are one step, and a registered delivery is re-checked, never registered again. |
525
+ | `oat-project-reconcile` | Repairs an interrupted record; never creates one for the active milestone. |
526
+
527
+ `oat project delivery refresh` never writes `oat_milestone_status` or
528
+ `oat_goal_recovery`.
529
+
530
+ ### 12.7 Delivery registry
531
+
532
+ `oat_deliveries` entries carry `delivery_id` (`dNN`, unique), `milestone`, a
533
+ `scope` frozen on registration, the agreed `endpoint` (`open | merged`),
534
+ `kind: pr`, `status` (`registering | open | at_endpoint | superseded`), the
535
+ supersession links `superseded_by` and `covers_scope_of`, an additive
536
+ `corrects_delivery_id`, persisted `lookup` keys (`repository`, `head_branch`,
537
+ `head_sha_at_registration`), `members` (`url`, `base`, `reviewed_head`,
538
+ `observed_head`, `observed_base`, `status`), the `integrated_review`
539
+ (`artifact`, `scope`, `bound_revisions`, `disposition`), the accepted exit-gate
540
+ binding `exit_gate`, and the first observed `endpoint_attainment`.
541
+
542
+ - **Idempotent registration.** The registration owner writes the entry with
543
+ `status: registering` and its `lookup` keys and commits before creating the
544
+ pull request, then records the URL and `status: open`. A `registering` entry
545
+ on resume runs `gh pr list --repo <repository> --head <head_branch> --state
546
+ all --json url,headRefOid`: exactly one match is attached without creating a
547
+ duplicate; zero matches create once; more than one stops and routes to
548
+ `oat-project-reconcile`.
549
+ - **Prerequisites.** Before registration the owner runs
550
+ `oat project delivery refresh --project <path>` and
551
+ `oat project delivery check --project <path> --subject <mNN|dNN> --json`; it
552
+ registers only when the check reports `status: ok` (deliverable: a passed,
553
+ fresh integrated review and an allowed, fresh exit carrier). An undeliverable
554
+ subject reports `status: undeliverable` with the full report and exits 1.
555
+ - **Supersession.** A replacement names its one direct predecessor in
556
+ `covers_scope_of`, and that predecessor's `superseded_by` points back; the
557
+ registration owner writes both links together. Only a delivery that never
558
+ reached its agreed endpoint may be replaced; the first observed endpoint
559
+ attainment is preserved, and later corrections of such a delivery are
560
+ additive (`corrects_delivery_id`, new phase IDs, no inherited coverage).
561
+ - **Shared members.** Terminal deliveries registered from one head branch
562
+ share their member pull request (`gh` allows one open pull request per head
563
+ and base), so one member URL may appear in several deliveries. Coverage
564
+ judges each delivery's own frozen scope and bound evidence, never the shared
565
+ member alone; `oat_pr_url` and `oat_pr_status` project the latest member.
566
+ - **Evidence capture.** The exit-gate result accepted for the delivery is
567
+ persisted as its `exit_gate` with the delivery evidence; overwriting the
568
+ milestone's working carrier for a correction never relabels another
569
+ delivery's historical evidence. Review-receive persists the authoritative
570
+ scope, revision and disposition evidence in tracked records before local
571
+ archival; archived review files are optional local history.
572
+ - **Two exit-carrier consumers.** `oat project delivery check` judges the
573
+ milestone's current working exit carrier, `oat_milestone_gates[mNN].exit`,
574
+ and reports it as `exit.source: milestone-carrier`. The closeout boundary
575
+ (`oat project closeout-check`, `oat project complete-state`) judges the exit
576
+ gate persisted with each delivery (`oat_deliveries[].exit_gate`). The two
577
+ consumers are distinct: a fresh working carrier does not repair a stale
578
+ delivery binding, and a correction's new carrier does not rewrite a historical
579
+ binding.
580
+ - **Observation.** `oat project delivery refresh` observes members with
581
+ `gh pr view <url> --json state,headRefOid,baseRefOid` and persists only
582
+ observations, endpoint attainment and derived staleness
583
+ (`integrated_review.disposition: stale`, the milestone exit carrier's
584
+ `freshness: stale` with `freshness_reason`). It never rewrites a reviewed
585
+ revision, a member base or the first endpoint attainment, and never
586
+ manufactures a passed review or a fresh carrier. The closeout boundary obtains
587
+ the same observations read-only.
588
+
589
+ ### 12.8 Bookkeeping-successor freshness
590
+
591
+ Keep `reviewed_head`, the review row's `Reviewed Head`, artifact revision
592
+ fields and bound review revisions equal to the revisions actually reviewed;
593
+ never advance them because registration, receive or publication advanced HEAD.
594
+ Evidence reviewed at R covers a published head H only when R = H, or R is an
595
+ ancestor of H and every intervening commit, merge-introduced changes included,
596
+ changes only permitted bookkeeping:
597
+
598
+ - **Paths:** this project's `state.md`, `plan.md`, `implementation.md`,
599
+ `project-log.md`, `summary.md`, and the exact review artifacts belonging to
600
+ the evidence being recorded or archived, and, for a delivery whose member
601
+ pull request is shared (12.7, Shared members), the review artifacts recorded
602
+ for the deliveries that share it; each delivery is still judged on its own
603
+ frozen scope, reviewed revisions and `exit_gate`. `summary.md` is derived
604
+ institutional memory, never the authority for outcomes, approach,
605
+ constraints, decisions or endpoint, which live in the brief; any change to
606
+ it is bookkeeping. Path membership alone is insufficient for the other
607
+ paths.
608
+ - **Permitted changes:** routing and progress updates, evidence recording,
609
+ review dispositions, registration and observation metadata, and append-only
610
+ execution observations.
611
+ - **Substantive changes:** approved outcomes, approach, constraints, decisions,
612
+ endpoint or authority, phase intent or exit evidence, milestone membership,
613
+ frozen delivery scope, or existing evidence identities and revisions. Added
614
+ evidence must refer to the unchanged subject it records. Executable code,
615
+ tests, configuration, templates, skills and product documentation are never
616
+ bookkeeping.
617
+
618
+ A substantive change followed by its revert is not a bookkeeping successor.
619
+ Missing Git objects, failed inspection, unknown paths or disallowed edits fail
620
+ closed. A member base change (`observed_base` differs from `base`) invalidates
621
+ delivery evidence independently. Historical deliveries are checked against
622
+ their own observed member revisions, never the branch's latest HEAD. Unequal
623
+ heads alone never invalidate evidence. A delivery's persisted `exit_gate`,
624
+ its `integrated_review` identity (`artifact`, `scope`, `bound_revisions`) and
625
+ its `members[].reviewed_head` are set once and are replaced only by a commit
626
+ that records a review naming a different artifact of that delivery (an
627
+ artifact and its `reviews/archived/` counterpart are the same artifact; a
628
+ sharing sibling's artifact never counts; the delivery's own review artifacts
629
+ are those its Reviews rows record), with each `reviewed_head` equal to
630
+ the head the new `bound_revisions` binds for that member. A bound revision
631
+ that disagrees with its member's `reviewed_head` is not fresh
632
+ (`bound-revision-mismatch`).
633
+
634
+ The shared evaluator (`delivery/evidence.ts`) implements this rule for
635
+ `delivery check`, `delivery refresh` and the closeout boundary. It accepts two
636
+ deliberate leniencies:
637
+
638
+ - a modified review artifact is accepted without a frontmatter identity check,
639
+ because the tracked records (the Reviews row and the registry's
640
+ `integrated_review`) are authoritative; and
641
+ - a recorded `**Head:**` may be rewritten in a bookkeeping commit under the
642
+ section 10 late-fix rule.
643
+
644
+ ### 12.9 Terminal declaration and outcome audit
645
+
646
+ Only `oat-project-goal`, after the user's explicit declaration, writes
647
+ `oat_goal_status: declared_met` and `oat_goal_outcome_audit`. Implement
648
+ consumes the declaration and never declares the goal met. Declaration prevents
649
+ activation of another milestone; it does not imply delivery readiness.
650
+
651
+ ```yaml
652
+ oat_goal_outcome_audit:
653
+ disposition: met # met | met_with_deferrals
654
+ decided_at: '2026-10-11T12:00:00Z'
655
+ declaration_ref: <where the user's declaration is recorded>
656
+ brief_identity: <approved brief commit>
657
+ phases:
658
+ p01: { disposition: accepted, reason: null, scope_decision_ref: null }
659
+ outcomes:
660
+ '1':
661
+ {
662
+ disposition: met,
663
+ evidence_or_ref: <observed evidence>,
664
+ text: <outcome text as written>,
665
+ }
666
+ ```
290
667
 
291
- Goal mode adds a `## Milestones` index, milestone state, a delivery registry,
292
- milestone-scoped gates, re-alignment at each delivered milestone, and terminal
293
- closeout by verified delivery coverage. It is not registered yet; its
294
- sections will be added here when it ships.
668
+ - **Phases.** Every phase in the full inventory has exactly one disposition:
669
+ `accepted` (the phase-unit contract reports acceptance; the phase stays
670
+ subject to delivery coverage), `extracted` (matching brief and journal targets
671
+ and a child with the matching `oat_extracted_from` backlink), `deferred` or
672
+ `retired` (non-empty `reason` and `scope_decision_ref`; the phase stays
673
+ historically incomplete and the audit never fabricates `**Status:**
674
+ completed`).
675
+ - **Extracted-child deferral.** An extracted phase whose child project is not
676
+ complete keeps disposition `extracted` and records a non-empty `reason` and
677
+ `scope_decision_ref` for the approved deferral of the child's outstanding
678
+ obligation. The audit is then `met_with_deferrals`; under `met` closeout
679
+ refuses with `child-deferral-under-met`.
680
+ - **Outcomes.** Every numbered outcome has exactly one disposition, keyed by
681
+ its number and bound to its exact text: `met` with observed evidence,
682
+ `extracted` with the validated child obligation, or `deferred`/`retired` with
683
+ an approved scope decision. Renumbering or changing an outcome's text
684
+ invalidates the audit.
685
+ - `met` is permitted only when no obligation is deferred or retired;
686
+ otherwise the audit is `met_with_deferrals`. Unknown, duplicate, omitted or
687
+ contradictory phase or outcome references invalidate it.
688
+
689
+ **Terminal routing and coverage.** After declaration the router validates the
690
+ audit first, then repairs review, gate and delivery obligations through the
691
+ owners above, then routes uncovered accepted phases to
692
+ `oat-project-pr-final`, which registers the terminal delivery (`kind: pr`,
693
+ scope = those phases) through the section 12.7 contract: one terminal
694
+ delivery per milestone that owns uncovered phases, because a frozen delivery
695
+ scope never spans milestones, all sharing the head branch's member pull
696
+ request (section 12.7, Shared members). Audited `deferred`
697
+ and `retired` phases leave the terminal execution scope without changing
698
+ ordinary progress counts. Declaration opens closeout; coverage completes it:
699
+ `oat project closeout-check` and `oat project complete-state` require a valid
700
+ declaration, an exhaustive audit and delivery coverage before either
701
+ snapshot success or `not_required`, refuse without writing on unreadable
702
+ inputs or a failed member observation, and name the next owner in
703
+ `nextOwner.skill`.
704
+
705
+ **Snapshot `pr` step.** When execution of the configured post-implement
706
+ sequence reaches the `pr` step's position and coverage holds, implement's
707
+ closeout records that step complete with
708
+ `satisfied_by: { pr: delivery-coverage }` in the snapshot. The field is goal
709
+ only, names only the `pr` step, and is valid only once `pr` is in the completed
710
+ prefix; every other configured step runs unchanged.
711
+
712
+ ### 12.10 Re-alignment, project log and learnings
713
+
714
+ At `delivered`, `oat-project-goal` re-aligns: it runs
715
+ `oat project delivery refresh`, captures learnings, runs a delta interview,
716
+ amends the brief in place, appends the next milestone's phases and its
717
+ `## Milestones` row, repeats the section 5 ladder for the amendment (artifact
718
+ review, the next milestone's `plan` carrier, one approval), and activates only
719
+ once the previous delivery is observed at its agreed endpoint.
720
+
721
+ **Learnings captured** (the `delivered → aligning` prerequisite) is a concrete
722
+ write, not a reflection: one judgment entry (`worked-well` or `friction`)
723
+ through `oat project log append` when the project log is enabled; otherwise a
724
+ dated entry in the project's `oat-execution-learnings.md`
725
+ (created when absent, append-only).
726
+
727
+ **Structural log entries.** `oat-project-goal` appends exactly one structural
728
+ entry with `oat project log append --structural --producer oat-project-goal
729
+ --ref mNN` at each milestone activation and one at each re-alignment entry.
730
+ The delivery registration owners append one per registration (section 12.7
731
+ owners: `--producer oat-project-pr-progress --ref dNN` or
732
+ `--producer oat-project-pr-final --ref dNN`). Skills never pre-check log
733
+ configuration: the helper no-ops when logging is disabled.
734
+
735
+ ### 12.11 Extraction
736
+
737
+ Extraction is manual in v1.5 and is not `oat-project-split`. A transferred
738
+ phase gets `**Extracted to:** <slug>` in the brief and the journal marker pair
739
+ `**Status:** extracted` / `**Extracted to:** <slug>`; the child records
740
+ `oat_extracted_from: <goal slug>` and the transferred outcome text. The outcome
741
+ stays in the goal brief, and the audit requires the child complete or an
742
+ approved deferral (section 12.9). Goal promotion to quick refuses any extracted
743
+ phase (section 11).