kenaz 0.3.18 → 0.3.19

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 (308) 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__/m1-hmap-convid.test.js +1 -124
  30. package/core/.formation/tools/dispatch.js +1 -1
  31. package/core/.formation/tools/loader.js +17 -140
  32. package/core/.formation/tools/post-complete.js +0 -31
  33. package/core/.rule/INDEX.yaml +0 -18
  34. package/core/.rule/general/agent-workflow.yaml +14 -164
  35. package/core/.rule/general/project-self-containment.yaml +8 -19
  36. package/core/.rule/general/rust-verify-target.yaml +6 -5
  37. package/core/.rule/general/synapse-code-intelligence.yaml +3 -3
  38. package/core/.specialist/Amelia/capability.yaml +12 -12
  39. package/core/.specialist/Amelia/workflow.yaml +2 -2
  40. package/core/.specialist/Ansuz/SYSTEM_DOC.md +20 -578
  41. package/core/.specialist/Ansuz/cognitive_principles.yaml +2 -3
  42. package/core/.specialist/Ansuz/concepts/boot_rules_summary.yaml +0 -1
  43. package/core/.specialist/Ansuz/concepts/deep_knowledge_pointers.yaml +1 -2
  44. package/core/.specialist/Ansuz/core.yaml +6 -108
  45. package/core/.specialist/Ansuz/guards/lesson_guards.yaml +0 -3
  46. package/core/.specialist/Ansuz/identity_contract.yaml +0 -1
  47. package/core/.specialist/Ansuz/knowledge.yaml +0 -4
  48. package/core/.specialist/Ansuz/rule.yaml +0 -1
  49. package/core/.specialist/Ansuz/tools/handoff-session-identity.test.js +6 -150
  50. package/core/.specialist/tests/runtime-discovery/README.md +1 -1
  51. package/core/.specialist/tools/__tests__/task-2374-usage-counter.test.js +1 -12
  52. package/core/.specialist/tools/prompt-files.test.js +1 -0
  53. package/core/.specialist/tools/task-bridge.js +1 -66
  54. package/core/.system/README.md +11 -552
  55. package/core/.system/collaboration/README.md +10 -174
  56. package/core/CLAUDE.md +1 -6
  57. package/core/KENAZ_CORE_VERSION +1 -1
  58. package/core/dev/scripts/js-yaml-resolution.test.js +1 -1
  59. package/core/dev/scripts/run-rust-tests.js +9 -45
  60. package/core/dev/scripts/rust-verify-worktree.js +4 -4
  61. package/core/dev/scripts/verify-target-dir.js +6 -6
  62. package/core/plugins/kenaz/INVENTORY.md +8 -8
  63. package/core/plugins/kenaz/commands/architect.md +1 -2
  64. package/core/plugins/kenaz/commands/spec.md +1 -1
  65. package/core/plugins/kenaz/commands//347/224/242/345/223/201.md +1 -1
  66. package/core/plugins/kenaz/guidance.md +1 -1
  67. package/core/plugins/kenaz/scripts/sync.js +1 -1
  68. package/core/plugins/kenaz/skills/architect_agent/SKILL.md +11 -92
  69. package/core/plugins/kenaz/skills/assessment_agent/SKILL.md +0 -1
  70. package/core/plugins/kenaz/skills/backend_engineer/SKILL.md +3 -6
  71. package/core/plugins/kenaz/skills/code_reviewer/SKILL.md +1 -1
  72. package/core/plugins/kenaz/skills/code_reviewer/patterns.yaml +1 -1
  73. package/core/plugins/kenaz/skills/designer/SKILL.md +3 -6
  74. package/core/plugins/kenaz/skills/dev_agent/SKILL.md +30 -491
  75. package/core/plugins/kenaz/skills/developer/SKILL.md +3 -6
  76. package/core/plugins/kenaz/skills/feature_agent/SKILL.md +3 -17
  77. package/core/plugins/kenaz/skills/product_manager/SKILL.md +29 -1064
  78. package/core/plugins/kenaz/skills/qa_engineer/SKILL.md +12 -17
  79. package/core/plugins/kenaz/skills/spec_optimizer/SKILL.md +25 -275
  80. package/core/plugins/kenaz/skills/sre_agent/SKILL.md +3 -6
  81. package/package.json +6 -6
  82. package/core/.claude/commands/archive.md +0 -24
  83. package/core/.claude/commands/init.md +0 -112
  84. package/core/.claude/commands/legacy_dev.md +0 -18
  85. package/core/.claude/commands/product-review.md +0 -131
  86. package/core/.claude/commands/strategy.md +0 -141
  87. package/core/.claude/commands/sunny.md +0 -1
  88. package/core/.claude/commands//347/224/242/345/223/201/346/252/242/350/246/226.md +0 -129
  89. package/core/.claude/commands//351/200/262/345/272/246.md +0 -15
  90. package/core/.claude/hooks/__tests__/substrate.test.js +0 -122
  91. package/core/.claude/hooks/_substrate-paths.js +0 -95
  92. package/core/.claude/hooks/context-check.js +0 -51
  93. package/core/.claude/hooks/fatigue-check.js +0 -52
  94. package/core/.claude/hooks/handoff-snapshot-on-commit.js +0 -154
  95. package/core/.claude/hooks/handoff-snapshot-on-question.js +0 -158
  96. package/core/.claude/hooks/handoff-staleness.js +0 -197
  97. package/core/.claude/hooks/jev-thalamus-context.js +0 -17
  98. package/core/.claude/hooks/jev-thalamus-context.test.js +0 -41
  99. package/core/.claude/hooks/lease-release.js +0 -119
  100. package/core/.claude/hooks/lease-touch.js +0 -96
  101. package/core/.claude/hooks/reflex-feedback.js +0 -5
  102. package/core/.claude/hooks/session-init.ps1 +0 -49
  103. package/core/.claude/hooks/sound-event.js +0 -70
  104. package/core/.claude/hooks/sound-event.sh +0 -37
  105. package/core/.claude/hooks/stream-delta.js +0 -169
  106. package/core/.claude/no-hooks.settings.json +0 -3
  107. package/core/.claude/skills/legacy_dev/SKILL.md +0 -202
  108. package/core/.claude/skills/sunny/SKILL.md +0 -74
  109. package/core/.collaboration/cli/commands/assign.js +0 -39
  110. package/core/.collaboration/cli/commands/claim.js +0 -33
  111. package/core/.collaboration/cli/commands/complete.js +0 -44
  112. package/core/.collaboration/cli/commands/create.js +0 -110
  113. package/core/.collaboration/cli/commands/get.js +0 -83
  114. package/core/.collaboration/cli/commands/index.js +0 -52
  115. package/core/.collaboration/cli/commands/list.js +0 -51
  116. package/core/.collaboration/cli/commands/lock.js +0 -45
  117. package/core/.collaboration/cli/commands/rebuild.js +0 -39
  118. package/core/.collaboration/cli/commands/search.js +0 -61
  119. package/core/.collaboration/cli/commands/stats.js +0 -61
  120. package/core/.collaboration/cli/commands/transfer.js +0 -41
  121. package/core/.collaboration/cli/commands/unlock.js +0 -48
  122. package/core/.collaboration/cli/formatters/help-formatter.js +0 -70
  123. package/core/.collaboration/cli/formatters/index.js +0 -7
  124. package/core/.collaboration/cli/task-cli.js +0 -46
  125. package/core/.collaboration/cli/utils/arg-parser.js +0 -74
  126. package/core/.collaboration/cli/utils/git-user.js +0 -25
  127. package/core/.collaboration/cli/utils/index.js +0 -9
  128. package/core/.collaboration/cli/utils/output.js +0 -10
  129. package/core/.collaboration/config/default.yaml +0 -189
  130. package/core/.collaboration/core/conflict-resolver.js +0 -461
  131. package/core/.collaboration/core/conflict-resolver.test.js +0 -389
  132. package/core/.collaboration/core/migrate-legacy.js +0 -260
  133. package/core/.collaboration/docs/API.md +0 -787
  134. package/core/.collaboration/docs/ARCHITECTURE.md +0 -596
  135. package/core/.collaboration/docs/FAQ.md +0 -695
  136. package/core/.collaboration/docs/MIGRATION.md +0 -804
  137. package/core/.collaboration/docs/examples/README.md +0 -320
  138. package/core/.collaboration/docs/examples/advanced-queries.js +0 -261
  139. package/core/.collaboration/docs/examples/basic-usage.js +0 -184
  140. package/core/.collaboration/docs/examples/team-workflow.js +0 -352
  141. package/core/.failure/agent-execution/FAIL-001-agent-no-output.yaml +0 -391
  142. package/core/.failure/agent-execution/FAIL-007-pm-lead-wrong-team-invocation.yaml +0 -0
  143. package/core/.failure/agent-execution/FAIL-010-phase0-poem-format-skipped.yaml +0 -28
  144. package/core/.failure/agent-execution/FAIL-010-skipping-cognitive-checkpoint-after-verification.yaml +0 -59
  145. package/core/.failure/agent-execution/FAIL-012-grep-shortcut-during-investigation.yaml +0 -85
  146. package/core/.failure/architecture/FAIL-006-python-version-compatibility.yaml +0 -445
  147. package/core/.failure/pipeline/FAIL-003-queue-pollution.yaml +0 -335
  148. package/core/.failure/pipeline/README.md +0 -95
  149. package/core/.failure/retired/FAIL-009-skipping-synapse-pulse-before-code-change.yaml +0 -49
  150. package/core/.failure/tools/USAGE_GUIDE.md +0 -323
  151. package/core/.failure/tools/check_failures.ps1 +0 -387
  152. package/core/.failure/tools/log_failure.ps1 +0 -474
  153. package/core/.formation/.episode-input.json +0 -10
  154. package/core/.formation/.merge-lock +0 -1
  155. package/core/.formation/lead.yaml +0 -118
  156. package/core/.formation/legacy.bak/designer.yaml +0 -57
  157. package/core/.formation/legacy.bak/pm.yaml +0 -57
  158. package/core/.formation/legacy.bak/qa.yaml +0 -57
  159. package/core/.formation/legacy.bak/review.yaml +0 -62
  160. package/core/.formation/legacy.bak/scheduler.yaml +0 -129
  161. package/core/.formation/legacy.bak/sre.yaml +0 -57
  162. package/core/.formation/role-map.yaml +0 -274
  163. package/core/.formation/roles/_shared/modules/code_review.yaml +0 -98
  164. package/core/.formation/roles/_shared/modules/security.yaml +0 -103
  165. package/core/.formation/roles/_shared/modules/testing.yaml +0 -14
  166. package/core/.formation/roles/backend/role.yaml +0 -93
  167. package/core/.formation/roles/code_reviewer/role.yaml +0 -102
  168. package/core/.formation/roles/database_optimizer/role.yaml +0 -107
  169. package/core/.formation/roles/designer/role.yaml +0 -66
  170. package/core/.formation/roles/developer/role.yaml +0 -75
  171. package/core/.formation/roles/frontend/role.yaml +0 -134
  172. package/core/.formation/roles/incident_response/role.yaml +0 -89
  173. package/core/.formation/roles/qa/role.yaml +0 -89
  174. package/core/.formation/roles/security/role.yaml +0 -87
  175. package/core/.formation/roles/sre/role.yaml +0 -66
  176. package/core/.formation/skills/coordinator.yaml +0 -52
  177. package/core/.formation/solo/diagnosis.yaml +0 -78
  178. package/core/.formation/solo/strategy.yaml +0 -121
  179. package/core/.formation/tests/hello.txt +0 -2
  180. package/core/.formation/tools/coordinator.js +0 -350
  181. package/core/.formation/tools/jev-correction.js +0 -214
  182. package/core/.formation/tools/jev-correction.test.js +0 -178
  183. package/core/.formation/tools/log-reader.js +0 -232
  184. package/core/.formation/tools/revert-daemon-state.js +0 -162
  185. package/core/.formation/tools/test-drift.js +0 -148
  186. package/core/.formation/unit/heimdall.yaml +0 -96
  187. package/core/.formation/unit/plan.yaml +0 -67
  188. package/core/.formation/unit/think.yaml +0 -58
  189. package/core/.kenaz/MUNINN_SNAPSHOT9_EPISODE.json +0 -32
  190. package/core/.kenaz/MUNINN_SNAPSHOT9_RUNE.json +0 -23
  191. package/core/.kenaz/MUNINN_SNAPSHOT9_SUMMARY.md +0 -89
  192. package/core/.kenaz/ash_TASK_1428-20260507.json +0 -14
  193. package/core/.kenaz/muninn_episode_write.ps1 +0 -17
  194. package/core/.kenaz/muninn_snapshot11_rune_candidates.md +0 -63
  195. package/core/.kenaz/muninn_snapshot1_rune_candidates.md +0 -49
  196. package/core/.kenaz/runes_TASK_1428.json +0 -57
  197. package/core/.kenaz/tmp_heimdall_proposal_8d3e392.json +0 -13
  198. package/core/.kenaz/tmp_props.json +0 -1
  199. package/core/.kenaz/tmp_sounddrop_t1_prompt.txt +0 -371
  200. package/core/.rule/MECHANIZED.md +0 -61
  201. package/core/.rule/general/cortex-memory-recall.yaml +0 -446
  202. package/core/.rule/general/pipeline.yaml +0 -246
  203. package/core/.rule/general/sunny-access-control.yaml +0 -60
  204. package/core/.rule/general/system-invariants.yaml +0 -231
  205. package/core/.rule/pipeline/PPL-002-completed-task-archival.yaml +0 -528
  206. package/core/.rule/pipeline/auto-update.yaml +0 -282
  207. package/core/.rule/pipeline/task-execution.yaml +0 -365
  208. package/core/.specialist/Ansuz/concepts/phase_protocol.yaml +0 -65
  209. package/core/.specialist/Ansuz/experiments/boot_ablation_replay.js +0 -197
  210. package/core/.specialist/Ansuz/tools/bootstrap-anchors.js +0 -289
  211. package/core/.specialist/Ansuz/workflow.yaml +0 -1225
  212. package/core/.specialist/experiments/rg_benchmark.js +0 -523
  213. package/core/.specialist/experiments/rg_benchmark_results.json +0 -27
  214. package/core/.specialist/tools/jev-optional-context.js +0 -107
  215. package/core/.specialist/tools/jev-optional-context.test.js +0 -152
  216. package/core/.specialist/tools/memory-action-log.js +0 -839
  217. package/core/.specialist/tools/phase-gate.js +0 -3534
  218. package/core/.specialist/tools/phase-gate.test.js +0 -85
  219. package/core/.specialist/tools/precompute-runner.js +0 -444
  220. package/core/.specialist/tools/rule-engine.js +0 -621
  221. package/core/.specialist/tools/task-bridge-jev.test.js +0 -170
  222. package/core/.synapse/memory-shared.json.sync +0 -1
  223. package/core/.system/agent-skills/README.md +0 -724
  224. package/core/.system/cli-tools/README.md +0 -724
  225. package/core/.system/cortex/MODULES.md +0 -1046
  226. package/core/.system/dashboard/FRONTEND.md +0 -812
  227. package/core/.system/dashboard/README.md +0 -737
  228. package/core/.system/failure/README.md +0 -723
  229. package/core/.system/formation/LEGACY_SKILLS.md +0 -974
  230. package/core/.system/formation/POST_COMPLETE.md +0 -602
  231. package/core/.system/formation/README.md +0 -1094
  232. package/core/.system/formation/TOOLS_REFERENCE.md +0 -1145
  233. package/core/.system/kenaz/README.md +0 -787
  234. package/core/.system/memory/README.md +0 -719
  235. package/core/.system/pipeline/README.md +0 -712
  236. package/core/.system/rule/README.md +0 -794
  237. package/core/.system/sunny/README.md +0 -476
  238. package/core/.system/sunny/RULES.json +0 -89
  239. package/core/.system/sunny/knowledge/INDEX.md +0 -37
  240. package/core/.system/sunny/knowledge/agent-teams-api.md +0 -0
  241. package/core/.system/sunny/knowledge/ansuz-specialist.md +0 -500
  242. package/core/.system/sunny/knowledge/claude-cli-spawn.md +0 -177
  243. package/core/.system/sunny/knowledge/collaboration-api.md +0 -925
  244. package/core/.system/sunny/teammates/README.md +0 -107
  245. package/core/.system/sunny/teammates/how_to_use.yaml +0 -101
  246. package/core/.system/sunny/teammates/tools/headless/launcher.js +0 -318
  247. package/core/.system/sunny/teammates/tools/powershell/launcher.js +0 -241
  248. package/core/.system/sunny/teammates/tools/powershell/start.bat +0 -50
  249. package/core/.system/sunny/teammates/tools/utils/env.js +0 -96
  250. package/core/.system/sunny/teammates/tools/utils/format-output.js +0 -329
  251. package/core/.system/sunny/tools.json +0 -101
  252. package/core/dev/scripts/cleanup-queue.js +0 -184
  253. package/core/dev/scripts/cleanup_queue.js +0 -86
  254. package/core/dev/scripts/legacy/README.md +0 -39
  255. package/core/dev/scripts/legacy/dev_agent_scheduler.ps1.bak +0 -536
  256. package/core/dev/scripts/legacy/multi_agent_scheduler.ps1.bak +0 -1978
  257. package/core/dev/scripts/matrix/CLI_README.md +0 -214
  258. package/core/dev/scripts/matrix/README.md +0 -310
  259. package/core/dev/scripts/matrix/package-lock.json +0 -4266
  260. package/core/dev/scripts/matrix/package.json +0 -55
  261. package/core/dev/scripts/matrix/src/abbreviations.ts +0 -295
  262. package/core/dev/scripts/matrix/src/cli/commands/convert.ts +0 -211
  263. package/core/dev/scripts/matrix/src/cli/commands/create.ts +0 -95
  264. package/core/dev/scripts/matrix/src/cli/commands/delete.ts +0 -102
  265. package/core/dev/scripts/matrix/src/cli/commands/list-tags.ts.wip +0 -140
  266. package/core/dev/scripts/matrix/src/cli/commands/manage-tags.ts.wip +0 -173
  267. package/core/dev/scripts/matrix/src/cli/commands/query.ts +0 -261
  268. package/core/dev/scripts/matrix/src/cli/commands/read.ts +0 -77
  269. package/core/dev/scripts/matrix/src/cli/commands/stats.ts.wip +0 -168
  270. package/core/dev/scripts/matrix/src/cli/commands/tokens.ts.wip +0 -126
  271. package/core/dev/scripts/matrix/src/cli/commands/update.ts +0 -147
  272. package/core/dev/scripts/matrix/src/cli/commands/validate.ts +0 -275
  273. package/core/dev/scripts/matrix/src/cli/index.ts +0 -350
  274. package/core/dev/scripts/matrix/src/cli/utils/file-handler.ts +0 -72
  275. package/core/dev/scripts/matrix/src/cli/utils/logger.ts +0 -65
  276. package/core/dev/scripts/matrix/src/index.ts +0 -62
  277. package/core/dev/scripts/matrix/src/indexer/tag-indexer.ts +0 -165
  278. package/core/dev/scripts/matrix/src/parser.ts +0 -281
  279. package/core/dev/scripts/matrix/src/serializer.ts +0 -151
  280. package/core/dev/scripts/matrix/src/validator.ts +0 -301
  281. package/core/dev/scripts/matrix/tests/abbreviations.test.ts +0 -122
  282. package/core/dev/scripts/matrix/tests/cli.test.ts +0 -177
  283. package/core/dev/scripts/matrix/tests/convert.test.ts +0 -143
  284. package/core/dev/scripts/matrix/tests/parser.test.ts +0 -203
  285. package/core/dev/scripts/matrix/tests/query.test.ts +0 -85
  286. package/core/dev/scripts/matrix/tests/serializer.test.ts +0 -197
  287. package/core/dev/scripts/matrix/tests/validate.test.ts +0 -141
  288. package/core/dev/scripts/matrix/tests/validator.test.ts +0 -167
  289. package/core/dev/scripts/matrix/tsconfig.json +0 -20
  290. package/core/dev/scripts/matrix/types/index.d.ts +0 -111
  291. package/core/dev/scripts/matrix/types/index.d.ts.map +0 -1
  292. package/core/dev/scripts/matrix/types/index.js +0 -8
  293. package/core/dev/scripts/matrix/types/index.js.map +0 -1
  294. package/core/dev/scripts/matrix/types/index.ts +0 -124
  295. package/core/dev/scripts/memory-usage-report.js +0 -152
  296. package/core/dev/scripts/probe/ansuz-scaffold-ablation.js +0 -579
  297. package/core/dev/scripts/probe/ansuz-scaffold-ablation.test.js +0 -244
  298. package/core/dev/scripts/probe/hook-latency-probe.js +0 -315
  299. package/core/dev/scripts/probe/hook-latency-probe.test.js +0 -105
  300. package/core/dev/scripts/probe/prediction-signal-auc.js +0 -483
  301. package/core/dev/scripts/probe/prediction-signal-auc.test.js +0 -200
  302. package/core/dev/scripts/test-pty-ws-tunnel.js +0 -229
  303. package/core/dev/scripts/validate_pipeline.js +0 -197
  304. package/core/dev/spikes/task2145-evidence-20261004/backend-log-excerpt.txt +0 -56
  305. package/core/dev/spikes/task2145-evidence-20261004/graph.shadow +0 -0
  306. package/core/dev/spikes/task2145-evidence-20261004/graph.wal +0 -0
  307. package/core/dev/spikes/task2145-evidence-20261004/graph_corrupt_suspect.marker +0 -1
  308. package/core/plugins/kenaz/commands/strategy.md +0 -141
@@ -1,11 +1,7 @@
1
1
  /**
2
2
  * Formation Loader
3
- * YAML 技能定義 + 任務載入(支援新舊兩套任務系統)
4
- *
5
- * 任務系統:
6
- * 新系統 (.collaboration/tasks/) — TASK_151+ 目錄即狀態,YAML 格式
7
- * 舊系統 (dev/pipeline/) — TASK_134~187 JSON 索引 + YAML 檔
8
- * 查詢順序:新系統 → 舊系統 YAML → 舊系統 TASK_QUEUE.json
3
+ * YAML skill definitions + task loading (via task-api.js, which resolves
4
+ * .kenaz/tasks/ first and .collaboration/tasks/ as the legacy fallback).
9
5
  */
10
6
 
11
7
  const { execSync } = require('child_process');
@@ -14,14 +10,10 @@ const fs = require('fs');
14
10
  const yaml = (() => { try { return require('js-yaml'); } catch { return require('../../.vendor/js-yaml.cjs'); } })();
15
11
  const { FORMATION_DIR, COLLABORATION_API, ROOT } = require('./utils');
16
12
 
17
- // 舊系統路徑
18
- const LEGACY_PIPELINE_DIR = path.join(ROOT, 'dev', 'pipeline');
19
- const LEGACY_TASK_QUEUE = path.join(LEGACY_PIPELINE_DIR, 'TASK_QUEUE.json');
20
-
21
13
  /**
22
- * 載入 skill YAML 定義
23
- * @param {string} formation - 陣型名稱 (unit/solo/squad/legion)
24
- * @param {string} skill - 技能名稱
14
+ * Load a skill YAML definition (.formation/<formation>/<skill>.yaml).
15
+ * @param {string} formation - formation name (unit)
16
+ * @param {string} skill - skill name
25
17
  * @returns {object} parsed YAML
26
18
  */
27
19
  function loadSkill(formation, skill) {
@@ -34,48 +26,33 @@ function loadSkill(formation, skill) {
34
26
  }
35
27
 
36
28
  /**
37
- * 載入任務資料(新系統優先,fallback 舊系統)
38
- *
39
- * 查詢順序:
40
- * 1. .collaboration/tasks/ 或 .kenaz/tasks/ (新系統 — task-api.js get)
41
- * 2. dev/pipeline/completed/ + tasks/ (舊系統 YAML 檔)
42
- * 3. dev/pipeline/TASK_QUEUE.json (舊系統 JSON 索引)
29
+ * Load task data through task-api.js.
43
30
  *
44
- * @param {string} taskId - TASK_XXX 格式的任務 ID
45
- * @param {object} [options] - 可選參數
46
- * @param {string} [options.projectPath] - 子專案路徑(優先在此查找任務)
47
- * @returns {string|null} 任務 YAML/JSON 文本,或 null
31
+ * @param {string} taskId - TASK_XXX
32
+ * @param {object} [options]
33
+ * @param {string} [options.projectPath] - sub-project path (looked up first)
34
+ * @returns {string|null} task YAML text, or null
48
35
  */
49
36
  function loadTask(taskId, options) {
50
37
  if (!taskId || !taskId.startsWith('TASK_')) return null;
51
38
 
52
39
  const projectRoot = options?.projectPath || ROOT;
53
40
 
54
- // 1. 新系統 (.collaboration / .kenaz)
55
- const fromCollab = loadTaskFromCollaboration(taskId, projectRoot);
56
- if (fromCollab) return fromCollab;
57
-
58
- // 2. 舊系統 YAML 檔 (dev/pipeline/completed/ + tasks/)
59
- const fromYaml = loadTaskFromLegacyYaml(taskId, projectRoot);
60
- if (fromYaml) return fromYaml;
61
-
62
- // 3. 舊系統 JSON 索引 (TASK_QUEUE.json)
63
- const fromQueue = loadTaskFromLegacyQueue(taskId, projectRoot);
64
- if (fromQueue) return fromQueue;
41
+ const fromApi = loadTaskFromApi(taskId, projectRoot);
42
+ if (fromApi) return fromApi;
65
43
 
66
- console.warn(`⚠️ Task ${taskId} not found in any system (root: ${projectRoot})`);
44
+ console.warn(`⚠️ Task ${taskId} not found (root: ${projectRoot})`);
67
45
  return null;
68
46
  }
69
47
 
70
48
  /**
71
- * 從新系統 .collaboration 載入
72
49
  * @param {string} taskId
73
- * @param {string} projectRoot - 專案根目錄
50
+ * @param {string} projectRoot
74
51
  */
75
- function loadTaskFromCollaboration(taskId, projectRoot) {
52
+ function loadTaskFromApi(taskId, projectRoot) {
76
53
  if (!fs.existsSync(COLLABORATION_API)) return null;
77
54
  try {
78
- // 當 projectRoot 與 core ROOT 不同時,使用 --project-path
55
+ // When projectRoot differs from the core ROOT, pass --project-path
79
56
  const projectArg = projectRoot !== ROOT ? ` --project-path "${projectRoot}"` : '';
80
57
  const result = execSync(
81
58
  `node "${COLLABORATION_API}"${projectArg} get ${taskId}`,
@@ -87,104 +64,4 @@ function loadTaskFromCollaboration(taskId, projectRoot) {
87
64
  return null;
88
65
  }
89
66
 
90
- /**
91
- * 從舊系統 YAML 檔載入 (dev/pipeline/completed/ + tasks/)
92
- * @param {string} taskId
93
- * @param {string} projectRoot - 專案根目錄
94
- */
95
- function loadTaskFromLegacyYaml(taskId, projectRoot) {
96
- const pipelineDir = path.join(projectRoot, 'dev', 'pipeline');
97
- const dirs = ['completed', 'tasks'];
98
- for (const dir of dirs) {
99
- const dirPath = path.join(pipelineDir, dir);
100
- if (!fs.existsSync(dirPath)) continue;
101
- try {
102
- const files = fs.readdirSync(dirPath);
103
- const match = files.find(f => f.startsWith(taskId) && f.endsWith('.yaml'));
104
- if (match) {
105
- return fs.readFileSync(path.join(dirPath, match), 'utf8').trim();
106
- }
107
- } catch (e) {}
108
- }
109
- return null;
110
- }
111
-
112
- /**
113
- * 從舊系統 TASK_QUEUE.json 載入
114
- * @param {string} taskId
115
- * @param {string} projectRoot - 專案根目錄
116
- */
117
- function loadTaskFromLegacyQueue(taskId, projectRoot) {
118
- const queuePath = path.join(projectRoot, 'dev', 'pipeline', 'TASK_QUEUE.json');
119
- if (!fs.existsSync(queuePath)) return null;
120
- try {
121
- const queue = JSON.parse(fs.readFileSync(queuePath, 'utf8'));
122
- const task = (queue.tasks || []).find(t => t.id === taskId);
123
- if (task) {
124
- return yaml.dump(task, { lineWidth: -1 });
125
- }
126
- } catch (e) {}
127
- return null;
128
- }
129
-
130
- /**
131
- * 列出某個 formation 下所有可用的 skill
132
- * @param {string} formation - 陣型名稱
133
- * @returns {string[]} skill 名稱列表
134
- */
135
- function listSkills(formation) {
136
- const dir = path.join(FORMATION_DIR, formation);
137
- if (!fs.existsSync(dir)) return [];
138
- return fs.readdirSync(dir)
139
- .filter(f => f.endsWith('.yaml'))
140
- .map(f => f.replace('.yaml', ''));
141
- }
142
-
143
- /**
144
- * 載入 specialist 定義(5 個 YAML 檔案)
145
- * @param {string} name - specialist 名稱 (e.g., "Ansuz", "Amelia")
146
- * @returns {object} { principles, workflow, knowledge, rule, capability }
147
- */
148
- function loadSpecialist(name) {
149
- const specialistDir = path.join(ROOT, '.specialist', name);
150
- if (!fs.existsSync(specialistDir)) {
151
- console.error(`❌ Specialist not found: ${specialistDir}`);
152
- process.exit(1);
153
- }
154
-
155
- const files = ['principles', 'workflow', 'knowledge', 'rule', 'capability'];
156
- const specialist = { name };
157
-
158
- for (const file of files) {
159
- const filePath = path.join(specialistDir, `${file}.yaml`);
160
- if (!fs.existsSync(filePath)) {
161
- console.warn(`⚠️ Missing ${file}.yaml for specialist ${name}`);
162
- specialist[file] = null;
163
- continue;
164
- }
165
- try {
166
- specialist[file] = yaml.load(fs.readFileSync(filePath, 'utf8'));
167
- } catch (e) {
168
- console.error(`❌ Failed to parse ${filePath}: ${e.message}`);
169
- process.exit(1);
170
- }
171
- }
172
-
173
- return specialist;
174
- }
175
-
176
- /**
177
- * 列出所有可用的 specialist
178
- * @returns {string[]} specialist 名稱列表
179
- */
180
- function listSpecialists() {
181
- const specialistDir = path.join(ROOT, '.specialist');
182
- if (!fs.existsSync(specialistDir)) return [];
183
- return fs.readdirSync(specialistDir)
184
- .filter(f => {
185
- const stat = fs.statSync(path.join(specialistDir, f));
186
- return stat.isDirectory();
187
- });
188
- }
189
-
190
- module.exports = { loadSkill, loadTask, listSkills, loadSpecialist, listSpecialists };
67
+ module.exports = { loadSkill, loadTask };
@@ -54,7 +54,6 @@
54
54
  * | 2.5d | Safety net: force-move to done | merge succeeded but complete() failed | spawnSync | task stays in active |
55
55
  * | 2.6b | Ansuz inbox signal | result.taskCompleted && !dryRun | catch (silent) | Ansuz not notified |
56
56
  * | 2.6c | Relay task_completed event (TASK_1409) | result.taskCompleted && !dryRun && relay | catch (silent) | PM inbox not notified cross-node |
57
- * | 3 | Memory agent onTaskCompleted/onError | memoryAgent && taskId | catch (log warning) | memory event not queued |
58
57
  *
59
58
  * A.2 gitBranchAndMerge() — serial mode (L2344)
60
59
  *
@@ -301,12 +300,6 @@ const { verify: verifyAcceptance } = require('./verify-acceptance');
301
300
  // LLM-based acceptance verification (./verify-acceptance.js) remains and is the
302
301
  // one whose result (result.git.acceptance) is actually read.
303
302
 
304
- // Memory Agent(記憶系統整合)
305
- let memoryAgent = null;
306
- try {
307
- memoryAgent = require('../../.memory/tools/memory-agent');
308
- } catch { /* memory-agent not available — graceful degradation */ }
309
-
310
303
  // Design Reasoning Attribution (TASK_1074)
311
304
  let designReasoning = null;
312
305
  try {
@@ -587,7 +580,6 @@ function listDaemonManagedPaths(projectRoot) {
587
580
 
588
581
  scanDir('.synapse');
589
582
  scanDir('.prefrontal');
590
- scanDir('.memory');
591
583
  if (fs.existsSync(path.join(projectRoot, '.tmp'))) discovered.add('.tmp/');
592
584
 
593
585
  return Array.from(discovered);
@@ -3003,29 +2995,6 @@ function postComplete(opts = {}) {
3003
2995
  } catch { /* fire-and-forget — never blocks post-complete */ }
3004
2996
  }
3005
2997
 
3006
- // Step 3: Memory Agent(記憶系統整合)
3007
- if (memoryAgent && taskId) {
3008
- try {
3009
- const testsFailed = result.git?.regression && !result.git.regression.passed && !result.git.regression.skipped;
3010
- if (testsFailed) {
3011
- // 回歸測試失敗 → onError(fire-and-forget)
3012
- memoryAgent.onError({
3013
- event: 'regression_test_failure',
3014
- taskId,
3015
- error: `Regression tests failed after ${taskId} completion`,
3016
- summary: result.git.regression.output?.slice(-500),
3017
- }).catch(() => {});
3018
- console.log(' 🧠 Memory: error event queued (regression failure)');
3019
- } else {
3020
- // 任務成功完成 → onTaskCompleted(fire-and-forget)
3021
- memoryAgent.onTaskCompleted(taskId).catch(() => {});
3022
- console.log(' 🧠 Memory: task completion event queued');
3023
- }
3024
- } catch (e) {
3025
- console.log(` ⚠️ Memory agent skipped: ${e.message}`);
3026
- }
3027
- }
3028
-
3029
2998
  // Step 4.6: Guard Failure Detector (TASK_1653)
3030
2999
  // Runs shadow-mode failure detectors for active lesson guards that carry failure_signature.
3031
3000
  // Reads guard snapshots directly from lesson_guards.yaml (not the task chart) because
@@ -24,8 +24,6 @@ load_order:
24
24
  description: "GEN-009: 跨平台相容原則 - Windows/macOS/Linux 三平台相容性要求"
25
25
  - path: "general/agent-workflow.yaml"
26
26
  description: "Agent 工作流程 - 記憶點優先 + 邊界意識 + Context Integrity Canary(AGT-001 至 AGT-009)"
27
- - path: "general/sunny-access-control.yaml"
28
- description: "SEC-010: Sunny 系統存取控制 - 禁止其他 Agent 存取 .system/sunny/"
29
27
  - path: "general/synapse-code-intelligence.yaml"
30
28
  description: "SYN-001~007: 代碼導航 — kenaz_lsp_* 代碼導航、Grep/Glob 文字與概念搜尋。記憶層 synapse_* 工具已於 2026-10-11 移除(TASK_2411)"
31
29
  # 2026-10-11 (TASK_2411): synapse-cognitive-fusion.yaml, cortex-tools.yaml, memory-source-priority.yaml, memory-language.yaml deleted - memory system removed.
@@ -41,14 +39,6 @@ load_order:
41
39
  description: "VERIFY-TGT-001~002: Rust 驗證正典 CARGO_TARGET_DIR — 單一共用目錄(dev/scripts/verify-target-dir.js),禁止自創目錄;並行驗證被 cargo 檔案鎖串行化屬正常等待"
42
40
  - path: "general/task-pool-routing.yaml"
43
41
  description: "POOL-001~003: 本地任務 vs 任務池 路由規則 — 詞彙驅動路由、術語一致性、Pool 操作安全(publish/claim 破壞性語義)"
44
- - path: "general/pipeline.yaml"
45
- description: "Pipeline 系統規則 - 任務管理規範"
46
- - path: "pipeline/PPL-002-completed-task-archival.yaml"
47
- description: "已完成任務封存規則 - 防止佇列污染"
48
- - path: "pipeline/auto-update.yaml"
49
- description: "PPL-003 - 任務完成後必須更新 Pipeline 系統(Critical)"
50
- - path: "pipeline/task-execution.yaml"
51
- description: "PPL-101 至 PPL-113 - Pipeline 任務執行規範(拆分、依賴、並行、回歸保護等)"
52
42
 
53
43
  # Code 規則組 - 從核心原則到具體實踐
54
44
  - path: "code/principles.yaml"
@@ -70,14 +60,6 @@ load_order:
70
60
 
71
61
  - path: "design/ui.yaml"
72
62
  description: "UI 設計規範"
73
- - path: "design/ux.yaml"
74
- description: "UX 設計原則"
75
- - path: "design/colors.yaml"
76
- description: "色彩系統"
77
- - path: "architecture/decisions.yaml"
78
- description: "架構決策記錄"
79
- - path: "business/constraints.yaml"
80
- description: "業務邏輯約束"
81
63
 
82
64
  # 嚴重程度定義
83
65
  severity_levels:
@@ -11,118 +11,7 @@ _meta:
11
11
  version: "1.0.0"
12
12
 
13
13
  rules:
14
- # =============================================================================
15
- # AGT-001: 記憶點優先載入(核心規則)
16
- # =============================================================================
17
- - id: "AGT-001"
18
- title: "記憶點優先載入"
19
- description: |
20
- 所有 Agent 開始工作前,必須先讀取 .memory/CONTEXT.md。
21
- 此文件包含專案當前狀態、已完成功能、技術棧、關鍵路徑。
22
- 只有在需要詳細任務資訊時,才讀取任務文件。
23
- severity: "must"
24
- rationale: "減少 context 消耗,快速掌握專案狀態"
25
- workflow:
26
- - step: 1
27
- action: "讀取 .memory/CONTEXT.md"
28
- purpose: "快速掌握專案全局狀態"
29
- required: true
30
- - step: 2
31
- action: "評估是否需要詳細任務資訊"
32
- purpose: "判斷是否需要讀取更多文件"
33
- criteria:
34
- - "如果任務涉及特定功能,需要確認技術細節"
35
- - "如果需要了解依賴關係"
36
- - "如果 CONTEXT.md 資訊不足以開始工作"
37
- - step: 3
38
- action: "視需要讀取 dev/pipeline/PROGRESS.md 或具體任務文件"
39
- purpose: "獲取具體任務細節和當前進度"
40
- note: "優先讀取 PROGRESS.md 而非 TASK_QUEUE.json(後者較大)"
41
-
42
- # =============================================================================
43
- # AGT-002: 記憶點更新責任
44
- # =============================================================================
45
- - id: "AGT-002"
46
- title: "記憶點更新責任"
47
- description: |
48
- 完成重要里程碑或重大變更後,Agent 應更新 .memory/CONTEXT.md。
49
- 更新時機:
50
- - 完成重要功能
51
- - 技術架構變更
52
- - 新增/移除主要模組
53
- severity: "should"
54
- rationale: "保持記憶點準確,供下次 session 使用"
55
- update_triggers:
56
- - "新功能完成"
57
- - "重大 Bug 修復"
58
- - "架構變更"
59
- - "新模組加入"
60
- - "技術棧更新"
61
-
62
- # =============================================================================
63
- # AGT-003: 避免重複讀取任務文件
64
- # =============================================================================
65
- - id: "AGT-003"
66
- title: "避免重複讀取任務文件"
67
- description: |
68
- 不要每次都讀取所有任務的詳細資訊。
69
- .memory/CONTEXT.md 已包含足夠的狀態摘要。
70
- 只在需要特定任務細節時才讀取對應的任務文件。
71
- severity: "should"
72
- rationale: "節省 token,提高效率"
73
- anti_patterns:
74
- - "每次都讀取 TASK_QUEUE.json 全部內容"
75
- - "遍歷 dev/pipeline/tasks/ 目錄讀取所有任務"
76
- - "重複讀取已知資訊"
77
-
78
- # =============================================================================
79
- # AGT-004: 任務執行前置流程(新增)
80
- # =============================================================================
81
- - id: "AGT-004"
82
- title: "任務執行前置流程"
83
- description: |
84
- 定義 Agent 執行任務前的標準流程,確保記憶點系統與任務單系統協同運作。
85
- 此流程為基本流程:先讀 CONTEXT.md → 再讀任務單 → 執行任務。
86
- severity: "must"
87
- rationale: "確保 Agent 在充分了解專案狀態後才開始執行任務"
88
- workflow:
89
- - phase: "Context 獲取"
90
- steps:
91
- - step: 1
92
- action: "讀取 .memory/CONTEXT.md"
93
- required: true
94
- purpose: "了解專案全局狀態、技術棧、關鍵路徑"
95
- - step: 2
96
- action: "讀取 dev/pipeline/PROGRESS.md"
97
- required: true
98
- purpose: "了解當前進度和待處理任務列表"
99
- - phase: "任務確認"
100
- steps:
101
- - step: 3
102
- action: "確定本次要執行的任務"
103
- required: true
104
- purpose: "從待處理佇列中選取最優先的任務"
105
- - step: 4
106
- action: "讀取具體任務文件(dev/pipeline/tasks/TASK_XXX.yaml)"
107
- required: true
108
- purpose: "獲取任務的詳細需求、驗收標準、技術備註"
109
- - phase: "執行任務"
110
- steps:
111
- - step: 5
112
- action: "按照任務需求執行開發工作"
113
- required: true
114
- purpose: "完成任務定義的所有驗收標準"
115
- - step: 6
116
- action: "更新進度文件"
117
- required: true
118
- purpose: "記錄任務完成狀態,歸檔任務文件"
119
- integration:
120
- memory_system: ".memory/CONTEXT.md"
121
- task_system: "dev/pipeline/"
122
- relationship: |
123
- 記憶點系統提供專案全局 Context,減少重複讀取。
124
- 任務單系統提供具體執行細節和驗收標準。
125
- 兩者協同運作:先從記憶點獲取全局視角,再從任務單獲取執行細節。
14
+ # AGT-001~004(.memory/CONTEXT.md 記憶點載入/更新、PROGRESS.md 任務前置)已於 2026-10 移除:記憶系統與 dev/pipeline 已退役。
126
15
 
127
16
  # =============================================================================
128
17
  # AGT-005: 失敗時必須查閱失敗經驗
@@ -238,10 +127,8 @@ rules:
238
127
  - pattern: "專案根目錄及其子目錄"
239
128
  description: "當前工作目錄(project root)"
240
129
  examples:
241
- - ".memory/"
242
130
  - ".failure/"
243
131
  - ".rule/"
244
- - "dev/pipeline/"
245
132
  - "src/"
246
133
  - "dashboard/"
247
134
 
@@ -259,16 +146,16 @@ rules:
259
146
  error_messages:
260
147
  - trigger: "嘗試訪問 ~/.claude/"
261
148
  message: "❌ 違反 AGT-007:禁止訪問用戶私有配置目錄 (~/.claude/)"
262
- suggestion: "全局記憶由 Claude Code 自動管理,請在專案內 .memory/ 記錄專案相關資訊"
149
+ suggestion: "全局記憶由 Claude Code 自動管理;專案教訓用 `kenaz learn add`"
263
150
  - trigger: "嘗試訪問 C:\\Users\\*\\.claude\\"
264
151
  message: "❌ 違反 AGT-007:禁止訪問用戶私有配置目錄"
265
- suggestion: "請使用專案內的 .memory/ 系統"
152
+ suggestion: "專案教訓請用 `kenaz learn add`,不要寫入用戶目錄"
266
153
 
267
154
  related_systems:
268
- project_memory:
269
- path: ".memory/"
270
- purpose: "專案特定的記憶、日誌、任務記錄"
271
- management: "Agent 手動寫入"
155
+ project_lessons:
156
+ path: ".kenaz/knowledge/"
157
+ purpose: "專案教訓(kenaz learn add)"
158
+ management: "kenaz learn"
272
159
  should_access: true
273
160
  global_memory:
274
161
  path: "~/.claude/projects/.../memory/MEMORY.md"
@@ -281,11 +168,8 @@ rules:
281
168
  good:
282
169
  - description: "✅ 在專案內記錄學習經驗"
283
170
  code: |
284
- # 正確:寫入專案內的 .memory/topics/
285
- Write(
286
- file_path=".memory/topics/learning-2026-02-11.md",
287
- content="學習筆記內容..."
288
- )
171
+ # 正確:用 kenaz learn 記錄到專案內
172
+ Bash(command='kenaz learn add "..."')
289
173
  bad:
290
174
  - description: "❌ 嘗試訪問全局記憶目錄"
291
175
  code: |
@@ -343,7 +227,7 @@ rules:
343
227
  - phase: "檢查階段"
344
228
  questions:
345
229
  - "任務要求的所有輸出是否已產生?"
346
- - "文檔是否已寫入專案內?(.memory/, .failure/, dev/)"
230
+ - "文檔是否已寫入專案內?(.failure/, dev/)"
347
231
  - "代碼變更是否已完成?"
348
232
  - "Git commit 是否已建立?"
349
233
  - "任務狀態是否已更新?"
@@ -385,7 +269,7 @@ rules:
385
269
  - phase: "Output Verification(驗證輸出)"
386
270
  steps:
387
271
  - "檢查所有要求的輸出是否已產生"
388
- - "驗證文檔在專案內(.memory/, .failure/)"
272
+ - "驗證文檔在專案內(.failure/)"
389
273
  - "確認 Git commit 已建立"
390
274
  - phase: "Completion Check(完成檢查)"
391
275
  question: "所有輸出都完整嗎?"
@@ -429,7 +313,7 @@ rules:
429
313
  scenario: "完成並行處理失敗學習文檔"
430
314
  steps:
431
315
  - "1. 建立 .failure/architecture/FAIL-004_*.md ✅"
432
- - "2. 建立 .memory/topics/parallel-processing-*.md ✅"
316
+ - "2. 建立專案內的 parallel-processing 筆記 ✅"
433
317
  - "3. Git commit ✅"
434
318
  - "4. 檢查:所有輸出都完整? → 是 ✅"
435
319
  - "5. 停止工作,等待用戶指示 ✅"
@@ -439,7 +323,7 @@ rules:
439
323
  scenario: "完成並行處理失敗學習文檔後"
440
324
  steps:
441
325
  - "1. 建立 .failure/architecture/FAIL-004_*.md ✅"
442
- - "2. 建立 .memory/topics/parallel-processing-*.md ✅"
326
+ - "2. 建立專案內的 parallel-processing 筆記 ✅"
443
327
  - "3. Git commit ✅"
444
328
  - "4. 想:'應該更新 MEMORY.md 索引' ❌"
445
329
  - "5. 嘗試訪問 ~/.claude/.../memory/ ❌(違反 AGT-007)"
@@ -461,7 +345,7 @@ rules:
461
345
  checklist:
462
346
  - item: "✅ 所有任務要求的輸出都已產生"
463
347
  importance: "critical"
464
- - item: "✅ 文檔都在專案內(.memory/, .failure/)"
348
+ - item: "✅ 文檔都在專案內(.failure/)"
465
349
  importance: "critical"
466
350
  - item: "✅ Git commit 已建立"
467
351
  importance: "high"
@@ -536,37 +420,3 @@ rules:
536
420
  importance: "critical"
537
421
  - item: "✅ 恢復的 scope_paths 與當前任務一致"
538
422
  importance: "high"
539
-
540
- # =============================================================================
541
- # AGT-010: Formation Dispatch 後必須切回 User Branch
542
- # =============================================================================
543
- - id: "AGT-010"
544
- title: "Dispatch 後切回 User Branch"
545
- description: |
546
- (已退役)Formation headless dispatch 曾在獨立進程中建立 task branch(task/task_XXX),
547
- 完成後 post-complete.js 會 merge 回 user branch。但呼叫者(Ansuz/Agent)的
548
- working tree 仍停留在 task branch 上。
549
-
550
- 如果 dispatch 後繼續在同一 session 做其他改動,會意外 commit 到 task branch,
551
- 而不是 user branch。用戶在桌面端會看到 branch 不一致。
552
- severity: "must"
553
- rationale: "headless dispatch 是獨立進程(已退役,僅供歷史參照),不會切換呼叫者的 git working tree"
554
- trigger: "legacy Formation dispatch 完成後,Ansuz 或 Agent 要做下一個改動之前"
555
- workflow:
556
- - step: 1
557
- action: "確認 dispatch 完成(task status = completed)"
558
- - step: 2
559
- action: "git checkout <user-branch>(通常是 xyz951610 或 main)"
560
- command: "git checkout $(git config --get init.defaultBranch || echo main)"
561
- note: "如果有 uncommitted changes,先 stash 再 checkout"
562
- - step: 3
563
- action: "確認 task branch 的改動已 merge(git log 可見 merge commit)"
564
- - step: 4
565
- action: "繼續下一個改動"
566
- anti_pattern: |
567
- ❌ Dispatch 完成後直接繼續編輯(仍在 task/task_XXX branch)
568
- ❌ 多個 task 共用同一個 task branch(每個 task 應有自己的 branch)
569
- applies_to:
570
- - "Ansuz(PM dispatch 後繼續做其他工作)"
571
- - "任何仍經 legacy Formation dispatch 的 Agent"
572
- - "用戶手動 dispatch 後"
@@ -45,7 +45,7 @@ rules:
45
45
  - path: "dev/"
46
46
  purpose: "開發工具和任務管理"
47
47
  must_contain:
48
- - "pipeline/ - 任務追蹤系統"
48
+ - "pipeline/ - 凍結的舊任務佇列(僅歷史參照;現行任務在 .kenaz/tasks/)"
49
49
  - "scripts/ - 自動化腳本"
50
50
  - "PRODUCT_SPEC.md - 產品規格"
51
51
 
@@ -95,21 +95,16 @@ rules:
95
95
  task_tracking:
96
96
  - title: "任務追蹤必須在專案內"
97
97
  description: |
98
- 所有任務追蹤文件必須在 dev/pipeline/ 下。
99
- 背景 agent 的任務狀態必須更新到 TASK_QUEUE.json。
98
+ 所有任務追蹤文件必須在專案內的 .kenaz/tasks/ 下(YAML 任務卡,目錄即狀態)。
99
+ 背景 agent 的任務狀態必須透過 task-api.js 更新。
100
100
 
101
101
  required_files:
102
- - "dev/pipeline/TASK_QUEUE.json - 任務佇列"
103
- - "dev/pipeline/PROGRESS.md - 進度追蹤"
104
- - "dev/pipeline/tasks/ - 待處理任務"
105
- - "dev/pipeline/completed/ - 已完成任務"
102
+ - ".kenaz/tasks/{backlog,active,done,blocked,cancel}/ - 任務卡"
106
103
 
107
104
  update_rule: |
108
105
  Agent 完成任務後必須:
109
- 1. 更新 TASK_QUEUE.json 中的任務狀態
110
- 2. 移動任務文件到 completed/
111
- 3. 更新 PROGRESS.md
112
- 4. 建立 Git commit(包含 Task ID)
106
+ 1. node .collaboration/core/task-api.js complete TASK_XXX
107
+ 2. 建立 commit(包含 Task ID)
113
108
 
114
109
  background_agents:
115
110
  - title: "背景 Agent 必須使用專案配置"
@@ -122,7 +117,7 @@ rules:
122
117
  - "Task(run_in_background=True) 創建新 session"
123
118
  - "新 session 讀取 .claude/settings.local.json"
124
119
  - "背景 agent 使用專案配置的權限執行"
125
- - "輸出文件寫入專案的 temp 目錄或 dev/pipeline/"
120
+ - "輸出文件寫入專案的 temp 目錄"
126
121
 
127
122
  anti_pattern: |
128
123
  ❌ 假設背景 agent 會繼承主 session 的權限
@@ -167,13 +162,7 @@ rules:
167
162
  - description: "背景 Agent 更新專案內任務狀態"
168
163
  code: |
169
164
  # 在 Agent 執行完成後
170
- node -e "
171
- const fs = require('fs');
172
- const queue = JSON.parse(fs.readFileSync('dev/pipeline/TASK_QUEUE.json', 'utf8'));
173
- const task = queue.tasks.find(t => t.id === 'TASK_XXX');
174
- task.status = 'completed';
175
- fs.writeFileSync('dev/pipeline/TASK_QUEUE.json', JSON.stringify(queue, null, 2));
176
- "
165
+ node .collaboration/core/task-api.js complete TASK_XXX
177
166
 
178
167
  bad:
179
168
  - description: "❌ 依賴全局配置"
@@ -37,14 +37,15 @@ rules:
37
37
  shell_usage: "CARGO_TARGET_DIR=$(node dev/scripts/verify-target-dir.js) cargo check --lib -p kenaz-dashboard"
38
38
 
39
39
  rationale: |
40
- - Windows MAX_PATH: vendor/kuzu CMake object paths exceed 260 chars when
41
- the target dir sits under the repo or a worktree; a short root fixes it.
40
+ - Windows MAX_PATH: deep C/C++ dependency object paths (bundled sqlite etc.)
41
+ can approach 260 chars when the target dir sits under the repo or a
42
+ worktree; a short root keeps them safe.
42
43
  - Bounded growth: one shared dir caps disk usage structurally instead of
43
44
  relying on agent cleanup discipline (proven not to happen).
44
45
  - Warm cache: repeat verification from the same source root is much faster.
45
- Caveat: kuzu is a [patch] path dep — its artifacts are keyed per source
46
- root, so a verify from a NEW worktree path recompiles kuzu (but coexists
47
- without invalidating other roots' artifacts).
46
+ Caveat: workspace crates are keyed per source root, so a verify from a
47
+ NEW worktree path recompiles them (but coexists without invalidating
48
+ other roots' artifacts).
48
49
  - The repo's own dashboard/src-tauri/target must NOT be shared for
49
50
  verification: live tauri dev holds onnxruntime.dll there (os error 32).
50
51
 
@@ -217,7 +217,7 @@ rules:
217
217
  寫代碼前的分析(修改既有 symbol 時):
218
218
  1. kenaz_lsp_references(symbol) → 爆炸半徑
219
219
  2. kenaz_lsp_callers(symbol, depth=2) → 跨模組呼叫者
220
- 禁止盲寫 — 修改非 trivial symbol 前不看影響範圍是被禁止的行為(FAIL-009)。
220
+ 禁止盲寫 — 修改非 trivial symbol 前不看影響範圍是被禁止的行為。
221
221
 
222
222
  red_flags: |
223
223
  如果你發現自己在想以下任何一句話 — 立刻停下,這是跳過影響分析的前兆:
@@ -226,12 +226,12 @@ rules:
226
226
  - 「我已經很熟這段代碼了」
227
227
  - 「只是改個文字 / 樣式 / 常數」
228
228
  - 「趕時間,先改了再說」
229
- 來源:FAIL-009(LoadingScreen.tsx 事件)。
229
+ 來源:LoadingScreen.tsx 事件。
230
230
  原則:覺得太簡單不需要查的時刻,正是最需要它的時刻。
231
231
 
232
232
  anti_rationalization:
233
233
  - excuse: "這只是 UI 改動,不影響邏輯"
234
- reality: "LoadingScreen.tsx 就是這樣出事的(FAIL-009)。UI 組件有 props、state、context 依賴。"
234
+ reality: "LoadingScreen.tsx 就是這樣出事的。UI 組件有 props、state、context 依賴。"
235
235
  - excuse: "我剛才已經查過相關的 symbol 了"
236
236
  reality: "每個被修改的 symbol 都需要獨立查影響範圍。相關不等於相同。"
237
237
  - excuse: "這次改動範圍很小,不會有爆炸半徑"