@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
@@ -19,21 +19,23 @@
19
19
 
20
20
  set -uo pipefail
21
21
 
22
- PLAN_FILE="${1:-}"
23
22
  ERRORS=0
24
23
  WARNINGS=0
25
24
 
26
- # Source the shared resolver to get PLANS_ROOT for file path validation
25
+ # Source the artifact-store resolver to get PLANS_ROOT/ARTIFACT_ROOT for path
26
+ # resolution and the store mode.
27
27
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
28
28
  SHARED_DIR="${SCRIPT_DIR}/../../../shared/scripts"
29
29
 
30
- if [[ -f "${SHARED_DIR}/resolve-plans-dir.sh" ]]; then
31
- # shellcheck source=../../../shared/scripts/resolve-plans-dir.sh
32
- source "${SHARED_DIR}/resolve-plans-dir.sh"
30
+ if [[ -f "${SHARED_DIR}/resolve-artifact-store.sh" ]]; then
31
+ # shellcheck source=../../../shared/scripts/resolve-artifact-store.sh
32
+ source "${SHARED_DIR}/resolve-artifact-store.sh"
33
+ # shellcheck source=../../../shared/scripts/artifact-body.sh
34
+ source "${SHARED_DIR}/artifact-body.sh"
33
35
  else
34
36
  # ponytail: resolver ships with the plugin; failing beats resolving a
35
37
  # relative plan path against the wrong cwd. Upgrade: restore the resolver.
36
- echo "ERROR: resolve-plans-dir.sh not found at ${SHARED_DIR}" >&2
38
+ echo "ERROR: resolve-artifact-store.sh not found at ${SHARED_DIR}" >&2
37
39
  echo "Cannot resolve PLANS_ROOT safely; refusing to guess." >&2
38
40
  exit 1
39
41
  fi
@@ -58,16 +60,44 @@ success() {
58
60
  echo -e "${GREEN}✓${NC} $1"
59
61
  }
60
62
 
63
+ PLAN_FILE=""
64
+ STORE_FLAG=""
65
+ while [[ $# -gt 0 ]]; do
66
+ case "$1" in
67
+ --store=*)
68
+ STORE_FLAG="$1"
69
+ ;;
70
+ *)
71
+ if [[ -z "$PLAN_FILE" ]]; then
72
+ PLAN_FILE="$1"
73
+ else
74
+ echo "Usage: validate-plan.sh <plan-file> [--store=linear|local]" >&2
75
+ exit 1
76
+ fi
77
+ ;;
78
+ esac
79
+ shift
80
+ done
81
+
82
+ if [[ -n "$STORE_FLAG" ]]; then
83
+ # shellcheck disable=SC2086
84
+ resolve_artifact_store "$PWD" "$STORE_FLAG" || {
85
+ echo "ERROR: invalid ${STORE_FLAG#--}" >&2
86
+ exit 1
87
+ }
88
+ fi
89
+
61
90
  if [[ -z "$PLAN_FILE" ]]; then
62
- echo "Usage: validate-plan.sh <plan-file>"
91
+ echo "Usage: validate-plan.sh <plan-file> [--store=linear|local]"
63
92
  echo ""
64
93
  echo "Validates the structure of a parallel implementation plan."
65
94
  exit 1
66
95
  fi
67
96
 
68
- # Always resolve relative paths against PLANS_ROOT
69
- if [[ "$PLAN_FILE" != /* && -n "${PLANS_ROOT:-}" ]]; then
70
- PLAN_FILE="${PLANS_ROOT}/${PLAN_FILE}"
97
+ # Resolve relative paths against the active artifact root: PLANS_ROOT in local
98
+ # mode, ARTIFACT_ROOT in linear mode.
99
+ if [[ "$PLAN_FILE" != /* && -n "${ARTIFACT_ROOT:-${PLANS_ROOT:-}}" ]]; then
100
+ PLAN_FILE="${ARTIFACT_ROOT:-$PLANS_ROOT}/${PLAN_FILE}"
71
101
  fi
72
102
 
73
103
  if [[ ! -f "$PLAN_FILE" ]]; then
@@ -78,12 +108,13 @@ fi
78
108
  echo "Validating plan structure: $PLAN_FILE"
79
109
  echo ""
80
110
 
81
- # Read file content
82
- CONTENT=$(cat "$PLAN_FILE")
111
+ # Read file content minus any leading frontmatter block (linear-mode identity
112
+ # metadata is not body; see _shared/references/artifact-store.md, Frontmatter).
113
+ CONTENT=$(artifact_body "$PLAN_FILE")
83
114
 
84
115
  # Title check
85
116
  echo "Checking document structure..."
86
- if echo "$CONTENT" | head -5 | grep -q "^# "; then
117
+ if grep -q "^# " <<<"$(head -n 5 <<<"$CONTENT")"; then
87
118
  success "Title present"
88
119
  else
89
120
  error "Missing title (# heading)"
@@ -108,7 +139,7 @@ fi
108
139
  # Critically Relevant Files section
109
140
  echo ""
110
141
  echo "Checking required sections..."
111
- if echo "$CONTENT" | grep -q "## Critically Relevant Files"; then
142
+ if grep -q "## Critically Relevant Files" <<<"$CONTENT"; then
112
143
  success "Critically Relevant Files section present"
113
144
 
114
145
  # Count files listed (absolute or relative paths)
@@ -123,14 +154,14 @@ else
123
154
  fi
124
155
 
125
156
  # Implementation Plan section
126
- if echo "$CONTENT" | grep -q "## Implementation Plan"; then
157
+ if grep -q "## Implementation Plan" <<<"$CONTENT"; then
127
158
  success "Implementation Plan section present"
128
159
  else
129
160
  error "Missing 'Implementation Plan' section"
130
161
  fi
131
162
 
132
163
  # Advice section
133
- if echo "$CONTENT" | grep -q "## Advice"; then
164
+ if grep -q "## Advice" <<<"$CONTENT"; then
134
165
  success "Advice section present"
135
166
 
136
167
  # Count advice items
@@ -148,7 +179,7 @@ fi
148
179
  # per-task **Worktree** lines are legacy and not required in new plans.
149
180
  echo ""
150
181
  echo "Checking optional worktree annotations..."
151
- if echo "$CONTENT" | grep -q "^## Worktree Setup"; then
182
+ if grep -q "^## Worktree Setup" <<<"$CONTENT"; then
152
183
  success "Worktree Setup section present (single feature worktree — see worktree-strategy.md)"
153
184
  WORKTREE_TASK_FIELDS=$(echo "$CONTENT" | grep -c '\*\*Worktree\*\*:' || true)
154
185
  success " $WORKTREE_TASK_FIELDS legacy per-task **Worktree** field(s) (expected 0 in new plans)"
@@ -87,12 +87,18 @@ Extract flags from `$ARGUMENTS`; the remainder is the PR selector.
87
87
  | `--ci-max-same-failure=N` | Bail after the same failure signature recurs N times (default 3). |
88
88
  | `--ci-timeout-min=N` | Wall-clock cap in minutes (default 30). |
89
89
  | `--ci-yes` | Skip the one-time CI authorization prompt (non-interactive callers). |
90
+ | `--store=local\|linear` | Artifact-store override for the local report path; kept verbatim as `STORE_FLAG` (empty when absent). |
90
91
 
91
92
  **Validation** (abort on any failure):
92
93
 
93
94
  - `--bot-only` and `--human-only` are mutually exclusive.
94
95
  - `--no-push` and `--ci` are mutually exclusive (CI cannot observe unpushed commits).
95
96
  - `--commit-style` must be `one` or `per-comment`.
97
+ - Artifact store: print the mode for the report with
98
+ `bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --shell "$(git rev-parse --show-toplevel)"`
99
+ and abort on a non-zero exit (for example `--store=liner`), before any fix,
100
+ commit or push. The report is a local-only kind, so no Linear call gate
101
+ applies (artifact-store.md > Review and report skills).
96
102
 
97
103
  ### PR resolution
98
104
 
@@ -125,6 +131,8 @@ Before the GitHub checks, detect the provider on `origin` (`forge_detect_provide
125
131
  | Working tree clean | Warn + ask the user: "Uncommitted changes detected — commit/stash before fixing? (yes/no/abort)" |
126
132
  | Local checkout = `HEAD_BRANCH` | If not, ask the user: "Switch to `<HEAD_BRANCH>` now? (yes/no)". On `no`, abort. |
127
133
 
134
+ A `.gitignore` whose only change adds the `.ycc/artifacts/` rule (left by a previous linear-mode report, Phase 8; the rule-only check in artifact-store.md > Reviews) does not count as uncommitted changes in any clean-tree or clean-index check: Phase 0 here, Phase 4 before each dispatch, and Phase 5 after each per-comment commit. Never stage it.
135
+
128
136
  If `--ci` was passed and any refusal fires, append: `--ci will not run because the autofix run cannot proceed.`
129
137
 
130
138
  ---
@@ -175,7 +183,7 @@ For each `Apply` entry, sanitize the body per `references/prompt-injection-safet
175
183
  ### Batching
176
184
 
177
185
  1. For `--commit-style one`: group same-file Apply entries in one fixer, sorted by line DESCENDING. Different-file groups parallelize with `--parallel`; order batches by severity: CRITICAL → HIGH → MEDIUM → LOW.
178
- 2. For `--commit-style per-comment`: dispatch one comment at a time, sequentially even with `--parallel`. Use the same severity-first, same-file line-DESC order; re-check each anchor against the current file. Before dispatch require a clean working tree and index. After each `Fixed`, run Phase 5's per-comment commit before dispatching the next comment.
186
+ 2. For `--commit-style per-comment`: dispatch one comment at a time, sequentially even with `--parallel`. Use the same severity-first, same-file line-DESC order; re-check each anchor against the current file. Before dispatch require a clean working tree and index (a `.gitignore` whose only change adds the `.ycc/artifacts/` rule does not count). After each `Fixed`, run Phase 5's per-comment commit before dispatching the next comment.
179
187
  3. For either mode, a Failed fixer with leftover edits stops dispatch and push for user review; never include those edits in another comment's commit or discard them automatically.
180
188
 
181
189
  ### Dispatch modes
@@ -192,7 +200,7 @@ Each fixer returns `STATUS: Fixed` or `STATUS: Failed` per comment, with `CHANGE
192
200
  If no fixer returned `Fixed`, create no commit. Otherwise:
193
201
 
194
202
  - `--commit-style one` (default): after all fixers finish, review the diff, stage only verified Fixed changes with `git add <files-touched>`, then `git commit -m "fix: apply PR review feedback (PR #${PR_NUMBER})"`. Uncommitted Failed changes require user review before staging/pushing.
195
- - `--commit-style per-comment`: commit immediately after each `Fixed` in Phase 4, before dispatching the next comment. Review only this comment's delta against its clean pre-dispatch state, validate the message, and `git add -- <this-comment-files>` (never stage all fixers). No delta (`CHANGES: none (already applied)`): record `Fixed`, create no empty commit. Any unexpected file or failed commit stops dispatch and push for user review. After each commit require a clean working tree and index. Message:
203
+ - `--commit-style per-comment`: commit immediately after each `Fixed` in Phase 4, before dispatching the next comment. Review only this comment's delta against its clean pre-dispatch state, validate the message, and `git add -- <this-comment-files>` (never stage all fixers). No delta (`CHANGES: none (already applied)`): record `Fixed`, create no empty commit. Any unexpected file or failed commit stops dispatch and push for user review. After each commit require a clean working tree and index (the rule-only `.gitignore` exemption from Phase 0 applies). Message:
196
204
 
197
205
  ```
198
206
  fix: address review comment from <author> on <path>:<line>
@@ -275,7 +283,14 @@ If everything was Deferred (no commit, no thread mutation), skip the summary ent
275
283
 
276
284
  ### Local report and final stdout
277
285
 
278
- Write the report to `$(git rev-parse --show-toplevel)/docs/prps/reports/pr-autofix-${PR_NUMBER}-$(date -u +%FT%H%M%SZ).md`, then print the final stdout. Both templates, and the Goal Signals block, are in `references/output-templates.md`. Print every Goal Signal verbatim as the last lines of Phase 8 output, one `KEY: PASS|FAIL` per line.
286
+ Resolve the report through the artifact store, kind `pr-autofix-report-<N>-<ts>`, using the same UTC stamp as before:
287
+
288
+ ```bash
289
+ TS="$(date -u +%FT%H%M%SZ)"
290
+ REPORT_PATH="$(bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --ensure --kind=pr-autofix-report-${PR_NUMBER}-${TS} --slug=<slug> "$(git rev-parse --show-toplevel)")"
291
+ ```
292
+
293
+ Slug: `pr-autofix` in local mode (validated only); in linear mode artifact-store.md Slugs rules 3-4 (lowercased `ARTIFACT_LINEAR_HINT`, else the sanitized `HEAD_BRANCH`), with no Linear calls. Local mode: unchanged path `$(git rev-parse --show-toplevel)/docs/prps/reports/pr-autofix-${PR_NUMBER}-<ts>.md`. Linear mode: `.ycc/artifacts/<slug>/reports/pr-autofix-<N>-<ts>.md` (gitignored); create its parent with `mkdir -p "$(dirname "$REPORT_PATH")"` before writing. The report is local-only in both modes (artifact-store.md > Review and report skills > Local-only reports): never pushed to Linear, never committed in linear mode, and a `.gitignore` change made by `--ensure` is never staged. When the rule-only `.gitignore` check (artifact-store.md > Reviews, run against the toplevel) holds, add the `.gitignore` line from the final stdout template; later runs ignore that change in their clean-tree checks. `--dry-run` writes no report. The `~/.config/opencode/session-data/ci-watch/` audit log is unchanged. Write the report to `$REPORT_PATH`, then print the final stdout (`Report:` shows the toplevel-relative path in local mode, as before). Both templates, and the Goal Signals block, are in `references/output-templates.md`. Print every Goal Signal verbatim as the last lines of Phase 8 output, one `KEY: PASS|FAIL` per line.
279
294
 
280
295
  ---
281
296
 
@@ -296,7 +311,7 @@ Write the report to `$(git rev-parse --show-toplevel)/docs/prps/reports/pr-autof
296
311
  - **NO_FORCE_PUSH**: no `git push --force` or `--force-with-lease` was issued.
297
312
  - **NO_NO_VERIFY**: no `git commit --no-verify` was issued.
298
313
  - **NO_RAW_PROMPTS_OUTBOUND**: no reviewer text appears verbatim in any reply, summary, or commit message; all outbound text passes the sanitizer.
299
- - **REPORT_CREATED**: `docs/prps/reports/pr-autofix-<N>-<ts>.md` exists.
314
+ - **REPORT_CREATED**: the resolved `$REPORT_PATH` exists (local mode: `docs/prps/reports/pr-autofix-<N>-<ts>.md`).
300
315
  - **CI_GREEN**: if `--ci` ran, the loop reached `RESULT=green` and Phase 8 stdout shows `Result: green`. `n/a` when `--ci` was not set.
301
316
  - **CI_BAIL_VISIBLE**: if `--ci` bailed, the report and stdout state the `bail-*` code and the cap/constraint that fired. `n/a` when `--ci` reached green or was not set.
302
317
 
@@ -61,7 +61,7 @@ For `Skip`, a second ask the user collects a free-form reason (max ~140 chars),
61
61
 
62
62
  ## Phase 8 local report
63
63
 
64
- Write to `$(git rev-parse --show-toplevel)/docs/prps/reports/pr-autofix-${PR_NUMBER}-$(date -u +%FT%H%M%SZ).md`:
64
+ Write to `$REPORT_PATH`, resolved in SKILL.md Phase 8 with kind `pr-autofix-report-<N>-<ts>` (local mode: unchanged `$(git rev-parse --show-toplevel)/docs/prps/reports/pr-autofix-${PR_NUMBER}-$(date -u +%FT%H%M%SZ).md`; linear mode: `.ycc/artifacts/<slug>/reports/pr-autofix-<N>-<ts>.md`, local-only and never pushed or committed):
65
65
 
66
66
  ```markdown
67
67
  # PR Autofix Report: PR #<N>
@@ -126,7 +126,8 @@ Write to `$(git rev-parse --show-toplevel)/docs/prps/reports/pr-autofix-${PR_NUM
126
126
  PR: #<PR_NUMBER>
127
127
  Branch: <HEAD_BRANCH>
128
128
  Mode: <Sequential|Parallel>
129
- Report: docs/prps/reports/pr-autofix-<N>-<ts>.md
129
+ Report: <local mode docs/prps/reports/pr-autofix-<N>-<ts>.md; linear mode absolute REPORT_PATH>
130
+ Gitignore: <linear mode only, when --ensure added it: .gitignore gained the .ycc/artifacts/ rule; leave it out of commits>
130
131
 
131
132
  ### Comments
132
133
  Fetched: T
@@ -42,7 +42,6 @@ VERSION="1.0.0"
42
42
 
43
43
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
44
44
  FORGE_LIB="${SCRIPT_DIR}/../../../shared/scripts/lib/forge.sh"
45
- [[ -f "$FORGE_LIB" ]] || FORGE_LIB="${SCRIPT_DIR}/../../../shared/scripts/lib/forge.sh"
46
45
  # shellcheck source=/dev/null
47
46
  source "$FORGE_LIB"
48
47
 
@@ -131,7 +130,7 @@ done
131
130
  require_arg "--pr" "$PR"
132
131
  require_arg "--out" "$OUT"
133
132
 
134
- if ! printf '%s' "$PR" | grep -qE '^[0-9]+$'; then
133
+ if ! grep -qE '^[0-9]+$' <<<"$PR"; then
135
134
  printf 'fetch-pr-comments.sh: --pr must be a positive integer, got: %s\n' "$PR" >&2
136
135
  exit 1
137
136
  fi
@@ -41,7 +41,6 @@ VERSION="1.0.0"
41
41
 
42
42
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
43
43
  FORGE_LIB="${SCRIPT_DIR}/../../../shared/scripts/lib/forge.sh"
44
- [[ -f "$FORGE_LIB" ]] || FORGE_LIB="${SCRIPT_DIR}/../../../shared/scripts/lib/forge.sh"
45
44
  # shellcheck source=/dev/null
46
45
  source "$FORGE_LIB"
47
46
 
@@ -129,7 +128,7 @@ for pair in "pr:$PR" "fixed:$FIXED" "failed:$FAILED" "skipped:$SKIPPED" "deferre
129
128
  "ci-iterations:$CI_ITERATIONS" "ci-pushes:$CI_PUSHES"; do
130
129
  label="${pair%%:*}"
131
130
  value="${pair#*:}"
132
- if ! printf '%s' "$value" | grep -qE '^[0-9]+$'; then
131
+ if ! grep -qE '^[0-9]+$' <<<"$value"; then
133
132
  printf 'post-summary.sh: --%s must be a non-negative integer, got: %s\n' "$label" "$value" >&2
134
133
  exit 1
135
134
  fi
@@ -42,7 +42,6 @@ VERSION="1.0.0"
42
42
 
43
43
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
44
44
  FORGE_LIB="${SCRIPT_DIR}/../../../shared/scripts/lib/forge.sh"
45
- [[ -f "$FORGE_LIB" ]] || FORGE_LIB="${SCRIPT_DIR}/../../../shared/scripts/lib/forge.sh"
46
45
  # shellcheck source=/dev/null
47
46
  source "$FORGE_LIB"
48
47
 
@@ -114,11 +113,11 @@ cmd_reply() {
114
113
  require_arg "root_comment_id" "$root_id"
115
114
  require_arg "body" "$body"
116
115
 
117
- if ! printf '%s' "$pr" | grep -qE '^[0-9]+$'; then
116
+ if ! grep -qE '^[0-9]+$' <<<"$pr"; then
118
117
  printf 'resolve-thread.sh: pr_number must be a positive integer, got: %s\n' "$pr" >&2
119
118
  exit 1
120
119
  fi
121
- if ! printf '%s' "$root_id" | grep -qE '^[0-9]+$'; then
120
+ if ! grep -qE '^[0-9]+$' <<<"$root_id"; then
122
121
  printf 'resolve-thread.sh: root_comment_id must be a positive integer, got: %s\n' "$root_id" >&2
123
122
  exit 1
124
123
  fi
@@ -139,7 +138,7 @@ cmd_issue_reply() {
139
138
  require_arg "pr_number" "$pr"
140
139
  require_arg "body" "$body"
141
140
 
142
- if ! printf '%s' "$pr" | grep -qE '^[0-9]+$'; then
141
+ if ! grep -qE '^[0-9]+$' <<<"$pr"; then
143
142
  printf 'resolve-thread.sh: pr_number must be a positive integer, got: %s\n' "$pr" >&2
144
143
  exit 1
145
144
  fi
@@ -9,7 +9,7 @@ description: Executes PRP plan files with validation loops, reports, and archivi
9
9
 
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
- Execute a plan file step-by-step with continuous validation. Every change is verified immediately; never accumulate broken state. Detect the package manager, prepare the Git branch, execute tasks, validate static/unit/build/integration/edge cases, write `docs/prps/reports/`, and archive the plan. Detect parallel-capable plans and prompt for execution mode unless a flag selects it.
12
+ Execute a plan file step-by-step with continuous validation. Every change is verified immediately; never accumulate broken state. Detect the package manager, prepare the Git branch, execute tasks, validate static/unit/build/integration/edge cases, write `docs/prps/reports/`, and archive the plan (linear mode: see Phase 5). Detect parallel-capable plans and prompt for execution mode unless a flag selects it.
13
13
 
14
14
  > Adapted from PRPs-agentic-eng by Wirasm. Part of the PRP workflow series.
15
15
 
@@ -29,17 +29,21 @@ Execute a plan file step-by-step with continuous validation. Every change is ver
29
29
 
30
30
  Extract flags from `$ARGUMENTS` before treating the remainder as a plan path:
31
31
 
32
- | Flag | Effect |
33
- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
34
- | `--parallel` | Force standalone parallel execution when the plan has `Batches`; skip the prompt. Otherwise warn and fall back to sequential. Works in opencode, Cursor, Codex. |
35
- | `--worktree` | Silent legacy no-op; isolation is on by default. |
36
- | `--no-worktree` | Force worktree mode off regardless of annotations; use the prepared current checkout. |
32
+ | Flag | Effect |
33
+ | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
34
+ | `--parallel` | Force standalone parallel execution when the plan has `Batches`; skip the prompt. Otherwise warn and fall back to sequential. Works in opencode, Cursor, Codex. |
35
+ | `--worktree` | Silent legacy no-op; isolation is on by default. |
36
+ | `--no-worktree` | Force worktree mode off regardless of annotations; use the prepared current checkout. |
37
+ | `--store=local\|linear` | Artifact store override; strip it, retain as `STORE_FLAG` (empty when absent), and forward it to every resolver call. See artifact-store.md **Implementation skills**. |
37
38
 
38
- Set `PARALLEL_FLAG=true|false`, ``, `WORKTREE_MODE=true|false`, `DRY_RUN=true|false`. The remaining text is the plan file path.
39
+ Set `PARALLEL_FLAG=true|false`, ``, `WORKTREE_MODE=true|false`, `DRY_RUN=true|false`. The remaining text is the plan input: a plan path, a cached linear plan path, or a Linear reference. `{{package-root}}/shared/references/artifact-store.md` **Implementation skills > Inputs** defines issue keys, references, linear plan paths and which of them select linear mode (an existing local plan path wins). If the input is a Linear reference or linear plan path and `STORE_FLAG` is empty, set `STORE_FLAG=--store=linear` before the first resolver call and forward it to every later call, per that contract.
40
+
41
+ Existing local plans keep local mode (Inputs): when `STORE_FLAG` is empty and `bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" --shell` prints `ARTIFACT_STORE_SOURCE=default`, a plan path that is not a linear plan path sets `STORE_FLAG=--store=local`; print `Using local plan at <path>; pin with store: local in .plans-config`.
39
42
 
40
43
  Validation (abort with these exact messages):
41
44
 
42
45
  - Both `--worktree` and `--no-worktree`: `--worktree and --no-worktree are mutually exclusive. Use --no-worktree to opt out of the default.`
46
+ - `--store=local` with a Linear reference or linear plan path: `A Linear plan reference requires linear mode; drop --store=local.`
43
47
 
44
48
 
45
49
  ### Package Manager and Validation Scripts
@@ -52,13 +56,14 @@ Read `{{package-root}}/shared/references/standalone-dispatch.md` for standalone
52
56
 
53
57
  ## Phase 1 — LOAD
54
58
 
55
- Read the stripped plan path (`PLAN_PATH`); extract Summary, Patterns to Mirror, Files to Change, Step-by-Step Tasks, Validation Commands, Acceptance Criteria. Missing or invalid plan:
59
+ Local mode: read the stripped plan path (`PLAN_PATH`) exactly as before; extract Summary, Patterns to Mirror, Files to Change, Step-by-Step Tasks, Validation Commands, Acceptance Criteria. Missing or invalid plan:
56
60
 
57
61
  ```
58
62
  Error: Plan file not found or invalid.
59
63
  Run /ycc:prp-plan <feature-description> to create a plan first.
60
64
  ```
61
65
 
66
+ Linear mode: follow artifact-store.md **Implementation skills > Resolve and hydrate** for kind `prp-plan` before branch preparation (`resolve-artifact-store.sh ${STORE_FLAG} --shell`, reading `ARTIFACT_STORE=`; Linear call gate; Lookup; Load); set `PLAN_PATH` to the absolute cache path and read its `tasks` map (rebuilt in memory when missing). If `DRY_RUN=true`, do not use `--ensure`, write the cache, or run Load's push/Conflict steps: reuse an existing cache file read-only, or fetch the body into a `mktemp` file outside the repository and use that as `PLAN_PATH`. A missing plan follows Lookup step 7 (ask, listing what was tried) — never report "not found" without querying Linear. Parse the selected file as above.
62
67
  Read `references/detection.md` (Parallel-Capable Detection and Execution Mode Decision) now. A `## Batches` section makes the plan parallel-capable: parse its ordering and task `BATCH:` fields. Select sequential or parallel standalone execution; record `EXECUTION_MODE=sequential|parallel`.
63
68
 
64
69
 
@@ -66,17 +71,22 @@ Read `references/detection.md` (Parallel-Capable Detection and Execution Mode De
66
71
  Apply the common worktree precedence/deduction in standalone-dispatch.md §8.1. Scan the plan's worktree annotations:
67
72
 
68
73
  ```bash
69
- grep -c "^## Worktree Setup" "$PLAN_PATH" || echo 0
70
- grep -c "^\- \*\*Worktree\*\*:" "$PLAN_PATH" || echo 0
74
+ # grep -c prints the count itself; exit 1 only means zero matches, so
75
+ # exit codes 0 and 1 both leave exactly one integer on stdout. A status
76
+ # above 1 (unreadable/missing file) is a real error and makes the line fail.
77
+ grep -c "^## Worktree Setup" "$PLAN_PATH"; [ $? -le 1 ]
78
+ grep -c "^\- \*\*Worktree\*\*:" "$PLAN_PATH"; [ $? -le 1 ]
71
79
  ```
72
80
 
73
- With a parent annotation, use its path before whitespace/comment and slug segment after `<repo>-`. Otherwise derive `WT_FEATURE_SLUG` from plan basename: strip `.plan.md`, lowercase, replace `[^a-z0-9-]` with `-`, collapse runs, truncate to 40 chars. `WORKTREE_ACTIVE` follows common mode selection; sequential tasks use the parent execution tree too.
81
+ Local mode: with a parent annotation, use its path before whitespace/comment and slug segment after `<repo>-`. Otherwise derive `WT_FEATURE_SLUG` from plan basename: strip `.plan.md`, lowercase, replace `[^a-z0-9-]` with `-`, collapse runs, truncate to 40 chars. In linear mode derive `WT_FEATURE_SLUG` from the cache slug, never from the cache basename (`prp-plan.md`), using artifact-store.md **Resolve and hydrate** step 4: lowercase, replace `[^a-z0-9-]` with `-`, collapse runs, trim `-`, truncate to 40 characters, and fall back to `untitled` if empty. Keep the raw cache slug for every resolver `--slug=` call. `WORKTREE_ACTIVE` follows common mode selection; sequential tasks use the parent execution tree too.
74
82
 
75
83
  **CHECKPOINT**: Plan loaded. All sections identified. Tasks extracted. Parallel capability detected. Execution mode chosen.
76
84
 
77
85
  ## Phase 2 — PREPARE
78
86
 
79
- Follow standalone-dispatch.md §8.2 for Git-state inspection, required branch preparation, one-time parent worktree setup, and one-way plan relocation. Input plan is the stripped `$ARGUMENTS`; optional companion artifacts ride as extra move arguments. Retain `$PLAN_PATH` as the canonical path for validation, prompts, report, and archive. All subsequent git operations and writes run in `$WT_PARENT_PATH` when active; `--no-worktree` uses the prepared current checkout.
87
+ In linear mode with `DRY_RUN=true`, skip this entire phase: no branch preparation, worktree setup, artifact relocation, or remote sync. Continue to Phase 3's dry-run roster output with the read-only or temporary `PLAN_PATH` from Phase 1.
88
+
89
+ Follow standalone-dispatch.md §8.2 for Git-state inspection, required branch preparation, and one-time parent worktree setup. Local mode keeps the one-way plan relocation; linear mode skips `move-plan-to-worktree.sh` — the plan is not moved into the worktree and worktree tasks read the absolute cache `$PLAN_PATH`. In linear mode the cache is gitignored and the only expected dirty path is a `.gitignore` whose sole change appends one `.ycc/artifacts/` rule line, which branch preparation accepts. Input plan is the stripped `$ARGUMENTS`; optional companion artifacts ride as extra move arguments (local only). Retain `$PLAN_PATH` as the canonical path for validation, prompts, report, and archive/completion. All subsequent git operations and writes run in `$WT_PARENT_PATH` when active; `--no-worktree` uses the prepared current checkout.
80
90
 
81
91
  Sync remote after preparation in the execution tree:
82
92
 
@@ -88,7 +98,7 @@ git pull --rebase origin $(git branch --show-current) 2>/dev/null || true
88
98
 
89
99
  ## Phase 3 — EXECUTE
90
100
 
91
- Branch on `EXECUTION_MODE` chosen in Phase 1.
101
+ Branch on `EXECUTION_MODE` chosen in Phase 1. In linear mode, read `references/linear-sync.md` now and apply it (orchestrator only; `implementor` subagents never call Linear).
92
102
 
93
103
  ### Path A — Sequential Execution
94
104
 
@@ -140,14 +150,18 @@ Read `references/validation-and-failures.md` now. Run every level in order; fix
140
150
 
141
151
  ## Phase 5 — REPORT
142
152
 
143
- Read `references/report-output.md` now for report template, PRD update, archive commands, and worktree section.
153
+ Read `references/report-output.md` now for report template, PRD update, archive/completion commands, and worktree section.
154
+
155
+ Local mode (unchanged):
144
156
 
145
157
  1. Create `docs/prps/reports/{plan-name}-report.md`, including assessment vs reality, task status, all validation levels, changed files, verbatim deviations, issues, tests, next steps.
146
158
  2. If a PRD phase: change `in-progress` to `complete`, add report path.
147
159
  3. Archive canonical `$PLAN_PATH` to its sibling `completed/` inside the execution tree (fallback to stripped `$ARGUMENTS` under `--no-worktree`).
148
160
  4. If `WORKTREE_ACTIVE=true`, capture `list-worktrees.sh` output after archive; include full table and cleanup commands under `## Worktree Summary` in the report.
149
161
 
150
- **CHECKPOINT**: Report created. PRD updated. Plan archived. Worktree summary captured (if applicable).
162
+ Linear mode: resolve the report with `bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --ensure --kind=prp-report --slug=<slug>` (`<slug>` = cache parent directory name), write it there, and complete per `references/linear-sync.md` instead of the archive move.
163
+
164
+ **CHECKPOINT**: Report created. PRD updated. Plan archived (local) or Linear completion applied (linear). Worktree summary captured (if applicable).
151
165
 
152
166
  ## Phase 6 — OUTPUT
153
167
 
@@ -165,7 +179,7 @@ Read `references/validation-and-failures.md` when any type-check, test, lint, bu
165
179
  - **TESTS_PASS**: All tests green, new tests written.
166
180
  - **BUILD_PASS**: Build succeeds.
167
181
  - **REPORT_CREATED**: Implementation report saved.
168
- - **PLAN_ARCHIVED**: Plan moved to `docs/prps/plans/completed/`.
182
+ - **PLAN_ARCHIVED**: Local: plan moved to `docs/prps/plans/completed/`. Linear: parent tracking issue and every tracked task issue are `completed` (or `canceled`) and the Project status update was posted (see `references/linear-sync.md`).
169
183
 
170
184
  ## /goal pairing and Next Steps
171
185
 
@@ -174,6 +188,7 @@ Read `references/report-output.md` (Goal pairing) for the condition template; re
174
188
  ## References — read when
175
189
 
176
190
  - `references/detection.md`: Phase 0 package manager/scripts and Phase 1 parallel detection/mode selection.
191
+ - `references/linear-sync.md`: linear-mode status sync, report Save, completion, and offline replay (Phase 3/5).
177
192
  - `references/agent-task-prompt.md`: once before parallel implementor dispatch.
178
193
  - `references/validation-and-failures.md`: Phase 4 validation and any failed check.
179
194
  - `references/report-output.md`: Phase 5 report/PRD/archive, Phase 6 user output, or `/goal` condition.
@@ -13,7 +13,7 @@ Read once before parallel or agent-team dispatch. Substitute complete task detai
13
13
  ```text
14
14
  Implement {{TASK_ID}}: {{TASK_TITLE}}
15
15
 
16
- Plan: {{PLAN_PATH}}
16
+ Plan: {{PLAN_PATH}} (absolute, read-only)
17
17
  Patterns to Mirror:
18
18
  {{PATTERNS_TO_MIRROR}}
19
19
 
@@ -25,6 +25,8 @@ apply GOTCHA warnings and use specified IMPORTS. Implement only this task.
25
25
  Run your own type-check on modified files before reporting complete.
26
26
  Report files created/modified, validation results, issues and deviations
27
27
  verbatim (what changed and why).
28
+ Never edit the plan or its frontmatter, and never call Linear MCP or other
29
+ external tracker tools; report status only to the orchestrator.
28
30
 
29
31
  {{WORKING_DIRECTORY_LINES}}
30
32
  {{TEAM_COMPLETION_DIRECTIVE}}
@@ -32,5 +34,6 @@ verbatim (what changed and why).
32
34
 
33
35
  `WORKING_DIRECTORY_LINES`: use shared execution-directory prompt contract, for
34
36
  both parallel and sequential tasks. Treat that directory as repo root for all
35
- Read / Write / Edit / Bash calls; no per-agent worktree isolation.
37
+ writes and for reads of files not supplied by absolute path (the plan path may
38
+ lie outside it); no per-agent worktree isolation.
36
39
  to call `update the todo tracker` to mark its own registered task complete.
@@ -27,7 +27,10 @@ Note available commands for: type-check, lint, test, build.
27
27
  After reading the plan, check whether it was written in parallel mode by looking for a `## Batches` section:
28
28
 
29
29
  ```bash
30
- grep -c "^## Batches" "$PLAN_PATH" || echo 0
30
+ # grep -c prints the count itself; exit 1 only means zero matches. Exit codes
31
+ # 0 and 1 both leave exactly one integer on stdout; a status above 1
32
+ # (unreadable or missing file) is a real read error and makes the line fail.
33
+ grep -c "^## Batches" "$PLAN_PATH"; [ $? -le 1 ]
31
34
  ```
32
35
 
33
36
  - **Count > 0** → Plan is **parallel-capable**. Parse the `Batches` table to extract batch ordering and `BATCH:` fields from tasks.
@@ -0,0 +1,25 @@
1
+ # PRP Linear Sync (linear mode only)
2
+
3
+ Canonical rules: `{{package-root}}/shared/references/artifact-store.md` **Implementation skills** (Status sync, Report and completion, Offline). This file only adapts them to prp-implement's phases. Local mode never reads this file and makes no Linear calls. Only the orchestrating skill calls Linear MCP; `implementor` subagents never do. Move issues by state type, never team-specific state names, and never move an issue backwards, reopen it, change its assignee, or touch issues outside the plan's `tasks` map and parent.
4
+
5
+ ## Run start
6
+
7
+
8
+ ## Phase 3 status sync
9
+
10
+ - Sequential (Path A): before each task, its issue → `started` when `backlog`/`unstarted`/`triage`; after that task's Phase 0 type-check passes, its issue → `completed`.
11
+ - Parallel/team: at batch dispatch, every task issue in the batch → `started` (same guard); after the between-batch validation (type-check + affected tests) passes, every issue in that batch → `completed`.
12
+ - Failure (task or batch): leave the issue `started`; add one comment with the task id, the failing check, and a short excerpt — never secrets or full logs.
13
+ - Re-run: a task whose issue is already `completed` is treated as done and skipped; a `canceled` issue's task is skipped as removed. Print both in the summary. A task with no issue still runs; list it as untracked in the report and suggest re-saving the plan with its planning skill.
14
+ - After every state change or failure comment, apply the contract's Timestamps rule (fetch `updatedAt` first; re-stamp `tasks.<id>.updatedAt` only when it matched the stored stamp).
15
+
16
+ ## Phase 5 report and completion
17
+
18
+ 1. Resolve the report path: `bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --ensure --kind=prp-report --slug=<slug>`; write the report there (same content as the local report template). Do this on failure as well as success.
19
+ 2. Save it: post one Project status update with health `onTrack` when every task passed, `atRisk` otherwise; when the report exceeds the status-update size, also save it as a Document (`<slug> · report`). Record `linear.statusUpdate` (and `linear.document` when long) in the report cache file's frontmatter.
20
+ 3. Replace the archive move: parent tracking issue → `completed` once all tasks pass final validation. Complete the Project only under the contract's Project completion rule (name equals the plan slug, carries `ARTIFACT_LINEAR_LABEL` when set, not `ARTIFACT_LINEAR_PROJECT`, every issue `completed` or `canceled`); otherwise leave it open and say why in the report/summary.
21
+ 4. `PLAN_ARCHIVED: PASS` in linear mode means: parent tracking issue and every tracked task issue are `completed` (or `canceled`) and the Project status update was posted.
22
+
23
+ ## Offline
24
+
25
+ If the MCP becomes unreachable mid-run, keep implementing. At the moment a transition fails, resolve the report path with `--ensure`, append it under `## Linear sync pending` in that file and set `pending: true`; the final report merges into the same file. Print the list. The next run on the same plan replays the pending transitions before dispatching, following artifact-store.md **Offline**.
@@ -11,12 +11,16 @@
11
11
 
12
12
  ## Implementation report
13
13
 
14
+ Local mode:
15
+
14
16
  ```bash
15
17
  mkdir -p docs/prps/reports
16
18
  ```
17
19
 
18
20
  Write report to `docs/prps/reports/{plan-name}-report.md`:
19
21
 
22
+ Linear mode: resolve the report path instead with `resolve-artifact-store.sh ${STORE_FLAG} --ensure --kind=prp-report --slug=<slug>` and write it there; Save and completion follow `references/linear-sync.md`. Content below is the same in both modes.
23
+
20
24
  ```markdown
21
25
  # Implementation Report: [Feature Name]
22
26
 
@@ -85,7 +89,7 @@ If this implementation was for a PRD phase:
85
89
  1. Update the phase status from `in-progress` to `complete`
86
90
  2. Add report path as reference
87
91
 
88
- ### Archive Plan
92
+ ### Archive Plan (local mode only)
89
93
 
90
94
  Run inside `$WT_PARENT_PATH` (when `WORKTREE_ACTIVE=true`) so the archive lives next to the implementation report, not back in main. `$PLAN_PATH` is the relocated plan path set in Phase 2; if the run was `--no-worktree` it falls back to `$ARGUMENTS`.
91
95
 
@@ -95,6 +99,8 @@ mkdir -p "$(dirname -- "$PLAN_PATH")/completed"
95
99
  mv "$PLAN_PATH" "$(dirname -- "$PLAN_PATH")/completed/"
96
100
  ```
97
101
 
102
+ Linear mode has no archive move: close the parent issue and apply the Project-completion rule per `references/linear-sync.md`.
103
+
98
104
  ### Worktree Summary (when `WORKTREE_ACTIVE=true`)
99
105
 
100
106
  After archiving the plan, run:
@@ -110,7 +116,7 @@ Include the full output (markdown table + cleanup commands) in the implementatio
110
116
 
111
117
  ## User output and Goal Signals
112
118
 
113
- Report to user:
119
+ Report to user (linear mode: print `[plan Document URL] → issues closed` instead of the archive path on the **Plan** line, and use the Linear Artifacts section):
114
120
 
115
121
  ```
116
122
  ## Implementation Complete
@@ -143,6 +149,11 @@ Report to user:
143
149
  - Report: `docs/prps/reports/{name}-report.md`
144
150
  - Archived Plan: `docs/prps/plans/completed/{name}.plan.md`
145
151
 
152
+ ### Linear Artifacts ← include this section only when ARTIFACT_STORE=linear (omit the two Artifacts lines above)
153
+
154
+ - Report: [Linear Project / status update URL, or pending]
155
+ - Plan: [Linear plan Document URL] (not archived; parent issue completed)
156
+
146
157
  ### PRD Progress (if applicable)
147
158
 
148
159
  | Phase | Status |
@@ -188,6 +199,8 @@ PLAN_ARCHIVED: PASS. If any signal prints FAIL, keep fixing and re-running valid
188
199
  until all seven are PASS. Stop after 25 turns if not achieved.
189
200
  ```
190
201
 
202
+ In linear mode, replace the plan path with the Linear reference or cached plan path; `PLAN_ARCHIVED` then means what SKILL.md Success Criteria says for linear mode.
203
+
191
204
  The transcript-output contract and shared caveats (worktree cwd, interactive failure
192
205
  prompts, platform availability) live in the shared reference — read it before relying on a
193
206
  `/goal` loop: