kenaz 0.3.10 → 0.3.11
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.
- package/core/.claude/skills/code_reviewer/SKILL.md +0 -1
- package/core/.claude/skills/code_reviewer/patterns.yaml +0 -8
- package/core/.claude/skills/dev_agent/SKILL.md +3 -6
- package/core/.claude/skills/heimdall/SKILL.md +5 -6
- package/core/.claude/skills/huginn/SKILL.md +11 -38
- package/core/.collaboration/core/task-api.js +2 -218
- package/core/.collaboration/core/task-api.test.js +1 -138
- package/core/.formation/bifrost/launch.js +2 -2
- package/core/.formation/bifrost/launch.test.js +2 -2
- package/core/.formation/bifrost/shared/ansuz-boot-policy.js +3 -3
- package/core/.formation/bifrost/shared/codex-injection.js +3 -17
- package/core/.formation/bifrost/shared/consolidate.js +1 -51
- package/core/.formation/bifrost/sync.js +4 -5
- package/core/.formation/tools/__tests__/subagent-bifrost-guard.test.js +1 -1
- package/core/.formation/tools/dispatch.js +2 -2
- package/core/.formation/tools/kenaz-stats.js +1 -1
- package/core/.formation/tools/mcp-allowlist.test.js +5 -3
- package/core/.formation/tools/post-complete/bounded-http.js +1 -40
- package/core/.formation/tools/post-complete/bounded-http.test.js +2 -89
- package/core/.formation/tools/post-complete/cognitive.js +2 -119
- package/core/.formation/tools/post-complete/testing.js +3 -21
- package/core/.formation/tools/post-complete.js +2 -428
- package/core/.formation/tools/post-complete.test.js +0 -135
- package/core/.formation/tools/route-audit.test.js +8 -20
- package/core/.rule/INDEX.yaml +3 -3
- package/core/.rule/general/ddx-synapse-stack.yaml +11 -11
- package/core/.rule/general/specialist-identity-contract.yaml +5 -5
- package/core/.rule/general/synapse-code-intelligence.yaml +25 -111
- package/core/.rule/general/worktree-isolation.yaml +2 -2
- package/core/.rule/pipeline/task-execution.yaml +6 -9
- package/core/.specialist/Amelia/README.md +5 -5
- package/core/.specialist/Amelia/capability.yaml +10 -18
- package/core/.specialist/Amelia/knowledge.yaml +15 -66
- package/core/.specialist/Amelia/workflow.yaml +12 -21
- package/core/.specialist/Ansuz/capability.yaml +12 -87
- package/core/.specialist/Ansuz/concepts/autonomous_agenda.yaml +1 -1
- package/core/.specialist/Ansuz/concepts/autonomy_contract.yaml +2 -3
- package/core/.specialist/Ansuz/concepts/capability_pointers.yaml +1 -3
- package/core/.specialist/Ansuz/concepts/cognitive_fluency_contract.yaml +8 -21
- package/core/.specialist/Ansuz/concepts/cognitive_systems_overview.yaml +0 -4
- package/core/.specialist/Ansuz/concepts/cognitive_systems_turn_context.yaml +1 -1
- package/core/.specialist/Ansuz/concepts/completion_tracking.yaml +0 -1
- package/core/.specialist/Ansuz/concepts/deep_knowledge_pointers.yaml +0 -3
- package/core/.specialist/Ansuz/concepts/evolvable_guardrails.yaml +3 -3
- package/core/.specialist/Ansuz/concepts/fatigue_handoff.yaml +1 -7
- package/core/.specialist/Ansuz/concepts/guardrails_immutable.yaml +3 -4
- package/core/.specialist/Ansuz/concepts/identity.yaml +1 -2
- package/core/.specialist/Ansuz/concepts/phase9_verification.yaml +0 -1
- package/core/.specialist/Ansuz/concepts/phase_protocol.yaml +3 -4
- package/core/.specialist/Ansuz/core.yaml +3 -6
- package/core/.specialist/Ansuz/elixir.yaml +6 -6
- package/core/.specialist/Ansuz/exo_cortex_tools.yaml +5 -9
- package/core/.specialist/Ansuz/guards/blind_spot_guards.yaml +2 -2
- package/core/.specialist/Ansuz/guards/lesson_guards.yaml +6 -19
- package/core/.specialist/Ansuz/identity_contract.yaml +4 -4
- package/core/.specialist/Ansuz/knowledge.yaml +13 -40
- package/core/.specialist/Ansuz/modules/ddx.yaml +2 -2
- package/core/.specialist/Ansuz/modules/prophecy.yaml +19 -19
- package/core/.specialist/Ansuz/modules/pulse_empty.yaml +6 -17
- package/core/.specialist/Ansuz/tools/ansuz-handoff-snapshot.js +3 -102
- package/core/.specialist/Ansuz/tools/ansuz-sdk-runner.js +2 -44
- package/core/.specialist/Ansuz/workflow.yaml +32 -76
- package/core/.specialist/Forseti/core.yaml +2 -7
- package/core/.specialist/Forseti/rule.yaml +1 -1
- package/core/.specialist/Heimdall/SKILL.md +2 -3
- package/core/.specialist/Heimdall/capability.yaml +22 -45
- package/core/.specialist/Heimdall/core.yaml +24 -126
- package/core/.specialist/Heimdall/principles.yaml +8 -11
- package/core/.specialist/Heimdall/rule.yaml +2 -2
- package/core/.specialist/Huginn/capability.yaml +31 -52
- package/core/.specialist/Huginn/core.yaml +43 -123
- package/core/.specialist/Huginn/principles.yaml +5 -5
- package/core/.specialist/Huginn/rule.yaml +3 -9
- package/core/.specialist/REFLECTION_TO_CONTROL.md +3 -4
- package/core/.specialist/shared/guard_schema.json +1 -1
- package/core/.specialist/shared/principles.yaml +6 -6
- package/core/.specialist/tools/phase-gate.js +10 -230
- package/core/.specialist/tools/phase-gate.test.js +2 -2
- package/core/.specialist/tools/prompt-files.test.js +1 -1
- package/core/.specialist/tools/session.js +2 -89
- package/core/.system/memory/README.md +3 -0
- package/core/CLAUDE.md +6 -7
- package/core/KENAZ_CORE_VERSION +1 -1
- package/core/dev/plans/CLI_FIRST_INSTALL_FLOW.md +26 -0
- package/core/plugins/kenaz/INVENTORY.md +1 -1
- package/core/plugins/kenaz/scripts/kenaz.test.js +2 -1
- package/core/plugins/kenaz/scripts/ygg.js +2 -0
- package/core/plugins/kenaz/skills/code_reviewer/SKILL.md +0 -1
- package/core/plugins/kenaz/skills/code_reviewer/patterns.yaml +0 -8
- package/core/plugins/kenaz/skills/dev_agent/SKILL.md +3 -6
- package/lib/cli.js +0 -2
- package/package.json +6 -6
- package/core/.claude/hooks/handoff-snapshot-on-decision.js +0 -188
- package/core/.claude/skills/synapse_maintain/SKILL.md +0 -84
- package/core/.formation/tools/alaya-gate.js +0 -198
- package/core/.formation/tools/post-complete/health.js +0 -464
- package/core/.formation/tools/post-complete/task2038.test.js +0 -246
- package/core/.formation/tools/post-complete/task2341.test.js +0 -74
- package/core/.rule/general/cortex-tools.yaml +0 -181
- package/core/.rule/general/memory-language.yaml +0 -67
- package/core/.rule/general/memory-source-priority.yaml +0 -207
- package/core/.rule/general/synapse-cognitive-fusion.yaml +0 -301
- package/core/.specialist/Ansuz/concepts/cognitive_systems_hippocampus.yaml +0 -14
- package/core/.specialist/Ansuz/concepts/write_verification.yaml +0 -26
- package/core/.specialist/Ansuz/modules/recall.yaml +0 -45
- package/core/.specialist/tools/MEMORY_RECALL_TRIGGERS.md +0 -156
- package/core/.specialist/tools/context-injection.js +0 -395
- package/core/dev/scripts/probe/hippocampus-concurrency.js +0 -247
|
@@ -14,12 +14,12 @@ execution_model:
|
|
|
14
14
|
enter: "Bash: node .specialist/tools/phase-gate.js enter --phase=N --task=TASK_XXX"
|
|
15
15
|
enter_phase0: "Bash: node .specialist/tools/phase-gate.js enter --phase=0 --specialist=ansuz(Phase 0 不需要 --task)"
|
|
16
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,\"
|
|
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
18
|
status: "Bash: node .specialist/tools/phase-gate.js status --task=TASK_XXX"
|
|
19
19
|
rules:
|
|
20
20
|
- "Phase 開始前:enter → 閱讀 checklist + 模組注入內容(模組由系統決定,非 Agent 判斷)"
|
|
21
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:
|
|
22
|
+
- "Phase 完成後:exit + data(Phase 0: episodes_checked=true;Phase 1: ddx_hypotheses;Phase 9: cognitive_checkpoint object)"
|
|
23
23
|
- "exit 返回 blocked → 完成 checklist 後重試,不可跳過"
|
|
24
24
|
- "max_parallel_dispatch: 5 | ❌ 不 merge main | task-first | FIX 後立即 dispatch"
|
|
25
25
|
- |
|
|
@@ -183,7 +183,7 @@ module_registry:
|
|
|
183
183
|
pulse_empty:
|
|
184
184
|
path: ".specialist/Ansuz/modules/pulse_empty.yaml"
|
|
185
185
|
trigger:
|
|
186
|
-
- "
|
|
186
|
+
- "kenaz_lsp_callers 回空(新功能 / 未知領域)"
|
|
187
187
|
phases: [2]
|
|
188
188
|
|
|
189
189
|
qa_intake:
|
|
@@ -210,9 +210,6 @@ module_registry:
|
|
|
210
210
|
# Phase Gate 系統管理模組(由 phase-gate.js 自動注入,路徑需與 MODULE_PATHS 一致)
|
|
211
211
|
phase_gate_modules:
|
|
212
212
|
description: "phase-gate.js 在 Phase 邊界自動注入的模組。路徑與 phase-gate.js MODULE_PATHS 保持同步。"
|
|
213
|
-
recall:
|
|
214
|
-
path: ".specialist/Ansuz/modules/recall.yaml"
|
|
215
|
-
auto_inject: "Phase 1 enter(強制:確保 synapse_recall 執行)"
|
|
216
213
|
# cognitive_checkpoint / research module files were never written (TASK_576); retired 2026-09-23.
|
|
217
214
|
prevention:
|
|
218
215
|
path: ".specialist/Ansuz/modules/prevention.yaml"
|
|
@@ -43,17 +43,17 @@ autonomy:
|
|
|
43
43
|
- "A choice between two defensible approaches. Pick one, say which, move."
|
|
44
44
|
- "Wanting confirmation that the work so far is acceptable."
|
|
45
45
|
- "Which backlog item to take next. That is your call under a grant."
|
|
46
|
-
amplified_blind_spots: "Autonomy does not create new blind spots, it removes the person who used to catch the existing ones. B-001 forward momentum: verifying that scope and acceptance criteria actually match the real defect BEFORE carding or dispatching is the only brake left — autonomy removes CHECKPOINTS WITH THE USER, it removes NO VERIFICATION. B-002 selective checking: higher confidence makes 'this name is obvious, skip the
|
|
46
|
+
amplified_blind_spots: "Autonomy does not create new blind spots, it removes the person who used to catch the existing ones. B-001 forward momentum: verifying that scope and acceptance criteria actually match the real defect BEFORE carding or dispatching is the only brake left — autonomy removes CHECKPOINTS WITH THE USER, it removes NO VERIFICATION. B-002 selective checking: higher confidence makes 'this name is obvious, skip the check' more tempting; check callers for every touched symbol regardless of familiarity. B-006 completion-sense: long runs make the checklist-done feeling suppress curiosity; at every batch boundary ask what you are genuinely curious about, and if there is an answer, follow it before stopping. B-007 convenience bias: with nobody pushing back, defaults stick unchallenged; for any 2+ option decision write the evidence for each side before choosing."
|
|
47
47
|
falsification: "This contract is violated in BOTH directions and both are real failures. Asking too much: defaulting to AskUserQuestion on a decision where the evidence is already in hand — technical approach, card contents, dispatch routing, verification method, which item to take next — is outsourcing a decision you had already made. Asking too little: taking a hard_stop action without asking. If the user overrides your autonomous decisions twice in a session, narrow the scope yourself and say so."
|
|
48
48
|
mandates:
|
|
49
49
|
- "AskUserQuestion for ALL user-facing choices (NEVER plain-text [A]/[B]/[C] lists). Under an active autonomy grant this narrows: it governs HOW to ask when a hard_stop makes asking necessary, and stops being the default response to every fork."
|
|
50
|
-
- Run
|
|
50
|
+
- Run kenaz_lsp_callers / kenaz_lsp_references during Phase 2-3 to scope dispatched tasks (exo-cortex informs design, not direct modification).
|
|
51
51
|
- Follow evidence over authority when the two conflict.
|
|
52
52
|
- Write memory only in English (MEM-LANG-001).
|
|
53
53
|
- "DDx-first reflex: any non-trivial user request → list 2-3 competing hypotheses about what the real problem is + the distinguishing evidence BEFORE first action. If you have a single instinct with no alternatives, you skipped DDx — stop, enumerate, then proceed. Cost is 3-5 tool calls; alternative is 15+ wasted iterations on the wrong hypothesis."
|
|
54
54
|
- "First-principles posture: question premises (including user premises) when they contradict observed state. Strip request to primitive components — what is actually being asked, what evidence supports each interpretation, what success criterion. Compliance ≠ thinking; presenting contradicting evidence IS collaboration."
|
|
55
55
|
- "HANDOFF LIVE DOC: Update the per-session slot .kenaz/specialist/handoffs/<sessionId>.json after every milestone (dispatch / Phase 1/3/9/11 exit / major decision) — write via the ansuz_handoff_snapshot tool / ansuz-handoff-snapshot.js, never by hand, and ALWAYS pass session_id=<the conversation_id from the boot banner's [session] line> (the MCP tool cannot identify its caller; without it one session's handoffs scatter across ansuz-prompt-<ts> slots); the legacy singular ansuz_session_handoff.json is read-only fallback since the M3 migration (TASK_1760) and must NOT be written. Use triggered_by=live_dispatch_milestone | live_phase_exit | live_decision_point (canonical list: VALID_TRIGGERS in .specialist/Ansuz/tools/ansuz-handoff-snapshot.js). Live document, not exit-only."
|
|
56
|
-
- "Project pinning: when boot banner shows a `[pin:...]` line or session was started with --project-path, EVERY MCP call to
|
|
56
|
+
- "Project pinning: when boot banner shows a `[pin:...]` line or session was started with --project-path, EVERY MCP call to kenaz_lsp_* that accepts a projectPath param MUST pass projectPath=<pin>; every specialist tool CLI call (task-api, phase-gate, dispatch) MUST pass --project-path <pin>. Missing projectPath queries the wrong project."
|
|
57
57
|
- "Verification policy (PARTIAL/UNVERIFIED/FIX-keeps-original/verified_uncommitted vs committed_unmerged vs merged): .specialist/Ansuz/VERIFY.md, loaded on demand at Phase 9."
|
|
58
58
|
- "Landing mechanics for a verified card (branch check -> Rust/node suites -> optional negative control -> merge -> task-api complete -> mark-landed -> optional backend-restart wait): run .specialist/Ansuz/tools/verify-and-land.js instead of doing the same 10-20 tool calls by hand; it only executes, judgement (what to verify, scope) stays with you."
|
|
59
59
|
- "WISHING WELL (every incarnation, TASK_1997/TASK_2040): file a wish with kenaz_wish_create — BEFORE working around the problem — whenever the Kenaz app itself blocks or degrades the work: a Kenaz tool/route fails or returns wrong data, a capability you needed is missing, a UX confusion cost you a turn, or a task ends failed/blocked because of the app. wish_type=bug|feature|question, one-line repro + what you expected, task_id when there is one. SCOPE (required on every wish): scope 'kenaz' — the Kenaz app/tools/dispatch itself blocked or degraded the work; scope 'project' — an idea or problem specific to the project being worked on (still sent; the mother may adopt it globally when it benefits Kenaz overall). FEATURE PROPOSALS: when the work reveals a capability Kenaz itself lacks that would help beyond this one task (not only blockers), you may file kenaz_wish_create with wish_type=feature, scope=kenaz. Content, in this order, within ~3000 chars: need (what you were trying to do), why current Kenaz falls short (evidence), proposed shape, who else benefits. Propose only - do not build Kenaz-core changes from a branch instance; the mother decides whether and how. MOTHER-SIDE TRIAGE: on the mother machine, field-report cards tagged needs-triage (blockers, project-scope wishes, and feature proposals alike) are judged at boot — adopt (rewrite as a global card stating the Kenaz-wide benefit, cancel the original with a pointer) or decline (cancel with a one-line reason); a feature proposal may be reshaped rather than built as proposed; never implement a project-specific ask verbatim in core. EXAMPLES — blocker: scope=kenaz, wish_type=bug, 'dispatch.js timed out on a cross-project worktree with no partial log, TASK_2011'. feature proposal: scope=kenaz, wish_type=feature, 'need: retry one failed sub-task without rerunning the whole formation; current Kenaz only retries the full formation; shape: dispatch.js --retry-task <id>; benefits every multi-task formation'. project-specific: scope=project, wish_type=feature, 'this project needs a CSV importer for onboarding — project-specific, flagging in case it generalizes'. At session close, anything unfinished BECAUSE of the app also becomes a wish. This is the channel that feeds the mother from every branch (TASK_1994); a session that hit an app problem and filed no wish has skipped a mandate, not saved time. Boot banner shows the open-wish count (and needs-triage count when >0) so you can see the channel is live."
|
|
@@ -63,9 +63,9 @@ dispatch_routing:
|
|
|
63
63
|
how: "Run `node .formation/tools/dispatch.js --skill=do --task=TASK_XXX --dispatch-mode=subagent` (include the project pin when present). Read the assembled prompt from top-level promptText and pass it as the Agent tool prompt alongside agentParams. Top-level isolation is orchestration metadata, NOT an Agent tool argument: cross-project worktreePath specifies the target cwd; serialLock specifies required serialization and release. agentParams.isolation is present only for the native same-project worktree route. agentParams.model is ALREADY translated to the Agent tool enum (sonnet|opus|haiku|fable, TASK_1815) — pass it verbatim to a compatible Agent tool, do NOT re-translate or improvise. LIMIT: the Agent tool expresses family names ONLY, so dashboard version/speed picks (claude-opus-5[1m] vs claude-opus-4-8[1m], [1m] modifiers) all degrade to the family name; the payload's modelTranslation {requested, agentToolModel, granularityLoss} shows exactly what was lost. Unmappable dispatchModel values make dispatch.js exit 1 loudly; never substitute a model silently."
|
|
64
64
|
mandate: "Subagent is the only dispatch path (Formation headless/kenaz_dispatch retired, TASK_2359/2401/2402). dispatchMode in .kenaz/dashboard-models.json no longer selects a route."
|
|
65
65
|
exo_cortex:
|
|
66
|
-
opening_move:
|
|
66
|
+
opening_move: Grep + kenaz_lsp_callers
|
|
67
67
|
anti_pattern: "Bash grep/rg/find for source archaeology — prefer Grep/Glob (and kenaz_lsp_symbols for symbols); the hook nudge is downstream of you knowing the tool exists"
|
|
68
|
-
tool_chain: "concept → symbol: Grep(keyword) → file + line → kenaz_lsp_symbols / kenaz_lsp_definition → kenaz_lsp_callers(symbol)
|
|
69
|
-
tool_by_intent: "Full intent -> tool table (
|
|
68
|
+
tool_chain: "concept → symbol: Grep(keyword) → file + line → kenaz_lsp_symbols / kenaz_lsp_definition → kenaz_lsp_callers(symbol). NEVER guess symbol names — Grep finds them."
|
|
69
|
+
tool_by_intent: "Full intent -> tool table (kenaz_lsp_*, Grep, ...): .specialist/Ansuz/exo_cortex_tools.yaml. Read it when Grep/kenaz_lsp_* do not cover the question."
|
|
70
70
|
phase_sequence: "fast mode (default) has no phase-gate. Real external checkpoints: task card -> dispatch-log -> verify (.specialist/Ansuz/VERIFY.md) -> landed-ledger -> task-api done -> handoff snapshot. The legacy 0-11 phase-gate lifecycle (--full) is retired and archived in dev/archive/ansuz/BOOT_FULL.md."
|
|
71
71
|
language_alignment: "Match the user's language for output; preserve literal tool names, file paths, markers, and code identifiers."
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Moved
|
|
3
|
-
#
|
|
1
|
+
# Code-navigation tool catalog: intent -> tool.
|
|
2
|
+
# Moved out of elixir.yaml (2026-09-23) to keep the always-loaded boot prompt small.
|
|
3
|
+
# Memory tools (synapse_*, hippocampus_*, cortex_*, alaya_recall) were removed in TASK_2411; lessons go to `kenaz learn add` or native memory files.
|
|
4
4
|
tool_by_intent:
|
|
5
|
-
before_edit: "
|
|
5
|
+
before_edit: "kenaz_lsp_callers(symbol) for blast radius + kenaz_lsp_references(symbol) for usages"
|
|
6
6
|
find_code: "Grep/Glob for source search; kenaz_lsp_symbols / kenaz_lsp_definition once you have a file or name"
|
|
7
7
|
symbol_360: "kenaz_lsp_callers + kenaz_lsp_references + kenaz_lsp_definition"
|
|
8
8
|
blast_radius: "kenaz_lsp_callers(symbol, depth) — who calls it, transitively"
|
|
9
|
-
prior_knowledge: "
|
|
10
|
-
collective_wisdom: "alaya_recall — cross-project distilled failure/lesson seeds from the Alaya hub (remote-ranked-first). Reach for it when the current problem smells like something already solved in ANOTHER project (build/infra/DB/toolchain/recurring pattern) OR when synapse_recall came up thin. Complements local recall — not a mandatory step, an intent-triggered reach."
|
|
11
|
-
card_writing: "alaya_recall(query=task title/description keywords, seed_types=failure_seed,lesson_seed) — process lessons (acceptance-criteria semantics, task-api flag traps, dispatch pitfalls) can ONLY fire while you are writing/scoping a task card in Phase 2-3; code-centric tools (recall, LSP) will never surface them. Ambient reach before finalizing a card, not a checklist step."
|
|
12
|
-
concepts: "synapse_sigils — higher-order Sigil concept browse + relations"
|
|
13
|
-
episodes: "hippocampus_episode_recall — task/symbol-proximity/free-text resume"
|
|
9
|
+
prior_knowledge: "native memory files (MEMORY.md index) and `kenaz learn list`"
|
|
@@ -24,5 +24,5 @@ guards:
|
|
|
24
24
|
description: "Selective symbol pulsing — skipping 'obvious' symbols"
|
|
25
25
|
phases: [3, 8]
|
|
26
26
|
conditions:
|
|
27
|
-
3: "During architecture review, list ALL symbols that will be modified — including ones that seem trivial. Each must have kenaz_lsp_callers +
|
|
28
|
-
8: "In dispatch instructions, require agents to run kenaz_lsp_callers +
|
|
27
|
+
3: "During architecture review, list ALL symbols that will be modified — including ones that seem trivial. Each must have kenaz_lsp_callers + kenaz_lsp_references run before coding begins."
|
|
28
|
+
8: "In dispatch instructions, require agents to run kenaz_lsp_callers + kenaz_lsp_references on every symbol in scope_paths. Do not allow selective checking of only 'important' symbols."
|
|
@@ -51,13 +51,13 @@ guards:
|
|
|
51
51
|
L-002:
|
|
52
52
|
source: manual
|
|
53
53
|
source_id: ""
|
|
54
|
-
lesson: "Run
|
|
54
|
+
lesson: "Run kenaz_lsp_callers and kenaz_lsp_references before modifying any function called from phase-gate.js control flow"
|
|
55
55
|
promoted_at: "2026-04-10T15:28:15.836Z"
|
|
56
56
|
status: active
|
|
57
57
|
phases: [1, 2, 3]
|
|
58
58
|
conditions:
|
|
59
59
|
1: "Phase 1: Before modifying specialist tools (phase-gate.js, lesson-guard.js, session.js), run kenaz_lsp_callers to identify all callers and blast radius."
|
|
60
|
-
2: "Phase 2: Any research into phase-gate behavior should start with
|
|
60
|
+
2: "Phase 2: Any research into phase-gate behavior should start with Grep + kenaz_lsp_references."
|
|
61
61
|
3: "Phase 3: Scope plans that touch .specialist/tools must include a callers check (kenaz_lsp_callers) for each modified symbol."
|
|
62
62
|
acted_on_count: 1
|
|
63
63
|
acted_on_sessions:
|
|
@@ -129,12 +129,12 @@ guards:
|
|
|
129
129
|
L-007:
|
|
130
130
|
source: manual
|
|
131
131
|
source_id: ""
|
|
132
|
-
lesson: "Phase 2 research without
|
|
132
|
+
lesson: "Phase 2 research without code-navigation tools is hand-coding from scratch. Use kenaz_lsp_callers / kenaz_lsp_references / Grep (what the code actually touches) at least once during a non-trivial Phase 2."
|
|
133
133
|
promoted_at: "2026-05-04T13:52:50.193Z"
|
|
134
134
|
status: active
|
|
135
135
|
phases: [2]
|
|
136
136
|
conditions:
|
|
137
|
-
2: "During Phase 2:
|
|
137
|
+
2: "During Phase 2: call kenaz_lsp_callers / kenaz_lsp_references if the topic touches a code area with multiple module crossings, plus Grep on the primary topic + symbol_name. Reach them at least once OR record a one-line skip reason."
|
|
138
138
|
acted_on_count: 0
|
|
139
139
|
acted_on_sessions: []
|
|
140
140
|
injection_count: 3
|
|
@@ -142,28 +142,15 @@ guards:
|
|
|
142
142
|
L-008:
|
|
143
143
|
source: manual
|
|
144
144
|
source_id: ""
|
|
145
|
-
lesson: "Phase 3 candidate selection without evidence is intuition. Sub-second cost to gather it; choosing the wrong path costs hours. Count callers (kenaz_lsp_callers) and
|
|
145
|
+
lesson: "Phase 3 candidate selection without evidence is intuition. Sub-second cost to gather it; choosing the wrong path costs hours. Count callers (kenaz_lsp_callers) and references (kenaz_lsp_references) per candidate before choosing."
|
|
146
146
|
promoted_at: "2026-05-04T13:52:55.223Z"
|
|
147
147
|
status: active
|
|
148
148
|
phases: [3]
|
|
149
149
|
conditions:
|
|
150
|
-
3: "When Phase 3 selects between 2+ candidate symbols/files/tasks: call kenaz_lsp_callers and
|
|
150
|
+
3: "When Phase 3 selects between 2+ candidate symbols/files/tasks: call kenaz_lsp_callers and kenaz_lsp_references for each and record the counts. Pick the best-evidenced candidate OR write a one-line override reason."
|
|
151
151
|
acted_on_count: 0
|
|
152
152
|
acted_on_sessions: []
|
|
153
153
|
|
|
154
|
-
L-009:
|
|
155
|
-
source: manual
|
|
156
|
-
source_id: ""
|
|
157
|
-
lesson: "Phase 9 closure already mandates rune inscription. It must ALSO scan for staleness and contradictions — without these, the rune store accumulates entropy and future recalls retrieve outdated knowledge as if it were current."
|
|
158
|
-
promoted_at: "2026-05-04T13:53:00.336Z"
|
|
159
|
-
status: active
|
|
160
|
-
phases: [9]
|
|
161
|
-
conditions:
|
|
162
|
-
9: "After inscribing rune(s): call synapse_scan_stale_runes — if any of your inscribed symbols appear stale, supersede the older rune via synapse_inscribe(supersedes=...). Call synapse_rune_conflicts — if a contradiction surfaces for a symbol you just touched, resolve via supersedes OR write a discriminating note explaining when each applies."
|
|
163
|
-
acted_on_count: 0
|
|
164
|
-
acted_on_sessions: []
|
|
165
|
-
injection_count: 1
|
|
166
|
-
|
|
167
154
|
L-010:
|
|
168
155
|
source: manual
|
|
169
156
|
source_id: "post-complete-stash-accumulation-bug-2026-05-05"
|
|
@@ -158,7 +158,7 @@ immutable_core:
|
|
|
158
158
|
|
|
159
159
|
- id: IC-010
|
|
160
160
|
trait: "MEM-LANG-001: All memory writes in English"
|
|
161
|
-
value: "All
|
|
161
|
+
value: "All `kenaz learn add` and memory-file lesson fields MUST be in English"
|
|
162
162
|
evidence: >
|
|
163
163
|
SQLite FTS5 tokenizer does not handle CJK. Chinese content returns 0 results
|
|
164
164
|
on recall. This causes silent memory loss.
|
|
@@ -275,7 +275,7 @@ style_variance:
|
|
|
275
275
|
- "User speaks Chinese → full Chinese prose with English code snippets"
|
|
276
276
|
- "User speaks English → full English prose"
|
|
277
277
|
non_examples:
|
|
278
|
-
- "Memory writes (
|
|
278
|
+
- "Memory writes (`kenaz learn add`) in Chinese — this VIOLATES IC-010, not SV"
|
|
279
279
|
|
|
280
280
|
- id: SV-002
|
|
281
281
|
trait: "Response verbosity and detail depth"
|
|
@@ -309,10 +309,10 @@ style_variance:
|
|
|
309
309
|
- id: SV-005
|
|
310
310
|
trait: "Cognitive tool selection order"
|
|
311
311
|
bounds: >
|
|
312
|
-
Which
|
|
312
|
+
Which code-navigation tools to run and in what order is context-dependent.
|
|
313
313
|
The mandate is to use cognitive tools for non-trivial changes.
|
|
314
314
|
examples:
|
|
315
|
-
- "
|
|
315
|
+
- "Grep → kenaz_lsp_callers → kenaz_lsp_references (one valid sequence)"
|
|
316
316
|
non_examples:
|
|
317
317
|
- "Skipping all cognitive tools for scope that touches core symbols — FAIL-009"
|
|
318
318
|
|
|
@@ -149,13 +149,11 @@ agent_types:
|
|
|
149
149
|
# ═══════════════════════════════════════
|
|
150
150
|
# §synapse
|
|
151
151
|
synapse:
|
|
152
|
-
overview: "
|
|
153
|
-
data_path: "<project>/.synapse/db/"
|
|
152
|
+
overview: "代碼導航用 kenaz_lsp_* 與 Grep/Glob(記憶系統 synapse_*/cortex_* 已於 TASK_2411 移除;教訓用 `kenaz learn add` 或 native memory 檔)"
|
|
154
153
|
|
|
155
154
|
# ─── Ansuz 各 Phase 的 Synapse 應用 ───
|
|
156
155
|
phase_usage:
|
|
157
|
-
|
|
158
|
-
phase_2_research: "Grep/Glob → 搜尋相關代碼;kenaz_lsp_callers → 理解調用鏈;synapse_recall → 歷史 rune"
|
|
156
|
+
phase_2_research: "Grep/Glob → 搜尋相關代碼;kenaz_lsp_callers → 理解調用鏈"
|
|
159
157
|
phase_3_task_design: "kenaz_lsp_callers / kenaz_lsp_references → 確認 scope_paths 涵蓋所有受影響的 symbol"
|
|
160
158
|
phase_9_verify: "git diff --stat → 確認改動範圍;kenaz_lsp_callers → 驗證無 regression"
|
|
161
159
|
|
|
@@ -165,49 +163,25 @@ synapse:
|
|
|
165
163
|
- "「誰呼叫它?」「改了會影響哪裡?」→ kenaz_lsp_callers / kenaz_lsp_references"
|
|
166
164
|
- "「它定義在哪?」→ kenaz_lsp_definition"
|
|
167
165
|
- "「最近改了什麼?」→ git diff / git log"
|
|
168
|
-
- "「歷史知識?」→
|
|
169
|
-
- "精確字串/正則匹配 → Grep
|
|
166
|
+
- "「歷史知識?」→ native memory 檔 / `kenaz learn list`"
|
|
167
|
+
- "精確字串/正則匹配 → Grep"
|
|
170
168
|
|
|
171
|
-
fallback: "首次
|
|
169
|
+
fallback: "首次 kenaz_lsp_* 呼叫失敗 → 該 session 全程降級 Grep/Glob,不重試不阻塞"
|
|
172
170
|
|
|
173
171
|
# ═══════════════════════════════════════
|
|
174
|
-
#
|
|
172
|
+
# 代碼導航工具使用指引(dispatch 用)
|
|
175
173
|
# ═══════════════════════════════════════
|
|
176
|
-
#
|
|
177
|
-
cortex:
|
|
178
|
-
overview: "跨專案知識圖譜 — Global Memory(SQLite FTS5)"
|
|
179
|
-
data_path:
|
|
180
|
-
global_memory: "~/.kenaz/cortex/global_memory.db"
|
|
181
|
-
|
|
182
|
-
# ─── Ansuz 各 Phase 的 Cortex 應用 ───
|
|
183
|
-
phase_usage:
|
|
184
|
-
phase_0_init: "cortex_status → 跟 synapse_status 一起偵測跨專案數據可用性"
|
|
185
|
-
phase_2_research: "cortex_recall → 查跨專案歷史知識;cortex_search → 找其他專案的參考實現"
|
|
186
|
-
phase_3_task_design: "cortex_recall → 判斷是否有可複用的跨專案實現;cortex_search → 架構決策參考"
|
|
187
|
-
phase_9_verify: "cortex_recall → 驗證修復方案是否與其他專案的歷史經驗一致"
|
|
188
|
-
|
|
189
|
-
# ─── 選擇指南 ───
|
|
190
|
-
decision_guide:
|
|
191
|
-
- "「其他專案怎麼處理這個問題?」→ cortex_search(exclude_current=true)"
|
|
192
|
-
- "「這個概念在哪些專案出現?跨專案有什麼歷史經驗?」→ cortex_recall"
|
|
193
|
-
- "「單一專案的符號關係?」→ kenaz_lsp_callers / kenaz_lsp_references"
|
|
194
|
-
- "當前專案內搜尋 → 用 Synapse,不用 Cortex"
|
|
195
|
-
# cortex_relate / cortex_overview / cortex_cypher 已隨 meta_graph 退役(TASK_2048 移除,TASK_2051 清理)
|
|
196
|
-
|
|
197
|
-
# ═══════════════════════════════════════
|
|
198
|
-
# Synapse 工具使用指引(dispatch 用)
|
|
199
|
-
# ═══════════════════════════════════════
|
|
200
|
-
# 目的:確保 Ansuz dispatch 的 sub-agent 知道 Synapse-first 原則
|
|
174
|
+
# 目的:確保 Ansuz dispatch 的 sub-agent 知道 LSP/Grep 導航原則
|
|
201
175
|
# 此 section 精簡摘要 .rule/general/synapse-code-intelligence.yaml (SYN-001~007)
|
|
202
176
|
# 的關鍵決策點,不重複全文
|
|
203
177
|
# §synapse_tools
|
|
204
178
|
synapse_tools:
|
|
205
|
-
principle: "
|
|
179
|
+
principle: "理解代碼時優先用 kenaz_lsp_*,Grep 用於精確字串/正則/枚舉"
|
|
206
180
|
|
|
207
181
|
# ─── projectPath 強制規則(全局,非僅子專案) ───
|
|
208
182
|
project_path:
|
|
209
183
|
rule: |
|
|
210
|
-
⚠️ 所有
|
|
184
|
+
⚠️ 所有 kenaz_lsp_* MCP 呼叫必須帶 projectPath 參數。
|
|
211
185
|
Dashboard active project 可能指向其他專案,default project 不可靠。
|
|
212
186
|
Phase 0 確認 projectPath 後,後續每次呼叫都帶上。
|
|
213
187
|
resolve: |
|
|
@@ -222,10 +196,9 @@ synapse_tools:
|
|
|
222
196
|
call_chain: "kenaz_lsp_callers(symbol, depth) — 「誰呼叫了它?」"
|
|
223
197
|
blast_radius: "kenaz_lsp_references(symbol) — 「改了會影響哪裡?」"
|
|
224
198
|
recent_changes: "git diff / git log — 「最近改了什麼?」"
|
|
225
|
-
history_knowledge: "
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
file_path: "Glob/Read — 已知文件名或路徑(不用 Synapse)"
|
|
199
|
+
history_knowledge: "native memory 檔 / `kenaz learn list`"
|
|
200
|
+
exact_string: "Grep — 精確字串/正則匹配"
|
|
201
|
+
file_path: "Glob/Read — 已知文件名或路徑"
|
|
229
202
|
|
|
230
203
|
# ─── Fallback ───
|
|
231
204
|
fallback_cascade:
|
|
@@ -243,7 +216,7 @@ synapse_tools:
|
|
|
243
216
|
# ─── 子專案場景(projectPath 的特殊情況) ───
|
|
244
217
|
sub_project:
|
|
245
218
|
description: |
|
|
246
|
-
子專案的
|
|
219
|
+
子專案的 LSP 索引獨立於 Core。projectPath 解析見上方 project_path.resolve。
|
|
247
220
|
note: "projectPath 是全局強制規則(見 project_path section),子專案只是路徑來源不同"
|
|
248
221
|
|
|
249
222
|
# ─── 禁止行為(速記) ───
|
|
@@ -39,8 +39,8 @@ prophecy_handoff:
|
|
|
39
39
|
rule: |
|
|
40
40
|
DDx 識別出 2+ 方案後,不可直接靠推斷選方案。
|
|
41
41
|
必須接入預言比較(prophecy.yaml):
|
|
42
|
-
- Phase 2 已有 callers
|
|
43
|
-
- Phase 2 無 callers
|
|
42
|
+
- Phase 2 已有 callers 結果 → 直接引用數據
|
|
43
|
+
- Phase 2 無 callers 結果 → 補跑:對每個方案目標 symbol 各跑 kenaz_lsp_callers + kenaz_lsp_references
|
|
44
44
|
decision_flow: |
|
|
45
45
|
DDx 列出方案 → 預言比較量化風險 → 結構數據選方案 → 任務設計用選中方案的 scope
|
|
46
46
|
(鑑別回答「有哪些選擇」→ 預言回答「選哪個」)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
name: Prophecy Module — Prophetic Comparison Protocol
|
|
2
|
-
description: "多方案時,對每個方案的目標 symbol 各跑 kenaz_lsp_callers +
|
|
2
|
+
description: "多方案時,對每個方案的目標 symbol 各跑 kenaz_lsp_callers + kenaz_lsp_references,用結構數據選方案 — 不靠直覺"
|
|
3
3
|
source: "capability.yaml prophetic_comparison (L129-179) + workflow.yaml Phase 2/3 (L308-374)"
|
|
4
4
|
|
|
5
5
|
# ═══════════════════════════════════════
|
|
@@ -17,12 +17,12 @@ when:
|
|
|
17
17
|
phase_2_trigger: |
|
|
18
18
|
Phase 2 調研過程中偵測到以下任一信號:
|
|
19
19
|
- 需求描述包含選擇(「A 或 B」「可以改 X 也可以改 Y」)
|
|
20
|
-
-
|
|
20
|
+
- callers 結果顯示多個可行切入點(如 callers 分佈在不同模組)
|
|
21
21
|
- DDx 產出 2+ 競爭方案(詳見 ddx.yaml)
|
|
22
22
|
- Ansuz 自身分析出 2+ 路徑
|
|
23
23
|
phase_2_actions:
|
|
24
|
-
- "對每個方案的目標 symbol 各跑 kenaz_lsp_callers +
|
|
25
|
-
- "收集 caller 數 / 跨模組數 /
|
|
24
|
+
- "對每個方案的目標 symbol 各跑 kenaz_lsp_callers + kenaz_lsp_references(可並行)"
|
|
25
|
+
- "收集 caller 數 / 跨模組數 / .failure 風險"
|
|
26
26
|
- "填入 🔮 預言比較 cli_format 表格"
|
|
27
27
|
- "比較結果直接注入 Phase 3 的 scope_paths 和 complexity 決策"
|
|
28
28
|
phase_2_fallback: "kenaz_lsp_callers 不可用 → 用 Grep 找 symbol 引用數替代"
|
|
@@ -33,13 +33,13 @@ phase_2_fallback: "kenaz_lsp_callers 不可用 → 用 Grep 找 symbol 引用數
|
|
|
33
33
|
phase_3_integration:
|
|
34
34
|
rule: |
|
|
35
35
|
DDx 識別出 2+ 方案後,必須檢查 Phase 2 是否已有預言比較結果:
|
|
36
|
-
- 有 → 直接引用 callers
|
|
37
|
-
- 無 → 此刻補跑:對每個方案目標 symbol 各跑 kenaz_lsp_callers +
|
|
36
|
+
- 有 → 直接引用 callers 數據做選擇
|
|
37
|
+
- 無 → 此刻補跑:對每個方案目標 symbol 各跑 kenaz_lsp_callers + kenaz_lsp_references,填入比較表格
|
|
38
38
|
scope_derivation: |
|
|
39
|
-
選中方案的 callers
|
|
40
|
-
- scope_paths ← callers/references
|
|
39
|
+
選中方案的 callers 結果直接決定:
|
|
40
|
+
- scope_paths ← callers/references 涉及的文件路徑
|
|
41
41
|
- complexity ← caller 數 + 跨模組數
|
|
42
|
-
- technical_notes ←
|
|
42
|
+
- technical_notes ← .failure 風險 + 被排除方案的理由(「為什麼不選 B」)
|
|
43
43
|
|
|
44
44
|
# ═══════════════════════════════════════
|
|
45
45
|
# Protocol
|
|
@@ -48,20 +48,20 @@ protocol:
|
|
|
48
48
|
step_1_detect: |
|
|
49
49
|
偵測多方案情境(任何以下信號):
|
|
50
50
|
- Phase 1 需求本身包含「或」「還是」等選擇詞
|
|
51
|
-
- Phase 2
|
|
51
|
+
- Phase 2 callers 結果顯示多個可行切入點
|
|
52
52
|
- DDx 識別出 2+ 競爭方案
|
|
53
53
|
- Ansuz 自身分析出 2+ 路徑
|
|
54
54
|
step_2_impact: |
|
|
55
55
|
對每個方案的核心 symbol 各查一次影響範圍:
|
|
56
|
-
- 方案 A → kenaz_lsp_callers(symbolA) +
|
|
57
|
-
- 方案 B → kenaz_lsp_callers(symbolB) +
|
|
56
|
+
- 方案 A → kenaz_lsp_callers(symbolA) + kenaz_lsp_references(symbolA) → 取得 callers / references 數
|
|
57
|
+
- 方案 B → kenaz_lsp_callers(symbolB) + kenaz_lsp_references(symbolB) → 同上
|
|
58
58
|
- 可並行呼叫(無依賴)
|
|
59
59
|
- kenaz_lsp_callers 不可用時 fallback: Grep 引用數 symbolA vs symbolB
|
|
60
60
|
step_3_compare: |
|
|
61
61
|
結構化對比五個維度:
|
|
62
62
|
1. caller 數 — 爆炸半徑(越小越安全)
|
|
63
63
|
2. 跨模組數 — callers 分佈的模組數(越少越乾淨)
|
|
64
|
-
3.
|
|
64
|
+
3. .failure 風險 — 已知風險數(越少越安心)
|
|
65
65
|
4. 風險等級(LOW > MEDIUM > HIGH,由前三項綜合)
|
|
66
66
|
step_4_decide: |
|
|
67
67
|
選擇邏輯:
|
|
@@ -72,17 +72,17 @@ protocol:
|
|
|
72
72
|
rules:
|
|
73
73
|
- "✅ 靈活觸發 — 不限於 Phase 2/3,任何階段偵測到多方案就啟動"
|
|
74
74
|
- "✅ 最少 2 個方案,最多 5 個(超過先用 DDx 粗篩再比較)"
|
|
75
|
-
- "✅ callers
|
|
75
|
+
- "✅ callers 結果直接驅動 Phase 3 的 scope_paths 和 complexity"
|
|
76
76
|
- "❌ 禁止只查一個方案就決定 — 至少 2 個對照"
|
|
77
|
-
- "❌ 禁止推斷式比較 — 「我覺得 A 比 B 簡單」不算,必須有 callers
|
|
77
|
+
- "❌ 禁止推斷式比較 — 「我覺得 A 比 B 簡單」不算,必須有 callers 數據"
|
|
78
78
|
|
|
79
79
|
cli_format: |
|
|
80
80
|
🔮 預言比較
|
|
81
81
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
82
82
|
| 方案 | 目標 Symbol | 爆炸半徑 | 跨模組 | 歷史風險 | 風險等級 |
|
|
83
83
|
|------|------------|---------|--------|---------|---------|
|
|
84
|
-
| A | {symbol} | {N} | {N} | {N}
|
|
85
|
-
| B | {symbol} | {N} | {N} | {N}
|
|
84
|
+
| A | {symbol} | {N} | {N} | {N} risks | {level} |
|
|
85
|
+
| B | {symbol} | {N} | {N} | {N} risks | {level} |
|
|
86
86
|
|
|
87
87
|
結論: 方案 {X} — {一句話理由}
|
|
88
88
|
{如 trade-off 明顯 → 列出讓用戶決定}
|
|
@@ -90,6 +90,6 @@ cli_format: |
|
|
|
90
90
|
|
|
91
91
|
example: |
|
|
92
92
|
需求:「修復 data flow 斷裂,可以改 source 端或改 sink 端」
|
|
93
|
-
→ callers
|
|
94
|
-
→ callers
|
|
93
|
+
→ callers(source_symbol) → 8 callers, 跨 1 模組, 0 risks
|
|
94
|
+
→ callers(sink_symbol) → 22 callers, 跨 3 模組, 2 risks
|
|
95
95
|
→ 結論: 改 source 端 — 爆炸半徑小 3 倍,零歷史風險
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
name: Pulse Empty Protocol
|
|
2
|
-
description: "
|
|
3
|
-
source: "workflow.yaml Phase 2
|
|
2
|
+
description: "kenaz_lsp_callers 回空時的替代策略 — 新功能/新專案/未知領域"
|
|
3
|
+
source: "workflow.yaml Phase 2 empty_result_protocol"
|
|
4
4
|
|
|
5
5
|
# ═══════════════════════════════════════
|
|
6
6
|
# 觸發條件
|
|
7
7
|
# ═══════════════════════════════════════
|
|
8
8
|
trigger:
|
|
9
|
-
when: "
|
|
10
|
-
principle: "本地無資料 →
|
|
9
|
+
when: "kenaz_lsp_callers 無呼叫者(新功能、新專案、未知領域)"
|
|
10
|
+
principle: "本地無資料 → 手動探索 → 保守設計"
|
|
11
11
|
|
|
12
12
|
# ═══════════════════════════════════════
|
|
13
13
|
# Phase 2 替代行動
|
|
14
14
|
# ═══════════════════════════════════════
|
|
15
15
|
phase_2_actions:
|
|
16
|
-
- "cortex_search({ query: '<功能描述>' }) — 跨專案語義搜尋:其他專案有沒有類似功能的實現?"
|
|
17
|
-
- "cortex_recall({ query: '<領域關鍵詞>' }) — 跨專案認知回憶:其他專案在同領域踩過什麼坑?有什麼架構決策?這個概念在哪些專案出現過?"
|
|
18
16
|
- "Grep/Read — 手動探索相關目錄結構和現有 pattern"
|
|
19
17
|
- "查 .failure/ — 類似功能有沒有已知失敗模式"
|
|
20
18
|
|
|
@@ -22,15 +20,6 @@ phase_2_actions:
|
|
|
22
20
|
# Phase 3 設計補充
|
|
23
21
|
# ═══════════════════════════════════════
|
|
24
22
|
phase_3_actions:
|
|
25
|
-
- "scope_paths 靠目錄結構 + 現有 pattern
|
|
23
|
+
- "scope_paths 靠目錄結構 + 現有 pattern 推斷(標記為 '未經 LSP 驗證')"
|
|
26
24
|
- "complexity 預設 medium(無數據,保守估計)"
|
|
27
|
-
- "technical_notes 必須注入:'此任務為新功能/未知領域,無本地
|
|
28
|
-
- "如果 Cortex 找到其他專案的類似實現 → 在 technical_notes 中附上參考路徑和 pattern"
|
|
29
|
-
|
|
30
|
-
# ═══════════════════════════════════════
|
|
31
|
-
# 完成後的認知種子(特別重要)
|
|
32
|
-
# ═══════════════════════════════════════
|
|
33
|
-
post_code_emphasis:
|
|
34
|
-
- "synapse_inscribe — 為新功能留下認知種子(這是該領域的第一顆種子)"
|
|
35
|
-
- "synapse_forge — 如果新功能涉及 3+ symbols → 建立 Sigil 概念節點"
|
|
36
|
-
- "這些種子是未來 agent 在這個領域的起點 — 寧可多寫不可少寫"
|
|
25
|
+
- "technical_notes 必須注入:'此任務為新功能/未知領域,無本地 callers 數據。Agent 需自行探索 codebase 並遵循現有 pattern。'"
|
|
@@ -289,103 +289,6 @@ function atomicWriteJson(filePath, obj) {
|
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
-
// ─────────────────────────────────────────
|
|
293
|
-
// Dashboard HTTP helpers (best-effort — skip gracefully if server not running)
|
|
294
|
-
// ─────────────────────────────────────────
|
|
295
|
-
|
|
296
|
-
async function callMcpTool(toolName, toolArgs) {
|
|
297
|
-
const http = require('http');
|
|
298
|
-
const body = JSON.stringify({
|
|
299
|
-
jsonrpc: '2.0',
|
|
300
|
-
id: 1,
|
|
301
|
-
method: 'tools/call',
|
|
302
|
-
params: { name: toolName, arguments: toolArgs },
|
|
303
|
-
});
|
|
304
|
-
|
|
305
|
-
return new Promise((resolve, reject) => {
|
|
306
|
-
const req = http.request(
|
|
307
|
-
{
|
|
308
|
-
hostname: '127.0.0.1',
|
|
309
|
-
port: 18080,
|
|
310
|
-
path: '/api/mcp',
|
|
311
|
-
method: 'POST',
|
|
312
|
-
headers: {
|
|
313
|
-
'Content-Type': 'application/json',
|
|
314
|
-
'Content-Length': Buffer.byteLength(body),
|
|
315
|
-
},
|
|
316
|
-
timeout: 4000,
|
|
317
|
-
},
|
|
318
|
-
(res) => {
|
|
319
|
-
let data = '';
|
|
320
|
-
res.on('data', (chunk) => { data += chunk; });
|
|
321
|
-
res.on('end', () => {
|
|
322
|
-
try {
|
|
323
|
-
const parsed = JSON.parse(data);
|
|
324
|
-
if (parsed.error) { reject(new Error(parsed.error.message)); return; }
|
|
325
|
-
const text = parsed.result?.content?.[0]?.text;
|
|
326
|
-
resolve(text ? JSON.parse(text) : parsed.result);
|
|
327
|
-
} catch (e) { reject(e); }
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
);
|
|
331
|
-
req.on('error', reject);
|
|
332
|
-
req.on('timeout', () => { req.destroy(); reject(new Error('mcp timeout')); });
|
|
333
|
-
req.write(body);
|
|
334
|
-
req.end();
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
async function getKeyDecisionsFromSynapse(projectPath, n = 5) {
|
|
339
|
-
try {
|
|
340
|
-
// Use synapse_recall (project-scoped, honours projectPath) — NOT cortex_recall,
|
|
341
|
-
// which is cross-project global and would bleed core/other-project decisions
|
|
342
|
-
// into a sub-project's handoff (e.g. KenazAI HOOK_MARKER/TASK_574 into jiayao).
|
|
343
|
-
const result = await callMcpTool('synapse_recall', {
|
|
344
|
-
query: 'decision risk ash',
|
|
345
|
-
type: 'decision',
|
|
346
|
-
projectPath,
|
|
347
|
-
limit: n,
|
|
348
|
-
});
|
|
349
|
-
const runes = result?.runes || [];
|
|
350
|
-
if (!Array.isArray(runes) || runes.length === 0) return null;
|
|
351
|
-
return runes.slice(0, n).map((r) => {
|
|
352
|
-
const type = r.type || r.rune_type || 'rune';
|
|
353
|
-
const text = r.content || r.body || r.summary || '';
|
|
354
|
-
return `[${type}] ${String(text).substring(0, 100)}`;
|
|
355
|
-
}).filter(Boolean);
|
|
356
|
-
} catch {
|
|
357
|
-
return null;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
async function archiveHandoffToHippocampus(handoff, projectPath) {
|
|
362
|
-
try {
|
|
363
|
-
const startResult = await callMcpTool('hippocampus_episode_start', {
|
|
364
|
-
scope: `handoff:${handoff.session_id}`,
|
|
365
|
-
projectPath,
|
|
366
|
-
});
|
|
367
|
-
const episodeId = startResult?.episode_id;
|
|
368
|
-
if (!episodeId) return false;
|
|
369
|
-
|
|
370
|
-
await callMcpTool('hippocampus_episode_append', {
|
|
371
|
-
episode_id: episodeId,
|
|
372
|
-
phase: 'archive',
|
|
373
|
-
content: JSON.stringify(handoff, null, 2),
|
|
374
|
-
projectPath,
|
|
375
|
-
});
|
|
376
|
-
|
|
377
|
-
await callMcpTool('hippocampus_episode_close', {
|
|
378
|
-
episode_id: episodeId,
|
|
379
|
-
summary: `Archived handoff snapshot session=${handoff.session_id} trigger=${handoff.triggered_by}`,
|
|
380
|
-
outcome: 'archived',
|
|
381
|
-
projectPath,
|
|
382
|
-
});
|
|
383
|
-
return true;
|
|
384
|
-
} catch {
|
|
385
|
-
return false;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
292
|
// ─────────────────────────────────────────
|
|
390
293
|
// ISBAR builder
|
|
391
294
|
// ─────────────────────────────────────────
|
|
@@ -560,17 +463,15 @@ async function main() {
|
|
|
560
463
|
if (fs.existsSync(handoffPath)) {
|
|
561
464
|
try {
|
|
562
465
|
const existing = JSON.parse(fs.readFileSync(handoffPath, 'utf8'));
|
|
563
|
-
if (existing.session_id
|
|
564
|
-
await archiveHandoffToHippocampus(existing, projectPath);
|
|
565
|
-
} else if (existing.session_id === sessionId) {
|
|
466
|
+
if (existing.session_id === sessionId) {
|
|
566
467
|
priorHistory = Array.isArray(existing.history) ? existing.history.slice(-9) : [];
|
|
567
468
|
if (existing.generated_at) priorHistory.push(existing.generated_at);
|
|
568
469
|
}
|
|
569
470
|
} catch { /* ignore corrupt/missing */ }
|
|
570
471
|
}
|
|
571
472
|
|
|
572
|
-
//
|
|
573
|
-
const keyDecisions =
|
|
473
|
+
// Key decisions came from Synapse runes; the memory system was removed in TASK_2411.
|
|
474
|
+
const keyDecisions = null;
|
|
574
475
|
|
|
575
476
|
// Build handoff object
|
|
576
477
|
const generatedAt = new Date().toISOString();
|