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,474 +0,0 @@
1
- # log_failure.ps1
2
- # 自動化建立失敗記錄文件的 PowerShell 腳本
3
-
4
- <#
5
- .SYNOPSIS
6
- 建立新的失敗記錄到 .failure/ 系統
7
-
8
- .DESCRIPTION
9
- 此腳本幫助快速記錄失敗經驗,包括:
10
- - 自動生成 FAIL-XXX ID
11
- - 根據分類選擇正確的目錄
12
- - 使用標準模板建立 YAML 文件
13
- - 自動更新 INDEX.yaml 的統計數據和 load_order
14
-
15
- .PARAMETER Category
16
- 失敗分類:agent_execution, code_quality, architecture, pipeline, data_integrity
17
-
18
- .PARAMETER Title
19
- 失敗標題(簡短描述)
20
-
21
- .PARAMETER Severity
22
- 嚴重程度:critical, high, medium, low
23
-
24
- .PARAMETER TaskID
25
- 相關任務 ID(如 TASK_078)
26
-
27
- .PARAMETER Interactive
28
- 互動式模式(預設)
29
-
30
- .PARAMETER Help
31
- 顯示幫助訊息
32
-
33
- .EXAMPLE
34
- .\log_failure.ps1
35
- 互動式建立失敗記錄
36
-
37
- .EXAMPLE
38
- .\log_failure.ps1 -Category "pipeline" -Title "任務佇列損壞" -Severity "high" -TaskID "TASK_088"
39
- 使用參數建立失敗記錄
40
- #>
41
-
42
- param(
43
- [Parameter(Mandatory=$false)]
44
- [ValidateSet("agent_execution", "code_quality", "architecture", "pipeline", "data_integrity")]
45
- [string]$Category,
46
-
47
- [Parameter(Mandatory=$false)]
48
- [string]$Title,
49
-
50
- [Parameter(Mandatory=$false)]
51
- [ValidateSet("critical", "high", "medium", "low")]
52
- [string]$Severity,
53
-
54
- [Parameter(Mandatory=$false)]
55
- [string]$TaskID,
56
-
57
- [Parameter(Mandatory=$false)]
58
- [switch]$Interactive = $true,
59
-
60
- [Parameter(Mandatory=$false)]
61
- [switch]$Help
62
- )
63
-
64
- # ============================================================
65
- # 常量定義
66
- # ============================================================
67
- $FAILURE_ROOT = Join-Path (Split-Path $PSScriptRoot -Parent) ""
68
- $INDEX_FILE = Join-Path $FAILURE_ROOT "INDEX.yaml"
69
-
70
- $CATEGORY_PATHS = @{
71
- "agent_execution" = "agent-execution"
72
- "code_quality" = "code-quality"
73
- "architecture" = "architecture"
74
- "pipeline" = "pipeline"
75
- "data_integrity" = "data-integrity"
76
- }
77
-
78
- $SEVERITY_ICONS = @{
79
- "critical" = "🔴"
80
- "high" = "🟠"
81
- "medium" = "🟡"
82
- "low" = "🟢"
83
- }
84
-
85
- # ============================================================
86
- # 函數定義
87
- # ============================================================
88
-
89
- function Show-Help {
90
- Write-Host @"
91
- 🔧 Failure Logging Tool
92
-
93
- 使用方式:
94
- .\log_failure.ps1 # 互動式模式
95
- .\log_failure.ps1 -Category <cat> -Title <title> -Severity <sev>
96
-
97
- 參數:
98
- -Category 失敗分類: agent_execution, code_quality, architecture, pipeline, data_integrity
99
- -Title 失敗標題(簡短描述)
100
- -Severity 嚴重程度: critical, high, medium, low
101
- -TaskID 相關任務 ID(可選)
102
- -Interactive 互動式模式(預設)
103
- -Help 顯示此幫助訊息
104
-
105
- 範例:
106
- .\log_failure.ps1 -Category "pipeline" -Title "任務佇列損壞" -Severity "high"
107
- .\log_failure.ps1 -Interactive
108
-
109
- 相關資源:
110
- - 失敗記錄索引: .failure/INDEX.yaml
111
- - 失敗記錄模板: .failure/INDEX.yaml (failure_template)
112
- "@
113
- exit 0
114
- }
115
-
116
- function Get-NextFailureID {
117
- # 讀取 INDEX.yaml 獲取當前最大的 FAIL-XXX ID
118
- if (-not (Test-Path $INDEX_FILE)) {
119
- Write-Error "❌ INDEX.yaml not found at: $INDEX_FILE"
120
- exit 1
121
- }
122
-
123
- $content = Get-Content $INDEX_FILE -Raw
124
- $maxID = 0
125
-
126
- # 匹配 FAIL-XXX 格式
127
- $matches = [regex]::Matches($content, 'FAIL-(\d{3})')
128
- foreach ($match in $matches) {
129
- $id = [int]$match.Groups[1].Value
130
- if ($id -gt $maxID) {
131
- $maxID = $id
132
- }
133
- }
134
-
135
- $nextID = $maxID + 1
136
- return "FAIL-{0:D3}" -f $nextID
137
- }
138
-
139
- function Get-CategoryPath {
140
- param([string]$Category)
141
-
142
- if (-not $CATEGORY_PATHS.ContainsKey($Category)) {
143
- Write-Error "❌ Invalid category: $Category"
144
- exit 1
145
- }
146
-
147
- $path = Join-Path $FAILURE_ROOT $CATEGORY_PATHS[$Category]
148
- if (-not (Test-Path $path)) {
149
- Write-Warning "⚠️ Category directory not found, creating: $path"
150
- New-Item -ItemType Directory -Path $path -Force | Out-Null
151
- }
152
-
153
- return $path
154
- }
155
-
156
- function New-FailureRecord {
157
- param(
158
- [string]$FailureID,
159
- [string]$Category,
160
- [string]$Title,
161
- [string]$Severity,
162
- [string]$TaskID
163
- )
164
-
165
- $date = Get-Date -Format "yyyy-MM-dd"
166
- $categoryPath = Get-CategoryPath -Category $Category
167
-
168
- # 生成文件名(使用小寫和連字符)
169
- $titleSlug = $Title -replace '\s+', '-' -replace '[^\w\-]', '' -replace '-+', '-'
170
- $titleSlug = $titleSlug.ToLower()
171
- $fileName = "$FailureID-$titleSlug.yaml"
172
- $filePath = Join-Path $categoryPath $fileName
173
-
174
- # 生成失敗記錄內容
175
- $relatedTasksValue = if ($TaskID) { "`"$TaskID`"" } else { "" }
176
-
177
- $content = @"
178
- # [$FailureID] $Title
179
-
180
- _meta:
181
- id: "$FailureID"
182
- category: "$Category"
183
- severity: "$Severity"
184
- date: "$date"
185
- related_tasks: [$relatedTasksValue]
186
- related_commits: []
187
- status: "open"
188
-
189
- ## 失敗描述
190
-
191
- **現象**:(清晰描述發生了什麼)
192
-
193
- **預期行為**:
194
- - (預期的正常行為)
195
-
196
- **實際結果**:
197
- - (實際觀察到的錯誤結果)
198
-
199
- ## 根本原因
200
-
201
- 深入分析導致失敗的根本原因,不只是表面現象。
202
-
203
- ### 可能的原因
204
- 1. 原因 1
205
- 2. 原因 2
206
-
207
- ## 影響範圍
208
-
209
- ### 受影響的模組/文件
210
- - 文件 1
211
- - 文件 2
212
-
213
- ### 受影響的功能
214
- - 功能 1
215
- - 功能 2
216
-
217
- ### 潛在的連鎖反應
218
- - 連鎖反應 1
219
-
220
- ## 重現步驟
221
-
222
- 1. 步驟 1
223
- 2. 步驟 2
224
- 3. 觀察到的錯誤
225
-
226
- ## 解決方案
227
-
228
- 具體的、可執行的修復步驟。
229
-
230
- ``````
231
- # 修復代碼範例
232
- ``````
233
-
234
- ## 預防措施
235
-
236
- ### 檢查清單
237
- - [ ] 檢查項目 1
238
- - [ ] 檢查項目 2
239
-
240
- ### 規則建議
241
- 如果此失敗模式重複出現,建議建立 .rule/ 規則:
242
- - 規則 ID: XXX-YYY
243
- - 規則描述: ...
244
-
245
- ## 教訓與啟示
246
-
247
- ### 關鍵教訓
248
- 1. 教訓 1
249
- 2. 教訓 2
250
-
251
- ### 如何避免類似問題
252
- 1. 方法 1
253
- 2. 方法 2
254
-
255
- ---
256
-
257
- **最後更新**: $date
258
- **貢獻者**: (Agent Name)
259
- **狀態**: Open
260
- "@
261
-
262
- # 寫入文件
263
- $content | Out-File -FilePath $filePath -Encoding UTF8 -NoNewline
264
- Write-Host "✅ Failure record created: $filePath" -ForegroundColor Green
265
-
266
- return $filePath
267
- }
268
-
269
- function Update-IndexYaml {
270
- param(
271
- [string]$FailureID,
272
- [string]$Category,
273
- [string]$Title,
274
- [string]$Severity,
275
- [string]$FilePath
276
- )
277
-
278
- if (-not (Test-Path $INDEX_FILE)) {
279
- Write-Error "❌ INDEX.yaml not found"
280
- exit 1
281
- }
282
-
283
- # 讀取 INDEX.yaml
284
- $content = Get-Content $INDEX_FILE -Raw
285
-
286
- # 1. 更新 load_order (在 statistics 之前插入)
287
- $relativePath = $FilePath.Replace($FAILURE_ROOT, "").TrimStart("\").Replace("\", "/")
288
- $newLoadEntry = @"
289
-
290
- - path: "$relativePath"
291
- title: "$Title"
292
- severity: "$Severity"
293
- "@
294
-
295
- # 找到 statistics 前插入
296
- $statisticsIndex = $content.IndexOf("# ============================================================`n# 統計數據")
297
- if ($statisticsIndex -gt 0) {
298
- $content = $content.Insert($statisticsIndex, $newLoadEntry + "`n")
299
- }
300
-
301
- # 2. 更新統計數據
302
- # 更新 total_failures
303
- if ($content -match 'total_failures:\s*(\d+)') {
304
- $newTotal = [int]$matches[1] + 1
305
- $content = $content -replace 'total_failures:\s*\d+', "total_failures: $newTotal"
306
- }
307
-
308
- # 更新分類統計
309
- if ($content -match "$Category`:\s*(\d+)") {
310
- $newCount = [int]$matches[1] + 1
311
- $content = $content -replace "$Category`:\s*\d+", "$Category`: $newCount"
312
- }
313
-
314
- # 更新嚴重程度統計
315
- if ($content -match "$Severity`:\s*(\d+)") {
316
- $newCount = [int]$matches[1] + 1
317
- $content = $content -replace "$Severity`:\s*\d+", "$Severity`: $newCount"
318
- }
319
-
320
- # 3. 更新 last_updated
321
- $now = Get-Date -Format "yyyy-MM-ddTHH:mm:sszzz"
322
- $content = $content -replace 'last_updated:\s*"[^"]+"', "last_updated: `"$now`""
323
-
324
- # 寫回文件
325
- $content | Out-File -FilePath $INDEX_FILE -Encoding UTF8 -NoNewline
326
- Write-Host "✅ INDEX.yaml updated" -ForegroundColor Green
327
- }
328
-
329
- # ============================================================
330
- # 主程序
331
- # ============================================================
332
-
333
- if ($Help) {
334
- Show-Help
335
- }
336
-
337
- Write-Host "🔧 Failure Logging Tool" -ForegroundColor Cyan
338
- Write-Host "========================`n" -ForegroundColor Cyan
339
-
340
- # 如果參數不完整,進入互動模式
341
- if (-not $Category -or -not $Title -or -not $Severity) {
342
- $Interactive = $true
343
- }
344
-
345
- if ($Interactive) {
346
- Write-Host "📝 互動式建立失敗記錄`n" -ForegroundColor Yellow
347
-
348
- # 選擇分類
349
- Write-Host "1. 選擇失敗分類:"
350
- Write-Host " 1) agent_execution - Agent 執行失敗"
351
- Write-Host " 2) code_quality - 代碼品質問題"
352
- Write-Host " 3) architecture - 架構決策失敗"
353
- Write-Host " 4) pipeline - Pipeline 系統失敗"
354
- Write-Host " 5) data_integrity - 數據完整性問題"
355
- $categoryChoice = Read-Host "請選擇 (1-5)"
356
-
357
- $Category = switch ($categoryChoice) {
358
- "1" { "agent_execution" }
359
- "2" { "code_quality" }
360
- "3" { "architecture" }
361
- "4" { "pipeline" }
362
- "5" { "data_integrity" }
363
- default { Write-Error "❌ Invalid choice"; exit 1 }
364
- }
365
-
366
- # 輸入標題
367
- $Title = Read-Host "`n2. 失敗標題(簡短描述)"
368
- if (-not $Title) {
369
- Write-Error "❌ Title is required"
370
- exit 1
371
- }
372
-
373
- # 選擇嚴重程度
374
- Write-Host "`n3. 選擇嚴重程度:"
375
- Write-Host " 1) critical - 導致系統無法運作或數據損壞"
376
- Write-Host " 2) high - 嚴重影響功能或效率"
377
- Write-Host " 3) medium - 影響體驗但不阻礙功能"
378
- Write-Host " 4) low - 輕微問題或不便"
379
- $severityChoice = Read-Host "請選擇 (1-4)"
380
-
381
- $Severity = switch ($severityChoice) {
382
- "1" { "critical" }
383
- "2" { "high" }
384
- "3" { "medium" }
385
- "4" { "low" }
386
- default { Write-Error "❌ Invalid choice"; exit 1 }
387
- }
388
-
389
- # 輸入相關任務 ID(可選)
390
- $TaskID = Read-Host "`n4. 相關任務 ID(可選,如 TASK_078)"
391
- }
392
-
393
- # 驗證必填欄位
394
- if (-not $Category -or -not $Title -or -not $Severity) {
395
- Write-Error "❌ Missing required parameters: Category, Title, Severity"
396
- Show-Help
397
- exit 1
398
- }
399
-
400
- # 生成 Failure ID
401
- $FailureID = Get-NextFailureID
402
- Write-Host "`n📋 生成失敗記錄 ID: $FailureID" -ForegroundColor Cyan
403
-
404
- # 顯示摘要
405
- Write-Host "`n📊 失敗記錄摘要:" -ForegroundColor Yellow
406
- Write-Host " ID: $FailureID"
407
- Write-Host " 分類: $Category"
408
- Write-Host " 標題: $Title"
409
- Write-Host " 嚴重程度: $Severity $($SEVERITY_ICONS[$Severity])"
410
- if ($TaskID) {
411
- Write-Host " 相關任務: $TaskID"
412
- }
413
-
414
- # 確認建立
415
- $confirm = Read-Host "`n確認建立此失敗記錄? (Y/n)"
416
- if ($confirm -eq "n" -or $confirm -eq "N") {
417
- Write-Host "❌ 已取消" -ForegroundColor Red
418
- exit 0
419
- }
420
-
421
- # 建立失敗記錄
422
- Write-Host "`n🚀 建立失敗記錄..." -ForegroundColor Cyan
423
- $filePath = New-FailureRecord -FailureID $FailureID -Category $Category -Title $Title -Severity $Severity -TaskID $TaskID
424
-
425
- # 更新 INDEX.yaml
426
- Write-Host "📝 更新 INDEX.yaml..." -ForegroundColor Cyan
427
- Update-IndexYaml -FailureID $FailureID -Category $Category -Title $Title -Severity $Severity -FilePath $filePath
428
-
429
- # 🆕 同時寫入記憶系統 (.memory/failures/)
430
- Write-Host "💾 同時寫入記憶系統..." -ForegroundColor Cyan
431
- try {
432
- # 轉換嚴重程度到重要性分數
433
- $importanceMap = @{
434
- "critical" = 5
435
- "high" = 4
436
- "medium" = 3
437
- "low" = 2
438
- }
439
- $importance = $importanceMap[$Severity]
440
-
441
- # 生成標籤
442
- $tags = "failure,$Severity"
443
- if ($Category) {
444
- $tags += ",$Category"
445
- }
446
-
447
- # 構建 memory-tools.js 命令
448
- $memoryToolsPath = Join-Path $PSScriptRoot "..\..\memory\tools\memory-tools.js"
449
- $summary = "失敗記錄:$Title($Severity 嚴重程度)"
450
-
451
- # 調用 memory-tools.js
452
- $cmd = "node `"$memoryToolsPath`" add --type failure --title `"$Title`" --summary `"$summary`" --importance $importance --tags `"$tags`" --sourceFile `"$FailureID`""
453
-
454
- $result = Invoke-Expression $cmd 2>&1
455
- if ($LASTEXITCODE -eq 0) {
456
- Write-Host " ✅ 已同步到記憶系統" -ForegroundColor Green
457
- } else {
458
- Write-Warning "⚠️ 記憶系統同步失敗(不影響失敗記錄建立)"
459
- Write-Warning " 錯誤: $result"
460
- }
461
- } catch {
462
- Write-Warning "⚠️ 記憶系統同步失敗(不影響失敗記錄建立)"
463
- Write-Warning " 錯誤: $_"
464
- }
465
-
466
- Write-Host "`n✅ 完成!失敗記錄已建立並更新到索引。" -ForegroundColor Green
467
- Write-Host "📁 .failure/ 路徑: $filePath" -ForegroundColor Cyan
468
- Write-Host "📁 .memory/ 路徑: 自動生成(查看上方輸出)" -ForegroundColor Cyan
469
- Write-Host "`n下一步:"
470
- Write-Host " 1. 編輯失敗記錄,補充詳細資訊"
471
- Write-Host " 2. 執行 .\check_failures.ps1 檢查相關失敗模式"
472
- Write-Host " 3. 如需轉化為規則,執行 .\failure-to-rule.ps1"
473
-
474
- exit 0
@@ -1,10 +0,0 @@
1
- {
2
- "tool": "hippocampus_episode_start",
3
- "params": {
4
- "scope": "M3 handoff migration: write-endpoint completion after TASK_1828 read-path fix",
5
- "task_id": "TASK_1829",
6
- "agent_role": "ansuz",
7
- "agent_skill": "session-observer",
8
- "projectPath": "."
9
- }
10
- }
@@ -1 +0,0 @@
1
- {"pid":32452,"taskId":"TASK_2356","acquiredAt":"2026-10-09T10:19:19.033Z"}
@@ -1,118 +0,0 @@
1
- skill: lead
2
- formation: "*"
3
- version: "2.0"
4
-
5
- name: Formation Lead
6
- description: |
7
- Formation PM — 使用 Formation 系統的全權 PM。
8
- 完整任務生命週期:理解需求 → 建立任務 → 判斷陣型 → 調度執行 → 追蹤結果 → 回報用戶。
9
-
10
- role:
11
- identity: |
12
- 你是 Formation Lead,全權 PM。
13
- 你不親自寫程式碼。你理解需求、做決策、派人、追結果。
14
- priority: 先理解再行動,需求不清就問。最輕量原則。
15
-
16
- input:
17
- required:
18
- - task: 任務 ID 或用戶描述(支援多個,逗號分隔或陣列)
19
- optional:
20
- - formation: 強制指定陣型(跳過自動判斷)
21
- - skill: 強制指定技能
22
- - concurrency: 並行執行數(預設 3,上限 5)
23
-
24
- # ─────────────────────────────────────────
25
- # 陣型選擇邏輯
26
- # ─────────────────────────────────────────
27
-
28
- selection:
29
- rules:
30
- - condition: 單一明確任務,影響 ≤3 個檔案
31
- formation: unit
32
- skill: do
33
-
34
- - condition: 需要調查或分析,不需要改程式碼
35
- formation: unit
36
- skill: think
37
-
38
- - condition: 需要拆解目標、制定方案
39
- formation: unit
40
- skill: plan
41
-
42
- - condition: 需要多角度動態分析,一個 agent 裝備多視角自主切換
43
- formation: solo
44
- skill: 根據分析類型選擇(strategy | diagnosis)
45
-
46
- - condition: 一個任務可拆成多個互不依賴的子任務並行完成
47
- formation: squad
48
- skill: blitz
49
-
50
- - condition: 同一變更邏輯需套用到多個獨立區域(跨模組重構、批量遷移)
51
- formation: squad
52
- skill: sweep
53
-
54
- - condition: 有順序依賴(設計→實作→驗收)或回饋循環
55
- formation: legion
56
- skill: forge
57
-
58
- - condition: 工作高度耦合,所有人的變更互相影響,需即時協調
59
- formation: legion
60
- skill: hive
61
-
62
- fallback: unit/do
63
-
64
- # ─────────────────────────────────────────
65
- # 工作流程
66
- # ─────────────────────────────────────────
67
-
68
- collaboration:
69
- task_api: node .collaboration/core/task-api.js
70
-
71
- workflow:
72
- - phase: 理解需求
73
- actions:
74
- - 如果是 TASK_ID → 讀取任務詳情
75
- - 如果是描述 → 確認需求是否足夠明確
76
- - 需求不清就問用戶,不要猜
77
-
78
- - phase: 建立任務
79
- run: node .collaboration/core/task-api.js create --title "{title}" --priority {priority}
80
- then: node .collaboration/core/task-api.js claim TASK_XXX
81
- skip_if: 已有 TASK_ID
82
-
83
- - phase: 判斷陣型
84
- actions:
85
- - 檢查是否有用戶強制指定的 formation/skill
86
- - 若無,Lead 自行評估需求特性,參考 selection.rules 作為指引(非硬性)
87
- - 告知用戶選擇和理由(一句話)
88
-
89
- - phase: 調度執行
90
- actions:
91
- - "單任務: unit/solo → dispatch.js → runSingle"
92
- - "多任務並行: 按 concurrency 參數(預設 3)同時啟動多個 dispatch"
93
- - "squad: dispatch.js → runParallel(隊內並行)"
94
- - "legion: dispatch.js → TeamCreate 配置"
95
- parallel:
96
- description: |
97
- 當有多個任務時,Lead 按 concurrency 數量同時調度:
98
- 1. 從 pending 佇列按優先級取 N 個任務(N = concurrency)
99
- 2. 每個任務獨立判斷陣型,獨立 dispatch
100
- 3. 滑動窗口:有 slot 完成就補入下一個任務
101
- 4. 衝突檢查:相同檔案路徑的任務不並行
102
- default_concurrency: 3
103
- max_concurrency: 5
104
-
105
- - phase: 追蹤結果
106
- actions:
107
- - 追蹤所有並行 slot 的執行狀態
108
- - 任一 slot 完成時立即處理結果
109
- - "成功: task-api.js complete TASK_XXX"
110
- - "失敗: task-api.js move TASK_XXX blocked"
111
- - 空出的 slot 自動補入下一個 pending 任務
112
-
113
- - phase: 回報用戶
114
- format: |
115
- ✅ 批次完成({completed}/{total})
116
- 並行度:{concurrency}
117
- 結果:
118
- {逐任務摘要列表}
@@ -1,57 +0,0 @@
1
- skill: designer
2
- formation: legacy
3
- version: "1.0"
4
-
5
- name: Designer
6
- description: UI/UX 設計。設計規範、視覺稿、互動設計、設計系統維護。
7
-
8
- role:
9
- identity: |
10
- 你是 UI/UX 設計師。產出設計規範、組件規格、視覺風格定義。
11
- 以用戶體驗為核心,確保設計的一致性和可實現性。
12
- priority: 產出可執行的設計規範,而非抽象概念。
13
-
14
- input:
15
- required:
16
- - task: 任務 ID 或設計需求描述
17
- optional:
18
- - context: 現有設計系統或品牌指南
19
- - target: 目標頁面或組件
20
-
21
- output:
22
- primary: 設計規範文件(DESIGN_SPEC.md)或組件規格
23
- secondary: 設計決策記錄、參考資料
24
-
25
- behavior:
26
- - 先完成指派的任務(## Task),完成後可用 task-api.js claim 認領下一個任務繼續工作
27
- - 嚴禁直接讀取 .collaboration/tasks/ 目錄。所有任務操作必須透過 task-api.js(list/claim/complete)
28
- - 只能 complete 你自己認領的任務,不要標記其他 agent 的任務為完成
29
- - 先了解現有設計系統和視覺風格
30
- - 只修改當前任務 scope_paths 指定的檔案
31
- - 設計規範要具體到可以直接實作(顏色值、間距、字體大小)
32
- - 考慮 RWD 和無障礙
33
- - 與現有元件庫一致
34
- - 產出 Markdown 格式的規範文件
35
- - 禁止執行任何 git 操作(commit、branch、merge)— Git 由 Formation Lead 統一管理
36
-
37
- collaboration:
38
- task_api: node .collaboration/core/task-api.js
39
-
40
- workflow:
41
- - step: 讀取任務
42
- run: node .collaboration/core/task-api.js get {task_id}
43
-
44
- - step: 認領任務
45
- run: node .collaboration/core/task-api.js claim {task_id}
46
-
47
- - step: 設計分析
48
- actions:
49
- - 檢查現有設計系統
50
- - 分析需求與用戶場景
51
- - 產出設計規範或視覺稿
52
-
53
- - step: 完成任務
54
- run: node .collaboration/core/task-api.js complete {task_id}
55
-
56
- on_blocked:
57
- run: node .collaboration/core/task-api.js move {task_id} blocked