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
@@ -1,724 +0,0 @@
1
- # Agent Skills & Commands 系統 (.claude/)
2
-
3
- ## 系統概述
4
-
5
- `.claude/` 是 Kenaz AI 專案的 **Agent 定義與指令系統**,提供完整的 AI Agent 管理框架,包含:
6
-
7
- - **Skills**:Agent 角色定義(職責、能力、工作流程)
8
- - **Commands**:斜線指令觸發機制(如 `/Ansuz`、`/產品`)
9
- - **Hooks**:Session 生命週期鉤子(自動初始化)
10
- - **Settings**:權限管理與配置
11
- - **MCP**:Model Context Protocol 整合(Cortex RAG 引擎)
12
-
13
- **設計理念**:
14
- - **Skills 定義 Agent**:每個 Agent 都有獨立的 SKILL.md 定義其行為
15
- - **Commands 觸發 Skills**:斜線指令讀取並載入對應的 Agent Skill
16
- - **Hooks 自動化初始化**:新 session 啟動時自動提示可用指令
17
- - **Settings 控制權限**:管理工具權限、目錄存取、Hook 配置
18
-
19
- ---
20
-
21
- ## 目錄結構
22
-
23
- ```
24
- .claude/
25
- ├── skills/ # Agent 技能定義
26
- │ ├── product_manager/ # 產品經理(PRD、需求拆解)
27
- │ ├── designer/ # UI/UX 設計師
28
- │ ├── developer/ # 前端開發(React/TypeScript)
29
- │ ├── backend_engineer/ # 後端開發(Python/FastAPI)
30
- │ ├── qa_engineer/ # QA 測試
31
- │ ├── sre_agent/ # SRE 運維
32
- │ ├── dev_agent/ # Pipeline 協調(持續迭代)
33
- │ ├── sunny/ # 內部系統開發(特權模式)
34
- │ └── ... # 其他 Agent
35
- ├── commands/ # 斜線指令定義
36
- │ ├── lead.md # /lead - Formation Lead
37
- │ ├── 產品.md # /產品 - Product Manager
38
- │ ├── 設計.md # /設計 - Designer
39
- │ ├── dev.md # /dev - Dev Agent
40
- │ ├── sunny.md # /sunny - Sunny Agent
41
- │ └── ... # 其他指令
42
- ├── hooks/ # Session 生命週期鉤子
43
- │ └── session-init.ps1 # SessionStart Hook(顯示指令選單)
44
- ├── prompts/ # 提示模板(預留)
45
- ├── mcp.json # MCP Server 配置(Cortex RAG)
46
- ├── settings.json # 全局設定(Hooks、權限)
47
- └── settings.local.json # 本地設定(覆蓋 settings.json)
48
- ```
49
-
50
- ---
51
-
52
- ## 1. Skills 系統
53
-
54
- ### 1.1 Skill 定義格式
55
-
56
- 每個 Agent 的 Skill 定義位於 `.claude/skills/<agent_name>/SKILL.md`,採用 **Markdown + YAML frontmatter** 格式:
57
-
58
- ```markdown
59
- ---
60
- name: agent_name
61
- aliases:
62
- - 別名1
63
- - 別名2
64
- description: 簡短描述 Agent 職責(一句話)
65
- ---
66
-
67
- # Agent Name - 完整標題
68
-
69
- ## 角色定位
70
- [描述 Agent 的角色、定位、核心職責]
71
-
72
- ## 核心職責
73
- [列出主要職責清單]
74
-
75
- ## 核心技能
76
- [列出技術技能、溝通技能等]
77
-
78
- ## 工作流程
79
- [定義標準作業流程,通常包含多個 Phase]
80
-
81
- ## 輸出規範
82
- [定義輸出格式、文件結構、命名規則]
83
-
84
- ## 備註
85
- [其他補充說明]
86
- ```
87
-
88
- ### 1.2 YAML Frontmatter 規範
89
-
90
- | 字段 | 必填 | 說明 | 範例 |
91
- |------|------|------|------|
92
- | `name` | ✅ | Agent 唯一名稱(英文、底線) | `code_reviewer` |
93
- | `aliases` | ❌ | 別名列表(支援中文) | `["產品", "pm"]` |
94
- | `description` | ✅ | 簡短描述(顯示在指令列表) | `需求分析、陣型判斷、agent 調度` |
95
-
96
- **範例**:
97
- ```yaml
98
- ---
99
- name: code_reviewer
100
- description: Formation PM — 需求分析、陣型判斷、agent 調度、結果追蹤
101
- ---
102
- ```
103
-
104
- ### 1.3 現有 Agent 列表
105
-
106
- | Agent | 路徑 | 職責 | 斜線指令 |
107
- |-------|------|------|----------|
108
- | **Product Manager** | `product_manager/` | 產品需求分析、PRD 撰寫、任務規劃 | `/產品` |
109
- | **Designer** | `designer/` | UI/UX 設計、設計規範、視覺稿 | `/設計` |
110
- | **Developer** | `developer/` | 前端開發 - React/TypeScript、UI 實現 | - |
111
- | **Backend Engineer** | `backend_engineer/` | 後端開發 - Python/FastAPI、API 設計 | `/後端` |
112
- | **QA Engineer** | `qa_engineer/` | 測試策略、缺陷追蹤、品質保證 | `/qa` |
113
- | **SRE Agent** | `sre_agent/` | Supabase 管理、部署、監控 | `/sre` |
114
- | **Dev Agent** | `dev_agent/` | Pipeline 協調、任務調度、持續迭代 | (無指令,由 Ansuz 派工) |
115
- | **Assessment Agent** | `assessment_agent/` | 功能/頁面/組件/API 評估、改良建議 | `/評估` |
116
- | **Architect Agent** | `architect_agent/` | 系統架構設計、技術選型、接口定義 | `/architect` |
117
- | **Sunny** | `sunny/` | 內部系統開發(特權模式) | `/sunny` |
118
- | **UI/UX Pro Max** | `ui-ux-pro-max/` | 設計系統生成、色彩/字體配對 | - |
119
-
120
- **外部安裝的 Skills**(位於 `.agents/skills/`,透過 `npx skills add` 安裝):
121
- | Skill | 來源 | 說明 |
122
- |-------|------|------|
123
- | `vercel-react-best-practices` | Vercel Engineering | React/Next.js 效能優化指南(57 條規則) |
124
- | `supabase-postgres-best-practices` | Supabase | Postgres 效能優化與最佳實踐(8 類別規則) |
125
-
126
- ### 1.4 Lead vs Worker Agent 模式
127
-
128
- Kenaz AI 的 Agent 系統採用 **Lead-Worker 分層架構**:
129
-
130
- #### Lead Agent(溝通者)
131
- - **職責**:理解需求、澄清問題、調度執行、匯報結果
132
- - **不執行**:實際開發工作
133
- - **工具**:Task 工具(調用 Team 或 Subagent)
134
- - **範例**:Product Manager, Designer, Developer(Frontend Lead)
135
-
136
- ```
137
- 用戶需求 → Lead Agent
138
- ↓ 分析需求、澄清問題
139
- ↓ 調度 Team/Subagent
140
- Worker 執行實際工作
141
- ↓ 返回結果
142
- Lead 匯報給用戶
143
- ```
144
-
145
- #### Worker Agent(執行者)
146
- - **職責**:接收明確任務、執行技術工作、返回結果
147
- - **工具**:Read, Write, Edit, Bash 等
148
- - **範例**:Formation 系統中的 solo/squad/legion 成員
149
-
150
- #### 混合 Agent(既溝通又執行)
151
- - **職責**:可直接執行任務,也可調度其他 Agent
152
- - **範例**:Dev Agent(既協調 Pipeline,也執行簡單任務)
153
-
154
- ---
155
-
156
- ## 2. Commands 系統
157
-
158
- ### 2.1 Command 定義格式
159
-
160
- 斜線指令位於 `.claude/commands/<指令名>.md`,定義**如何觸發對應的 Agent Skill**:
161
-
162
- ```markdown
163
- # /<指令名> - 簡短描述
164
-
165
- 正在讀取 <Agent 名稱> Agent...
166
-
167
- 請按照以下步驟執行:
168
-
169
- 1. **讀取 Agent Skill**:讀取 `.claude/skills/<agent_name>/SKILL.md` 內容並按照其框架執行。
170
-
171
- 2. **執行特定職責**:
172
- - [職責 1]
173
- - [職責 2]
174
- - [職責 3]
175
-
176
- 請開始執行 [任務名稱]。
177
- ```
178
-
179
- **範例**:`.claude/commands/產品.md`
180
- ```markdown
181
- # /產品 - 產品需求分析
182
-
183
- 正在讀取產品經理 Agent...
184
-
185
- 請按照以下步驟執行:
186
-
187
- 1. **讀取 Agent Skill**:讀取 `.claude/skills/product_manager/SKILL.md` 內容並按照其框架執行。
188
-
189
- 2. **執行產品經理職責**:
190
- - 深度理解用戶需求
191
- - 進行需求分析
192
- - 將需求拆解為開發任務
193
- - 將任務寫入 Pipeline 系統
194
-
195
- 請開始執行產品需求分析。
196
- ```
197
-
198
- ### 2.2 中英文混用支援
199
-
200
- Kenaz AI 支援**中英文混用指令**,同一個 Agent 可有多個指令名稱:
201
-
202
- | Agent | 中文指令 | 英文指令 | 說明 |
203
- |-------|---------|---------|------|
204
- | Product Manager | `/產品` | - | 產品需求分析 |
205
- | Designer | `/設計` | - | UI/UX 設計 |
206
- | Formation Lead | - | `/lead` | Formation PM |
207
-
208
- **實現方式**:建立多個 `.md` 檔案,內容完全相同(或使用符號連結)。
209
-
210
- ### 2.3 現有指令列表
211
-
212
- | 指令 | Agent | 說明 |
213
- |-----|-------|------|
214
- | `/產品` | Product Manager | 需求分析、任務規劃、PRD 撰寫 |
215
- | `/設計` | Designer | UI/UX 設計、設計規範、視覺稿 |
216
- | `/評估` | Assessment Agent | 功能/頁面/組件/API 深度評估 |
217
- | `/後端` | Backend Engineer | API 設計、資料庫、Python |
218
- | `/qa` | QA Engineer | 測試策略、缺陷追蹤、品質保證 |
219
- | `/sre` | SRE Agent | Supabase 管理、部署、監控 |
220
- | `/進度` | - | 查看 `dev/pipeline/PROGRESS.md` |
221
- | `/產品檢視`, `/product-review` | Product Manager | 自動化專案檢視模式(供排程使用) |
222
- | `/init` | - | 初始化新專案(清理 Pipeline、重置狀態) |
223
- | `/lead` | Formation Lead | Formation PM - 需求分析、陣型調度 |
224
- | `/sunny` | Sunny | 內部系統開發(特權模式) |
225
- | `/agent-worker` | - | 多 Agent Worker 模式(由排程器呼叫) |
226
- | `/architect` | Architect Agent | 系統架構設計 |
227
- | `/spec` | Spec Optimizer | 規格優化與文件整理 |
228
- | `/strategy` | Strategy Team | 策略智庫團隊 |
229
- | `/archive` | - | 封存已完成任務到記憶點 |
230
-
231
- ---
232
-
233
- ## 3. Hooks 系統
234
-
235
- ### 3.1 SessionStart Hook
236
-
237
- **目的**:在新 session 啟動時,自動提示用戶可用的 Agent 指令。
238
-
239
- **實現**:`.claude/hooks/session-init.ps1`(PowerShell 腳本)
240
-
241
- ```powershell
242
- # Session Start Hook - 顯示 Command 選擇菜單
243
- # 當新 session 啟動時,提示 Claude 顯示可用的 Agent 指令供用戶選擇
244
-
245
- param()
246
-
247
- # 讀取 stdin 獲取 session 資訊
248
- $input = [Console]::In.ReadToEnd()
249
- $sessionInfo = $input | ConvertFrom-Json -ErrorAction SilentlyContinue
250
-
251
- # 檢查是否是新啟動(不是 resume)
252
- $source = $sessionInfo.source
253
- if ($source -eq "startup" -or $source -eq "clear") {
254
- # 返回 additionalContext,觸發 Claude 顯示選擇菜單
255
- $context = @{
256
- hookSpecificOutput = @{
257
- hookEventName = "SessionStart"
258
- additionalContext = @"
259
- [SESSION_INIT_TRIGGER]
260
- 新 session 已啟動。請立即使用 AskUserQuestion 工具向用戶展示 Agent 選擇菜單。
261
- "@
262
- }
263
- } | ConvertTo-Json -Depth 10 -Compress
264
-
265
- Write-Output $context
266
- }
267
-
268
- exit 0
269
- ```
270
-
271
- ### 3.2 Hook 配置
272
-
273
- 在 `settings.json` 中配置 Hook:
274
-
275
- ```json
276
- {
277
- "hooks": {
278
- "SessionStart": [
279
- {
280
- "matcher": "startup",
281
- "hooks": [
282
- {
283
- "type": "command",
284
- "command": "powershell -ExecutionPolicy Bypass -File \"$CLAUDE_PROJECT_DIR/.claude/hooks/session-init.ps1\"",
285
- "statusMessage": "Initializing session..."
286
- }
287
- ]
288
- },
289
- {
290
- "matcher": "clear",
291
- "hooks": [
292
- {
293
- "type": "command",
294
- "command": "powershell -ExecutionPolicy Bypass -File \"$CLAUDE_PROJECT_DIR/.claude/hooks/session-init.ps1\"",
295
- "statusMessage": "Initializing session..."
296
- }
297
- ]
298
- }
299
- ]
300
- },
301
- "disableAllHooks": false
302
- }
303
- ```
304
-
305
- **可用的 matcher**:
306
- - `startup`:新 session 啟動時
307
- - `clear`:使用者執行 `/clear` 後
308
- - `all`:所有情況
309
-
310
- **Hook 類型**:
311
- - `command`:執行系統指令(如 PowerShell 腳本)
312
- - 其他類型(未來擴展)
313
-
314
- ### 3.3 停用 Hooks
315
-
316
- 若需暫時停用 Hooks:
317
-
318
- ```json
319
- {
320
- "disableAllHooks": true
321
- }
322
- ```
323
-
324
- ---
325
-
326
- ## 4. Settings 系統
327
-
328
- ### 4.1 settings.json(全局設定)
329
-
330
- 位於 `.claude/settings.json`,定義**專案級別的權限與配置**:
331
-
332
- ```json
333
- {
334
- "env": {
335
- "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
336
- },
337
- "permissions": {
338
- "allow": [
339
- "Bash(指令模式1)",
340
- "Bash(指令模式2)"
341
- ],
342
- "additionalDirectories": [
343
- "路徑1",
344
- "路徑2"
345
- ]
346
- },
347
- "hooks": {
348
- "SessionStart": [...]
349
- },
350
- "disableAllHooks": false
351
- }
352
- ```
353
-
354
- #### 字段說明
355
-
356
- | 字段 | 說明 | 範例 |
357
- |------|------|------|
358
- | `env` | 環境變數 | 啟用實驗性功能 |
359
- | `permissions.allow` | 預先批准的 Bash 指令模式 | 允許特定批次操作 |
360
- | `permissions.additionalDirectories` | 額外允許存取的目錄 | 允許讀寫 Formation 目錄 |
361
- | `hooks` | Session 生命週期鉤子 | SessionStart 自動初始化 |
362
- | `disableAllHooks` | 停用所有 Hooks | `true` / `false` |
363
-
364
- ### 4.2 settings.local.json(本地設定)
365
-
366
- 位於 `.claude/settings.local.json`,**覆蓋** `settings.json` 的設定。
367
-
368
- **用途**:
369
- - 本地開發環境專用設定
370
- - 不應提交到 Git(已加入 `.gitignore`)
371
- - 個人化權限配置
372
-
373
- **合併策略**:`settings.local.json` 的值優先於 `settings.json`。
374
-
375
- ---
376
-
377
- ## 5. MCP 整合(Cortex RAG)
378
-
379
- ### 5.1 mcp.json 配置
380
-
381
- 位於 `.claude/mcp.json`,定義 **Model Context Protocol Server** 的連接方式。
382
-
383
- Kenaz AI 使用 MCP 整合 **kenaz-cortex** RAG 引擎,提供語義代碼搜索能力。
384
-
385
- ```json
386
- {
387
- "mcpServers": {
388
- "kenaz-cortex": {
389
- "command": "C:/Users/Wei/AppData/Local/Microsoft/WindowsApps/PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0/python.exe",
390
- "args": ["-m", "cortex.mcp.server"],
391
- "env": {
392
- "PYTHONPATH": "C:/Users/Wei/Desktop/Project/KenazAI/kenaz-cortex/src"
393
- }
394
- }
395
- }
396
- }
397
- ```
398
-
399
- **字段說明**:
400
- - `command`:Python 可執行檔路徑(需使用絕對路徑)
401
- - `args`:啟動參數(`-m cortex.mcp.server` 表示執行 MCP Server 模組)
402
- - `env.PYTHONPATH`:Python 模組搜尋路徑(指向 kenaz-cortex 源碼)
403
-
404
- ### 5.2 可用的 MCP 工具
405
-
406
- 當 `mcp.json` 配置正確,Claude Code 會自動載入以下 Cortex 工具:
407
-
408
- | 工具 | 用途 | 使用時機 |
409
- |------|------|---------|
410
- | `cortex_search` | 語義代碼搜索 | 「這個功能怎麼運作?」「有類似實現嗎?」 |
411
- | `cortex_context` | 專案結構 Context(自動切換全量/RAG) | 「專案結構長什麼樣?」 |
412
- | `cortex_file_chunks` | 文件切片查詢 | 查詢大型文件的特定部分 |
413
- | `cortex_symbols` | 符號檢索(函數、類) | 「這個函數在哪裡定義?」 |
414
- | `cortex_status` | RAG 引擎狀態 | 檢查索引狀態、資料庫連接 |
415
-
416
- **智能切換策略**:
417
- - 小型專案(<40k tokens, <20 files)→ `cortex_context` 返回全量 Context
418
- - 大型專案(>40k tokens 或 >20 files)→ `cortex_context` 使用 RAG 模式
419
-
420
- ### 5.3 設置 MCP Server
421
-
422
- ```powershell
423
- # 設置 MCP Server(讓 Claude Code 自動使用 RAG)
424
- .\dev\scripts\setup_mcp.ps1
425
- ```
426
-
427
- 詳細文檔:請參閱 `CLAUDE.md#MCP Server 設置`。
428
-
429
- ---
430
-
431
- ## 6. 新增 Agent 指南
432
-
433
- ### 6.1 完整步驟
434
-
435
- #### Step 1: 建立 Skill 定義
436
-
437
- 在 `.claude/skills/<agent_name>/` 建立 `SKILL.md`:
438
-
439
- ```markdown
440
- ---
441
- name: my_agent
442
- aliases:
443
- - 我的代理
444
- - my-agent
445
- description: 簡短描述 Agent 職責
446
- ---
447
-
448
- # My Agent
449
-
450
- ## 角色定位
451
- [描述角色]
452
-
453
- ## 核心職責
454
- [列出職責]
455
-
456
- ## 工作流程
457
- ### Phase 1: [階段名稱]
458
- [步驟描述]
459
-
460
- ### Phase 2: [階段名稱]
461
- [步驟描述]
462
- ```
463
-
464
- #### Step 2: 建立斜線指令
465
-
466
- 在 `.claude/commands/<指令名>.md` 建立指令檔:
467
-
468
- ```markdown
469
- # /<指令名> - 簡短描述
470
-
471
- 正在讀取 <Agent 名稱> Agent...
472
-
473
- 請按照以下步驟執行:
474
-
475
- 1. **讀取 Agent Skill**:讀取 `.claude/skills/<agent_name>/SKILL.md` 內容並按照其框架執行。
476
-
477
- 2. **執行特定職責**:
478
- - [職責 1]
479
- - [職責 2]
480
-
481
- 請開始執行 [任務名稱]。
482
- ```
483
-
484
- **支援中文指令**:建立多個 `.md` 檔案指向同一個 Skill(如 `開發.md` 和 `dev.md`)。
485
-
486
- #### Step 3: 更新 CLAUDE.md
487
-
488
- 在 `CLAUDE.md` 的 **Agent 系統表格** 中註冊新 Agent:
489
-
490
- ```markdown
491
- | Agent | Skill 路徑 | 職責 |
492
- |-------|-----------|------|
493
- | My Agent | `.claude/skills/my_agent/SKILL.md` | 簡短描述 |
494
- ```
495
-
496
- 在 **指令集表格** 中註冊新指令:
497
-
498
- ```markdown
499
- | 指令 | Agent | 說明 |
500
- |-----|-------|------|
501
- | `/my-cmd` | My Agent | 簡短描述 |
502
- ```
503
-
504
- #### Step 4: 更新 Session Init Hook(可選)
505
-
506
- 若希望在 Session 啟動時顯示新 Agent,更新 `.claude/hooks/session-init.ps1` 中的選單。
507
-
508
- #### Step 5: 測試 Agent
509
-
510
- 在 Claude Code 中輸入 `/<指令名>` 測試載入是否正常。
511
-
512
- ### 6.2 命名規範
513
-
514
- | 元素 | 規範 | 範例 |
515
- |------|------|------|
516
- | **Agent Name** | 英文、底線分隔、小寫 | `my_agent`, `backend_engineer` |
517
- | **Skill 目錄** | 與 Agent Name 同名 | `.claude/skills/my_agent/` |
518
- | **Command 檔案** | 英文或中文、可使用連字符 | `my-cmd.md`, `我的指令.md` |
519
- | **Skill 檔名** | 固定使用 `SKILL.md`(大寫) | `SKILL.md` |
520
-
521
- ### 6.3 最佳實踐
522
-
523
- #### DO ✅
524
- - **明確角色定位**:清楚定義 Agent 是 Lead、Worker 還是混合型
525
- - **結構化工作流程**:使用 Phase 1/2/3 清楚劃分階段
526
- - **輸出規範具體**:明確定義檔案格式、命名規則、存放位置
527
- - **使用 YAML frontmatter**:方便未來擴展自動化功能
528
- - **遵循現有風格**:參考現有 Agent 的文檔結構
529
-
530
- #### DON'T ❌
531
- - **避免職責重疊**:確保新 Agent 與現有 Agent 職責清晰分離
532
- - **避免過度複雜**:工作流程不超過 5 個 Phase
533
- - **避免硬編碼路徑**:使用相對路徑或環境變數
534
- - **避免直接執行敏感操作**:涉及 Git、部署等應有用戶確認機制
535
-
536
- ---
537
-
538
- ## 7. Agent 載入機制
539
-
540
- ### 7.1 載入流程
541
-
542
- ```
543
- 用戶輸入 /<指令名>
544
- ↓
545
- Claude Code 查找 .claude/commands/<指令名>.md
546
- ↓
547
- 讀取 Command 內容(包含「讀取 .claude/skills/<agent_name>/SKILL.md」)
548
- ↓
549
- 載入 SKILL.md 的完整內容
550
- ↓
551
- Claude 按照 SKILL.md 定義的工作流程執行
552
- ```
553
-
554
- ### 7.2 自動初始化行為
555
-
556
- 當用戶在新 Session 中**未使用斜線指令**時,Session Hook 會自動觸發 **AskUserQuestion** 顯示選單:
557
-
558
- ```
559
- [SESSION_INIT_TRIGGER]
560
- 新 session 已啟動。請立即使用 AskUserQuestion 工具向用戶展示 Agent 選擇菜單。
561
-
562
- 可用的 Agent 指令:
563
- - /產品 - 需求分析、任務規劃、PRD 撰寫
564
- - /設計 - UI/UX 設計、設計規範、視覺稿
565
- - /architect - 系統架構設計
566
- ...
567
- ```
568
-
569
- 用戶選擇後,自動調用對應的 Skill 工具載入 Agent。
570
-
571
- ### 7.3 判斷規則
572
-
573
- - **用戶輸入以 `/` 開頭** → 直接執行該指令,不詢問
574
- - **用戶輸入其他內容** → 先顯示選擇菜單,再處理用戶訊息
575
-
576
- ---
577
-
578
- ## 8. 與其他系統的關係
579
-
580
- ### 8.1 規則優先級
581
-
582
- 當規則發生衝突時,按以下優先級順序執行:
583
-
584
- ```
585
- 1. .rule/* ← 最高優先級(所有人必須遵守)
586
- 2. CLAUDE.md ← 專案級指令與工作流程
587
- 3. .claude/skills/ ← Agent 行為定義
588
- 4. .agents/skills/ ← 外部安裝的最佳實踐
589
- ```
590
-
591
- ### 8.2 與 Formation 系統的關係
592
-
593
- - **Formation 系統**(`.formation/`):提供多 Agent 協作調度機制(unit/solo/squad/legion)
594
- - **Skills 系統**(`.claude/skills/`):定義 Agent 的行為與能力
595
- - **整合方式**:Formation Lead 調度時,會讀取對應 Agent 的 Skill 定義
596
-
597
- **範例**:
598
- ```
599
- ↓
600
- Formation Lead 分析需求
601
- ↓
602
- dispatch squad 陣型(調用 developer, backend_engineer)
603
- ↓
604
- 這些 Agent 執行時,會遵循各自的 SKILL.md
605
- ```
606
-
607
- ### 8.3 與 Collaboration 任務系統的關係
608
-
609
- - **Collaboration 系統**(`.collaboration/`):提供任務管理 API(建立、認領、完成任務)
610
- - **Skills 系統**(`.claude/skills/`):定義 Agent 如何執行任務
611
- - **整合方式**:許多 Agent(如 Formation Lead)強制要求透過 Collaboration API 管理任務
612
-
613
- **範例**(Formation Lead 的任務流程):
614
- ```
615
- 1. node .collaboration/core/task-api.js create ... # 建立任務
616
- 2. node .collaboration/core/task-api.js claim TASK_XXX # 認領任務
617
- 3. dispatch agent 執行任務
618
- 4. node .collaboration/core/task-api.js complete TASK_XXX # 完成任務
619
- ```
620
-
621
- ---
622
-
623
- ## 9. 常見問題
624
-
625
- ### Q1: 如何讓 Agent 支援中英文雙語指令?
626
-
627
- **A**:建立兩個 Command 檔案指向同一個 Skill:
628
-
629
- ```bash
630
- # 建立英文指令
631
- echo '讀取並遵循 `.claude/skills/my_agent/SKILL.md` 中的指示。' > .claude/commands/my-cmd.md
632
-
633
- # 建立中文指令(內容相同)
634
- echo '讀取並遵循 `.claude/skills/my_agent/SKILL.md` 中的指示。' > .claude/commands/我的指令.md
635
- ```
636
-
637
- ### Q2: 如何停用 SessionStart Hook?
638
-
639
- **A**:修改 `.claude/settings.json`:
640
-
641
- ```json
642
- {
643
- "disableAllHooks": true
644
- }
645
- ```
646
-
647
- 或移除 `hooks` 區塊。
648
-
649
- ### Q3: 如何讓 Agent 自動使用 Cortex RAG?
650
-
651
- **A**:在 Agent 的 SKILL.md 中加入指示:
652
-
653
- ```markdown
654
- ## 核心技能
655
-
656
- * **語義搜尋**:使用 Cortex MCP 工具(cortex_search, cortex_symbols)進行代碼檢索
657
- ```
658
-
659
- 並確保 `mcp.json` 已正確配置(執行 `.\dev\scripts\setup_mcp.ps1`)。
660
-
661
- ### Q4: Command 檔案可以包含複雜邏輯嗎?
662
-
663
- **A**:**不建議**。Command 檔案應保持簡潔,只負責「觸發載入 Skill」。複雜邏輯應寫在 SKILL.md 中。
664
-
665
- **範例**(簡潔 Command):
666
- ```markdown
667
- # /dev - Pipeline 分段開發模式
668
-
669
- 正在讀取開發協調 Agent...
670
-
671
- 請按照以下步驟執行:
672
-
673
- 1. **讀取 Agent Skill**:讀取 `.claude/skills/dev_agent/SKILL.md` 內容並按照其框架執行。
674
- 2. **讀取當前進度**:讀取 `dev/pipeline/PROGRESS.md` 確認當前狀態。
675
- 3. **執行 Pipeline 流程**:[簡短步驟清單]
676
-
677
- 請開始執行 Pipeline 開發迭代。
678
- ```
679
-
680
- ### Q5: 外部 Skills(.agents/skills/)與內部 Skills(.claude/skills/)有何差異?
681
-
682
- **A**:
683
-
684
- | 特性 | 內部 Skills | 外部 Skills |
685
- |------|------------|------------|
686
- | **位置** | `.claude/skills/` | `.agents/skills/` |
687
- | **來源** | 專案自定義 | 透過 `npx skills add` 安裝 |
688
- | **用途** | Kenaz AI 專案特定的 Agent | 通用最佳實踐(如 Vercel React 規則) |
689
- | **優先級** | 較高(規則優先級第 3 位) | 較低(規則優先級第 4 位) |
690
- | **可編輯** | ✅ 可自由修改 | ⚠️ 不建議修改(會被覆蓋) |
691
-
692
- ---
693
-
694
- ## 10. 參考資料
695
-
696
- ### 10.1 相關文檔
697
-
698
- | 文檔 | 路徑 | 說明 |
699
- |------|------|------|
700
- | **專案指引** | `CLAUDE.md` | 專案級指令、工作流程、Agent 列表 |
701
- | **規則系統** | `.system/rule/README.md` | 規則定義、優先級、嚴重程度 |
702
- | **失敗學習系統** | `.system/failure/README.md` | 失敗模式記錄與預防措施 |
703
- | **Collaboration 系統** | `.system/collaboration/README.md` | 任務管理 API 與目錄結構 |
704
- | **Formation 系統** | `.system/formation/README.md` | 多 Agent 協作陣型調度 |
705
- | **Sunny Agent** | `.system/sunny/README.md` | 內部系統開發特權模式 |
706
- | **記憶系統** | `.system/memory/README.md` | 經驗記錄與知識沉澱 |
707
-
708
- ### 10.2 工具腳本
709
-
710
- | 工具 | 路徑 | 用途 |
711
- |------|------|------|
712
- | `setup_mcp.ps1` | `dev/scripts/` | 設置 MCP Server(Cortex RAG) |
713
- | `task-api.js` | `.collaboration/core/` | 任務管理 CLI(建立、認領、完成) |
714
- | `check_failures.ps1` | `.failure/tools/` | 檢查相關失敗模式 |
715
-
716
- ### 10.3 官方文檔
717
-
718
- - **Claude Code 官方文檔**:[claude.ai/code](https://claude.ai/code)
719
- - **MCP Protocol**:[Model Context Protocol](https://modelcontextprotocol.io/)
720
- - **YAML 規範**:[YAML 1.2 Spec](https://yaml.org/spec/1.2/spec.html)
721
-
722
- ---
723
-
724
- *建立日期: 2026-02-19 | 版本: 1.0.0*