@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
@@ -83,17 +83,17 @@ categorize_file() {
83
83
  local file="$1"
84
84
 
85
85
  # Test files
86
- if echo "$file" | grep -qE '(test|spec|__tests__|\.test\.|\.spec\.)'; then
86
+ if grep -qE '(test|spec|__tests__|\.test\.|\.spec\.)' <<<"$file"; then
87
87
  return 1
88
88
  fi
89
89
 
90
90
  # Documentation files
91
- if echo "$file" | grep -qE '\.(md|txt|rst|adoc)$|^docs/'; then
91
+ if grep -qE '\.(md|txt|rst|adoc)$|^docs/' <<<"$file"; then
92
92
  return 2
93
93
  fi
94
94
 
95
95
  # Config files
96
- if echo "$file" | grep -qE '\.(json|yaml|yml|toml|ini|conf|config)$|^\.|package\.json|tsconfig|eslint|prettier'; then
96
+ if grep -qE '\.(json|yaml|yml|toml|ini|conf|config)$|^\.|package\.json|tsconfig|eslint|prettier' <<<"$file"; then
97
97
  return 3
98
98
  fi
99
99
 
@@ -111,8 +111,9 @@ ALL_CHANGED_FILES=$(
111
111
  # Categorize each file
112
112
  while IFS= read -r file; do
113
113
  if [ -n "$file" ]; then
114
- categorize_file "$file"
115
- case $? in
114
+ rc=0
115
+ categorize_file "$file" || rc=$?
116
+ case "$rc" in
116
117
  0) SOURCE_FILES=$((SOURCE_FILES + 1)) ;;
117
118
  1) TEST_FILES=$((TEST_FILES + 1)) ;;
118
119
  2) DOC_FILES=$((DOC_FILES + 1)) ;;
@@ -157,7 +158,10 @@ echo ""
157
158
  if [ "$UNIQUE_DIRS" -gt 0 ]; then
158
159
  echo -e "${GREEN}Changed Directories:${NC}"
159
160
  echo "$ALL_CHANGED_FILES" | grep -v '^$' | xargs -r dirname | sort -u | while IFS= read -r dir; do
160
- file_count=$(echo "$ALL_CHANGED_FILES" | grep -c "^${dir}/" || echo "0")
161
+ # Count by fixed-string prefix: dir comes from the filesystem and may
162
+ # contain regex metacharacters (e.g. app/[[...slug]]), so grep would
163
+ # either miscount or fail with exit 2. awk index() cannot fail.
164
+ file_count=$(awk -v p="${dir}/" 'index($0, p) == 1 {n++} END {print n + 0}' <<<"$ALL_CHANGED_FILES")
161
165
  echo " - $dir/ ($file_count files)"
162
166
  done
163
167
  echo ""
@@ -176,14 +180,17 @@ fi
176
180
  show_files_by_category() {
177
181
  local category="$1"
178
182
  local pattern="$2"
179
- local files
183
+ local files rc
180
184
 
181
185
  if [ "$category" = "Source" ]; then
182
186
  # Source files are those that don't match other patterns
183
187
  files=$(echo "$ALL_CHANGED_FILES" | while IFS= read -r file; do
184
188
  if [ -n "$file" ]; then
185
- categorize_file "$file"
186
- [ $? -eq 0 ] && echo "$file"
189
+ rc=0
190
+ categorize_file "$file" || rc=$?
191
+ if [ "$rc" -eq 0 ]; then
192
+ echo "$file"
193
+ fi
187
194
  fi
188
195
  done)
189
196
  else
@@ -239,14 +246,17 @@ else
239
246
  echo "Potential agent scopes:"
240
247
  echo "$ALL_CHANGED_FILES" | grep -v '^$' | xargs -r dirname | sort | uniq -c | sort -rn | head -5 | while read -r count dir; do
241
248
  scope=$(basename "$dir")
242
- [ "$scope" != "." ] && echo " - Agent for: $scope ($count files)"
249
+ if [ "$scope" != "." ]; then
250
+ echo " - Agent for: $scope ($count files)"
251
+ fi
243
252
  done
244
253
  echo ""
245
254
  fi
246
255
 
247
256
  # Check for common patterns that might need documentation
248
257
  NEEDS_DOCS=false
249
- if echo "$ALL_CHANGED_FILES" | grep -qE '^(src/|lib/|app/)'; then
258
+ # A here-string avoids SIGPIPE from an early grep match under pipefail.
259
+ if grep -qE '^(src/|lib/|app/)' <<<"$ALL_CHANGED_FILES"; then
250
260
  if [ "$SOURCE_FILES" -ge 3 ]; then
251
261
  NEEDS_DOCS=true
252
262
  fi
@@ -61,11 +61,9 @@ fi
61
61
  # Detect the forge provider and select the matching CLI (gh / tea / glab).
62
62
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
63
63
  FORGE_LIB="${SCRIPT_DIR}/../../../shared/scripts/lib/forge.sh"
64
- [[ -f "$FORGE_LIB" ]] || FORGE_LIB="${SCRIPT_DIR}/../../../shared/scripts/lib/forge.sh"
65
64
  # shellcheck source=/dev/null
66
65
  source "$FORGE_LIB"
67
66
  PR_GUARD="${SCRIPT_DIR}/../../../shared/scripts/pr-guard.sh"
68
- [[ -f "$PR_GUARD" ]] || PR_GUARD="${SCRIPT_DIR}/../../../shared/scripts/pr-guard.sh"
69
67
 
70
68
  PROVIDER="$(forge_detect_provider origin)"
71
69
  FORGE_CLI="$(forge_cli "$PROVIDER")"
@@ -220,7 +218,7 @@ else
220
218
  # Try to extract type and scope from first commit
221
219
  FIRST_COMMIT=$(git log --format=%s -n1 HEAD)
222
220
 
223
- if echo "$FIRST_COMMIT" | grep -qE '^[a-z]+(\([a-z0-9-]+\))?:'; then
221
+ if grep -qE '^[a-z]+(\([a-z0-9-]+\))?:' <<<"$FIRST_COMMIT"; then
224
222
  TYPE=$(echo "$FIRST_COMMIT" | grep -oE '^[a-z]+')
225
223
  SCOPE=$(echo "$FIRST_COMMIT" | grep -oE '\([a-z0-9-]+\)' | tr -d '()' || echo "")
226
224
 
@@ -256,9 +254,13 @@ else
256
254
  fi
257
255
  echo ""
258
256
 
259
- # Check for breaking changes in commits
257
+ # Check for breaking changes in commits. Capture git log output first and
258
+ # match with a here-string, not `git log | grep -q`: under pipefail the
259
+ # early-exiting grep SIGPIPEs git once the log exceeds the pipe buffer and a
260
+ # present BREAKING CHANGE reads as absent (YAN-1587).
261
+ COMMIT_MESSAGES=$(git log --format=%B "$MERGE_BASE..HEAD")
260
262
  echo -e "${GREEN}Breaking Changes:${NC}"
261
- if git log --format=%B "$MERGE_BASE..HEAD" | grep -qE 'BREAKING CHANGE:|^[a-z]+(\([a-z0-9-]+\))?!:'; then
263
+ if grep -qE 'BREAKING CHANGE:|^[a-z]+(\([a-z0-9-]+\))?!:' <<<"$COMMIT_MESSAGES"; then
262
264
  echo " ⚠ Breaking changes detected in commits"
263
265
  { git log --format=%s "$MERGE_BASE..HEAD" | grep -E '^[a-z]+(\([a-z0-9-]+\))?!:' || true; } | while IFS= read -r line; do
264
266
  echo " - $line"
@@ -335,6 +337,49 @@ else
335
337
  echo ""
336
338
  fi
337
339
 
340
+ # Related issues: Linear branch hints and commit keys from the shared helper,
341
+ # filtered by ARTIFACT_LINEAR_TEAM, plus GitHub issues referenced in commits.
342
+ # See _shared/references/artifact-store.md "PR linking". Missing or failing
343
+ # helpers never prevent PR creation; session-aware plan links are added by callers.
344
+ LINEAR_KEYS_SCRIPT="${SCRIPT_DIR}/../../../shared/scripts/collect-linear-keys.sh"
345
+ RESOLVE_STORE_SCRIPT="${SCRIPT_DIR}/../../../shared/scripts/resolve-artifact-store.sh"
346
+
347
+ LINEAR_TEAM="${ARTIFACT_LINEAR_TEAM:-}"
348
+ if [ -z "$LINEAR_TEAM" ] && [ -f "$RESOLVE_STORE_SCRIPT" ]; then
349
+ LINEAR_TEAM=$(bash "$RESOLVE_STORE_SCRIPT" --shell 2>/dev/null | awk '
350
+ /^ARTIFACT_LINEAR_TEAM=/ { sub(/^ARTIFACT_LINEAR_TEAM=/, ""); if ($0 != "\047\047") print }
351
+ ' || true)
352
+ fi
353
+
354
+ RELATED_ISSUES=""
355
+ if [ -f "$LINEAR_KEYS_SCRIPT" ]; then
356
+ if [ -n "$LINEAR_TEAM" ]; then
357
+ while IFS=$'\t' read -r LINEAR_KEY _LINEAR_SRC LINEAR_ACTION; do
358
+ [ -n "$LINEAR_KEY" ] || continue
359
+ case "$LINEAR_ACTION" in
360
+ closes) LINEAR_VERB=Closes ;;
361
+ refs) LINEAR_VERB=Refs ;;
362
+ *) continue ;;
363
+ esac
364
+ RELATED_ISSUES="${RELATED_ISSUES:+${RELATED_ISSUES}
365
+ }${LINEAR_VERB} ${LINEAR_KEY}"
366
+ done <<<"$LINEAR_KEYS_OUT"
367
+ elif [ -n "$LINEAR_KEYS_OUT" ]; then
368
+ echo 'Skipping Linear issue links: no ARTIFACT_LINEAR_TEAM configured and no Linear MCP to verify keys.' >&2
369
+ fi
370
+ fi
371
+
372
+ # GitHub issues referenced in commit messages (Closes/Fixes/Resolves #n).
373
+ GH_REFS=$(grep -oiE '(closes|fixes|resolves) #[0-9]+' <<<"$COMMIT_MESSAGES" 2>/dev/null | grep -oE '#[0-9]+' | awk '!seen[$0]++' || true)
374
+ while IFS= read -r GH_REF; do
375
+ [ -n "$GH_REF" ] || continue
376
+ RELATED_ISSUES="${RELATED_ISSUES:+${RELATED_ISSUES}
377
+ }Closes ${GH_REF}"
378
+ done <<<"$GH_REFS"
379
+
380
+ # No linked issues: keep the bare placeholder for the author to fill in.
381
+ [ -n "$RELATED_ISSUES" ] || RELATED_ISSUES="Closes #"
382
+
338
383
  # Create description based on commits
339
384
  PR_DESCRIPTION="## Summary
340
385
 
@@ -375,7 +420,7 @@ PR_DESCRIPTION="${PR_DESCRIPTION}
375
420
 
376
421
  ## Related Issues
377
422
 
378
- Closes #
423
+ ${RELATED_ISSUES}
379
424
 
380
425
  ## Breaking Changes
381
426
 
@@ -43,8 +43,13 @@ echo -e "${GREEN}=== Commit Message Validation ===${NC}\n"
43
43
  echo "Validating: $COMMIT_MSG"
44
44
  echo ""
45
45
 
46
- # Extract the subject line (first line)
47
- SUBJECT=$(echo "$COMMIT_MSG" | head -n1)
46
+ # Match variables with here-strings, not `echo | grep -q`: under pipefail an
47
+ # early-exiting reader SIGPIPEs the echo writer and a present pattern reads
48
+ # as missing (YAN-1587).
49
+
50
+ # Extract the subject line (first line). Parameter expansion keeps the whole
51
+ # message in memory — no echo writer for an early-exiting head to SIGPIPE.
52
+ SUBJECT="${COMMIT_MSG%%$'\n'*}"
48
53
 
49
54
  # Check if message is empty
50
55
  if [ -z "$SUBJECT" ]; then
@@ -54,7 +59,7 @@ if [ -z "$SUBJECT" ]; then
54
59
  fi
55
60
 
56
61
  # Validate format: <type>(<scope>): <subject> or <type>: <subject>
57
- if ! echo "$SUBJECT" | grep -qE '^[a-z]+(\([a-z0-9-]+\))?!?: .+'; then
62
+ if ! grep -qE '^[a-z]+(\([a-z0-9-]+\))?!?: .+' <<<"$SUBJECT"; then
58
63
  echo -e "${RED}✗ Error: Subject line doesn't match conventional commit format${NC}"
59
64
  echo " Expected: <type>(<scope>): <subject> or <type>: <subject>"
60
65
  echo " Got: $SUBJECT"
@@ -86,23 +91,23 @@ if [ -n "$TYPE" ]; then
86
91
  fi
87
92
 
88
93
  # Extract scope (if present)
89
- if echo "$SUBJECT" | grep -qE '\([a-z0-9-]+\)'; then
94
+ if grep -qE '\([a-z0-9-]+\)' <<<"$SUBJECT"; then
90
95
  SCOPE=$(echo "$SUBJECT" | grep -oE '\([a-z0-9-]+\)' | tr -d '()')
91
96
  echo -e "${GREEN}✓ Scope '$SCOPE' is present${NC}"
92
97
 
93
98
  # Check scope format (lowercase, alphanumeric + hyphens)
94
- if ! echo "$SCOPE" | grep -qE '^[a-z0-9-]+$'; then
99
+ if ! grep -qE '^[a-z0-9-]+$' <<<"$SCOPE"; then
95
100
  echo -e "${YELLOW}⚠ Warning: Scope should be lowercase alphanumeric with hyphens${NC}"
96
101
  WARNINGS=$((WARNINGS + 1))
97
102
  fi
98
103
  fi
99
104
 
100
105
  # Check for breaking change indicator (!)
101
- if echo "$SUBJECT" | grep -qE '!:'; then
106
+ if grep -qE '!:' <<<"$SUBJECT"; then
102
107
  echo -e "${YELLOW}⚠ Breaking change indicator detected (!)${NC}"
103
108
 
104
109
  # Check if BREAKING CHANGE footer is present in full message
105
- if ! echo "$COMMIT_MSG" | grep -qE 'BREAKING CHANGE:'; then
110
+ if ! grep -qE 'BREAKING CHANGE:' <<<"$COMMIT_MSG"; then
106
111
  echo -e "${YELLOW}⚠ Warning: Breaking change indicator used but no BREAKING CHANGE footer found${NC}"
107
112
  echo " Consider adding: BREAKING CHANGE: <description>"
108
113
  WARNINGS=$((WARNINGS + 1))
@@ -128,7 +133,7 @@ if [ -n "$SUBJECT_TEXT" ]; then
128
133
 
129
134
  # Check if subject starts with uppercase (should be lowercase)
130
135
  FIRST_CHAR=$(echo "$SUBJECT_TEXT" | cut -c1)
131
- if echo "$FIRST_CHAR" | grep -qE '[A-Z]'; then
136
+ if grep -qE '[A-Z]' <<<"$FIRST_CHAR"; then
132
137
  # Portable lowercase conversion using bash parameter expansion
133
138
  REST="${SUBJECT_TEXT:1}"
134
139
  LOWERCASE_FIRST="${FIRST_CHAR,,}"
@@ -143,7 +148,7 @@ if [ -n "$SUBJECT_TEXT" ]; then
143
148
  fi
144
149
 
145
150
  # Check if subject ends with period (should not)
146
- if echo "$SUBJECT_TEXT" | grep -qE '\.$'; then
151
+ if grep -qE '\.$' <<<"$SUBJECT_TEXT"; then
147
152
  echo -e "${YELLOW}⚠ Warning: Subject should not end with a period${NC}"
148
153
  WARNINGS=$((WARNINGS + 1))
149
154
  else
@@ -154,7 +159,7 @@ if [ -n "$SUBJECT_TEXT" ]; then
154
159
  FIRST_WORD=$(echo "$SUBJECT_TEXT" | awk '{print $1}')
155
160
 
156
161
  # Common non-imperative patterns
157
- if echo "$FIRST_WORD" | grep -qE '(added|fixed|updated|changed|removed|deleted)$'; then
162
+ if grep -qE '(added|fixed|updated|changed|removed|deleted)$' <<<"$FIRST_WORD"; then
158
163
  echo -e "${YELLOW}⚠ Warning: Use imperative mood (add, fix, update, not added, fixed, updated)${NC}"
159
164
  echo " Got: '$FIRST_WORD'"
160
165
  echo " Prefer: '$(echo "$FIRST_WORD" | sed 's/ed$//' | sed 's/d$//')'"
@@ -165,7 +170,14 @@ if [ -n "$SUBJECT_TEXT" ]; then
165
170
  fi
166
171
 
167
172
  # Check for body (optional but recommended for complex changes)
168
- BODY_LINES=$(echo "$COMMIT_MSG" | tail -n +3 | grep -c '[[:alnum:]]' || echo "0")
173
+ # grep -c prints the count itself; exit 1 only means zero matches. Any other
174
+ # non-zero status is a real failure.
175
+ BODY_LINES_STATUS=0
176
+ BODY_LINES=$(echo "$COMMIT_MSG" | tail -n +3 | grep -c '[[:alnum:]]') || BODY_LINES_STATUS=$?
177
+ if [ "$BODY_LINES_STATUS" -gt 1 ]; then
178
+ echo "Error: Failed to count body lines" >&2
179
+ exit "$BODY_LINES_STATUS"
180
+ fi
169
181
 
170
182
  if [ "$BODY_LINES" -gt 0 ]; then
171
183
  echo -e "${GREEN}✓ Body is present ($BODY_LINES lines)${NC}"
@@ -186,11 +198,11 @@ if [ "$BODY_LINES" -gt 0 ]; then
186
198
  fi
187
199
 
188
200
  # Check for BREAKING CHANGE footer
189
- if echo "$COMMIT_MSG" | grep -qE 'BREAKING CHANGE:'; then
201
+ if grep -qE 'BREAKING CHANGE:' <<<"$COMMIT_MSG"; then
190
202
  echo -e "${YELLOW}⚠ Breaking change footer detected${NC}"
191
203
 
192
204
  # Verify format
193
- if echo "$COMMIT_MSG" | grep -qE '^BREAKING CHANGE: .+'; then
205
+ if grep -qE '^BREAKING CHANGE: .+' <<<"$COMMIT_MSG"; then
194
206
  echo -e "${GREEN}✓ BREAKING CHANGE footer is properly formatted${NC}"
195
207
  else
196
208
  echo -e "${RED}✗ Error: BREAKING CHANGE footer format incorrect${NC}"
@@ -200,7 +212,7 @@ if echo "$COMMIT_MSG" | grep -qE 'BREAKING CHANGE:'; then
200
212
  fi
201
213
 
202
214
  # Check for issue references
203
- if echo "$COMMIT_MSG" | grep -qE '(Fixes|Closes|Resolves|Related to) #[0-9]+'; then
215
+ if grep -qE '(Fixes|Closes|Resolves|Related to) #[0-9]+' <<<"$COMMIT_MSG"; then
204
216
  echo -e "${GREEN}✓ Issue reference found${NC}"
205
217
  fi
206
218
 
@@ -197,7 +197,7 @@ PYEOF
197
197
  fi
198
198
  local first_line
199
199
  first_line="$(head -1 "$CONFIG_FILE")"
200
- if echo "$first_line" | grep -q "Advisory only"; then
200
+ if grep -q "Advisory only" <<<"$first_line"; then
201
201
  add_check "advisory-comment" "PASS" "file leads with advisory comment"
202
202
  else
203
203
  add_check "advisory-comment" "FAIL" "file must lead with '# Advisory only ...' comment; got: ${first_line}"
@@ -15,7 +15,7 @@ Execute a parallel implementation plan by deploying implementor agents in depend
15
15
  ## Hard Gates
16
16
 
17
17
  - `--worktree` and `--no-worktree` together → abort (exact message in Arguments).
18
- - `--dry-run` → print the plan only; never dispatch agents or manage team state. STOP HERE.
18
+ - `--dry-run` → print the plan only; never dispatch agents or manage team state. Skip branch preparation and worktree setup, including Phase 2.5. STOP HERE. In linear mode it also makes no Linear or local writes (no `--ensure`, no cache write); see `references/linear-sync.md`.
19
19
  - Always run the branch-prep helper before any dispatch — narrative-only branch instructions are how agents end up committing to `main`.
20
20
  - Never pass `isolation: "worktree"` per agent — all agents in all batches share the one feature worktree (or the prepared checkout under `--no-worktree`).
21
21
  - Standalone task failure: record it and continue only independent tasks. Team failure: no auto-retry or skipping; ask the user before advancing.
@@ -35,25 +35,26 @@ Final step of the planning workflow; requires `parallel-plan.md` from the parall
35
35
  shared.md parallel-plan.md parallel-plan.md
36
36
  ```
37
37
 
38
- If parallel-plan.md doesn't exist, run `/ycc:parallel-plan [feature-name]` first.
38
+ In local mode, if parallel-plan.md doesn't exist, run `/ycc:parallel-plan [feature-name]` first. In linear mode, use Phase 0 Lookup before concluding that a plan is missing.
39
39
 
40
40
  ## Arguments
41
41
 
42
42
  **Target**: `$ARGUMENTS`
43
43
 
44
- Parse flags first, then treat the remainder as the feature name:
44
+ Parse flags first, then resolve the remaining feature name, plan path, or Linear reference using `references/plan-inputs.md`:
45
45
 
46
46
  - `--worktree` — (legacy — now default; safe to omit) Accepted as a silent no-op. Worktree isolation is on by default; this flag matches the new default and has no additional effect.
47
47
  - `--no-worktree` — Force worktree mode **OFF** regardless of plan annotations. Create/use `feat/<feature-name>` in the current checkout and run tasks there. No feature worktree is created.
48
- - `<feature-name>` — The name of the feature to implement (matches directory name in `docs/plans/`).
48
+ - `--store=local|linear` — Artifact-store override; strip and retain as `STORE_FLAG` (empty when absent), forwarding it to every resolver call.
49
+ - `<feature-name | plan-path | Linear-reference>` — Existing feature name, cached plan path, or issue key/URL, Project URL/slug, or Document URL/id; see artifact-store.md **Implementation skills > Inputs**.
49
50
 
50
- Strip the supported flags from `$ARGUMENTS` and set `DRY_RUN=true|false`, `WORKTREE_MODE=true|false`, and `WORKTREE_FLAG_PRESENT=true|false`. The remaining non-flag token is the feature name.
51
+ Strip the flags from `$ARGUMENTS` and set ``, `DRY_RUN=true|false`, `WORKTREE_MODE=true|false`, and `WORKTREE_FLAG_PRESENT=true|false`. Retain the remaining input; derive the feature slug during Phase 0.
51
52
 
52
53
  **Validation**:
53
54
 
54
55
  - `--worktree` and `--no-worktree` together → abort with: `--worktree and --no-worktree are mutually exclusive. Use --no-worktree to opt out of the default.`
55
56
 
56
- If no feature name remains after stripping flags, abort with this usage line followed by the Examples in `references/plan-inputs.md` (default worktree, `--dry-run`, `--no-worktree`, and the combinations):
57
+ If no input remains after stripping flags, abort with this usage line followed by the Examples in `references/plan-inputs.md`:
57
58
 
58
59
  Usage: /ycc:implement-plan [--dry-run] [--worktree] [--no-worktree] <feature-name>
59
60
 
@@ -66,18 +67,28 @@ Read `{{package-root}}/shared/references/standalone-dispatch.md` for standalone
66
67
 
67
68
  ### Step 1: Validate Prerequisites
68
69
 
69
- After flag parsing, extract the feature name (first non-flag argument) and run:
70
+ First read `{{package-root}}/shared/references/artifact-store.md` **Implementation skills**, **Sync**, **Lookup**, and **Helper API**. Apply **Inputs** before resolution (including the local-plan-wins and `--store=local` conflict rules): when a Linear reference or linear plan path selects linear mode and `STORE_FLAG` is empty, set `STORE_FLAG=--store=linear` before the first resolver call and forward it to every later call, consistent with `references/plan-inputs.md`. Resolve and print the store (default `linear`), retaining the printed mode and absolute paths across tool calls:
70
71
 
71
72
  ```bash
72
- {{package-root}}/skills/implement-plan/scripts/check-prerequisites.sh [feature-name]
73
+ bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --shell
73
74
  ```
74
75
 
75
- If the script exits with error: display the error message, instruct the user to run `/ycc:parallel-plan` first to create the implementation plan, and **STOP HERE** — do not proceed.
76
+ If the printed `ARTIFACT_STORE_SOURCE` is `default` and `STORE_FLAG` is empty, apply the Inputs local-plan rule: an explicit plan path outside `.ycc/artifacts/`, or an existing local feature directory (`test -d "$(bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" --store=local)/<feature-name>"`, which also accepts legacy local names such as `team/auth`), sets `STORE_FLAG=--store=local`; print `Using local plan at <path>; pin with store: local in .plans-config` and resolve again with it. `check-prerequisites.sh` applies the same feature-directory rule when called without a store flag.
77
+
78
+ In linear mode, follow **Resolve and hydrate** (Lookup → Load `parallel-plan` and available `shared`) before prerequisites or branch preparation; retain absolute `PLAN_PATH` and `SHARED_PATH`. Follow `references/linear-sync.md` throughout this run. Local feature-name input keeps the existing prerequisite call:
79
+
80
+ ```bash
81
+ {{package-root}}/skills/implement-plan/scripts/check-prerequisites.sh ${STORE_FLAG} [feature-name]
82
+ ```
83
+
84
+ For linear mode, call the helper with `${STORE_FLAG} --plan="${PLAN_PATH}" <resolved-slug>`; `PLAN_PATH` must be the absolute hydrated cache path. An explicit local plan path uses `${STORE_FLAG} --plan="${PLAN_PATH}" <feature-name>` with the store chosen above.
85
+
86
+ If the script exits with error: display the error message and **STOP HERE** — do not proceed. In local mode, instruct the user to run `/ycc:parallel-plan` first; in linear mode, preserve Lookup's diagnostics rather than claiming no plan without querying Linear.
76
87
 
77
88
  ### Step 2: Read Planning Documents
78
89
 
79
- 1. `docs/plans/[feature-name]/parallel-plan.md` — the implementation plan
80
- 2. `docs/plans/[feature-name]/shared.md` — architecture context
90
+ 1. Local: `docs/plans/[feature-name]/parallel-plan.md` (or explicit plan path); linear: absolute `PLAN_PATH` — the implementation plan
91
+ 2. Local: companion `shared.md`; linear: hydrated `SHARED_PATH` when available — architecture context
81
92
 
82
93
  Also read files listed in the "Critically Relevant Files" section of parallel-plan.md.
83
94
 
@@ -85,17 +96,18 @@ Also read files listed in the "Critically Relevant Files" section of parallel-pl
85
96
 
86
97
  ### Step 3: Extract Tasks
87
98
 
88
- Run when building the execution graph (Phase 1 task extraction):
99
+ For local inputs, set absolute `PLAN_PATH` and companion `SHARED_PATH` from the resolved plan directory (refresh both after worktree relocation); linear mode keeps the absolute cache paths. Run when building the execution graph (Phase 1 task extraction):
89
100
 
90
101
  ```bash
91
- {{package-root}}/skills/implement-plan/scripts/parse-dependencies.sh docs/plans/[feature-name]/parallel-plan.md
102
+ {{package-root}}/skills/implement-plan/scripts/parse-dependencies.sh "${PLAN_PATH}"
92
103
  ```
93
104
 
94
105
  The script emits optional header lines (`WT_PARENT_PATH=<path>`, `WT_FEATURE_SLUG=<slug>` — present only when the plan has a `## Worktree Setup` section) followed by per-task rows (`TASK_ID|TASK_TITLE|DEPENDENCIES`). Row fields and the monorepo `.plans-config` behavior are documented in `references/plan-inputs.md`.
106
+ Parse task specifications from the body, not identity frontmatter.
95
107
 
96
108
  ### How Worktree Mode Is Decided
97
109
 
98
- Use standalone-dispatch.md §8.1 for precedence and variables in both modes. Skill input: `WT_FEATURE_SLUG` is the parsed annotation slug if present, otherwise the feature-name argument (no extra sanitization/cap). Always derive `WT_REPO_NAME` and `FEATURE_BRANCH`; `--no-worktree` sets `WORKTREE_ACTIVE=false` even when parser headers exist.
110
+ Use standalone-dispatch.md §8.1 for precedence and variables in both modes. Local skill input: `WT_FEATURE_SLUG` is the parsed annotation slug if present, otherwise the resolved feature slug (the feature-name argument in local mode; no extra sanitization/cap). In linear mode, derive `WT_FEATURE_SLUG` from the cache slug per 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. Always derive `WT_REPO_NAME` and `FEATURE_BRANCH`; `--no-worktree` sets `WORKTREE_ACTIVE=false` even when parser headers exist.
99
111
 
100
112
  ### Step 4: Build Dependency Graph
101
113
 
@@ -111,6 +123,7 @@ Use `track the task` for each plan item with `subject="[Task ID] [Task Title]"`
111
123
  `description="<full specification and dependencies>"`. Capture the returned task IDs;
112
124
  wire dependencies via `update the todo tracker` with `addBlockedBy` using those IDs. See
113
125
  `references/plan-inputs.md` (Task list format).
126
+ In linear mode, reconcile mapped task issues before registration per `references/linear-sync.md`; completed/canceled tasks are skipped, not dispatched, and completed prerequisites count as satisfied.
114
127
 
115
128
  ### Step 6: Identify First Batch
116
129
 
@@ -120,7 +133,7 @@ All tasks with `Depends on [none]` form the first batch; mark them ready for exe
120
133
 
121
134
  ### Steps 6.5–6.7
122
135
 
123
- Use standalone-dispatch.md §8.2 in both dispatch modes for Git inspection, required branch preparation, one-time parent setup, and one-way artifact relocation. Expected dirty artifacts: `docs/plans/${WT_FEATURE_SLUG}/` only; unrelated dirty files stop and require user cleanup. Move `docs/plans/${WT_FEATURE_SLUG}/parallel-plan.md` with `docs/plans/${WT_FEATURE_SLUG}/shared.md` as companion; other research artifacts from the same feature directory may ride as extra arguments. Keep returned `$PLAN_PATH` canonical; later validation/reports use the execution tree. Branch-prep exit contract: `{{package-root}}/shared/references/branch-prep.md`.
136
+ Use standalone-dispatch.md §8.2 in both dispatch modes for Git inspection, required branch preparation and one-time parent setup. **Local mode:** expected dirty artifacts: `docs/plans/${WT_FEATURE_SLUG}/` only; unrelated dirty files stop and require user cleanup. Move `docs/plans/${WT_FEATURE_SLUG}/parallel-plan.md` with `docs/plans/${WT_FEATURE_SLUG}/shared.md` as companion; other research artifacts from the same feature directory may ride as extra arguments. Keep returned `$PLAN_PATH` canonical; later validation/reports use the execution tree. **Linear mode:** skip `move-plan-to-worktree.sh` and all artifact relocation; keep absolute cache paths from Phase 0 for worktree prompts and plan validation. The cache is gitignored; the only expected dirty path is a `.gitignore` whose sole change appends one `.ycc/artifacts/` rule line, which branch preparation accepts. Branch-prep exit contract: `{{package-root}}/shared/references/branch-prep.md`.
124
137
 
125
138
  ## Phase 3: Execute in Batches
126
139
 
@@ -129,6 +142,8 @@ Use standalone-dispatch.md §8.2 in both dispatch modes for Git inspection, requ
129
142
  If `--dry-run` is present, read `references/output-formats.md` (Dry-run formats), print the default batch roster, and do not dispatch any agents.
130
143
  **STOP HERE** after either dry-run output.
131
144
 
145
+ After this gate, linear mode runs the start transitions and pending replay in `references/linear-sync.md` before dispatch.
146
+
132
147
  ### Step 8: Execute standalone batches
133
148
 
134
149
  Execute the dependency-ready standalone batches described below.
@@ -161,6 +176,7 @@ All parallel agents in this batch share this path; batching guarantees no two ag
161
176
  ```
162
177
 
163
178
  Implementor prompt template: `references/agent-task-prompt.md` — read once before the loop for the full task prompt.
179
+ For both paths, apply `references/linear-sync.md` before each batch and after its orchestrator validation; implementors never sync Linear or edit plan identity.
164
180
 
165
181
  #### Process Batch Results (Path A)
166
182
 
@@ -190,6 +206,8 @@ Repeat from the ready-task selection until no tasks remain, then Phase 4.
190
206
  2. Verify all "Files to Create" exist.
191
207
  3. Sanity-check the modifications.
192
208
 
209
+ In linear mode, write kind `report` and Save its Project status update, then apply parent/Project completion via `references/linear-sync.md`; local mode retains its existing report behavior and makes no Linear calls.
210
+
193
211
  ### Step 10: Display Summary
194
212
 
195
213
  When `WORKTREE_ACTIVE=true`, first capture: `bash {{package-root}}/shared/scripts/list-worktrees.sh "${WT_REPO_NAME}" "${WT_FEATURE_SLUG}"`.
@@ -204,7 +222,7 @@ The implementation must: complete all tasks in the plan, respect dependency orde
204
222
 
205
223
  ## Monorepo Support
206
224
 
207
- Plans are read from the git repository root in `docs/plans/` by default; running from any subdirectory still reads from the root. A `.plans-config` at repo root (`plans_dir: docs/plans`) customizes the directory; with `scope: local` in a package-level `.plans-config`, plans are read from that package's local `docs/plans/`. Structure example in `references/plan-inputs.md` (Monorepo Support).
225
+ Local-mode plans are read from the git repository root in `docs/plans/` by default; running from any subdirectory still reads from the root. A `.plans-config` at repo root (`plans_dir: docs/plans`) customizes the directory; with `scope: local` in a package-level `.plans-config`, plans are read from that package's local `docs/plans/`. Linear mode resolves under `.ycc/artifacts/<slug>/` in the invoking checkout and passes absolute cache paths to worktree agents. Structure example in `references/plan-inputs.md` (Monorepo Support).
208
226
 
209
227
  ## Success Criteria
210
228
 
@@ -221,3 +239,4 @@ Pair with the `/goal` session directive to loop the batch executor to completion
221
239
  - `references/plan-inputs.md` — read when parsing tasks, building the dependency graph, registering tasks, showing usage, or resolving the monorepo plans directory.
222
240
  - `references/agent-task-prompt.md` — read once before dispatching implementor agents.
223
241
  - `references/output-formats.md` — read when printing `--dry-run` output or the Phase 4 completion summary, or writing a `/goal` condition.
242
+ - `references/linear-sync.md` — orchestrator-only Linear lifecycle hooks; canonical behavior lives in artifact-store.md.
@@ -24,11 +24,11 @@ You are implementing one task from a larger feature plan. Read the context docum
24
24
 
25
25
  ### Required Reading
26
26
 
27
- 1. **Plan Document**: docs/plans/{{FEATURE_NAME}}/parallel-plan.md
27
+ 1. **Plan Document**: {{PLAN_PATH}} (absolute, read-only)
28
28
  - Read the full plan to understand the feature
29
29
  - Focus on Task {{TASK_ID}} for your specific instructions
30
30
 
31
- 2. **Shared Context**: docs/plans/{{FEATURE_NAME}}/shared.md
31
+ 2. **Shared Context**: {{SHARED_PATH}} (absolute, read-only; omit when unavailable)
32
32
  - Understand the architecture and patterns
33
33
  - Note the relevant files and their purposes
34
34
 
@@ -55,6 +55,7 @@ You are implementing one task from a larger feature plan. Read the context docum
55
55
  3. **Follow Existing Patterns**: Match the codebase style and conventions
56
56
  4. **Validate Changes**: Check for linting errors after modifications
57
57
  5. **Report Results**: Return a summary of what you changed
58
+ 6. **Orchestrator-Owned Plan and Status**: Never edit the plan or its frontmatter, and never call Linear MCP or other external tracker tools. Report status only to the orchestrator. Read the supplied absolute plan/context paths even if the cache is outside your working directory; all implementation writes stay in the assigned working directory.
58
59
 
59
60
  ## Output Format
60
61
 
@@ -85,7 +86,8 @@ After completing the task, provide:
85
86
 
86
87
  | Variable | Description | Example |
87
88
  |----------|-------------|---------|
88
- | `{{FEATURE_NAME}}` | Feature directory name | `user-authentication` |
89
+ | `{{PLAN_PATH}}` | Canonical absolute plan path; linear cache is not moved into the feature worktree | `/repo/.ycc/artifacts/user-authentication/parallel-plan.md` |
90
+ | `{{SHARED_PATH}}` | Absolute companion context path; omit its reading item when absent | `/repo/.ycc/artifacts/user-authentication/shared.md` |
89
91
  | `{{TASK_ID}}` | Task identifier | `1.1`, `2.3` or `T0`, `T1` |
90
92
  | `{{TASK_TITLE}}` | Task title from plan | `Create user model` |
91
93
  | `{{FILES_TO_READ}}` | Files from "READ THESE BEFORE TASK" | `- /src/models/base.ts` |
@@ -121,11 +123,11 @@ You are implementing one task from a larger feature plan. Read the context docum
121
123
 
122
124
  ### Required Reading
123
125
 
124
- 1. **Plan Document**: docs/plans/user-authentication/parallel-plan.md
126
+ 1. **Plan Document**: /repo/.ycc/artifacts/user-authentication/parallel-plan.md (absolute, read-only)
125
127
  - Read the full plan to understand the feature
126
128
  - Focus on Task 1.1 for your specific instructions
127
129
 
128
- 2. **Shared Context**: docs/plans/user-authentication/shared.md
130
+ 2. **Shared Context**: /repo/.ycc/artifacts/user-authentication/shared.md (absolute, read-only)
129
131
  - Understand the architecture and patterns
130
132
  - Note the relevant files and their purposes
131
133
 
@@ -167,6 +169,7 @@ Follow the pattern in /src/models/base-model.ts for consistency.
167
169
  3. **Follow Existing Patterns**: Match the codebase style and conventions
168
170
  4. **Validate Changes**: Check for linting errors after modifications
169
171
  5. **Report Results**: Return a summary of what you changed
172
+ 6. **Orchestrator-Owned Plan and Status**: Never edit the plan or its frontmatter, and never call Linear MCP or other external tracker tools. Report status only to the orchestrator. The supplied absolute plan/context paths may be outside your working directory; implementation writes stay in the assigned working directory.
170
173
 
171
174
  ## Output Format
172
175
 
@@ -0,0 +1,20 @@
1
+ # Implement-plan Linear Lifecycle
2
+
3
+ Read `{{package-root}}/shared/references/artifact-store.md` **Implementation skills** (Inputs, Resolve and hydrate, Status sync, Report and completion), **Plan task issues**, **Sync**, and **Lookup**. Those sections are the contract; this file maps them to executor phases, not a second sync protocol. All hooks below are linear-mode only. Local mode keeps its existing paths, worktree move and report behavior, with no Linear calls.
4
+
5
+ ## Phase hooks
6
+
7
+ - **Phase 0:** apply Inputs and Resolve and hydrate before prerequisites. Retain `STORE_FLAG`, resolved feature slug, absolute `PLAN_PATH`, and available `SHARED_PATH` across tool calls. Use Lookup and Load with the Linear call gate and Conflict rules; never overwrite unpushed cache edits. Read the `tasks` map; rebuild a missing map in memory only (no issue creation, no cache write). Tasks without issues remain runnable and are reported as untracked.
8
+ - **Phases 1–2:** fetch mapped task states. Treat `completed` tasks as done and skip dispatch on resume; skip `canceled` tasks as removed. Retain both lists for the summary and account for completed dependencies in the execution graph. Never renumber task ids or change the plan body.
9
+ - **After Step 7's dry-run exit:** replay pending transitions from the prior report through Offline and the normal remote checks before dispatch. Apply Status sync's run-start row to the parent and Project by state type, never by a hardcoded team state name. A dry run follows the contract's `--dry-run` rule: Lookup and read-only reuse only; no `--ensure`, no cache write, no Linear writes (state changes, comments, pending replay, report Save, Project updates).
10
+ - **Before every batch, Path A or B:** apply Status sync's dispatch row to each mapped task issue. The orchestrator alone performs these transitions; implementors receive read-only absolute cache paths and report only to it.
11
+ - **After each batch's orchestrator validation:** mark issues for tasks that passed their required validation `completed`. Do not mark success merely because an agent returned. Apply Status sync's failure row to failed tasks/batches: leave issues `started` and add one sanitized comment identifying the task id, failed check and short excerpt; no secrets or full logs. Preserve the existing standalone/team failure policy.
12
+ - **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). Never move issues backwards, reopen them, change assignees, or touch issues outside this plan's map and parent.
13
+
14
+ ## Phase 4 report and completion
15
+
16
+ After final verification, apply **Report and completion**: resolve kind `report` with `${STORE_FLAG} --ensure --kind=report --slug=<resolved-slug>` through the shared resolver, retain its absolute path, write the run report, and Save as the Project status update (plus a Document when long), recording `linear.statusUpdate`. Do this on failure as well as success (including team-abort). Use the contract's health, parent-completion and Project completion rules (name equals slug, label, not `ARTIFACT_LINEAR_PROJECT`, all issues done); otherwise leave the Project open and report why. Local mode does not run this hook.
17
+
18
+ If an installed, authorized MCP becomes unreachable mid-run, keep implementing through **Offline**. 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 same list; the next run replays it before dispatch, without overriding remote changes. Do not claim an unapplied transition or status update succeeded. Missing/unauthorized MCP at initial hydration follows the gate, not a local fallback.
19
+
20
+ Use `references/output-formats.md` for Linear URLs, issues moved, skipped/untracked tasks, pending transitions and the Project completion reason. Keep the existing Goal Signals unchanged.
@@ -93,6 +93,19 @@ Provide completion summary:
93
93
 
94
94
  [List any problems or warnings]
95
95
 
96
+ ## Linear ← include this section only when ARTIFACT_STORE=linear
97
+
98
+ - **Issues moved**: [parent/task keys and resulting state types, or none]
99
+ - **Skipped on resume**: [completed task ids/keys; canceled task ids/keys]
100
+ - **Untracked tasks**: [ids without mapped issues; suggest re-saving with /ycc:parallel-plan]
101
+ - **Project**: [URL; completed, or left open with reason]
102
+ - **Plan**: [Document URL]
103
+ - **Report**: [absolute report cache path; Project status update URL, or pending]
104
+
105
+ ### Linear sync pending
106
+
107
+ [Each unapplied transition/report write, or None; preserve the same list in the report with pending: true while unapplied]
108
+
96
109
  ## Worktree Status ← include this section only when WORKTREE_ACTIVE=true
97
110
 
98
111
  [Output of list-worktrees.sh]
@@ -110,7 +123,7 @@ Provide completion summary:
110
123
  3. Commit the changes when satisfied
111
124
  4. **Optional**: Generate implementation report:
112
125
 
113
- /ycc:code-report [feature-name]
126
+ /ycc:code-report ${STORE_FLAG} [feature-name]
114
127
 
115
128
  ## Goal Signals (machine-readable — printed verbatim for /goal)
116
129
 
@@ -123,6 +136,8 @@ Print every signal verbatim as the last lines of the completion summary. Use `PA
123
136
  when the matching criterion in `## Success Criteria` is met; otherwise `FAIL` (for example
124
137
  `FILES_CHANGED_NONEMPTY: FAIL` when the "Files Changed" section enumerated no files).
125
138
 
139
+ In linear mode, Step 9 already writes kind `report` and Saves a Project status update per `references/linear-sync.md`. Include its URL (or pending failure), issue transitions, skipped tasks and Project completion reason above; do not claim a remote write succeeded without its response. Keep the Goal Signals unchanged and last.
140
+
126
141
  ## Goal pairing
127
142
 
128
143
  Pair this skill with the `/goal` session directive to loop the batch executor to completion
@@ -132,7 +147,7 @@ condition that references the Phase 4 Step 10 Goal Signals block rather than fil
132
147
  Recommended condition template:
133
148
 
134
149
  ```
135
- /goal Execute the parallel plan at docs/plans/<feature>/parallel-plan.md using the
150
+ /goal Execute the parallel plan <feature> (resolved plan path) using the
136
151
  implement-plan workflow, continuing through every batch and the Phase 4 lint pass
137
152
  without returning control to me. Done when the transcript shows the Phase 4
138
153
  "# Implementation Complete" output followed by all three Goal Signals printed verbatim —