@open-agent-toolkit/cli 0.1.19 → 0.1.21

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 (59) hide show
  1. package/README.md +2 -1
  2. package/assets/agents/oat-reviewer.md +48 -10
  3. package/assets/docs/cli-utilities/config-and-local-state.md +13 -1
  4. package/assets/docs/cli-utilities/configuration.md +24 -6
  5. package/assets/docs/docs-tooling/workflows.md +8 -2
  6. package/assets/docs/reference/cli-reference.md +13 -7
  7. package/assets/docs/reference/file-locations.md +1 -1
  8. package/assets/docs/reference/oat-directory-structure.md +3 -3
  9. package/assets/docs/workflows/projects/index.md +1 -1
  10. package/assets/docs/workflows/projects/lifecycle.md +1 -1
  11. package/assets/docs/workflows/projects/repo-analysis.md +7 -4
  12. package/assets/docs/workflows/projects/reviews.md +41 -0
  13. package/assets/public-package-versions.json +4 -4
  14. package/assets/skills/oat-agent-instructions-analyze/SKILL.md +43 -13
  15. package/assets/skills/oat-docs-analyze/SKILL.md +42 -12
  16. package/assets/skills/oat-project-complete/SKILL.md +16 -152
  17. package/assets/skills/oat-project-discover/SKILL.md +22 -4
  18. package/assets/skills/oat-project-import-plan/SKILL.md +38 -9
  19. package/assets/skills/oat-project-plan/SKILL.md +30 -7
  20. package/assets/skills/oat-project-plan-writing/SKILL.md +45 -2
  21. package/assets/skills/oat-project-progress/SKILL.md +9 -3
  22. package/assets/skills/oat-project-quick-start/SKILL.md +40 -8
  23. package/assets/skills/oat-project-review-provide/SKILL.md +24 -11
  24. package/assets/skills/oat-project-review-receive/SKILL.md +37 -17
  25. package/assets/skills/oat-wrap-up/SKILL.md +9 -9
  26. package/assets/skills/oat-wrap-up/references/automation-recipes.md +5 -5
  27. package/dist/commands/config/index.d.ts.map +1 -1
  28. package/dist/commands/config/index.js +38 -2
  29. package/dist/commands/index.d.ts.map +1 -1
  30. package/dist/commands/index.js +2 -0
  31. package/dist/commands/project/archive/archive-utils.d.ts +19 -0
  32. package/dist/commands/project/archive/archive-utils.d.ts.map +1 -1
  33. package/dist/commands/project/archive/archive-utils.js +94 -25
  34. package/dist/commands/project/archive/index.d.ts +6 -19
  35. package/dist/commands/project/archive/index.d.ts.map +1 -1
  36. package/dist/commands/project/archive/index.js +19 -251
  37. package/dist/commands/project/archive/push-runner.d.ts +21 -0
  38. package/dist/commands/project/archive/push-runner.d.ts.map +1 -0
  39. package/dist/commands/project/archive/push-runner.js +151 -0
  40. package/dist/commands/project/archive/sync-runner.d.ts +47 -0
  41. package/dist/commands/project/archive/sync-runner.d.ts.map +1 -0
  42. package/dist/commands/project/archive/sync-runner.js +232 -0
  43. package/dist/commands/repo/archive/index.d.ts +4 -0
  44. package/dist/commands/repo/archive/index.d.ts.map +1 -0
  45. package/dist/commands/repo/archive/index.js +22 -0
  46. package/dist/commands/repo/index.d.ts.map +1 -1
  47. package/dist/commands/repo/index.js +2 -0
  48. package/dist/commands/review/index.d.ts +3 -0
  49. package/dist/commands/review/index.d.ts.map +1 -0
  50. package/dist/commands/review/index.js +7 -0
  51. package/dist/commands/review/latest.d.ts +23 -0
  52. package/dist/commands/review/latest.d.ts.map +1 -0
  53. package/dist/commands/review/latest.js +182 -0
  54. package/dist/config/oat-config.d.ts +5 -0
  55. package/dist/config/oat-config.d.ts.map +1 -1
  56. package/dist/config/oat-config.js +12 -0
  57. package/dist/config/resolve.d.ts.map +1 -1
  58. package/dist/config/resolve.js +4 -0
  59. package/package.json +2 -2
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  name: oat-agent-instructions-analyze
3
- version: 1.10.0
3
+ version: 1.11.0
4
4
  description: Run when you need to evaluate agent instruction file coverage, quality, and drift. Produces a severity-rated analysis artifact. Run before oat-agent-instructions-apply to identify what needs improvement.
5
5
  disable-model-invocation: true
6
6
  user-invocable: true
7
- allowed-tools: Read, Write, Bash(git:*), Glob, Grep, AskUserQuestion
7
+ allowed-tools: Read, Write, Bash(git:*), Glob, Grep, AskUserQuestion, Task
8
8
  ---
9
9
 
10
10
  # Agent Instructions Analysis
@@ -32,6 +32,7 @@ Scan, evaluate, and report on agent instruction file coverage, quality, and drif
32
32
  - Reading all instruction files and project configuration.
33
33
  - Running helper scripts for discovery.
34
34
  - Writing analysis artifact to `.oat/repo/analysis/`.
35
+ - Reviewing and correcting the analysis artifact and companion bundle through the shared Auto Artifact-Review Loop.
35
36
  - Updating `.oat/tracking.json`.
36
37
 
37
38
  ## Analyze vs Apply Boundary
@@ -58,16 +59,17 @@ or fill in missing evidence gaps on its own.
58
59
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
59
60
 
60
61
  - Step indicators:
61
- - `[1/10] Resolving providers + mode…`
62
- - `[2/10] Discovering instruction files…`
63
- - `[3/10] Discovering documentation surfaces…`
64
- - `[4/10] Evaluating quality + validating existing rules…`
65
- - `[5/10] Assessing directory coverage gaps…`
66
- - `[6/10] Discovering file-type patterns…`
67
- - `[7/10] Checking for drift…`
68
- - `[8/10] Checking cross-format consistency…`
69
- - `[9/10] Writing analysis artifact…`
70
- - `[10/10] Updating tracking + summary…`
62
+ - `[1/11] Resolving providers + mode…`
63
+ - `[2/11] Discovering instruction files…`
64
+ - `[3/11] Discovering documentation surfaces…`
65
+ - `[4/11] Evaluating quality + validating existing rules…`
66
+ - `[5/11] Assessing directory coverage gaps…`
67
+ - `[6/11] Discovering file-type patterns…`
68
+ - `[7/11] Checking for drift…`
69
+ - `[8/11] Checking cross-format consistency…`
70
+ - `[9/11] Writing analysis artifact…`
71
+ - `[10/11] Reviewing artifact accuracy…`
72
+ - `[11/11] Updating verified tracking + summary…`
71
73
 
72
74
  ## Process
73
75
 
@@ -435,7 +437,32 @@ The markdown artifact and companion bundle together are the contract for apply.
435
437
  recommendation that requires judgment during generation
436
438
  - stable recommendation IDs and pack references for any recommendation that apply may execute
437
439
 
438
- ### Step 9: Update Tracking and Output Summary
440
+ ### Step 9: Review Analysis Artifact Accuracy
441
+
442
+ Run the shared **Auto Artifact-Review Loop** from `oat-project-plan-writing` after `$ARTIFACT_PATH` and `$BUNDLE_DIR` are written and before tracking is updated or `oat-agent-instructions-apply` is recommended.
443
+
444
+ Use the `analysis` target:
445
+
446
+ - `type: analysis`
447
+ - `scope: agent-instructions`
448
+ - `analysis_artifact: $ARTIFACT_PATH`
449
+ - `oat_output_mode: structured`
450
+
451
+ Follow the canonical loop exactly:
452
+
453
+ 1. Resolve `workflow.autoArtifactReview.analysis`; missing config means enabled, and only explicit `false` skips the loop.
454
+ 2. Resolve `oat_orchestration_retry_limit`; default to `2` if unavailable.
455
+ 3. Dispatch `oat-reviewer` in structured mode via Tier 1 subagent when available, falling back to the same reviewer prompt inline when needed.
456
+ 4. Apply Critical and Important fixes when they are local to the analysis artifact, companion bundle, and unambiguous.
457
+ 5. Offer Medium and Minor fixes rather than applying them silently.
458
+ 6. Rewrite `$ARTIFACT_PATH` and any affected bundle files after applied fixes, then re-dispatch while retries remain.
459
+ 7. Stop when the reviewer is clean or the retry bound is exhausted.
460
+
461
+ The review loop may only edit the markdown analysis artifact and its companion bundle. It must not modify or create instruction files, provider rules, repo configuration, or any other downstream apply target. If a finding cannot be fixed inside the analysis artifact or bundle, preserve it as a residual review finding and surface it in the summary before handoff.
462
+
463
+ If the loop is disabled, note `Auto artifact review: skipped (workflow.autoArtifactReview.analysis=false)` in the summary and do not describe the artifact as verified.
464
+
465
+ ### Step 10: Update Verified Tracking and Output Summary
439
466
 
440
467
  **Update tracking:**
441
468
 
@@ -454,6 +481,8 @@ bash "$TRACKING_SCRIPT" write \
454
481
  {providers...}
455
482
  ```
456
483
 
484
+ Only run this tracking write after Step 9 finishes. A tracked agent-instructions analysis artifact is therefore reviewed/verified unless the summary explicitly says the auto artifact-review loop was skipped.
485
+
457
486
  **Output summary to the user:**
458
487
 
459
488
  ```
@@ -472,6 +501,7 @@ Analysis complete.
472
501
 
473
502
  Artifact: {artifact_path}
474
503
  Bundle: {bundle_dir}
504
+ Auto artifact review: {passed|passed with residual findings|skipped}
475
505
 
476
506
  Next step: Run oat-agent-instructions-apply to act on these findings.
477
507
  ```
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  name: oat-docs-analyze
3
- version: 1.2.0
3
+ version: 1.3.0
4
4
  description: Run when you need to evaluate documentation structure, navigation, and coverage against the OAT docs app contract. Produces a severity-rated analysis artifact for oat-docs-apply.
5
5
  disable-model-invocation: true
6
6
  user-invocable: true
7
- allowed-tools: Read, Write, Bash(git:*), Glob, Grep, AskUserQuestion
7
+ allowed-tools: Read, Write, Bash(git:*), Glob, Grep, AskUserQuestion, Task
8
8
  ---
9
9
 
10
10
  # Docs Analysis
@@ -32,6 +32,7 @@ Scan a repository's documentation surface, evaluate it against the OAT docs cont
32
32
 
33
33
  - Reading docs trees, MkDocs config, and related repository metadata.
34
34
  - Writing a docs analysis artifact to `.oat/repo/analysis/`.
35
+ - Reviewing and correcting the docs analysis artifact itself through the shared Auto Artifact-Review Loop.
35
36
  - Updating docs analysis tracking metadata.
36
37
 
37
38
  ## Analyze vs Apply Boundary
@@ -66,15 +67,16 @@ When executing this skill, provide lightweight progress feedback so the user can
66
67
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
67
68
 
68
69
  - Use step indicators:
69
- - `[1/9] Resolving docs target + mode…`
70
- - `[2/9] Inventorying docs files…`
71
- - `[3/9] Evaluating index contract…`
72
- - `[4/9] Assessing quality + coverage…`
73
- - `[5/9] Verifying substantive claims…`
74
- - `[6/9] Finding content opportunities…`
75
- - `[7/9] Checking nav and drift…`
76
- - `[8/9] Writing analysis artifact…`
77
- - `[9/9] Updating tracking + summary…`
70
+ - `[1/10] Resolving docs target + mode…`
71
+ - `[2/10] Inventorying docs files…`
72
+ - `[3/10] Evaluating index contract…`
73
+ - `[4/10] Assessing quality + coverage…`
74
+ - `[5/10] Verifying substantive claims…`
75
+ - `[6/10] Finding content opportunities…`
76
+ - `[7/10] Checking nav and drift…`
77
+ - `[8/10] Writing analysis artifact…`
78
+ - `[9/10] Reviewing artifact accuracy…`
79
+ - `[10/10] Updating verified tracking + summary…`
78
80
 
79
81
  ## Process
80
82
 
@@ -302,7 +304,32 @@ Populate the artifact with:
302
304
  - Progressive disclosure decisions (`inline`, `link_only`, `omit`, `ask_user`)
303
305
  - Canonical link targets when deeper detail should stay out of always-on docs pages
304
306
 
305
- ### Step 9: Update Tracking and Output Summary
307
+ ### Step 9: Review Analysis Artifact Accuracy
308
+
309
+ Run the shared **Auto Artifact-Review Loop** from `oat-project-plan-writing` after `$ARTIFACT_PATH` is written and before tracking is updated or `oat-docs-apply` is recommended.
310
+
311
+ Use the `analysis` target:
312
+
313
+ - `type: analysis`
314
+ - `scope: docs`
315
+ - `analysis_artifact: $ARTIFACT_PATH`
316
+ - `oat_output_mode: structured`
317
+
318
+ Follow the canonical loop exactly:
319
+
320
+ 1. Resolve `workflow.autoArtifactReview.analysis`; missing config means enabled, and only explicit `false` skips the loop.
321
+ 2. Resolve `oat_orchestration_retry_limit`; default to `2` if unavailable.
322
+ 3. Dispatch `oat-reviewer` in structured mode via Tier 1 subagent when available, falling back to the same reviewer prompt inline when needed.
323
+ 4. Apply Critical and Important fixes when they are local to the analysis artifact and unambiguous.
324
+ 5. Offer Medium and Minor fixes rather than applying them silently.
325
+ 6. Rewrite `$ARTIFACT_PATH` after applied fixes and re-dispatch while retries remain.
326
+ 7. Stop when the reviewer is clean or the retry bound is exhausted.
327
+
328
+ The review loop may only edit the analysis artifact. It must not edit docs content, `mkdocs.yml`, navigation files, or any other downstream apply target. If a finding cannot be fixed inside the analysis artifact, preserve it as a residual review finding and surface it in the summary before handoff.
329
+
330
+ If the loop is disabled, note `Auto artifact review: skipped (workflow.autoArtifactReview.analysis=false)` in the summary and do not describe the artifact as verified.
331
+
332
+ ### Step 10: Update Verified Tracking and Output Summary
306
333
 
307
334
  Update docs tracking using the shared helper:
308
335
 
@@ -320,6 +347,8 @@ bash "$TRACKING_SCRIPT" write \
320
347
  --artifact-path "$ARTIFACT_PATH"
321
348
  ```
322
349
 
350
+ Only run this tracking write after Step 9 finishes. A tracked docs analysis artifact is therefore reviewed/verified unless the summary explicitly says the auto artifact-review loop was skipped.
351
+
323
352
  Output a summary:
324
353
 
325
354
  ```text
@@ -337,6 +366,7 @@ Analysis complete.
337
366
  Low: {N}
338
367
 
339
368
  Artifact: {artifact_path}
369
+ Auto artifact review: {passed|passed with residual findings|skipped}
340
370
 
341
371
  Next step: Run oat-docs-apply to act on these findings.
342
372
  ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: oat-project-complete
3
- version: 1.4.8
3
+ version: 1.4.9
4
4
  description: Use when all implementation work is finished and the project is ready to close. Marks the OAT project lifecycle as complete.
5
5
  disable-model-invocation: true
6
6
  user-invocable: true
@@ -340,166 +340,30 @@ Anti-pattern: do not "rescue" a dropped artifact by linking to its archived path
340
340
 
341
341
  Archive happens after PR description generation (so artifacts are readable at tracked paths) but before commit+push (so the archive deletion is included in the commit).
342
342
 
343
- The archive-side effects in this step are CLI-owned. Follow the canonical behavior from `packages/cli/src/commands/project/archive/archive-utils.ts` rather than inventing separate S3 or summary-export logic inside the skill.
344
-
345
- **Anti-pattern (do NOT do this):** Running `git check-ignore` on the
346
- `.oat/projects/archived` directory itself to decide durability. A common
347
- gitignore shape for this repo is `.oat/projects/archived/**`, which leaves the
348
- directory visible in the tree while ignoring every file placed inside. A
349
- directory-level check reports "not ignored" and produces the inverse of the
350
- intended decision — archiving in the worktree when the archive must actually
351
- go to the primary repo. Always probe a representative path **inside** the
352
- archive directory (the project subpath or a probe filename), matching the CLI
353
- helper at `packages/cli/src/commands/project/archive/archive-utils.ts`.
343
+ The archive-side effects in this step are CLI-owned. Do not reimplement local archive movement, summary export, S3 sync, AWS credential handling, or worktree durability checks in the skill.
354
344
 
355
345
  ```bash
356
- ARCHIVED_ROOT=".oat/projects/archived"
357
- # ARCHIVE_RELATIVE_PATH is the contents-level probe: a hypothetical file that
358
- # would live inside the archive directory. This is the same probe shape the
359
- # CLI helper uses do not simplify this to the directory itself.
360
- ARCHIVE_RELATIVE_PATH=".oat/projects/archived/${PROJECT_NAME}"
361
- PRIMARY_REPO_ARCHIVE=""
362
- ARCHIVE_CONTENTS_TRACKED="true"
363
- USE_PRIMARY_REPO_ARCHIVE="false"
364
-
365
- # Will a newly-archived file at ${ARCHIVE_RELATIVE_PATH} actually be tracked in
366
- # this checkout? Probe a representative path INSIDE the directory, not the
367
- # directory itself. A `.oat/projects/archived/**` gitignore pattern leaves the
368
- # directory visible in the tree but ignores everything placed inside, so a
369
- # directory-level check reports "tracked" and gives the inverse of the
370
- # intended answer.
371
- if git check-ignore --quiet --no-index "$ARCHIVE_RELATIVE_PATH" 2>/dev/null; then
372
- ARCHIVE_CONTENTS_TRACKED="false"
373
- fi
374
-
375
- # Fall back to the primary checkout whenever archive contents are local-only
376
- # in the current worktree, regardless of whether the archive directory itself
377
- # happens to exist in the tree.
378
- if [[ "$ARCHIVE_CONTENTS_TRACKED" == "false" ]] && git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
379
- GIT_COMMON_DIR=$(git rev-parse --git-common-dir 2>/dev/null || true)
380
- GIT_DIR=$(git rev-parse --git-dir 2>/dev/null || true)
381
- if [[ -n "$GIT_COMMON_DIR" && -n "$GIT_DIR" && "$GIT_COMMON_DIR" != "$GIT_DIR" ]]; then
382
- PRIMARY_REPO_ROOT=$(cd "$(dirname "$GIT_COMMON_DIR")" && pwd)
383
- PRIMARY_REPO_ARCHIVE="${PRIMARY_REPO_ROOT}/.oat/projects/archived"
384
- if [[ -d "$(dirname "$PRIMARY_REPO_ARCHIVE")" ]]; then
385
- USE_PRIMARY_REPO_ARCHIVE="true"
386
- ARCHIVED_ROOT="$PRIMARY_REPO_ARCHIVE"
387
- else
388
- echo "Warning: Running in a worktree with a local-only archive path, but the primary repo archive path is unavailable: $PRIMARY_REPO_ARCHIVE"
389
- echo "A worktree-local archive may be deleted when the worktree is removed and is not a durable archive."
390
- echo "Require explicit confirmation before proceeding with local-only archive."
391
- fi
392
- fi
393
- fi
394
-
395
- if [[ "$USE_PRIMARY_REPO_ARCHIVE" != "true" ]]; then
396
- ARCHIVED_ROOT=".oat/projects/archived"
346
+ ARCHIVE_OUTPUT=""
347
+ if ! ARCHIVE_OUTPUT=$(oat project archive "$PROJECT_PATH" 2>&1); then
348
+ printf '%s\n' "$ARCHIVE_OUTPUT" >&2
349
+ echo "Error: Project archive failed." >&2
350
+ exit 1
397
351
  fi
398
352
 
399
- mkdir -p "$ARCHIVED_ROOT"
400
- ARCHIVE_PATH="${ARCHIVED_ROOT}/${PROJECT_NAME}"
353
+ printf '%s\n' "$ARCHIVE_OUTPUT"
401
354
 
402
- if [[ -e "$ARCHIVE_PATH" ]]; then
403
- ARCHIVE_PATH="${ARCHIVED_ROOT}/${PROJECT_NAME}-$(date +%Y%m%d-%H%M%S)"
355
+ ARCHIVE_PATH=$(printf '%s\n' "$ARCHIVE_OUTPUT" | sed -nE 's/^Archived project `[^`]+` to `(.+)`\.$/\1/p' | tail -1)
356
+ if [[ -z "$ARCHIVE_PATH" ]]; then
357
+ echo "Error: oat project archive did not report the archived path." >&2
358
+ exit 1
404
359
  fi
405
360
 
406
- mv "$PROJECT_PATH" "$ARCHIVE_PATH"
407
361
  PROJECT_PATH="$ARCHIVE_PATH"
408
- echo "Project archived to $ARCHIVE_PATH"
362
+ ARCHIVE_S3_PATH=$(printf '%s\n' "$ARCHIVE_OUTPUT" | sed -nE 's/^S3 archive: (.+)$/\1/p' | tail -1)
363
+ ARCHIVE_S3_CONTEXT=$(printf '%s\n' "$ARCHIVE_OUTPUT" | grep -E '^Archive S3 sync: .*profile=.*region=' | tail -1 || true)
409
364
  ```
410
365
 
411
- **Canonical helper behaviors (required):**
412
-
413
- - Always archive locally first. The local archive is the authoritative completion artifact even when remote sync is also configured.
414
- - If `archive.summaryExportPath` is configured and `summary.md` exists after archive, copy it to `{repoRoot}/{archive.summaryExportPath}/YYYYMMDD-{PROJECT_NAME}.md`.
415
- - If `archive.s3SyncOnComplete=true` and `archive.s3Uri` is configured, sync the archived project to `{archive.s3Uri}/{repo-slug}/projects/YYYYMMDD-{PROJECT_NAME}/`. The S3 sync excludes process artifacts (`reviews/*`, `pr/*`) — only core deliverables (discovery, spec, design, plan, implementation, summary, state) are uploaded. The CLI enforces this via `S3_ARCHIVE_SYNC_EXCLUDES` in `archive-utils.ts`.
416
- - If AWS CLI is missing or unusable for that S3 sync, warn and continue. Completion must not fail after the local archive succeeds.
417
- - If `archive.s3SyncOnComplete` is false or `archive.s3Uri` is unset, skip remote sync without prompting.
418
-
419
- **AWS credential handling for archive S3 sync (required):**
420
-
421
- When `archive.s3SyncOnComplete=true` and `archive.s3Uri` is set, the agent MUST honor the repo's archive-scoped AWS credentials instead of falling back to whatever shell profile/region happens to be active. The contract mirrors `buildAwsEnv` in `packages/cli/src/commands/project/archive/archive-utils.ts`.
422
-
423
- - **Read both keys from OAT config before any AWS CLI call:**
424
-
425
- ```bash
426
- ARCHIVE_AWS_PROFILE=$(oat config get archive.awsProfile 2>/dev/null || true)
427
- ARCHIVE_AWS_REGION=$(oat config get archive.awsRegion 2>/dev/null || true)
428
- ```
429
-
430
- - **Apply them to every `aws` invocation tied to archive sync** — preflight checks (`aws --version`, `aws sts get-caller-identity`), bucket access probes (`aws s3 ls`), and the actual `aws s3 sync`. Do not mix configured values across some calls and ambient values across others.
431
- - **Configured archive values WIN over ambient shell AWS env vars.** A non-empty `archive.awsProfile` overrides any `AWS_PROFILE` or `AWS_DEFAULT_PROFILE` already exported in the shell. A non-empty `archive.awsRegion` overrides `AWS_REGION` and `AWS_DEFAULT_REGION`. Treat the repo's archive-scoped declaration as deliberate intent — users should not have to unset shell env vars to get correct archive credentials. Empty/unset config values fall through to the AWS CLI's normal resolution chain.
432
- - **Prefer the OAT CLI when it is available.** If you delegate archive sync to an `oat project archive ...` invocation, the CLI applies the canonical handling for you (config-resolved profile/region clobber the spawned env). Do not pass `--profile` / `--region` flags unless the user asked for a one-off override different from the repo config.
433
- - **Manual AWS CLI fallback** — when no OAT command wraps the operation and the agent must call `aws` directly, pass the configured profile/region explicitly. Either use flags:
434
-
435
- ```bash
436
- AWS_FLAGS=()
437
- if [[ -n "$ARCHIVE_AWS_PROFILE" ]]; then
438
- AWS_FLAGS+=(--profile "$ARCHIVE_AWS_PROFILE")
439
- fi
440
- if [[ -n "$ARCHIVE_AWS_REGION" ]]; then
441
- AWS_FLAGS+=(--region "$ARCHIVE_AWS_REGION")
442
- fi
443
-
444
- aws "${AWS_FLAGS[@]}" sts get-caller-identity
445
- aws "${AWS_FLAGS[@]}" s3 sync \
446
- "$ARCHIVE_PATH" \
447
- "${ARCHIVE_S3_URI%/}/${REPO_SLUG}/projects/${SNAPSHOT_NAME}/" \
448
- --exclude 'reviews/*' --exclude 'pr/*'
449
- ```
450
-
451
- …or set the equivalent env vars for the spawned process so the same precedence applies:
452
-
453
- ```bash
454
- AWS_ENV=()
455
- [[ -n "$ARCHIVE_AWS_PROFILE" ]] && AWS_ENV+=("AWS_PROFILE=$ARCHIVE_AWS_PROFILE")
456
- [[ -n "$ARCHIVE_AWS_REGION" ]] && AWS_ENV+=("AWS_REGION=$ARCHIVE_AWS_REGION")
457
- env "${AWS_ENV[@]}" aws s3 sync ...
458
- ```
459
-
460
- Both shapes are acceptable; the AWS CLI treats `--profile` / `--region` and `AWS_PROFILE` / `AWS_REGION` env as higher precedence than `AWS_DEFAULT_*`, so the configured values win.
461
-
462
- - **Report the resolved profile/region in the completion summary** so the user can confirm the right identity ran the sync, e.g. `Archive S3 sync used AWS profile=tkstang-artifact-sync region=us-east-1`. Do not echo raw access keys, session tokens, or any value from `AWS_SECRET_ACCESS_KEY` / `AWS_SESSION_TOKEN`. If `archive.awsProfile` or `archive.awsRegion` is unset, report `<unset; using shell default>` for that field.
463
- - **AccessDenied troubleshooting** — if `aws s3 sync` returns AccessDenied, confirm before retrying that the spawn actually used `archive.awsProfile` (not the ambient shell profile). A common pitfall is invoking `aws s3 sync` without flags from a shell where `AWS_PROFILE` points at an unrelated identity; rerun with the configured profile/region applied as above.
464
-
465
- **Worktree durability guard (required):**
466
-
467
- - If running in a worktree and the primary repo archive path is unavailable, do not silently continue with a local-only archive.
468
- - Ask the user explicitly: "Primary repo archive path is unavailable, so this archive may be lost when the worktree is deleted. Continue with local-only archive anyway?"
469
- - If the user declines, skip archiving and continue the completion flow without archive.
470
- - Resolve the durable repo root from `git rev-parse --git-common-dir` and `git rev-parse --git-dir`, matching the CLI helper in `packages/cli/src/commands/project/archive/archive-utils.ts`. Do not rely on a `main` checkout or default-branch naming.
471
- - Apply this guard only when `git check-ignore --quiet --no-index "$ARCHIVE_RELATIVE_PATH"` reports that the archive **contents** are local-only in the current checkout. `$ARCHIVE_RELATIVE_PATH` must be a path **inside** the archive directory (the project subpath), never the directory itself — see the anti-pattern note above the bash block.
472
-
473
- **Git handling after archive:**
474
-
475
- If the archived directory is gitignored (check with `git check-ignore -q "$ARCHIVE_PATH"`), the move looks like a deletion to git — the original tracked files disappear and the archived copy is local-only. To commit:
476
-
477
- ```bash
478
- git add -A "$PROJECTS_ROOT/$PROJECT_NAME" 2>/dev/null || true
479
- ```
480
-
481
- This stages the deletions from the shared directory. The archived copy is preserved locally but not tracked by git.
482
-
483
- **Worktree archive target (required when available):**
484
-
485
- If running from a git worktree, prefer the primary repo archive directory whenever a newly-archived file inside `.oat/projects/archived/` would be local-only in the current checkout.
486
-
487
- Reference path:
488
-
489
- ```bash
490
- GIT_COMMON_DIR=$(git rev-parse --git-common-dir)
491
- PRIMARY_REPO_ROOT=$(cd "$(dirname "$GIT_COMMON_DIR")" && pwd)
492
- PRIMARY_REPO_ARCHIVE="${PRIMARY_REPO_ROOT}/.oat/projects/archived"
493
- ```
494
-
495
- Guidance:
496
-
497
- - In a worktree, prefer `PRIMARY_REPO_ARCHIVE` whenever `git check-ignore --quiet --no-index "$ARCHIVE_RELATIVE_PATH"` reports the archive **contents** as ignored — regardless of whether the archive directory itself happens to exist in the tree. Only archive in the current checkout when a hypothetical file at `.oat/projects/archived/<project>/state.md` would actually be tracked here.
498
- - Do not check `git check-ignore` on `.oat/projects/archived` (the directory itself). A `.oat/projects/archived/**` ignore pattern leaves the directory unignored while ignoring all contents, so a directory-level check reports "tracked" and an agent can mistakenly archive in the worktree.
499
- - Do not treat the worktree-local archive as durable.
500
- - If forced to use a local-only archive, warn and require explicit user confirmation.
501
- - Always write the dated `archive.summaryExportPath` copy into the current checkout (`repoRoot`), even when the project archive itself is written to the primary checkout.
502
- - Do not hardcode user-specific absolute paths.
366
+ Use `ARCHIVE_S3_CONTEXT` in Step 12 if the command reports profile/region details. If S3 sync ran and only `ARCHIVE_S3_PATH` is available, report the destination and note that credential context was not emitted by the command.
503
367
 
504
368
  ### Step 9: Regenerate Dashboard
505
369
 
@@ -607,7 +471,7 @@ Show user:
607
471
 
608
472
  - "Project **{PROJECT_NAME}** marked as complete."
609
473
  - If archived: "Archived location: **{PROJECT_PATH}**"
610
- - If S3 archive sync ran: include the resolved AWS profile and region used (e.g. `Archive S3 sync: profile=<archive.awsProfile> region=<archive.awsRegion>`). Show `<unset; using shell default>` for any field the config did not provide. Never echo raw credentials (`AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN`, etc.).
474
+ - If S3 archive sync ran: include `ARCHIVE_S3_CONTEXT` when the archive command reported profile/region details. If only `ARCHIVE_S3_PATH` is available, include the S3 destination and note that profile/region context was not reported by the command. Never echo raw credentials (`AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN`, etc.).
611
475
  - Include commit hash and push result for the bookkeeping changes.
612
476
  - If PR was opened: include the PR URL.
613
477
  - If `oat_pr_url` is present, show it in the completion summary even when PR creation was skipped because the project already tracked an open PR.
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: oat-project-discover
3
- version: 2.0.2
4
- description: Use when starting a project or when requirements are still unclear. Runs structured discovery to gather requirements, constraints, and context.
5
- disable-model-invocation: true
3
+ version: 2.0.3
4
+ description: Use when the user explicitly asks to continue discovery for an active spec-driven OAT project — e.g. "continue discovery", "run discovery", or confirms a previously offered discovery step. Do NOT auto-invoke for new ideas or quick-mode projects. Gathers requirements and context before spec/design.
5
+ disable-model-invocation: false
6
6
  user-invocable: true
7
7
  allowed-tools: Read, Write, Bash(git:*), Bash(oat:*), Bash(pnpm:*), Glob, Grep, AskUserQuestion
8
8
  ---
@@ -15,6 +15,20 @@ Gather requirements and understand the problem space through natural collaborati
15
15
 
16
16
  **Required:** Knowledge base must exist. If missing, run the `oat-repo-knowledge-index` skill first.
17
17
 
18
+ **Required for model invocation:** An active spec-driven OAT project must already exist. If no active project exists, route to `oat-project-new` for spec-driven setup or `oat-project-quick-start` for quick workflow. If the active project is quick or import mode, decline this skill and route to the current mode's next step instead.
19
+
20
+ ## Model Invocation Gate
21
+
22
+ This skill is model-invokable only for explicit discovery-continuation asks on an active spec-driven project. Do NOT auto-invoke when the user mentions a new idea, asks for a quick workflow, or has an active quick/import project.
23
+
24
+ Before acting:
25
+
26
+ 1. Resolve `activeProject`.
27
+ 2. Confirm `{PROJECT_PATH}/state.md` exists.
28
+ 3. Confirm `oat_workflow_mode` is `spec-driven` or absent only in a legacy spec-driven project.
29
+
30
+ If any check fails, decline this skill. Offer `oat-project-new` for a new spec-driven project, `oat-project-quick-start` for a quick project, or `oat-project-open` for switching to an existing project. When the gate passes, summarize the active project and ask before continuing discovery.
31
+
18
32
  ## Mode Assertion
19
33
 
20
34
  **OAT MODE: Discovery**
@@ -68,7 +82,7 @@ If you catch yourself:
68
82
 
69
83
  ## Process
70
84
 
71
- ### Step 1: Resolve Active Project (or Create a New One)
85
+ ### Step 1: Resolve Active Spec-Driven Project
72
86
 
73
87
  OAT stores active project context in `.oat/config.local.json` (`activeProject`, local-only).
74
88
 
@@ -84,6 +98,10 @@ PROJECTS_ROOT="${PROJECTS_ROOT%/}"
84
98
 
85
99
  - Derive `project-name` from the directory name (basename of the path)
86
100
  - Read `{PROJECT_PATH}/state.md` (if it exists) and show current status
101
+ - Read `oat_workflow_mode` from `{PROJECT_PATH}/state.md`
102
+ - If `oat_workflow_mode` is present and not `spec-driven`, stop and route:
103
+ - quick project: continue with `oat-project-quick-start` / `oat-project-progress`
104
+ - import project: continue with `oat-project-import-plan` / `oat-project-progress`
87
105
  - Ask user:
88
106
  - **Continue** with active project, or
89
107
  - **Switch projects**:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: oat-project-import-plan
3
- version: 1.3.2
3
+ version: 1.3.3
4
4
  description: Use when you have an external markdown plan to execute with OAT. Preserves the source plan and normalizes it into canonical plan.md format.
5
5
  argument-hint: '<path-to-plan.md> [--provider codex|cursor|claude] [--project <name>]'
6
6
  disable-model-invocation: true
@@ -56,13 +56,14 @@ When executing this skill, provide lightweight progress feedback so the user can
56
56
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
57
57
 
58
58
  - Before multi-step work, print step indicators, e.g.:
59
- - `[0/6] Checking inherited git state...`
60
- - `[1/6] Resolving project + source plan…`
61
- - `[2/6] Preserving imported source…`
62
- - `[3/6] Normalizing plan to OAT task structure…`
63
- - `[4/6] Updating project metadata + state…`
64
- - `[5/6] Refreshing dashboard…`
65
- - `[6/6] Ensuring implementation tracker…`
59
+ - `[0/7] Checking inherited git state...`
60
+ - `[1/7] Resolving project + source plan…`
61
+ - `[2/7] Preserving imported source…`
62
+ - `[3/7] Normalizing plan to OAT task structure…`
63
+ - `[4/7] Updating plan metadata…`
64
+ - `[5/7] Running import-aware plan review…`
65
+ - `[6/7] Updating project state + dashboard…`
66
+ - `[7/7] Ensuring implementation tracker…`
66
67
 
67
68
  ## Process
68
69
 
@@ -180,7 +181,7 @@ Dispatch Profile import handling:
180
181
  Set frontmatter in `"$PROJECT_PATH/plan.md"`:
181
182
 
182
183
  - `oat_status: complete`
183
- - `oat_ready_for: oat-project-implement`
184
+ - `oat_ready_for: null` (Step 4.5 sets this after the import-aware plan review)
184
185
  - `oat_phase: plan`
185
186
  - `oat_phase_status: complete`
186
187
  - `oat_plan_source: imported`
@@ -188,6 +189,33 @@ Set frontmatter in `"$PROJECT_PATH/plan.md"`:
188
189
  - `oat_import_source_path: {source-path}`
189
190
  - `oat_import_provider: {codex|cursor|claude|null}`
190
191
 
192
+ ### Step 4.5: Run Import-Aware Plan Artifact Review Loop
193
+
194
+ Invoke the shared `Auto Artifact-Review Loop` from `oat-project-plan-writing` with target `plan` before advancing project state or handing off to implementation.
195
+
196
+ Required payload:
197
+
198
+ - `target: plan`
199
+ - `type: artifact`
200
+ - `scope: plan`
201
+ - `artifact_path: "$PROJECT_PATH/plan.md"`
202
+ - `oat_output_mode: structured`
203
+ - `import_aware: true`
204
+ - `review_note: "Review for canonical OAT plan conformance, executable completeness, stable task IDs, required sections, review-row preservation, and verification clarity. Preserve the imported source's intent and ordering; do not rewrite the author's plan goals or product decisions unless required for OAT conformance or completeness."`
205
+
206
+ Apply the shared loop exactly:
207
+
208
+ - Resolve `workflow.autoArtifactReview.plan`; only an explicit `false` skips the loop.
209
+ - Resolve `oat_orchestration_retry_limit` from project state, defaulting to `2`.
210
+ - Dispatch `oat-reviewer` in structured mode using Tier 1 subagent when available and Tier 2 inline fallback otherwise.
211
+ - Apply Critical and Important artifact-local fixes when unambiguous and limited to canonical conformance/completeness; offer Medium and Minor fixes instead of silently applying them.
212
+ - Re-dispatch after rewrites until clean or the retry bound is exhausted.
213
+ - Update the `plan` artifact row in the `## Reviews` table to `passed` when clean. If residual findings remain, preserve the row and surface the residual findings before downstream handoff.
214
+
215
+ After the loop completes or is explicitly skipped, set `"$PROJECT_PATH/plan.md"` frontmatter:
216
+
217
+ - `oat_ready_for: oat-project-implement`
218
+
191
219
  ### Step 5: Update Project State
192
220
 
193
221
  Set `"$PROJECT_PATH/state.md"` frontmatter:
@@ -245,6 +273,7 @@ Report:
245
273
  - ✅ Imported markdown preserved at `references/imported-plan.md`.
246
274
  - ✅ Canonical `plan.md` generated with OAT task structure.
247
275
  - ✅ `plan.md` metadata marks `oat_plan_source: imported`.
276
+ - ✅ `plan.md` records the import-aware plan artifact review row unless `workflow.autoArtifactReview.plan` was explicitly disabled.
248
277
  - ✅ `state.md` marks `oat_workflow_mode: import`.
249
278
  - ✅ `implementation.md` is present and resumable.
250
279
  - ✅ `oat_plan_hill_phases` left unset in frontmatter (deferred to `oat-project-implement` Step 2.5).
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: oat-project-plan
3
- version: 1.3.4
3
+ version: 1.3.5
4
4
  description: Use when design.md is complete and executable implementation tasks are needed. Breaks design into bite-sized TDD tasks in canonical plan.md format.
5
5
  disable-model-invocation: true
6
6
  user-invocable: true
@@ -41,11 +41,12 @@ When executing this skill, provide lightweight progress feedback so the user can
41
41
  OAT ▸ PLAN
42
42
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
43
43
 
44
- - Before multi-step work (drafting/finalizing/committing), print 2–5 short step indicators, e.g.:
45
- - `[1/4] Reading design + context…`
46
- - `[2/4] Drafting phases + tasks…`
47
- - `[3/4] Finalizing plan + rollups…`
48
- - `[4/4] Updating state + committing…`
44
+ - Before multi-step work (drafting/finalizing/reviewing/committing), print 2–5 short step indicators, e.g.:
45
+ - `[1/5] Reading design + context…`
46
+ - `[2/5] Drafting phases + tasks…`
47
+ - `[3/5] Finalizing plan + rollups…`
48
+ - `[4/5] Running plan artifact review…`
49
+ - `[5/5] Updating state + committing…`
49
50
  - For any operation that may take noticeable time (e.g., reading large artifacts), print a start line and a completion line (duration optional).
50
51
  - Keep it concise; don’t print a line for every shell command.
51
52
 
@@ -293,7 +294,7 @@ This creates traceability: Requirement → Tasks → Implementation
293
294
  ### Step 10.1: Keep Reviews Table Rows
294
295
 
295
296
  Follow the review table preservation rules from `oat-project-plan-writing`:
296
- - Include both **code** rows (p01/p02/…/final) and **artifact** rows (`spec`, `design`)
297
+ - Include both **code** rows (p01/p02/…/final) and **artifact** rows (`spec`, `design`, `plan`)
297
298
  - Add additional rows as needed (e.g., p03), but never delete existing rows
298
299
 
299
300
  **Why stable IDs:** Using `p01-t03` instead of "Task 3" prevents broken references when tasks are inserted or reordered.
@@ -381,12 +382,34 @@ Ask: "Does this breakdown make sense? Any tasks missing?"
381
382
 
382
383
  Iterate until user confirms.
383
384
 
385
+ ### Step 12.5: Run Plan Artifact Review Loop
386
+
387
+ Invoke the shared `Auto Artifact-Review Loop` from `oat-project-plan-writing` with target `plan` before setting `plan.md` to implementation-ready.
388
+
389
+ Required payload:
390
+
391
+ - `target: plan`
392
+ - `type: artifact`
393
+ - `scope: plan`
394
+ - `artifact_path: "$PROJECT_PATH/plan.md"`
395
+ - `oat_output_mode: structured`
396
+
397
+ Apply the shared loop exactly:
398
+
399
+ - Resolve `workflow.autoArtifactReview.plan`; only an explicit `false` skips the loop.
400
+ - Resolve `oat_orchestration_retry_limit` from project state, defaulting to `2`.
401
+ - Dispatch `oat-reviewer` in structured mode using Tier 1 subagent when available and Tier 2 inline fallback otherwise.
402
+ - Apply Critical and Important artifact-local fixes when unambiguous; offer Medium and Minor fixes instead of silently applying them.
403
+ - Re-dispatch after rewrites until clean or the retry bound is exhausted.
404
+ - Update the `plan` artifact row in the `## Reviews` table to `passed` when clean. If residual findings remain, preserve the row and surface the residual findings before downstream handoff.
405
+
384
406
  ### Step 13: Mark Plan Complete
385
407
 
386
408
  Before setting `oat_status: complete`, verify:
387
409
  - `## Planning Checklist` exists
388
410
  - the checklist records that checkpoint confirmation is deferred to implementation
389
411
  - if `oat_plan_hill_phases` is already present, it is intentionally preserved and valid
412
+ - the `plan` artifact review row has been recorded by Step 12.5, unless `workflow.autoArtifactReview.plan` was explicitly disabled
390
413
 
391
414
  Update frontmatter:
392
415
  ```yaml