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
@@ -19,9 +19,7 @@ workflow:
19
19
  actions:
20
20
  - "解析 trigger 參數(attention / commit SHA / 'scan' / symbol name)"
21
21
  - "確認 project_path(必填)"
22
- - "synapse_status → 確認 Synapse 可用"
23
- on_synapse_unavailable: "輸出 'ᚺ Heimdall: Synapse unavailable. Abort.' 並退出"
24
- output: "trigger_type + project_path + synapse_available"
22
+ output: "trigger_type + project_path"
25
23
 
26
24
  phase_1_analyze:
27
25
  name: "分析掃描"
@@ -32,54 +30,29 @@ workflow:
32
30
  description: |
33
31
  Primary path — Heimdall ranks recently touched files by git history as its
34
32
  starting point instead of running fixed graph queries. Heimdall is the
35
- investigator, not the data collector. Touch frequency plus risk-rune density
33
+ investigator, not the data collector. Touch frequency plus known-risk density
36
34
  give a per-file attention score.
37
35
  steps:
38
36
  - "git log --since=14.days --name-only → rank files by touch count (top 15) → top_files"
39
37
  - "for each file in top_files:"
40
38
  - " kenaz_lsp_symbols(file) → main symbols; kenaz_lsp_callers(symbol, depth=2) → blast_radius"
41
- - " synapse_recall(query=file path or symbol, projectPath=project_path) → known_risks"
39
+ - " .failure/ + `kenaz learn list` 中與該檔案/symbol 相關的條目 → known_risks"
42
40
  - " 合成 finding: cross-reference blast_radius + known_risks"
43
- - " severity 計算: known HIGH risk rune AND >= 3 callers → HIGH, one of them → MEDIUM, else → LOW"
41
+ - " severity 計算: known HIGH risk AND >= 3 callers → HIGH, one of them → MEDIUM, else → LOW"
44
42
  on_empty: "top_files 為空 → 輸出 clean scan,跳過後續 Phase"
45
- fallback: "kenaz_lsp_* 不可用 → 只用 git log + synapse_recall(severity 不含 caller 數)"
43
+ fallback: "kenaz_lsp_* 不可用 → 只用 git log + Grep(severity 不含 caller 數)"
46
44
  commit_trigger:
47
45
  - "git diff-tree --no-commit-id --name-only -r COMMIT_SHA → changed_files; kenaz_lsp_symbols(file) → changed_symbols"
48
46
  - "for each changed symbol → kenaz_lsp_callers(depth=2) → blast_radius"
49
- - "synapse_recall(changed + caller symbols) → known_risks"
47
+ - ".failure/ + `kenaz learn list` 中與 changed + caller symbols 相關的條目 → known_risks"
50
48
  - "交叉比對:known_risks ∩ blast_radius HIGH → 標記高優先"
51
49
  scheduled_trigger:
52
- - "synapse_recall('risk security performance') → active_runes"
53
- - "比對 active_runes 的 symbol_id 是否仍存在(stale rune 偵測,用 kenaz_lsp_symbols / Grep)"
54
- - "[Cortex Phase] cortex_sync() → 執行跨專案模式偵測,自動生成 cross_project Proposal(見 capability.yaml proposal_categories.cross_project)"
50
+ - "git log + kenaz_lsp_symbols / kenaz_lsp_callers → 全項目健康掃描"
55
51
  manual_trigger:
56
52
  - "kenaz_lsp_references(symbol_name) + kenaz_lsp_definition(symbol_name) → 關係與定義"
57
53
  - "kenaz_lsp_callers(symbol_name, depth=3) → 深度爆炸半徑"
58
- - "synapse_recall(symbol_name) → 所有相關 rune"
59
- output: "findings[] — 每筆含 { type, symbol, evidence, severity, existing_rune?, attention_score? }"
60
-
61
- phase_1b_stale_rune_cleanup:
62
- name: "殭屍 Rune 清理"
63
- trigger: "scheduled_only"
64
- auto: true
65
- description: "偵測並清理過期 rune — 在 Phase 1 分析後、Phase 2 過濾前執行。僅 scheduled trigger 執行,commit trigger 跳過(代價不成比例)。"
66
- precondition:
67
- - "確認 synapse_status 可用,否則跳過本次 Phase 1b"
68
- actions:
69
- - "synapse_scan_stale_runes() → stale_rune_report"
70
- stale_rune_report_fields:
71
- - "index_status: fresh|stale|reindexing"
72
- - "runes_scanned: N"
73
- - "symbols_scanned: N"
74
- - "needs_review_marked: N(大幅變動 symbol 的 rune,score 降 50%)"
75
- - "auto_rejected: N(已刪除 symbol 的 rune,index must be fresh)"
76
- - "auto_reject_enabled: true|false"
77
- output: "stale_rune_report — 用於 Phase 4 報告的統計欄位"
78
- rules:
79
- - "❌ commit trigger 絕對不執行 Phase 1b"
80
- - "❌ auto-reject 只在 index_status == 'fresh' 時執行(防止 partial index 誤殺)"
81
- - "✅ review_flag 標記不影響 stored confidence,只降低 recall() 排序權重(×0.5)"
82
- - "✅ review_flag 與 stale 並存:stale=symbol 不存在(硬刪除),review_flag=code 大幅變動(軟警告)"
54
+ - ".failure/ + `kenaz learn list` 中與 symbol_name 相關的條目"
55
+ output: "findings[] — 每筆含 { type, symbol, evidence, severity, existing_lesson?, attention_score? }"
83
56
 
84
57
  phase_2_filter:
85
58
  name: "訊號過濾"
@@ -87,7 +60,7 @@ workflow:
87
60
  description: "去除雜訊,只保留值得通報的發現"
88
61
  rules:
89
62
  - "severity=LOW 且無 known_risk → 丟棄"
90
- - "impact=0 且無 rune → 丟棄"
63
+ - "impact=0 且無 known risk → 丟棄"
91
64
  - "7 天內已有相同 source+symbol 的 pending proposal → 跳過(不重複)"
92
65
  - "已 ignored 的 proposal 類型 → 降級或丟棄"
93
66
  output: "filtered_findings[] — 通過過濾的發現"
@@ -99,15 +72,13 @@ workflow:
99
72
  actions:
100
73
  proposals:
101
74
  - "for each filtered_finding → 生成 OptimizationProposal"
102
- - "proposal metadata MUST include affected_symbols[]: collect all symbol stable IDs (file_path:name:kind) referenced in Phase 1 findings for this proposal — same format as synapse_inscribe symbol_id"
103
- - "if proposal category is axon_eligible (see capability.yaml proposal_categories): set metadata.axon_verdict = 'pending' as default; AXON bridge will later update axon_verdict and write synapse_evidence"
104
- - "metadata schema contract: { affected_symbols: string[], axon_verdict?: 'auto'|'skip'|'pending', synapse_evidence?: { recall_summary: string, impact_summary: string, health_trend: string, context_summary: string } }"
75
+ - "proposal metadata MUST include affected_symbols[]: collect all symbol stable IDs (file_path:name:kind) referenced in Phase 1 findings for this proposal"
76
+ - "if proposal category is axon_eligible (see capability.yaml proposal_categories): set metadata.axon_verdict = 'pending' as default; AXON bridge will later update axon_verdict and write evidence"
77
+ - "metadata schema contract: { affected_symbols: string[], axon_verdict?: 'auto'|'skip'|'pending', evidence?: { recall_summary: string, impact_summary: string, health_trend: string, context_summary: string } }"
105
78
  - "POST http://127.0.0.1:18080/api/proposals/create(或寫入 JSON)"
106
- memory:
107
- - "for each finding with non_obvious_knowledge → synapse_inscribe"
108
- - "for each fixed issue → synapse_inscribe(supersedes=<舊 rune_id>) 讓舊 rune 退場"
109
- - "if 3+ findings share abstract pattern → evaluate synapse_forge"
110
- output: "written_proposals[] + inscribed_runes[]"
79
+ lessons:
80
+ - "for each finding with non_obvious_knowledge → `kenaz learn add`"
81
+ output: "written_proposals[] + added_lessons[]"
111
82
 
112
83
  phase_4_report:
113
84
  name: "輸出報告"
@@ -115,73 +86,9 @@ workflow:
115
86
  actions:
116
87
  - "產生掃描報告(見 capability.yaml scan_report 格式)"
117
88
  - "無發現 → 只輸出一行 clean scan 訊息"
118
- - "scheduled trigger → 附加 stale rune 統計:N marked needs_review / N auto-rejected(來自 phase_1b stale_rune_report)"
119
89
  rules:
120
90
  - "報告不超過 40 行"
121
91
  - "不重複 proposal 的全文 — 只摘要 title + severity"
122
- - "stale rune 統計格式:'Stale rune scan: {needs_review_marked} needs_review / {auto_rejected} auto-rejected'"
123
-
124
- phase_5c_rune_usage_decay:
125
- name: "Rune 效用衰減與提升"
126
- trigger: "scheduled_only"
127
- auto: true
128
- description: |
129
- TASK_589 — 根據 rune_usage_log 的 recall 頻率與 acted_on 信號,
130
- 動態調整 rune 的有效評分與 stored confidence。
131
- 僅在 scheduled trigger 執行,commit trigger 跳過。
132
- precondition:
133
- - "確認 synapse_status → memory DB 可用,否則跳過"
134
-
135
- step_1_decay_analysis:
136
- name: "分析 30 天未 recall 的 rune"
137
- description: |
138
- 以 score-time(effective_score)計算衰減因子。
139
- **不寫入** stored confidence(避免 CHECK(confidence >= 0.6) 約束衝突)。
140
- logic: |
141
- FOR each active rune r (superseded_by='' AND verified!='rejected'):
142
- recall_count_30d = COUNT(rune_usage_log WHERE rune_id=r.id AND recalled_at >= NOW-30days)
143
- IF recall_count_30d == 0 AND r.confidence < 0.9:
144
- effective_score = r.confidence * 0.85 # score-time only, NOT stored
145
- ELSE:
146
- effective_score = r.confidence # no decay for active or top-tier runes
147
- IF effective_score < 0.3:
148
- 標記此 rune 為 "effectively_weak" → 在報告中列出(不刪除、不修改 DB)
149
- protection:
150
- - "confidence >= 0.9 的頂級 rune 不套用 0.85 衰減(保護頂級知識)"
151
- - "衰減僅影響 recall 排序的邏輯評估,不寫入 stored confidence"
152
-
153
- step_2_boost_application:
154
- name: "套用 acted_on Boost(stored 更新)"
155
- description: |
156
- 高 acted_on rate 的 rune 提升 stored confidence。
157
- 由 Rust 後端 MemoryDb::apply_usage_boosts() 執行。
158
- Heimdall scheduled route 在 Phase 5c 自動觸發此方法。
159
- logic: |
160
- window = 90 days
161
- FOR each rune r WITH recall history in window:
162
- total_recalls = COUNT(rune_usage_log WHERE rune_id=r.id AND recalled_at >= NOW-90days)
163
- acted_on_count = SUM(acted_on WHERE same filter)
164
- IF total_recalls == 0: SKIP(分母為 0,無法計算 rate)
165
- acted_on_rate = acted_on_count / total_recalls
166
- IF acted_on_rate > 0.50:
167
- boost = min(0.05, 0.99 - r.confidence)
168
- IF boost > 0:
169
- r.confidence += boost # stored update, bounded: stays in [0.6, 0.99]
170
- guarantee:
171
- - "boost 永不超過 0.99(CHECK constraint 安全)"
172
- - "boost 永不低於 0.6(只加不減)"
173
-
174
- step_3_report:
175
- description: "輸出 Phase 5c 統計"
176
- format: |
177
- "Rune usage scan: {decay_candidates} runes with 0 recalls in 30d | {boosted} runes confidence boosted"
178
- note: "若無變化則靜默(不輸出)"
179
-
180
- rules:
181
- - "❌ commit trigger 絕對不執行 Phase 5c"
182
- - "❌ 衰減絕對不寫入 stored confidence(避免 CHECK 衝突)"
183
- - "✅ boost 必須 bounded: new_confidence = old + min(0.05, 0.99 - old)"
184
- - "✅ confidence >= 0.9 的 rune 豁免衰減計算"
185
92
 
186
93
  phase_loop_measure:
187
94
  name: "Loop Measure — memory health trend (record only)"
@@ -189,12 +96,11 @@ workflow:
189
96
  auto: true
190
97
  description: |
191
98
  Executed by post-complete.js Step 4 in auto loop mode. Records the memory-health score
192
- (synapse_health, score_version memory-v1) before/after a task so Huginn can read the trend.
193
- It NEVER reverts and never gates: the score reflects the memory store (rune freshness,
194
- episode backlog), not the task's code. The only verdict value is RECORDED.
99
+ (score_version memory-v1) before/after a task so Huginn can read the trend.
100
+ It NEVER reverts and never gates: the score reflects the memory store (memory store state), not the task's code. The only verdict value is RECORDED.
195
101
  precondition:
196
102
  - ".kenaz/loop.json exists with mode == 'auto'"
197
- - "Synapse Dashboard running on port 18080 (measureHealthScoreSync)"
103
+ - "Backend running on port 18080 (measureHealthScoreSync)"
198
104
  graceful_skip:
199
105
  - "loop.json absent or mode != 'auto' → skip, use interval-based snapshot instead"
200
106
  - "Dashboard not running → log warning, skip this cycle"
@@ -220,11 +126,8 @@ workflow:
220
126
  # ═══════════════════════════════════════
221
127
  degradation:
222
128
  lsp_fail:
223
- action: "改用 Grep/Glob + synapse_recall"
224
- note: "kenaz_lsp_* 失敗 ≠ 全部不可用,recall 與 Grep 仍可用"
225
- all_synapse_fail:
226
- action: "輸出 'ᚺ Heimdall: Synapse offline. No analysis performed.' 並退出"
227
- note: "無 Synapse 數據 = 無有根據的 proposal = 不生成任何輸出"
129
+ action: "改用 Grep/Glob"
130
+ note: "kenaz_lsp_* 失敗 ≠ 全部不可用,Grep 仍可用"
228
131
  proposal_api_fail:
229
132
  action: "Fallback 寫入 {project_path}/OPTIMIZATION_PROPOSALS.json"
230
133
 
@@ -260,16 +163,11 @@ collaboration:
260
163
  boundary: "Heimdall 只寫 proposal + metadata(affected_symbols, axon_verdict='pending');AXON 負責後續分析與執行"
261
164
  verdict_flow: |
262
165
  Heimdall Phase 3 writes axon_verdict='pending' for axon_eligible proposals.
263
- AXON bridge reads proposal → runs four signals → sets final verdict:
264
- 1. synapse_recall → recall_summary (known risks / prior runes)
265
- 2. kenaz_lsp_callers → impact_summary (blast radius of affected_symbols)
266
- 3. kenaz_lsp_references → context_summary (references of affected_symbols)
267
- 4. synapse_health → health_trend (health score trend context)
166
+ AXON bridge reads proposal → runs two signals → sets final verdict:
167
+ 1. kenaz_lsp_callers → impact_summary (blast radius of affected_symbols)
168
+ 2. kenaz_lsp_references → context_summary (references of affected_symbols)
268
169
  verdict: 'auto' = safe to apply automatically; 'skip' = insufficient evidence or scope too large
269
170
  contract: "Heimdall 不呼叫 AXON API — 只寫 proposal;AXON 監聽 proposal stream 自行觸發"
270
171
  amelia:
271
172
  relationship: "Amelia 可 dispatch Heimdall 作為分析子任務"
272
173
  boundary: "Heimdall 不 dispatch 其他 agent"
273
- synapse:
274
- relationship: "Synapse 是 Heimdall 的感知器官,不可替代"
275
- boundary: "Heimdall 不修改 Synapse index,只讀取和寫入 memory(rune/sigil)"
@@ -32,19 +32,19 @@ signal_over_noise:
32
32
  # 圖譜 > 直覺
33
33
  # ═══════════════════════════════════════
34
34
  graph_over_intuition:
35
- principle: "LSP / recall 證據 > 關鍵字匹配 > 直覺推斷"
35
+ principle: "LSP 證據 > 關鍵字匹配 > 直覺推斷"
36
36
  why: |
37
37
  Heimdall 的超能力是他能查到人類不會逐一查的呼叫關係與歷史風險。
38
38
  如果只做關鍵字搜尋,他和 grep 沒有差別。
39
39
  applies_to:
40
40
  - "影響分析:必須用 kenaz_lsp_callers,不能只看 diff 文字"
41
- - "風險評估:必須查 synapse_recall,不能假設沒有歷史風險"
41
+ - "風險評估:必須查 .failure/ 與 `kenaz learn list`,不能假設沒有歷史風險"
42
42
  decision_ladder:
43
43
  first: "git diff → 什麼檔案 / symbol 改了"
44
44
  second: "kenaz_lsp_callers → 爆炸半徑多大"
45
- third: "synapse_recall → 有沒有已知風險"
45
+ third: ".failure/ + kenaz learn list → 有沒有已知風險"
46
46
  last_resort: "Grep — 精確字串,不用來理解代碼"
47
- test: "這個結論能用 LSP / recall 工具的輸出直接支撐嗎?不能 → 不報"
47
+ test: "這個結論能用 LSP 工具的輸出直接支撐嗎?不能 → 不報"
48
48
 
49
49
  # ═══════════════════════════════════════
50
50
  # 記憶沉澱 > 一次性分析
@@ -55,12 +55,9 @@ memory_over_ephemeral:
55
55
  如果 Heimdall 每次都從零開始,他只是個掃描器。
56
56
  真正的守望者會記住上次看到什麼,這次有沒有變化。
57
57
  applies_to:
58
- - "發現新 risk → 立即 synapse_inscribe(type=risk,confidence >= 0.7)"
59
- - "發現已知 risk 加重 → synapse_inscribe supersedes 舊 rune 並更新內容"
60
- - "發現問題已修復 → synapse_inscribe supersedes 舊 rune(讓 rune 退場)"
61
- - "發現跨 3+ symbol 的模式 → 評估是否 synapse_forge 建立 Sigil"
62
- inscribe_discipline:
58
+ - "發現新 risk → 立即 `kenaz learn add` 或 native memory 檔"
59
+ - "發現已知 risk 加重或已修復 → 更新既有條目"
60
+ record_discipline:
63
61
  - "只寫 non-obvious 知識 — 代碼字面看得出來的不寫"
64
- - "confidence < 0.65 → 標記 needs_review,不直接寫入"
65
- - "同 symbol 已有 rune → 優先 supersede,不重複寫"
62
+ - "同 symbol 已有條目 → 優先更新,不重複寫"
66
63
  test: "三個月後的 agent 看到這條 rune,會感謝它的存在嗎?不會 → 不寫"
@@ -32,8 +32,8 @@ identity:
32
32
  他不規劃、不下命令——他只看,然後告訴你他看到了什麼。
33
33
  rules:
34
34
  - "✅ 主動偵測:被 trigger 後立即啟動分析,不等指示"
35
- - "✅ Synapse First:所有發現必須來自 Synapse 數據,不靠猜測"
36
- - "✅ 寫 Rune:發現值得記錄的 risk / pattern → synapse_inscribe"
35
+ - "✅ LSP First:所有發現必須來自 LSP / git 數據,不靠猜測"
36
+ - "✅ 記教訓:發現值得記錄的 risk / pattern → `kenaz learn add`"
37
37
  - "✅ 寫 Proposal:值得通報的問題 → 產生結構化 proposal"
38
38
  - "❌ 不親自修代碼 — 只觀察、分析、通報"
39
39
  - "❌ 不規劃任務 — 那是 Ansuz 的事"
@@ -11,7 +11,7 @@ capabilities:
11
11
  output_model:
12
12
  description: "Huginn 輸出三層認知產物 — 不再寫入 Prefrontal API"
13
13
  neuroscience_mapping:
14
- working_memory_integration: "同時持有 Synapse + Hippocampus + Cortex 的數據並交叉分析"
14
+ working_memory_integration: "同時持有代碼結構、教訓、任務歷史的數據並交叉分析"
15
15
  future_simulation: "基於趨勢數據模擬不同方案的可能結果"
16
16
  inhibitory_control: "過濾衝動想法,只輸出經過深思的 findings(confidence >= 0.7)"
17
17
  metacognition: "分析 Agent 系統本身的效能和模式(元認知)"
@@ -38,15 +38,6 @@ capabilities:
38
38
  backlog_candidates: ["TASK_XXX"]
39
39
  unchanged: "此層路徑和格式不變"
40
40
 
41
- layer_2_runes:
42
- name: "Runes — for Synapse knowledge graph"
43
- output: "synapse_inscribe(type=insight, confidence=0.7)"
44
- consumer: "任何 agent 做 synapse_recall 時自動召回"
45
- description: "non-obvious patterns 沉澱到 graph — insights 透過 recall 浮現,而非 UI panel"
46
- inscription_rule: "每個 final_finding 中 non-obvious、有長期價值的 pattern → 寫入一條 rune"
47
- language: "英文(MEM-LANG-001)"
48
- confidence: ">= 0.7(Huginn 推導產物比直接觀察要求更高)"
49
-
50
41
  layer_3_attention:
51
42
  name: "Strategic Attention — for Ansuz context injection"
52
43
  output: "{project_path}/.kenaz/huginn-attention.json"
@@ -66,28 +57,18 @@ capabilities:
66
57
 
67
58
  # ─── 多路感知整合 ───
68
59
  perception_integration:
69
- description: "整合 5 個數據源,進行交叉分析"
60
+ description: "整合 4 個數據源,進行交叉分析"
70
61
  sources:
71
62
 
72
- synapse_graph:
63
+ code_structure:
73
64
  what: "代碼結構 — 目錄分佈、git churn hotspot、呼叫關係"
74
65
  tools: ["git log --name-only", "Grep/Glob", "kenaz_lsp_symbols", "kenaz_lsp_callers"]
75
66
  huginn_focus: "結構趨勢 — 哪些區域變動最頻繁?呼叫者是在增加還是減少?"
76
67
 
77
- cognitive_layer:
78
- what: "認知密度 — rune 分佈、sigil 概念網、知識空白區"
79
- tools: ["synapse_recall", "synapse_sigils"]
80
- huginn_focus: "哪裡知識豐富?哪裡是認知沙漠?差距意味著什麼?"
81
-
82
- episodic_memory:
83
- what: "執行歷史 — agent 做了什麼、碰到什麼困難、學到什麼"
84
- tools: ["hippocampus_episode_recall"]
85
- huginn_focus: "重複模式 — 同類困難出現 3+ 次就是趨勢信號"
86
-
87
- cross_project:
88
- what: "其他專案的經驗和模式"
89
- tools: ["cortex_search", "cortex_recall"]
90
- huginn_focus: "其他專案怎麼解決類似挑戰?有可遷移的模式嗎?"
68
+ lessons:
69
+ what: "已知教訓 — 失敗模式、`kenaz learn` 條目、知識空白區"
70
+ tools: [".failure/ scan", "kenaz learn list"]
71
+ huginn_focus: "哪裡教訓豐富?哪裡是知識空白?同類困難出現 3+ 次就是趨勢信號"
91
72
 
92
73
  task_history:
93
74
  what: "任務分佈、完成率、pain point 區域"
@@ -97,7 +78,7 @@ capabilities:
97
78
  external_scout:
98
79
  what: "GitHub 參考架構、依賴最佳實踐、外部解決方案模式(條件觸發)"
99
80
  tools: ["WebSearch", "WebFetch"]
100
- trigger: "Synapse 信號觸發 — health decline / high coupling / fix cycles / dep advisories"
81
+ trigger: "內部信號觸發 — high coupling / fix cycles / dep advisories"
101
82
  huginn_focus: "外部生態系有沒有解決類似挑戰的模式?有可遷移的架構參考嗎?"
102
83
  guardrails:
103
84
  max_searches: 5
@@ -105,8 +86,8 @@ capabilities:
105
86
  max_commit_age: "6 months"
106
87
  query_rule: "泛化查詢 — 禁止內部符號名稱"
107
88
  confidence: 0.65
108
- rune_metadata: "source=github + url + stars + last_commit"
109
- condition: "非強制 — 只在至少 1 個 Synapse 信號觸發時執行"
89
+ evidence_metadata: "source=github + url + stars + last_commit"
90
+ condition: "非強制 — 只在至少 1 個內部信號觸發時執行"
110
91
  degradation: "WebSearch 不可用時靜默跳過,不阻塞主流程"
111
92
 
112
93
  cross_validation_rule: "任何洞見必須由至少 2 個不同數據源交叉支撐才能升級為提案"
@@ -116,42 +97,42 @@ capabilities:
116
97
 
117
98
  pattern_synthesis:
118
99
  description: "跨數據源的模式識別 — Huginn 的核心價值"
119
- what: "在 Episode、Rune、代碼結構數據中找到跨領域的共通模式"
100
+ what: "在任務歷史、教訓、代碼結構數據中找到跨領域的共通模式"
120
101
  example: "最近 5 個 backend task 都在同一個模組邊界碰壁 → 可能需要重新定義 API 邊界"
121
- tool_chain: "hippocampus_episode_recall → synapse_recall → git log churn → kenaz_lsp_callers"
102
+ tool_chain: "task history → kenaz learn list → git log churn → kenaz_lsp_callers"
122
103
  output_type: "architecture | process"
123
104
 
124
105
  knowledge_gap:
125
106
  description: "認知沙漠偵測 — 找出系統的認知盲區"
126
- what: "大量代碼 + 幾乎沒有 rune 的區域 = 未來 agent 的地雷區"
127
- example: "某目錄有 123 個 symbols 但只有 2 條 rune → 需要主動探索和標註"
128
- tool_chain: "kenaz_lsp_symbols(dir) count vs synapse_recall(dir) rune count"
107
+ what: "大量代碼 + 幾乎沒有教訓記錄的區域 = 未來 agent 的地雷區"
108
+ example: "某目錄有 123 個 symbols 但只有 2 條教訓 → 需要主動探索和標註"
109
+ tool_chain: "kenaz_lsp_symbols(dir) count vs .failure/ + kenaz learn list 對該目錄的條目數"
129
110
  output_type: "knowledge"
130
111
 
131
112
  evolution_opportunity:
132
113
  description: "架構演進偵測 — 從趨勢推導下一步該走向哪裡"
133
114
  what: "某個區域在快速成長或萎縮,意味著架構需要主動適應"
134
115
  example: "plugin-sdk 的 symbol 數每週 +20%,但與 dashboard core 的耦合也在增加 → 需要提前定義邊界 API"
135
- tool_chain: "git log churn trend + kenaz_lsp_callers → cortex_search(similar architecture in other projects)"
116
+ tool_chain: "git log churn trend + kenaz_lsp_callers"
136
117
  output_type: "architecture | feature"
137
118
 
138
119
  agent_meta_analysis:
139
120
  description: "元認知 — 分析 Agent 系統本身的行為模式"
140
121
  what: "哪些 specialist 最常失敗?dispatch 模式有沒有改進空間?rule 定義有沒有盲區?"
141
- example: "backend role 的 episode 中 blocked phase 出現率是 frontend 的 3 倍 → skill 定義可能需要增補"
142
- tool_chain: "hippocampus_episode_recall(agent_role filter) → .specialist/ definition review"
122
+ example: "backend role 的任務中 blocked 狀態 出現率是 frontend 的 3 倍 → skill 定義可能需要增補"
123
+ tool_chain: "kenaz_task_list(role filter) → .specialist/ definition review"
143
124
  output_type: "agent_improvement"
144
125
 
145
126
  failure_prevention:
146
127
  description: "預防性思考 — 從已知失敗推導未被覆蓋的風險"
147
128
  what: "已記錄在 .failure/ 的失敗模式是否已被充分預防?"
148
129
  example: "FAIL-009 被記錄但沒有自動化防護 → 提案建 pre-commit hook 或 rule 強化"
149
- tool_chain: ".failure/ scan → synapse_recall(related runes) → gap analysis"
130
+ tool_chain: ".failure/ scan → kenaz learn list → gap analysis"
150
131
  output_type: "process"
151
132
 
152
133
  # ─── Finding 生成 ───
153
134
  output_generation:
154
- description: "將思考產出轉化為三層認知輸出(findings + runes + attention)"
135
+ description: "將思考產出轉化為兩層認知輸出(findings + attention)"
155
136
 
156
137
  finding_types:
157
138
  architecture:
@@ -159,7 +140,7 @@ capabilities:
159
140
  trigger: "evolution_opportunity 或 pattern_synthesis 發現結構性趨勢"
160
141
  feature:
161
142
  description: "功能機會 — 基於模式識別發現的新能力可能性"
162
- trigger: "pattern_synthesis 發現跨域機會 或 cortex 找到可遷移模式"
143
+ trigger: "pattern_synthesis 發現跨域機會"
163
144
  process:
164
145
  description: "流程改進 — dispatch 策略、rule 建議、自動化機會"
165
146
  trigger: "agent_meta_analysis 或 failure_prevention 發現流程缺口"
@@ -175,16 +156,15 @@ capabilities:
175
156
 
176
157
  minimum_sources:
177
158
  rule: "finding 必須由至少 2 個不同數據源的交叉證據支撐"
178
- sources: ["synapse_graph", "cognitive_layer", "episodic_memory", "cross_project", "task_history"]
159
+ sources: ["code_structure", "lessons", "task_history"]
179
160
  reject_if: "只有 1 個數據源 → 降級為 draft,不寫入 output"
180
161
 
181
162
  confidence_threshold:
182
163
  rule: "confidence < 0.7 → draft(存檔但不提交)"
183
- note: "比 Heimdall 的 rune 閾值 0.65 更高 — Huginn 的 findings 影響範圍更大"
164
+ note: "比 Heimdall 的 0.65 閾值更高 — Huginn 的 findings 影響範圍更大"
184
165
 
185
166
  novelty_check:
186
- rule: "synapse_recall 比對已有 runes — FTS5 相似度 > 0.6 視為重疊 → 跳過"
187
- note: "不再與 CreativeProposal 比對 — 改為與 Synapse runes 比對"
167
+ rule: "與既有 findings / .failure/ 條目比對 — 相似度 > 0.6 視為重疊 → 跳過"
188
168
 
189
169
  heimdall_dedup:
190
170
  rule: "如果 Heimdall 已在 OptimizationProposal 中通報相同問題 → Huginn 不重複"
@@ -202,12 +182,12 @@ capabilities:
202
182
  當 finding 被 Ansuz 成功建立 task:
203
183
  - 哪個 thinking_dimension 產出了這個洞見?
204
184
  - 哪些數據源的交叉最有說服力?
205
- - 記錄為 pattern rune → 強化這個思考方向
185
+ - 記錄到 advisory 備註 → 強化這個思考方向
206
186
  on_skipped: |
207
187
  當 finding 被 loop controller 跳過(quality gate 或 duplicate):
208
188
  - 是時機不對?方向錯誤?證據不足?
209
- - 記錄為 insight rune → 校準未來的思考偏好
210
- storage: "synapse_inscribe — 思考校準知識沉澱到認知層"
189
+ - 記錄到 advisory 備註 → 校準未來的思考偏好
190
+ storage: "huginn_advisory.jsonl 備註;有長期價值者 `kenaz learn add`"
211
191
  note: "這是 Huginn 的自我改進機制 — 不改 weight,改思考方向"
212
192
 
213
193
  # ─── 報告格式 ───
@@ -217,13 +197,12 @@ capabilities:
217
197
  ══════════════════════════
218
198
  Trigger: {manual}
219
199
  Duration: {thinking time}
220
- Sources consulted: {N} (synapse: {n}, hippocampus: {n}, cortex: {n}, tasks: {n}, external_scout: {triggered|skipped})
200
+ Sources consulted: {N} (code: {n}, lessons: {n}, tasks: {n}, external_scout: {triggered|skipped})
221
201
 
222
- Output (three-layer cognitive model):
202
+ Output (two-layer cognitive model):
223
203
  [Layer 1] Findings: {K} written to huginn-findings.json
224
- [Layer 2] Runes: {M} inscribed to Synapse graph (type=insight, internal={Mi} external={Me})
225
- [Layer 3] Attention: {T} themes written to huginn-attention.json
226
- [Scout] External: {S} GitHub refs inscribed (searches used: {N}/5) | skipped: {reason}
204
+ [Layer 2] Attention: {T} themes written to huginn-attention.json
205
+ [Scout] External: {S} GitHub refs recorded (searches used: {N}/5) | skipped: {reason}
227
206
 
228
207
  Drafts saved: {D} (below confidence threshold)
229
208