kenaz 0.3.17 → 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 (316) 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/hooks/synapse-first-investigation.js +15 -0
  7. package/core/.claude/skills/architect_agent/SKILL.md +11 -92
  8. package/core/.claude/skills/assessment_agent/SKILL.md +0 -1
  9. package/core/.claude/skills/backend_engineer/SKILL.md +3 -6
  10. package/core/.claude/skills/code_reviewer/SKILL.md +1 -1
  11. package/core/.claude/skills/code_reviewer/patterns.yaml +1 -1
  12. package/core/.claude/skills/designer/SKILL.md +3 -6
  13. package/core/.claude/skills/dev_agent/SKILL.md +30 -491
  14. package/core/.claude/skills/developer/SKILL.md +3 -6
  15. package/core/.claude/skills/feature_agent/SKILL.md +3 -17
  16. package/core/.claude/skills/product_manager/SKILL.md +29 -1064
  17. package/core/.claude/skills/qa_engineer/SKILL.md +12 -17
  18. package/core/.claude/skills/spec_optimizer/SKILL.md +25 -275
  19. package/core/.claude/skills/sre_agent/SKILL.md +3 -6
  20. package/core/.collaboration/README.md +2 -3
  21. package/core/.collaboration/core/task-api.js +5 -138
  22. package/core/.collaboration/docs/CLI.md +0 -2
  23. package/core/.failure/INDEX.yaml +6 -40
  24. package/core/.failure/agent-execution/FAIL-013-search-cwd-drift-and-case-mismatch.yaml +1 -1
  25. package/core/.failure/tools/README.md +9 -227
  26. package/core/.formation/bifrost/exec.js +29 -4
  27. package/core/.formation/bifrost/launch.js +1 -6
  28. package/core/.formation/bifrost/launch.test.js +1 -1
  29. package/core/.formation/bifrost/provider-launch.js +18 -11
  30. package/core/.formation/bifrost/provider-launch.test.js +26 -2
  31. package/core/.formation/bifrost/shared/ansuz-boot-policy.js +3 -3
  32. package/core/.formation/bifrost/shared/ansuz-boot-policy.test.js +1 -2
  33. package/core/.formation/tools/__tests__/dispatch-cwd-project.test.js +42 -0
  34. package/core/.formation/tools/__tests__/m1-hmap-convid.test.js +1 -124
  35. package/core/.formation/tools/__tests__/subagent-executor.test.js +3 -2
  36. package/core/.formation/tools/dispatch.js +15 -2
  37. package/core/.formation/tools/loader.js +17 -140
  38. package/core/.formation/tools/post-complete.js +0 -31
  39. package/core/.rule/INDEX.yaml +0 -18
  40. package/core/.rule/general/agent-workflow.yaml +14 -164
  41. package/core/.rule/general/project-self-containment.yaml +8 -19
  42. package/core/.rule/general/rust-verify-target.yaml +6 -5
  43. package/core/.rule/general/synapse-code-intelligence.yaml +3 -3
  44. package/core/.specialist/Amelia/capability.yaml +12 -12
  45. package/core/.specialist/Amelia/workflow.yaml +2 -2
  46. package/core/.specialist/Ansuz/SYSTEM_DOC.md +20 -578
  47. package/core/.specialist/Ansuz/cognitive_principles.yaml +2 -3
  48. package/core/.specialist/Ansuz/concepts/boot_rules_summary.yaml +0 -1
  49. package/core/.specialist/Ansuz/concepts/deep_knowledge_pointers.yaml +1 -2
  50. package/core/.specialist/Ansuz/core.yaml +6 -108
  51. package/core/.specialist/Ansuz/guards/lesson_guards.yaml +0 -3
  52. package/core/.specialist/Ansuz/identity_contract.yaml +0 -1
  53. package/core/.specialist/Ansuz/knowledge.yaml +0 -4
  54. package/core/.specialist/Ansuz/rule.yaml +0 -1
  55. package/core/.specialist/Ansuz/tools/handoff-session-identity.test.js +6 -150
  56. package/core/.specialist/tests/runtime-discovery/README.md +1 -1
  57. package/core/.specialist/tools/__tests__/task-2374-usage-counter.test.js +1 -12
  58. package/core/.specialist/tools/prompt-files.test.js +1 -0
  59. package/core/.specialist/tools/task-bridge.js +1 -66
  60. package/core/.system/README.md +11 -552
  61. package/core/.system/collaboration/README.md +10 -174
  62. package/core/CLAUDE.md +1 -6
  63. package/core/KENAZ_CORE_VERSION +1 -1
  64. package/core/dev/scripts/js-yaml-resolution.test.js +1 -1
  65. package/core/dev/scripts/run-rust-tests.js +30 -46
  66. package/core/dev/scripts/run-rust-tests.test.js +17 -0
  67. package/core/dev/scripts/rust-verify-worktree.js +4 -4
  68. package/core/dev/scripts/verify-target-dir.js +6 -6
  69. package/core/plugins/kenaz/INVENTORY.md +8 -8
  70. package/core/plugins/kenaz/commands/architect.md +1 -2
  71. package/core/plugins/kenaz/commands/spec.md +1 -1
  72. package/core/plugins/kenaz/commands//347/224/242/345/223/201.md +1 -1
  73. package/core/plugins/kenaz/guidance.md +1 -1
  74. package/core/plugins/kenaz/scripts/sync.js +1 -1
  75. package/core/plugins/kenaz/scripts/ygg.js +6 -0
  76. package/core/plugins/kenaz/skills/architect_agent/SKILL.md +11 -92
  77. package/core/plugins/kenaz/skills/assessment_agent/SKILL.md +0 -1
  78. package/core/plugins/kenaz/skills/backend_engineer/SKILL.md +3 -6
  79. package/core/plugins/kenaz/skills/code_reviewer/SKILL.md +1 -1
  80. package/core/plugins/kenaz/skills/code_reviewer/patterns.yaml +1 -1
  81. package/core/plugins/kenaz/skills/designer/SKILL.md +3 -6
  82. package/core/plugins/kenaz/skills/dev_agent/SKILL.md +30 -491
  83. package/core/plugins/kenaz/skills/developer/SKILL.md +3 -6
  84. package/core/plugins/kenaz/skills/feature_agent/SKILL.md +3 -17
  85. package/core/plugins/kenaz/skills/product_manager/SKILL.md +29 -1064
  86. package/core/plugins/kenaz/skills/qa_engineer/SKILL.md +12 -17
  87. package/core/plugins/kenaz/skills/spec_optimizer/SKILL.md +25 -275
  88. package/core/plugins/kenaz/skills/sre_agent/SKILL.md +3 -6
  89. package/package.json +6 -6
  90. package/core/.claude/commands/archive.md +0 -24
  91. package/core/.claude/commands/init.md +0 -112
  92. package/core/.claude/commands/legacy_dev.md +0 -18
  93. package/core/.claude/commands/product-review.md +0 -131
  94. package/core/.claude/commands/strategy.md +0 -141
  95. package/core/.claude/commands/sunny.md +0 -1
  96. package/core/.claude/commands//347/224/242/345/223/201/346/252/242/350/246/226.md +0 -129
  97. package/core/.claude/commands//351/200/262/345/272/246.md +0 -15
  98. package/core/.claude/hooks/__tests__/substrate.test.js +0 -122
  99. package/core/.claude/hooks/_substrate-paths.js +0 -95
  100. package/core/.claude/hooks/context-check.js +0 -51
  101. package/core/.claude/hooks/fatigue-check.js +0 -52
  102. package/core/.claude/hooks/handoff-snapshot-on-commit.js +0 -154
  103. package/core/.claude/hooks/handoff-snapshot-on-question.js +0 -158
  104. package/core/.claude/hooks/handoff-staleness.js +0 -197
  105. package/core/.claude/hooks/jev-thalamus-context.js +0 -17
  106. package/core/.claude/hooks/jev-thalamus-context.test.js +0 -41
  107. package/core/.claude/hooks/lease-release.js +0 -119
  108. package/core/.claude/hooks/lease-touch.js +0 -96
  109. package/core/.claude/hooks/reflex-feedback.js +0 -5
  110. package/core/.claude/hooks/session-init.ps1 +0 -49
  111. package/core/.claude/hooks/sound-event.js +0 -70
  112. package/core/.claude/hooks/sound-event.sh +0 -37
  113. package/core/.claude/hooks/stream-delta.js +0 -169
  114. package/core/.claude/no-hooks.settings.json +0 -3
  115. package/core/.claude/skills/legacy_dev/SKILL.md +0 -202
  116. package/core/.claude/skills/sunny/SKILL.md +0 -74
  117. package/core/.collaboration/cli/commands/assign.js +0 -39
  118. package/core/.collaboration/cli/commands/claim.js +0 -33
  119. package/core/.collaboration/cli/commands/complete.js +0 -44
  120. package/core/.collaboration/cli/commands/create.js +0 -110
  121. package/core/.collaboration/cli/commands/get.js +0 -83
  122. package/core/.collaboration/cli/commands/index.js +0 -52
  123. package/core/.collaboration/cli/commands/list.js +0 -51
  124. package/core/.collaboration/cli/commands/lock.js +0 -45
  125. package/core/.collaboration/cli/commands/rebuild.js +0 -39
  126. package/core/.collaboration/cli/commands/search.js +0 -61
  127. package/core/.collaboration/cli/commands/stats.js +0 -61
  128. package/core/.collaboration/cli/commands/transfer.js +0 -41
  129. package/core/.collaboration/cli/commands/unlock.js +0 -48
  130. package/core/.collaboration/cli/formatters/help-formatter.js +0 -70
  131. package/core/.collaboration/cli/formatters/index.js +0 -7
  132. package/core/.collaboration/cli/task-cli.js +0 -46
  133. package/core/.collaboration/cli/utils/arg-parser.js +0 -74
  134. package/core/.collaboration/cli/utils/git-user.js +0 -25
  135. package/core/.collaboration/cli/utils/index.js +0 -9
  136. package/core/.collaboration/cli/utils/output.js +0 -10
  137. package/core/.collaboration/config/default.yaml +0 -189
  138. package/core/.collaboration/core/conflict-resolver.js +0 -461
  139. package/core/.collaboration/core/conflict-resolver.test.js +0 -389
  140. package/core/.collaboration/core/migrate-legacy.js +0 -260
  141. package/core/.collaboration/docs/API.md +0 -787
  142. package/core/.collaboration/docs/ARCHITECTURE.md +0 -596
  143. package/core/.collaboration/docs/FAQ.md +0 -695
  144. package/core/.collaboration/docs/MIGRATION.md +0 -804
  145. package/core/.collaboration/docs/examples/README.md +0 -320
  146. package/core/.collaboration/docs/examples/advanced-queries.js +0 -261
  147. package/core/.collaboration/docs/examples/basic-usage.js +0 -184
  148. package/core/.collaboration/docs/examples/team-workflow.js +0 -352
  149. package/core/.failure/agent-execution/FAIL-001-agent-no-output.yaml +0 -391
  150. package/core/.failure/agent-execution/FAIL-007-pm-lead-wrong-team-invocation.yaml +0 -0
  151. package/core/.failure/agent-execution/FAIL-010-phase0-poem-format-skipped.yaml +0 -28
  152. package/core/.failure/agent-execution/FAIL-010-skipping-cognitive-checkpoint-after-verification.yaml +0 -59
  153. package/core/.failure/agent-execution/FAIL-012-grep-shortcut-during-investigation.yaml +0 -85
  154. package/core/.failure/architecture/FAIL-006-python-version-compatibility.yaml +0 -445
  155. package/core/.failure/pipeline/FAIL-003-queue-pollution.yaml +0 -335
  156. package/core/.failure/pipeline/README.md +0 -95
  157. package/core/.failure/retired/FAIL-009-skipping-synapse-pulse-before-code-change.yaml +0 -49
  158. package/core/.failure/tools/USAGE_GUIDE.md +0 -323
  159. package/core/.failure/tools/check_failures.ps1 +0 -387
  160. package/core/.failure/tools/log_failure.ps1 +0 -474
  161. package/core/.formation/.episode-input.json +0 -10
  162. package/core/.formation/.merge-lock +0 -1
  163. package/core/.formation/lead.yaml +0 -118
  164. package/core/.formation/legacy.bak/designer.yaml +0 -57
  165. package/core/.formation/legacy.bak/pm.yaml +0 -57
  166. package/core/.formation/legacy.bak/qa.yaml +0 -57
  167. package/core/.formation/legacy.bak/review.yaml +0 -62
  168. package/core/.formation/legacy.bak/scheduler.yaml +0 -129
  169. package/core/.formation/legacy.bak/sre.yaml +0 -57
  170. package/core/.formation/role-map.yaml +0 -274
  171. package/core/.formation/roles/_shared/modules/code_review.yaml +0 -98
  172. package/core/.formation/roles/_shared/modules/security.yaml +0 -103
  173. package/core/.formation/roles/_shared/modules/testing.yaml +0 -14
  174. package/core/.formation/roles/backend/role.yaml +0 -93
  175. package/core/.formation/roles/code_reviewer/role.yaml +0 -102
  176. package/core/.formation/roles/database_optimizer/role.yaml +0 -107
  177. package/core/.formation/roles/designer/role.yaml +0 -66
  178. package/core/.formation/roles/developer/role.yaml +0 -75
  179. package/core/.formation/roles/frontend/role.yaml +0 -134
  180. package/core/.formation/roles/incident_response/role.yaml +0 -89
  181. package/core/.formation/roles/qa/role.yaml +0 -89
  182. package/core/.formation/roles/security/role.yaml +0 -87
  183. package/core/.formation/roles/sre/role.yaml +0 -66
  184. package/core/.formation/skills/coordinator.yaml +0 -52
  185. package/core/.formation/solo/diagnosis.yaml +0 -78
  186. package/core/.formation/solo/strategy.yaml +0 -121
  187. package/core/.formation/tests/hello.txt +0 -2
  188. package/core/.formation/tools/coordinator.js +0 -350
  189. package/core/.formation/tools/jev-correction.js +0 -214
  190. package/core/.formation/tools/jev-correction.test.js +0 -178
  191. package/core/.formation/tools/log-reader.js +0 -232
  192. package/core/.formation/tools/revert-daemon-state.js +0 -162
  193. package/core/.formation/tools/test-drift.js +0 -148
  194. package/core/.formation/unit/heimdall.yaml +0 -96
  195. package/core/.formation/unit/plan.yaml +0 -67
  196. package/core/.formation/unit/think.yaml +0 -58
  197. package/core/.kenaz/MUNINN_SNAPSHOT9_EPISODE.json +0 -32
  198. package/core/.kenaz/MUNINN_SNAPSHOT9_RUNE.json +0 -23
  199. package/core/.kenaz/MUNINN_SNAPSHOT9_SUMMARY.md +0 -89
  200. package/core/.kenaz/ash_TASK_1428-20260507.json +0 -14
  201. package/core/.kenaz/muninn_episode_write.ps1 +0 -17
  202. package/core/.kenaz/muninn_snapshot11_rune_candidates.md +0 -63
  203. package/core/.kenaz/muninn_snapshot1_rune_candidates.md +0 -49
  204. package/core/.kenaz/runes_TASK_1428.json +0 -57
  205. package/core/.kenaz/tmp_heimdall_proposal_8d3e392.json +0 -13
  206. package/core/.kenaz/tmp_props.json +0 -1
  207. package/core/.kenaz/tmp_sounddrop_t1_prompt.txt +0 -371
  208. package/core/.rule/MECHANIZED.md +0 -61
  209. package/core/.rule/general/cortex-memory-recall.yaml +0 -446
  210. package/core/.rule/general/pipeline.yaml +0 -246
  211. package/core/.rule/general/sunny-access-control.yaml +0 -60
  212. package/core/.rule/general/system-invariants.yaml +0 -231
  213. package/core/.rule/pipeline/PPL-002-completed-task-archival.yaml +0 -528
  214. package/core/.rule/pipeline/auto-update.yaml +0 -282
  215. package/core/.rule/pipeline/task-execution.yaml +0 -365
  216. package/core/.specialist/Ansuz/concepts/phase_protocol.yaml +0 -65
  217. package/core/.specialist/Ansuz/experiments/boot_ablation_replay.js +0 -197
  218. package/core/.specialist/Ansuz/tools/bootstrap-anchors.js +0 -289
  219. package/core/.specialist/Ansuz/workflow.yaml +0 -1225
  220. package/core/.specialist/experiments/rg_benchmark.js +0 -523
  221. package/core/.specialist/experiments/rg_benchmark_results.json +0 -27
  222. package/core/.specialist/tools/jev-optional-context.js +0 -107
  223. package/core/.specialist/tools/jev-optional-context.test.js +0 -152
  224. package/core/.specialist/tools/memory-action-log.js +0 -839
  225. package/core/.specialist/tools/phase-gate.js +0 -3534
  226. package/core/.specialist/tools/phase-gate.test.js +0 -85
  227. package/core/.specialist/tools/precompute-runner.js +0 -444
  228. package/core/.specialist/tools/rule-engine.js +0 -621
  229. package/core/.specialist/tools/task-bridge-jev.test.js +0 -170
  230. package/core/.synapse/memory-shared.json.sync +0 -1
  231. package/core/.system/agent-skills/README.md +0 -724
  232. package/core/.system/cli-tools/README.md +0 -724
  233. package/core/.system/cortex/MODULES.md +0 -1046
  234. package/core/.system/dashboard/FRONTEND.md +0 -812
  235. package/core/.system/dashboard/README.md +0 -737
  236. package/core/.system/failure/README.md +0 -723
  237. package/core/.system/formation/LEGACY_SKILLS.md +0 -974
  238. package/core/.system/formation/POST_COMPLETE.md +0 -602
  239. package/core/.system/formation/README.md +0 -1094
  240. package/core/.system/formation/TOOLS_REFERENCE.md +0 -1145
  241. package/core/.system/kenaz/README.md +0 -787
  242. package/core/.system/memory/README.md +0 -719
  243. package/core/.system/pipeline/README.md +0 -712
  244. package/core/.system/rule/README.md +0 -794
  245. package/core/.system/sunny/README.md +0 -476
  246. package/core/.system/sunny/RULES.json +0 -89
  247. package/core/.system/sunny/knowledge/INDEX.md +0 -37
  248. package/core/.system/sunny/knowledge/agent-teams-api.md +0 -0
  249. package/core/.system/sunny/knowledge/ansuz-specialist.md +0 -500
  250. package/core/.system/sunny/knowledge/claude-cli-spawn.md +0 -177
  251. package/core/.system/sunny/knowledge/collaboration-api.md +0 -925
  252. package/core/.system/sunny/teammates/README.md +0 -107
  253. package/core/.system/sunny/teammates/how_to_use.yaml +0 -101
  254. package/core/.system/sunny/teammates/tools/headless/launcher.js +0 -318
  255. package/core/.system/sunny/teammates/tools/powershell/launcher.js +0 -241
  256. package/core/.system/sunny/teammates/tools/powershell/start.bat +0 -50
  257. package/core/.system/sunny/teammates/tools/utils/env.js +0 -96
  258. package/core/.system/sunny/teammates/tools/utils/format-output.js +0 -329
  259. package/core/.system/sunny/tools.json +0 -101
  260. package/core/dev/scripts/cleanup-queue.js +0 -184
  261. package/core/dev/scripts/cleanup_queue.js +0 -86
  262. package/core/dev/scripts/legacy/README.md +0 -39
  263. package/core/dev/scripts/legacy/dev_agent_scheduler.ps1.bak +0 -536
  264. package/core/dev/scripts/legacy/multi_agent_scheduler.ps1.bak +0 -1978
  265. package/core/dev/scripts/matrix/CLI_README.md +0 -214
  266. package/core/dev/scripts/matrix/README.md +0 -310
  267. package/core/dev/scripts/matrix/package-lock.json +0 -4266
  268. package/core/dev/scripts/matrix/package.json +0 -55
  269. package/core/dev/scripts/matrix/src/abbreviations.ts +0 -295
  270. package/core/dev/scripts/matrix/src/cli/commands/convert.ts +0 -211
  271. package/core/dev/scripts/matrix/src/cli/commands/create.ts +0 -95
  272. package/core/dev/scripts/matrix/src/cli/commands/delete.ts +0 -102
  273. package/core/dev/scripts/matrix/src/cli/commands/list-tags.ts.wip +0 -140
  274. package/core/dev/scripts/matrix/src/cli/commands/manage-tags.ts.wip +0 -173
  275. package/core/dev/scripts/matrix/src/cli/commands/query.ts +0 -261
  276. package/core/dev/scripts/matrix/src/cli/commands/read.ts +0 -77
  277. package/core/dev/scripts/matrix/src/cli/commands/stats.ts.wip +0 -168
  278. package/core/dev/scripts/matrix/src/cli/commands/tokens.ts.wip +0 -126
  279. package/core/dev/scripts/matrix/src/cli/commands/update.ts +0 -147
  280. package/core/dev/scripts/matrix/src/cli/commands/validate.ts +0 -275
  281. package/core/dev/scripts/matrix/src/cli/index.ts +0 -350
  282. package/core/dev/scripts/matrix/src/cli/utils/file-handler.ts +0 -72
  283. package/core/dev/scripts/matrix/src/cli/utils/logger.ts +0 -65
  284. package/core/dev/scripts/matrix/src/index.ts +0 -62
  285. package/core/dev/scripts/matrix/src/indexer/tag-indexer.ts +0 -165
  286. package/core/dev/scripts/matrix/src/parser.ts +0 -281
  287. package/core/dev/scripts/matrix/src/serializer.ts +0 -151
  288. package/core/dev/scripts/matrix/src/validator.ts +0 -301
  289. package/core/dev/scripts/matrix/tests/abbreviations.test.ts +0 -122
  290. package/core/dev/scripts/matrix/tests/cli.test.ts +0 -177
  291. package/core/dev/scripts/matrix/tests/convert.test.ts +0 -143
  292. package/core/dev/scripts/matrix/tests/parser.test.ts +0 -203
  293. package/core/dev/scripts/matrix/tests/query.test.ts +0 -85
  294. package/core/dev/scripts/matrix/tests/serializer.test.ts +0 -197
  295. package/core/dev/scripts/matrix/tests/validate.test.ts +0 -141
  296. package/core/dev/scripts/matrix/tests/validator.test.ts +0 -167
  297. package/core/dev/scripts/matrix/tsconfig.json +0 -20
  298. package/core/dev/scripts/matrix/types/index.d.ts +0 -111
  299. package/core/dev/scripts/matrix/types/index.d.ts.map +0 -1
  300. package/core/dev/scripts/matrix/types/index.js +0 -8
  301. package/core/dev/scripts/matrix/types/index.js.map +0 -1
  302. package/core/dev/scripts/matrix/types/index.ts +0 -124
  303. package/core/dev/scripts/memory-usage-report.js +0 -152
  304. package/core/dev/scripts/probe/ansuz-scaffold-ablation.js +0 -579
  305. package/core/dev/scripts/probe/ansuz-scaffold-ablation.test.js +0 -244
  306. package/core/dev/scripts/probe/hook-latency-probe.js +0 -315
  307. package/core/dev/scripts/probe/hook-latency-probe.test.js +0 -105
  308. package/core/dev/scripts/probe/prediction-signal-auc.js +0 -483
  309. package/core/dev/scripts/probe/prediction-signal-auc.test.js +0 -200
  310. package/core/dev/scripts/test-pty-ws-tunnel.js +0 -229
  311. package/core/dev/scripts/validate_pipeline.js +0 -197
  312. package/core/dev/spikes/task2145-evidence-20261004/backend-log-excerpt.txt +0 -56
  313. package/core/dev/spikes/task2145-evidence-20261004/graph.shadow +0 -0
  314. package/core/dev/spikes/task2145-evidence-20261004/graph.wal +0 -0
  315. package/core/dev/spikes/task2145-evidence-20261004/graph_corrupt_suspect.marker +0 -1
  316. package/core/plugins/kenaz/commands/strategy.md +0 -141
@@ -1,88 +1,6 @@
1
- name: Ansuz Workflow Engine
2
- version: "4.0.0"
3
- description: "phase-gated 全生命週期 — 12 Phase 從需求到完成(phase-gate.js 驅動)"
4
- # Phase 詳細定義見 dev/archive/ansuz/legacy/phases/phase_N.yaml(由 phase-gate.js 分階段注入)
5
-
6
- model: "phase-gated"
7
-
8
- # ═══════════════════════════════════════
9
- # 執行模型:Phase Gate 強制檢查點
10
- # ═══════════════════════════════════════
11
- execution_model:
12
- path: ".specialist/tools/phase-gate.js"
13
- commands:
14
- enter: "Bash: node .specialist/tools/phase-gate.js enter --phase=N --task=TASK_XXX"
15
- enter_phase0: "Bash: node .specialist/tools/phase-gate.js enter --phase=0 --specialist=ansuz(Phase 0 不需要 --task)"
16
- exit: "Bash: node .specialist/tools/phase-gate.js exit --phase=N --task=TASK_XXX --data='{...}'"
17
- exit_phase0: "Bash: node .specialist/tools/phase-gate.js exit --phase=0 --data='{\"episodes_checked\":true,\"poem_displayed\":true,\"session_handoff_loaded\":false}'"
18
- status: "Bash: node .specialist/tools/phase-gate.js status --task=TASK_XXX"
19
- rules:
20
- - "Phase 開始前:enter → 閱讀 checklist + 模組注入內容(模組由系統決定,非 Agent 判斷)"
21
- - "Phase 0 特殊:enter --phase=0 --specialist=ansuz(無 --task)→ 自動召回 3 個 episodic memory + 注入 phase_0.yaml 指令"
22
- - "Phase 完成後:exit + data(Phase 0: episodes_checked=true;Phase 1: ddx_hypotheses;Phase 9: cognitive_checkpoint object)"
23
- - "exit 返回 blocked → 完成 checklist 後重試,不可跳過"
24
- - "max_parallel_dispatch: 5 | ❌ 不 merge main | task-first | FIX 後立即 dispatch"
25
- - |
26
- ⚠️ COMPLETION TRACKING(Phase 8→11 自動閉環):
27
- dispatch 後 ❌ 禁止輸出任何中斷性問題(「還要做其他事嗎?」「要追蹤嗎?」)
28
- ✅ 靜默等背景通知 → 通知到達自動執行:branch guard → Phase 9 驗證 → Phase 10 post-complete
29
- ✅ 多任務時按依賴順序迴圈 dispatch,全部完成才進 Phase 11 回報
30
- Phase 11 是唯一可以問用戶下一步的地方
31
- compression: "簡單需求(單任務/明確目標)→ Phase 1-6 壓縮(TASK_584);壓縮後仍需用戶批准"
32
-
33
- # ═══════════════════════════════════════
34
- # Phase 序列地圖(Agent 的全局流程圖)
35
- # ═══════════════════════════════════════
36
- # stop = 必須等用戶確認;auto = 靜默執行
37
- # 詳細 actions/cli_format/checklist 見 phases/phase_N.yaml(phase-gate enter 時自動注入)
38
- phase_sequence:
39
- - phase: 0 # auto
40
- name: "初始化"
41
- io: "session start → project context + task stats"
42
- - phase: 1 # stop
43
- name: "需求理解"
44
- io: "用戶需求 → requirement_type + priority + summary(等用戶確認)"
45
- - phase: 2 # auto
46
- name: "背景調研"
47
- io: "phase_1: type+priority+summary → EFE-ranked targets + pulse_targets + scope_paths + known_risks"
48
- - phase: 3 # stop
49
- name: "任務設計"
50
- io: "phase_2: pulse_targets + scope_paths + known_risks → task_breakdown + phantom_ids(等確認)"
51
- - phase: 4 # auto
52
- name: "規格撰寫"
53
- io: "phase_3: task_list + roles + dependencies → task_yaml_specs"
54
- - phase: 5 # auto
55
- name: "驗證"
56
- io: "phase_4: task_yaml_specs → validation_results(pass/fail per task)"
57
- - phase: 6 # stop
58
- name: "用戶批准"
59
- io: "phase_5: validated_specs → approval(等批准建立任務卡)"
60
- - phase: 7 # auto
61
- name: "任務建立"
62
- io: "phase_6: approved_specs → task_ids(in backlog)"
63
- - phase: 8 # auto
64
- name: "陣型 + Dispatch"
65
- io: "phase_7: task_ids + formation_choice → 直接 dispatch(不等用戶確認)"
66
- - phase: 9 # auto
67
- name: "結果驗證"
68
- io: "phase_8: dispatched_tasks → verify_results + cognitive_checkpoint"
69
- - phase: 10 # auto
70
- name: "Post-Complete"
71
- io: "phase_9: completed_task_ids → archive done + git merged"
72
- - phase: 11 # stop
73
- name: "回報"
74
- io: "phase_10: all_results → final_report(問用戶下一步)"
75
-
76
- # ═══════════════════════════════════════
77
- # 事件觸發器
78
- # ═══════════════════════════════════════
79
- triggers:
80
- user_request: "用戶給需求 → Phase 1~6 → 任務建立"
81
- task_ready: "Phase 6 用戶批准建立任務卡 → Phase 7~8 自動執行 → dispatch"
82
- result_arrived: "agent 回報 → Phase 9 → 驗證通過 → Phase 10 | 驗證失敗 → 建 FIX → Phase 8(FIX) 迴圈"
83
- error_occurred: "失敗 → 分析根因 → 重派 | 建 FIX 並 dispatch | 換策略 | 升級"
84
- conflict_detected: "兩個結果矛盾 → 交叉驗證原始碼 | 問用戶"
85
- qa_issue_received: "QA 缺陷報告 → 懶載入 modules/qa_intake.yaml → Phase 1"
1
+ name: Ansuz Support Definitions
2
+ version: "5.0.0"
3
+ description: "優先級、Feature ID、失敗整合、效率原則與進階模組目錄。12-Phase phase-gate 生命週期已移除(2026-07 起未使用);現行啟動與流程見 elixir.yaml 與 RULES.md。"
86
4
 
87
5
  # ═══════════════════════════════════════
88
6
  # 支援定義
@@ -102,7 +20,7 @@ feature_id:
102
20
  qa: "source: 'QA Issue Report: QA_ISSUES_<timestamp>.md'"
103
21
 
104
22
  failure_integration:
105
- when: "Phase 0 + Phase 2 + Phase 9 失敗時 + Phase 9 預防分析時"
23
+ when: "任務失敗時、調研階段、驗證階段、預防分析時"
106
24
  check: "讀 .failure/INDEX.yaml — 搜尋相關失敗模式"
107
25
  learn: "新失敗發生時 → 記錄到 .failure/ 避免重複"
108
26
 
@@ -111,10 +29,8 @@ efficiency:
111
29
  - "✅ 輕量工作自己做(Glob/Grep/Read/單檔 Edit)"
112
30
  - "✅ 一個 message 能發多少 Bash(background) 就發多少"
113
31
  - "✅ 結果到了立即處理 — 不等齊再動"
114
- - "✅ Phase 1-6 可壓縮 — 簡單需求快速走完"
115
32
  dont:
116
33
  - "❌ 不為開 agent 而開 agent"
117
- - "❌ 不用 Task tool subagent 繞過 Formation"
118
34
 
119
35
  task_first:
120
36
  rule: "預設先建立任務,再 dispatch。極簡任務(單檔 < 20 行,意圖明確)才可直接執行。"
@@ -125,7 +41,7 @@ task_first:
125
41
  # ═══════════════════════════════════════
126
42
  module_registry:
127
43
  description: |
128
- 進階能力模組。核心迴圈(Phase 0-11)在觸發條件成立時,
44
+ 進階能力模組。在觸發條件成立時,
129
45
  用 Read tool 懶載入對應模組,再執行其中的 protocol。
130
46
  模組不在 rule.yaml files 清單中,不會被自動載入。
131
47
 
@@ -170,16 +86,6 @@ module_registry:
170
86
  - "例外:backlog 超過 7 天 → 輕量 feasibility check(只驗 scope_paths 存在性)"
171
87
  phases: [3.5]
172
88
 
173
- phantom_declaration:
174
- path: "dev/archive/ansuz/legacy/phases/phase_3.yaml"
175
- description: "phase_3.yaml 內建 — 設計階段自動宣告 phantom symbol,實現設計先於實作的爆炸半徑預覽"
176
- trigger:
177
- - "Phase 3 任務設計時,requirements 包含 add|create|implement|new|introduce 關鍵字"
178
- skip_conditions:
179
- - "需求為純 bug-fix / refactor / optimize(僅修改現有 symbol)→ phantoms_declared: skipped"
180
- output: "phantom_ids 寫入 task YAML technical_notes([PHANTOM] symbol_id_1, symbol_id_2)"
181
- phases: [3]
182
-
183
89
  pulse_empty:
184
90
  path: ".specialist/Ansuz/modules/pulse_empty.yaml"
185
91
  trigger:
@@ -207,15 +113,7 @@ module_registry:
207
113
  phases: [11]
208
114
  command: "node {CORE}/.specialist/tools/verify-identity.js --task=TASK_XXX [--project-path=PATH]"
209
115
 
210
- # Phase Gate 系統管理模組(由 phase-gate.js 自動注入,路徑需與 MODULE_PATHS 一致)
211
- phase_gate_modules:
212
- description: "phase-gate.js 在 Phase 邊界自動注入的模組。路徑與 phase-gate.js MODULE_PATHS 保持同步。"
213
- # cognitive_checkpoint / research module files were never written (TASK_576); retired 2026-09-23.
214
- prevention:
215
- path: ".specialist/Ansuz/modules/prevention.yaml"
216
- auto_inject: "(context-driven:P0/P1 任務或 fix/regression)"
217
-
218
116
  lazy_load_instruction: |
219
117
  觸發條件成立時,執行:
220
118
  Read tool → path(模組路徑)→ 閱讀並應用模組中的 protocol
221
- 模組是補充指令,不替換核心 Phase 的基本流程。
119
+ 模組是補充指令,不替換 elixir.yaml 的基本流程。
@@ -62,9 +62,6 @@ guards:
62
62
  acted_on_count: 1
63
63
  acted_on_sessions:
64
64
  - "TASK_1076_TEST"
65
- precompute:
66
- cmd: gitLogShort
67
- file: .specialist/tools/phase-gate.js
68
65
  injection_count: 14
69
66
 
70
67
  L-003:
@@ -350,7 +350,6 @@ cross_model:
350
350
 
351
351
  continuity_test:
352
352
  - "Run: grep -c 'name: \"Ansuz' dev/archive/ansuz/legacy/kernel.yaml — expect >= 1"
353
- - "Run: node .specialist/tools/phase-gate.js enter --phase=0 --specialist=ansuz — must not error"
354
353
  - "Run: node .collaboration/core/task-api.js list — must return valid JSON"
355
354
  - "Run: grep -c 'immutable_hash' .kenaz/specialist/ansuz_rules.yaml — expect >= 11"
356
355
  - "Behavioral: first response after Phase 0 must use AskUserQuestion for any user choice"
@@ -106,10 +106,6 @@ agent_types:
106
106
  backend:
107
107
  skill_path: ".claude/skills/backend_engineer/SKILL.md"
108
108
  scope: "API 設計、資料庫 Schema、後端業務邏輯、錯誤韌性"
109
- database_optimizer:
110
- skill_path: ".formation/roles/database_optimizer/role.yaml"
111
- scope: "查詢效能優化、索引策略、N+1 修復、零停機遷移、RLS 效能評估"
112
- type: "role_only" # 無獨立 skill,由 role.yaml 驅動
113
109
  qa:
114
110
  skill_path: ".claude/skills/qa_engineer/SKILL.md"
115
111
  scope: "測試策略、單元測試、Bug 驗證"
@@ -23,7 +23,6 @@ kernel_file: dev/archive/ansuz/legacy/kernel.yaml
23
23
 
24
24
  boot_rules:
25
25
  - principles.yaml
26
- - sunny-access-control.yaml
27
26
  - cross-platform.yaml
28
27
  - project-self-containment.yaml
29
28
 
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * handoff-session-identity.test.js — TASK_1982
4
4
  *
5
- * handoff-staleness.js (the hook) and ansuz-handoff-snapshot.js (the writer)
5
+ * the retired handoff-staleness hook and ansuz-handoff-snapshot.js (the writer)
6
6
  * used to disagree on the per-session slot name: the hook's #1 candidate is
7
7
  * the Claude Code conversation id (hook-stdin payload.session_id), while the
8
8
  * writer minted a fresh ansuz-prompt-<ts> slot on every MCP-tool call that had
@@ -14,7 +14,7 @@
14
14
  * liveness) when no explicit --session-id is given, landing on the same slot
15
15
  * name the hook looks for first.
16
16
  *
17
- * These tests run the REAL hook and REAL writer as child processes (the
17
+ * These tests run the REAL writer as child processes (the
18
18
  * defect path, not a re-implementation of it) against a throwaway fixture
19
19
  * project.
20
20
  */
@@ -31,7 +31,6 @@ const WRITER_SRC = path.join(HERE, 'ansuz-handoff-snapshot.js');
31
31
  const RESOLVER_SRC = path.join(HERE, 'handoff-resolver.js');
32
32
  const PROJECT_RESOLVER_SRC = path.join(REPO_ROOT, '.specialist', 'tools', 'lib', 'project-resolver.js');
33
33
  const STREAM_LEASE_SRC = path.join(REPO_ROOT, '.specialist', 'tools', 'stream-lease.js');
34
- const HOOK_STALENESS = path.join(REPO_ROOT, '.claude', 'hooks', 'handoff-staleness.js');
35
34
 
36
35
  function mkProject() {
37
36
  const proj = fs.mkdtempSync(path.join(os.tmpdir(), 'task1982-'));
@@ -76,29 +75,6 @@ function writeSession(proj, sid) {
76
75
  );
77
76
  }
78
77
 
79
- function writeBrief(proj, name, mtimeMs) {
80
- const fp = path.join(proj, '.kenaz', 'specialist', name);
81
- fs.writeFileSync(fp, 'dispatch brief fixture');
82
- fs.utimesSync(fp, new Date(mtimeMs), new Date(mtimeMs));
83
- return fp;
84
- }
85
-
86
- function makeStaleSlot(proj, sid, ageMs) {
87
- fs.writeFileSync(path.join(proj, '.kenaz', 'specialist', 'handoffs', sid + '.json'), JSON.stringify({
88
- schema_version: 1,
89
- session_id: sid,
90
- triggered_by: 'manual',
91
- generated_at: new Date(Date.now() - ageMs).toISOString(),
92
- isbar: {
93
- identification: { session_id: sid, fatigue_potential: 0, context_size_kb: 0 },
94
- situation: { current_topic: 'fixture topic', pending_decisions: ['(none)'] },
95
- background: { key_decisions: ['kd'], user_intent: 'fixture' },
96
- assessment: { why_handing_off: 'fixture', unfinished: [] },
97
- recommendation: { first_action: 'fixture action', context_to_restore: 'fixture ctx' },
98
- },
99
- }, null, 2));
100
- }
101
-
102
78
  function runNode(script, args, env) {
103
79
  const r = spawnSync(process.execPath, [script].concat(args || []), {
104
80
  input: '',
@@ -110,29 +86,12 @@ function runNode(script, args, env) {
110
86
  return { out: r.stdout || '', err: r.stderr || '', status: r.status };
111
87
  }
112
88
 
113
- function runHook(proj, payload) {
114
- const r = spawnSync(process.execPath, [HOOK_STALENESS], {
115
- input: JSON.stringify(payload),
116
- env: Object.assign({}, process.env, { CLAUDE_PROJECT_DIR: proj }),
117
- encoding: 'utf8',
118
- timeout: 30000,
119
- windowsHide: true,
120
- });
121
- return { out: r.stdout || '', err: r.stderr || '', status: r.status };
122
- }
123
-
124
89
  // Transcript lines shaped like Claude Code's JSONL. The hook only nags in an
125
90
  // Ansuz conversation, decided from USER-role text (see _ansuz-conversation.js).
126
91
  const ANSUZ_USER_LINE = JSON.stringify({
127
92
  type: 'user',
128
93
  message: { role: 'user', content: '<command-message>Ansuz</command-message>\n<command-name>/Ansuz</command-name>' },
129
94
  });
130
- const PLAIN_USER_LINE = JSON.stringify({ type: 'user', message: { role: 'user', content: 'port 18383 is in use' } });
131
- // This conversation's own dispatch of TASK_TEST (a dispatch counts only when
132
- // the conversation's tool calls name its task id).
133
- const DISPATCH_TOOL_LINE = JSON.stringify({ type: 'assistant', message: { role: 'assistant', content: [
134
- { type: 'tool_use', name: 'Bash', input: { command: 'node .formation/tools/dispatch.js --task=TASK_TEST --dispatch-mode=subagent' } },
135
- ] } });
136
95
 
137
96
  function writeTranscript(proj, lines) {
138
97
  const fp = path.join(proj, 'transcript.jsonl');
@@ -140,14 +99,6 @@ function writeTranscript(proj, lines) {
140
99
  return fp;
141
100
  }
142
101
 
143
- function staleNagSetup(tag) {
144
- const proj = mkProject();
145
- const convId = 'conv-gate-' + tag;
146
- makeStaleSlot(proj, convId, 20 * 60 * 1000);
147
- writeSession(proj, convId);
148
- return { proj, convId };
149
- }
150
-
151
102
  function handoffSlots(proj) {
152
103
  return fs.readdirSync(path.join(proj, '.kenaz', 'specialist', 'handoffs')).filter((f) => f.endsWith('.json'));
153
104
  }
@@ -190,108 +141,13 @@ test('two snapshots in the same session update the same slot file, not two', ()
190
141
  );
191
142
  });
192
143
 
193
- test('(a) hook sees a fresh slot written by the real snapshot code path -> no nag', () => {
194
- const proj = mkProject();
195
- const convId = 'conv-task1982-c';
196
- writeCurrentStream(proj, 'boot-task1982-c', convId);
197
- writeSession(proj, convId);
198
- const writerCli = path.join(proj, '.specialist', 'Ansuz', 'tools', 'ansuz-handoff-snapshot.js');
199
-
200
- const r = runNode(writerCli, [`--trigger=manual`, `--project-path=${proj}`], { CLAUDE_PROJECT_DIR: proj });
201
- assert.match(r.out, /handoff written/, `expected a write, got: ${r.out}${r.err}`);
202
-
203
- const transcript = writeTranscript(proj, [ANSUZ_USER_LINE, DISPATCH_TOOL_LINE]);
204
- writeBrief(proj, 'dispatch_prompt_TASK_TEST.md', Date.now() + 2000); // dispatched after conv start
205
-
206
- const hookResult = runHook(proj, { session_id: convId, transcript_path: transcript });
207
- assert.equal(hookResult.out.trim(), '', `expected silence (no nag), got: ${hookResult.out}`);
208
- });
209
-
210
- test('(b) hook sees a stale slot -> nag', () => {
211
- const proj = mkProject();
212
- const convId = 'conv-task1982-d';
213
- makeStaleSlot(proj, convId, 20 * 60 * 1000); // 20min > HANDOFF_STALE_AFTER_MS (5min)
214
- writeSession(proj, convId);
215
-
216
- const transcript = writeTranscript(proj, [ANSUZ_USER_LINE, DISPATCH_TOOL_LINE]);
217
- writeBrief(proj, 'dispatch_prompt_TASK_TEST.md', Date.now() + 2000);
218
-
219
- const hookResult = runHook(proj, { session_id: convId, transcript_path: transcript });
220
- assert.match(hookResult.out, /ISBAR handoff stale/, `expected a stale nag, got: ${hookResult.out}`);
221
- });
222
-
223
- test('(c) non-Ansuz conversation with a stale slot and a fresh brief -> no nag', () => {
224
- const { proj, convId } = staleNagSetup('c');
225
- const transcript = writeTranscript(proj, [PLAIN_USER_LINE, DISPATCH_TOOL_LINE]);
226
- writeBrief(proj, 'dispatch_prompt_TASK_TEST.md', Date.now() + 2000);
227
- const r = runHook(proj, { session_id: convId, transcript_path: transcript });
228
- assert.equal(r.out.trim(), '', `expected silence outside Ansuz, got: ${r.out}`);
229
- });
230
-
231
- test('(d) dispatch_prompt_stats.jsonl alone is not a dispatch -> no nag', () => {
232
- const { proj, convId } = staleNagSetup('d');
233
- const transcript = writeTranscript(proj, [ANSUZ_USER_LINE]);
234
- writeBrief(proj, 'dispatch_prompt_stats.jsonl', Date.now() + 2000);
235
- const r = runHook(proj, { session_id: convId, transcript_path: transcript });
236
- assert.equal(r.out.trim(), '', `stats file must not count as a brief, got: ${r.out}`);
237
- });
238
-
239
- test('(e) /Ansuz seen only in a tool call and a tool result -> not an Ansuz conversation', () => {
240
- const { proj, convId } = staleNagSetup('e');
241
- const toolUse = JSON.stringify({ type: 'assistant', message: { role: 'assistant', content: [
242
- { type: 'tool_use', name: 'Bash', input: { command: 'grep "command-name>/Ansuz<" x.jsonl' } },
243
- ] } });
244
- const toolResult = JSON.stringify({ type: 'user', message: { role: 'user', content: [
245
- { type: 'tool_result', content: '<command-name>/Ansuz</command-name>\n# Ansuz -- Specialist Prompt' },
246
- ] } });
247
- const transcript = writeTranscript(proj, [PLAIN_USER_LINE, toolUse, toolResult]);
248
- writeBrief(proj, 'dispatch_prompt_TASK_TEST.md', Date.now() + 2000);
249
- const r = runHook(proj, { session_id: convId, transcript_path: transcript });
250
- assert.equal(r.out.trim(), '', `tool traffic must not make a session Ansuz, got: ${r.out}`);
251
- });
252
-
253
- test('(f) /Ansuz typed later in the conversation is picked up on the next turn', () => {
254
- const { proj, convId } = staleNagSetup('f');
255
- const transcript = writeTranscript(proj, [PLAIN_USER_LINE, DISPATCH_TOOL_LINE]);
256
- writeBrief(proj, 'dispatch_prompt_TASK_TEST.md', Date.now() + 2000);
257
- const before = runHook(proj, { session_id: convId, transcript_path: transcript });
258
- assert.equal(before.out.trim(), '', `silent before /Ansuz, got: ${before.out}`);
259
- fs.appendFileSync(transcript, ANSUZ_USER_LINE + '\n');
260
- const after = runHook(proj, { session_id: convId, transcript_path: transcript });
261
- assert.match(after.out, /ISBAR handoff stale/, `expected a nag after /Ansuz, got: ${after.out}`);
262
- });
263
-
264
- function writeRegistry(proj, entries) {
265
- fs.mkdirSync(path.join(proj, '.formation'), { recursive: true });
266
- fs.writeFileSync(path.join(proj, '.formation', '.active-dispatches.json'), JSON.stringify(entries));
267
- }
268
-
269
- test('(g) Ansuz conversation, but the fresh dispatches belong to another session -> no nag', () => {
270
- const { proj, convId } = staleNagSetup('g');
271
- // Hook-injected completion notice names the task; that is not this conversation dispatching it.
272
- const notice = JSON.stringify({ type: 'user', message: { role: 'user', content: 'Task completed: TASK_2005' } });
273
- const transcript = writeTranscript(proj, [ANSUZ_USER_LINE, notice]);
274
- writeBrief(proj, 'dispatch_prompt_2005.md', Date.now() + 2000);
275
- writeRegistry(proj, [{ taskId: 'TASK_2006', startedAt: new Date(Date.now() + 2000).toISOString() }]);
276
- const r = runHook(proj, { session_id: convId, transcript_path: transcript });
277
- assert.equal(r.out.trim(), '', `another session's dispatch must not nag, got: ${r.out}`);
278
- });
279
-
280
- test('(h) registry dispatch named by this conversation\'s own tool call -> nag', () => {
281
- const { proj, convId } = staleNagSetup('h');
282
- const mcpDispatch = JSON.stringify({ type: 'assistant', message: { role: 'assistant', content: [
283
- { type: 'tool_use', name: 'mcp__kenaz-dashboard__kenaz_dispatch', input: { taskId: 'TASK_REG' } },
284
- ] } });
285
- const transcript = writeTranscript(proj, [ANSUZ_USER_LINE, mcpDispatch]);
286
- writeRegistry(proj, [{ taskId: 'TASK_REG', startedAt: new Date(Date.now() + 2000).toISOString() }]);
287
- const r = runHook(proj, { session_id: convId, transcript_path: transcript });
288
- assert.match(r.out, /ISBAR handoff stale/, `expected a nag for our own dispatch, got: ${r.out}`);
289
- });
290
-
291
144
  function writeTaskCard(proj, status, id, title) {
292
145
  const dir = path.join(proj, '.kenaz', 'tasks', status);
293
146
  fs.mkdirSync(dir, { recursive: true });
294
- fs.writeFileSync(path.join(dir, `${id}.yaml`), `id: ${id}\ntitle: "${title}"\nstatus: ${status}\n`);
147
+ fs.writeFileSync(path.join(dir, `${id}.yaml`), `id: ${id}
148
+ title: "${title}"
149
+ status: ${status}
150
+ `);
295
151
  }
296
152
 
297
153
  test('(i) --transcript-path scopes pending_decisions to tasks this conversation touched', () => {
@@ -21,7 +21,7 @@ node .specialist/tools/discovery-runner.js --self-test
21
21
  # Save JUnit XML + JSON for dashboard consumption
22
22
  node .specialist/tools/discovery-runner.js \
23
23
  --fixture sentinel \
24
- --target .specialist/tools/phase-gate.js \
24
+ --target .specialist/tools/session.js \
25
25
  --output-dir ./test-results
26
26
  ```
27
27
 
@@ -1,10 +1,9 @@
1
- // TASK_2374: usage counter fixtures — dispatch prompt build + phase-gate subcommand (Bifrost enter shape).
1
+ // TASK_2374: usage counter fixtures — dispatch prompt build.
2
2
  const test = require('node:test');
3
3
  const assert = require('node:assert/strict');
4
4
  const fs = require('fs');
5
5
  const os = require('os');
6
6
  const path = require('path');
7
- const { spawnSync } = require('child_process');
8
7
 
9
8
  const ROOT = path.resolve(__dirname, '..', '..', '..');
10
9
  const tmp = () => path.join(fs.mkdtempSync(path.join(os.tmpdir(), 'usage-')), 'usage_counters.jsonl');
@@ -22,13 +21,3 @@ test('buildPrompt appends a skill counter line', () => {
22
21
  assert.equal(rec.kind, 'skill');
23
22
  assert.match(rec.name, /^unit\//);
24
23
  });
25
-
26
- test('phase-gate subcommand appends a counter line even when the action fails', () => {
27
- const f = tmp();
28
- const r = spawnSync(process.execPath, [path.join(ROOT, '.specialist', 'tools', 'phase-gate.js'), 'enter', '--phase=1'], {
29
- env: { ...process.env, KENAZ_USAGE_COUNTERS_FILE: f }, encoding: 'utf8',
30
- });
31
- assert.notEqual(r.status, 0); // missing --task: fails after counting
32
- const [rec] = lines(f);
33
- assert.deepEqual([rec.kind, rec.name], ['phase-gate', 'enter']);
34
- });
@@ -42,6 +42,7 @@ const KNOWN_MISSING = [
42
42
  ['.rule/code/structure.yaml', 'dashboard/src/app/agents/page.md', 'illustrative naming example, not a pointer'],
43
43
  ['.rule/code/structure.yaml', 'dashboard/src/app/agents/components/AgentCreateWizard/page.md', 'illustrative naming example, not a pointer'],
44
44
  ['.specialist/Ansuz/decisions/ADR-requirement-graph-layer.md', 'dashboard/src-tauri/src/features/synapse/context.rs', 'dated ADR; the file was removed with Kuzu (0.2.266)'],
45
+ ['.specialist/Ansuz/decisions/ADR-requirement-graph-layer.md', '.specialist/experiments/rg_benchmark.js', 'dated ADR; the one-off benchmark was removed 2026-10-12'],
45
46
  ];
46
47
  const knownMissing = new Set(KNOWN_MISSING.map(([f, r]) => `${f} -> ${r}`));
47
48
 
@@ -2,7 +2,6 @@
2
2
  'use strict';
3
3
 
4
4
  const fs = require('fs');
5
- const os = require('os');
6
5
  const path = require('path');
7
6
  const { TaskAPI } = require('../../.collaboration/core/task-api.js');
8
7
 
@@ -619,56 +618,6 @@ function extractTaskToolPayload(payload) {
619
618
  };
620
619
  }
621
620
 
622
- // ─────────────────────────────────────────────────────────────────────────────
623
- // TASK_1977 R2 — Jev optional context inject-on-change.
624
- //
625
- // jev-optional-context.js ranks every turn (kept ON per user decision), but
626
- // re-emitting an identical "Optional local reference DATA" block on every
627
- // UserPromptSubmit adds ~3.3 KB (x2 under D1's double registration) even
628
- // when the selected reference set hasn't moved. Persist the last-emitted
629
- // reference id set per session and only write the block when it changes (or
630
- // on the session's first prompt). State lives under os.tmpdir(), never a
631
- // tracked repo path -- keyed by session_id from the hook payload, which is
632
- // the only stable identity a hook process has (each invocation is a fresh
633
- // process). When no session_id is present (older callers, direct
634
- // handleHookEvent() calls) we can't track a session, so we fail open and
635
- // always emit -- unchanged from pre-R2 behavior.
636
- // ─────────────────────────────────────────────────────────────────────────────
637
- const JEV_SESSION_STATE_DIR = path.join(os.tmpdir(), 'kenaz-jev-session-state');
638
-
639
- function jevSessionKey(sessionId) {
640
- const safe = String(sessionId).replace(/[^A-Za-z0-9_-]/g, '_').slice(0, 128);
641
- return safe || 'unknown';
642
- }
643
-
644
- function jevSessionStateFile(sessionId) {
645
- return path.join(JEV_SESSION_STATE_DIR, `${jevSessionKey(sessionId)}.json`);
646
- }
647
-
648
- function readJevLastEmitted(sessionId) {
649
- try {
650
- const parsed = JSON.parse(fs.readFileSync(jevSessionStateFile(sessionId), 'utf8'));
651
- return Array.isArray(parsed.ids) ? parsed.ids : null;
652
- } catch {
653
- return null; // no prior state (first prompt of session, or unreadable) -- treat as "changed"
654
- }
655
- }
656
-
657
- function writeJevLastEmitted(sessionId, ids) {
658
- try {
659
- fs.mkdirSync(JEV_SESSION_STATE_DIR, { recursive: true });
660
- fs.writeFileSync(jevSessionStateFile(sessionId), JSON.stringify({ ids, updated_at: new Date().toISOString() }), 'utf8');
661
- } catch { /* best-effort persistence; never block the hook on a write failure */ }
662
- }
663
-
664
- function jevIdSetChanged(lastIds, currentIds) {
665
- if (!Array.isArray(lastIds)) return true;
666
- if (lastIds.length !== currentIds.length) return true;
667
- const sortedLast = [...lastIds].sort();
668
- const sortedCurrent = [...currentIds].sort();
669
- return sortedLast.some((id, i) => id !== sortedCurrent[i]);
670
- }
671
-
672
621
  async function handleHookEvent(payload) {
673
622
  const hookEvent = payload.hook_event_name || process.argv[2] || '';
674
623
  const toolName = String(payload.tool_name || '');
@@ -677,21 +626,7 @@ async function handleHookEvent(payload) {
677
626
  if (hookEvent === 'UserPromptSubmit') {
678
627
  // The per-turn "[Task Bridge] ... kenaz_task_id link" reminder was removed 2026-10-09
679
628
  // (user decision: noise, never observed to change behavior).
680
- try {
681
- const { loadOptionalContext } = require('./jev-optional-context');
682
- const result = await loadOptionalContext({ projectPath, specialist: payload.specialist,
683
- prompt: payload.prompt || payload.user_prompt || payload.text || '' });
684
- if (result.context) {
685
- const sessionId = payload.session_id || payload.sessionId || null;
686
- const currentIds = Array.isArray(result.selectedIds) ? result.selectedIds : [];
687
- if (!sessionId) {
688
- process.stdout.write(result.context); // no session identity -- fail open, always emit
689
- } else if (jevIdSetChanged(readJevLastEmitted(sessionId), currentIds)) {
690
- process.stdout.write(result.context);
691
- writeJevLastEmitted(sessionId, currentIds);
692
- }
693
- }
694
- } catch { /* Optional context is fail-open; existing workflow remains available. */ }
629
+ // Jev optional-context injection was removed (its ranking backend is gone; it always resolved to baseline).
695
630
  return null;
696
631
  }
697
632