@kawacode/mcp 6.1.2 → 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 +16 -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 +225 -7
- package/build/tools/index.js +18 -3
- package/build/tools/index.js.map +1 -1
- package/build/tools/infer-history.d.ts +16 -0
- package/build/tools/infer-history.js +27 -0
- package/build/tools/infer-history.js.map +1 -1
- package/build/tools/list-team-intents.d.ts +6 -6
- package/build/tools/list-team-intents.js +21 -32
- 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/build/tools/update-features.d.ts +31 -0
- package/build/tools/update-features.js +51 -0
- package/build/tools/update-features.js.map +1 -0
- package/package.json +2 -2
|
@@ -5,41 +5,23 @@ import { forkFieldsExtensions, extractForkFields } from './_fork-fields.js';
|
|
|
5
5
|
export const completeIntentSchema = z.object({
|
|
6
6
|
repoOrigin: z.string().optional().describe('Git remote origin URL. Auto-detected from repoPath via git if not provided.'),
|
|
7
7
|
repoPath: z.string().describe('Local path to the repository root'),
|
|
8
|
-
intentId: z.string().optional().describe('
|
|
8
|
+
intentId: z.string().optional().describe('Target intent to complete/abandon. When omitted, completes THIS session\'s current intent. When provided, targets that specific intent directly — this is how you force-close an intent that is not your current one (e.g. another session\'s). Completing an intent created by ANOTHER team member additionally requires humanApproved=true (see below).'),
|
|
9
9
|
commitSha: z.string().optional().describe('The git commit SHA to associate with this intent (if already committed)'),
|
|
10
10
|
status: z.enum(['committed', 'pushed', 'done', 'abandoned', 'superseded']).default('committed')
|
|
11
11
|
.describe('The new status for the intent. Use "committed" after git commit, "done" when work is complete, "abandoned" to discard, "superseded" when another intent replaces this one.'),
|
|
12
12
|
supersededBy: z.string().optional().describe('Intent ID that supersedes this one. Required when status is "superseded".'),
|
|
13
|
+
humanApproved: z.boolean().optional().describe('Set to true ONLY when the human has explicitly confirmed closing an intent created by ANOTHER team member. Required for that cross-author case; ignored for your own intents. NEVER set this on your own initiative — always ask the user first and only set it after they approve.'),
|
|
13
14
|
...forkFieldsExtensions,
|
|
14
15
|
});
|
|
15
16
|
export async function completeIntent(input) {
|
|
16
17
|
const actualOrigin = resolveOrigin(input.repoOrigin, input.repoPath);
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
intentId: input.intentId,
|
|
25
|
-
previousStatus: 'unknown',
|
|
26
|
-
newStatus: input.status,
|
|
27
|
-
commitSha: input.commitSha,
|
|
28
|
-
message: `No active intent found. Expected intent ${input.intentId.substring(0, 8)} but nothing is active.`
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
if (activeId !== input.intentId) {
|
|
32
|
-
const activeTitle = activeRes.intent?.title || 'unknown';
|
|
33
|
-
return {
|
|
34
|
-
success: false,
|
|
35
|
-
intentId: input.intentId,
|
|
36
|
-
previousStatus: 'unknown',
|
|
37
|
-
newStatus: input.status,
|
|
38
|
-
commitSha: input.commitSha,
|
|
39
|
-
message: `Intent mismatch: expected ${input.intentId.substring(0, 8)} but active intent is "${activeTitle}" (${activeId.substring(0, 8)}). Another session may have changed the active intent.`
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
}
|
|
18
|
+
// Multi-active model (IMPLEMENTATION_PLAN_MULTI_ACTIVE_INTENTS.md §7): `intentId`
|
|
19
|
+
// is a TARGET, forwarded to Muninn directly. When omitted, Muninn completes this
|
|
20
|
+
// session's current pointer; when provided, it targets that specific intent
|
|
21
|
+
// (force-close). There is no per-repo single "active" intent to verify against
|
|
22
|
+
// anymore, so the old get-active match-or-reject guard is gone. The same-user vs
|
|
23
|
+
// cross-user authorization (and the humanApproved requirement for closing a
|
|
24
|
+
// teammate's intent) is hard-enforced API-side.
|
|
43
25
|
// Muninn's v2 distillation pipeline (Sonnet distill + per-pair Haiku conflict
|
|
44
26
|
// judge + recall embeddings) can run well past the 30s default — measured
|
|
45
27
|
// 51s for superseded on an M3 (see kawa.muninn intent.rs). Override the
|
|
@@ -49,9 +31,11 @@ export async function completeIntent(input) {
|
|
|
49
31
|
const COMPLETE_TIMEOUT_MS = 180_000;
|
|
50
32
|
const res = await request('intent', 'complete', {
|
|
51
33
|
repoOrigin: actualOrigin,
|
|
34
|
+
intentId: input.intentId,
|
|
52
35
|
status: input.status,
|
|
53
36
|
commitSha: input.commitSha,
|
|
54
37
|
supersededBy: input.supersededBy,
|
|
38
|
+
humanApproved: input.humanApproved,
|
|
55
39
|
...extractForkFields(input),
|
|
56
40
|
}, COMPLETE_TIMEOUT_MS);
|
|
57
41
|
const intentId = res.intentId || '';
|
|
@@ -62,6 +46,7 @@ export async function completeIntent(input) {
|
|
|
62
46
|
const committedDecisionCount = typeof res.committedDecisionCount === 'number' ? res.committedDecisionCount : undefined;
|
|
63
47
|
const reason = res.reason === 'conflicts' || res.reason === 'transient-failure' ? res.reason : undefined;
|
|
64
48
|
const apiSyncDeferred = res.apiSyncDeferred === true;
|
|
49
|
+
const completionCollisions = Array.isArray(res.collisions) ? res.collisions : [];
|
|
65
50
|
// Branch on the four §7.2 / §7.3 outcome shapes — pick the message that
|
|
66
51
|
// tells the agent exactly what to surface to the user.
|
|
67
52
|
let newStatus;
|
|
@@ -130,7 +115,15 @@ export async function completeIntent(input) {
|
|
|
130
115
|
const deferredPart = apiSyncDeferred
|
|
131
116
|
? ` — API sync deferred (${(res.deferredStages || []).join(', ')}); will retry on the next sync tick`
|
|
132
117
|
: '';
|
|
133
|
-
|
|
118
|
+
// Layer C: a live HAI's in-progress diff overlaps the work just completed.
|
|
119
|
+
// Advisory coordination heads-up appended to the success message.
|
|
120
|
+
const collisionPart = completionCollisions.length > 0
|
|
121
|
+
? ` — heads-up: ${completionCollisions.length} live collaborator(s) overlap this work: ` +
|
|
122
|
+
completionCollisions
|
|
123
|
+
.map(c => `${c.label}${c.isAgent ? ' (agent)' : ''} on ${c.files.map(f => f.fpath).join(', ')}`)
|
|
124
|
+
.join('; ')
|
|
125
|
+
: '';
|
|
126
|
+
message = statusMsg + shaPart + distilledPart + deferredPart + collisionPart;
|
|
134
127
|
}
|
|
135
128
|
return {
|
|
136
129
|
success,
|
|
@@ -148,6 +141,7 @@ export async function completeIntent(input) {
|
|
|
148
141
|
deferredStages: Array.isArray(res.deferredStages) ? res.deferredStages : undefined,
|
|
149
142
|
deferredDecisionCount: typeof res.deferredDecisionCount === 'number' ? res.deferredDecisionCount : undefined,
|
|
150
143
|
deferredError: res.deferredError,
|
|
144
|
+
collisions: completionCollisions.length > 0 ? completionCollisions : undefined,
|
|
151
145
|
};
|
|
152
146
|
}
|
|
153
147
|
export const completeIntentTool = {
|
|
@@ -175,6 +169,10 @@ REQUIRED: Inspect the response after calling this tool. Four outcomes:
|
|
|
175
169
|
get_intent_decisions / get_relevant_context if the user wants details.
|
|
176
170
|
If response.apiSyncDeferred === true, also mention that the API sync was
|
|
177
171
|
deferred; the queued writes will replay on the next sync tick.
|
|
172
|
+
If response.collisions is non-empty, a live collaborator's (HAI's)
|
|
173
|
+
in-progress edits overlap the work you just completed — surface it as a
|
|
174
|
+
coordination heads-up (who, and which files), naming response.collisions[].label
|
|
175
|
+
and the files. It's advisory, not a failure; the completion still succeeded.
|
|
178
176
|
|
|
179
177
|
2. response.success === false AND response.conflicts is non-empty:
|
|
180
178
|
The distillation produced decisions that contradict existing standards in
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"complete-intent.js","sourceRoot":"","sources":["../../src/tools/complete-intent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE3E,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6EAA6E,CAAC;IACzH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IAClE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"complete-intent.js","sourceRoot":"","sources":["../../src/tools/complete-intent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE3E,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6EAA6E,CAAC;IACzH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IAClE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2VAA2V,CAA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,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS;QAC5G,aAAa,EAAE,GAAG,CAAC,aAAa;QAChC,UAAU,EAAE,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,SAAS;KAC/E,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0EAqD2D;IACxE,WAAW,EAAE,oBAAoB;IACjC,OAAO,EAAE,cAAc;CACxB,CAAA"}
|
|
@@ -65,32 +65,12 @@ interface ConflictInfo {
|
|
|
65
65
|
oppositionDetected: boolean;
|
|
66
66
|
oppositionDetail: string | null;
|
|
67
67
|
}
|
|
68
|
-
export interface ActiveIntentLockConflict {
|
|
69
|
-
existingIntentId: string;
|
|
70
|
-
title?: string;
|
|
71
|
-
createdBy?: string;
|
|
72
|
-
author?: string;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Soft-lock surfaced when a `pending` intent blocks creating a new one on
|
|
76
|
-
* the same repo. PRD_AGENT_COORDINATION_LAYER_02 §6.3 — the agent must prompt
|
|
77
|
-
* the user to abandon-or-finalize the pending one before proceeding.
|
|
78
|
-
*/
|
|
79
|
-
export interface PendingIntentBlocking {
|
|
80
|
-
intentId: string;
|
|
81
|
-
title?: string;
|
|
82
|
-
pendingReason?: string;
|
|
83
|
-
lastActivityAt?: string;
|
|
84
|
-
distilledDecisionCount?: number;
|
|
85
|
-
}
|
|
86
68
|
export interface CreateIntentResponse {
|
|
87
69
|
success: boolean;
|
|
88
70
|
intentId: string;
|
|
89
|
-
action: 'created' | 'reactivated' | 'conflict'
|
|
71
|
+
action: 'created' | 'reactivated' | 'conflict';
|
|
90
72
|
message: string;
|
|
91
73
|
conflicts?: ConflictInfo[];
|
|
92
|
-
lockConflict?: ActiveIntentLockConflict;
|
|
93
|
-
pendingIntent?: PendingIntentBlocking;
|
|
94
74
|
}
|
|
95
75
|
export declare function createAndActivateIntent(input: CreateIntentInput): Promise<CreateIntentResponse>;
|
|
96
76
|
export declare const createAndActivateIntentTool: {
|
|
@@ -14,8 +14,10 @@ export const createAndActivateIntentSchema = z.object({
|
|
|
14
14
|
});
|
|
15
15
|
export async function createAndActivateIntent(input) {
|
|
16
16
|
const actualOrigin = resolveOrigin(input.repoOrigin, input.repoPath);
|
|
17
|
-
// Step 1: Create the intent. If a sufficiently similar one
|
|
18
|
-
// server may reactivate it instead of creating a
|
|
17
|
+
// Step 1: Create the intent. If a sufficiently similar one created by THIS
|
|
18
|
+
// session already exists, the server may reactivate it instead of creating a
|
|
19
|
+
// duplicate (dedup is scoped per-session — IMPLEMENTATION_PLAN_MULTI_ACTIVE_INTENTS.md
|
|
20
|
+
// §10.4 — so two sessions' near-duplicates are surfaced as conflicts, not merged).
|
|
19
21
|
const createRes = await request('intent', 'create', {
|
|
20
22
|
repoOrigin: actualOrigin,
|
|
21
23
|
title: input.title,
|
|
@@ -26,19 +28,11 @@ export async function createAndActivateIntent(input) {
|
|
|
26
28
|
force: input.force || false,
|
|
27
29
|
...extractForkFields(input),
|
|
28
30
|
});
|
|
29
|
-
// Pending-intent soft lock — surfaced before any API write per PRD §6.3.
|
|
30
|
-
// The agent's job is to ask the user to dispose of the pending one before
|
|
31
|
-
// proceeding. force=true bypasses this for autonomous runs.
|
|
32
|
-
if (createRes.pendingIntentBlocking) {
|
|
33
|
-
return buildPendingBlockedResponse(createRes.pendingIntentBlocking);
|
|
34
|
-
}
|
|
35
31
|
// Handle conflict detection — API returned 409 with conflict data.
|
|
36
32
|
// Return the conflicts to the caller (Claude Code) so it can present
|
|
37
33
|
// them to the user and optionally retry with force=true.
|
|
38
34
|
if (createRes.conflict === true && createRes.conflicts) {
|
|
39
35
|
const conflicts = createRes.conflicts;
|
|
40
|
-
const highCount = conflicts.filter((c) => c.severity === 'high').length;
|
|
41
|
-
const mediumCount = conflicts.filter((c) => c.severity === 'medium').length;
|
|
42
36
|
const lines = [
|
|
43
37
|
`Found ${conflicts.length} potential conflict(s) with existing intents:`,
|
|
44
38
|
'',
|
|
@@ -74,38 +68,14 @@ export async function createAndActivateIntent(input) {
|
|
|
74
68
|
throw new Error('Intent creation succeeded but no intent ID was returned');
|
|
75
69
|
}
|
|
76
70
|
const action = createRes.action === 'reactivated' ? 'reactivated' : 'created';
|
|
77
|
-
// Step 2: Set it as active
|
|
78
|
-
//
|
|
79
|
-
//
|
|
80
|
-
|
|
81
|
-
const setRes = await request('intent', 'set-active', {
|
|
71
|
+
// Step 2: Set it as THIS session's current intent. Under the multi-active
|
|
72
|
+
// model (no lock) set-active never conflicts — many intents can be active per
|
|
73
|
+
// repo at once, and this only moves this session's `current` focus pointer.
|
|
74
|
+
await request('intent', 'set-active', {
|
|
82
75
|
repoOrigin: actualOrigin,
|
|
83
76
|
intentId,
|
|
84
|
-
force: input.force || false,
|
|
85
77
|
...extractForkFields(input),
|
|
86
78
|
});
|
|
87
|
-
// The set-active step has its own pending-intent soft-lock check (the lock
|
|
88
|
-
// holder may have transitioned to pending between steps 1 and 2, or the
|
|
89
|
-
// pre-check on create may have been skipped because the active intent was
|
|
90
|
-
// not the lock holder). Surface the same shaped response.
|
|
91
|
-
if (setRes.pendingIntentBlocking) {
|
|
92
|
-
return buildPendingBlockedResponse(setRes.pendingIntentBlocking, intentId);
|
|
93
|
-
}
|
|
94
|
-
if (setRes.conflict === true && setRes.conflictType === 'active_intent_lock') {
|
|
95
|
-
const lockConflict = await buildLockConflictDetails(actualOrigin, setRes.existingIntentId);
|
|
96
|
-
const idShort = setRes.existingIntentId.substring(0, 8);
|
|
97
|
-
const who = lockConflict.author ? ` by ${lockConflict.author}` : '';
|
|
98
|
-
const titlePart = lockConflict.title ? ` "${lockConflict.title}"` : '';
|
|
99
|
-
return {
|
|
100
|
-
success: false,
|
|
101
|
-
intentId,
|
|
102
|
-
action: 'lock_conflict',
|
|
103
|
-
lockConflict,
|
|
104
|
-
message: `Intent "${input.title}" was ${action} (id: ${intentId.substring(0, 8)}), but could not be activated: ` +
|
|
105
|
-
`repo already owns intent ${idShort}${titlePart}${who}. ` +
|
|
106
|
-
`Retry with force=true to take over, complete_intent on ${idShort} first, or abandon this new intent.`,
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
79
|
const message = action === 'reactivated'
|
|
110
80
|
? `Reactivated existing similar intent: "${input.title}" — resuming previous work instead of creating a duplicate.`
|
|
111
81
|
: `Created and activated intent: "${input.title}"`;
|
|
@@ -116,84 +86,26 @@ export async function createAndActivateIntent(input) {
|
|
|
116
86
|
message,
|
|
117
87
|
};
|
|
118
88
|
}
|
|
119
|
-
function buildPendingBlockedResponse(blocker, intentId = '') {
|
|
120
|
-
const pendingIntent = {
|
|
121
|
-
intentId: blocker.intentId || '',
|
|
122
|
-
title: blocker.title || undefined,
|
|
123
|
-
pendingReason: blocker.pendingReason || undefined,
|
|
124
|
-
lastActivityAt: blocker.lastActivityAt || undefined,
|
|
125
|
-
distilledDecisionCount: typeof blocker.distilledDecisionCount === 'number'
|
|
126
|
-
? blocker.distilledDecisionCount
|
|
127
|
-
: undefined,
|
|
128
|
-
};
|
|
129
|
-
const idShort = pendingIntent.intentId ? pendingIntent.intentId.substring(0, 8) : 'pending';
|
|
130
|
-
const titlePart = pendingIntent.title ? ` "${pendingIntent.title}"` : '';
|
|
131
|
-
const reasonPart = pendingIntent.pendingReason ? ` (reason: ${pendingIntent.pendingReason})` : '';
|
|
132
|
-
return {
|
|
133
|
-
success: false,
|
|
134
|
-
intentId,
|
|
135
|
-
action: 'pending_blocked',
|
|
136
|
-
pendingIntent,
|
|
137
|
-
message: `Pending intent ${idShort}${titlePart}${reasonPart} exists on this repo. ` +
|
|
138
|
-
`Ask the user how to proceed: ` +
|
|
139
|
-
`(A) abandon it via complete_intent(intentId="${pendingIntent.intentId}", status="abandoned"), ` +
|
|
140
|
-
`(C) complete and finalize it via complete_intent(intentId="${pendingIntent.intentId}", status="committed"), ` +
|
|
141
|
-
`then retry. To proceed without prompting, retry with force=true.`,
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
async function buildLockConflictDetails(repoOrigin, existingIntentId) {
|
|
145
|
-
try {
|
|
146
|
-
const res = await request('intent', 'get-active', { repoOrigin });
|
|
147
|
-
const intent = res.intent;
|
|
148
|
-
if (intent && intent.id === existingIntentId) {
|
|
149
|
-
return {
|
|
150
|
-
existingIntentId,
|
|
151
|
-
title: intent.title,
|
|
152
|
-
createdBy: intent.createdBy,
|
|
153
|
-
author: intent.authorInfo?.name || intent.author,
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
catch {
|
|
158
|
-
// Fall through to ID-only response
|
|
159
|
-
}
|
|
160
|
-
return { existingIntentId };
|
|
161
|
-
}
|
|
162
89
|
export const createAndActivateIntentTool = {
|
|
163
90
|
name: 'create_and_activate_intent',
|
|
164
|
-
description: `Create a new intent from the user's request and mark it as active.
|
|
91
|
+
description: `Create a new intent from the user's request and mark it as active for THIS session.
|
|
165
92
|
|
|
166
|
-
Call this when check_active_intent returns no active intent. Before calling:
|
|
93
|
+
Call this when check_active_intent returns no active intent for your session. Before calling:
|
|
167
94
|
1. Summarize what the user is asking for
|
|
168
95
|
2. Ask the user to confirm the intent details (title, description, type)
|
|
169
96
|
3. Then call this tool with the confirmed details
|
|
170
97
|
|
|
171
98
|
This ensures all AI-generated code gets properly tracked and attributed.
|
|
172
99
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
Three distinct block types exist:
|
|
178
|
-
|
|
179
|
-
- action="conflict": content-similarity conflict from intent creation (another
|
|
180
|
-
team member's intent overlaps semantically or in files). Bypassed by
|
|
181
|
-
force=true after the user reviews and chooses to proceed.
|
|
182
|
-
|
|
183
|
-
- action="lock_conflict": per-repo active-intent lock — another session on this
|
|
184
|
-
repo already owns the active intent slot. The new intent was still created
|
|
185
|
-
and can be activated later; or call complete_intent on the existing one first.
|
|
186
|
-
Bypassed by force=true (takes over the active slot).
|
|
100
|
+
Multi-active model: many intents can be active on a repo at once (one per
|
|
101
|
+
session/teammate). Creating + activating one only sets YOUR session's current
|
|
102
|
+
focus — it never blocks or displaces another session's active intent, so there
|
|
103
|
+
is no lock conflict to resolve.
|
|
187
104
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
(A) Abandon it: call complete_intent(intentId=..., status="abandoned").
|
|
193
|
-
(C) Complete and finalize: call complete_intent(intentId=..., status="committed").
|
|
194
|
-
After the user decides and the pending intent is disposed, retry create_and_activate_intent.
|
|
195
|
-
In autonomous (non-interactive) sessions, retry with force=true to proceed
|
|
196
|
-
without prompting — the pending intent stays pending.`,
|
|
105
|
+
If the tool returns conflicts (action="conflict"), it found an existing
|
|
106
|
+
team-member intent that overlaps semantically or in files. Present the conflict
|
|
107
|
+
details to the user and ask whether to proceed. If yes, retry with force=true to
|
|
108
|
+
bypass conflict detection.`,
|
|
197
109
|
inputSchema: createAndActivateIntentSchema,
|
|
198
110
|
handler: createAndActivateIntent
|
|
199
111
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-intent.js","sourceRoot":"","sources":["../../src/tools/create-intent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE3E,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IACpD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6EAA6E,CAAC;IACzH,QAAQ,EAAE,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;2BAiBY;IACzB,WAAW,EAAE,6BAA6B;IAC1C,OAAO,EAAE,uBAAuB;CACjC,CAAA"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const getDecisionDetailSchema: z.ZodObject<{
|
|
3
|
+
forkAuthor: z.ZodOptional<z.ZodObject<{
|
|
4
|
+
platform: z.ZodEnum<["github", "gitlab"]>;
|
|
5
|
+
user: z.ZodString;
|
|
6
|
+
forkOrigin: z.ZodString;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
platform: "github" | "gitlab";
|
|
9
|
+
user: string;
|
|
10
|
+
forkOrigin: string;
|
|
11
|
+
}, {
|
|
12
|
+
platform: "github" | "gitlab";
|
|
13
|
+
user: string;
|
|
14
|
+
forkOrigin: string;
|
|
15
|
+
}>>;
|
|
16
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
17
|
+
repoOrigin: z.ZodOptional<z.ZodString>;
|
|
18
|
+
repoPath: z.ZodString;
|
|
19
|
+
decisionId: z.ZodString;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
repoPath: string;
|
|
22
|
+
decisionId: string;
|
|
23
|
+
repoOrigin?: string | undefined;
|
|
24
|
+
forkAuthor?: {
|
|
25
|
+
platform: "github" | "gitlab";
|
|
26
|
+
user: string;
|
|
27
|
+
forkOrigin: string;
|
|
28
|
+
} | undefined;
|
|
29
|
+
workspaceId?: string | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
repoPath: string;
|
|
32
|
+
decisionId: string;
|
|
33
|
+
repoOrigin?: string | undefined;
|
|
34
|
+
forkAuthor?: {
|
|
35
|
+
platform: "github" | "gitlab";
|
|
36
|
+
user: string;
|
|
37
|
+
forkOrigin: string;
|
|
38
|
+
} | undefined;
|
|
39
|
+
workspaceId?: string | undefined;
|
|
40
|
+
}>;
|
|
41
|
+
export type GetDecisionDetailInput = z.infer<typeof getDecisionDetailSchema>;
|
|
42
|
+
export interface DecisionDetail {
|
|
43
|
+
decisionId: string;
|
|
44
|
+
intentId: string;
|
|
45
|
+
intentIds: string[];
|
|
46
|
+
type: string;
|
|
47
|
+
summary: string;
|
|
48
|
+
rationale: string;
|
|
49
|
+
context?: string;
|
|
50
|
+
alternatives: string[];
|
|
51
|
+
consequences?: string;
|
|
52
|
+
symptom?: string;
|
|
53
|
+
appliesWhen?: string | null;
|
|
54
|
+
relatedFiles: string[];
|
|
55
|
+
supersedes: string[];
|
|
56
|
+
constraintsChecked: string[];
|
|
57
|
+
constraintViolations: any[];
|
|
58
|
+
timestamp?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface GetDecisionDetailResponse {
|
|
61
|
+
found: boolean;
|
|
62
|
+
decision?: DecisionDetail;
|
|
63
|
+
error?: string;
|
|
64
|
+
}
|
|
65
|
+
export declare function getDecisionDetail(input: GetDecisionDetailInput): Promise<GetDecisionDetailResponse>;
|
|
66
|
+
export declare const getDecisionDetailTool: {
|
|
67
|
+
name: string;
|
|
68
|
+
description: string;
|
|
69
|
+
inputSchema: z.ZodObject<{
|
|
70
|
+
forkAuthor: z.ZodOptional<z.ZodObject<{
|
|
71
|
+
platform: z.ZodEnum<["github", "gitlab"]>;
|
|
72
|
+
user: z.ZodString;
|
|
73
|
+
forkOrigin: z.ZodString;
|
|
74
|
+
}, "strip", z.ZodTypeAny, {
|
|
75
|
+
platform: "github" | "gitlab";
|
|
76
|
+
user: string;
|
|
77
|
+
forkOrigin: string;
|
|
78
|
+
}, {
|
|
79
|
+
platform: "github" | "gitlab";
|
|
80
|
+
user: string;
|
|
81
|
+
forkOrigin: string;
|
|
82
|
+
}>>;
|
|
83
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
84
|
+
repoOrigin: z.ZodOptional<z.ZodString>;
|
|
85
|
+
repoPath: z.ZodString;
|
|
86
|
+
decisionId: z.ZodString;
|
|
87
|
+
}, "strip", z.ZodTypeAny, {
|
|
88
|
+
repoPath: string;
|
|
89
|
+
decisionId: string;
|
|
90
|
+
repoOrigin?: string | undefined;
|
|
91
|
+
forkAuthor?: {
|
|
92
|
+
platform: "github" | "gitlab";
|
|
93
|
+
user: string;
|
|
94
|
+
forkOrigin: string;
|
|
95
|
+
} | undefined;
|
|
96
|
+
workspaceId?: string | undefined;
|
|
97
|
+
}, {
|
|
98
|
+
repoPath: string;
|
|
99
|
+
decisionId: string;
|
|
100
|
+
repoOrigin?: string | undefined;
|
|
101
|
+
forkAuthor?: {
|
|
102
|
+
platform: "github" | "gitlab";
|
|
103
|
+
user: string;
|
|
104
|
+
forkOrigin: string;
|
|
105
|
+
} | undefined;
|
|
106
|
+
workspaceId?: string | undefined;
|
|
107
|
+
}>;
|
|
108
|
+
handler: typeof getDecisionDetail;
|
|
109
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { request } from '../services/muninn-ipc.js';
|
|
3
|
+
import { resolveOrigin } from './resolve-origin.js';
|
|
4
|
+
import { forkFieldsExtensions, extractForkFields } from './_fork-fields.js';
|
|
5
|
+
export const getDecisionDetailSchema = z.object({
|
|
6
|
+
repoOrigin: z.string().optional().describe('Git remote origin URL. Auto-detected from repoPath via git if not provided.'),
|
|
7
|
+
repoPath: z.string().describe('Local path to the repository root'),
|
|
8
|
+
decisionId: z.string().describe('The decision ID to expand (from a recall result, e.g. get_relevant_context)'),
|
|
9
|
+
...forkFieldsExtensions,
|
|
10
|
+
});
|
|
11
|
+
export async function getDecisionDetail(input) {
|
|
12
|
+
const actualOrigin = resolveOrigin(input.repoOrigin, input.repoPath);
|
|
13
|
+
const res = await request('decision', 'detail', {
|
|
14
|
+
repoOrigin: actualOrigin,
|
|
15
|
+
decisionId: input.decisionId,
|
|
16
|
+
...extractForkFields(input),
|
|
17
|
+
});
|
|
18
|
+
const d = res?.decision;
|
|
19
|
+
if (!d) {
|
|
20
|
+
return { found: false, error: res?.error || 'Decision not found' };
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
found: true,
|
|
24
|
+
decision: {
|
|
25
|
+
decisionId: d.decisionId || d.decision_id || d._id || d.id || '',
|
|
26
|
+
intentId: d.intentId || d.intent_id || d.intentIds?.[0] || d.intent_ids?.[0] || '',
|
|
27
|
+
intentIds: d.intentIds || d.intent_ids || (d.intentId || d.intent_id ? [d.intentId || d.intent_id] : []),
|
|
28
|
+
type: d.decisionType || d.decision_type || d.type || '',
|
|
29
|
+
summary: d.summary || '',
|
|
30
|
+
rationale: d.rationale || '',
|
|
31
|
+
context: d.context,
|
|
32
|
+
alternatives: d.alternatives || [],
|
|
33
|
+
consequences: d.consequences,
|
|
34
|
+
symptom: d.symptom,
|
|
35
|
+
appliesWhen: d.appliesWhen ?? d.applies_when ?? d.aw ?? null,
|
|
36
|
+
relatedFiles: d.relatedFiles || d.related_files || [],
|
|
37
|
+
supersedes: d.supersedes || [],
|
|
38
|
+
constraintsChecked: d.constraintsChecked || d.constraints_checked || [],
|
|
39
|
+
constraintViolations: d.constraintViolations || d.constraint_violations || [],
|
|
40
|
+
timestamp: d.timestamp || d.createdAt || d.created_at,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export const getDecisionDetailTool = {
|
|
45
|
+
name: 'get_decision_detail',
|
|
46
|
+
description: `Expand one decision to its full detail.
|
|
47
|
+
|
|
48
|
+
Recall surfaces (get_relevant_context, get_project_decisions, get_session_decisions) return decisions summary-only to keep context lean. Use this to pull the full reasoning for a single decision you want to open — pay for detail only where you ask for it.
|
|
49
|
+
|
|
50
|
+
Inputs:
|
|
51
|
+
- \`decisionId\`: the decision to expand (the \`id\` / \`decisionId\` from a recall result).
|
|
52
|
+
|
|
53
|
+
Returns the decision's \`rationale\`, \`context\`, \`consequences\`, \`alternatives\`, \`symptom\`, \`appliesWhen\`, and related metadata. \`found: false\` when the id is unknown in this repo.`,
|
|
54
|
+
inputSchema: getDecisionDetailSchema,
|
|
55
|
+
handler: getDecisionDetail
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=get-decision-detail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-decision-detail.js","sourceRoot":"","sources":["../../src/tools/get-decision-detail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE3E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6EAA6E,CAAC;IACzH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IAClE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6EAA6E,CAAC;IAC9G,GAAG,oBAAoB;CACxB,CAAC,CAAA;AA6BF,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,KAA6B;IACnE,MAAM,YAAY,GAAG,aAAa,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;IACpE,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,UAAU,EAAE,QAAQ,EAAE;QAC9C,UAAU,EAAE,YAAY;QACxB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,GAAG,iBAAiB,CAAC,KAAK,CAAC;KAC5B,CAAC,CAAA;IAEF,MAAM,CAAC,GAAG,GAAG,EAAE,QAAQ,CAAA;IACvB,IAAI,CAAC,CAAC,EAAE,CAAC;QACP,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,IAAI,oBAAoB,EAAE,CA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oBAAoB,EAAE,CAAC,CAAC,oBAAoB,IAAI,CAAC,CAAC,qBAAqB,IAAI,EAAE;YAC7E,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,UAAU;SACtD;KACF,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE;;;;;;;iMAOkL;IAC/L,WAAW,EAAE,uBAAuB;IACpC,OAAO,EAAE,iBAAiB;CAC3B,CAAA"}
|
|
@@ -48,10 +48,6 @@ export interface ProjectDecision {
|
|
|
48
48
|
timestamp: string;
|
|
49
49
|
type: 'fork' | 'abandoned' | 'discovery' | 'constraint' | 'tradeoff' | 'dependency';
|
|
50
50
|
summary: string;
|
|
51
|
-
rationale: string;
|
|
52
|
-
context?: string;
|
|
53
|
-
alternatives: string[];
|
|
54
|
-
consequences?: string;
|
|
55
51
|
relatedFiles: string[];
|
|
56
52
|
constraintsChecked: string[];
|
|
57
53
|
constraintViolations: ConstraintViolation[];
|
|
@@ -20,10 +20,9 @@ export async function getProjectDecisions(input) {
|
|
|
20
20
|
timestamp: d.timestamp || d.created_at || d.createdAt || '',
|
|
21
21
|
type: d.decision_type || d.decisionType || d.type,
|
|
22
22
|
summary: d.summary || '',
|
|
23
|
-
|
|
24
|
-
context
|
|
25
|
-
|
|
26
|
-
consequences: d.consequences,
|
|
23
|
+
// Lean payload (INTENT_INTELLIGENCE.md §5.8): the unbounded free-text fields
|
|
24
|
+
// (rationale/context/consequences/alternatives) are dropped from this recall
|
|
25
|
+
// surface. Fetch them on demand via get_decision_detail(decisionId).
|
|
27
26
|
relatedFiles: d.related_files || d.relatedFiles || [],
|
|
28
27
|
constraintsChecked: d.constraints_checked || d.constraintsChecked || [],
|
|
29
28
|
constraintViolations: d.constraint_violations || d.constraintViolations || []
|
|
@@ -47,11 +46,10 @@ Returns:
|
|
|
47
46
|
- decisions: Array of decisions with their intent context
|
|
48
47
|
- count: Total number of decisions
|
|
49
48
|
|
|
50
|
-
Each decision includes:
|
|
49
|
+
Each decision includes (summary-only, to keep context lean — call get_decision_detail(decisionId) for full rationale/context/consequences/alternatives):
|
|
51
50
|
- intentIds: The intents this decision belongs to (array — a decision can span multiple intents)
|
|
52
51
|
- type: fork, abandoned, discovery, constraint, tradeoff, or dependency
|
|
53
52
|
- summary: Brief description of the decision
|
|
54
|
-
- rationale: Why this decision was made
|
|
55
53
|
- relatedFiles: Files affected by this decision
|
|
56
54
|
- constraintViolations: Options that were rejected due to constraints`,
|
|
57
55
|
inputSchema: getProjectDecisionsSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-project-decisions.js","sourceRoot":"","sources":["../../src/tools/get-project-decisions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE3E,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6EAA6E,CAAC;IACzH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IAClE,GAAG,oBAAoB;CACxB,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"get-project-decisions.js","sourceRoot":"","sources":["../../src/tools/get-project-decisions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,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AAG,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE;QACxD,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,SAAS,IAAI,EAAE;QAC3D,IAAI,EAAE,CAAC,CAAC,aAAa,IAAI,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,IAAI;QACjD,OAAO,EAAE,CAAC,CAAC,OAAO,IAAI,EAAE;QACxB,6EAA6E;QAC7E,6EAA6E;QAC7E,qEAAqE;QACrE,YAAY,EAAE,CAAC,CAAC,aAAa,IAAI,CAAC,CAAC,YAAY,IAAI,EAAE;QACrD,kBAAkB,EAAE,CAAC,CAAC,mBAAmB,IAAI,CAAC,CAAC,kBAAkB,IAAI,EAAE;QACvE,oBAAoB,EAAE,CAAC,CAAC,qBAAqB,IAAI,CAAC,CAAC,oBAAoB,IAAI,EAAE;KAC9E,CAAC,CAAC,CAAA;IAEH,OAAO;QACL,SAAS;QACT,KAAK,EAAE,SAAS,CAAC,MAAM;KACxB,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE;;;;;;;;;;;;;;;;;sEAiBuD;IACpE,WAAW,EAAE,yBAAyB;IACtC,OAAO,EAAE,mBAAmB;CAC7B,CAAA"}
|
|
@@ -59,7 +59,9 @@ export async function getRelevantContext(input) {
|
|
|
59
59
|
intentIds: d.intentIds || d.intent_ids || (d.intentId || d.intent_id ? [d.intentId || d.intent_id] : []),
|
|
60
60
|
type: d.decisionType || d.decision_type || d.type || '',
|
|
61
61
|
summary: d.summary || '',
|
|
62
|
-
|
|
62
|
+
// Lean payload (INTENT_INTELLIGENCE.md §5.8): rationale is dropped from the
|
|
63
|
+
// recall surface — it dominated context accumulation (re-sent every turn).
|
|
64
|
+
// Fetch full rationale on demand via get_decision_detail(decisionId).
|
|
63
65
|
relatedFiles: d.relatedFiles || d.related_files || [],
|
|
64
66
|
hasViolations: (d.constraintViolations || d.constraint_violations || []).length > 0,
|
|
65
67
|
score: d.score || 0,
|
|
@@ -88,7 +90,7 @@ Inputs of note:
|
|
|
88
90
|
|
|
89
91
|
Returns:
|
|
90
92
|
- \`relevantIntents\`: past work units (intents) related to the task, scored by relevance.
|
|
91
|
-
- \`relevantDecisions\`: prior decisions related to the task — both intent-scoped and repo-scoped.
|
|
93
|
+
- \`relevantDecisions\`: prior decisions related to the task — both intent-scoped and repo-scoped. Summary-only (no inline rationale, to keep context lean); call \`get_decision_detail(decisionId)\` for the full rationale/context/consequences of any decision you want to open.
|
|
92
94
|
|
|
93
95
|
Recommended sequence:
|
|
94
96
|
1. \`check_active_intent\` at session start to resume any existing work.
|