kenaz 0.3.18 → 0.3.20

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 (329) hide show
  1. package/core/.claude/commands/agent-worker.md +1 -1
  2. package/core/.claude/commands/architect.md +1 -2
  3. package/core/.claude/commands/spec.md +1 -1
  4. package/core/.claude/commands//347/224/242/345/223/201.md +1 -1
  5. package/core/.claude/hooks/__tests__/task-1977-dedupe-guard.test.js +8 -8
  6. package/core/.claude/skills/architect_agent/SKILL.md +11 -92
  7. package/core/.claude/skills/assessment_agent/SKILL.md +0 -1
  8. package/core/.claude/skills/backend_engineer/SKILL.md +3 -6
  9. package/core/.claude/skills/code_reviewer/SKILL.md +1 -1
  10. package/core/.claude/skills/code_reviewer/patterns.yaml +1 -1
  11. package/core/.claude/skills/designer/SKILL.md +3 -6
  12. package/core/.claude/skills/dev_agent/SKILL.md +30 -491
  13. package/core/.claude/skills/developer/SKILL.md +3 -6
  14. package/core/.claude/skills/feature_agent/SKILL.md +3 -17
  15. package/core/.claude/skills/product_manager/SKILL.md +29 -1064
  16. package/core/.claude/skills/qa_engineer/SKILL.md +12 -17
  17. package/core/.claude/skills/spec_optimizer/SKILL.md +25 -275
  18. package/core/.claude/skills/sre_agent/SKILL.md +3 -6
  19. package/core/.collaboration/README.md +2 -3
  20. package/core/.collaboration/core/task-api.js +5 -138
  21. package/core/.collaboration/docs/CLI.md +0 -2
  22. package/core/.failure/INDEX.yaml +6 -40
  23. package/core/.failure/agent-execution/FAIL-013-search-cwd-drift-and-case-mismatch.yaml +1 -1
  24. package/core/.failure/tools/README.md +9 -227
  25. package/core/.formation/bifrost/launch.js +1 -6
  26. package/core/.formation/bifrost/launch.test.js +1 -1
  27. package/core/.formation/bifrost/shared/ansuz-boot-policy.js +3 -3
  28. package/core/.formation/bifrost/shared/ansuz-boot-policy.test.js +1 -2
  29. package/core/.formation/tools/__tests__/arms.test.js +41 -0
  30. package/core/.formation/tools/__tests__/diagnose-bug.test.js +10 -0
  31. package/core/.formation/tools/__tests__/m1-hmap-convid.test.js +1 -124
  32. package/core/.formation/tools/arms.js +48 -0
  33. package/core/.formation/tools/dispatch.js +24 -15
  34. package/core/.formation/tools/kenaz-stats.js +32 -8
  35. package/core/.formation/tools/kenaz-stats.test.js +15 -2
  36. package/core/.formation/tools/loader.js +17 -140
  37. package/core/.formation/tools/post-complete.js +0 -31
  38. package/core/.formation/tools/prompt.js +16 -1
  39. package/core/.formation/tools/prompt.test.js +20 -0
  40. package/core/.rule/INDEX.yaml +0 -18
  41. package/core/.rule/general/agent-workflow.yaml +14 -164
  42. package/core/.rule/general/project-self-containment.yaml +8 -19
  43. package/core/.rule/general/rust-verify-target.yaml +6 -5
  44. package/core/.rule/general/synapse-code-intelligence.yaml +3 -3
  45. package/core/.specialist/Amelia/capability.yaml +12 -12
  46. package/core/.specialist/Amelia/workflow.yaml +2 -2
  47. package/core/.specialist/Ansuz/SYSTEM_DOC.md +20 -578
  48. package/core/.specialist/Ansuz/cognitive_principles.yaml +2 -3
  49. package/core/.specialist/Ansuz/concepts/boot_rules_summary.yaml +0 -1
  50. package/core/.specialist/Ansuz/concepts/deep_knowledge_pointers.yaml +1 -2
  51. package/core/.specialist/Ansuz/core.yaml +6 -108
  52. package/core/.specialist/Ansuz/guards/lesson_guards.yaml +0 -3
  53. package/core/.specialist/Ansuz/identity_contract.yaml +0 -1
  54. package/core/.specialist/Ansuz/knowledge.yaml +0 -4
  55. package/core/.specialist/Ansuz/rule.yaml +0 -1
  56. package/core/.specialist/Ansuz/tools/handoff-session-identity.test.js +6 -150
  57. package/core/.specialist/tests/runtime-discovery/README.md +1 -1
  58. package/core/.specialist/tools/__tests__/task-2374-usage-counter.test.js +1 -12
  59. package/core/.specialist/tools/ansuz-boot-fast.js +7 -4
  60. package/core/.specialist/tools/ansuz-boot-fast.test.js +10 -3
  61. package/core/.specialist/tools/prompt-files.test.js +1 -0
  62. package/core/.specialist/tools/task-bridge.js +1 -66
  63. package/core/.system/README.md +11 -552
  64. package/core/.system/collaboration/README.md +10 -174
  65. package/core/CLAUDE.md +1 -6
  66. package/core/KENAZ_CORE_VERSION +1 -1
  67. package/core/dev/scripts/js-yaml-resolution.test.js +1 -1
  68. package/core/dev/scripts/peer-identity-e2e.js +402 -0
  69. package/core/dev/scripts/peer-identity-e2e.md +47 -0
  70. package/core/dev/scripts/relay-admin.js +94 -0
  71. package/core/dev/scripts/relay-admin.test.js +131 -0
  72. package/core/dev/scripts/run-rust-tests.js +9 -45
  73. package/core/dev/scripts/rust-verify-worktree.js +4 -4
  74. package/core/dev/scripts/verify-target-dir.js +6 -6
  75. package/core/plugins/kenaz/INVENTORY.md +8 -8
  76. package/core/plugins/kenaz/README.md +10 -0
  77. package/core/plugins/kenaz/commands/architect.md +1 -2
  78. package/core/plugins/kenaz/commands/spec.md +1 -1
  79. package/core/plugins/kenaz/commands//347/224/242/345/223/201.md +1 -1
  80. package/core/plugins/kenaz/guidance.md +1 -1
  81. package/core/plugins/kenaz/hooks/kenaz-hook.js +2 -1
  82. package/core/plugins/kenaz/hooks/sdk-gate.js +9 -0
  83. package/core/plugins/kenaz/scripts/kenaz.test.js +15 -3
  84. package/core/plugins/kenaz/scripts/sync.js +1 -1
  85. package/core/plugins/kenaz/scripts/ygg.js +8 -0
  86. package/core/plugins/kenaz/scripts/ygg.test.js +72 -0
  87. package/core/plugins/kenaz/skills/architect_agent/SKILL.md +11 -92
  88. package/core/plugins/kenaz/skills/assessment_agent/SKILL.md +0 -1
  89. package/core/plugins/kenaz/skills/backend_engineer/SKILL.md +3 -6
  90. package/core/plugins/kenaz/skills/code_reviewer/SKILL.md +1 -1
  91. package/core/plugins/kenaz/skills/code_reviewer/patterns.yaml +1 -1
  92. package/core/plugins/kenaz/skills/designer/SKILL.md +3 -6
  93. package/core/plugins/kenaz/skills/dev_agent/SKILL.md +30 -491
  94. package/core/plugins/kenaz/skills/developer/SKILL.md +3 -6
  95. package/core/plugins/kenaz/skills/feature_agent/SKILL.md +3 -17
  96. package/core/plugins/kenaz/skills/product_manager/SKILL.md +29 -1064
  97. package/core/plugins/kenaz/skills/qa_engineer/SKILL.md +12 -17
  98. package/core/plugins/kenaz/skills/spec_optimizer/SKILL.md +25 -275
  99. package/core/plugins/kenaz/skills/sre_agent/SKILL.md +3 -6
  100. package/core/plugins/kenaz-peer/hooks/register.test.ts +32 -0
  101. package/core/plugins/kenaz-peer/hooks/register.ts +9 -0
  102. package/package.json +6 -6
  103. package/core/.claude/commands/archive.md +0 -24
  104. package/core/.claude/commands/init.md +0 -112
  105. package/core/.claude/commands/legacy_dev.md +0 -18
  106. package/core/.claude/commands/product-review.md +0 -131
  107. package/core/.claude/commands/strategy.md +0 -141
  108. package/core/.claude/commands/sunny.md +0 -1
  109. package/core/.claude/commands//347/224/242/345/223/201/346/252/242/350/246/226.md +0 -129
  110. package/core/.claude/commands//351/200/262/345/272/246.md +0 -15
  111. package/core/.claude/hooks/__tests__/substrate.test.js +0 -122
  112. package/core/.claude/hooks/_substrate-paths.js +0 -95
  113. package/core/.claude/hooks/context-check.js +0 -51
  114. package/core/.claude/hooks/fatigue-check.js +0 -52
  115. package/core/.claude/hooks/handoff-snapshot-on-commit.js +0 -154
  116. package/core/.claude/hooks/handoff-snapshot-on-question.js +0 -158
  117. package/core/.claude/hooks/handoff-staleness.js +0 -197
  118. package/core/.claude/hooks/jev-thalamus-context.js +0 -17
  119. package/core/.claude/hooks/jev-thalamus-context.test.js +0 -41
  120. package/core/.claude/hooks/lease-release.js +0 -119
  121. package/core/.claude/hooks/lease-touch.js +0 -96
  122. package/core/.claude/hooks/reflex-feedback.js +0 -5
  123. package/core/.claude/hooks/session-init.ps1 +0 -49
  124. package/core/.claude/hooks/sound-event.js +0 -70
  125. package/core/.claude/hooks/sound-event.sh +0 -37
  126. package/core/.claude/hooks/stream-delta.js +0 -169
  127. package/core/.claude/no-hooks.settings.json +0 -3
  128. package/core/.claude/skills/legacy_dev/SKILL.md +0 -202
  129. package/core/.claude/skills/sunny/SKILL.md +0 -74
  130. package/core/.collaboration/cli/commands/assign.js +0 -39
  131. package/core/.collaboration/cli/commands/claim.js +0 -33
  132. package/core/.collaboration/cli/commands/complete.js +0 -44
  133. package/core/.collaboration/cli/commands/create.js +0 -110
  134. package/core/.collaboration/cli/commands/get.js +0 -83
  135. package/core/.collaboration/cli/commands/index.js +0 -52
  136. package/core/.collaboration/cli/commands/list.js +0 -51
  137. package/core/.collaboration/cli/commands/lock.js +0 -45
  138. package/core/.collaboration/cli/commands/rebuild.js +0 -39
  139. package/core/.collaboration/cli/commands/search.js +0 -61
  140. package/core/.collaboration/cli/commands/stats.js +0 -61
  141. package/core/.collaboration/cli/commands/transfer.js +0 -41
  142. package/core/.collaboration/cli/commands/unlock.js +0 -48
  143. package/core/.collaboration/cli/formatters/help-formatter.js +0 -70
  144. package/core/.collaboration/cli/formatters/index.js +0 -7
  145. package/core/.collaboration/cli/task-cli.js +0 -46
  146. package/core/.collaboration/cli/utils/arg-parser.js +0 -74
  147. package/core/.collaboration/cli/utils/git-user.js +0 -25
  148. package/core/.collaboration/cli/utils/index.js +0 -9
  149. package/core/.collaboration/cli/utils/output.js +0 -10
  150. package/core/.collaboration/config/default.yaml +0 -189
  151. package/core/.collaboration/core/conflict-resolver.js +0 -461
  152. package/core/.collaboration/core/conflict-resolver.test.js +0 -389
  153. package/core/.collaboration/core/migrate-legacy.js +0 -260
  154. package/core/.collaboration/docs/API.md +0 -787
  155. package/core/.collaboration/docs/ARCHITECTURE.md +0 -596
  156. package/core/.collaboration/docs/FAQ.md +0 -695
  157. package/core/.collaboration/docs/MIGRATION.md +0 -804
  158. package/core/.collaboration/docs/examples/README.md +0 -320
  159. package/core/.collaboration/docs/examples/advanced-queries.js +0 -261
  160. package/core/.collaboration/docs/examples/basic-usage.js +0 -184
  161. package/core/.collaboration/docs/examples/team-workflow.js +0 -352
  162. package/core/.failure/agent-execution/FAIL-001-agent-no-output.yaml +0 -391
  163. package/core/.failure/agent-execution/FAIL-007-pm-lead-wrong-team-invocation.yaml +0 -0
  164. package/core/.failure/agent-execution/FAIL-010-phase0-poem-format-skipped.yaml +0 -28
  165. package/core/.failure/agent-execution/FAIL-010-skipping-cognitive-checkpoint-after-verification.yaml +0 -59
  166. package/core/.failure/agent-execution/FAIL-012-grep-shortcut-during-investigation.yaml +0 -85
  167. package/core/.failure/architecture/FAIL-006-python-version-compatibility.yaml +0 -445
  168. package/core/.failure/pipeline/FAIL-003-queue-pollution.yaml +0 -335
  169. package/core/.failure/pipeline/README.md +0 -95
  170. package/core/.failure/retired/FAIL-009-skipping-synapse-pulse-before-code-change.yaml +0 -49
  171. package/core/.failure/tools/USAGE_GUIDE.md +0 -323
  172. package/core/.failure/tools/check_failures.ps1 +0 -387
  173. package/core/.failure/tools/log_failure.ps1 +0 -474
  174. package/core/.formation/.episode-input.json +0 -10
  175. package/core/.formation/.merge-lock +0 -1
  176. package/core/.formation/lead.yaml +0 -118
  177. package/core/.formation/legacy.bak/designer.yaml +0 -57
  178. package/core/.formation/legacy.bak/pm.yaml +0 -57
  179. package/core/.formation/legacy.bak/qa.yaml +0 -57
  180. package/core/.formation/legacy.bak/review.yaml +0 -62
  181. package/core/.formation/legacy.bak/scheduler.yaml +0 -129
  182. package/core/.formation/legacy.bak/sre.yaml +0 -57
  183. package/core/.formation/role-map.yaml +0 -274
  184. package/core/.formation/roles/_shared/modules/code_review.yaml +0 -98
  185. package/core/.formation/roles/_shared/modules/security.yaml +0 -103
  186. package/core/.formation/roles/_shared/modules/testing.yaml +0 -14
  187. package/core/.formation/roles/backend/role.yaml +0 -93
  188. package/core/.formation/roles/code_reviewer/role.yaml +0 -102
  189. package/core/.formation/roles/database_optimizer/role.yaml +0 -107
  190. package/core/.formation/roles/designer/role.yaml +0 -66
  191. package/core/.formation/roles/developer/role.yaml +0 -75
  192. package/core/.formation/roles/frontend/role.yaml +0 -134
  193. package/core/.formation/roles/incident_response/role.yaml +0 -89
  194. package/core/.formation/roles/qa/role.yaml +0 -89
  195. package/core/.formation/roles/security/role.yaml +0 -87
  196. package/core/.formation/roles/sre/role.yaml +0 -66
  197. package/core/.formation/skills/coordinator.yaml +0 -52
  198. package/core/.formation/solo/diagnosis.yaml +0 -78
  199. package/core/.formation/solo/strategy.yaml +0 -121
  200. package/core/.formation/tests/hello.txt +0 -2
  201. package/core/.formation/tools/coordinator.js +0 -350
  202. package/core/.formation/tools/jev-correction.js +0 -214
  203. package/core/.formation/tools/jev-correction.test.js +0 -178
  204. package/core/.formation/tools/log-reader.js +0 -232
  205. package/core/.formation/tools/revert-daemon-state.js +0 -162
  206. package/core/.formation/tools/test-drift.js +0 -148
  207. package/core/.formation/unit/heimdall.yaml +0 -96
  208. package/core/.formation/unit/plan.yaml +0 -67
  209. package/core/.formation/unit/think.yaml +0 -58
  210. package/core/.kenaz/MUNINN_SNAPSHOT9_EPISODE.json +0 -32
  211. package/core/.kenaz/MUNINN_SNAPSHOT9_RUNE.json +0 -23
  212. package/core/.kenaz/MUNINN_SNAPSHOT9_SUMMARY.md +0 -89
  213. package/core/.kenaz/ash_TASK_1428-20260507.json +0 -14
  214. package/core/.kenaz/muninn_episode_write.ps1 +0 -17
  215. package/core/.kenaz/muninn_snapshot11_rune_candidates.md +0 -63
  216. package/core/.kenaz/muninn_snapshot1_rune_candidates.md +0 -49
  217. package/core/.kenaz/runes_TASK_1428.json +0 -57
  218. package/core/.kenaz/tmp_heimdall_proposal_8d3e392.json +0 -13
  219. package/core/.kenaz/tmp_props.json +0 -1
  220. package/core/.kenaz/tmp_sounddrop_t1_prompt.txt +0 -371
  221. package/core/.rule/MECHANIZED.md +0 -61
  222. package/core/.rule/general/cortex-memory-recall.yaml +0 -446
  223. package/core/.rule/general/pipeline.yaml +0 -246
  224. package/core/.rule/general/sunny-access-control.yaml +0 -60
  225. package/core/.rule/general/system-invariants.yaml +0 -231
  226. package/core/.rule/pipeline/PPL-002-completed-task-archival.yaml +0 -528
  227. package/core/.rule/pipeline/auto-update.yaml +0 -282
  228. package/core/.rule/pipeline/task-execution.yaml +0 -365
  229. package/core/.specialist/Ansuz/concepts/phase_protocol.yaml +0 -65
  230. package/core/.specialist/Ansuz/experiments/boot_ablation_replay.js +0 -197
  231. package/core/.specialist/Ansuz/tools/bootstrap-anchors.js +0 -289
  232. package/core/.specialist/Ansuz/workflow.yaml +0 -1225
  233. package/core/.specialist/experiments/rg_benchmark.js +0 -523
  234. package/core/.specialist/experiments/rg_benchmark_results.json +0 -27
  235. package/core/.specialist/tools/jev-optional-context.js +0 -107
  236. package/core/.specialist/tools/jev-optional-context.test.js +0 -152
  237. package/core/.specialist/tools/memory-action-log.js +0 -839
  238. package/core/.specialist/tools/phase-gate.js +0 -3534
  239. package/core/.specialist/tools/phase-gate.test.js +0 -85
  240. package/core/.specialist/tools/precompute-runner.js +0 -444
  241. package/core/.specialist/tools/rule-engine.js +0 -621
  242. package/core/.specialist/tools/task-bridge-jev.test.js +0 -170
  243. package/core/.synapse/memory-shared.json.sync +0 -1
  244. package/core/.system/agent-skills/README.md +0 -724
  245. package/core/.system/cli-tools/README.md +0 -724
  246. package/core/.system/cortex/MODULES.md +0 -1046
  247. package/core/.system/dashboard/FRONTEND.md +0 -812
  248. package/core/.system/dashboard/README.md +0 -737
  249. package/core/.system/failure/README.md +0 -723
  250. package/core/.system/formation/LEGACY_SKILLS.md +0 -974
  251. package/core/.system/formation/POST_COMPLETE.md +0 -602
  252. package/core/.system/formation/README.md +0 -1094
  253. package/core/.system/formation/TOOLS_REFERENCE.md +0 -1145
  254. package/core/.system/kenaz/README.md +0 -787
  255. package/core/.system/memory/README.md +0 -719
  256. package/core/.system/pipeline/README.md +0 -712
  257. package/core/.system/rule/README.md +0 -794
  258. package/core/.system/sunny/README.md +0 -476
  259. package/core/.system/sunny/RULES.json +0 -89
  260. package/core/.system/sunny/knowledge/INDEX.md +0 -37
  261. package/core/.system/sunny/knowledge/agent-teams-api.md +0 -0
  262. package/core/.system/sunny/knowledge/ansuz-specialist.md +0 -500
  263. package/core/.system/sunny/knowledge/claude-cli-spawn.md +0 -177
  264. package/core/.system/sunny/knowledge/collaboration-api.md +0 -925
  265. package/core/.system/sunny/teammates/README.md +0 -107
  266. package/core/.system/sunny/teammates/how_to_use.yaml +0 -101
  267. package/core/.system/sunny/teammates/tools/headless/launcher.js +0 -318
  268. package/core/.system/sunny/teammates/tools/powershell/launcher.js +0 -241
  269. package/core/.system/sunny/teammates/tools/powershell/start.bat +0 -50
  270. package/core/.system/sunny/teammates/tools/utils/env.js +0 -96
  271. package/core/.system/sunny/teammates/tools/utils/format-output.js +0 -329
  272. package/core/.system/sunny/tools.json +0 -101
  273. package/core/dev/scripts/cleanup-queue.js +0 -184
  274. package/core/dev/scripts/cleanup_queue.js +0 -86
  275. package/core/dev/scripts/legacy/README.md +0 -39
  276. package/core/dev/scripts/legacy/dev_agent_scheduler.ps1.bak +0 -536
  277. package/core/dev/scripts/legacy/multi_agent_scheduler.ps1.bak +0 -1978
  278. package/core/dev/scripts/matrix/CLI_README.md +0 -214
  279. package/core/dev/scripts/matrix/README.md +0 -310
  280. package/core/dev/scripts/matrix/package-lock.json +0 -4266
  281. package/core/dev/scripts/matrix/package.json +0 -55
  282. package/core/dev/scripts/matrix/src/abbreviations.ts +0 -295
  283. package/core/dev/scripts/matrix/src/cli/commands/convert.ts +0 -211
  284. package/core/dev/scripts/matrix/src/cli/commands/create.ts +0 -95
  285. package/core/dev/scripts/matrix/src/cli/commands/delete.ts +0 -102
  286. package/core/dev/scripts/matrix/src/cli/commands/list-tags.ts.wip +0 -140
  287. package/core/dev/scripts/matrix/src/cli/commands/manage-tags.ts.wip +0 -173
  288. package/core/dev/scripts/matrix/src/cli/commands/query.ts +0 -261
  289. package/core/dev/scripts/matrix/src/cli/commands/read.ts +0 -77
  290. package/core/dev/scripts/matrix/src/cli/commands/stats.ts.wip +0 -168
  291. package/core/dev/scripts/matrix/src/cli/commands/tokens.ts.wip +0 -126
  292. package/core/dev/scripts/matrix/src/cli/commands/update.ts +0 -147
  293. package/core/dev/scripts/matrix/src/cli/commands/validate.ts +0 -275
  294. package/core/dev/scripts/matrix/src/cli/index.ts +0 -350
  295. package/core/dev/scripts/matrix/src/cli/utils/file-handler.ts +0 -72
  296. package/core/dev/scripts/matrix/src/cli/utils/logger.ts +0 -65
  297. package/core/dev/scripts/matrix/src/index.ts +0 -62
  298. package/core/dev/scripts/matrix/src/indexer/tag-indexer.ts +0 -165
  299. package/core/dev/scripts/matrix/src/parser.ts +0 -281
  300. package/core/dev/scripts/matrix/src/serializer.ts +0 -151
  301. package/core/dev/scripts/matrix/src/validator.ts +0 -301
  302. package/core/dev/scripts/matrix/tests/abbreviations.test.ts +0 -122
  303. package/core/dev/scripts/matrix/tests/cli.test.ts +0 -177
  304. package/core/dev/scripts/matrix/tests/convert.test.ts +0 -143
  305. package/core/dev/scripts/matrix/tests/parser.test.ts +0 -203
  306. package/core/dev/scripts/matrix/tests/query.test.ts +0 -85
  307. package/core/dev/scripts/matrix/tests/serializer.test.ts +0 -197
  308. package/core/dev/scripts/matrix/tests/validate.test.ts +0 -141
  309. package/core/dev/scripts/matrix/tests/validator.test.ts +0 -167
  310. package/core/dev/scripts/matrix/tsconfig.json +0 -20
  311. package/core/dev/scripts/matrix/types/index.d.ts +0 -111
  312. package/core/dev/scripts/matrix/types/index.d.ts.map +0 -1
  313. package/core/dev/scripts/matrix/types/index.js +0 -8
  314. package/core/dev/scripts/matrix/types/index.js.map +0 -1
  315. package/core/dev/scripts/matrix/types/index.ts +0 -124
  316. package/core/dev/scripts/memory-usage-report.js +0 -152
  317. package/core/dev/scripts/probe/ansuz-scaffold-ablation.js +0 -579
  318. package/core/dev/scripts/probe/ansuz-scaffold-ablation.test.js +0 -244
  319. package/core/dev/scripts/probe/hook-latency-probe.js +0 -315
  320. package/core/dev/scripts/probe/hook-latency-probe.test.js +0 -105
  321. package/core/dev/scripts/probe/prediction-signal-auc.js +0 -483
  322. package/core/dev/scripts/probe/prediction-signal-auc.test.js +0 -200
  323. package/core/dev/scripts/test-pty-ws-tunnel.js +0 -229
  324. package/core/dev/scripts/validate_pipeline.js +0 -197
  325. package/core/dev/spikes/task2145-evidence-20261004/backend-log-excerpt.txt +0 -56
  326. package/core/dev/spikes/task2145-evidence-20261004/graph.shadow +0 -0
  327. package/core/dev/spikes/task2145-evidence-20261004/graph.wal +0 -0
  328. package/core/dev/spikes/task2145-evidence-20261004/graph_corrupt_suspect.marker +0 -1
  329. package/core/plugins/kenaz/commands/strategy.md +0 -141
@@ -78,7 +78,7 @@ description: QA Lead(溝通者)- 測試策略、團隊調度、品質保證
78
78
 
79
79
  **你的操作**:
80
80
  1. 讀取 `dev/PRODUCT_SPEC.md` - 了解專案規格
81
- 2. 讀取相關任務文件(`dev/pipeline/tasks/TASK_XXX.yaml`)- 了解驗收標準
81
+ 2. 讀取相關任務文件(`node .collaboration/core/task-api.js get TASK_XXX`)- 了解驗收標準
82
82
  3. 讀取 `.failure/INDEX.yaml` - 檢查相關失敗模式(AGT-005 規則)
83
83
 
84
84
  **CLI 匯報格式**:
@@ -156,14 +156,14 @@ description: QA Lead(溝通者)- 測試策略、團隊調度、品質保證
156
156
  4. 搜尋相關代碼(Grep `backend/` 或 `src/`)
157
157
  5. 檢查 API 文檔(Read `dev/API_SPEC.md`)
158
158
  6. 查閱歷史缺陷(Grep `dev/BUG_LIST.md`)
159
- 7. 查閱類似任務(Grep `dev/pipeline/completed/`)
159
+ 7. 查閱類似任務(`task-api.js search KEYWORD`)
160
160
 
161
161
  **CLI 匯報格式**:
162
162
  ```
163
163
  🔍 背景調研
164
164
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
165
165
  相關 Feature: F-XXX
166
- 驗收標準: dev/pipeline/tasks/TASK_XXX.yaml
166
+ 驗收標準: `task-api.js get TASK_XXX`
167
167
  現有測試: tests/test_user_service.py
168
168
  測試覆蓋率: 65%(需提升至 80%)
169
169
  相關代碼: backend/services/user_service.py
@@ -735,10 +735,10 @@ Agent 類型根據缺陷性質分配(後端 bug→backend, 前端 bug→fronte
735
735
 
736
736
  ```bash
737
737
  # 讀取新建立的任務文件
738
- ls dev/pipeline/tasks/TASK_*_fix_*.yaml
738
+ node .collaboration/core/task-api.js list --status backlog | grep fix
739
739
 
740
- # 確認 TASK_QUEUE.json 已更新
741
- cat dev/pipeline/TASK_QUEUE.json | grep "fix" -A 5
740
+ # 確認任務卡已建立
741
+ node .collaboration/core/task-api.js search fix
742
742
  ```
743
743
 
744
744
  #### 10.5 最終匯報
@@ -757,8 +757,7 @@ cat dev/pipeline/TASK_QUEUE.json | grep "fix" -A 5
757
757
  | TASK_204 | 缺少 rate limiting | backend | P1 |
758
758
 
759
759
  Pipeline 已更新:
760
- ✓ TASK_QUEUE.json(+4 修復任務)
761
- ✓ PROGRESS.md
760
+ ✓ 任務卡(+4 修復任務)
762
761
 
763
762
  Issue Report: dev/qa/QA_ISSUES_20260215_143000.md
764
763
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -875,7 +874,7 @@ Issue Report: dev/qa/QA_ISSUES_20260215_143000.md
875
874
  🔍 背景調研
876
875
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
877
876
  相關 Feature: F-003(用戶系統)
878
- 驗收標準: dev/pipeline/tasks/TASK_089.yaml
877
+ 驗收標準: `task-api.js get TASK_089`
879
878
  現有測試: 無
880
879
  測試覆蓋率: 0%(需建立測試)
881
880
  相關代碼: backend/services/auth_service.py
@@ -981,8 +980,7 @@ Task(
981
980
  | TASK_204 | 缺少 rate limiting | backend | P1 |
982
981
 
983
982
  Pipeline 已更新:
984
- ✓ TASK_QUEUE.json(+4 修復任務)
985
- ✓ PROGRESS.md
983
+ ✓ 任務卡(+4 修復任務)
986
984
 
987
985
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
988
986
  下一步: 執行 `/Ansuz` 派工修復,完成後 `/qa` 回歸測試
@@ -1246,12 +1244,9 @@ QA Team 將遵循以下規範(參考 `.rule/code/` 規則):
1246
1244
 
1247
1245
  執行任務前,檢查相關失敗模式(遵循 AGT-005 規則):
1248
1246
 
1249
- ```powershell
1250
- # 檢查 QA 相關失敗模式
1251
- .\.failure\tools\check_failures.ps1 -AgentType "qa"
1252
-
1253
- # 檢查測試相關失敗模式
1254
- .\.failure\tools\check_failures.ps1 -ScopePath "tests/"
1247
+ ```bash
1248
+ # 讀索引,再 Grep 與任務 scope 相關的失敗記錄
1249
+ Grep pattern="tests|關鍵字" path=".failure/"
1255
1250
  ```
1256
1251
 
1257
1252
  **常見失敗模式**:
@@ -4,296 +4,46 @@ aliases:
4
4
  - 規格優化
5
5
  - spec
6
6
  - optimizer
7
- description: 專案規格優化、文件整理、知識沉澱專家。根據 .failure、.memory、.rule 進行系統性改良。
7
+ description: 專案規格優化、文件整理、知識沉澱專家。根據 .failure、.rule 與任務卡進行系統性改良。
8
8
  ---
9
9
 
10
10
  # Spec Optimizer Agent
11
11
 
12
12
  ## 角色
13
13
 
14
- 你是一名**規格優化與知識管理專家**,專注於提升專案的規格品質、整理開發經驗、優化工作流程。你的核心職責是將散落的知識系統化、從失敗中提煉規則、持續優化專案文件。
14
+ 規格優化與知識管理專家:提升規格品質、整理開發經驗、優化文件。
15
15
 
16
16
  ## 核心職責
17
17
 
18
- ### 1. 規格優化
19
- - 審查並優化 `dev/PRODUCT_SPEC.md`
20
- - 確保 Feature ID 制度完整(F-XXX)
21
- - 驗證規格與實作的一致性
22
- - 識別規格漂移(Spec Drift)
23
-
24
- ### 2. 文件整理
25
- - 更新 `.memory/CONTEXT.md`(專案概況)
26
- - 更新 `C:/Users/User/.claude/projects/.../memory/MEMORY.md`(個人教訓)
27
- - 整理 `dev/pipeline/PROGRESS.md`
28
- - 維護 `.rule/` 規則庫
29
-
30
- ### 3. 知識沉澱
31
- - 從 `.failure/` 提取失敗經驗
32
- - 將重複失敗模式提升為 `.rule/` 規則
33
- - 記錄關鍵決策和權衡(ADR)
34
- - 建立最佳實踐文件
35
-
36
- ### 4. 系統改良
37
- - 分析工作流程瓶頸
38
- - 提出改進建議
39
- - 優化 Agent 協作流程
40
- - 建立自動化腳本
41
-
42
- ## 技能
43
-
44
- * **文件撰寫**:清晰、結構化的技術文件
45
- * **知識管理**:分類、索引、檢索優化
46
- * **模式識別**:從失敗中發現規律
47
- * **規格設計**:Feature ID、驗收標準、追溯性
48
- * **流程優化**:識別瓶頸、自動化機會
18
+ 1. **規格優化**:審查 `dev/PRODUCT_SPEC.md`;確保 Feature ID(F-XXX)完整;驗證規格與實作一致;識別規格漂移。
19
+ 2. **文件整理**:維護 `.rule/` 規則庫與 `.failure/` 失敗索引;更新 PRODUCT_SPEC 的 Feature 狀態。
20
+ 3. **知識沉澱**:重複出現的失敗提升為規則;教訓用 `kenaz learn add` 或 Claude 原生記憶檔。
21
+ 4. **系統改良**:找出文件間不一致、過期描述並修正。
49
22
 
50
23
  ## 工作流程
51
24
 
52
- ### 階段 1:評估現狀
53
-
54
- **輸入**:用戶請求(例如:「整理最近的開發記憶點」)
55
-
56
- **執行步驟**:
57
- 1. 讀取關鍵文件:
58
- - `dev/PRODUCT_SPEC.md`(了解專案規格)
59
- - `dev/pipeline/PROGRESS.md`(了解最新進度)
60
- - `.memory/CONTEXT.md`(了解專案現狀)
61
- - `.failure/INDEX.yaml`(了解失敗記錄)
62
-
63
- 2. 識別待處理事項:
64
- - 哪些 Feature 已完成但未更新狀態?
65
- - 哪些失敗模式重複出現(需要提升為規則)?
66
- - 哪些記憶點需要更新?
67
- - 哪些文件缺失或過時?
68
-
69
- 3. 提出整理計劃:
70
- ```
71
- 發現以下待整理事項:
72
- 1. PRODUCT_SPEC.md - F-007 狀態需更新為 completed
73
- 2. MEMORY.md - 缺少 2/4-2/5 的開發教訓
74
- 3. .failure/ - FAIL-003 重複出現,建議提升為規則
75
-
76
- 預估時間:30 分鐘
77
- ```
78
-
79
- ### 階段 2:執行整理
80
-
81
- **優先順序**:
82
- 1. **Critical**:規格漂移修正、嚴重失敗記錄
83
- 2. **High**:MEMORY.md 更新、重要決策記錄
84
- 3. **Medium**:CONTEXT.md 更新、文件格式優化
85
- 4. **Low**:錦上添花的改進
86
-
87
- **執行原則**:
88
- - ✅ 保持文件簡潔(CONTEXT.md < 100 行)
89
- - ✅ 使用結構化格式(Markdown 表格、清單)
90
- - ✅ 提供可執行範例(程式碼片段、指令)
91
- - ✅ 記錄時間戳和來源
92
- - ✅ 交叉引用相關文件
93
-
94
- **範例輸出**:
95
-
96
- #### 更新 MEMORY.md
97
- ```markdown
98
- ## .failure 系統 (2026-02-05)
99
-
100
- ### 系統建立完成
101
- - 五大分類:Agent 執行、代碼品質、架構、Pipeline、數據完整性
102
- - 三個初始失敗記錄:FAIL-001, FAIL-002, FAIL-003
103
- - 自動化工具:check_failures.ps1, log_failure.ps1, fix_json.js
104
-
105
- ### 關鍵學習
106
- 1. **JSON BOM 問題**(FAIL-002):Windows 編輯器會加 BOM,導致解析失敗
107
- - 解決:使用 fix_json.js 自動移除
108
- 2. **Queue 污染問題**(FAIL-003):Scheduler 從 completed/ 同步導致
109
- - 解決:改為手動封存(/archive 指令)
110
- ```
25
+ ### 1. 評估現狀
26
+ 讀取:
27
+ * `dev/PRODUCT_SPEC.md`
28
+ * `.failure/INDEX.yaml`(失敗模式索引)
29
+ * `.rule/INDEX.yaml`(規則索引)
30
+ * 任務狀態:`node .collaboration/core/task-api.js stats`、`list --status done`
111
31
 
112
- #### 更新 CONTEXT.md
113
- ```markdown
114
- ## 已完成功能
32
+ ### 2. 執行整理
33
+ * 更新 PRODUCT_SPEC.md 中已完成 Feature 的狀態
34
+ * 失敗模式在 INDEX 中補齊或標為 retired;重複 2 次以上的提升為 `.rule/` 規則
35
+ * 清除過期文件描述(指向已刪除檔案、已退役系統的段落)
115
36
 
116
- | 功能 | 狀態 | 備註 |
117
- |------|------|------|
118
- | 錯誤學習系統 (.failure/) | ✅ | 五分類、三失敗記錄、自動化工具 |
119
- | 手動記憶點封存 (/archive) | ✅ | 取代自動清理,用戶控制 |
120
- ```
121
-
122
- #### 更新 PRODUCT_SPEC.md
123
- ```yaml
124
- # F-007: 錯誤學習系統 (.failure)
125
- - Status: completed ✅
126
- - Completed: 2026-02-05
127
- ```
128
-
129
- ### 階段 3:驗證品質
130
-
131
- **檢查清單**:
132
- - [ ] 所有 Markdown 語法正確
133
- - [ ] 程式碼範例可執行
134
- - [ ] 時間戳記錄完整
135
- - [ ] 交叉引用連結有效
136
- - [ ] 文件長度適中(< 200 行警告)
137
- - [ ] 結構清晰(標題層級正確)
138
-
139
- **驗證方法**:
37
+ ### 3. 驗證品質
140
38
  ```bash
141
- # 驗證 Markdown 格式
142
- markdownlint .memory/*.md
143
-
144
- # 驗證 JSON 文件
145
- node .failure/tools/validate_json.js dev/pipeline/TASK_QUEUE.json
146
-
147
- # 檢查文件大小
148
- wc -l .memory/CONTEXT.md
39
+ node .failure/tools/validate_json.js <json 檔> # 若有 JSON 檔需驗證
149
40
  ```
41
+ 確認被修改的文件沒有指向不存在的路徑(Grep 驗證)。
150
42
 
151
- ### 階段 4:輸出總結
152
-
153
- **格式**:
154
- ```
155
- ## ✅ 整理完成
156
-
157
- ### 更新的文件
158
- 1. .memory/CONTEXT.md - 新增 .failure 系統、/archive 指令
159
- 2. MEMORY.md - 新增 2/4-2/5 開發教訓章節
160
- 3. dev/PRODUCT_SPEC.md - F-007 標記為 completed
161
-
162
- ### 關鍵改進
163
- - 記錄了 .failure 系統的完整建立過程
164
- - 沉澱了 JSON BOM、Queue 污染的解決方案
165
- - 更新了專案現狀,新 Agent 可快速理解
166
-
167
- ### 建議下一步
168
- - 考慮將 FAIL-003 提升為 PPL-003 規則(已重複 2 次)
169
- - 定期執行 /archive 清理 Queue
170
- ```
171
-
172
- ---
173
-
174
- ## 文件路徑索引
175
-
176
- ### 必讀文件
177
- | 路徑 | 用途 | 更新頻率 |
178
- |------|------|---------|
179
- | `dev/PRODUCT_SPEC.md` | 產品規格與 Feature 狀態 | 每個 Feature 完成時 |
180
- | `.memory/CONTEXT.md` | 專案概況(< 100 行) | 每週或重大變更時 |
181
- | `C:/Users/User/.claude/.../MEMORY.md` | 個人教訓與最佳實踐 | 每次遇到新問題時 |
182
- | `dev/pipeline/PROGRESS.md` | 任務進度追蹤 | 每次任務狀態變更 |
183
-
184
- ### 參考文件
185
- | 路徑 | 用途 |
186
- |------|------|
187
- | `.failure/INDEX.yaml` | 失敗記錄索引 |
188
- | `.rule/INDEX.yaml` | 規則索引 |
189
- | `CLAUDE.md` | 專案指導文件 |
190
- | `.memory/COMPLETED_TASKS.json` | 歷史已完成任務 |
191
-
192
- ---
193
-
194
- ## 特殊場景處理
195
-
196
- ### 場景 1:新 Agent Session 開始
197
- **目標**:讓新 Agent 快速理解專案狀態
198
-
199
- **執行**:
200
- 1. 確保 `.memory/CONTEXT.md` 是最新的
201
- 2. 檢查 `PROGRESS.md` 的 Last Update 時間
202
- 3. 驗證 Feature 狀態與實際一致
203
-
204
- ### 場景 2:重大失敗發生
205
- **目標**:記錄失敗並防止重複
206
-
207
- **執行**:
208
- 1. 使用 `.failure/tools/log_failure.ps1` 記錄
209
- 2. 分析是否與現有失敗記錄重複
210
- 3. 如果重複 >= 2 次,提議提升為 `.rule/` 規則
211
-
212
- ### 場景 3:Feature 完成
213
- **目標**:更新規格狀態
214
-
215
- **執行**:
216
- 1. 更新 `PRODUCT_SPEC.md` 中的 Feature 狀態
217
- 2. 記錄完成時間
218
- 3. 更新 `CONTEXT.md` 的已完成功能列表
219
-
220
- ### 場景 4:定期維護
221
- **目標**:保持文件健康
222
-
223
- **執行**(建議每週一次):
224
- 1. 檢查 `CONTEXT.md` 行數(目標 < 100 行)
225
- 2. 封存舊任務(執行 `/archive`)
226
- 3. 清理過時的記憶點
227
- 4. 驗證所有文件的 Markdown 格式
228
-
229
- ---
230
-
231
- ## 輸出範本
232
-
233
- ### 快速整理(30 分鐘)
234
- ```markdown
235
- ## 📝 快速整理報告
236
-
237
- ### 更新內容
238
- 1. ✅ CONTEXT.md - 新增 [功能名稱]
239
- 2. ✅ MEMORY.md - 記錄 [日期] 的教訓
240
- 3. ✅ PRODUCT_SPEC.md - 更新 F-XXX 狀態
241
-
242
- ### 關鍵變更
243
- - [變更 1]
244
- - [變更 2]
245
-
246
- ### 時間消耗
247
- - 評估:5 分鐘
248
- - 執行:20 分鐘
249
- - 驗證:5 分鐘
250
- ```
251
-
252
- ### 完整整理(1-2 小時)
253
- ```markdown
254
- ## 📚 完整整理報告
255
-
256
- ### 執行摘要
257
- 本次整理涵蓋 [日期範圍],更新了 [N] 個文件,記錄了 [N] 個關鍵學習。
258
-
259
- ### 更新文件
260
- | 文件 | 變更類型 | 說明 |
261
- |------|---------|------|
262
- | CONTEXT.md | 新增 | 新功能 X |
263
- | MEMORY.md | 新增章節 | 失敗教訓 Y |
264
- | PRODUCT_SPEC.md | 狀態更新 | F-XXX completed |
265
-
266
- ### 關鍵學習
267
- 1. **[學習 1]**:[描述 + 解決方案]
268
- 2. **[學習 2]**:[描述 + 解決方案]
269
-
270
- ### 提升為規則的建議
271
- - FAIL-XXX → RULE-XXX:[理由]
272
-
273
- ### 下一步建議
274
- - [ ] [建議 1]
275
- - [ ] [建議 2]
276
- ```
277
-
278
- ---
279
-
280
- ## 注意事項
281
-
282
- 1. **保持簡潔**:CONTEXT.md 務必 < 100 行,過長則分離到其他文件
283
- 2. **時間戳**:所有記憶點必須記錄日期
284
- 3. **可執行**:程式碼範例必須能直接執行
285
- 4. **交叉引用**:相關內容互相連結
286
- 5. **版本控制**:重大變更前先備份
287
-
288
- ## 協作方式
289
-
290
- **與其他 Agent 的分工**:
291
- - **Product Manager**:建立任務 → Spec Optimizer 更新規格
292
- - **Dev Agent**:完成開發 → Spec Optimizer 記錄經驗
293
- - **QA Engineer**:發現 Bug → Spec Optimizer 記錄失敗模式
43
+ ### 4. 輸出總結
44
+ 列出:更新的文件、關鍵改進、建議下一步。
294
45
 
295
- **何時調用此 Agent**:
296
- - 完成重要里程碑後
297
- - 累積多個失敗記錄時
298
- - 新 Agent 需要理解專案時
299
- - 定期維護(建議每週)
46
+ ## 特殊場景
47
+ * **重大失敗發生**:先記錄到 `.failure/`,再評估是否提升為規則。
48
+ * **Feature 完成**:更新 PRODUCT_SPEC.md 狀態。
49
+ * **定期維護**(建議每週):掃描過期文件與失效連結。
@@ -1324,12 +1324,9 @@ SRE Team 將遵循以下規範(參考 `.rule/code/` 規則):
1324
1324
 
1325
1325
  執行任務前,檢查相關失敗模式(遵循 AGT-005 規則):
1326
1326
 
1327
- ```powershell
1328
- # 檢查 SRE 相關失敗模式
1329
- .\.failure\tools\check_failures.ps1 -AgentType "sre"
1330
-
1331
- # 檢查 Supabase 相關失敗模式
1332
- .\.failure\tools\check_failures.ps1 -ScopePath "supabase/"
1327
+ ```bash
1328
+ # 讀索引,再 Grep 與任務 scope 相關的失敗記錄
1329
+ Grep pattern="supabase|關鍵字" path=".failure/"
1333
1330
  ```
1334
1331
 
1335
1332
  **常見失敗模式**:
@@ -11,7 +11,6 @@
11
11
  - **目錄即狀態** - 任務狀態由所在目錄決定,直觀易懂
12
12
  - **YAML 格式** - 人類可讀的任務檔案格式
13
13
  - **簡潔 ID** - 可讀性高的任務 ID(TASK_171)
14
- - **向後相容** - API 輸出相容舊版 Dashboard
15
14
 
16
15
  ## 目錄結構
17
16
 
@@ -19,7 +18,7 @@
19
18
  .collaboration/
20
19
  ├── core/ # 核心模組
21
20
  │ ├── task-api.js # 統一任務 API v3.0
22
- │ ├── task-api-json.js # JSON 輸出(Dashboard 相容)
21
+ │ ├── task-api-json.js # JSON 輸出
23
22
  │ └── id-generator.js # ID 生成器
24
23
  ├── tasks/ # 任務存儲(按狀態分目錄)
25
24
  │ ├── backlog/ # 待處理 (原 pending)
@@ -105,7 +104,7 @@ node .collaboration/core/task-api.js complete TASK_172
105
104
  # 移動任務
106
105
  node .collaboration/core/task-api.js move TASK_172 blocked
107
106
 
108
- # JSON 輸出(供 Dashboard 使用)
107
+ # JSON 輸出
109
108
  node .collaboration/core/task-api-json.js
110
109
  ```
111
110
 
@@ -791,21 +791,7 @@ class TaskAPI {
791
791
  }
792
792
  }
793
793
 
794
- // 2. 舊系統(dev/pipeline/)— 只有 Core 專案才掃描
795
- // 子專案(.kenaz/tasks/)不再載入 legacy pipeline
796
- const isSubProject = this.tasksDir.includes('.kenaz');
797
- if (!isSubProject) {
798
- const legacyTasks = await this._scanLegacyPipeline();
799
- for (const t of legacyTasks) {
800
- if (!seenIds.has(t.id)) {
801
- t._source = 'old';
802
- seenIds.add(t.id);
803
- allTasks.push(t);
804
- }
805
- }
806
- }
807
-
808
- // 3. 專案隔離:不再跨專案載入任務
794
+ // 2. 專案隔離:不再跨專案載入任務
809
795
  // 主專案只讀主專案任務,子專案只讀子專案任務
810
796
 
811
797
  return allTasks;
@@ -889,41 +875,6 @@ class TaskAPI {
889
875
  };
890
876
  }
891
877
 
892
- /**
893
- * 掃描舊系統 dev/pipeline/(TASK_QUEUE.json + completed/ YAML)
894
- */
895
- async _scanLegacyPipeline() {
896
- const projectRoot = this._resolveProjectRoot();
897
- const pipelineDir = path.join(projectRoot, 'dev', 'pipeline');
898
- const tasks = [];
899
-
900
- // 2a. 從 TASK_QUEUE.json 讀取活躍(非 completed)任務
901
- // completed 任務視為 archived,不在 Dashboard 顯示
902
- const queueFile = path.join(pipelineDir, 'TASK_QUEUE.json');
903
- try {
904
- const content = await fs.readFile(queueFile, 'utf8');
905
- // 移除 BOM
906
- const cleanContent = content.charCodeAt(0) === 0xFEFF ? content.slice(1) : content;
907
- const queue = JSON.parse(cleanContent);
908
- if (Array.isArray(queue.tasks)) {
909
- for (const t of queue.tasks) {
910
- if (t.id && t.status !== 'completed') {
911
- t._file_path = queueFile;
912
- t._source = 'old';
913
- tasks.push(t);
914
- }
915
- }
916
- }
917
- } catch (e) {
918
- // TASK_QUEUE.json 不存在或解析失敗,靜默跳過
919
- }
920
-
921
- // 2b. 不載入 completed/ 目錄 — 視為 archived
922
- // (舊系統的 completed/ ≈ 新系統的 archived/)
923
-
924
- return tasks;
925
- }
926
-
927
878
  /**
928
879
  * 找出最大的任務編號
929
880
  */
@@ -2359,11 +2310,11 @@ class TaskAPI {
2359
2310
  }
2360
2311
 
2361
2312
  /**
2362
- * Reload: 確保目錄結構存在 + 遷移舊系統任務到新系統
2313
+ * Reload: 確保目錄結構存在 + 把 .collaboration/tasks/ 的任務遷移到 .kenaz/tasks/
2363
2314
  *
2364
2315
  * 1. 建立所有 status 目錄
2365
- * 2. 掃描舊系統 dev/pipeline/ 的任務
2366
- * 3. 將尚未存在於新系統的任務遷移過來
2316
+ * 2. 收集已存在的 task ID
2317
+ * 3. 子專案:把 .collaboration/tasks/ 中尚未存在的任務複製過來
2367
2318
  *
2368
2319
  * @returns {{ created_dirs: string[], migrated: number, skipped: number, errors: string[] }}
2369
2320
  */
@@ -2395,93 +2346,9 @@ class TaskAPI {
2395
2346
  } catch { /* dir doesn't exist yet */ }
2396
2347
  }
2397
2348
 
2398
- // 3. 掃描舊系統
2399
2349
  const projectRoot = this._resolveProjectRoot();
2400
- const pipelineDir = path.join(projectRoot, 'dev', 'pipeline');
2401
-
2402
- // 3a. dev/pipeline/tasks/*.yaml → backlog/
2403
- const legacyTasksDir = path.join(pipelineDir, 'tasks');
2404
- if (fsSync.existsSync(legacyTasksDir)) {
2405
- try {
2406
- const files = await fs.readdir(legacyTasksDir);
2407
- for (const file of files) {
2408
- if (!file.startsWith('TASK_') || !file.endsWith('.yaml')) continue;
2409
- const id = file.split('_').slice(0, 2).join('_');
2410
- if (existingIds.has(id)) {
2411
- stats.skipped++;
2412
- continue;
2413
- }
2414
- try {
2415
- const src = path.join(legacyTasksDir, file);
2416
- const dst = path.join(this.tasksDir, 'backlog', file);
2417
- await fs.copyFile(src, dst);
2418
- existingIds.add(id);
2419
- stats.migrated++;
2420
- } catch (e) {
2421
- stats.errors.push(`${file}: ${e.message}`);
2422
- }
2423
- }
2424
- } catch { /* ignore */ }
2425
- }
2426
-
2427
- // 3b. dev/pipeline/completed/*.yaml → done/
2428
- const legacyCompletedDir = path.join(pipelineDir, 'completed');
2429
- if (fsSync.existsSync(legacyCompletedDir)) {
2430
- try {
2431
- const files = await fs.readdir(legacyCompletedDir);
2432
- for (const file of files) {
2433
- if (!file.startsWith('TASK_') || !file.endsWith('.yaml')) continue;
2434
- const id = file.split('_').slice(0, 2).join('_');
2435
- if (existingIds.has(id)) {
2436
- stats.skipped++;
2437
- continue;
2438
- }
2439
- try {
2440
- const src = path.join(legacyCompletedDir, file);
2441
- const dst = path.join(this.tasksDir, 'done', file);
2442
- await fs.copyFile(src, dst);
2443
- existingIds.add(id);
2444
- stats.migrated++;
2445
- } catch (e) {
2446
- stats.errors.push(`${file}: ${e.message}`);
2447
- }
2448
- }
2449
- } catch { /* ignore */ }
2450
- }
2451
-
2452
- // 3c. TASK_QUEUE.json — 將 JSON 條目轉為 YAML 檔案
2453
- const queueFile = path.join(pipelineDir, 'TASK_QUEUE.json');
2454
- if (fsSync.existsSync(queueFile)) {
2455
- try {
2456
- const content = await fs.readFile(queueFile, 'utf8');
2457
- const cleanContent = content.charCodeAt(0) === 0xFEFF ? content.slice(1) : content;
2458
- const queue = JSON.parse(cleanContent);
2459
- if (Array.isArray(queue.tasks)) {
2460
- for (const task of queue.tasks) {
2461
- if (!task.id || existingIds.has(task.id)) {
2462
- stats.skipped++;
2463
- continue;
2464
- }
2465
- try {
2466
- const status = (task.status || '').toLowerCase();
2467
- const isCompleted = status === 'completed' || status === 'done';
2468
- const targetDir = isCompleted ? 'done' : 'backlog';
2469
- const gitUser = task.assigned_agent || 'system';
2470
- const fileName = `${task.id}_${gitUser}.yaml`;
2471
- const dst = path.join(this.tasksDir, targetDir, fileName);
2472
- const yamlContent = toYAML(task);
2473
- await fs.writeFile(dst, yamlContent);
2474
- existingIds.add(task.id);
2475
- stats.migrated++;
2476
- } catch (e) {
2477
- stats.errors.push(`${task.id}: ${e.message}`);
2478
- }
2479
- }
2480
- }
2481
- } catch { /* ignore */ }
2482
- }
2483
2350
 
2484
- // 4. 子專案 .collaboration/tasks/ → .kenaz/tasks/ 遷移
2351
+ // 3. 子專案 .collaboration/tasks/ → .kenaz/tasks/ 遷移
2485
2352
  // 當 tasksDir 是 .kenaz/tasks/ 時,檢查同專案是否有 .collaboration/tasks/
2486
2353
  const collabTasksDir = path.join(projectRoot, '.collaboration', 'tasks');
2487
2354
  if (this.tasksDir.includes('.kenaz') && fsSync.existsSync(collabTasksDir) && collabTasksDir !== this.tasksDir) {
@@ -187,7 +187,6 @@ task-cli.js list --status pending --priority P1 --assigned-to zhangsan
187
187
  ### 符號說明
188
188
 
189
189
  - `🆕` - 新系統任務(.collaboration/tasks/db/)
190
- - `📦` - 舊系統任務(dev/pipeline/TASK_QUEUE.json)
191
190
 
192
191
  ---
193
192
 
@@ -810,7 +809,6 @@ done
810
809
  ## 相關文檔
811
810
 
812
811
  - [API 參考文檔](./API.md) - JavaScript API 完整文檔
813
- - [遷移指南](./MIGRATION.md) - 從舊系統遷移步驟
814
812
  - [常見問題](./FAQ.md) - 疑難排解指南
815
813
  - [架構設計](./ARCHITECTURE.md) - 系統架構詳細說明
816
814