@kawacode/mcp 6.1.5 → 6.6.1
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/CLAUDE.md.example +2 -0
- package/build/index.js +13 -1
- package/build/index.js.map +1 -1
- package/build/kawacode-on-pre-edit.d.ts +5 -0
- package/build/kawacode-on-pre-edit.js +45 -6
- package/build/kawacode-on-pre-edit.js.map +1 -1
- package/build/kawacode-on-stop.d.ts +49 -23
- package/build/kawacode-on-stop.js +233 -38
- package/build/kawacode-on-stop.js.map +1 -1
- package/build/services/muninn-ipc.d.ts +19 -1
- package/build/services/muninn-ipc.js +20 -2
- package/build/services/muninn-ipc.js.map +1 -1
- package/build/stop/uncompleted-commit.d.ts +45 -0
- package/build/stop/uncompleted-commit.js +117 -0
- package/build/stop/uncompleted-commit.js.map +1 -0
- package/build/stop/uncompleted-commit.test.d.ts +1 -0
- package/build/stop/uncompleted-commit.test.js +105 -0
- package/build/stop/uncompleted-commit.test.js.map +1 -0
- package/build/tools/activate-intent.d.ts +1 -14
- package/build/tools/activate-intent.js +17 -56
- package/build/tools/activate-intent.js.map +1 -1
- package/build/tools/arbiter-apply.d.ts +132 -0
- package/build/tools/arbiter-apply.js +59 -0
- package/build/tools/arbiter-apply.js.map +1 -0
- package/build/tools/arbiter-resolve.d.ts +132 -0
- package/build/tools/arbiter-resolve.js +58 -0
- package/build/tools/arbiter-resolve.js.map +1 -0
- package/build/tools/check-active-intent.d.ts +21 -12
- package/build/tools/check-active-intent.js +26 -13
- package/build/tools/check-active-intent.js.map +1 -1
- package/build/tools/complete-intent.d.ts +29 -0
- package/build/tools/complete-intent.js +26 -28
- package/build/tools/complete-intent.js.map +1 -1
- package/build/tools/create-intent.d.ts +1 -21
- package/build/tools/create-intent.js +18 -106
- package/build/tools/create-intent.js.map +1 -1
- package/build/tools/get-decision-detail.d.ts +109 -0
- package/build/tools/get-decision-detail.js +57 -0
- package/build/tools/get-decision-detail.js.map +1 -0
- package/build/tools/get-project-decisions.d.ts +0 -4
- package/build/tools/get-project-decisions.js +4 -6
- package/build/tools/get-project-decisions.js.map +1 -1
- package/build/tools/get-relevant-context.d.ts +0 -1
- package/build/tools/get-relevant-context.js +4 -2
- package/build/tools/get-relevant-context.js.map +1 -1
- package/build/tools/get-resolution-context.d.ts +154 -0
- package/build/tools/get-resolution-context.js +78 -0
- package/build/tools/get-resolution-context.js.map +1 -0
- package/build/tools/get-session-decisions.d.ts +0 -5
- package/build/tools/get-session-decisions.js +5 -5
- package/build/tools/get-session-decisions.js.map +1 -1
- package/build/tools/index.d.ts +210 -7
- package/build/tools/index.js +13 -3
- package/build/tools/index.js.map +1 -1
- package/build/tools/list-team-intents.d.ts +6 -6
- package/build/tools/list-team-intents.js +2 -2
- package/build/tools/list-team-intents.js.map +1 -1
- package/build/tools/pre-edit-decision-check.js +2 -0
- package/build/tools/pre-edit-decision-check.js.map +1 -1
- package/build/tools/record-decision.d.ts +76 -0
- package/build/tools/record-decision.js +10 -0
- package/build/tools/record-decision.js.map +1 -1
- package/package.json +2 -2
package/CLAUDE.md.example
CHANGED
|
@@ -9,6 +9,8 @@ Guidance for Claude Code when working in this repository.
|
|
|
9
9
|
|
|
10
10
|
## Workflow — run on every non-trivial turn
|
|
11
11
|
|
|
12
|
+
> **Recall before you explore — every turn, including questions and investigation.** On a new request in an indexed sub-project, your *first* tool call is `get_relevant_context` (paraphrase the ask + name any files you already know) — **before** the first Read/Grep/Bash/Explore, not after. The common failure this prevents: opening a turn with search and never pulling prior decisions. `check_active_intent` is secondary (only when you may edit).
|
|
13
|
+
|
|
12
14
|
1. **Check active intent** — `check_active_intent` (kawa-intents MCP). Resume if one exists.
|
|
13
15
|
2. **Get relevant context** — `get_relevant_context` with a task description. Past decisions and related intents inform the approach.
|
|
14
16
|
3. **Now** explore code, read files, plan.
|
package/build/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
|
3
3
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
4
|
import { CallToolRequestSchema, ListToolsRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';
|
|
5
5
|
import { connectToMuninn, ensureRepo } from './services/muninn-ipc.js';
|
|
6
|
-
import { allTools, getRelevantContext, checkActiveIntent, createAndActivateIntent, activateIntent, getIntentsForFile, getIntentsForLines, listTeamIntents, getIntentChanges, completeIntent, updateIntent, logWork, recordDecision, getSessionDecisions, getProjectDecisions, editSessionDecision, detectIntentConflicts, inferHistory, evolveDecisions, updateFeatures, preEditDecisionCheck, preEditAcknowledge } from './tools/index.js';
|
|
6
|
+
import { allTools, getRelevantContext, checkActiveIntent, createAndActivateIntent, activateIntent, getIntentsForFile, getIntentsForLines, listTeamIntents, getIntentChanges, completeIntent, updateIntent, logWork, recordDecision, getSessionDecisions, getProjectDecisions, getDecisionDetail, editSessionDecision, detectIntentConflicts, inferHistory, evolveDecisions, updateFeatures, preEditDecisionCheck, preEditAcknowledge, getResolutionContext, arbiterResolve, arbiterApply } from './tools/index.js';
|
|
7
7
|
import { prompts } from './prompts/intent-first-workflow.js';
|
|
8
8
|
import { resources, readActiveIntentResource } from './resources/active-intent.js';
|
|
9
9
|
// Create MCP server
|
|
@@ -91,6 +91,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
91
91
|
case 'get_project_decisions':
|
|
92
92
|
result = await getProjectDecisions(args);
|
|
93
93
|
break;
|
|
94
|
+
case 'get_decision_detail':
|
|
95
|
+
result = await getDecisionDetail(args);
|
|
96
|
+
break;
|
|
94
97
|
case 'edit_session_decision':
|
|
95
98
|
result = await editSessionDecision(args);
|
|
96
99
|
break;
|
|
@@ -112,6 +115,15 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
112
115
|
case 'pre_edit_acknowledge':
|
|
113
116
|
result = await preEditAcknowledge(args);
|
|
114
117
|
break;
|
|
118
|
+
case 'get_resolution_context':
|
|
119
|
+
result = await getResolutionContext(args);
|
|
120
|
+
break;
|
|
121
|
+
case 'arbiter_resolve':
|
|
122
|
+
result = await arbiterResolve(args);
|
|
123
|
+
break;
|
|
124
|
+
case 'arbiter_apply':
|
|
125
|
+
result = await arbiterApply(args);
|
|
126
|
+
break;
|
|
115
127
|
default:
|
|
116
128
|
throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
|
|
117
129
|
}
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAA;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,EACzB,SAAS,EACT,QAAQ,EACT,MAAM,oCAAoC,CAAA;AAE3C,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAEtE,OAAO,EACL,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,EACvB,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,OAAO,EACP,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAA;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,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AAC,KAAK,CAAC,oEAAoE,CAAC,CAAA;IACrF,CAAC;IAED,4BAA4B;IAC5B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAA;IAC5C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IAE/B,OAAO,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAA;AAClD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAA;IACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
|
|
@@ -18,6 +18,11 @@
|
|
|
18
18
|
* - "review" → exit 0 + JSON on stdout (advisory)
|
|
19
19
|
* - "proceed" / silent → exit 0, no output
|
|
20
20
|
*
|
|
21
|
+
* This hook carries only the SEMANTIC (decision-tier) signal. The live-HAI
|
|
22
|
+
* code-collision signal was relocated off this per-edit path to a once-per-turn
|
|
23
|
+
* check in kawacode-on-stop (COLLISION_SURFACE_RELOCATION.md) — pre-edit no
|
|
24
|
+
* longer queries or surfaces collisions.
|
|
25
|
+
*
|
|
21
26
|
* Failure discipline: every error path exits 0. Hook must not block
|
|
22
27
|
* Claude Code's turn loop on infra issues. (Same fail-soft carve-out
|
|
23
28
|
* as kawacode-on-stop — see that file's header for the rule.)
|
|
@@ -18,6 +18,11 @@
|
|
|
18
18
|
* - "review" → exit 0 + JSON on stdout (advisory)
|
|
19
19
|
* - "proceed" / silent → exit 0, no output
|
|
20
20
|
*
|
|
21
|
+
* This hook carries only the SEMANTIC (decision-tier) signal. The live-HAI
|
|
22
|
+
* code-collision signal was relocated off this per-edit path to a once-per-turn
|
|
23
|
+
* check in kawacode-on-stop (COLLISION_SURFACE_RELOCATION.md) — pre-edit no
|
|
24
|
+
* longer queries or surfaces collisions.
|
|
25
|
+
*
|
|
21
26
|
* Failure discipline: every error path exits 0. Hook must not block
|
|
22
27
|
* Claude Code's turn loop on infra issues. (Same fail-soft carve-out
|
|
23
28
|
* as kawacode-on-stop — see that file's header for the rule.)
|
|
@@ -95,19 +100,53 @@ function resolveTarget(payload) {
|
|
|
95
100
|
}
|
|
96
101
|
return null;
|
|
97
102
|
}
|
|
103
|
+
// Payload economy for the one inline-rationale surface (INTENT_INTELLIGENCE.md §5.8).
|
|
104
|
+
// This block is injected into the agent transcript and is append-only — it
|
|
105
|
+
// re-sends every turn until compaction — so per-fire size is first-class.
|
|
106
|
+
// - RATIONALE_CHARS: each rationale is truncated to this, with a never-silent
|
|
107
|
+
// marker that doubles as the expand pointer (amount cut + get_decision_detail).
|
|
108
|
+
// - MAX_BLOCK_TOKENS: a per-fire budget; once exceeded, remaining decisions are
|
|
109
|
+
// dropped with an explicit "N more suppressed" line (never a silent cap).
|
|
110
|
+
const RATIONALE_CHARS = 280;
|
|
111
|
+
const MAX_BLOCK_TOKENS = 600;
|
|
112
|
+
const CHARS_PER_TOKEN = 4; // coarse char→token approximation; deterministic, no tokenizer dep
|
|
113
|
+
const MAX_BLOCK_CHARS = MAX_BLOCK_TOKENS * CHARS_PER_TOKEN;
|
|
114
|
+
function truncateRationale(d) {
|
|
115
|
+
const r = d.rationale ?? '';
|
|
116
|
+
if (r.length <= RATIONALE_CHARS)
|
|
117
|
+
return r;
|
|
118
|
+
const head = r.slice(0, RATIONALE_CHARS).trimEnd();
|
|
119
|
+
const cut = r.length - head.length;
|
|
120
|
+
return `${head}… ⟨+${cut} chars · get_decision_detail("${d.decisionId}")⟩`;
|
|
121
|
+
}
|
|
98
122
|
function formatBlockMessage(target, res) {
|
|
99
123
|
const lines = [];
|
|
100
124
|
const symbol = res.enclosingSymbol?.name ? ` (in ${res.enclosingSymbol.name})` : '';
|
|
101
125
|
lines.push(`Pre-edit decision check: prior reasoning is attached to ${target.filePath}:${target.startLine}-${target.endLine}${symbol}.`);
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
126
|
+
const decisions = res.decisions ?? [];
|
|
127
|
+
let usedChars = 0;
|
|
128
|
+
let shown = 0;
|
|
129
|
+
for (const d of decisions) {
|
|
130
|
+
const entry = [` • [${d.type}] ${d.summary ?? ''}`];
|
|
131
|
+
const rationale = truncateRationale(d);
|
|
132
|
+
if (rationale)
|
|
133
|
+
entry.push(` ${rationale}`);
|
|
134
|
+
const entryChars = entry.join('\n').length;
|
|
135
|
+
// Always show at least one decision, even if it alone exceeds the budget.
|
|
136
|
+
if (shown > 0 && usedChars + entryChars > MAX_BLOCK_CHARS) {
|
|
137
|
+
const remaining = decisions.length - shown;
|
|
138
|
+
lines.push(` … ${remaining} more decision${remaining === 1 ? '' : 's'} suppressed (per-fire budget) — call get_decision_detail(decisionId) to inspect.`);
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
lines.push(...entry);
|
|
142
|
+
usedChars += entryChars;
|
|
143
|
+
shown += 1;
|
|
106
144
|
}
|
|
107
145
|
lines.push('');
|
|
108
146
|
lines.push('Override options:');
|
|
109
|
-
lines.push(' 1) record_decision(type:"fork", supersedes:[<id>], rationale:"...") then retry the Edit.');
|
|
110
|
-
|
|
147
|
+
lines.push(' 1) record_decision(type:"fork", supersedes:[<id>], rationale:"...") then retry the Edit — persistent (records lineage across sessions).');
|
|
148
|
+
const ackIds = decisions.map(d => `"${d.decisionId}"`).join(', ');
|
|
149
|
+
lines.push(` 2) pre_edit_acknowledge({ decisionIds: [${ackIds}] }) to override for THIS session, then retry the Edit.`);
|
|
111
150
|
return lines.join('\n');
|
|
112
151
|
}
|
|
113
152
|
async function main() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kawacode-on-pre-edit.js","sourceRoot":"","sources":["../src/kawacode-on-pre-edit.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"kawacode-on-pre-edit.js","sourceRoot":"","sources":["../src/kawacode-on-pre-edit.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;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I,GAAG,EAAE,cAAc,KAAK,QAAQ,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG;YACV,kBAAkB,EAAE;gBAClB,aAAa,EAAE,YAAY;gBAC3B,iBAAiB,EAAE,kBAAkB,CAAC,MAAM,EAAE,GAAG,CAAC;aACnD;SACF,CAAA;QACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAA;QAChD,UAAU,EAAE,CAAA;QACZ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IAED,oBAAoB;IACpB,UAAU,EAAE,CAAA;IACZ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -2,32 +2,58 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* kawacode-on-stop — Claude Code Stop hook dispatcher.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* and sends two short IPCs to Muninn:
|
|
5
|
+
* Fires three independent, fail-soft jobs at the end of every turn:
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
7
|
+
* 1. Thought capture (opt out: KAWA_THOUGHT_CAPTURE=off) — two IPCs to Muninn:
|
|
8
|
+
* a. capture-thoughts:capture { sessionId, transcriptPath, cwd }
|
|
9
|
+
* → Muninn reads the transcript, extracts the assistant's text
|
|
10
|
+
* content blocks (the model's visible responses), and appends them
|
|
11
|
+
* as JSONL to ~/.kawa-code/thoughts/active/session-{id}.jsonl.
|
|
12
|
+
* Thinking blocks are deliberately ignored — Claude Code redacts
|
|
13
|
+
* their plaintext on disk, so they carry no recoverable signal.
|
|
14
|
+
* b. extractor:trigger { session_id, cwd }
|
|
15
|
+
* → Muninn wakes the (debounced) extractor service which reads the
|
|
16
|
+
* fresh JSONL and emits ephemeral decisions verbalized in the
|
|
17
|
+
* assistant's responses.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
19
|
+
* 2. Live-HAI collision report (opt out: KAWA_STOP_COLLISION_CHECK=off) — ONE
|
|
20
|
+
* IPC, stop-collision:check { repoOrigin, repoPath } (_agentId auto-stamped).
|
|
21
|
+
* Muninn recomputes the turn's working-tree diff and runs the transient
|
|
22
|
+
* /repos/collisions read once per changed file (no publish), returning the
|
|
23
|
+
* peers grouped by HAI plus the per-repo advisory|block mode. This is the
|
|
24
|
+
* once-per-turn relocation of the old per-edit Tier-2 collision check
|
|
25
|
+
* (COLLISION_SURFACE_RELOCATION.md). When peers overlap this turn's work:
|
|
26
|
+
* - advisory (default): inject the report via additionalContext (model-
|
|
27
|
+
* only context; the agent self-judges whether to coordinate/rework/
|
|
28
|
+
* surface to the user).
|
|
29
|
+
* - block (per-repo setting): emit { decision:"block", reason } so the
|
|
30
|
+
* turn stays open until the agent addresses it — but only when
|
|
31
|
+
* stop_hook_active is not already set, so we never loop the block.
|
|
23
32
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
33
|
+
* 3. complete_intent hard gate (opt out: KAWA_COMPLETE_GATE=off) — blocks the
|
|
34
|
+
* turn when the agent ran `git commit` under an active intent but never
|
|
35
|
+
* finalized it with complete_intent, so distillation + code-block
|
|
36
|
+
* auto-capture aren't silently skipped. Detection is pure Claude Code
|
|
37
|
+
* transcript introspection (the hook's job, not Muninn's): scan for the
|
|
38
|
+
* last CONFIRMED `git commit` vs the last complete_intent tool_use. A
|
|
39
|
+
* commit is confirmed only when its command invokes git commit AND its
|
|
40
|
+
* tool_result carries git's `[<ref> <shorthash>]` success line — so a
|
|
41
|
+
* command that merely mentions "git commit" as data (printf/heredoc) is
|
|
42
|
+
* not misread as a commit. Gate only when a commit lands AFTER the most
|
|
43
|
+
* recent complete_intent call (or with none after it) — a failed/attempted
|
|
44
|
+
* complete_intent still counts as "tried", so conflict-resolution turns
|
|
45
|
+
* are not nagged. Then confirm via intent:get-active that THIS session
|
|
46
|
+
* still has an open current intent (supplies its id/title). Output mirrors
|
|
47
|
+
* job 2: { decision:"block", reason } guarded by !stop_hook_active; once a
|
|
48
|
+
* block has fired it degrades to additionalContext (block once, then
|
|
49
|
+
* advise — never loop). Takes precedence over the collision report on the
|
|
50
|
+
* turn it fires (finalizing the intent matters more; collisions re-surface
|
|
51
|
+
* next turn).
|
|
30
52
|
*
|
|
31
|
-
*
|
|
53
|
+
* Failure discipline: every error path exits 0. Claude Code's Stop hook must
|
|
54
|
+
* never block the turn loop on capture/collision failure or Muninn being down.
|
|
55
|
+
* This is the ONLY place fail-soft is allowed under the no-Muninn-independence
|
|
56
|
+
* rule — the hook is the boundary between the harness (which can't recover) and
|
|
57
|
+
* Muninn (which re-derives missing state on the next Stop / at complete_intent).
|
|
32
58
|
*/
|
|
33
59
|
export {};
|
|
@@ -2,36 +2,65 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* kawacode-on-stop — Claude Code Stop hook dispatcher.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* and sends two short IPCs to Muninn:
|
|
5
|
+
* Fires three independent, fail-soft jobs at the end of every turn:
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
7
|
+
* 1. Thought capture (opt out: KAWA_THOUGHT_CAPTURE=off) — two IPCs to Muninn:
|
|
8
|
+
* a. capture-thoughts:capture { sessionId, transcriptPath, cwd }
|
|
9
|
+
* → Muninn reads the transcript, extracts the assistant's text
|
|
10
|
+
* content blocks (the model's visible responses), and appends them
|
|
11
|
+
* as JSONL to ~/.kawa-code/thoughts/active/session-{id}.jsonl.
|
|
12
|
+
* Thinking blocks are deliberately ignored — Claude Code redacts
|
|
13
|
+
* their plaintext on disk, so they carry no recoverable signal.
|
|
14
|
+
* b. extractor:trigger { session_id, cwd }
|
|
15
|
+
* → Muninn wakes the (debounced) extractor service which reads the
|
|
16
|
+
* fresh JSONL and emits ephemeral decisions verbalized in the
|
|
17
|
+
* assistant's responses.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
19
|
+
* 2. Live-HAI collision report (opt out: KAWA_STOP_COLLISION_CHECK=off) — ONE
|
|
20
|
+
* IPC, stop-collision:check { repoOrigin, repoPath } (_agentId auto-stamped).
|
|
21
|
+
* Muninn recomputes the turn's working-tree diff and runs the transient
|
|
22
|
+
* /repos/collisions read once per changed file (no publish), returning the
|
|
23
|
+
* peers grouped by HAI plus the per-repo advisory|block mode. This is the
|
|
24
|
+
* once-per-turn relocation of the old per-edit Tier-2 collision check
|
|
25
|
+
* (COLLISION_SURFACE_RELOCATION.md). When peers overlap this turn's work:
|
|
26
|
+
* - advisory (default): inject the report via additionalContext (model-
|
|
27
|
+
* only context; the agent self-judges whether to coordinate/rework/
|
|
28
|
+
* surface to the user).
|
|
29
|
+
* - block (per-repo setting): emit { decision:"block", reason } so the
|
|
30
|
+
* turn stays open until the agent addresses it — but only when
|
|
31
|
+
* stop_hook_active is not already set, so we never loop the block.
|
|
23
32
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
33
|
+
* 3. complete_intent hard gate (opt out: KAWA_COMPLETE_GATE=off) — blocks the
|
|
34
|
+
* turn when the agent ran `git commit` under an active intent but never
|
|
35
|
+
* finalized it with complete_intent, so distillation + code-block
|
|
36
|
+
* auto-capture aren't silently skipped. Detection is pure Claude Code
|
|
37
|
+
* transcript introspection (the hook's job, not Muninn's): scan for the
|
|
38
|
+
* last CONFIRMED `git commit` vs the last complete_intent tool_use. A
|
|
39
|
+
* commit is confirmed only when its command invokes git commit AND its
|
|
40
|
+
* tool_result carries git's `[<ref> <shorthash>]` success line — so a
|
|
41
|
+
* command that merely mentions "git commit" as data (printf/heredoc) is
|
|
42
|
+
* not misread as a commit. Gate only when a commit lands AFTER the most
|
|
43
|
+
* recent complete_intent call (or with none after it) — a failed/attempted
|
|
44
|
+
* complete_intent still counts as "tried", so conflict-resolution turns
|
|
45
|
+
* are not nagged. Then confirm via intent:get-active that THIS session
|
|
46
|
+
* still has an open current intent (supplies its id/title). Output mirrors
|
|
47
|
+
* job 2: { decision:"block", reason } guarded by !stop_hook_active; once a
|
|
48
|
+
* block has fired it degrades to additionalContext (block once, then
|
|
49
|
+
* advise — never loop). Takes precedence over the collision report on the
|
|
50
|
+
* turn it fires (finalizing the intent matters more; collisions re-surface
|
|
51
|
+
* next turn).
|
|
30
52
|
*
|
|
31
|
-
*
|
|
53
|
+
* Failure discipline: every error path exits 0. Claude Code's Stop hook must
|
|
54
|
+
* never block the turn loop on capture/collision failure or Muninn being down.
|
|
55
|
+
* This is the ONLY place fail-soft is allowed under the no-Muninn-independence
|
|
56
|
+
* rule — the hook is the boundary between the harness (which can't recover) and
|
|
57
|
+
* Muninn (which re-derives missing state on the next Stop / at complete_intent).
|
|
32
58
|
*/
|
|
33
59
|
import { readFileSync } from 'node:fs';
|
|
60
|
+
import { execSync } from 'node:child_process';
|
|
34
61
|
import { connectToMuninn, request, disconnect } from './services/muninn-ipc.js';
|
|
62
|
+
import { resolveOrigin } from './tools/resolve-origin.js';
|
|
63
|
+
import { detectUncompletedCommit } from './stop/uncompleted-commit.js';
|
|
35
64
|
function readStdin() {
|
|
36
65
|
try {
|
|
37
66
|
return readFileSync(0, 'utf8');
|
|
@@ -40,10 +69,155 @@ function readStdin() {
|
|
|
40
69
|
return '';
|
|
41
70
|
}
|
|
42
71
|
}
|
|
72
|
+
/** Render one HAI's overlapping files as `path:1-3,7` (single-line ranges
|
|
73
|
+
* collapse to a single number). */
|
|
74
|
+
function formatFiles(files) {
|
|
75
|
+
return files
|
|
76
|
+
.map(f => {
|
|
77
|
+
const ranges = f.ranges
|
|
78
|
+
.map(r => (r[0] === r[1] ? `${r[0]}` : `${r[0]}-${r[1]}`))
|
|
79
|
+
.join(',');
|
|
80
|
+
return `${f.fpath}:${ranges}`;
|
|
81
|
+
})
|
|
82
|
+
.join('; ');
|
|
83
|
+
}
|
|
84
|
+
/** Lean report (payload economy — injected into the append-only transcript):
|
|
85
|
+
* a header plus one bullet per overlapping HAI. The guidance tail is added by
|
|
86
|
+
* the caller per advisory/block mode. */
|
|
87
|
+
function formatCollisionReport(collisions) {
|
|
88
|
+
const lines = [
|
|
89
|
+
`Live-edit collision check: ${collisions.length} collaborator(s) have in-progress edits overlapping your changes this turn.`,
|
|
90
|
+
];
|
|
91
|
+
for (const c of collisions) {
|
|
92
|
+
const tag = c.isAgent ? ' (agent)' : '';
|
|
93
|
+
lines.push(` • ${c.label || c.uid}${tag} — ${formatFiles(c.files)}`);
|
|
94
|
+
}
|
|
95
|
+
return lines.join('\n');
|
|
96
|
+
}
|
|
97
|
+
/** Run the once-per-turn collision check. Returns the hook-protocol JSON string
|
|
98
|
+
* to print (advisory additionalContext or a block-to-continue), or null when
|
|
99
|
+
* there's nothing to surface / on any failure (fail-soft). */
|
|
100
|
+
async function runCollisionCheck(payload) {
|
|
101
|
+
if (process.env.KAWA_STOP_COLLISION_CHECK === 'off')
|
|
102
|
+
return null;
|
|
103
|
+
const cwd = payload.cwd;
|
|
104
|
+
if (!cwd)
|
|
105
|
+
return null;
|
|
106
|
+
let repoOrigin;
|
|
107
|
+
try {
|
|
108
|
+
repoOrigin = resolveOrigin(undefined, cwd);
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
return null; // not a git repo / git unavailable — skip
|
|
112
|
+
}
|
|
113
|
+
let res;
|
|
114
|
+
try {
|
|
115
|
+
res = await request('stop-collision', 'check', { repoOrigin, repoPath: cwd });
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
return null; // Muninn error/timeout — fail open, no report, no block
|
|
119
|
+
}
|
|
120
|
+
const collisions = res?.collisions ?? [];
|
|
121
|
+
if (collisions.length === 0)
|
|
122
|
+
return null;
|
|
123
|
+
const report = formatCollisionReport(collisions);
|
|
124
|
+
// Block-to-continue only when the per-repo setting is on AND we're not already
|
|
125
|
+
// inside a prior block (else the turn can never end).
|
|
126
|
+
if (res?.mode === 'block' && payload.stop_hook_active !== true) {
|
|
127
|
+
return JSON.stringify({
|
|
128
|
+
decision: 'block',
|
|
129
|
+
reason: `${report}\n\nResolve this before ending the turn: coordinate, rework, or surface it to the user.`,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
// Advisory (the default; also where block degrades when stop_hook_active).
|
|
133
|
+
return JSON.stringify({
|
|
134
|
+
hookSpecificOutput: {
|
|
135
|
+
hookEventName: 'Stop',
|
|
136
|
+
additionalContext: `${report}\n\nThis is advisory — decide whether to coordinate, rework, or surface it to the user before committing.`,
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
// ===== Job 3: complete_intent hard gate =====
|
|
141
|
+
/** Read the transcript file and detect an uncompleted commit (fail-soft → false). */
|
|
142
|
+
function scanTranscriptForUncompletedCommit(transcriptPath) {
|
|
143
|
+
let raw;
|
|
144
|
+
try {
|
|
145
|
+
raw = readFileSync(transcriptPath, 'utf8');
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
return detectUncompletedCommit(raw);
|
|
151
|
+
}
|
|
152
|
+
/** Current HEAD sha for `cwd`, or null if unavailable. */
|
|
153
|
+
function gitHeadSha(cwd) {
|
|
154
|
+
try {
|
|
155
|
+
return execSync('git rev-parse HEAD', { cwd, encoding: 'utf8', timeout: 5000, windowsHide: true }).trim();
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The complete_intent hard gate. Returns the hook-protocol JSON to print
|
|
163
|
+
* (a block, or a degraded advisory), or null when there's nothing to gate /
|
|
164
|
+
* on any failure (fail-soft). Mirrors runCollisionCheck's output protocol.
|
|
165
|
+
*/
|
|
166
|
+
async function runCompleteGate(payload) {
|
|
167
|
+
if (process.env.KAWA_COMPLETE_GATE === 'off')
|
|
168
|
+
return null;
|
|
169
|
+
const cwd = payload.cwd;
|
|
170
|
+
const transcriptPath = payload.transcript_path;
|
|
171
|
+
if (!cwd || !transcriptPath)
|
|
172
|
+
return null;
|
|
173
|
+
// Cheap, IPC-free evidence first: did the agent commit without completing?
|
|
174
|
+
if (!scanTranscriptForUncompletedCommit(transcriptPath))
|
|
175
|
+
return null;
|
|
176
|
+
let repoOrigin;
|
|
177
|
+
try {
|
|
178
|
+
repoOrigin = resolveOrigin(undefined, cwd);
|
|
179
|
+
}
|
|
180
|
+
catch {
|
|
181
|
+
return null; // not a git repo / git unavailable — skip
|
|
182
|
+
}
|
|
183
|
+
// Confirm THIS session still has an open current intent (supplies id/title).
|
|
184
|
+
let res;
|
|
185
|
+
try {
|
|
186
|
+
res = await request('intent', 'get-active', { repoOrigin });
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
return null; // Muninn error/timeout — fail open, no gate
|
|
190
|
+
}
|
|
191
|
+
const intent = res?.intent;
|
|
192
|
+
if (!intent?.id)
|
|
193
|
+
return null; // already finalized (completion clears current) or no intent in play
|
|
194
|
+
if ((intent.status || 'active') !== 'active')
|
|
195
|
+
return null;
|
|
196
|
+
const headSha = gitHeadSha(cwd);
|
|
197
|
+
const shaShort = headSha ? ` (${headSha.slice(0, 8)})` : '';
|
|
198
|
+
const title = intent.title ? `"${intent.title}"` : 'the active intent';
|
|
199
|
+
const call = `complete_intent(intentId="${intent.id}", status="committed"${headSha ? `, commitSha="${headSha}"` : ''})`;
|
|
200
|
+
const reason = `You committed${shaShort} under ${title} but didn't finalize it. Run ${call} so its ` +
|
|
201
|
+
`decisions distill and code blocks are captured. If this commit isn't meant to finalize the ` +
|
|
202
|
+
`intent, complete it with the correct status or surface it to the user.`;
|
|
203
|
+
// Block-to-continue, unless we already blocked once this turn (avoid a loop).
|
|
204
|
+
if (payload.stop_hook_active !== true) {
|
|
205
|
+
return JSON.stringify({ decision: 'block', reason });
|
|
206
|
+
}
|
|
207
|
+
// Degrade to advisory so the turn can end after a single block.
|
|
208
|
+
return JSON.stringify({
|
|
209
|
+
hookSpecificOutput: {
|
|
210
|
+
hookEventName: 'Stop',
|
|
211
|
+
additionalContext: `Reminder — ${reason}`,
|
|
212
|
+
},
|
|
213
|
+
});
|
|
214
|
+
}
|
|
43
215
|
async function main() {
|
|
44
|
-
|
|
216
|
+
const captureOff = process.env.KAWA_THOUGHT_CAPTURE === 'off';
|
|
217
|
+
const collisionOff = process.env.KAWA_STOP_COLLISION_CHECK === 'off';
|
|
218
|
+
const gateOff = process.env.KAWA_COMPLETE_GATE === 'off';
|
|
219
|
+
if (captureOff && collisionOff && gateOff)
|
|
45
220
|
process.exit(0);
|
|
46
|
-
}
|
|
47
221
|
const raw = readStdin();
|
|
48
222
|
if (!raw)
|
|
49
223
|
process.exit(0);
|
|
@@ -57,31 +231,52 @@ async function main() {
|
|
|
57
231
|
const sessionId = payload.session_id;
|
|
58
232
|
const transcriptPath = payload.transcript_path;
|
|
59
233
|
const cwd = payload.cwd;
|
|
60
|
-
if (!sessionId || !transcriptPath)
|
|
61
|
-
process.exit(0);
|
|
62
234
|
try {
|
|
63
235
|
await connectToMuninn();
|
|
64
236
|
}
|
|
65
237
|
catch {
|
|
66
|
-
// Muninn down. Capture happens whenever Muninn is next up
|
|
67
|
-
//
|
|
238
|
+
// Muninn down. Capture happens whenever Muninn is next up (the extractor's
|
|
239
|
+
// checkpoint advances on the next successful capture); collision detection
|
|
240
|
+
// simply yields no report this turn.
|
|
68
241
|
process.exit(0);
|
|
69
242
|
}
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
request('capture-thoughts', 'capture', {
|
|
243
|
+
// Thought capture (fire-and-forget; each IPC tolerant of the other's failure).
|
|
244
|
+
const captureTasks = [];
|
|
245
|
+
if (!captureOff && sessionId && transcriptPath) {
|
|
246
|
+
captureTasks.push(request('capture-thoughts', 'capture', {
|
|
75
247
|
sessionId,
|
|
76
248
|
transcriptPath,
|
|
77
249
|
cwd: cwd ?? null,
|
|
78
|
-
}),
|
|
79
|
-
request('extractor', 'trigger', {
|
|
250
|
+
}), request('extractor', 'trigger', {
|
|
80
251
|
session_id: sessionId,
|
|
81
252
|
cwd: cwd ?? '',
|
|
82
|
-
})
|
|
83
|
-
|
|
253
|
+
}));
|
|
254
|
+
}
|
|
255
|
+
// Hook-protocol stdout producers, in precedence order. The complete_intent
|
|
256
|
+
// gate wins the turn it fires (finalizing the intent matters more than a
|
|
257
|
+
// collision advisory; collisions re-surface next turn). Only one JSON object
|
|
258
|
+
// may be written, so fall through to the collision report only when the gate
|
|
259
|
+
// produced nothing (the common case).
|
|
260
|
+
let output = null;
|
|
261
|
+
try {
|
|
262
|
+
output = await runCompleteGate(payload);
|
|
263
|
+
}
|
|
264
|
+
catch {
|
|
265
|
+
output = null; // belt-and-suspenders fail-soft
|
|
266
|
+
}
|
|
267
|
+
if (!output) {
|
|
268
|
+
try {
|
|
269
|
+
output = await runCollisionCheck(payload);
|
|
270
|
+
}
|
|
271
|
+
catch {
|
|
272
|
+
output = null;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
if (captureTasks.length > 0)
|
|
276
|
+
await Promise.allSettled(captureTasks);
|
|
84
277
|
disconnect();
|
|
278
|
+
if (output)
|
|
279
|
+
process.stdout.write(output + '\n');
|
|
85
280
|
process.exit(0);
|
|
86
281
|
}
|
|
87
282
|
main().catch(() => process.exit(0));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kawacode-on-stop.js","sourceRoot":"","sources":["../src/kawacode-on-stop.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"kawacode-on-stop.js","sourceRoot":"","sources":["../src/kawacode-on-stop.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAE7C,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AA0BtE,SAAS,SAAS;IAChB,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAA;IACX,CAAC;AACH,CAAC;AAED;oCACoC;AACpC,SAAS,WAAW,CAAC,KAA8C;IACjE,OAAO,KAAK;SACT,GAAG,CAAC,CAAC,CAAC,EAAE;QACP,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM;aACpB,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;aACzD,IAAI,CAAC,GAAG,CAAC,CAAA;QACZ,OAAO,GAAG,CAAC,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