@yandy-r/ycc-opencode 6.1.0 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/README.md +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/package.json +1 -1
  9. package/shared/references/artifact-store.md +613 -0
  10. package/shared/references/branch-prep.md +2 -0
  11. package/shared/references/forge-detection.md +3 -2
  12. package/shared/references/review-artifact-format.md +13 -6
  13. package/shared/references/review-checklist.md +3 -2
  14. package/shared/references/review-dispatch.md +15 -10
  15. package/shared/references/target-capability-matrix.md +42 -6
  16. package/shared/references/visual-mode.md +19 -13
  17. package/shared/references/worktree-strategy.md +12 -8
  18. package/shared/scripts/artifact-body.sh +71 -0
  19. package/shared/scripts/artifact-store-pointer.sh +245 -0
  20. package/shared/scripts/ci-monitor.sh +9 -4
  21. package/shared/scripts/collect-linear-keys.sh +77 -0
  22. package/shared/scripts/lib/ci-classify.sh +13 -10
  23. package/shared/scripts/lib/forge.sh +13 -4
  24. package/shared/scripts/prepare-feature-branch.sh +96 -10
  25. package/shared/scripts/release-ci-monitor.sh +2 -2
  26. package/shared/scripts/report-bundle-drift.sh +1 -1
  27. package/shared/scripts/resolve-artifact-store.sh +636 -0
  28. package/shared/scripts/validate-file-paths.sh +11 -4
  29. package/skills/blueprint/SKILL.md +48 -13
  30. package/skills/clean/SKILL.md +1 -1
  31. package/skills/clean/scripts/detect-project-type.sh +2 -2
  32. package/skills/clean/scripts/generate-report.sh +34 -5
  33. package/skills/clean/scripts/validate-safety.sh +9 -6
  34. package/skills/code-report/SKILL.md +26 -14
  35. package/skills/code-report/scripts/check-prerequisites.sh +72 -12
  36. package/skills/code-report/templates/report-structure.md +1 -1
  37. package/skills/code-review/SKILL.md +68 -17
  38. package/skills/code-review/references/pr-procedure.md +28 -15
  39. package/skills/compatibility-audit/scripts/audit-target-features.sh +1 -1
  40. package/skills/deep-research/SKILL.md +28 -5
  41. package/skills/deep-research/references/completion-summary-template.md +3 -2
  42. package/skills/deep-research/scripts/validate-research.sh +8 -2
  43. package/skills/feature-research/SKILL.md +48 -25
  44. package/skills/feature-research/scripts/validate-research.sh +51 -12
  45. package/skills/feature-research/scripts/validate-spec.sh +53 -22
  46. package/skills/feature-research/templates/research-agents.md +15 -14
  47. package/skills/feature-research/templates/spec-structure.md +5 -0
  48. package/skills/formatters/scripts/apply-aliases.sh +3 -1
  49. package/skills/formatters/scripts/apply-ci.sh +3 -1
  50. package/skills/git-workflow/SKILL.md +2 -1
  51. package/skills/git-workflow/references/pr-creation.md +10 -0
  52. package/skills/git-workflow/scripts/analyze-changes.sh +21 -11
  53. package/skills/git-workflow/scripts/create-pr.sh +51 -6
  54. package/skills/git-workflow/scripts/validate-commit.sh +26 -14
  55. package/skills/hooks-workflow/scripts/verify-hooks.sh +1 -1
  56. package/skills/implement-plan/SKILL.md +35 -16
  57. package/skills/implement-plan/references/agent-task-prompt.md +8 -5
  58. package/skills/implement-plan/references/linear-sync.md +20 -0
  59. package/skills/implement-plan/references/output-formats.md +17 -2
  60. package/skills/implement-plan/references/plan-inputs.md +23 -4
  61. package/skills/implement-plan/scripts/check-prerequisites.sh +95 -49
  62. package/skills/implement-plan/scripts/parse-dependencies.sh +10 -10
  63. package/skills/init/SKILL.md +77 -42
  64. package/skills/init/references/flag-reference.md +41 -17
  65. package/skills/init/references/project-profile-heuristics.md +3 -0
  66. package/skills/init/references/template-library.md +15 -5
  67. package/skills/init/scripts/profile-project.sh +26 -0
  68. package/skills/init/scripts/render-template.py +2 -2
  69. package/skills/init/templates/AGENTS.md.tmpl +6 -0
  70. package/skills/init/templates/git/gitignore.tmpl +5 -0
  71. package/skills/orchestrate/SKILL.md +17 -2
  72. package/skills/parallel-plan/SKILL.md +14 -8
  73. package/skills/plan/SKILL.md +18 -2
  74. package/skills/plan/references/planning-tracks.md +1 -1
  75. package/skills/plan-workflow/SKILL.md +67 -32
  76. package/skills/plan-workflow/references/checkpoint-messages.md +23 -14
  77. package/skills/plan-workflow/references/plan-structure.md +1 -1
  78. package/skills/plan-workflow/references/planning-agents.md +11 -9
  79. package/skills/plan-workflow/references/research-agents-optimized.md +12 -10
  80. package/skills/plan-workflow/references/research-agents.md +11 -10
  81. package/skills/plan-workflow/scripts/check-prerequisites.sh +50 -11
  82. package/skills/plan-workflow/scripts/check-state.sh +53 -9
  83. package/skills/plan-workflow/scripts/persist-or-fail.sh +21 -7
  84. package/skills/plan-workflow/scripts/validate-analysis-artifacts.sh +28 -14
  85. package/skills/plan-workflow/scripts/validate-research-artifacts.sh +35 -10
  86. package/skills/plan-workflow/scripts/validate-shared.sh +56 -15
  87. package/skills/plan-workflow/scripts/validate-workflow-plan.sh +48 -17
  88. package/skills/pr-autofix/SKILL.md +19 -4
  89. package/skills/pr-autofix/references/output-templates.md +3 -2
  90. package/skills/pr-autofix/scripts/fetch-pr-comments.sh +1 -2
  91. package/skills/pr-autofix/scripts/post-summary.sh +1 -2
  92. package/skills/pr-autofix/scripts/resolve-thread.sh +3 -4
  93. package/skills/prp-implement/SKILL.md +31 -16
  94. package/skills/prp-implement/references/agent-task-prompt.md +5 -2
  95. package/skills/prp-implement/references/detection.md +4 -1
  96. package/skills/prp-implement/references/linear-sync.md +25 -0
  97. package/skills/prp-implement/references/report-output.md +15 -2
  98. package/skills/prp-plan/SKILL.md +62 -30
  99. package/skills/prp-plan/references/enhanced-researchers.md +8 -9
  100. package/skills/prp-plan/scripts/validate-prp-plan.sh +42 -18
  101. package/skills/prp-pr/SKILL.md +14 -1
  102. package/skills/prp-prd/SKILL.md +21 -9
  103. package/skills/prp-spec/SKILL.md +30 -20
  104. package/skills/quick-fix/SKILL.md +6 -4
  105. package/skills/quick-review/SKILL.md +62 -25
  106. package/skills/release-model/scripts/collect-signals.sh +9 -3
  107. package/skills/releaser/scripts/publish-release.sh +6 -3
  108. package/skills/research-to-issues/SKILL.md +33 -14
  109. package/skills/research-to-issues/scripts/validate-prerequisites.sh +45 -23
  110. package/skills/research-to-issues/templates/task-issue.md +4 -0
  111. package/skills/research-to-issues/templates/tracking-issue.md +3 -0
  112. package/skills/review-fix/SKILL.md +96 -14
  113. package/skills/review-fix/references/fix-report.md +10 -10
  114. package/skills/review-fix/references/plan.md +5 -2
  115. package/skills/shared-context/SKILL.md +14 -11
  116. package/skills/visual-plan/SKILL.md +26 -8
  117. package/skills/visual-recap/SKILL.md +1 -1
  118. package/skills/write-docs/scripts/audit-documentation.sh +44 -10
  119. 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:
@@ -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
@@ -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+)"
@@ -10,7 +10,7 @@ description: Researches features with seven specialists and consolidates a featu
10
10
  > **OpenCode V2 compatibility:** `--team` is unsupported. If it is supplied, abort before setup or dispatch and ask the caller to rerun without it. This target uses native standalone `subagent` calls only.
11
11
 
12
12
 
13
- **Operational context:** Dispatch api-researcher, business-analyzer, tech-designer, ux-researcher, security-researcher, practices-researcher, and recommendations-agent; write seven research-*.md files plus feature-spec.md under docs/plans/[feature-name]/, never docs/prps/. Use /ycc:prp-spec for lightweight single-pass PRP specs.
13
+ **Operational context:** Dispatch api-researcher, business-analyzer, tech-designer, ux-researcher, security-researcher, practices-researcher, and recommendations-agent; write seven research-*.md files plus feature-spec.md at paths resolved through the artifact store, never docs/prps/. Linear mode (default) uses `.ycc/artifacts/[feature-name]/`; local mode keeps `docs/plans/[feature-name]/`. Use /ycc:prp-spec for lightweight single-pass PRP specs.
14
14
 
15
15
  ## Workflow Integration
16
16
 
@@ -25,7 +25,7 @@ feature-spec.md feature-spec.md parallel-plan.md
25
25
 
26
26
  | Skill | Agents | Output Dir | Output Files | Use When |
27
27
  | ------------------------- | --------------------------------- | -------------------- | ------------------------------------- | ---------------------------------------------- |
28
- | `feature-research` (THIS) | 7 parallel agents | `docs/plans/[name]/` | 7 `research-*.md` + `feature-spec.md` | Deep multi-agent research before plan-workflow |
28
+ | `feature-research` (THIS) | 7 parallel agents | Resolved feature dir | 7 `research-*.md` + `feature-spec.md` | Deep multi-agent research before plan-workflow |
29
29
  | `prp-spec` | Single pass (optional researcher) | `docs/prps/specs/` | `{name}.spec.md` | Lightweight spec for PRP workflow |
30
30
  | `prp-prd` | Interactive + researcher | `docs/prps/prds/` | `{name}.prd.md` | Full PRD with hypothesis-driven questioning |
31
31
  | `prp-plan` | Single pass + researcher | `docs/prps/plans/` | `{name}.plan.md` | Implementation plan from PRD or description |
@@ -34,7 +34,8 @@ feature-spec.md feature-spec.md parallel-plan.md
34
34
 
35
35
  - Deploys all 7 researchers in parallel (never skips agents)
36
36
  - Creates 7 `research-*.md` files + 1 `feature-spec.md`
37
- - Outputs ONLY to `docs/plans/[feature-name]/`
37
+ - Outputs only to the artifact-store feature directory (`docs/plans/[feature-name]/` in local mode)
38
+ - Uses `research-<lens>` paths, including the linear `research/` subdirectory
38
39
 
39
40
  **This skill NEVER**:
40
41
 
@@ -50,12 +51,13 @@ feature-spec.md feature-spec.md parallel-plan.md
50
51
  Parse arguments (flags first, then the feature name):
51
52
 
52
53
  - **--description "..."**: Brief description of the feature (guides research agents)
53
- - **feature-name**: Required. Directory name in `docs/plans/`
54
+ - **feature-name**: Required. Feature slug passed to the artifact-store resolver
55
+ - **--store=local|linear**: Optional artifact-store override. Forward it to every helper call. Linear is the default; `local` opts out.
54
56
 
55
57
  If no feature name provided, abort with usage instructions:
56
58
 
57
59
  ```
58
- Usage: /ycc:feature-research [--description "..."] [--dry-run] [feature-name]
60
+ Usage: /ycc:feature-research [--description "..."] [--dry-run] [--store=local|linear] [feature-name]
59
61
 
60
62
  Examples:
61
63
  /ycc:feature-research plex-integration --description "Advanced Plex media library integration with filters and playlists"
@@ -76,22 +78,38 @@ Extract from `$ARGUMENTS`:
76
78
  2. **--description**: Quoted string after flag (optional but recommended)
77
79
  3. **--dry-run**: Boolean flag. Set `DRY_RUN=true` if present, else `false`.
78
80
  4. **feature-name**: First non-flag argument (required)
81
+ 5. **--store=local|linear**: Parse and strip before selecting feature-name. Retain the exact override as `STORE_FLAG` (empty if absent), reject invalid/conflicting overrides, and pass it to every helper call and validator.
79
82
 
80
83
  Validate the feature name: must be kebab-case, no special characters except hyphens.
81
84
 
82
85
 
83
86
 
84
- ### Step 2: Create Directory
87
+ ### Step 2: Resolve Artifact Paths and Create Directories
85
88
 
86
- **CRITICAL**: Output goes to `docs/plans/[feature-name]/` — NEVER to `docs/prps/` or any other directory, regardless of the user's current working directory. If the user invokes this skill from inside `docs/prps/` or any subdirectory, still resolve the output path from the repository root as `docs/plans/[feature-name]/`.
89
+ **CRITICAL**: Write only to paths returned by the artifact-store resolver — NEVER to `docs/prps/` or another directory, regardless of the current working directory. Linear mode (default) resolves under `.ycc/artifacts/[feature-name]/`; local mode preserves `docs/plans/[feature-name]/`.
87
90
 
88
- ```bash
89
- test -d "docs/plans/[feature-name]" && echo "exists" || mkdir -p "docs/plans/[feature-name]"
90
- ```
91
+ 1. Print the mode and read `ARTIFACT_STORE=` from stdout; resolve paths without writes:
92
+
93
+ ```bash
94
+ bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --shell
95
+ feature_dir="$(bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --kind=feature-dir --slug="[feature-name]")"
96
+ research_dir="$(bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --kind=research-dir --slug="[feature-name]")"
97
+ spec_file="$(bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --kind=feature-spec --slug="[feature-name]")"
98
+ ```
99
+
100
+ 2. For a non-dry linear run only, apply the **Linear call gate** from `{{package-root}}/shared/references/artifact-store.md` before any write or pull.
101
+ 3. Once writing is permitted, establish the safe cache and gitignore rule before Lookup/Load:
102
+
103
+ ```bash
104
+ feature_dir="$(bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --ensure --kind=feature-dir --slug="[feature-name]")"
105
+ mkdir -p "$feature_dir" "$research_dir"
106
+ ```
107
+
108
+ Dry runs only resolve paths, never ensure or Load. In local mode `research_dir` equals `feature_dir`. In a real linear run, populate missing inputs via Lookup/Load before checking research. For every research/spec document to be written, if `linear.document` identity is missing, follow artifact-store.md **Planning skills** Lookup steps 3–6 and Load any hit before dispatch/writing; preserve identity and use Conflict for replacement, then Save. Retain the printed mode and absolute paths across tool calls.
91
109
 
92
110
  ### Step 3: Check Existing Research
93
111
 
94
- List any existing files. If `feature-spec.md` exists, read it and ask user if they want to regenerate or enhance.
112
+ List any existing files. If `${spec_file}` exists, read it and ask user if they want to regenerate or enhance.
95
113
 
96
114
  ### Step 4: Handle Dry Run
97
115
 
@@ -117,14 +135,14 @@ Researchers: 7 (api-researcher, business-analyzer, tech-designer, ux-researcher,
117
135
 
118
136
  ## Files That Would Be Created
119
137
 
120
- - docs/plans/[feature-name]/research-external.md
121
- - docs/plans/[feature-name]/research-business.md
122
- - docs/plans/[feature-name]/research-technical.md
123
- - docs/plans/[feature-name]/research-ux.md
124
- - docs/plans/[feature-name]/research-security.md
125
- - docs/plans/[feature-name]/research-practices.md
126
- - docs/plans/[feature-name]/research-recommendations.md
127
- - docs/plans/[feature-name]/feature-spec.md
138
+ - ${research_dir}/research-external.md
139
+ - ${research_dir}/research-business.md
140
+ - ${research_dir}/research-technical.md
141
+ - ${research_dir}/research-ux.md
142
+ - ${research_dir}/research-security.md
143
+ - ${research_dir}/research-practices.md
144
+ - ${research_dir}/research-recommendations.md
145
+ - ${spec_file}
128
146
 
129
147
  ## Execution Model
130
148
 
@@ -165,7 +183,8 @@ cat {{package-root}}/skills/feature-research/templates/research-agents.md
165
183
  Use the prompts from `research-agents.md` with variables substituted:
166
184
 
167
185
  - `{{FEATURE_NAME}}` - The feature directory name
168
- - `{{FEATURE_DIR}}` - Full output directory path (`docs/plans/[feature-name]`)
186
+ - `{{FEATURE_DIR}}` - Resolved feature directory (`${feature_dir}`)
187
+ - `{{RESEARCH_<LENS>_FILE}}` - Absolute path from the executed resolver with kind `research-<lens>` and the same store override; in local mode these are `${feature_dir}/research-<lens>.md`, in linear mode `${feature_dir}/research/research-<lens>.md`
169
188
  - `{{FEATURE_DESCRIPTION}}` - The description provided (or feature name if none)
170
189
 
171
190
  #### Path A — Standalone sub-agents (`STANDALONE_MODE=true`, default)
@@ -208,14 +227,16 @@ If a child report is empty or contentless, record its `sessionID`, inspect the d
208
227
  After all 7 sub-agents complete, validate all `research-*.md` files:
209
228
 
210
229
  ```bash
211
- {{package-root}}/skills/feature-research/scripts/validate-research.sh docs/plans/[feature-name]
230
+ {{package-root}}/skills/feature-research/scripts/validate-research.sh "${feature_dir}" ${STORE_FLAG}
212
231
  ```
213
232
 
214
233
  If validation fails: message the relevant sub-agent to fix their output, wait for correction, rerun validation until pass.
215
234
 
235
+ In linear mode, after validation and fixes, follow artifact-store.md section **Planning skills** to Save each of the seven `research-<lens>` documents.
236
+
216
237
  ### Step 12: Read Research Results
217
238
 
218
- Read all 7 research files from `docs/plans/[feature-name]/`.
239
+ Read all 7 research files from `${research_dir}/`.
219
240
 
220
241
  ### Step 13: Read Spec Template
221
242
 
@@ -225,7 +246,7 @@ cat {{package-root}}/skills/feature-research/templates/spec-structure.md
225
246
 
226
247
  ### Step 14: Generate feature-spec.md
227
248
 
228
- Create `docs/plans/[feature-name]/feature-spec.md` following the template.
249
+ Create `${spec_file}` following the template. In linear mode use `./research/research-<lens>.md` research links; in local mode use `./research-<lens>.md`. When replacing an existing spec, preserve its identity frontmatter in linear mode and replace only the body; local mode writes the body without frontmatter.
229
250
 
230
251
  **Key Consolidation Principles**:
231
252
 
@@ -245,11 +266,13 @@ Create `docs/plans/[feature-name]/feature-spec.md` following the template.
245
266
  Run after Step 14 creates `feature-spec.md`:
246
267
 
247
268
  ```bash
248
- {{package-root}}/skills/feature-research/scripts/validate-spec.sh docs/plans/[feature-name]/feature-spec.md
269
+ {{package-root}}/skills/feature-research/scripts/validate-spec.sh "${spec_file}" ${STORE_FLAG}
249
270
  ```
250
271
 
251
272
  Fix any issues reported (missing sections, empty content, formatting).
252
273
 
274
+ In linear mode, follow artifact-store.md section **Planning skills** to Save the validated `feature-spec` document. Local mode writes no identity frontmatter and makes no Linear calls.
275
+
253
276
  ### Step 17: Display Summary
254
277
 
255
278
  Provide completion summary with: feature name, description, dispatch mode (standalone sub-agents), files created, research summary counts, key findings, decisions needed, and next steps (review spec, proceed to `/ycc:plan-workflow`, or add requirements).
@@ -276,7 +299,7 @@ Each research file should: focus on its specific domain, include concrete exampl
276
299
 
277
300
  1. **Do NOT skip the multi-agent pipeline**: Never generate `feature-spec.md` directly without first deploying all 7 researchers (standalone sub-agents) and collecting their `research-*.md` files. The spec is a synthesis of research, not a standalone generation. If about to write `feature-spec.md` without the 7 research files already on disk, STOP — the pipeline is off-rails.
278
301
 
279
- 2. **Do NOT output to `docs/prps/`**: This skill's output directory is `docs/plans/[feature-name]/`. The `docs/prps/` tree belongs to the PRP workflow (`prp-prd`, `prp-spec`, `prp-plan`, `prp-implement`). Even if the user's working directory is `docs/prps/` or any subdirectory, always create output under `docs/plans/`.
302
+ 2. **Do NOT output to `docs/prps/`**: Write only to the resolved feature directory (`docs/plans/[feature-name]/` in local mode, `.ycc/artifacts/[feature-name]/` in linear mode). The `docs/prps/` tree belongs to the PRP workflow (`prp-prd`, `prp-spec`, `prp-plan`, `prp-implement`). Even if the user's working directory is `docs/prps/` or any subdirectory, always use the resolver-selected output path.
280
303
 
281
304
  3. **Do NOT generate a single file**: The minimum correct output is 8 files (7 research + 1 spec). If about to write only one file, STOP — the user likely wants the lightweight PRP spec skill. Redirect them to `/ycc:prp-spec`.
282
305