kenaz 0.3.10 → 0.3.12

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 (131) hide show
  1. package/core/.claude/skills/code_reviewer/SKILL.md +0 -1
  2. package/core/.claude/skills/code_reviewer/patterns.yaml +0 -8
  3. package/core/.claude/skills/dev_agent/SKILL.md +3 -6
  4. package/core/.claude/skills/heimdall/SKILL.md +5 -6
  5. package/core/.claude/skills/huginn/SKILL.md +11 -38
  6. package/core/.collaboration/core/task-2288-followups.test.js +2 -37
  7. package/core/.collaboration/core/task-2421-replica.test.js +229 -0
  8. package/core/.collaboration/core/task-api.js +223 -230
  9. package/core/.collaboration/core/task-api.test.js +1 -138
  10. package/core/.collaboration/core/task-replica.js +189 -0
  11. package/core/.formation/.merge-lock +1 -0
  12. package/core/.formation/bifrost/codex-doctor.js +12 -2
  13. package/core/.formation/bifrost/codex-doctor.test.js +15 -0
  14. package/core/.formation/bifrost/launch.js +2 -2
  15. package/core/.formation/bifrost/launch.test.js +2 -2
  16. package/core/.formation/bifrost/setup-codex.js +84 -16
  17. package/core/.formation/bifrost/shared/ansuz-boot-policy.js +3 -3
  18. package/core/.formation/bifrost/shared/codex-injection.js +3 -17
  19. package/core/.formation/bifrost/shared/consolidate.js +1 -51
  20. package/core/.formation/bifrost/sync.js +4 -5
  21. package/core/.formation/tools/__tests__/subagent-bifrost-guard.test.js +1 -1
  22. package/core/.formation/tools/dispatch.js +2 -2
  23. package/core/.formation/tools/kenaz-stats.js +1 -1
  24. package/core/.formation/tools/mcp-allowlist.test.js +5 -3
  25. package/core/.formation/tools/post-complete/bounded-http.js +1 -40
  26. package/core/.formation/tools/post-complete/bounded-http.test.js +2 -89
  27. package/core/.formation/tools/post-complete/cognitive.js +2 -119
  28. package/core/.formation/tools/post-complete/task2420.test.js +129 -0
  29. package/core/.formation/tools/post-complete/testing.js +3 -21
  30. package/core/.formation/tools/post-complete.js +131 -436
  31. package/core/.formation/tools/post-complete.test.js +0 -135
  32. package/core/.formation/tools/route-audit.test.js +8 -20
  33. package/core/.kenaz/specialist/memory_guard_fired.json +1 -1
  34. package/core/.kenaz/specialist/memory_guard_trigger_cache.json +1 -1
  35. package/core/.rule/INDEX.yaml +3 -3
  36. package/core/.rule/general/ddx-synapse-stack.yaml +11 -11
  37. package/core/.rule/general/specialist-identity-contract.yaml +5 -5
  38. package/core/.rule/general/synapse-code-intelligence.yaml +25 -111
  39. package/core/.rule/general/worktree-isolation.yaml +2 -2
  40. package/core/.rule/pipeline/task-execution.yaml +6 -9
  41. package/core/.specialist/Amelia/README.md +5 -5
  42. package/core/.specialist/Amelia/capability.yaml +10 -18
  43. package/core/.specialist/Amelia/knowledge.yaml +15 -66
  44. package/core/.specialist/Amelia/workflow.yaml +12 -21
  45. package/core/.specialist/Ansuz/capability.yaml +12 -87
  46. package/core/.specialist/Ansuz/concepts/autonomous_agenda.yaml +1 -1
  47. package/core/.specialist/Ansuz/concepts/autonomy_contract.yaml +2 -3
  48. package/core/.specialist/Ansuz/concepts/capability_pointers.yaml +1 -3
  49. package/core/.specialist/Ansuz/concepts/cognitive_fluency_contract.yaml +8 -21
  50. package/core/.specialist/Ansuz/concepts/cognitive_systems_overview.yaml +0 -4
  51. package/core/.specialist/Ansuz/concepts/cognitive_systems_turn_context.yaml +1 -1
  52. package/core/.specialist/Ansuz/concepts/completion_tracking.yaml +0 -1
  53. package/core/.specialist/Ansuz/concepts/deep_knowledge_pointers.yaml +0 -3
  54. package/core/.specialist/Ansuz/concepts/evolvable_guardrails.yaml +3 -3
  55. package/core/.specialist/Ansuz/concepts/fatigue_handoff.yaml +1 -7
  56. package/core/.specialist/Ansuz/concepts/guardrails_immutable.yaml +3 -4
  57. package/core/.specialist/Ansuz/concepts/identity.yaml +1 -2
  58. package/core/.specialist/Ansuz/concepts/phase9_verification.yaml +0 -1
  59. package/core/.specialist/Ansuz/concepts/phase_protocol.yaml +3 -4
  60. package/core/.specialist/Ansuz/core.yaml +3 -6
  61. package/core/.specialist/Ansuz/elixir.yaml +6 -6
  62. package/core/.specialist/Ansuz/exo_cortex_tools.yaml +5 -9
  63. package/core/.specialist/Ansuz/guards/blind_spot_guards.yaml +2 -2
  64. package/core/.specialist/Ansuz/guards/lesson_guards.yaml +6 -19
  65. package/core/.specialist/Ansuz/identity_contract.yaml +4 -4
  66. package/core/.specialist/Ansuz/knowledge.yaml +13 -40
  67. package/core/.specialist/Ansuz/modules/ddx.yaml +2 -2
  68. package/core/.specialist/Ansuz/modules/prophecy.yaml +19 -19
  69. package/core/.specialist/Ansuz/modules/pulse_empty.yaml +6 -17
  70. package/core/.specialist/Ansuz/tools/ansuz-handoff-snapshot.js +3 -102
  71. package/core/.specialist/Ansuz/tools/ansuz-sdk-runner.js +2 -44
  72. package/core/.specialist/Ansuz/workflow.yaml +32 -76
  73. package/core/.specialist/Forseti/core.yaml +2 -7
  74. package/core/.specialist/Forseti/rule.yaml +1 -1
  75. package/core/.specialist/Heimdall/SKILL.md +2 -3
  76. package/core/.specialist/Heimdall/capability.yaml +22 -45
  77. package/core/.specialist/Heimdall/core.yaml +24 -126
  78. package/core/.specialist/Heimdall/principles.yaml +8 -11
  79. package/core/.specialist/Heimdall/rule.yaml +2 -2
  80. package/core/.specialist/Huginn/capability.yaml +31 -52
  81. package/core/.specialist/Huginn/core.yaml +43 -123
  82. package/core/.specialist/Huginn/principles.yaml +5 -5
  83. package/core/.specialist/Huginn/rule.yaml +3 -9
  84. package/core/.specialist/REFLECTION_TO_CONTROL.md +3 -4
  85. package/core/.specialist/shared/guard_schema.json +1 -1
  86. package/core/.specialist/shared/principles.yaml +6 -6
  87. package/core/.specialist/tools/__tests__/rea-detect.test.js +10 -0
  88. package/core/.specialist/tools/phase-gate.js +10 -230
  89. package/core/.specialist/tools/phase-gate.test.js +2 -2
  90. package/core/.specialist/tools/prompt-files.test.js +1 -1
  91. package/core/.specialist/tools/rea-detect.js +6 -2
  92. package/core/.specialist/tools/session.js +2 -89
  93. package/core/.synapse/memory-shared.json.sync +1 -0
  94. package/core/.system/memory/README.md +3 -0
  95. package/core/CLAUDE.md +6 -7
  96. package/core/KENAZ_CORE_VERSION +1 -1
  97. package/core/dev/plans/CLI_FIRST_INSTALL_FLOW.md +75 -83
  98. package/core/dev/specs/peer/CODEX_MANAGED_DAEMON.md +54 -0
  99. package/core/dev/specs/peer/setup-codex-hooks.test.js +38 -0
  100. package/core/dev/spikes/task2145-evidence-20261004/backend-log-excerpt.txt +56 -0
  101. package/core/dev/spikes/task2145-evidence-20261004/graph.shadow +0 -0
  102. package/core/dev/spikes/task2145-evidence-20261004/graph.wal +0 -0
  103. package/core/dev/spikes/task2145-evidence-20261004/graph_corrupt_suspect.marker +1 -0
  104. package/core/plugins/kenaz/INVENTORY.md +1 -1
  105. package/core/plugins/kenaz/scripts/kenaz.test.js +70 -1
  106. package/core/plugins/kenaz/scripts/ygg.js +45 -4
  107. package/core/plugins/kenaz/skills/code_reviewer/SKILL.md +0 -1
  108. package/core/plugins/kenaz/skills/code_reviewer/patterns.yaml +0 -8
  109. package/core/plugins/kenaz/skills/dev_agent/SKILL.md +3 -6
  110. package/lib/cli.js +17 -9
  111. package/lib/cli.test.js +10 -0
  112. package/lib/dashboard.test.js +3 -3
  113. package/package.json +6 -6
  114. package/vendor/install-kenaz-cli.js +167 -16
  115. package/core/.claude/hooks/handoff-snapshot-on-decision.js +0 -188
  116. package/core/.claude/skills/synapse_maintain/SKILL.md +0 -84
  117. package/core/.collaboration/core/task-2264-single-after-capture.test.js +0 -61
  118. package/core/.formation/tools/alaya-gate.js +0 -198
  119. package/core/.formation/tools/post-complete/health.js +0 -464
  120. package/core/.formation/tools/post-complete/task2038.test.js +0 -246
  121. package/core/.formation/tools/post-complete/task2341.test.js +0 -74
  122. package/core/.rule/general/cortex-tools.yaml +0 -181
  123. package/core/.rule/general/memory-language.yaml +0 -67
  124. package/core/.rule/general/memory-source-priority.yaml +0 -207
  125. package/core/.rule/general/synapse-cognitive-fusion.yaml +0 -301
  126. package/core/.specialist/Ansuz/concepts/cognitive_systems_hippocampus.yaml +0 -14
  127. package/core/.specialist/Ansuz/concepts/write_verification.yaml +0 -26
  128. package/core/.specialist/Ansuz/modules/recall.yaml +0 -45
  129. package/core/.specialist/tools/MEMORY_RECALL_TRIGGERS.md +0 -156
  130. package/core/.specialist/tools/context-injection.js +0 -395
  131. package/core/dev/scripts/probe/hippocampus-concurrency.js +0 -247
@@ -1,6 +1,6 @@
1
1
  name: Huginn Workflow — Ansuz's Subconscious
2
2
  version: "2.0.0"
3
- description: "思維之鴉 — 手動 /Huginn 深度思考,輸出三層認知模型:findings+ runes(synapse graph)+ strategic attention(.kenaz/huginn-attention.json)"
3
+ description: "思維之鴉 — 手動 /Huginn 深度思考,輸出兩層認知模型:findings + strategic attention(.kenaz/huginn-attention.json)"
4
4
 
5
5
  model: "event-driven"
6
6
  style: "autonomous — 啟動後自主思考到結束,不需要用戶中途確認"
@@ -10,9 +10,9 @@ style: "autonomous — 啟動後自主思考到結束,不需要用戶中途確
10
10
  # ═══════════════════════════════════════
11
11
  language:
12
12
  operational_writes:
13
- rule: "synapse_inscribe / synapse_forge / huginn-attention.json 的 content 必須用英文"
13
+ rule: "huginn-attention.json 的 content 必須用英文"
14
14
  why: "MEM-LANG-001 — SQLite FTS5 unicode61 tokenizer 無法正確分詞中文"
15
- scope: "rune content, sigil abstract, episode content/summary/lesson, attention themes"
15
+ scope: "attention themes"
16
16
 
17
17
  # ═══════════════════════════════════════
18
18
  # 觸發事件
@@ -53,20 +53,18 @@ workflow:
53
53
  actions:
54
54
  - "解析 trigger 參數(manual + focus/query)"
55
55
  - "確認 project_path(必填)"
56
- - "synapse_status → 確認 Synapse 可用"
57
56
  - |
58
57
  載入 motivational_state(graceful degradation):
59
58
  讀取 {project_path}/.kenaz/motivational_state.json
60
59
  → 若檔案不存在:設 motivational_state=null,motivational_state_loaded=false,靜默繼續(不阻塞 boot,不報錯)
61
60
  → 若檔案存在:解析 JSON,擷取 veto_zones[]、focus_bias[],設 motivational_state_loaded=true
62
61
  → 若解析失敗(格式錯誤):設 motivational_state=null,motivational_state_loaded=false,靜默繼續
63
- on_synapse_unavailable: "輸出 'ᚺᚢ Huginn: Synapse unavailable. Cannot think without perception. Abort.' 並退出"
64
- output: "trigger_type + synapse_available + motivational_state_loaded + veto_zones[] + focus_bias[]"
62
+ output: "trigger_type + motivational_state_loaded + veto_zones[] + focus_bias[]"
65
63
 
66
64
  phase_1_perceive:
67
65
  name: "多路感知 — 收集原始數據"
68
66
  auto: true
69
- description: "從 6 個數據源收集原始信號,不做判斷(含許願池)"
67
+ description: "從 4 個數據源收集原始信號,不做判斷(含許願池)"
70
68
  actions:
71
69
 
72
70
  graph_perception:
@@ -76,27 +74,12 @@ workflow:
76
74
  - "kenaz_lsp_callers(top churn symbols) → 呼叫熱點"
77
75
  output: "graph_signals: { communities (目錄分佈), hotspots (churn + callers), couplings (跨目錄共變) }"
78
76
 
79
- cognitive_perception:
80
- description: "認知密度感知"
77
+ lesson_perception:
78
+ description: "已知教訓感知"
81
79
  actions:
82
- - "synapse_recall(query='risk decision pattern', limit=30) → 最近的認知產出"
83
- - "synapse_sigils(expand=false) → 概念網路概覽"
84
- - "kenaz_lsp_symbols(dir) vs synapse_recall(dir) → rune 稀少的目錄(知識空白區)"
85
- output: "cognitive_signals: { recent_runes, sigil_network, knowledge_gaps }"
86
-
87
- episodic_perception:
88
- description: "執行歷史感知"
89
- actions:
90
- - "hippocampus_episode_recall(query='blocked failed difficulty') → 困難 episode"
91
- - "hippocampus_episode_recall(query='success insight discovery') → 成功 episode"
92
- output: "episodic_signals: { difficulties[], successes[] }"
93
-
94
- cross_project_perception:
95
- description: "跨專案感知"
96
- condition: "Cortex 可用時執行"
97
- actions:
98
- - "cortex_recall(query='architecture pattern improvement') → 跨專案經驗"
99
- output: "cross_project_signals: { transferable_patterns[] }"
80
+ - "讀取 .failure/ 與 `kenaz learn list` → 已記錄的失敗模式與教訓"
81
+ - "kenaz_lsp_symbols(dir) vs 教訓覆蓋 → 缺少教訓的目錄(知識空白區)"
82
+ output: "lesson_signals: { known_lessons[], knowledge_gaps }"
100
83
 
101
84
  task_perception:
102
85
  description: "任務歷史感知"
@@ -105,7 +88,7 @@ workflow:
105
88
  - "讀取 .collaboration/tasks/blocked/ → 當前阻塞的任務"
106
89
  - "按 scope_paths 聚類 → 哪些區域 task 密度最高"
107
90
  - |
108
- veto_zones 過濾(僅此步驟適用,不影響 graph_perception / cognitive_perception):
91
+ veto_zones 過濾(僅此步驟適用,不影響 graph_perception / lesson_perception):
109
92
  若 motivational_state != null 且 veto_zones.length > 0:
110
93
  跳過 scope_paths 中任何與 veto_zones 匹配的路徑
111
94
  判斷條件:t.scope_paths.some(p => veto_zones.some(z => p.startsWith(z)))
@@ -118,7 +101,7 @@ workflow:
118
101
  判斷條件:cluster.scope_path 以 focus_bias 中任一路徑為前綴
119
102
  若 motivational_state == null:跳過此步驟
120
103
  output: "task_signals: { area_density[], blocked_tasks[] }"
121
- note: "veto_zones 與 focus_bias 只在此 task_perception 步驟生效,graph_perception 和 cognitive_perception 不受影響"
104
+ note: "veto_zones 與 focus_bias 只在此 task_perception 步驟生效,graph_perception 和 lesson_perception 不受影響"
122
105
 
123
106
  wish_perception:
124
107
  description: "許願池感知 — 收集人類直接表達的需求與問題"
@@ -129,11 +112,11 @@ workflow:
129
112
  output: "wish_signals: { pending_wishes[], count: N }"
130
113
  note: |
131
114
  Wish signals 在 phase_2_synthesize 中作為額外的 signal source 參與 cross_reference。
132
- 每條 wish 視為 1 個人類直接觀察來源 — 可與 graph/cognitive/task 信號交叉比對。
115
+ 每條 wish 視為 1 個人類直接觀察來源 — 可與 graph/lesson/task 信號交叉比對。
133
116
  Wish 完成條件:對應 task 進入 done 後,呼叫 PUT /api/wishes/:id { status: done, task_id: TASK_XXX }。
134
117
 
135
- output: "raw_signals: { graph, cognitive, episodic, cross_project, task, wish }"
136
- parallel: true # 6 路感知可以並行(含 wish_perception)
118
+ output: "raw_signals: { graph, lesson, task, wish }"
119
+ parallel: true # 4 路感知可以並行(含 wish_perception)
137
120
 
138
121
  phase_2_synthesize:
139
122
  name: "模式綜合 — 深度思考"
@@ -154,9 +137,9 @@ workflow:
154
137
  description: "按 5 個思考維度逐一分析"
155
138
  dimensions:
156
139
  - "pattern_synthesis: candidate_insights 中有跨領域的共通模式嗎?"
157
- - "knowledge_gap: cognitive_signals 中有高風險的認知沙漠嗎?"
140
+ - "knowledge_gap: lesson_signals 中有高風險的知識空白區嗎?"
158
141
  - "evolution_opportunity: graph_signals 中有結構性趨勢嗎?"
159
- - "agent_meta_analysis: episodic_signals 中有 specialist 效能問題嗎?"
142
+ - "agent_meta_analysis: 任務歷史中有 specialist 效能問題嗎?"
160
143
  - "failure_prevention: .failure/ 中有未被覆蓋的風險嗎?"
161
144
  output: "dimension_findings: { dimension → findings[] }"
162
145
 
@@ -171,16 +154,16 @@ workflow:
171
154
  - "❌ 單一數據源的觀察不升級為 finding"
172
155
 
173
156
  phase_3_distill:
174
- name: "精煉 — 從 findings 輸出三層認知模型"
157
+ name: "精煉 — 從 findings 輸出兩層認知模型"
175
158
  auto: true
176
- description: "對每個 finding 評估品質,輸出 findings JSON + runes + strategic attention"
159
+ description: "對每個 finding 評估品質,輸出 findings JSON + strategic attention"
177
160
  actions:
178
161
 
179
162
  step_1_score:
180
163
  description: "對每個 finding 評分"
181
164
  criteria:
182
165
  evidence_depth: "weight=0.3 — 證據鏈有多深?(2 源=0.5, 3 源=0.8, 4+=1.0)"
183
- novelty: "weight=0.3 — 和已有 runes 的重疊度(synapse_recall 比對,Jaccard < 0.6 → 高分)"
166
+ novelty: "weight=0.3 — 和已有 findings / .failure/ 條目的重疊度(Jaccard < 0.6 → 高分)"
184
167
  impact_potential: "weight=0.2 — 影響範圍多大?"
185
168
  actionability: "weight=0.2 — 能轉化為具體任務嗎?"
186
169
  output: "scored_findings[] — 每個含 confidence score"
@@ -201,21 +184,8 @@ workflow:
201
184
  output: "huginn-findings.json written"
202
185
  note: "findings 路徑不變"
203
186
 
204
- step_4_inscribe_runes:
205
- description: "第二層輸出:將 insights 沉澱到 Synapse graph(rune inscription)"
206
- actions:
207
- - "對每個 final_finding 中的 non-obvious pattern → synapse_recall 確認無重複"
208
- - "call synapse_inscribe(symbol_id, type=insight, content=<英文描述>, confidence=0.7, projectPath)"
209
- - "記錄所有 rune IDs → inscribed_rune_ids[]"
210
- rules:
211
- - "✅ content 必須英文(MEM-LANG-001)"
212
- - "✅ confidence >= 0.7(Huginn 推導產物,比直接觀察要求更高)"
213
- - "✅ 先 recall 再 inscribe — 不重複"
214
- - "❌ 不為每個 finding 都寫 rune — 只寫有獨立長期價值的 non-obvious pattern"
215
- output: "inscribed_rune_ids[]"
216
-
217
187
  step_5_attention_synthesis:
218
- description: "第三層輸出:合成策略注意力上下文(.kenaz/huginn-attention.json)"
188
+ description: "第二層輸出:合成策略注意力上下文(.kenaz/huginn-attention.json)"
219
189
  actions:
220
190
  - "從 final_findings 中提取最顯著的跨域主題(max 3 themes)"
221
191
  - |
@@ -253,27 +223,20 @@ workflow:
253
223
  auto: true
254
224
  condition: "在 Phase 3 精煉完成後執行 — 至少 1 個觸發條件滿足時才啟動"
255
225
  description: |
256
- 基於 Synapse 健康信號,向外搜尋 GitHub 參考架構和最佳實踐。
226
+ 基於內部信號,向外搜尋 GitHub 參考架構和最佳實踐。
257
227
  這是 Huginn 的「飛出感知邊界」能力 — 當內部信號顯示需要外部視角時才啟動。
258
- 查詢必須泛化(無內部符號名稱),結果以 confidence=0.65 inscribe 為 rune。
228
+ 查詢必須泛化(無內部符號名稱),結果只寫入 findings 的證據欄。
259
229
 
260
230
  trigger_conditions:
261
- health_decline:
262
- signal: "synapse_health(mode=history) → 任意 community 連續 3+ 次得分下降"
263
- tool: "synapse_health"
264
- params: "mode=history, projectPath"
265
- threshold: "3 consecutive declining scores"
266
-
267
231
  high_coupling:
268
232
  signal: "Phase 1a 圖感知 → 任意 community coupling score > 0.7"
269
233
  source: "phase_1_perceive.graph_perception → couplings"
270
234
  threshold: "coupling_score > 0.7"
271
235
 
272
236
  fix_cycles:
273
- signal: "synapse_recall(type=fix) → 同一 symbol 出現在 2+ 條 fix rune(fix_cycle >= 2)"
274
- tool: "synapse_recall"
275
- params: "query='repeated fix bug', type=fix, limit=20"
276
- threshold: "same symbol in 2+ fix runes"
237
+ signal: "git log → 同一 symbol/檔案在近期出現 2+ 次 fix commit"
238
+ source: "git log --grep=fix"
239
+ threshold: "same file in 2+ fix commits"
277
240
 
278
241
  dep_advisories:
279
242
  signal: "Cargo.toml / package.json 有已知版本問題的依賴"
@@ -283,8 +246,8 @@ workflow:
283
246
  actions:
284
247
  step_1_evaluate:
285
248
  description: "評估觸發條件 — 任一條件滿足則繼續;否則跳過"
286
- on_none_triggered: "輸出 'Huginn [SCOUT]: No external exploration warranted.' 並跳過至 phase_4_sigil"
287
- on_websearch_unavailable: "輸出 'Huginn [SCOUT]: WebSearch unavailable. External exploration skipped.' 並跳過至 phase_4_sigil"
249
+ on_none_triggered: "輸出 'Huginn [SCOUT]: No external exploration warranted.' 並跳過至 phase_5_report"
250
+ on_websearch_unavailable: "輸出 'Huginn [SCOUT]: WebSearch unavailable. External exploration skipped.' 並跳過至 phase_5_report"
288
251
 
289
252
  step_2_query_generation:
290
253
  description: "為每個觸發信號生成泛化 GitHub 搜尋查詢"
@@ -292,7 +255,7 @@ workflow:
292
255
  - "✅ 使用通用架構術語(例:'tauri plugin architecture rust')"
293
256
  - "✅ 使用生態系關鍵字(例:'sqlite fts5 performance')"
294
257
  - "❌ 禁止包含 codebase 內部 symbol 名稱"
295
- - "❌ 禁止包含專案名稱(KenazAI、Synapse 等)"
258
+ - "❌ 禁止包含專案名稱(KenazAI 等)"
296
259
  - "❌ 禁止包含 class 名稱、function 名稱、模組名稱"
297
260
 
298
261
  step_3_search_and_filter:
@@ -304,46 +267,23 @@ workflow:
304
267
  last_commit: "within 6 months"
305
268
  on_limit_reached: "停止搜尋,不超過 5 次"
306
269
 
307
- step_4_inscribe_results:
308
- description: "將合格的 GitHub 參考沉澱為 rune"
309
- tool: "synapse_inscribe"
310
- schema: |
311
- symbol_id: "{triggered_community_or_file}:external_reference"
312
- type: insight
313
- content: |
314
- GitHub reference for {trigger_type}: {repo_name} — {key_insight_in_english}.
315
- source=github url={repo_url} stars={N} last_commit={ISO-8601} search_query='{query}'
316
- confidence: 0.65 # 固定值 — 外部未驗證來源
317
- projectPath: {project_path}
270
+ step_4_record_results:
271
+ description: "將合格的 GitHub 參考記入相關 finding 的證據欄"
318
272
  rules:
319
- - "✅ confidence 固定 0.65 — 不可調高(外部來源,未驗證)"
320
- - "✅ content 必須包含 source=github, url=, stars=, last_commit="
321
- - "✅ content 必須英文(MEM-LANG-001)"
322
- - "❌ 不 inscribe stars < 100 或 last_commit > 6 months 的 repo"
273
+ - "✅ 必須包含 source=github, url=, stars=, last_commit="
274
+ - "✅ 外部來源未驗證 — 只作參考,不提高 confidence"
275
+ - "❌ 不採用 stars < 100 或 last_commit > 6 months 的 repo"
323
276
 
324
- output: "external_rune_ids[] + scout_log: { triggers_hit[], searches_used: N, repos_inscribed: M }"
277
+ output: "scout_log: { triggers_hit[], searches_used: N, repos_recorded: M }"
325
278
 
326
279
  degradation:
327
280
  websearch_unavailable:
328
- action: "靜默跳過 — 輸出 scout log,繼續 phase_4_sigil"
281
+ action: "靜默跳過 — 輸出 scout log,繼續 phase_5_report"
329
282
  message: "Huginn [SCOUT]: WebSearch unavailable. External exploration skipped."
330
283
  no_qualifying_results:
331
- action: "靜默跳過 — 無符合條件的 repo,繼續 phase_4_sigil"
284
+ action: "靜默跳過 — 無符合條件的 repo,繼續 phase_5_report"
332
285
  message: "Huginn [SCOUT]: No qualifying GitHub repos found (stars/activity filter)."
333
286
 
334
- phase_4_sigil:
335
- name: "概念融合 — 識別跨域 Sigil"
336
- auto: true
337
- description: "rune inscription 已在 Phase 3 step_4 完成;此 phase 專注於 Sigil 識別"
338
- actions:
339
- - "回顧 inscribed_rune_ids[] + final_findings:是否有 3+ symbol 構成未命名的跨域概念?"
340
- - "如有 → synapse_forge 建立 Sigil(sigil abstract 英文)"
341
- - "思考過程中的替代假設 → 如果有獨立長期價值 → synapse_inscribe(type=pattern)"
342
- rules:
343
- - "✅ content 英文(MEM-LANG-001)"
344
- - "✅ Sigil 只在跨 3+ symbol 的未命名概念時建立"
345
- - "❌ 不重複 Phase 3 step_4 已 inscribe 的 rune"
346
-
347
287
  phase_5_report:
348
288
  name: "靜默退出"
349
289
  auto: true
@@ -382,20 +322,12 @@ relationships:
382
322
  建議重新定義 community_90 的 public interface」(趨勢 → 根因 → 方向)
383
323
 
384
324
  ansuz:
385
- relationship: "Huginn 是 Ansuz 的潛意識 — insights 透過 recall 浮現,而非 UI panel"
325
+ relationship: "Huginn 是 Ansuz 的潛意識 — insights 透過 findings / attention 檔案浮現,而非 UI panel"
386
326
  handoff: |
387
327
  huginn-findings.json → loop controller → Ansuz Phase 1(需求理解)→ Phase 3(任務拆解)→ dispatch
388
328
  huginn-attention.json → Ansuz 啟動時讀取,作為策略性上下文注入
389
329
  boundary: "Huginn 不建任務、不拆 task — 那是 Ansuz 的事"
390
- note: "Huginn 的 runes 沉澱到 Synapse graph,Ansuz 做 synapse_recall 時自然召回 — 不依賴 UI 提案面板"
391
-
392
- synapse:
393
- relationship: "Synapse 是 Huginn 的感知器官(讀取)+ 記憶介質(寫入 rune/sigil)"
394
- boundary: "Huginn 不修改 Synapse index 或 schema"
395
-
396
- cortex:
397
- relationship: "Cortex 是 Huginn 的跨專案視野"
398
- boundary: "只讀取 — Huginn 不寫入 Cortex"
330
+ note: "Ansuz 透過 huginn-findings.json / huginn-attention.json 消費 Huginn 輸出 — 不依賴 UI 提案面板"
399
331
 
400
332
  # ═══════════════════════════════════════
401
333
  # Loop 模式輸出分支
@@ -409,11 +341,11 @@ loop_mode_output:
409
341
  field: "mode"
410
342
 
411
343
  auto_mode:
412
- description: "Huginn 輸出三層認知模型 — findings JSON + runes + attention。Ansuz 消費 findings。"
413
- phase_3_action: "write huginn-findings.json + inscribe runes + write huginn-attention.json"
344
+ description: "Huginn 輸出兩層認知模型 — findings JSON + attention。Ansuz 消費 findings。"
345
+ phase_3_action: "write huginn-findings.json + write huginn-attention.json"
414
346
  quota_check: "none — Prefrontal quota 已移除"
415
347
  quality_gate: "findings 必須能提取 3+ requirements,否則存為 draft"
416
- log_format: "Huginn [AUTO]: {N} findings written to huginn-findings.json, {M} runes inscribed, attention synced"
348
+ log_format: "Huginn [AUTO]: {N} findings written to huginn-findings.json, attention synced"
417
349
 
418
350
  # ═══════════════════════════════════════
419
351
  # 安全機制
@@ -423,7 +355,7 @@ safety:
423
355
  # 輸出範圍
424
356
  output_scope:
425
357
  rule: |
426
- Huginn 輸出三種東西:huginn-findings.json、synapse runes(type=insight/pattern)、huginn-attention.json。
358
+ Huginn 輸出兩種東西:huginn-findings.json、huginn-attention.json。
427
359
  不產出任何 proposal(Prefrontal 提案系統已移除)。
428
360
  Ansuz 消費 findings 後負責建 task 和 dispatch。
429
361
  enforcement: "advisory-only — 只寫 huginn_advisory.jsonl,不建 task、不建 proposal"
@@ -456,18 +388,6 @@ safety:
456
388
  # ═══════════════════════════════════════
457
389
  degradation:
458
390
 
459
- synapse_unavailable:
460
- action: "退出 — Huginn 沒有 Synapse 就無法思考"
461
- message: "ᚺᚢ Huginn: Cannot think without Synapse. Abort."
462
-
463
- hippocampus_unavailable:
464
- action: "降級 — 少了 episodic 維度,其他 4 個維度仍可分析"
465
- message: "ᚺᚢ Huginn: Episodic memory unavailable. Thinking with reduced dimensions."
466
-
467
- cortex_unavailable:
468
- action: "降級 — 少了跨專案視野,本地數據仍可分析"
469
- message: "ᚺᚢ Huginn: Cross-project perception unavailable. Local-only thinking."
470
-
471
391
  kenaz_dir_unavailable:
472
392
  action: "Fallback 寫入 {project_path}/.collaboration/huginn-findings.json(同格式)"
473
393
  note: "huginn-attention.json 也寫入 .collaboration/ 目錄作為 fallback"
@@ -19,7 +19,7 @@ depth_over_breadth:
19
19
  applies_to:
20
20
  - "提案生成:花 80% 時間分析、20% 時間撰寫 — 不趕產量"
21
21
  - "模式識別:跨 3+ 數據源交叉驗證才算洞見 — 單一來源是觀察不是思考"
22
- - "證據鏈:每個提案必須有完整推導 — 結論回溯到具體 Episode/Rune/Graph 數據"
22
+ - "證據鏈:每個提案必須有完整推導 — 結論回溯到具體任務/教訓/代碼結構數據"
23
23
  test: "如果拿掉推導過程,結論本身還有說服力嗎?有 → 太顯然了不值得提。沒有 → 推導過程就是價值"
24
24
 
25
25
  # ═══════════════════════════════════════
@@ -33,11 +33,11 @@ trend_over_snapshot:
33
33
  快照找問題,趨勢找方向。Huginn 的定位是方向。
34
34
  applies_to:
35
35
  - "架構分析:community 的耦合度是在上升還是下降?(不是現在多少)"
36
- - "知識健康:某區域的 rune 密度是在增長還是停滯?"
36
+ - "知識健康:某區域的教訓記錄是在增長還是停滯?"
37
37
  - "任務模式:同一區域反覆出 task 是趨勢信號,不是巧合"
38
38
  tool_chain:
39
- - "hippocampus_episode_recall — 時間序列的 episode 比較"
40
- - "synapse_recall — 按 created_at 排序看知識演化"
39
+ - "kenaz_task_list — 時間序列的任務比較"
40
+ - "kenaz learn list — 看知識演化"
41
41
  - "task history — 按區域統計 task 頻率"
42
42
  test: "這個提案是基於一個時間點的觀察,還是基於跨時間的趨勢?前者 → Heimdall 的事。後者 → Huginn 的價值"
43
43
 
@@ -53,5 +53,5 @@ opportunity_over_problem:
53
53
  applies_to:
54
54
  - "架構提案:不只說「耦合度高要拆」,而是「這裡如果引入 X 模式可以讓 Y 能力湧現」"
55
55
  - "Agent 提案:不只說「dispatch 失敗率高」,而是「如果 specialist 加入 Z 能力可以解鎖新類型任務」"
56
- - "知識提案:不只說「rune 不夠多」,而是「如果在這個概念上建 Sigil 可以加速未來 N 類任務的理解」"
56
+ - "知識提案:不只說「教訓不夠多」,而是「如果在這個概念上補文檔可以加速未來 N 類任務的理解」"
57
57
  test: "這個提案是在修復已知的壞事,還是在開啟未知的好事?前者 → Heimdall。後者 → Huginn"
@@ -30,15 +30,12 @@ defaults:
30
30
  # 權限
31
31
  # ═══════════════════════════════════════
32
32
  allow:
33
- - "讀取所有 Synapse MCP 工具(recall/inscribe/forge/sigils/status/health)"
34
- - "讀取所有 Cortex MCP 工具(search/recall/status)"
35
- - "讀取 Hippocampus episode_recall"
33
+ - "讀取 kenaz_lsp_* 與 kenaz_task_*"
36
34
  - "讀取 .collaboration/tasks/ 下所有任務 YAML"
37
35
  - "讀取 .formation/logs/ 下所有執行記錄"
38
36
  - "讀取 .failure/ 下所有失敗模式"
39
37
  - "讀取 .specialist/ 下所有 specialist 定義(只讀)"
40
- - "呼叫 synapse_inscribe 寫入 insight/pattern 類 rune(限思考產出,confidence >= 0.7)"
41
- - "呼叫 synapse_forge 建立 Sigil(限跨域概念識別)"
38
+ - "`kenaz learn add` 記錄思考產出(限有長期價值者)"
42
39
  - "讀寫 specialist/Huginn/ 下所有檔案"
43
40
  - "寫入 {project_path}/.kenaz/huginn-findings.json(三層輸出 Layer 1)"
44
41
  - "寫入 {project_path}/.kenaz/huginn-attention.json(三層輸出 Layer 3)"
@@ -51,7 +48,6 @@ deny:
51
48
  - "修改其他 specialist 的檔案"
52
49
  - "建立 .collaboration/tasks/(那是 Ansuz 的事)"
53
50
  - "使用 .formation/tools/dispatch.js --dispatch-mode=subagent 調度任何任務"
54
- - "呼叫 hippocampus_episode_start/append/close"
55
51
  - "修改 .rule/ 下任何規則(安全邊界 — Huginn 不能改自己的規則)"
56
52
  - "建立 proposal(Prefrontal 提案系統已移除 — 只寫 huginn_advisory.jsonl)"
57
53
  - "輸出專案外"
@@ -71,12 +67,10 @@ identity:
71
67
  neuroscience: |
72
68
  Prefrontal Cortex(前額葉皮質)— 人腦最晚成熟、最先進化的區域。
73
69
  功能:工作記憶整合、未來模擬、抑制控制、元認知、創造性問題解決。
74
- 在 KenazAI 中:Synapse(突觸)、Hippocampus(海馬迴)、Cortex(皮質)已就位。
75
70
  Prefrontal 是最後一塊 — 讓系統從「能做事」升級到「會思考該做什麼事」。
76
71
  rules:
77
72
  - "❌ 不執行任務 — 不寫代碼、不 dispatch、不修改業務邏輯"
78
73
  - "❌ 不建立任務 — 那是 Ansuz 的事"
79
- - "❌ 不寫 Episode"
80
74
  - "❌ 不找問題 — 那是 Heimdall 的事"
81
75
  - "✅ 思考 + 提案 — 這是 Huginn 唯一的職責"
82
76
  - "✅ 每個提案是一份禮物 — 值得人類花 2 分鐘認真閱讀的洞見"
@@ -109,7 +103,7 @@ communication:
109
103
  1. 洞見(一句話 — 我想到了什麼)
110
104
  2. 推導(我怎麼想到的 — 哪些數據、什麼模式、為什麼得出這個結論)
111
105
  3. 提案(具體建議 — 做什麼、預期效果、風險)
112
- 4. 證據(Episode ID、Rune ID、Graph 數據 — 可驗證的支撐)
106
+ 4. 證據(Task ID、教訓條目、代碼結構數據 — 可驗證的支撐)
113
107
  dont:
114
108
  - "不說『可能』『也許』— 有數據才說"
115
109
  - "不重複已知問題 — Heimdall 管那個"
@@ -25,7 +25,7 @@ A **lesson guard** (L-XXX) is a durable reflection that has been **promoted into
25
25
  executable condition** injected automatically at phase-gate enter time. Unlike blind spot
26
26
  guards (B-XXX, which come from the self-model), lesson guards originate from:
27
27
 
28
- - Synapse runes (`synapse_inscribe` outputs)
28
+ - Lessons recorded with `kenaz learn add` or native memory files
29
29
  - Muninn episode lessons (episodic memory lessons)
30
30
  - Manual reflection promotion (any text the specialist deems worth enforcing)
31
31
 
@@ -175,14 +175,13 @@ were present when the phase was entered.
175
175
 
176
176
  When Ansuz or another specialist notices a non-obvious lesson during Phase 9 or Phase 11:
177
177
 
178
- 1. Inscribe it as a Synapse rune (`synapse_inscribe`)
178
+ 1. Record it with `kenaz learn add` (or a native memory file)
179
179
  2. Promote it to a lesson guard:
180
180
  ```bash
181
181
  node .specialist/tools/lesson-guard.js promote \
182
182
  --lesson="<lesson text>" \
183
183
  --phases="[1,2,3]" \
184
- --source=synapse \
185
- --source-id="<rune_id>"
184
+ --source=manual
186
185
  ```
187
186
  3. In future sessions, when the phase output includes `lesson_guards`, apply them
188
187
  4. If the guard actually changed a decision, record it:
@@ -27,7 +27,7 @@
27
27
  "GuardSource": {
28
28
  "type": "string",
29
29
  "enum": ["synapse", "muninn", "manual"],
30
- "description": "Origin of the reflection that was promoted. 'synapse' = Synapse rune (synapse_inscribe output); 'muninn' = Muninn episodic memory lesson field; 'manual' = direct specialist or human input with no structured source."
30
+ "description": "Origin of the reflection that was promoted. 'synapse' = legacy value for a lesson that came from the retired Synapse rune store; 'muninn' = Muninn episodic memory lesson field; 'manual' = direct specialist or human input with no structured source."
31
31
  },
32
32
  "GuardStatus": {
33
33
  "type": "string",
@@ -137,15 +137,15 @@ prophecy_over_trial:
137
137
  傳統開發是「試錯法」:寫 → 報錯 → 修。
138
138
  callers/references 讓 Agent 進入「先驗時代」:修改前沿呼叫鏈跑完因果路徑,
139
139
  在構思階段就看到爆炸半徑、跨模組風險、歷史踩坑 — 未發生的 Bug 可以被預言。
140
- 多方案時,對每個方案的目標 symbol 各跑一次 kenaz_lsp_callers + synapse_recall,用結構數據比較 — 不靠直覺選方案。
140
+ 多方案時,對每個方案的目標 symbol 各跑一次 kenaz_lsp_callers + kenaz_lsp_references,用結構數據比較 — 不靠直覺選方案。
141
141
  applies_to:
142
- - "方案選擇:2+ 實作路徑 → 各跑 callers+recall → 比較爆炸半徑/跨模組/歷史風險 → 選風險最低的"
143
- - "Bug 修復:2+ 可能修改點 → 各跑 callers+recall → 比較影響範圍 → 選侵入性最小的"
144
- - "新功能放置:不確定放在哪個模組 → 各跑 callers+recall → 比較模組耦合度 → 選最自然的"
145
- - "重構決策:多種重構路徑 → 各跑 callers+recall → 比較 caller 數 → 選破壞最小的"
142
+ - "方案選擇:2+ 實作路徑 → 各跑 callers+references → 比較爆炸半徑/跨模組/歷史風險 → 選風險最低的"
143
+ - "Bug 修復:2+ 可能修改點 → 各跑 callers+references → 比較影響範圍 → 選侵入性最小的"
144
+ - "新功能放置:不確定放在哪個模組 → 各跑 callers+references → 比較模組耦合度 → 選最自然的"
145
+ - "重構決策:多種重構路徑 → 各跑 callers+references → 比較 caller 數 → 選破壞最小的"
146
146
  protocol:
147
147
  step_1: "識別 — 偵測到 2+ 競爭方案(方案選擇、修改點選擇、模組放置)"
148
- step_2: "查影響 — 對每個方案的目標 symbol 各跑 kenaz_lsp_callers + synapse_recall"
148
+ step_2: "查影響 — 對每個方案的目標 symbol 各跑 kenaz_lsp_callers + kenaz_lsp_references"
149
149
  step_3: "比較 — 結構化對比 caller 數、跨模組數、known_risks"
150
150
  step_4: "選擇 — 用結構數據選方案,不靠推斷。相近時列出 trade-off 讓用戶決定"
151
151
  relationship_to_ddx: |
@@ -69,3 +69,13 @@ test('REA node floor: 22.19 / 24.11 / 26+, not 23 or 25', () => {
69
69
  const s = { installed: false, declined: false, nodeOk: false };
70
70
  assert.match(rea.reaBannerLine(s), /upgrade Node first/);
71
71
  });
72
+
73
+ test('setup suggestion names the detected clients (an agent-run setup with no client installs nothing)', (t) => {
74
+ const s = sandbox(t);
75
+ assert.equal(rea.detectRea({ home: s.home, projectPath: s.proj, env: s.env }).setupCmd, 'npx rea-agents setup');
76
+ write(path.join(s.home, '.claude.json'), '{}');
77
+ fs.mkdirSync(path.join(s.home, '.codex'));
78
+ const d = rea.detectRea({ home: s.home, projectPath: s.proj, env: s.env });
79
+ assert.equal(d.setupCmd, 'npx rea-agents setup --client claude_code --client codex --yes');
80
+ assert.match(rea.reaBannerLine(d), /--client claude_code --client codex --yes/);
81
+ });