@yandy-r/ycc-opencode 6.1.1 → 6.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/README.md +7 -3
  2. package/agents/code-researcher.md +3 -3
  3. package/agents/feature-researcher.md +1 -1
  4. package/agents/implementor.md +4 -4
  5. package/agents/pr-comment-fixer.md +1 -1
  6. package/agents/release-fix-applier.md +1 -1
  7. package/agents/review-fixer.md +1 -1
  8. package/index.js +146 -95
  9. package/package.json +1 -1
  10. package/registration.json +0 -4
  11. package/shared/references/artifact-store.md +613 -0
  12. package/shared/references/branch-prep.md +2 -0
  13. package/shared/references/forge-detection.md +3 -2
  14. package/shared/references/review-artifact-format.md +13 -6
  15. package/shared/references/review-checklist.md +3 -2
  16. package/shared/references/review-dispatch.md +15 -10
  17. package/shared/references/target-capability-matrix.md +140 -32
  18. package/shared/references/visual-mode.md +19 -13
  19. package/shared/references/worktree-strategy.md +12 -8
  20. package/shared/scripts/artifact-body.sh +71 -0
  21. package/shared/scripts/artifact-store-pointer.sh +245 -0
  22. package/shared/scripts/ci-monitor.sh +9 -4
  23. package/shared/scripts/collect-linear-keys.sh +77 -0
  24. package/shared/scripts/lib/ci-classify.sh +13 -10
  25. package/shared/scripts/lib/forge.sh +13 -4
  26. package/shared/scripts/prepare-feature-branch.sh +118 -10
  27. package/shared/scripts/release-ci-monitor.sh +2 -2
  28. package/shared/scripts/report-bundle-drift.sh +1 -1
  29. package/shared/scripts/resolve-artifact-store.sh +636 -0
  30. package/shared/scripts/validate-file-paths.sh +11 -4
  31. package/skills/blueprint/SKILL.md +48 -13
  32. package/skills/bundle-release/scripts/draft-notes.sh +1 -1
  33. package/skills/bundle-release/scripts/release_versions.py +9 -1
  34. package/skills/clean/SKILL.md +1 -1
  35. package/skills/clean/scripts/detect-project-type.sh +2 -2
  36. package/skills/clean/scripts/generate-report.sh +34 -5
  37. package/skills/clean/scripts/validate-safety.sh +9 -6
  38. package/skills/code-report/SKILL.md +26 -14
  39. package/skills/code-report/scripts/check-prerequisites.sh +72 -12
  40. package/skills/code-report/templates/report-structure.md +1 -1
  41. package/skills/code-review/SKILL.md +68 -17
  42. package/skills/code-review/references/pr-procedure.md +28 -15
  43. package/skills/compatibility-audit/SKILL.md +10 -5
  44. package/skills/compatibility-audit/references/reading-the-report.md +4 -1
  45. package/skills/compatibility-audit/scripts/audit-install-assumptions.sh +64 -7
  46. package/skills/compatibility-audit/scripts/audit-target-features.sh +13 -10
  47. package/skills/deep-research/SKILL.md +28 -5
  48. package/skills/deep-research/references/completion-summary-template.md +3 -2
  49. package/skills/deep-research/scripts/validate-research.sh +8 -2
  50. package/skills/feature-research/SKILL.md +48 -25
  51. package/skills/feature-research/scripts/validate-research.sh +51 -12
  52. package/skills/feature-research/scripts/validate-spec.sh +53 -22
  53. package/skills/feature-research/templates/research-agents.md +15 -14
  54. package/skills/feature-research/templates/spec-structure.md +5 -0
  55. package/skills/formatters/scripts/apply-aliases.sh +3 -1
  56. package/skills/formatters/scripts/apply-ci.sh +3 -1
  57. package/skills/git-workflow/SKILL.md +2 -1
  58. package/skills/git-workflow/references/pr-creation.md +10 -0
  59. package/skills/git-workflow/scripts/analyze-changes.sh +21 -11
  60. package/skills/git-workflow/scripts/create-pr.sh +51 -6
  61. package/skills/git-workflow/scripts/validate-commit.sh +26 -14
  62. package/skills/hooks-workflow/scripts/verify-hooks.sh +1 -1
  63. package/skills/implement-plan/SKILL.md +35 -16
  64. package/skills/implement-plan/references/agent-task-prompt.md +8 -5
  65. package/skills/implement-plan/references/linear-sync.md +20 -0
  66. package/skills/implement-plan/references/output-formats.md +17 -2
  67. package/skills/implement-plan/references/plan-inputs.md +23 -4
  68. package/skills/implement-plan/scripts/check-prerequisites.sh +95 -49
  69. package/skills/implement-plan/scripts/parse-dependencies.sh +10 -10
  70. package/skills/init/SKILL.md +77 -42
  71. package/skills/init/references/flag-reference.md +41 -17
  72. package/skills/init/references/project-profile-heuristics.md +3 -0
  73. package/skills/init/references/template-library.md +15 -5
  74. package/skills/init/scripts/profile-project.sh +26 -0
  75. package/skills/init/scripts/render-template.py +2 -2
  76. package/skills/init/templates/AGENTS.md.tmpl +6 -0
  77. package/skills/init/templates/git/gitignore.tmpl +5 -0
  78. package/skills/orchestrate/SKILL.md +17 -2
  79. package/skills/parallel-plan/SKILL.md +14 -8
  80. package/skills/plan/SKILL.md +18 -2
  81. package/skills/plan/references/planning-tracks.md +1 -1
  82. package/skills/plan-workflow/SKILL.md +67 -32
  83. package/skills/plan-workflow/references/checkpoint-messages.md +23 -14
  84. package/skills/plan-workflow/references/plan-structure.md +1 -1
  85. package/skills/plan-workflow/references/planning-agents.md +11 -9
  86. package/skills/plan-workflow/references/research-agents-optimized.md +12 -10
  87. package/skills/plan-workflow/references/research-agents.md +11 -10
  88. package/skills/plan-workflow/scripts/check-prerequisites.sh +50 -11
  89. package/skills/plan-workflow/scripts/check-state.sh +53 -9
  90. package/skills/plan-workflow/scripts/persist-or-fail.sh +21 -7
  91. package/skills/plan-workflow/scripts/validate-analysis-artifacts.sh +28 -14
  92. package/skills/plan-workflow/scripts/validate-research-artifacts.sh +35 -10
  93. package/skills/plan-workflow/scripts/validate-shared.sh +56 -15
  94. package/skills/plan-workflow/scripts/validate-workflow-plan.sh +48 -17
  95. package/skills/pr-autofix/SKILL.md +19 -4
  96. package/skills/pr-autofix/references/output-templates.md +3 -2
  97. package/skills/pr-autofix/scripts/fetch-pr-comments.sh +1 -2
  98. package/skills/pr-autofix/scripts/post-summary.sh +1 -2
  99. package/skills/pr-autofix/scripts/resolve-thread.sh +3 -4
  100. package/skills/prp-implement/SKILL.md +31 -16
  101. package/skills/prp-implement/references/agent-task-prompt.md +5 -2
  102. package/skills/prp-implement/references/detection.md +4 -1
  103. package/skills/prp-implement/references/linear-sync.md +25 -0
  104. package/skills/prp-implement/references/report-output.md +15 -2
  105. package/skills/prp-plan/SKILL.md +62 -30
  106. package/skills/prp-plan/references/enhanced-researchers.md +8 -9
  107. package/skills/prp-plan/scripts/validate-prp-plan.sh +42 -18
  108. package/skills/prp-pr/SKILL.md +14 -1
  109. package/skills/prp-prd/SKILL.md +21 -9
  110. package/skills/prp-spec/SKILL.md +30 -20
  111. package/skills/quick-fix/SKILL.md +6 -4
  112. package/skills/quick-review/SKILL.md +62 -25
  113. package/skills/release-model/scripts/collect-signals.sh +9 -3
  114. package/skills/releaser/scripts/publish-release.sh +6 -3
  115. package/skills/research-to-issues/SKILL.md +33 -14
  116. package/skills/research-to-issues/scripts/validate-prerequisites.sh +45 -23
  117. package/skills/research-to-issues/templates/task-issue.md +4 -0
  118. package/skills/research-to-issues/templates/tracking-issue.md +3 -0
  119. package/skills/review-fix/SKILL.md +96 -14
  120. package/skills/review-fix/references/fix-report.md +10 -10
  121. package/skills/review-fix/references/plan.md +5 -2
  122. package/skills/shared-context/SKILL.md +14 -11
  123. package/skills/visual-plan/SKILL.md +26 -8
  124. package/skills/visual-recap/SKILL.md +1 -1
  125. package/skills/write-docs/scripts/audit-documentation.sh +44 -10
  126. package/skills/write-docs/scripts/generate-doc-index.sh +10 -3
@@ -26,8 +26,9 @@ Extract flags before interpreting the remaining text as the selector:
26
26
  | `--keep-draft` | PR: skip draft-to-ready promotion; draft decision is COMMENT |
27
27
  | `--keep-worktree` | PR: keep worktree after successful publish |
28
28
  | `--quick` | Alias for `/ycc:quick-review` after validation |
29
+ | `--store=<mode>` | Artifact store override, `local` or `linear` |
29
30
 
30
- Strip the supported flags from `$ARGUMENTS` and set `QUICK_MODE=true|false`, `PARALLEL_MODE=true|false`, `NO_WORKTREE_MODE=true|false`, `KEEP_DRAFT=true|false`, and `KEEP_WORKTREE=true|false`. Compute `WORKTREE_MODE=true` unless `--no-worktree` is present. The remaining text is the mode selector (PR number/URL or blank for local).
31
+ Strip the supported flags from `$ARGUMENTS` and set `QUICK_MODE=true|false`, `PARALLEL_MODE=true|false`, `NO_WORKTREE_MODE=true|false`, `KEEP_DRAFT=true|false`, and `KEEP_WORKTREE=true|false`. Keep `--store=local|linear` verbatim as `STORE_FLAG` (empty when absent) and forward it to every resolver call. Compute `WORKTREE_MODE=true` unless `--no-worktree` is present. The remaining text is the mode selector (PR number/URL or blank for local).
31
32
 
32
33
  Gates (abort on invalid combinations):
33
34
 
@@ -43,16 +44,58 @@ Mode selection: `--quick` first; PR number/URL (or branch selector) means PR;
43
44
  blank means local. Local/quick mode MUST NOT post to GitHub, promote drafts,
44
45
  commit/push artifacts, or remove worktrees.
45
46
 
46
- **Questions:** none. A PR argument is the explicit `confirm-publish` selection: PR mode posts the review, promotes a draft unless `--keep-draft`, and commits and pushes the artifact, interactive or headless. Local and `--quick` modes never publish. See `{{package-root}}/shared/references/question-policy.md`.
47
+ **Questions:** none. A PR argument is the explicit `confirm-publish` selection: PR mode posts the review, promotes a draft unless `--keep-draft`, and commits and pushes the artifact (local store only), interactive or headless. Local and `--quick` modes never publish to GitHub. Linear store mode keeps the artifact-store.md Linear call gate and Conflict prompts; headless, a Conflict skips the Document push, sets `pending: true`, and reports it. See `{{package-root}}/shared/references/question-policy.md`.
47
48
 
48
49
  ### Quick delegation
49
50
 
50
51
  Print:
51
52
  `--quick delegated to /quick-review. Run /ycc:quick-review directly for full option surface (--yes, --save, --severity).`
52
53
 
53
- Invoke `Skill: quick-review`, forwarding its accepted flags (`--parallel`
54
- Drop code-review-owned flags (`--quick`, decision and worktree flags).
55
- After delegation exit; quick-review owns artifact lifecycle.
54
+ Invoke `Skill: quick-review`, forwarding its accepted flags (`--parallel`,
55
+ `--yes`, `--save`, `--write-and-apply`, `--severity <level>`,
56
+ `--store=<mode>`). Drop code-review-owned flags (`--quick`, decision and
57
+ worktree flags). After delegation exit; quick-review owns artifact lifecycle.
58
+
59
+ ## Review destination (both modes)
60
+
61
+ Resolve the review file before REVIEW so fan-out scratch can live beside it.
62
+ `<checkout>` is `$PARENT_WORKTREE_PATH` when `WORKTREE_ACTIVE=true`, else the
63
+ current checkout's toplevel. `<review-id>` is `local-<TIMESTAMP>` (one
64
+ timestamp per invocation, reused as the fan-out run-id) or `pr-<N>`.
65
+
66
+ 1. Print the mode; read `ARTIFACT_STORE=` from stdout:
67
+ `bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --shell <checkout>`
68
+ 2. Slug: local mode uses `review` (validated only; the path ignores it).
69
+ Linear mode applies the **Linear call gate** from
70
+ `{{package-root}}/shared/references/artifact-store.md`, then
71
+ takes the slug from its Slugs rules 2-5 (no feature name). PR mode takes
72
+ the hint from the PR, never from `<checkout>`'s branch (with
73
+ `--no-worktree` that is the user's branch): the issue key in `headRefName`
74
+ (Branch hint rules), else a `Closes|Fixes|Resolves <KEY>` in the PR body;
75
+ verify it in Linear. With neither, skip rules 2-3 and sanitize
76
+ `headRefName` for rule 4.
77
+ 3. `OUT="$(bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --ensure --kind=review-<review-id> --slug=<slug> <checkout>)"`,
78
+ then `mkdir -p "$(dirname "$OUT")"` (linear `--ensure` creates only the
79
+ cache root).
80
+
81
+ Local mode: unchanged path `<checkout>/docs/prps/reviews/<review-id>-review.md`,
82
+ no identity frontmatter, no Linear calls. Linear mode:
83
+ `<checkout>/.ycc/artifacts/<slug>/reviews/<review-id>-review.md` (gitignored,
84
+ never committed); after writing, follow artifact-store.md > Review and report
85
+ skills > Reviews (Lookup/Load identity, then Save). Document
86
+ `<slug> · <review-id>-review`; parent is the verified hint issue from step 2
87
+ (or cached `linear.issue`), else the feature Project, else none: keep the
88
+ review local only and print `Review kept local: no Linear issue or Project.`
89
+ Fan-out scratch lives at `$(dirname "$OUT")/.review-scratch/<run-id>/`
90
+ (`mkdir -p` it) and is never pushed. Linear `--ensure` may add or create the
91
+ `.ycc/artifacts/` rule in `<checkout>/.gitignore`; never commit that to a PR
92
+ branch. When the rule-only `.gitignore` check (artifact-store.md > Reviews)
93
+ holds for `<checkout>`, print
94
+ `Note: <checkout>/.gitignore gained the .ycc/artifacts/ rule from the artifact store; leave it out of PR commits.`
95
+
96
+ `DISPLAY_OUT` is the printed form of `$OUT`: in local mode the path relative
97
+ to `<checkout>` (`docs/prps/reviews/<review-id>-review.md`, as before); in
98
+ linear mode the absolute cache path.
56
99
 
57
100
  ## REVIEW path (both modes)
58
101
 
@@ -87,21 +130,23 @@ If explicit `--worktree`, print:
87
130
  `Note: --worktree has no effect in local mode; uncommitted changes are not branch-isolated.`
88
131
 
89
132
  1. **GATHER** — `git diff --name-only HEAD`. Empty: `Nothing to review.`; stop.
133
+ Then resolve `OUT` per Review destination (`<review-id>` `local-<TIMESTAMP>`).
90
134
  2. **REVIEW** — Read changed files, project rules and relevant requirements;
91
135
  follow REVIEW path above (Local / Quick checklist).
92
136
  3. **REPORT** — Read canonical artifact schema before writing:
93
137
  `{{package-root}}/shared/references/review-artifact-format.md`.
94
- Generate one timestamp per invocation, reused for any fan-out run-id and
95
- `docs/prps/reviews/local-{YYYYMMDD-HHMMSS}-review.md`. Write even when no
138
+ Write `$OUT` (local mode:
139
+ `docs/prps/reviews/local-{YYYYMMDD-HHMMSS}-review.md`). Write even when no
96
140
  findings. Apply the schema's Finding ID rules — IDs ordered by severity
97
141
  (CRITICAL first), then by file path — plus initial Status and required
98
142
  fields.
99
143
  Omit Worktree Setup. Include validation table; mark unrun checks Skipped.
100
- After successful write remove this invocation's parallel scratch directory.
144
+ Linear mode: Save the Document. After successful write remove this
145
+ invocation's parallel scratch directory.
101
146
 
102
- Print artifact path, severity counts, and `/ycc:review-fix <path>` (optionally
103
- `--parallel`) as next steps. Block commit if CRITICAL/HIGH issues exist; never
104
- approve security vulnerabilities.
147
+ Print artifact path (`$DISPLAY_OUT`), severity counts, and `/ycc:review-fix $DISPLAY_OUT`
148
+ (optionally `--parallel`) as next steps. Block commit if CRITICAL/HIGH issues
149
+ exist; never approve security vulnerabilities.
105
150
 
106
151
  ## PR Review Mode
107
152
 
@@ -125,6 +170,9 @@ Phase checklist (execute in order):
125
170
  parent feature worktree via `setup-worktree.sh`; abort checkout failures.
126
171
  All subsequent reads, validation and artifact commands run in that worktree.
127
172
  - [ ] **FETCH (1)** — Resolve selector, fetch metadata and diff; stop if absent.
173
+ - [ ] **DESTINATION (1½)** — Always, with or without a worktree: resolve `OUT`
174
+ per Review destination (`<review-id>` `pr-<N>` from FETCH's PR number;
175
+ hint from `headRefName` and the PR body).
128
176
  - [ ] **CONTEXT (2)** — Rules, PRP artifacts, PR intent, changed files and
129
177
  release-base compatibility. Skip release-base check if no release state.
130
178
  - [ ] **REVIEW (3)** — Full files at PR head (worktree or GitHub API),
@@ -136,15 +184,18 @@ Phase checklist (execute in order):
136
184
  Draft retained with `--keep-draft`: COMMENT. Explicit decision flags override
137
185
  recommendation, not findings. Docs/config-only changes get lighter review.
138
186
  - [ ] **REPORT (6)** — Unless `--keep-draft`, promote draft before reporting.
139
- Write `docs/prps/reviews/pr-<N>-review.md` under active checkout using shared
140
- schema. With active worktree, commit only artifact and push before publish.
141
- Gitignored artifact: skip commit, preserve worktree. Clean scratch only after
142
- successful artifact write and applicable commit/push.
187
+ Write `$OUT` (local mode: `docs/prps/reviews/pr-<N>-review.md` under the
188
+ active checkout) using shared schema. With active worktree, commit only
189
+ the artifact and push before publish. Gitignored artifact (always in
190
+ linear mode): skip commit, preserve worktree. Linear mode: Save the
191
+ Document before PUBLISH. Clean scratch only after successful artifact
192
+ write and applicable commit/push.
143
193
  - [ ] **PUBLISH (7)** — Post review and inline comments per PR procedure.
144
194
  BLOCK maps to request-changes. Cleanup only after successful review post,
145
195
  only clean worktree, and only without `--keep-worktree`. Keep branch.
146
- - [ ] **OUTPUT (8)** — PR title, decision, counts, validation, artifact path,
147
- GitHub URL and contextual next steps.
196
+ - [ ] **OUTPUT (8)** — PR title, decision, counts, validation, artifact path
197
+ (`$DISPLAY_OUT`, plus the Linear Document URL in linear mode), GitHub URL and
198
+ contextual next steps.
148
199
 
149
200
  ## Safety gates
150
201
 
@@ -3,14 +3,14 @@
3
3
  ## Contents
4
4
 
5
5
  - SETUP
6
- - FETCH / CONTEXT / REVIEW
6
+ - FETCH / DESTINATION / CONTEXT / REVIEW
7
7
  - VALIDATE / DECIDE
8
8
  - REPORT / PUBLISH / OUTPUT
9
9
  - Edge cases
10
10
 
11
11
  ## Phase 0½ — SETUP (PR mode default; skipped with `--no-worktree`)
12
12
 
13
- Skip this phase entirely when `WORKTREE_MODE=false` (i.e., `--no-worktree` was passed).
13
+ Skip this phase entirely when `WORKTREE_MODE=false` (i.e., `--no-worktree` was passed). Phase 1½ DESTINATION still runs.
14
14
 
15
15
  ### PR mode with `--worktree`
16
16
 
@@ -74,12 +74,23 @@ gh pr diff <NUMBER>
74
74
 
75
75
  If PR not found, stop with error. Store PR metadata for later phases.
76
76
 
77
+ ### Phase 1½ — DESTINATION
78
+
79
+ Runs in every PR review, with or without a worktree, once FETCH has the PR
80
+ number (a URL or branch selector yields it only here). Resolve `OUT` per
81
+ SKILL.md "Review destination" with `<review-id>` `pr-<N>` and `<checkout>`
82
+ (`$PARENT_WORKTREE_PATH` when `WORKTREE_ACTIVE=true`, else the current
83
+ toplevel). In linear mode take the Linear hint from FETCH's `headRefName`
84
+ (issue key per artifact-store.md > Branch hint), else from a
85
+ `Closes|Fixes|Resolves <KEY>` line in `body`; never from the local branch.
86
+ Fan-out scratch for REVIEW lives under `$(dirname "$OUT")`.
87
+
77
88
  ### Phase 2 — CONTEXT
78
89
 
79
90
  Build review context:
80
91
 
81
92
  1. **Project rules** — Read `AGENTS.md`, `RELEASING.md` (when present), `.claude/docs/`, and any contributing guidelines
82
- 2. **PRP artifacts** — Check `docs/prps/reports/` and `docs/prps/plans/` (including `completed/`) for implementation context related to this PR
93
+ 2. **PRP artifacts** — Check `docs/prps/reports/` and `docs/prps/plans/` (including `completed/`) for implementation context related to this PR; in linear mode also check `.ycc/artifacts/*/` (read-only; no Linear calls here)
83
94
  3. **PR intent** — Parse PR description for goals, linked issues, test plans
84
95
  4. **Changed files** — List all modified files and categorize by type (source, test, config, docs)
85
96
  5. **PR base vs. release model** — Skip silently when `release-state.sh get` prints `present=0`. Otherwise fetch the head (`git fetch origin <headRefName>`, or `pull/<N>/head` for a fork) and compare `baseRefName` with `release-state.sh base --head FETCH_HEAD`, per `{{package-root}}/shared/references/pr-base-and-backport.md` (section "Checking an existing PR"). On a mismatch, record a **MEDIUM** finding anchored at `RELEASING.md` (Category: Pattern Compliance) naming both branches, with the suggested fix `gh pr edit <N> --base <expected>` (a retarget, not a code change).
@@ -183,26 +194,24 @@ fi
183
194
 
184
195
  #### Artifact Write
185
196
 
186
- Write the artifact to `$(git rev-parse --show-toplevel)/docs/prps/reviews/pr-<N>-review.md`. When `WORKTREE_ACTIVE=true` this resolves to the worktree top-level (e.g., `<repo-root>/.opencode/worktrees/<repo>-pr-<N>/docs/prps/reviews/pr-<N>-review.md`); when `--no-worktree` is in effect, it resolves to the main repo. The artifact intentionally lives **with the PR branch** so it travels with the review history.
197
+ Write the artifact to `$OUT`, resolved in SKILL.md "Review destination" with kind `review-pr-<N>` and the active checkout as start directory (its parent was created there with `mkdir -p "$(dirname "$OUT")"`).
187
198
 
188
- ```bash
189
- mkdir -p "$(git rev-parse --show-toplevel)/docs/prps/reviews"
190
- ```
199
+ - **Local mode** — unchanged path `$(git rev-parse --show-toplevel)/docs/prps/reviews/pr-<N>-review.md`. When `WORKTREE_ACTIVE=true` this resolves to the worktree top-level (e.g., `<repo-root>/.opencode/worktrees/<repo>-pr-<N>/docs/prps/reviews/pr-<N>-review.md`); when `--no-worktree` is in effect, it resolves to the main repo. The artifact intentionally lives **with the PR branch** so it travels with the review history.
200
+ - **Linear mode** — `<checkout>/.ycc/artifacts/<slug>/reviews/pr-<N>-review.md`, a gitignored cache that never reaches the PR branch. Follow `{{package-root}}/shared/references/artifact-store.md` > Review and report skills > Reviews: Lookup/Load identity for Document `<slug> · pr-<N>-review` before writing, write the body, then Save before PUBLISH. Parent: the verified hint issue (or `linear.issue`), else the feature Project, else none (keep it local only). The GitHub review comment is unchanged.
191
201
 
192
202
  Use the shared Review Artifact Format at
193
203
  `{{package-root}}/shared/references/review-artifact-format.md`.
194
204
  The artifact must include finding IDs and `Status: Open` on every finding so that `/ycc:review-fix` can later update the file in place.
195
205
 
196
- - Write the artifact to `$(git rev-parse --show-toplevel)/docs/prps/reviews/pr-<N>-review.md`. When `WORKTREE_ACTIVE=true` this resolves to the worktree top-level (e.g., `<repo-root>/.opencode/worktrees/<repo>-pr-<N>/docs/prps/reviews/pr-<N>-review.md`); when `--no-worktree` is in effect, it resolves to the main repo. The artifact intentionally lives **with the PR branch** so it travels with the review history.
197
- - **Note**: the artifact will be committed to the PR branch (see commit step below). If you do not want the review record on the PR branch, add `docs/prps/reviews/` to `.gitignore` — the skill detects this and skips the commit.
206
+ - **Note** (local mode): the artifact will be committed to the PR branch (see commit step below). If you do not want the review record on the PR branch, add `docs/prps/reviews/` to `.gitignore` — the skill detects this and skips the commit.
198
207
 
199
208
  #### Artifact Commit + Push
200
209
 
201
- After the artifact has been written, in PR mode when `WORKTREE_ACTIVE=true`, commit and push it to the PR branch before posting the review:
210
+ After the artifact has been written, in PR mode when `WORKTREE_ACTIVE=true`, commit and push it to the PR branch before posting the review. A linear-mode artifact is always gitignored, so it takes the skip branch:
202
211
 
203
212
  ```bash
204
213
  if [[ "$WORKTREE_ACTIVE" == "true" ]]; then
205
- ARTIFACT_REL="docs/prps/reviews/pr-${PR_NUMBER}-review.md"
214
+ ARTIFACT_REL="${OUT#"$(git -C "$PARENT_WORKTREE_PATH" rev-parse --show-toplevel)"/}"
206
215
  pushd "$PARENT_WORKTREE_PATH" >/dev/null
207
216
  if git check-ignore -q "$ARTIFACT_REL"; then
208
217
  echo "Artifact path is gitignored; skipping commit. Worktree preserved at $PARENT_WORKTREE_PATH."
@@ -217,10 +226,13 @@ if [[ "$WORKTREE_ACTIVE" == "true" ]]; then
217
226
  fi
218
227
  ```
219
228
 
229
+ In local mode `ARTIFACT_REL` is `docs/prps/reviews/pr-${PR_NUMBER}-review.md`, as before. Never stage a `.gitignore` change made by linear `--ensure`.
230
+
220
231
  If `PARALLEL_MODE=true` (Path B was used), remove the
221
- `docs/prps/reviews/.review-scratch/pr-<NUMBER>/` scratch directory now that
222
- the artifact has been written (and, when `WORKTREE_ACTIVE=true`, committed
223
- and pushed) successfully.
232
+ `$(dirname "$OUT")/.review-scratch/pr-<NUMBER>/` scratch directory (local
233
+ mode: `docs/prps/reviews/.review-scratch/pr-<NUMBER>/`) now that the artifact
234
+ has been written (and, when `WORKTREE_ACTIVE=true`, committed and pushed, or
235
+ in linear mode saved) successfully.
224
236
 
225
237
  ### Phase 7 — PUBLISH
226
238
 
@@ -290,7 +302,8 @@ Issues: <critical_count> critical, <high_count> high, <medium_count> medium, <lo
290
302
  Validation: <pass_count>/<total_count> checks passed
291
303
 
292
304
  Artifacts:
293
- Review: docs/prps/reviews/pr-<NUMBER>-review.md
305
+ Review: <$DISPLAY_OUT; local mode docs/prps/reviews/pr-<NUMBER>-review.md>
306
+ Linear: <Document URL, linear mode only; or "local only (no Linear parent)">
294
307
  GitHub: <PR URL>
295
308
 
296
309
  Next steps:
@@ -10,7 +10,7 @@ metadata:
10
10
  # compatibility-audit
11
11
 
12
12
  This skill audits the health of every generated compatibility target for the
13
- `ycc` plugin — Claude, Cursor, Codex, opencode, and omp (oh-my-pi) — and produces a structured,
13
+ `ycc` plugin — Claude, Cursor, Codex, opencode, omp (oh-my-pi), and pi — and produces a structured,
14
14
  per-target triage report. It detects bundle drift between the `ycc/` source
15
15
  tree and the generated bundles, validates install assumptions (path conventions,
16
16
  shebang lines, executable bits), and surfaces feature-capability gaps using the
@@ -36,10 +36,14 @@ modifies any file.
36
36
  Parse `$ARGUMENTS` for:
37
37
 
38
38
  - **--target** (optional, default `all`) — restrict the audit to a single
39
- target. Accepted values: `claude`, `cursor`, `codex`, `opencode`, `omp`, `all`. When `all` is
40
- specified, phases 2–5 run once per target in the set `{claude, cursor, codex, opencode, omp}`.
39
+ target. Accepted values: `claude`, `cursor`, `codex`, `opencode`, `omp`, `pi`, `all`. When `all`
40
+ is specified, phases 2–5 run once per target in the set
41
+ `{claude, cursor, codex, opencode, omp, pi}`.
41
42
  `omp` has no generated tree or generator yet: skip Phases 2 and 3 for it and
42
43
  report them as `not generated yet` rather than failures.
44
+ `pi` is modeled but has no generated `packages/pi/` tree or generator yet (ADR 0003,
45
+ YAN-1188): skip Phases 2 and 3 for it and report them as `not generated yet`. Phase 4
46
+ still runs its `PI1` check.
43
47
  - **--json** (flag, default off) — emit the final triage report as a
44
48
  machine-readable JSON envelope instead of Markdown. Per-target sections are
45
49
  preserved inside the envelope as structured objects.
@@ -66,7 +70,7 @@ required for Phase 5.
66
70
 
67
71
  Parse `$ARGUMENTS` as described above. Resolve `--target` to a concrete list:
68
72
 
69
- - `all` → `[claude, cursor, codex, opencode, omp]`
73
+ - `all` → `[claude, cursor, codex, opencode, omp, pi]`
70
74
  - any single value → a one-element list
71
75
 
72
76
  If `--dry-run` was passed, print the resolved target list, the scripts that
@@ -152,7 +156,8 @@ Wrap the per-target objects in a top-level envelope:
152
156
  "cursor": { "drift": {...}, "validation": {...}, "install": {...}, "features": {...}, "verdict": "PASS|WARN|FAIL" },
153
157
  "codex": { "drift": {...}, "validation": {...}, "install": {...}, "features": {...}, "verdict": "PASS|WARN|FAIL" },
154
158
  "opencode":{ "drift": {...}, "validation": {...}, "install": {...}, "features": {...}, "verdict": "PASS|WARN|FAIL" },
155
- "omp": { "drift": {...}, "validation": {...}, "install": {...}, "features": {...}, "verdict": "PASS|WARN|FAIL" }
159
+ "omp": { "drift": {...}, "validation": {...}, "install": {...}, "features": {...}, "verdict": "PASS|WARN|FAIL" },
160
+ "pi": { "drift": {...}, "validation": {...}, "install": {...}, "features": {...}, "verdict": "PASS|WARN|FAIL" }
156
161
  },
157
162
  "audited_at": "<ISO-8601 timestamp>"
158
163
  }
@@ -35,7 +35,10 @@ and that plugin-root variable references are rewritten target-appropriately (kep
35
35
  absolute path in generated Cursor and Codex bundles). For `omp`, `OM1` passes while the root
36
36
  `.omp-plugin/` is absent only if the matrix marks `INSTALL_PATH:omp` `unsupported` or `partial`
37
37
  (`partial` with no listed OMP package: installed by `install.sh --target omp` from a generated
38
- export); once the catalog exists, `OM2` requires a valid `.omp-plugin/marketplace.json`.
38
+ export); once the catalog exists, `OM2` requires a valid `.omp-plugin/marketplace.json`. For
39
+ `pi`, `PI1` fails closed both ways on an installable package (`packages/pi/*/package.json`): until
40
+ one exists every `pi` matrix cell must be `unsupported` (a skills-only `packages/pi/ycc/skills`
41
+ tree does not count), and once one exists `INSTALL_PATH:pi` must not be `unsupported`.
39
42
 
40
43
  **Feature-vs-matrix** — output of `audit-target-features.sh`. Cross-references
41
44
  capabilities in the source tree against `target-capability-matrix.md`. Features present
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env bash
2
2
  # audit-install-assumptions.sh — validate install-path assumptions for each
3
- # generated compatibility target (Claude, Cursor, Codex, opencode, omp).
3
+ # generated compatibility target (Claude, Cursor, Codex, opencode, omp, pi).
4
4
  #
5
5
  # Flags:
6
- # --target=<claude|cursor|codex|opencode|omp|all> (default: all)
6
+ # --target=<claude|cursor|codex|opencode|omp|pi|all> (default: all)
7
7
  # --format=<human|json> (default: human)
8
8
  # --help, -h print usage and exit 0
9
9
  #
@@ -12,7 +12,7 @@
12
12
  set -euo pipefail
13
13
 
14
14
  usage() { cat <<'EOF'
15
- Usage: audit-install-assumptions.sh [--target=<claude|cursor|codex|opencode|omp|all>]
15
+ Usage: audit-install-assumptions.sh [--target=<claude|cursor|codex|opencode|omp|pi|all>]
16
16
  [--format=<human|json>] [--help|-h]
17
17
  [repo-root]
18
18
 
@@ -42,7 +42,7 @@ for arg in "$@"; do
42
42
  ;;
43
43
  esac
44
44
  done
45
- case "$TARGET" in all|claude|cursor|codex|opencode|omp) ;;
45
+ case "$TARGET" in all|claude|cursor|codex|opencode|omp|pi) ;;
46
46
  *) echo "audit-install-assumptions.sh: unknown --target: $TARGET" >&2; usage >&2; exit 2 ;; esac
47
47
  case "$FORMAT" in human|json) ;;
48
48
  *) echo "audit-install-assumptions.sh: unknown --format: $FORMAT" >&2; usage >&2; exit 2 ;; esac
@@ -356,6 +356,62 @@ PY
356
356
  else record "omp" "OM2" "FAIL" "${mkt} is not valid JSON"; fi
357
357
  }
358
358
 
359
+ # ---------------------------------------------------------------------------
360
+ # pi checks
361
+ # ---------------------------------------------------------------------------
362
+ run_pi_checks() {
363
+ local pdir="${REPO_ROOT}/packages/pi"
364
+ local matrix="${REPO_ROOT}/ycc/skills/_shared/references/target-capability-matrix.md"
365
+
366
+ # PI1: the installable tree and every matrix pi verdict must agree (ADR 0003). The tree
367
+ # counts as present only once packages/pi/*/package.json exists (YAN-1188): skills land
368
+ # under packages/pi/ycc/skills earlier (YAN-1184). With no installable package every pi
369
+ # cell must be unsupported; with one, INSTALL_PATH:pi must no longer be unsupported.
370
+ if [[ ! -f "$matrix" ]]; then
371
+ record "pi" "PI1" "FAIL" "${matrix} does not exist — cannot read the pi column"; return
372
+ fi
373
+ local verdicts; set +e
374
+ verdicts=$(python3 - "$matrix" <<'PY'
375
+ import sys
376
+ header = None
377
+ for raw in open(sys.argv[1], encoding="utf-8"):
378
+ s = raw.strip()
379
+ if not s.startswith("|"):
380
+ if header is not None:
381
+ break
382
+ continue
383
+ cells = [c.strip() for c in s.strip("|").split("|")]
384
+ if all(c and set(c) == {"-"} for c in cells):
385
+ continue
386
+ if header is None:
387
+ header = cells
388
+ continue
389
+ if "pi" in header and len(cells) == len(header):
390
+ print(f"{cells[0]}={cells[header.index('pi')]}")
391
+ PY
392
+ ); local parse_rc=$?; set -e
393
+ if [[ $parse_rc -ne 0 ]]; then
394
+ record "pi" "PI1" "FAIL" "matrix parse failed (python rc=${parse_rc})"; return
395
+ fi
396
+ local install_path marker="${pdir}/*/package.json"
397
+ install_path="$(sed -n 's/^INSTALL_PATH=//p' <<<"$verdicts")"
398
+ if [[ -z "$install_path" ]]; then
399
+ record "pi" "PI1" "FAIL" "INSTALL_PATH:pi not found in ${matrix}"
400
+ elif ! compgen -G "$marker" >/dev/null; then
401
+ local claimed
402
+ claimed="$(grep -v '=unsupported$' <<<"$verdicts" | tr '\n' ' ' || true)"
403
+ if [[ -z "${claimed// /}" ]]; then
404
+ record "pi" "PI1" "PASS" "${marker} not generated yet (every matrix pi verdict is unsupported)"
405
+ else
406
+ record "pi" "PI1" "FAIL" "${marker} does not exist but the matrix claims ${claimed% }"
407
+ fi
408
+ elif [[ "$install_path" == "unsupported" ]]; then
409
+ record "pi" "PI1" "FAIL" "${marker} exists but matrix INSTALL_PATH:pi=unsupported"
410
+ else
411
+ record "pi" "PI1" "PASS" ""
412
+ fi
413
+ }
414
+
359
415
  # ---------------------------------------------------------------------------
360
416
  # Dispatch
361
417
  # ---------------------------------------------------------------------------
@@ -365,7 +421,8 @@ case "$TARGET" in
365
421
  codex) run_codex_checks ;;
366
422
  opencode) run_opencode_checks ;;
367
423
  omp) run_omp_checks ;;
368
- all) run_claude_checks; run_cursor_checks; run_codex_checks; run_opencode_checks; run_omp_checks ;;
424
+ pi) run_pi_checks ;;
425
+ all) run_claude_checks; run_cursor_checks; run_codex_checks; run_opencode_checks; run_omp_checks; run_pi_checks ;;
369
426
  esac
370
427
 
371
428
  OVERALL_RC=0
@@ -375,7 +432,7 @@ for s in "${CS[@]}"; do [[ "$s" == "FAIL" ]] && { OVERALL_RC=1; break; }; done
375
432
  # Human output
376
433
  # ---------------------------------------------------------------------------
377
434
  emit_human() {
378
- local tgts=(); [[ "$TARGET" == "all" ]] && tgts=(claude cursor codex opencode omp) || tgts=("$TARGET")
435
+ local tgts=(); [[ "$TARGET" == "all" ]] && tgts=(claude cursor codex opencode omp pi) || tgts=("$TARGET")
379
436
  local n=${#CI[@]}
380
437
  for tgt in "${tgts[@]}"; do
381
438
  local pass=0 fail=0 i=0
@@ -419,7 +476,7 @@ ss=[rd(f"{tmp}/s_{i}") for i in range(n)]; ds=[rd(f"{tmp}/d_{i}") for i in range
419
476
  def build(t):
420
477
  ch=[{"id":ids[i],"status":ss[i],"detail":ds[i] or None} for i in range(n) if ts[i]==t]
421
478
  return {"checks":ch,"ok":all(c["status"]!="FAIL" for c in ch)}
422
- names=["claude","cursor","codex","opencode","omp"] if tgt=="all" else [tgt]
479
+ names=["claude","cursor","codex","opencode","omp","pi"] if tgt=="all" else [tgt]
423
480
  out={t:build(t) for t in names}
424
481
  print(json.dumps({"as_of":datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ"),
425
482
  "targets":out,"ok":all(v["ok"] for v in out.values())},indent=2))
@@ -7,7 +7,7 @@
7
7
  #
8
8
  # Flags:
9
9
  # --target=<t>|all Restrict findings to one target: claude, cursor, codex,
10
- # opencode, omp, or all (default: all). `--target <t>` also works.
10
+ # opencode, omp, pi, or all (default: all). `--target <t>` also works.
11
11
  # --format=human|json Output format (default: human)
12
12
  # --strict Exit 1 if any verdict is "unsupported"
13
13
  # --help Show this help and exit 0
@@ -22,7 +22,7 @@
22
22
  #
23
23
  # The parser reads ONE markdown table from the matrix file. Rules:
24
24
  # - The header row must be exactly (after per-cell whitespace trim):
25
- # capability | claude | cursor | codex | opencode | omp
25
+ # capability | claude | cursor | codex | opencode | omp | pi
26
26
  # - Separator rows (cells of dashes) are skipped.
27
27
  # - Each data cell must be one of: supported | partial | unsupported
28
28
  # - The "As of <date>" line is expected anywhere in the file as:
@@ -47,7 +47,7 @@ verdict lines.
47
47
 
48
48
  Flags:
49
49
  --target=<t>|all Restrict findings to one target: claude, cursor, codex,
50
- opencode, omp, or all (default: all). `--target <t>` also works.
50
+ opencode, omp, pi, or all (default: all). `--target <t>` also works.
51
51
  --format=human|json Output format (default: human)
52
52
  --strict Exit 1 if any verdict is "unsupported"
53
53
  --help Show this help and exit 0
@@ -64,7 +64,7 @@ EOF
64
64
  # ---------------------------------------------------------------------------
65
65
 
66
66
  # Canonical target order; must match the matrix header after `capability`.
67
- ALL_TARGETS=("claude" "cursor" "codex" "opencode" "omp")
67
+ ALL_TARGETS=("claude" "cursor" "codex" "opencode" "omp" "pi")
68
68
 
69
69
  FORMAT="human"
70
70
  STRICT=0
@@ -114,7 +114,7 @@ case "$FORMAT" in
114
114
  esac
115
115
 
116
116
  case "$TARGET" in
117
- all|claude|cursor|codex|opencode|omp) ;;
117
+ all|claude|cursor|codex|opencode|omp|pi) ;;
118
118
  *)
119
119
  echo "audit-target-features.sh: unknown --target value: $TARGET" >&2
120
120
  usage >&2
@@ -182,7 +182,7 @@ fi
182
182
  # ---------------------------------------------------------------------------
183
183
  # Parse the capability matrix via Python
184
184
  # Outputs: one line per capability row in the form:
185
- # <capability>|<claude>|<cursor>|<codex>|<opencode>|<omp>
185
+ # <capability>|<claude>|<cursor>|<codex>|<opencode>|<omp>|<pi>
186
186
  # First line is the "As of ..." date (prefixed with "AS_OF:").
187
187
  # ---------------------------------------------------------------------------
188
188
 
@@ -193,7 +193,7 @@ matrix_path = sys.argv[1]
193
193
  matrix_rel = sys.argv[2]
194
194
 
195
195
  VOCABULARY = {"supported", "partial", "unsupported"}
196
- EXPECTED_HEADER = ["capability", "claude", "cursor", "codex", "opencode", "omp"]
196
+ EXPECTED_HEADER = ["capability", "claude", "cursor", "codex", "opencode", "omp", "pi"]
197
197
 
198
198
  lines = open(matrix_path).read().splitlines()
199
199
 
@@ -273,7 +273,7 @@ PYEOF
273
273
  }
274
274
 
275
275
  # Check for PARSE_ERROR prefix in stdout (belt-and-suspenders)
276
- if echo "$PARSE_RESULT" | grep -q "^PARSE_ERROR:"; then
276
+ if grep -q "^PARSE_ERROR:" <<<"$PARSE_RESULT"; then
277
277
  echo "$PARSE_RESULT" | grep "^PARSE_ERROR:" | sed 's/^PARSE_ERROR://' >&2
278
278
  exit 2
279
279
  fi
@@ -281,15 +281,16 @@ fi
281
281
  AS_OF_LINE="$(echo "$PARSE_RESULT" | grep "^AS_OF:" | sed 's/^AS_OF://')"
282
282
 
283
283
  # Build parallel arrays: CAPS, VERDICTS_CLAUDE, VERDICTS_CURSOR, VERDICTS_CODEX,
284
- # VERDICTS_OPENCODE, VERDICTS_OMP
284
+ # VERDICTS_OPENCODE, VERDICTS_OMP, VERDICTS_PI
285
285
  declare -a CAPS=()
286
286
  declare -a VERDICTS_CLAUDE=()
287
287
  declare -a VERDICTS_CURSOR=()
288
288
  declare -a VERDICTS_CODEX=()
289
289
  declare -a VERDICTS_OPENCODE=()
290
290
  declare -a VERDICTS_OMP=()
291
+ declare -a VERDICTS_PI=()
291
292
 
292
- while IFS='|' read -r cap cl cu co oc om; do
293
+ while IFS='|' read -r cap cl cu co oc om pi; do
293
294
  [[ "$cap" == AS_OF:* ]] && continue
294
295
  [[ -z "$cap" ]] && continue
295
296
  CAPS+=("$cap")
@@ -298,6 +299,7 @@ while IFS='|' read -r cap cl cu co oc om; do
298
299
  VERDICTS_CODEX+=("$co")
299
300
  VERDICTS_OPENCODE+=("$oc")
300
301
  VERDICTS_OMP+=("$om")
302
+ VERDICTS_PI+=("$pi")
301
303
  done < <(echo "$PARSE_RESULT" | grep -v "^AS_OF:")
302
304
 
303
305
  # ---------------------------------------------------------------------------
@@ -411,6 +413,7 @@ lookup_verdict() {
411
413
  codex) echo "${VERDICTS_CODEX[$i]}"; return ;;
412
414
  opencode) echo "${VERDICTS_OPENCODE[$i]}"; return ;;
413
415
  omp) echo "${VERDICTS_OMP[$i]}"; return ;;
416
+ pi) echo "${VERDICTS_PI[$i]}"; return ;;
414
417
  *)
415
418
  echo "audit-target-features.sh: lookup_verdict: unknown target '$target'" >&2
416
419
  exit 2
@@ -14,11 +14,11 @@ Preserve contradictions and uncertainty; do not replace missing research with gu
14
14
 
15
15
  ## Phase 0: Define and Set Up
16
16
 
17
- Parse `$ARGUMENTS`: flags first, remaining text is the required research subject.
17
+ Parse `$ARGUMENTS`: flags first. Parse and strip `--store=local|linear`, retain the exact override as `STORE_FLAG` (empty when absent), and reject invalid/conflicting overrides. Forward `${STORE_FLAG}` to every resolver call. Only the remaining text is the required research subject.
18
18
 
19
19
  Default: standalone parallel sub-agents.
20
20
 
21
- - `--output-dir "..."`: output directory; default `research/[sanitized-subject]`.
21
+ - `--output-dir "..."`: explicit working directory, overriding either store's default. Local mode defaults to `research/[sanitized-subject]`; linear mode resolves kind `deep-research`.
22
22
  - `--dry-run`: display the plan without running checks, creating files, or dispatching.
23
23
 
24
24
  Missing subject: abort with usage and an example:
@@ -30,6 +30,14 @@ Missing subject: abort with usage and an example:
30
30
  Require a focused topic. Sanitize the default directory name: lowercase, replace
31
31
  spaces with hyphens, remove characters other than alphanumerics and hyphens.
32
32
 
33
+ Step 1: resolve and **print** the store with the executed helper; read `ARTIFACT_STORE=` from stdout:
34
+
35
+ ```bash
36
+ bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --shell
37
+ ```
38
+
39
+ Use the sanitized subject as `<slug>`; if empty, request a focused subject instead of choosing a directory. Without `--output-dir`, local mode keeps `research/<slug>`; linear mode obtains `OUTPUT_DIR` from the helper's `--kind=deep-research --slug=<slug>` (without `--ensure` during dry-run). Explicit `--output-dir` always wins for working files. Retain the absolute output path across tool calls; shell state does not persist. The entire working tree is local-only; in linear mode only the final report is saved as research lens `deep-research`.
40
+
33
41
  ### Dry run
34
42
 
35
43
  Display the subject, output path, four phases (8 personas, 2 crucible agents,
@@ -41,14 +49,20 @@ Display the subject, output path, four phases (8 personas, 2 crucible agents,
41
49
 
42
50
  ### Infrastructure and objective (not dry run)
43
51
 
44
- Run `scripts/check-prerequisites.sh` when preparing the output directory, before
45
- creating anything:
52
+ Step 2: before any write in linear mode, apply the **Linear call gate** from `{{package-root}}/shared/references/artifact-store.md`. Run the prerequisite script against the selected `OUTPUT_DIR` before creating it:
46
53
 
47
54
  ```bash
48
55
  {{package-root}}/skills/deep-research/scripts/check-prerequisites.sh "$OUTPUT_DIR"
49
- mkdir -p "$OUTPUT_DIR/persona-findings" "$OUTPUT_DIR/synthesis" "$OUTPUT_DIR/evidence"
50
56
  ```
51
57
 
58
+ Step 3: in linear mode without explicit `--output-dir`, resolve the working directory with `--ensure` after the gate:
59
+
60
+ ```bash
61
+ OUTPUT_DIR="$(bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --ensure --kind=deep-research --slug=<slug>)"
62
+ ```
63
+
64
+ Then create `"$OUTPUT_DIR/persona-findings"`, `"$OUTPUT_DIR/synthesis"`, and `"$OUTPUT_DIR/evidence"` in either mode. Do not redirect an explicit `--output-dir` to the cache.
65
+
52
66
  Write `$OUTPUT_DIR/objective.md` with 3–5 research questions, success criteria,
53
67
  evidence standards, perspectives to cover, and 2–3 subject-specific bias risks.
54
68
  Use the phase checklist below as the success criteria. Give every agent the
@@ -195,6 +209,15 @@ Run `scripts/validate-research.sh` when report and artifacts are ready:
195
209
 
196
210
  Fix missing/empty artifacts, weak citation coverage, and format issues. Report
197
211
  actual validation result and any remaining gaps; do not call a failed run complete.
212
+
213
+ After validation, local mode keeps `FINAL_REPORT="$OUTPUT_DIR/report.md"` with no identity frontmatter or Linear calls. In linear mode, resolve the published report separately:
214
+
215
+ ```bash
216
+ OUT="$(bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --ensure --kind=research-deep-research --slug=<slug>)"
217
+ mkdir -p "$(dirname "$OUT")"
218
+ ```
219
+
220
+ Before writing `$OUT`, follow artifact-store.md **Planning skills**: if `linear.document` identity is missing, run Lookup steps 3–6 and Load any hit; preserve its identity and use Conflict before replacement, then Save the validated report (Document `<slug> · research-deep-research`). Set `FINAL_REPORT` to this path. Keep `$OUTPUT_DIR/report.md` and all intermediate findings local-only, including with explicit `--output-dir`. Report the working directory and final saved report path.
198
221
  Read `references/completion-summary-template.md` when presenting the formatted
199
222
  completion summary. Preserve its per-persona counts and separate Phase 3 counts:
200
223
  tensions, patterns, research gaps, and novel hypotheses. Report actual counts,
@@ -36,7 +36,8 @@
36
36
 
37
37
  ### Phase 4: Report Synthesis
38
38
 
39
- - Final report: $OUTPUT_DIR/report.md
39
+ - Final saved report: $FINAL_REPORT
40
+ - Local working report: $OUTPUT_DIR/report.md
40
41
 
41
42
  ## Key Discoveries
42
43
 
@@ -59,7 +60,7 @@
59
60
 
60
61
  ## Next Steps
61
62
 
62
- 1. **Review the report**: Read $OUTPUT_DIR/report.md
63
+ 1. **Review the report**: Read $FINAL_REPORT
63
64
  2. **Examine specific personas**: Dive into $OUTPUT_DIR/persona-findings/ for details
64
65
  3. **Review synthesis**: Check $OUTPUT_DIR/synthesis/ for analysis
65
66
  4. **Verify evidence**: See $OUTPUT_DIR/evidence/verification-log.md
@@ -100,8 +100,14 @@ check_search_queries() {
100
100
  fi
101
101
 
102
102
  # Count "Search Queries Executed" section entries
103
- local query_count
104
- query_count=$(grep -c "^[0-9]\+\." "$file" 2>/dev/null | tail -1 || echo "0")
103
+ local query_count status=0
104
+ # grep -c prints the count itself; exit 1 only means zero matches. Any
105
+ # other non-zero status (e.g. unreadable file) is a real read failure.
106
+ query_count=$(grep -c "^[0-9]\+\." "$file" 2>/dev/null) || status=$?
107
+ if [ "$status" -gt 1 ]; then
108
+ echo "Error: Failed to read findings file: $file" >&2
109
+ return "$status"
110
+ fi
105
111
 
106
112
  if [ "$query_count" -lt "$min_queries" ]; then
107
113
  echo -e "${YELLOW}⚠${NC} $persona: Only $query_count search queries (expected $min_queries+)"