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,335 +0,0 @@
1
- # FAIL-003: TASK_QUEUE 污染問題
2
-
3
- _meta:
4
- id: "FAIL-003"
5
- category: "pipeline"
6
- severity: "high"
7
- date: "2026-02-05"
8
- related_tasks: ["TASK_077", "TASK_078", "TASK_079", "TASK_080"]
9
- related_commits: []
10
- discovered_by: "Multi-Agent Scheduler"
11
- affected_versions: ["1.0.0"]
12
-
13
- ## 失敗描述
14
-
15
- **問題現象**:已完成任務被移到 `.memory/COMPLETED_TASKS.json` 後,Multi-Agent Scheduler 又把它們加回 `TASK_QUEUE.json` 並標記為 `completed`,污染佇列。
16
-
17
- **預期行為**:
18
- - 已完成任務應該只存在於 `dev/pipeline/completed/` 目錄和 `.memory/COMPLETED_TASKS.json`
19
- - `TASK_QUEUE.json` 應該只包含待處理任務(`pending`, `in_progress`, `blocked`)
20
- - 統計數據應該準確反映當前佇列狀態
21
-
22
- **實際結果**:
23
- - `TASK_QUEUE.json` 被大量 `status: completed` 的任務污染
24
- - 統計數據混亂,`total` 包含大量歷史任務
25
- - Agent 任務選取時需要過濾大量已完成任務,影響效率
26
-
27
- ## 根本原因
28
-
29
- Multi-Agent Scheduler 的任務同步邏輯存在缺陷:
30
-
31
- 1. **錯誤的同步來源**:Scheduler 從 `dev/pipeline/completed/` 資料夾同步任務時,會把所有歷史任務重新加入 `TASK_QUEUE.json`
32
- 2. **缺乏狀態過濾**:同步時沒有過濾 `completed` 狀態的任務
33
- 3. **累積制誤解**:將統計數據的累積制(total = 佇列 + 歷史)誤解為佇列應該包含所有歷史任務
34
-
35
- **代碼位置**:
36
- ```
37
- dashboard/src-tauri/src/cmd_modules/scheduler/
38
- - task_queue.rs(任務佇列管理)
39
- - dispatcher.rs(任務同步邏輯)
40
- ```
41
-
42
- ## 影響範圍
43
-
44
- ### 受影響的模組
45
- - `dev/pipeline/TASK_QUEUE.json` - 任務佇列數據污染
46
- - `dev/pipeline/PROGRESS.md` - 進度統計不準確
47
- - Multi-Agent Scheduler - 任務選取效率降低
48
- - Dashboard UI - 任務列表顯示混亂
49
-
50
- ### 受影響的功能
51
- - 任務佇列管理
52
- - 統計數據計算
53
- - Agent 任務分配
54
- - 進度追蹤
55
-
56
- ### 潛在的連鎖反應
57
- - Agent 可能重複執行已完成任務
58
- - 統計數據無法反映真實進度
59
- - 佇列文件體積持續增長
60
- - 影響多專案並行開發的隔離性
61
-
62
- ## 重現步驟
63
-
64
- 1. 完成一個或多個任務(狀態變為 `completed`)
65
- 2. 將已完成任務從 `dev/pipeline/tasks/` 移到 `dev/pipeline/completed/`
66
- 3. 將已完成任務記錄封存到 `.memory/COMPLETED_TASKS.json`
67
- 4. 啟動 Multi-Agent Scheduler
68
- 5. 觀察 `TASK_QUEUE.json`:已完成任務重新出現,狀態為 `completed`
69
- 6. 統計數據 `total` 包含大量歷史任務
70
-
71
- ## 解決方案
72
-
73
- ### 1. 立即清理 TASK_QUEUE.json
74
-
75
- 使用以下腳本清理已完成任務:
76
-
77
- ```javascript
78
- // cleanup-queue.js
79
- const fs = require('fs');
80
- const path = require('path');
81
-
82
- const queuePath = 'dev/pipeline/TASK_QUEUE.json';
83
-
84
- // 讀取並移除 BOM(如果存在)
85
- let content = fs.readFileSync(queuePath, 'utf8');
86
- if (content.charCodeAt(0) === 0xFEFF) {
87
- content = content.slice(1);
88
- }
89
-
90
- const data = JSON.parse(content);
91
-
92
- // 只保留 pending/in_progress/blocked 任務
93
- data.tasks = data.tasks.filter(t =>
94
- ['pending', 'in_progress', 'blocked'].includes(t.status)
95
- );
96
-
97
- // 重新計算統計數據(當前佇列制)
98
- data.statistics = {
99
- total: data.tasks.length,
100
- pending: data.tasks.filter(t => t.status === 'pending').length,
101
- in_progress: data.tasks.filter(t => t.status === 'in_progress').length,
102
- blocked: data.tasks.filter(t => t.status === 'blocked').length,
103
- completed: 0,
104
- cancelled: 0
105
- };
106
-
107
- // 更新時間戳
108
- data.last_updated = new Date().toISOString();
109
-
110
- // 寫回文件
111
- fs.writeFileSync(queuePath, JSON.stringify(data, null, 2));
112
-
113
- console.log(`✅ 清理完成!保留 ${data.tasks.length} 個任務`);
114
- console.log(` - pending: ${data.statistics.pending}`);
115
- console.log(` - in_progress: ${data.statistics.in_progress}`);
116
- console.log(` - blocked: ${data.statistics.blocked}`);
117
- ```
118
-
119
- 執行方式:
120
- ```bash
121
- node cleanup-queue.js
122
- ```
123
-
124
- ### 2. 修改 Scheduler 同步邏輯
125
-
126
- **修改文件**:`dashboard/src-tauri/src/cmd_modules/scheduler/task_queue.rs`
127
-
128
- **關鍵修改**:
129
- ```rust
130
- // 同步任務時,只從 tasks/ 目錄讀取,不從 completed/ 讀取
131
- pub fn sync_tasks_from_filesystem(&mut self, project_path: &Path) -> Result<()> {
132
- let tasks_dir = project_path.join("dev/pipeline/tasks");
133
-
134
- // ❌ 錯誤:不要從 completed/ 讀取
135
- // let completed_dir = project_path.join("dev/pipeline/completed");
136
-
137
- // ✅ 正確:只從 tasks/ 讀取
138
- self.load_tasks_from_directory(&tasks_dir)?;
139
-
140
- Ok(())
141
- }
142
-
143
- // 過濾 completed 狀態的任務
144
- pub fn filter_active_tasks(&mut self) {
145
- self.tasks.retain(|task| {
146
- matches!(task.status, TaskStatus::Pending | TaskStatus::InProgress | TaskStatus::Blocked)
147
- });
148
- }
149
- ```
150
-
151
- ### 3. 建立定期清理機制
152
-
153
- 在 `dev/scripts/` 建立定期清理腳本:
154
-
155
- ```powershell
156
- # cleanup-completed-tasks.ps1
157
- # 定期清理 TASK_QUEUE.json 中的已完成任務
158
-
159
- param(
160
- [switch]$DryRun,
161
- [switch]$Verbose
162
- )
163
-
164
- $QueuePath = "dev/pipeline/TASK_QUEUE.json"
165
- $BackupPath = "dev/pipeline/backups/queue_backup_$(Get-Date -Format 'yyyyMMdd_HHmmss').json"
166
-
167
- # 備份
168
- if (-not $DryRun) {
169
- Copy-Item $QueuePath $BackupPath -Force
170
- Write-Host "✅ 已備份到 $BackupPath"
171
- }
172
-
173
- # 清理
174
- node cleanup-queue.js
175
-
176
- # 驗證
177
- $data = Get-Content $QueuePath | ConvertFrom-Json
178
- $completedCount = ($data.tasks | Where-Object { $_.status -eq 'completed' }).Count
179
-
180
- if ($completedCount -gt 0) {
181
- Write-Warning "⚠️ 仍有 $completedCount 個已完成任務!"
182
- exit 1
183
- } else {
184
- Write-Host "✅ 佇列已清理,無已完成任務"
185
- }
186
- ```
187
-
188
- ## 預防措施
189
-
190
- ### 檢查清單
191
-
192
- - [ ] **任務完成後立即封存**:完成任務後,立即將 YAML 移到 `completed/` 並更新 Queue
193
- - [ ] **Scheduler 啟動前驗證**:Scheduler 啟動前,驗證 Queue 中無 `completed` 任務
194
- - [ ] **定期執行清理腳本**:每週執行一次 `cleanup-queue.js` 確保佇列乾淨
195
- - [ ] **監控統計數據異常**:當 `total` 超過 100 或 `completed > 0` 時觸發警報
196
- - [ ] **禁止從 completed/ 同步**:Scheduler 代碼禁止從 `completed/` 目錄讀取任務
197
- - [ ] **統一狀態更新邏輯**:所有狀態更新必須通過 `task_queue.rs` 的 API
198
-
199
- ### 自動化驗證
200
-
201
- 在 Scheduler 啟動時加入驗證:
202
-
203
- ```rust
204
- pub fn validate_queue_integrity(&self) -> Result<()> {
205
- let completed_count = self.tasks.iter()
206
- .filter(|t| t.status == TaskStatus::Completed)
207
- .count();
208
-
209
- if completed_count > 0 {
210
- return Err(SchedulerError::QueuePollution(
211
- format!("發現 {} 個已完成任務污染佇列!請執行清理腳本。", completed_count)
212
- ));
213
- }
214
-
215
- Ok(())
216
- }
217
- ```
218
-
219
- ### 規則建議
220
-
221
- 如果此失敗模式重複出現,建議建立 `.rule/general/pipeline.yaml` 規則:
222
-
223
- **規則 ID**: `PPL-002`
224
-
225
- **規則描述**: 已完成任務封存規範
226
- ```yaml
227
- id: "PPL-002"
228
- category: "pipeline"
229
- priority: "high"
230
- title: "已完成任務必須立即封存"
231
-
232
- rules:
233
- - name: "任務完成後立即移動"
234
- description: |
235
- 任務狀態變為 completed 後,必須在同一操作中:
236
- 1. 將 YAML 從 tasks/ 移到 completed/
237
- 2. 從 TASK_QUEUE.json 移除該任務
238
- 3. 記錄到 .memory/COMPLETED_TASKS.json
239
- 4. 更新統計數據
240
-
241
- - name: "禁止從 completed/ 同步"
242
- description: |
243
- Multi-Agent Scheduler 的任務同步邏輯必須只從 tasks/ 目錄讀取,
244
- completed/ 目錄僅供歷史記錄和審計使用。
245
-
246
- - name: "啟動時驗證佇列完整性"
247
- description: |
248
- Scheduler 啟動時必須驗證 TASK_QUEUE.json 中無 completed 狀態任務,
249
- 如有則拒絕啟動並提示執行清理腳本。
250
-
251
- enforcement:
252
- - type: "code_validation"
253
- tool: "rust_clippy"
254
- check: "禁止 Scheduler 讀取 completed/ 目錄"
255
-
256
- - type: "pre_commit_hook"
257
- script: "validate-queue-integrity.sh"
258
- description: "提交前驗證 TASK_QUEUE.json 完整性"
259
- ```
260
-
261
- ## 統計數據規範澄清
262
-
263
- **重要**:`TASK_QUEUE.json` 的統計應該是**累積制**(記錄在 `.memory/MEMORY.md`),但這不代表佇列要包含已完成任務!
264
-
265
- ### 正確的統計數據模型
266
-
267
- ```javascript
268
- // TASK_QUEUE.json 中的統計
269
- statistics: {
270
- // 當前佇列任務總數(不含已完成)
271
- total: queue.tasks.length,
272
-
273
- // 當前佇列狀態分布
274
- pending: queue.tasks.filter(t => t.status === 'pending').length,
275
- in_progress: queue.tasks.filter(t => t.status === 'in_progress').length,
276
- blocked: queue.tasks.filter(t => t.status === 'blocked').length,
277
-
278
- // 歷史統計(從外部讀取)
279
- completed: readFromMemory('.memory/COMPLETED_TASKS.json').length,
280
- cancelled: readFromMemory('.memory/CANCELLED_TASKS.json').length
281
- }
282
- ```
283
-
284
- ### 累積制的正確實現
285
-
286
- **佇列文件**(`TASK_QUEUE.json`):只存當前任務
287
- **歷史文件**(`.memory/COMPLETED_TASKS.json`):累積所有已完成任務
288
- **統計計算**:累積制 = 佇列 + 歷史
289
-
290
- 這樣既能保持統計數據的累積特性,又不會污染佇列。
291
-
292
- ## 教訓與啟示
293
-
294
- ### 1. 數據模型要清晰分離
295
-
296
- 不要在單一文件(`TASK_QUEUE.json`)中混合當前狀態和歷史記錄。應該:
297
- - **Queue**:只存當前待處理任務
298
- - **Memory**:存歷史已完成任務
299
- - **Statistics**:計算時合併兩者
300
-
301
- ### 2. 累積制 ≠ 全部塞進佇列
302
-
303
- 累積制統計數據是指「統計總數包含歷史」,而非「佇列包含歷史任務」。這是兩個層面的概念,不應混淆。
304
-
305
- ### 3. 同步邏輯要明確來源
306
-
307
- Scheduler 同步任務時,必須明確:
308
- - ✅ 從 `tasks/` 讀取 → 待處理任務
309
- - ❌ 從 `completed/` 讀取 → 污染佇列
310
-
311
- ### 4. 啟動前驗證資料完整性
312
-
313
- 系統啟動時應驗證核心數據文件的完整性,發現異常立即拒絕啟動,避免帶病運行。
314
-
315
- ### 5. 自動化清理優於手動維護
316
-
317
- 定期自動化清理比依賴開發者記憶更可靠。
318
-
319
- ## 相關資源
320
-
321
- - **任務佇列管理**:`dashboard/src-tauri/src/cmd_modules/scheduler/task_queue.rs`
322
- - **調度器邏輯**:`dashboard/src-tauri/src/cmd_modules/scheduler/dispatcher.rs`
323
- - **Pipeline 配置**:`dev/pipeline/PIPELINE_CONFIG.json`
324
- - **統計數據規範**:`.memory/MEMORY.md` - Pipeline 系統章節
325
- - **清理腳本**:`dev/scripts/cleanup-queue.js`(待建立)
326
-
327
- ## 修復進度
328
-
329
- - [x] 問題識別與記錄
330
- - [x] 根本原因分析
331
- - [ ] 建立清理腳本(`cleanup-queue.js`)
332
- - [ ] 修改 Scheduler 同步邏輯
333
- - [ ] 加入啟動時驗證
334
- - [ ] 建立定期清理機制
335
- - [ ] 轉化為 `.rule/` 規則(如重複發生)
@@ -1,95 +0,0 @@
1
- # ⚙️ Pipeline System Failures
2
-
3
- ## 分類說明
4
-
5
- 此目錄記錄 **Pipeline 系統失敗** 相關的問題,包括:
6
-
7
- - 任務管理和佇列問題
8
- - 任務狀態同步錯誤
9
- - 統計數據不準確
10
- - Agent 調度問題
11
- - 路徑鎖定和衝突
12
- - Pipeline 配置錯誤
13
-
14
- ## 嚴重程度範例
15
-
16
- ### 🔴 Critical
17
- - 任務佇列數據損壞導致系統無法運作
18
- - 路徑鎖定失效導致多 Agent 衝突
19
- - 統計數據嚴重錯誤影響決策
20
-
21
- ### 🟠 High
22
- - 任務狀態同步錯誤導致重複執行
23
- - Agent 調度邏輯錯誤影響效率
24
- - 已完成任務污染佇列
25
-
26
- ### 🟡 Medium
27
- - 統計數據輕微不準確
28
- - Pipeline 配置不夠彈性
29
- - 日誌記錄不完整
30
-
31
- ### 🟢 Low
32
- - 進度顯示格式問題
33
- - 任務描述不清晰
34
- - 日誌輸出冗餘
35
-
36
- ## 記錄指南
37
-
38
- 當遇到 Pipeline 系統問題時,請遵循以下步驟:
39
-
40
- ### 1. 確認問題範圍
41
- 確認問題屬於 Pipeline 系統層面,而非單一任務的執行問題。
42
-
43
- ### 2. 建立失敗記錄
44
- 使用失敗記錄模板建立 YAML 文件。
45
-
46
- ```yaml
47
- # 文件命名格式: FAIL-XXX-short-description.yaml
48
- # 範例: FAIL-003-queue-pollution.yaml
49
- ```
50
-
51
- ### 3. 包含系統狀態
52
- 記錄失敗時的系統狀態:
53
- - `TASK_QUEUE.json` 的內容
54
- - `LOCK_STATE.json` 的內容
55
- - `PROGRESS.md` 的狀態
56
- - Agent 執行日誌
57
-
58
- ### 4. 分析數據流
59
- 追蹤數據流動路徑,找出數據損壞或同步錯誤的位置:
60
- - 任務建立 → 任務佇列 → Agent 執行 → 狀態更新 → 統計計算
61
-
62
- ### 5. 建立預防措施
63
- - 添加數據驗證腳本
64
- - 增強狀態同步機制
65
- - 改進錯誤恢復邏輯
66
- - 考慮轉化為 `.rule/general/` 規則
67
-
68
- ## 常見 Pipeline 問題模式
69
-
70
- ### 1. 數據完整性問題
71
- - **問題**:JSON 文件損壞、BOM 編碼問題
72
- - **預防**:使用驗證腳本、統一編碼處理
73
-
74
- ### 2. 狀態同步問題
75
- - **問題**:多處狀態不一致
76
- - **預防**:單一數據源、原子性更新
77
-
78
- ### 3. 統計數據錯誤
79
- - **問題**:累積制 vs 當前制混淆
80
- - **預防**:明確定義統計規範
81
-
82
- ### 4. 路徑鎖定失效
83
- - **問題**:多 Agent 同時修改相同文件
84
- - **預防**:嚴格執行 scope_paths 限制
85
-
86
- ## 已記錄的失敗
87
-
88
- 請參考 `.failure/INDEX.yaml` 的 `load_order` 部分查看已記錄的失敗。
89
-
90
- ## 相關資源
91
-
92
- - **Pipeline 規則**:`.rule/general/pipeline.yaml`
93
- - **任務管理文檔**:`dev/pipeline/README.md`
94
- - **失敗記錄模板**:`.failure/INDEX.yaml` - `failure_template`
95
- - **Multi-Agent Scheduler**:`dashboard/src-tauri/src/cmd_modules/scheduler/`
@@ -1,49 +0,0 @@
1
- id: FAIL-009
2
- title: "Agent 跳過 synapse_pulse 直接修改代碼"
3
- category: agent_execution
4
- severity: high
5
-
6
- description: |
7
- Agent 在修改代碼前跳過 synapse_pulse(神經脈衝),直接編輯文件。
8
- 通常的理由是「這只是小改動」「只是 UI 修改」「沒有風險」。
9
- 但 pulse 的目的不是風險評估 — 是認知覺察(awareness)。
10
-
11
- incident:
12
- date: "2026-03-17"
13
- context: "Ansuz 修改 LoadingScreen.tsx,將 Unicode 符文替換為 SVG 石頭符文"
14
- what_happened: |
15
- Ansuz 判定「這只是 UI 修改,不需要查圖譜」,跳過 synapse_pulse 直接編輯。
16
- 修改本身沒有問題,但違反了 SYN-001(禁止盲寫)。
17
- what_was_missed: |
18
- Pulse 本可以揭示:
19
- - 同一個 &#5794; Unicode 字元是否在其他文件使用
20
- - LoadingScreen 的 callers 是否依賴其 DOM 結構
21
- - 是否有相關的歷史 rune(設計決策等)
22
-
23
- root_cause: |
24
- Agent 將 synapse_pulse 視為「風險評估工具」而非「認知習慣」。
25
- 當心理模型是「風險高才需要脈衝」時,Agent 會對「看起來簡單的任務」跳過。
26
- 正確的心理模型:pulse 是肌肉記憶,不是風險計算後的選擇。
27
-
28
- prevention:
29
- rule: "SYN-001: 修改任何 symbol 前,必須先做 synapse_pulse"
30
- mental_model: |
31
- Pulse 不是問「這個改動危險嗎?」
32
- Pulse 是問「關於這個 symbol,我還不知道什麼?」
33
- 10 秒的 pulse 可以揭示你未預料到的依賴、歷史決策、已知風險。
34
- trigger: |
35
- 如果你發現自己在想「這太簡單了不需要 pulse」—
36
- 這正是你最需要 pulse 的時候。
37
- 因為「覺得簡單」可能是「不知道自己不知道」。
38
-
39
- checklist:
40
- - "修改代碼前是否執行了 synapse_pulse?"
41
- - "如果跳過了,理由是什麼?「太簡單」不是合理理由"
42
- - "pulse 結果是否影響了你的實作方案?"
43
-
44
- related:
45
- rules:
46
- - ".rule/general/synapse-code-intelligence.yaml (SYN-001~007)"
47
- runes:
48
- - "rune_a7049ab7 (LoadingScreen risk)"
49
- - "rune_da740eee (Ansuz workflow fix)"