@open-agent-toolkit/cli 0.1.40 → 0.1.42

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 (54) hide show
  1. package/assets/agents/oat-phase-implementer.md +2 -2
  2. package/assets/agents/oat-reviewer.md +10 -8
  3. package/assets/docs/cli-utilities/backlog-lifecycle.md +61 -0
  4. package/assets/docs/cli-utilities/config-and-local-state.md +47 -0
  5. package/assets/docs/cli-utilities/index.md +1 -0
  6. package/assets/docs/cli-utilities/workflow-gates.md +55 -0
  7. package/assets/docs/provider-sync/instruction-sync.md +1 -0
  8. package/assets/docs/reference/cli-reference.md +1 -1
  9. package/assets/docs/workflows/projects/artifacts.md +22 -0
  10. package/assets/docs/workflows/projects/hill-checkpoints.md +2 -0
  11. package/assets/docs/workflows/projects/implementation-execution.md +2 -1
  12. package/assets/docs/workflows/projects/reviews.md +17 -0
  13. package/assets/public-package-versions.json +4 -4
  14. package/assets/skills/oat-pjm-review-backlog/SKILL.md +29 -7
  15. package/assets/skills/oat-pjm-update-repo-reference/SKILL.md +25 -5
  16. package/assets/skills/oat-project-implement/SKILL.md +76 -5
  17. package/assets/skills/oat-project-review-provide/SKILL.md +25 -13
  18. package/assets/skills/oat-project-review-receive/SKILL.md +20 -10
  19. package/assets/skills/oat-review-provide/SKILL.md +14 -12
  20. package/assets/skills/oat-review-provide/references/review-artifact-template.md +1 -1
  21. package/assets/templates/pjm-agents.md +80 -1
  22. package/assets/templates/pjm-handoffs-readme.md +21 -0
  23. package/assets/templates/reference-agents.md +13 -0
  24. package/assets/templates/repo-agents.md +4 -0
  25. package/assets/templates/repo-readme.md +35 -0
  26. package/dist/commands/backlog/archive.d.ts +33 -0
  27. package/dist/commands/backlog/archive.d.ts.map +1 -0
  28. package/dist/commands/backlog/archive.js +229 -0
  29. package/dist/commands/backlog/index.d.ts +2 -0
  30. package/dist/commands/backlog/index.d.ts.map +1 -1
  31. package/dist/commands/backlog/index.js +56 -2
  32. package/dist/commands/backlog/regenerate-index.d.ts +5 -1
  33. package/dist/commands/backlog/regenerate-index.d.ts.map +1 -1
  34. package/dist/commands/backlog/regenerate-index.js +7 -1
  35. package/dist/commands/backlog/shared/item-status.d.ts +13 -0
  36. package/dist/commands/backlog/shared/item-status.d.ts.map +1 -0
  37. package/dist/commands/backlog/shared/item-status.js +34 -0
  38. package/dist/commands/gate/index.d.ts.map +1 -1
  39. package/dist/commands/gate/index.js +15 -3
  40. package/dist/commands/instructions/instructions.utils.d.ts.map +1 -1
  41. package/dist/commands/instructions/instructions.utils.js +24 -0
  42. package/dist/commands/pjm/doctor.d.ts.map +1 -1
  43. package/dist/commands/pjm/doctor.js +161 -0
  44. package/dist/commands/pjm/index.d.ts.map +1 -1
  45. package/dist/commands/pjm/index.js +2 -1
  46. package/dist/commands/pjm/init.d.ts +2 -1
  47. package/dist/commands/pjm/init.d.ts.map +1 -1
  48. package/dist/commands/pjm/init.js +7 -0
  49. package/dist/commands/review/latest.d.ts.map +1 -1
  50. package/dist/commands/review/latest.js +5 -2
  51. package/dist/commands/shared/frontmatter.d.ts +11 -0
  52. package/dist/commands/shared/frontmatter.d.ts.map +1 -1
  53. package/dist/commands/shared/frontmatter.js +15 -0
  54. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: oat-project-implement
3
- version: 2.0.24
3
+ version: 2.0.25
4
4
  description: Use when plan.md is ready for execution. Dispatches phase-level subagents with bounded fix loops; supports plan-declared parallel phase groups with worktree-isolated execution and ordered fan-in.
5
5
  oat_gateable: true
6
6
  argument-hint: '[--retry-limit <N>] [--dry-run]'
@@ -679,6 +679,39 @@ This setting controls only the extra `oat-project-review-provide` lifecycle revi
679
679
 
680
680
  **On resume:** If `oat_auto_review_at_hill_checkpoints` is already present in plan.md frontmatter, skip Touchpoint A entirely — do not re-ask, do not re-read config, do not print the auto-review note. The stored value is authoritative. If only legacy `oat_auto_review_at_checkpoints` is present, treat it as authoritative for this run and write the new `oat_auto_review_at_hill_checkpoints` key on the next plan frontmatter update.
681
681
 
682
+ ### Step 2.6: Validate Optional Phase Review Gate
683
+
684
+ Read `oat_phase_review_gate` from `"$PROJECT_PATH/plan.md"` frontmatter when present.
685
+
686
+ This is the plan-level `phaseReviewGate` setting: an optional, non-pausing external lifecycle review gate that runs after a phase's standard per-phase self-review passes. It uses the existing `oat gate review` target configuration to run a cross-provider review, then maps the produced review artifact to a blocking/non-blocking gate result.
687
+
688
+ Valid shape:
689
+
690
+ ```yaml
691
+ oat_phase_review_gate:
692
+ enabled: true
693
+ phases: [] # empty or omitted = every implementation phase
694
+ review_type: code
695
+ exit_nonzero_on: important
696
+ ```
697
+
698
+ Validation rules:
699
+
700
+ - Missing, `null`, or `enabled: false` means disabled.
701
+ - `enabled: true` activates the gate.
702
+ - `phases` is optional. If missing or empty (`[]`), run after every implementation phase. If populated, every value must be a known plan phase ID.
703
+ - `review_type` is optional and defaults to `code`. This skill only supports `code` phase gates; any other value is invalid for implementation phase execution.
704
+ - `exit_nonzero_on` is optional and defaults to `important`. Allowed values: `critical`, `important`, `medium`, `minor`.
705
+
706
+ If the setting is invalid, stop before task execution and ask the user to repair `plan.md`. Do not silently disable a malformed gate.
707
+
708
+ This setting is independent from HiLL checkpoints:
709
+
710
+ - It does not pause when the gate passes.
711
+ - It does not append to `oat_hill_completed`.
712
+ - It does not alter `oat_plan_hill_phases` or `oat_auto_review_at_hill_checkpoints`.
713
+ - It uses the existing gate target config; do not hardcode `--target` in reusable plan execution unless the user explicitly asks for manual/debug routing.
714
+
682
715
  ### Step 3: Check Implementation State
683
716
 
684
717
  Check if implementation already started:
@@ -892,6 +925,43 @@ On reviewer verdict `fail`, run a bounded fix loop.
892
925
  - **Sequential mode:** STOP the run. Surface to user with phase ID, unresolved findings, review artifact path. Do not proceed to subsequent phases.
893
926
  - **Parallel group mode:** mark the phase `excluded`. Do not merge its worktree. Continue the remaining phases in the group. Report in Outstanding Items after the group completes.
894
927
 
928
+ ### Optional External Phase Review Gate
929
+
930
+ After the standard per-phase reviewer passes and after the required phase bookkeeping commit is cleanly recorded, check `oat_phase_review_gate`.
931
+
932
+ If the gate is enabled and the current phase is selected:
933
+
934
+ 1. Run the gate from the orchestration branch with the active project path:
935
+
936
+ ```bash
937
+ oat --json gate review \
938
+ --project "$PROJECT_PATH" \
939
+ --review-type code \
940
+ --review-scope "{pNN}" \
941
+ --exit-nonzero-on "{threshold}" \
942
+ '$oat-project-review-provide code {pNN}'
943
+ ```
944
+
945
+ - `{threshold}` comes from `oat_phase_review_gate.exit_nonzero_on` (default: `important`).
946
+ - `{pNN}` is the completed phase ID.
947
+ - Do not pass `--target` in normal execution; the existing gate config selects the cross-provider target.
948
+ - The gate CLI injects gate context into the review prompt. The produced review artifact must use `oat_review_invocation: gate`.
949
+
950
+ 2. Parse the JSON result. The gate verdict (`exit_nonzero_on: {threshold}`) decides whether the phase **stops**; it does not decide whether sub-threshold findings are ignored. Either way the produced artifact must be **consumed** — passing gate artifacts are not left unprocessed at the top level of `reviews/`.
951
+ - `status: "ok"` / exit code `0` means the phase gate passed at the configured threshold, so the phase does not stop. Still run `oat-project-review-receive` for the reported artifact path in non-pausing **judgment-sweep** mode (pass gate-passed context so receive selects sweep disposition). The sweep makes a per-finding judgment for each Medium/Minor — defer to final (default), address now (small/contained/low-risk fixes only), or reject with rationale — writes those durable dispositions into `implementation.md`, and archives the artifact. Then continue without pausing. Address-now fixes from a passing gate do **not** re-trigger the standard reviewer or re-gate the phase.
952
+ - `status: "blocked"` / non-zero exit due to review findings means blocking findings exist. Run `oat-project-review-receive` for the reported artifact path (blocking disposition) before treating the gate review as consumed.
953
+ - A non-zero exit caused by target execution failure, artifact validation failure, or missing review artifact is an operational failure. Stop and surface the gate output; do not continue as if the gate passed.
954
+
955
+ 3. If `oat-project-review-receive` adds fix tasks (blocking gate, or a sweep address-now fix that revealed a Critical/Important concern):
956
+ - Return to task execution for the newly added review-fix tasks.
957
+ - After fixes land, re-run the standard per-phase reviewer and this external phase gate for the same phase.
958
+ - Continue only after both the standard reviewer and the external phase gate pass.
959
+ - Bound these gate block → fix → re-gate rounds by `oat_orchestration_retry_limit` (from `state.md`, default `2`). If the limit is exhausted with the gate still blocking, apply the same terminal handling as the standard bounded fix loop: **sequential mode** stops the run and surfaces the phase ID, unresolved findings, and artifact path; **parallel group mode** marks the phase `excluded` and reports it in Outstanding Items.
960
+
961
+ 4. If the judgment sweep (passing gate) records only deferrals/rejections and no blocking fix tasks, record the receive result and continue.
962
+
963
+ For a parallel group, run selected phase gates after fan-in and bookkeeping, one gate per successfully merged phase in plan order. If a phase gate blocks, stop the schedule and process that gate's review before starting later schedule entries.
964
+
895
965
  ### Parallel Group Execution
896
966
 
897
967
  When the current schedule entry is a multi-phase group, execute as follows.
@@ -966,7 +1036,7 @@ When the current schedule entry is a multi-phase group, execute as follows.
966
1036
 
967
1037
  For phases that were excluded (fix-loop exhausted), preserve the worktree and log its path in `implementation.md` Outstanding Items.
968
1038
 
969
- 8. **Bookkeeping commit** after the group completes. Then HiLL checkpoint check.
1039
+ 8. **Bookkeeping commit** after the group completes. Then run any selected external phase review gates. After those gates pass, perform the HiLL checkpoint check.
970
1040
 
971
1041
  ### Step 7: Artifact Updates After Each Phase (or Group)
972
1042
 
@@ -1039,7 +1109,7 @@ git add {PROJECT_PATH}/implementation.md {PROJECT_PATH}/state.md {PROJECT_PATH}/
1039
1109
  git commit -m "chore(oat): bookkeeping after {pNN} {pass|fail}"
1040
1110
  ```
1041
1111
 
1042
- Then check HiLL checkpoint — if the phase ID is in `oat_plan_hill_phases`, pause for user approval before continuing.
1112
+ Then run the optional external phase review gate for the completed phase when `oat_phase_review_gate` selects it. After the gate passes or is skipped, check HiLL checkpoint — if the phase ID is in `oat_plan_hill_phases`, pause for user approval before continuing.
1043
1113
 
1044
1114
  ### Step 8: Check Plan Phase Completion
1045
1115
 
@@ -1130,6 +1200,7 @@ Do not use `git add -A` or glob patterns. Only commit the three project artifact
1130
1200
 
1131
1201
  - **Workflow HiLL** (`oat_hill_checkpoints` in state.md): Gates between workflow phases (discovery → spec → design → plan → implement). Checked by oat-project-progress router.
1132
1202
  - **Plan phase checkpoints** (`oat_plan_hill_phases` in plan.md): Gates at plan phase boundaries during implementation. `[]` means pause after every phase; a populated array pauses only after listed phases. The field may be absent only before the first implementation-run confirmation. Listed phases are where you stop AFTER completing them.
1203
+ - **Phase review gate** (`oat_phase_review_gate` in plan.md): Optional non-pausing external review gate after a completed phase passes the standard reviewer. Missing/disabled means skip; `phases: []` means gate every implementation phase. Passing gates continue automatically; blocking gates are received/fixed before execution proceeds.
1133
1204
 
1134
1205
  **Revision phase completion handling:**
1135
1206
 
@@ -1296,7 +1367,7 @@ echo "$FINAL_ROW"
1296
1367
  **If final review row exists and status is `passed`:**
1297
1368
 
1298
1369
  - Example row:
1299
- - `| final | code | passed | 2026-01-28 | reviews/final-review-2026-01-28.md |`
1370
+ - `| final | code | passed | 2026-01-28 | reviews/final-review-2026-01-28T140322Z.md |`
1300
1371
  - Check:
1301
1372
  ```bash
1302
1373
  echo "$FINAL_ROW" | grep -qE "^\\|\\s*final\\s*\\|.*\\|\\s*passed\\s*\\|" && echo "passed"
@@ -1446,7 +1517,7 @@ Final verification:
1446
1517
 
1447
1518
  Final review:
1448
1519
  - Status: ✓ passed
1449
- - Artifact: reviews/final-review-{date}.md
1520
+ - Artifact: reviews/final-review-{timestamp}.md
1450
1521
 
1451
1522
  Next: Create PR or run the oat-project-pr-final skill (when available)
1452
1523
  ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: oat-project-review-provide
3
- version: 1.3.8
3
+ version: 1.3.10
4
4
  description: Use when the user explicitly asks to review an OAT project — e.g. "review project", "review the project", "run project review", or confirms a previously offered review. Do NOT auto-invoke on completed work alone. Resolves a project review scope and offers before running.
5
5
  disable-model-invocation: false
6
6
  user-invocable: true
@@ -25,11 +25,13 @@ Reviewers should distinguish implementation defects from artifact drift. If code
25
25
 
26
26
  ## Model Invocation Gate
27
27
 
28
- This skill is model-invokable only for explicit review asks such as "review project" or "review the project", or when the user confirms a previously offered project-review step. Do NOT auto-invoke merely because a task, phase, or implementation appears complete.
28
+ This skill is model-invokable only for explicit review asks such as "review project" or "review the project", or when the user confirms a previously offered project-review step. A gate-originated request from `oat gate review` is also an explicit review ask. Do NOT auto-invoke merely because a task, phase, or implementation appears complete.
29
29
 
30
30
  Before acting, verify that there is an active OAT project or a user-provided review target that can be resolved to project state. If neither exists, do not run this skill; offer `oat-project-open` / `oat-project-quick-start` for project workflow setup, or `oat-review-provide` for a non-project ad-hoc review.
31
31
 
32
- When the gate passes, summarize the inferred review type and scope, then ask before running the review.
32
+ When the invocation is manual, summarize the inferred review type and scope, then ask before running the review.
33
+
34
+ **Gate-originated mode:** If the request context says the review is gate-originated, set `REVIEW_INVOCATION=gate`, honor any provided review type/scope arguments, and run without interactive confirmation prompts. The gate session is already the explicit authorization boundary. If subagent dispatch is unavailable, run the review inline in the current gate session instead of handing off to a fresh session.
33
35
 
34
36
  ## Mode Assertion
35
37
 
@@ -123,7 +125,7 @@ Tell user:
123
125
  - `oat-project-quick-start` (new quick project)
124
126
  - `oat-project-import-plan` (external plan import)
125
127
 
126
- If validation passes, derive `{project-name}` as basename of `PROJECT_PATH`. Summarize the resolved project/review target and ask before continuing to Step 1.
128
+ If validation passes, derive `{project-name}` as basename of `PROJECT_PATH`. Summarize the resolved project/review target. For manual invocation, ask before continuing to Step 1. For `REVIEW_INVOCATION=gate`, continue without asking.
127
129
 
128
130
  ### Step 1: Parse Arguments or Ask
129
131
 
@@ -424,6 +426,8 @@ Files changed: {FILE_COUNT}
424
426
  Proceed with review?
425
427
  ```
426
428
 
429
+ If `REVIEW_INVOCATION=gate`, print the same scope summary but do not ask `Proceed with review?`; continue directly.
430
+
427
431
  ### Step 4.1: Dispatch Profile Override Advisory (Artifact Plan Only)
428
432
 
429
433
  When reviewing `artifact plan`, apply this Dispatch Profile override advisory:
@@ -536,6 +540,7 @@ Detection logic:
536
540
  - If the runtime can dispatch reviewer work (`subagent_type` in Claude Code, Cursor invocation via `/name` or natural mention, or Codex multi-agent spawn/auto-spawn) → **Tier 1**.
537
541
  - If the Task tool is not available or subagent dispatch is not supported → **Tier 2**.
538
542
  - If user explicitly requests inline or confirms they are already in a fresh session → **Tier 3**.
543
+ - If `REVIEW_INVOCATION=gate` and Tier 1 is unavailable, skip Tier 2 and use **Tier 3** inline. Do not return fresh-session instructions from a gate invocation.
539
544
 
540
545
  **Step 6b: Tier 1 — Subagent (if available)**
541
546
 
@@ -566,6 +571,7 @@ If subagent not available:
566
571
  - If user is already in a fresh session (confirmed), proceed to Tier 3.
567
572
  - If Codex reported `authorization required` and the user approved delegation, do **not** use Tier 2. Return to Tier 1 and delegate to `oat-reviewer`.
568
573
  - If user prefers fresh session: provide instructions and exit.
574
+ - If `REVIEW_INVOCATION=gate`: do not provide fresh-session instructions; run Tier 3 inline instead.
569
575
 
570
576
  Instructions for fresh session:
571
577
 
@@ -599,13 +605,15 @@ Review storage contract:
599
605
 
600
606
  **Naming convention:**
601
607
 
602
- - Phase review: `{PROJECT_PATH}/reviews/pNN-review-YYYY-MM-DD.md`
603
- - Task review: `{PROJECT_PATH}/reviews/pNN-tNN-review-YYYY-MM-DD.md`
604
- - Final review: `{PROJECT_PATH}/reviews/final-review-YYYY-MM-DD.md`
605
- - Range review: `{PROJECT_PATH}/reviews/range-review-YYYY-MM-DD.md`
606
- - Artifact review: `{PROJECT_PATH}/reviews/artifact-{artifact}-review-YYYY-MM-DD.md`
608
+ Use a seconds-precision **UTC** timestamp token (`YYYY-MM-DDTHHMMSSZ`, from `date -u +%Y-%m-%dT%H%M%SZ` — the `-u` and the trailing `Z` are mandatory), not a date-only or local-time stamp, so that same-scope re-reviews and re-gates within one day never collide and `oat review latest` orders them by recency:
609
+
610
+ - Phase review: `{PROJECT_PATH}/reviews/pNN-review-YYYY-MM-DDTHHMMSSZ.md`
611
+ - Task review: `{PROJECT_PATH}/reviews/pNN-tNN-review-YYYY-MM-DDTHHMMSSZ.md`
612
+ - Final review: `{PROJECT_PATH}/reviews/final-review-YYYY-MM-DDTHHMMSSZ.md`
613
+ - Range review: `{PROJECT_PATH}/reviews/range-review-YYYY-MM-DDTHHMMSSZ.md`
614
+ - Artifact review: `{PROJECT_PATH}/reviews/artifact-{artifact}-review-YYYY-MM-DDTHHMMSSZ.md`
607
615
 
608
- **If file exists for today:** append `-v2`, `-v3`, etc.
616
+ Set `oat_generated_at` in the artifact frontmatter to the matching full timestamp (`YYYY-MM-DDTHH:MM:SSZ`). Same-second collisions are effectively impossible for sequential runs; if one occurs, append `-v2`, `-v3`, etc.
609
617
 
610
618
  **Important:** `PROJECT_PATH` here must be the resolved path from Step 1.5. If a worktree was detected, this path is relative to the worktree root, ensuring the artifact is written on the correct branch.
611
619
 
@@ -636,7 +644,7 @@ Shared ad-hoc companion reference (non-project mode):
636
644
  ```markdown
637
645
  ---
638
646
  oat_generated: true
639
- oat_generated_at: { today }
647
+ oat_generated_at: { full UTC timestamp, e.g. 2026-07-06T11:16:01Z }
640
648
  oat_review_scope: { scope }
641
649
  oat_review_type: { code|artifact }
642
650
  oat_review_invocation: { manual|auto|gate }
@@ -655,9 +663,13 @@ oat_project: { PROJECT_PATH }
655
663
 
656
664
  - `manual` (default): Review was manually triggered by the user. `oat-project-review-receive` uses standard disposition behavior (user prompts for triage, minors auto-deferred for non-final scopes).
657
665
  - `auto`: Review was spawned by the auto-review checkpoint trigger in `oat-project-implement`. `oat-project-review-receive` uses relaxed disposition: minors are auto-converted to fix tasks (not deferred), no user prompts for disposition decisions.
658
- - `gate`: Review was spawned by `oat gate review`. Gate-originated reviews use normal stateful review-provide behavior: write the review artifact, update the `## Reviews` row, and commit review bookkeeping. `oat-project-review-receive` treats gate reviews with the same standard disposition behavior as manual reviews unless a future implementation explicitly designs autonomous receive.
666
+ - `gate`: Review was spawned by `oat gate review` for a workflow gate. Gate-originated reviews use normal stateful review-provide behavior: write the review artifact, update the `## Reviews` row, and commit review bookkeeping. The gate CLI maps the review artifact findings to exit status, and `oat-project-review-receive` dispositions gate reviews autonomously (no user prompts) — selecting convert-to-fix-tasks when the gate **blocked** at its threshold, or non-pausing judgment-sweep disposition (defer / small-fix-now / reject, with sub-threshold findings recorded durably) when the gate **passed**.
667
+
668
+ When `oat-project-implement` spawns this skill for auto-review at checkpoints, it passes context indicating auto invocation. Set `oat_review_invocation: auto` in the artifact frontmatter.
669
+
670
+ When `oat gate review` invokes this skill, it includes gate-originated context instructing the reviewer to write `oat_review_invocation: gate`. Honor that instruction in the artifact frontmatter.
659
671
 
660
- When `oat-project-implement` spawns this skill for auto-review at checkpoints, it passes context indicating auto invocation. Set `oat_review_invocation: auto` in the artifact frontmatter. When `oat gate review` spawns this skill, set `oat_review_invocation: gate`. For all other invocations (user-triggered, fresh session), use `manual`.
672
+ For all other invocations (user-triggered, fresh session), use `manual`.
661
673
 
662
674
  Gate parsing contract:
663
675
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: oat-project-review-receive
3
- version: 1.5.4
3
+ version: 1.5.6
4
4
  description: Use when the user explicitly asks to receive review findings for an OAT project — e.g. "receive review", "process review", "process the project review", or confirms a previously offered review-receive step. Do NOT auto-invoke merely because a review file exists. Resolves the latest review and offers before acting.
5
5
  disable-model-invocation: false
6
6
  user-invocable: true
@@ -102,7 +102,7 @@ fi
102
102
 
103
103
  Selection rules:
104
104
 
105
- - Use `oat review latest` as the first-choice resolver. It scans project reviews (`reviews/` and `reviews/archived/`) plus ad-hoc review locations and orders candidates by `oat_generated_at` frontmatter rather than filesystem mtime.
105
+ - Use `oat review latest` as the first-choice resolver. It scans project reviews (`reviews/` and `reviews/archived/`) plus ad-hoc review locations and orders candidates by `oat_generated_at` frontmatter rather than filesystem mtime. Review artifacts carry a seconds-precision `oat_generated_at` and a matching timestamped filename, so same-scope same-day re-gates order deterministically and the newest round wins — never assume the plain `<scope>-review-<date>.md` name is current.
106
106
  - Read the JSON result:
107
107
  - `path: null` means no review target was found.
108
108
  - `kind: "project"` and `actionable: true` means this skill can process the target when the path is an active top-level project review.
@@ -267,15 +267,23 @@ Read `oat_review_type` and `oat_review_invocation` from review artifact frontmat
267
267
  - Require explicit user confirmation before applying any artifact edits.
268
268
  - Resolve findings directly in artifact files; do not convert findings into plan tasks.
269
269
  - Do not defer findings by default. Only use `rejected_with_rationale` for invalid findings, or `needs_user_direction` when user input is required.
270
- - If `oat_review_type == code` AND `oat_review_invocation == auto`:
271
- - **Auto-disposition mode.** This review was spawned by the auto-review checkpoint trigger in `oat-project-implement`. Apply relaxed disposition defaults:
270
+ - If `oat_review_type == code` AND `oat_review_invocation == auto`, OR `oat_review_invocation == gate` from a **blocking** gate (the gate-originated context does not indicate a passing-gate sweep):
271
+ - **Auto-disposition mode.** This review was spawned by the auto-review checkpoint trigger in `oat-project-implement` or by a blocking `oat gate review`. Apply relaxed disposition defaults:
272
272
  - Critical/Important/Medium: convert to fix tasks (same as manual mode)
273
- - Minor: auto-convert to fix tasks unless clearly out of scope (e.g., cosmetic polish unrelated to changed code). Manual mode now also defaults minors to `convert` (see Step 9); auto mode keeps the same intent — fix everything while context is fresh — but without any user prompts.
274
- - **No user prompts for disposition decisions.** The auto-review path runs fully autonomously.
273
+ - Minor: auto-convert to fix tasks unless clearly out of scope (e.g., cosmetic polish unrelated to changed code). Manual mode now also defaults minors to `convert` (see Step 9); auto/gate mode keeps the same intent — fix everything while context is fresh — but without any user prompts.
274
+ - **No user prompts for disposition decisions.** The auto/gate review path runs fully autonomously.
275
275
  - Genuinely ambiguous findings (e.g., a medium the agent disagrees with) are deferred with a note explaining why, rather than pausing for interactive resolution.
276
276
  - Follow the task-conversion flow in Steps 3-10 with these adjusted defaults.
277
- - If `oat_review_type == code` AND `oat_review_invocation == gate`:
278
- - **Gate review mode.** This review was spawned by `oat gate review`, but receive remains standard disposition behavior. Treat `gate` the same as manual for prompts, finding conversion, artifact archival, and bookkeeping unless a future implementation explicitly designs an autonomous receive path.
277
+ - If `oat_review_type == code` AND `oat_review_invocation == gate` from a **passing** gate (the gate-originated context indicates a passing-gate judgment sweep):
278
+ - **Judgment-sweep mode.** The phase gate already passed at its `exit_nonzero_on` threshold, so the phase does not stop. Consume the artifact anyway, so its sub-threshold findings become durable, ordered dispositions in `implementation.md` instead of evaporating. Fully non-pausing; no user prompts.
279
+ - The gate verdict decided whether the phase stops; it did **not** decide whether Medium/Minor findings are ignored. There are, by definition, no unresolved Critical/Important findings in a passing gate (if there were, the gate would have blocked).
280
+ - Make a per-finding **judgment call** for each Medium/Minor — do not mechanically dump them all:
281
+ - **Defer to final** (default): record under "Deferred Findings" (Mediums under "Deferred Findings (Medium)" so Step 8.5 resurfacing picks them up) with concrete rationale.
282
+ - **Address now:** only for small, contained, low-risk fixes. Apply the fix, commit it with the phase bookkeeping, and record the disposition. Do **not** re-run the standard reviewer or re-gate the phase for address-now fixes.
283
+ - **Reject** as false-positive / out-of-scope, with concrete rationale.
284
+ - `address now` is an **exception, not the norm** — when in doubt, defer. Do not let a passing gate drift into behaving like a Medium-blocking gate by habit.
285
+ - **Escalation exception:** if an address-now fix reveals or creates a Critical/Important concern, stop treating it as a sweep item. Convert it to a fix task and return control to the blocking-gate path (`oat-project-implement` re-runs the standard reviewer and the gate for the phase).
286
+ - Do not add blocking fix tasks for deferred or rejected findings. After recording all dispositions, archive the artifact (Step 7.5) and commit review bookkeeping (Step 7.6) as usual.
279
287
  - If `oat_review_type == code` (manual or `oat_review_invocation` absent):
280
288
  - Follow the existing task-conversion flow in Steps 3-10 with standard disposition behavior.
281
289
 
@@ -483,13 +491,15 @@ If the project itself is still untracked because earlier lifecycle steps never c
483
491
 
484
492
  **Bounded loop protection:**
485
493
 
486
- Count how many review cycles have occurred for this scope:
494
+ Count how many review cycles have occurred for this scope. Exclude gate-originated artifacts (`oat_review_invocation: gate`): the cap measures failed fix cycles of the standard review loop, not artifact volume, and phase gate re-runs are governed by the phase review gate flow in `oat-project-implement`, not by this cap.
487
495
 
488
496
  ```bash
489
497
  {
490
498
  find "$PROJECT_PATH/reviews" -maxdepth 1 -type f -name "*$SCOPE_TOKEN*.md" 2>/dev/null
491
499
  find "$PROJECT_PATH/reviews/archived" -maxdepth 1 -type f -name "*$SCOPE_TOKEN*.md" 2>/dev/null
492
- } | wc -l
500
+ } | while IFS= read -r artifact; do
501
+ grep -q "oat_review_invocation: gate" "$artifact" || echo "$artifact"
502
+ done | wc -l
493
503
  ```
494
504
 
495
505
  **If 3 or more cycles:**
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: oat-review-provide
3
- version: 1.2.2
3
+ version: 1.2.3
4
4
  description: Use when you need an ad-hoc review outside an active OAT project lifecycle. Reviews code or artifacts without project phase state, unlike oat-project-review-provide.
5
5
  argument-hint: '[unstaged|staged|base_branch=<branch>|base_sha=<sha>|<sha1>..<sha2>|--files <path1,path2,...>] [--output <path>] [--mode auto|local|tracked|inline]'
6
6
  disable-model-invocation: true
@@ -151,18 +151,20 @@ If user asks for tracked `.oat/repo/reviews` and it is gitignored, warn and ask
151
151
 
152
152
  Derive a **scope slug** from the resolved scope mode so that the filename indicates what was reviewed:
153
153
 
154
- | Scope mode | Slug derivation | Example filename |
155
- | ---------------------- | ------------------------------------ | --------------------------------------------- |
156
- | `base_branch=<branch>` | Current branch name | `ad-hoc-review-2026-02-16-oat-repo.md` |
157
- | `unstaged` | Literal `unstaged` | `ad-hoc-review-2026-02-16-unstaged.md` |
158
- | `staged` | Literal `staged` | `ad-hoc-review-2026-02-16-staged.md` |
159
- | `--files <paths>` | First 2–3 basenames, joined with `-` | `ad-hoc-review-2026-02-16-auth-login.md` |
160
- | `base_sha=<sha>` | Short SHA (7 chars) | `ad-hoc-review-2026-02-16-abc1234.md` |
161
- | `<sha1>..<sha2>` | Both short SHAs joined with `-` | `ad-hoc-review-2026-02-16-abc1234-def5678.md` |
154
+ | Scope mode | Slug derivation | Example filename |
155
+ | ---------------------- | ------------------------------------ | ----------------------------------------------------- |
156
+ | `base_branch=<branch>` | Current branch name | `ad-hoc-review-2026-02-16T140322Z-oat-repo.md` |
157
+ | `unstaged` | Literal `unstaged` | `ad-hoc-review-2026-02-16T140322Z-unstaged.md` |
158
+ | `staged` | Literal `staged` | `ad-hoc-review-2026-02-16T140322Z-staged.md` |
159
+ | `--files <paths>` | First 2–3 basenames, joined with `-` | `ad-hoc-review-2026-02-16T140322Z-auth-login.md` |
160
+ | `base_sha=<sha>` | Short SHA (7 chars) | `ad-hoc-review-2026-02-16T140322Z-abc1234.md` |
161
+ | `<sha1>..<sha2>` | Both short SHAs joined with `-` | `ad-hoc-review-2026-02-16T140322Z-abc1234-def5678.md` |
162
162
 
163
163
  ```bash
164
164
  mkdir -p "$OUTPUT_DIR"
165
- TODAY=$(date +%Y-%m-%d)
165
+ # Seconds-precision UTC token so same-scope same-day re-reviews never collide and
166
+ # order by recency in `oat review latest`. The trailing Z (UTC) is mandatory.
167
+ STAMP=$(date -u +%Y-%m-%dT%H%M%SZ)
166
168
 
167
169
  # Derive SCOPE_SLUG based on scope mode (examples):
168
170
  # base_branch → SCOPE_SLUG=$(git branch --show-current | tr '/' '-')
@@ -174,10 +176,10 @@ TODAY=$(date +%Y-%m-%d)
174
176
  # Sanitize: lowercase, replace non-alphanumeric with '-', collapse runs, trim to 40 chars
175
177
  SCOPE_SLUG=$(echo "$SCOPE_SLUG" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9-]/-/g; s/--*/-/g; s/^-//; s/-$//' | cut -c1-40)
176
178
 
177
- OUT_FILE="$OUTPUT_DIR/ad-hoc-review-${TODAY}-${SCOPE_SLUG}.md"
179
+ OUT_FILE="$OUTPUT_DIR/ad-hoc-review-${STAMP}-${SCOPE_SLUG}.md"
178
180
  ```
179
181
 
180
- If the file already exists (same scope reviewed twice in one day), suffix with `-v2`, `-v3`, etc.
182
+ Set `oat_generated_at` in the artifact frontmatter to the matching full UTC timestamp (`YYYY-MM-DDTHH:MM:SSZ`). Same-second collisions are effectively impossible for sequential runs; if one occurs, suffix with `-v2`, `-v3`, etc.
181
183
 
182
184
  ### Step 4: Run Review
183
185
 
@@ -5,7 +5,7 @@ Use this template for non-project commit-range reviews.
5
5
  ````markdown
6
6
  ---
7
7
  oat_generated: true
8
- oat_generated_at: YYYY-MM-DD
8
+ oat_generated_at: YYYY-MM-DDTHH:MM:SSZ
9
9
  oat_review_type: code
10
10
  oat_review_scope: { scope }
11
11
  oat_review_scope_mode: { files|unstaged|staged|range }
@@ -10,4 +10,83 @@ This directory owns active project-management state.
10
10
  - `current-state.md` records the present operating picture.
11
11
  - `roadmap.md` records prioritized direction and sequencing.
12
12
  - `backlog/` stores file-per-record backlog items and generated indexes.
13
- - Do not store durable research, brainstorms, imported plans, or decision history here.
13
+ - `handoffs/` stores one-shot project-kickoff prompts for backlog items
14
+ (see `handoffs/README.md`); each is deleted in the PR that ships its item.
15
+ - Do not store durable research, brainstorms, imported plans, or decision
16
+ history here.
17
+
18
+ ## Backlog Lifecycle
19
+
20
+ Invariant: `backlog/items/` holds only active work (`status: open` or
21
+ `in_progress`). Completed and abandoned records live in `backlog/archived/`.
22
+ `backlog/completed.md` is the newest-first summary of what shipped.
23
+
24
+ **Trigger.** Close an item out when either is true:
25
+
26
+ - an item's `status` changes to `closed` or `wont_do` (these are the only
27
+ terminal values — never invent variants like `done`), or
28
+ - a commit or PR satisfies an item's acceptance criteria — **even when the work
29
+ happened outside an OAT project lifecycle** (small doc commits included).
30
+
31
+ The agent or person shipping the work owns the close-out, in the same
32
+ commit/PR as the work whenever practical.
33
+
34
+ **Close-out (primary path).** Run `oat backlog archive <id>` — add `--wont-do`
35
+ for abandoned work and `--summary "<text>"` to record the outcome. The command
36
+ performs the whole close-out atomically: it flips `status` to the terminal
37
+ value and bumps `updated`, appends the canonical `backlog/completed.md` entry
38
+ (always for `closed`; for `wont_do` only when `--summary` is given), moves the
39
+ item file from `backlog/items/` to `backlog/archived/`, and regenerates
40
+ `backlog/index.md`. Stage the resulting changes with the shipping commit/PR.
41
+
42
+ **Manual fallback.** These are the steps the command automates — follow them, in
43
+ order, only when closing out by hand:
44
+
45
+ 1. In the item file, set `status: closed` (or `wont_do`) and bump `updated`.
46
+ 2. Append a summary entry to `backlog/completed.md` (newest first; entry format
47
+ is documented at the top of that file). Add the entry for a `wont_do` item
48
+ only when the abandonment itself is worth recording (an explicit summary).
49
+ 3. `git mv` the item file from `backlog/items/` to `backlog/archived/`.
50
+ 4. Run `oat backlog regenerate-index` and stage the regenerated
51
+ `backlog/index.md`.
52
+ 5. If the completion changes the operating picture, refresh
53
+ `current-state.md` and the curated overview section of `backlog/index.md`.
54
+
55
+ A partial close-out (status flipped or `completed.md` updated, but the file
56
+ left in `items/`) is how drift starts — finish all steps or none. `oat pjm
57
+ doctor` surfaces this drift.
58
+
59
+ **When reviewing backlog state** (e.g. `oat-pjm-review-backlog`), cross-check
60
+ recent commits against open items: work that shipped without a close-out
61
+ should be closed retroactively with a note.
62
+
63
+ ## Project Kickoff Handoffs
64
+
65
+ `handoffs/` holds one-shot kickoff prompts — consumable context for turning a
66
+ backlog item into a project, not documentation. The item file and `reference/`
67
+ remain the source of truth. See `handoffs/README.md` for the directory
68
+ convention.
69
+
70
+ - **When to generate:** when a priority-alignment pass concludes (e.g. the
71
+ walkthrough at the end of `oat-pjm-review-backlog`), write or refresh one
72
+ handoff per item in the agreed kickoff stack. Kickoff-stack membership, lane
73
+ count, and ordering are the human's call — present them, do not choose them.
74
+ Do not generate handoffs for parked or queued items until they are actually
75
+ next.
76
+ - **Naming:** one file per backlog item, `handoffs/<BL-id>.md`.
77
+ - **Required content:**
78
+ - the backlog item reference — its ID **and** human-readable title **and**
79
+ path (never a bare ID);
80
+ - the recommended project mode (`oat-project-quick-start` vs
81
+ `oat-project-new`), including which artifacts (spec/design/plan) to
82
+ pre-populate from existing research when it exists;
83
+ - authoritative input pointers (research directories, decision records, code
84
+ paths);
85
+ - repo conventions and verification gates the item file does not restate;
86
+ - a close-out section requiring (a) the **Backlog Lifecycle** above executed
87
+ in the same PR that ships the item and (b) deletion of the handoff file
88
+ (`git rm`) in that same PR.
89
+ - **Staleness:** if a later alignment pass drops an item from the kickoff
90
+ stack, delete its handoff in that pass rather than letting it drift.
91
+ - Every backlog item reference — in review output, alignment docs, and
92
+ handoffs — pairs the ID with its human-readable title. No bare IDs.
@@ -0,0 +1,21 @@
1
+ ---
2
+ oat_template: true
3
+ oat_template_name: pjm-handoffs-readme
4
+ ---
5
+
6
+ # PJM Handoffs
7
+
8
+ One-shot kickoff context for backlog items about to become OAT projects. Each
9
+ file stitches the backlog item, existing research, code pointers, and mode
10
+ guidance into a single prompt an operator passes as context when starting a
11
+ project (`oat-project-quick-start` or `oat-project-new`).
12
+
13
+ Conventions:
14
+
15
+ - One file per backlog item, named `<BL-id>.md`.
16
+ - Handoffs are **consumable, not durable**: once the project is created and the
17
+ content is absorbed into project artifacts, delete the handoff (`git rm`) in
18
+ the same PR that ships the work. Durable knowledge belongs in the item file,
19
+ `reference/`, or project artifacts — never here.
20
+ - Each handoff carries its own deletion instruction so the consuming agent
21
+ needs no outside context.
@@ -12,3 +12,16 @@ This directory owns append-mostly reference material.
12
12
  - `external-plans/` stores imported provider or external plans.
13
13
  - Create research, brainstorm, and deck folders on demand when a workflow needs them.
14
14
  - Do not put active roadmap, current-state, or backlog records directly under `reference/`.
15
+
16
+ ## Source of Truth
17
+
18
+ | Topic | Canonical location |
19
+ | -------------------------------------- | --------------------------------------------------------------------------- |
20
+ | Backlog close-out / lifecycle workflow | `../pjm/AGENTS.md` (Backlog Lifecycle) |
21
+ | Project kickoff handoffs | `../pjm/AGENTS.md` (Project Kickoff Handoffs) + `../pjm/handoffs/README.md` |
22
+ | Durable decisions | `decisions/` |
23
+ | Active operating picture / roadmap | `../pjm/current-state.md`, `../pjm/roadmap.md` |
24
+
25
+ **Update rule.** Do not restate the backlog close-out workflow here. When it
26
+ changes, edit `../pjm/AGENTS.md` and link to it — this directory defers to that
27
+ section rather than duplicating it.
@@ -11,3 +11,7 @@ Use this directory as the canonical OAT repo-reference root.
11
11
  - Durable append-mostly references live in `reference/`.
12
12
  - Keep generated indexes inside their managed marker pairs.
13
13
  - When an index conflicts, regenerate it with the owning OAT command and stage the result.
14
+ - Backlog close-out follows the **Backlog Lifecycle** in `pjm/AGENTS.md` — run
15
+ `oat backlog archive <id>` in the same PR that ships the work.
16
+ - `README.md` is the human-facing orientation for this directory; agent-facing
17
+ rules live in the `AGENTS.md` files alongside each subdirectory.
@@ -0,0 +1,35 @@
1
+ ---
2
+ oat_template: true
3
+ oat_template_name: repo-readme
4
+ ---
5
+
6
+ # OAT Repo Reference
7
+
8
+ Human-facing orientation for this OAT repo-reference root — the canonical
9
+ project-management and durable-reference surface for the repository.
10
+ Agent-facing rules live in the `AGENTS.md` files alongside each directory.
11
+
12
+ ## Layout
13
+
14
+ | Path | What it is | Maintained by |
15
+ | -------------------------- | -------------------------------------------------------- | ---------------------------------------------------------- |
16
+ | `pjm/current-state.md` | Present operating picture | Curated |
17
+ | `pjm/roadmap.md` | Now / Next / Later direction | Curated |
18
+ | `pjm/backlog/items/` | Active backlog items, one file each | Curated + `oat backlog` |
19
+ | `pjm/backlog/archived/` | Completed/abandoned item files | Moved here at close-out |
20
+ | `pjm/backlog/completed.md` | Newest-first completion summaries | Appended at close-out |
21
+ | `pjm/backlog/index.md` | Curated overview + generated item table | Overview curated; table via `oat backlog regenerate-index` |
22
+ | `pjm/handoffs/` | One-shot project-kickoff prompts (deleted when consumed) | Backlog walkthroughs; removed in the shipping PR |
23
+ | `reference/decisions/` | Durable decision records + generated index | `oat decision` |
24
+
25
+ ## Conventions
26
+
27
+ - **Generated vs. curated.** Generated tables live inside `<!-- OAT ... -->`
28
+ marker pairs; regenerate them with the owning `oat` command instead of
29
+ hand-editing. Everything outside those markers is curated by hand.
30
+ - **IDs.** Backlog items follow `BL-YYMMDD-slug` (`oat backlog generate-id`);
31
+ decisions follow `DR-YYMMDD-slug`. Pair every backlog item ID with its
32
+ human-readable title — no bare IDs in prose or handoffs.
33
+ - **Close-out.** When work ships that satisfies a backlog item's acceptance
34
+ criteria, the item is closed and archived in the same commit/PR — run
35
+ `oat backlog archive <id>`. See the Backlog Lifecycle in `pjm/AGENTS.md`.
@@ -0,0 +1,33 @@
1
+ import { type BacklogItemStatus } from './shared/item-status.js';
2
+ /** Result of an {@link archiveBacklogItem} run. */
3
+ export interface ArchiveBacklogItemResult {
4
+ id: string;
5
+ result: 'archived' | 'noop';
6
+ status: BacklogItemStatus | null;
7
+ completedEntry: 'written' | 'scaffolded' | 'skipped';
8
+ movedTo: string | null;
9
+ indexRegenerated: boolean;
10
+ warnings: string[];
11
+ }
12
+ export interface ArchiveBacklogItemOptions {
13
+ wontDo?: boolean;
14
+ summary?: string;
15
+ /** Injectable clock for deterministic tests; defaults to the current time. */
16
+ now?: Date;
17
+ }
18
+ /**
19
+ * Actionable close-out failure (unknown id, invalid current status). The
20
+ * command wrapper maps `exitCode` onto `process.exitCode` and logs `message`.
21
+ */
22
+ export declare class BacklogArchiveError extends Error {
23
+ readonly exitCode: 1 | 2;
24
+ constructor(message: string, exitCode?: 1 | 2);
25
+ }
26
+ /**
27
+ * Atomic backlog close-out. Validates the current status, sets the terminal
28
+ * status and `updated`, records a canonical `completed.md` entry, moves the
29
+ * item file into `archived/`, and regenerates the index. Idempotent when the
30
+ * item is already archived.
31
+ */
32
+ export declare function archiveBacklogItem(backlogRoot: string, id: string, options?: ArchiveBacklogItemOptions): Promise<ArchiveBacklogItemResult>;
33
+ //# sourceMappingURL=archive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"archive.d.ts","sourceRoot":"","sources":["../../../src/commands/backlog/archive.ts"],"names":[],"mappings":"AASA,OAAO,EAEL,KAAK,iBAAiB,EAGvB,MAAM,sBAAsB,CAAC;AAoB9B,mDAAmD;AACnD,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC;IAC5B,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACjC,cAAc,EAAE,SAAS,GAAG,YAAY,GAAG,SAAS,CAAC;IACrD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,yBAAyB;IACxC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,GAAG,CAAC,EAAE,IAAI,CAAC;CACZ;AAED;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;gBAEb,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAE,CAAC,GAAG,CAAK;CAKjD;AAkID;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,MAAM,EACnB,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,wBAAwB,CAAC,CAkHnC"}