ceulen 0.16.1 → 0.17.0
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.17.0 — 2026-10-13
|
|
4
|
+
|
|
5
|
+
- **Munin loop fixed** (incident report 2026-10-12; two sessions on
|
|
6
|
+
glm-5.3-flash looped 30/33 consecutive munin_search/munin_get calls while
|
|
7
|
+
intending munin_store, losing both sessions' memories):
|
|
8
|
+
- `munin_store` promoted DIRECT — a deferred store silently vanished from
|
|
9
|
+
the live tool schema across plan-mode transitions / branch restores, and
|
|
10
|
+
a model cannot emit a tool absent from its request's tool array, so it
|
|
11
|
+
looped on the always-declared read neighbors instead. The protocol's
|
|
12
|
+
terminal action is now declared in every configured session (plan mode
|
|
13
|
+
still blocks it via BLOCKED_TOOLS). Guarded by the registry tier test.
|
|
14
|
+
- Consecutive-call loop dampener on the munin read tools: the 3rd identical
|
|
15
|
+
-args call or 6th same-tool call (any args — incident A's queries
|
|
16
|
+
degenerated/varied) returns guidance ("call munin_store directly")
|
|
17
|
+
instead of executing. Resets on a different munin tool, ANY non-munin
|
|
18
|
+
tool_call (protocol-compliant search→work→search sessions never
|
|
19
|
+
accumulate), session_start, and after guidance fires. 7 new tests.
|
|
20
|
+
- Protocol header + skill text aligned: "munin_search/munin_get/
|
|
21
|
+
munin_store are always declared".
|
|
22
|
+
- Live-verified post-reload (4 probes: schema declaration, both dampener
|
|
23
|
+
rules, non-munin reset).
|
|
24
|
+
|
|
3
25
|
## 0.16.1 — 2026-10-10
|
|
4
26
|
|
|
5
27
|
- **herdr stall recovery rewritten on output evidence** — live probing
|
|
@@ -17,7 +39,13 @@
|
|
|
17
39
|
across all five agent types under 4-way concurrency, including a mid-turn
|
|
18
40
|
Z.ai 429 recovery; 6 new regression tests (`test/herdr-stalled.test.ts`).
|
|
19
41
|
|
|
20
|
-
## 0.16.0 — 2026-10-09
|
|
42
|
+
## 0.16.0 — 2026-10-09 (never released separately)
|
|
43
|
+
|
|
44
|
+
The v0.16.0 tag/release was not created (bump+changelog landed in commit
|
|
45
|
+
`901cc0e`, but the tag step was skipped), so publish.yml never ran for it and
|
|
46
|
+
npm jumped 0.15.2 → 0.16.1. Its full content ships inside **0.16.1** together
|
|
47
|
+
with the a474b… review wave (27 defect fixes) — do not create a v0.16.0
|
|
48
|
+
release retroactively: it would publish a pre-security-fix artifact.
|
|
21
49
|
|
|
22
50
|
- **RTK selective rewrite** — the prompt note states the policy honestly
|
|
23
51
|
(RTK rewrites only what it models; chains, redirects, and inline scripts
|
|
@@ -50,11 +50,14 @@ describe("isProjectTrusted", () => {
|
|
|
50
50
|
|
|
51
51
|
describe("deferredTools tiers", () => {
|
|
52
52
|
// 2026-10-08 usage re-eval: these four were promoted from deferred to
|
|
53
|
-
// direct.
|
|
53
|
+
// direct. 2026-10-12 munin-loop incident: munin_store joined them — a
|
|
54
|
+
// deferred store vanished from the live schema across plan-mode/branch
|
|
55
|
+
// restores and the model looped on the read neighbors. A registry edit that
|
|
56
|
+
// silently reverts any of these must fail here.
|
|
54
57
|
it("keeps the promoted hot tools out of every deferred list", async () => {
|
|
55
58
|
const { MODULES } = await import("./registry.js");
|
|
56
59
|
const allDeferred = new Set(MODULES.flatMap((m) => m.deferredTools ?? []));
|
|
57
|
-
for (const hot of ["munin_search", "munin_get", "github", "ux_audit"]) {
|
|
60
|
+
for (const hot of ["munin_search", "munin_get", "munin_store", "github", "ux_audit"]) {
|
|
58
61
|
assert.equal(allDeferred.has(hot), false, `${hot} must stay direct`);
|
|
59
62
|
}
|
|
60
63
|
});
|
|
@@ -134,11 +134,16 @@ export const MODULES: ModuleEntry[] = [
|
|
|
134
134
|
// munin_search + munin_get are DIRECT (2026-10-08 usage re-eval): the Memory
|
|
135
135
|
// Protocol is injected into every configured session and its before-acting
|
|
136
136
|
// rule is a search — forcing a tool_search round-trip first was pure
|
|
137
|
-
// latency.
|
|
137
|
+
// latency. munin_store joined them DIRECT (2026-10-12 munin-loop incident):
|
|
138
|
+
// it is the protocol's terminal action (every configured session's last
|
|
139
|
+
// munin call), and a deferred store silently vanished from the live schema
|
|
140
|
+
// across plan-mode transitions / branch restores — the model then cannot
|
|
141
|
+
// emit it at all and loops on the always-declared read neighbors (two full
|
|
142
|
+
// sessions lost). The remaining five stay deferred: list/recent/delete/
|
|
138
143
|
// capabilities/share are needed only after search/get evidence is in hand
|
|
139
144
|
// (and store/delete/share stay behind plan mode's BLOCKED_TOOLS).
|
|
140
145
|
{ name: "munin", category: "Memory", describe: "Munin long-term memory tools (search/get/store/list/recent/delete/capabilities/share) + memory protocol. Config at project level.", load: muninModule, config: muninConfig, deferredTools: [
|
|
141
|
-
"
|
|
146
|
+
"munin_list", "munin_recent", "munin_delete", "munin_capabilities", "munin_share",
|
|
142
147
|
] },
|
|
143
148
|
// ── Tasks ──────────────────────────────────────────────────────────────
|
|
144
149
|
{ name: "ponytail", category: "Tasks", describe: "Lazy-senior-dev mode: prompts, skills, subagent instructions.", load: ponytailModule, config: ponytailConfig },
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
//
|
|
3
3
|
// Ported from @bacnh85/pi-munin 0.5.12 extensions/index.ts (SDK vendored to
|
|
4
4
|
// lib/sdk.ts; dotenv dropped — ceulen's bundle env.ts ingests trusted .env).
|
|
5
|
-
// Registers the 8 munin_* tools (search/get direct; the other
|
|
6
|
-
// tool_search loads them),
|
|
5
|
+
// Registers the 8 munin_* tools (search/get/store direct; the other five
|
|
6
|
+
// deferred — tool_search loads them), the consecutive-call loop dampener,
|
|
7
7
|
// /munin-status, the Munin Memory Protocol injection (only when configured),
|
|
8
8
|
// the tool_result error sanitizer, and the munin skill (resources_discover).
|
|
9
9
|
// Config lives at PROJECT level (.pi/settings.json `munin` section) — see
|
|
@@ -69,8 +69,8 @@ const MUNIN_PROTOCOL_HEADER = `## Munin Memory Protocol
|
|
|
69
69
|
|
|
70
70
|
Use Munin to recover and preserve verified project knowledge, not as a task log.
|
|
71
71
|
If Munin is unavailable, state that briefly when it matters and continue from
|
|
72
|
-
repository evidence. munin_search/munin_get are always declared;
|
|
73
|
-
munin_* tools load on demand with one tool_search call for "munin".
|
|
72
|
+
repository evidence. munin_search/munin_get/munin_store are always declared;
|
|
73
|
+
the other munin_* tools load on demand with one tool_search call for "munin".
|
|
74
74
|
|
|
75
75
|
### Before acting
|
|
76
76
|
|
|
@@ -265,7 +265,65 @@ function invokeMuninAction(
|
|
|
265
265
|
// generic (same pattern as ux_audit).
|
|
266
266
|
type AnyTool = ToolDefinition<any, unknown>;
|
|
267
267
|
|
|
268
|
-
|
|
268
|
+
/** Read-only munin tools the dampener may suppress (mutators are confirm-gated
|
|
269
|
+
* already; suppress-on-repeat has no legitimacy case there). */
|
|
270
|
+
const DAMPENED_TOOLS = new Set(["munin_search", "munin_get", "munin_list", "munin_recent"]);
|
|
271
|
+
|
|
272
|
+
/** Loop-dampener state (2026-10-12 munin-loop incident: a model intending
|
|
273
|
+
* munin_store emitted the always-declared read neighbors 30/33× and could not
|
|
274
|
+
* stop). Tracks the CONSECUTIVE munin_* run: same-tool run length and the
|
|
275
|
+
* identical-args run length. Reset by a different munin tool, ANY non-munin
|
|
276
|
+
* tool call (a protocol-compliant session interleaves non-munin work between
|
|
277
|
+
* searches — it must never accumulate), session_start, and after guidance
|
|
278
|
+
* fires (a renewed loop re-trips the same threshold). */
|
|
279
|
+
interface DampenerState {
|
|
280
|
+
lastTool: string | undefined;
|
|
281
|
+
runCount: number;
|
|
282
|
+
lastArgsSig: string | undefined;
|
|
283
|
+
identicalRunCount: number;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function createDampener() {
|
|
287
|
+
const state: DampenerState = { lastTool: undefined, runCount: 0, lastArgsSig: undefined, identicalRunCount: 0 };
|
|
288
|
+
|
|
289
|
+
function reset(): void {
|
|
290
|
+
state.lastTool = undefined;
|
|
291
|
+
state.runCount = 0;
|
|
292
|
+
state.lastArgsSig = undefined;
|
|
293
|
+
state.identicalRunCount = 0;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/** Record one munin tool call; returns guidance (do-not-execute) only for
|
|
297
|
+
* read tools: 3rd consecutive identical-args call, or 6th consecutive
|
|
298
|
+
* same-tool call with any args (incident A's queries degenerated/varied —
|
|
299
|
+
* an identical-args-only rule would have missed it). */
|
|
300
|
+
function dampenCheck(name: string, params: Record<string, unknown>): { text: string; runCount: number; identicalRunCount: number } | undefined {
|
|
301
|
+
if (name !== state.lastTool) {
|
|
302
|
+
state.lastTool = name;
|
|
303
|
+
state.runCount = 1;
|
|
304
|
+
state.identicalRunCount = 0;
|
|
305
|
+
state.lastArgsSig = undefined;
|
|
306
|
+
} else {
|
|
307
|
+
state.runCount += 1;
|
|
308
|
+
}
|
|
309
|
+
const sig = JSON.stringify(Object.entries(params ?? {}).sort());
|
|
310
|
+
state.identicalRunCount = sig === state.lastArgsSig ? state.identicalRunCount + 1 : 1;
|
|
311
|
+
state.lastArgsSig = sig;
|
|
312
|
+
|
|
313
|
+
if (!DAMPENED_TOOLS.has(name)) return undefined;
|
|
314
|
+
const fire = state.identicalRunCount >= 3 || state.runCount >= 6;
|
|
315
|
+
if (!fire) return undefined;
|
|
316
|
+
const text =
|
|
317
|
+
`${name} has been called ${Math.max(state.runCount, state.identicalRunCount)} times in a row — repeating it returns nothing new. ` +
|
|
318
|
+
`If you intend to STORE memory, call munin_store directly (always available). Otherwise state your finding and move on.`;
|
|
319
|
+
reset();
|
|
320
|
+
return { text, runCount: state.runCount, identicalRunCount: state.identicalRunCount };
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
return { state, reset, dampenCheck };
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function makeTools(dampenCheck: (name: string, params: Record<string, unknown>) => { text: string } | undefined): AnyTool[] {
|
|
269
327
|
return [
|
|
270
328
|
{
|
|
271
329
|
name: "munin_search",
|
|
@@ -298,6 +356,8 @@ function makeTools(): AnyTool[] {
|
|
|
298
356
|
),
|
|
299
357
|
}),
|
|
300
358
|
async execute(_id, params, _signal, _onUpdate, ctx) {
|
|
359
|
+
const dampened = dampenCheck("munin_search", params as Record<string, unknown>);
|
|
360
|
+
if (dampened) return { content: [{ type: "text" as const, text: dampened.text }], details: { dampened: true, ...dampened } };
|
|
301
361
|
const { query, topK = 10, tags, tag_mode, since, before, include_total } = params as Record<string, any>;
|
|
302
362
|
validateSearchQuery(query);
|
|
303
363
|
const tagMode = validateTagMode(tag_mode);
|
|
@@ -330,6 +390,8 @@ function makeTools(): AnyTool[] {
|
|
|
330
390
|
key: Type.String({ description: "Key to retrieve." }),
|
|
331
391
|
}),
|
|
332
392
|
async execute(_id, params, _signal, _onUpdate, ctx) {
|
|
393
|
+
const dampened = dampenCheck("munin_get", params as Record<string, unknown>);
|
|
394
|
+
if (dampened) return { content: [{ type: "text" as const, text: dampened.text }], details: { dampened: true, ...dampened } };
|
|
333
395
|
const { key: rawKey } = params as Record<string, any>;
|
|
334
396
|
const key = validateMemoryKey(rawKey);
|
|
335
397
|
const result = await withMuninClient(params as Record<string, unknown>, async (client, projectId) => {
|
|
@@ -374,6 +436,8 @@ function makeTools(): AnyTool[] {
|
|
|
374
436
|
),
|
|
375
437
|
}),
|
|
376
438
|
async execute(_id, params, _signal, _onUpdate, ctx) {
|
|
439
|
+
const dampened = dampenCheck("munin_store", params as Record<string, unknown>);
|
|
440
|
+
if (dampened) return { content: [{ type: "text" as const, text: dampened.text }], details: { dampened: true, ...dampened } };
|
|
377
441
|
const { key: rawKey, title, content, tags, valid_from, valid_to, pinned } = params as Record<string, any>;
|
|
378
442
|
const key = validateMemoryKey(rawKey);
|
|
379
443
|
const tagValidation = validateMemoryTags(tags);
|
|
@@ -415,6 +479,8 @@ function makeTools(): AnyTool[] {
|
|
|
415
479
|
),
|
|
416
480
|
}),
|
|
417
481
|
async execute(_id, params, _signal, _onUpdate, ctx) {
|
|
482
|
+
const dampened = dampenCheck("munin_list", params as Record<string, unknown>);
|
|
483
|
+
if (dampened) return { content: [{ type: "text" as const, text: dampened.text }], details: { dampened: true, ...dampened } };
|
|
418
484
|
const { limit = 20, offset = 0 } = params as Record<string, any>;
|
|
419
485
|
const result = await withMuninClient(params as Record<string, unknown>, async (client, projectId) => {
|
|
420
486
|
return callMunin(client, projectId, "list", { limit, offset });
|
|
@@ -440,6 +506,8 @@ function makeTools(): AnyTool[] {
|
|
|
440
506
|
),
|
|
441
507
|
}),
|
|
442
508
|
async execute(_id, params, _signal, _onUpdate, ctx) {
|
|
509
|
+
const dampened = dampenCheck("munin_recent", params as Record<string, unknown>);
|
|
510
|
+
if (dampened) return { content: [{ type: "text" as const, text: dampened.text }], details: { dampened: true, ...dampened } };
|
|
443
511
|
const { limit = 10 } = params as Record<string, any>;
|
|
444
512
|
const result = await withMuninClient(params as Record<string, unknown>, async (client, projectId) => {
|
|
445
513
|
return callMunin(client, projectId, "recent", { limit });
|
|
@@ -464,6 +532,8 @@ function makeTools(): AnyTool[] {
|
|
|
464
532
|
key: Type.String({ description: "Key to delete." }),
|
|
465
533
|
}),
|
|
466
534
|
async execute(_id, params, _signal, _onUpdate, ctx) {
|
|
535
|
+
const dampened = dampenCheck("munin_delete", params as Record<string, unknown>);
|
|
536
|
+
if (dampened) return { content: [{ type: "text" as const, text: dampened.text }], details: { dampened: true, ...dampened } };
|
|
467
537
|
const { key: rawKey } = params as Record<string, any>;
|
|
468
538
|
const key = validateMemoryKey(rawKey);
|
|
469
539
|
const confirmed = await ctx.ui.confirm(
|
|
@@ -499,6 +569,8 @@ function makeTools(): AnyTool[] {
|
|
|
499
569
|
...controlSchema,
|
|
500
570
|
}),
|
|
501
571
|
async execute(_id, params, _signal, _onUpdate, ctx) {
|
|
572
|
+
const dampened = dampenCheck("munin_capabilities", params as Record<string, unknown>);
|
|
573
|
+
if (dampened) return { content: [{ type: "text" as const, text: dampened.text }], details: { dampened: true, ...dampened } };
|
|
502
574
|
const result = await withMuninClient(params as Record<string, unknown>, async (client, projectId) => {
|
|
503
575
|
return callMunin(client, projectId, "capabilities", {});
|
|
504
576
|
}, ctx);
|
|
@@ -523,6 +595,8 @@ function makeTools(): AnyTool[] {
|
|
|
523
595
|
target_project_ids: Type.Array(Type.String(), { description: "Target project IDs." }),
|
|
524
596
|
}),
|
|
525
597
|
async execute(_id, params, _signal, _onUpdate, ctx) {
|
|
598
|
+
const dampened = dampenCheck("munin_share", params as Record<string, unknown>);
|
|
599
|
+
if (dampened) return { content: [{ type: "text" as const, text: dampened.text }], details: { dampened: true, ...dampened } };
|
|
526
600
|
const { memory_ids, target_project_ids } = params as Record<string, any>;
|
|
527
601
|
const confirmed = await ctx.ui.confirm(
|
|
528
602
|
"Share Munin memories?",
|
|
@@ -577,7 +651,20 @@ export default function muninExtension(pi: ExtensionAPI) {
|
|
|
577
651
|
skillPaths: [path.join(skillsRoot(), "munin")],
|
|
578
652
|
}));
|
|
579
653
|
|
|
580
|
-
|
|
654
|
+
const dampener = createDampener();
|
|
655
|
+
|
|
656
|
+
// Any NON-munin tool call breaks the consecutive munin run: a
|
|
657
|
+
// protocol-compliant session interleaves non-munin work between searches and
|
|
658
|
+
// must never accumulate toward the dampener (both 2026-10-12 incidents were
|
|
659
|
+
// munin-only back-to-back sequences — true loops stay caught).
|
|
660
|
+
pi.on("tool_call", async (event) => {
|
|
661
|
+
if (!String(event.toolName || "").startsWith("munin_")) dampener.reset();
|
|
662
|
+
return undefined;
|
|
663
|
+
});
|
|
664
|
+
|
|
665
|
+
pi.on("session_start", () => dampener.reset());
|
|
666
|
+
|
|
667
|
+
for (const tool of makeTools(dampener.dampenCheck)) {
|
|
581
668
|
pi.registerTool(tool as AnyTool);
|
|
582
669
|
}
|
|
583
670
|
|
|
@@ -222,3 +222,127 @@ describe("munin extension", () => {
|
|
|
222
222
|
assert.equal(await hook({ toolName: "munin_search", isError: false, content: [{ type: "text", text: "ok" }] }), undefined);
|
|
223
223
|
});
|
|
224
224
|
});
|
|
225
|
+
|
|
226
|
+
describe("loop dampener", () => {
|
|
227
|
+
beforeEach(() => {
|
|
228
|
+
process.env.MUNIN_API_KEY = "key";
|
|
229
|
+
process.env.MUNIN_PROJECT = "project";
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
afterEach(() => {
|
|
233
|
+
delete process.env.MUNIN_API_KEY;
|
|
234
|
+
delete process.env.MUNIN_PROJECT;
|
|
235
|
+
delete (MuninClient.prototype as { invoke?: unknown }).invoke;
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
function stubInvoke(calls: string[]): void {
|
|
239
|
+
MuninClient.prototype.invoke = async function (this: unknown, _projectId: string, action: string) {
|
|
240
|
+
calls.push(action);
|
|
241
|
+
return { ok: true } as any;
|
|
242
|
+
} as typeof MuninClient.prototype.invoke;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
it("3rd identical munin_get returns guidance without executing", async () => {
|
|
246
|
+
const { tools, ctx } = harness();
|
|
247
|
+
const calls: string[] = [];
|
|
248
|
+
stubInvoke(calls);
|
|
249
|
+
for (let i = 0; i < 2; i++) {
|
|
250
|
+
const r = await tools.munin_get.execute("id", { key: "bug-fix/some-key" }, undefined, undefined, ctx);
|
|
251
|
+
assert.equal((r.details as { dampened?: boolean }).dampened ?? false, false);
|
|
252
|
+
}
|
|
253
|
+
assert.equal(calls.length, 2);
|
|
254
|
+
const third = await tools.munin_get.execute("id", { key: "bug-fix/some-key" }, undefined, undefined, ctx);
|
|
255
|
+
assert.equal(calls.length, 2, "3rd identical call must not reach the SDK");
|
|
256
|
+
assert.match((third.content[0] as { text: string }).text, /call munin_store directly/);
|
|
257
|
+
assert.equal((third.details as { dampened: boolean }).dampened, true);
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
it("6th consecutive munin_search with varying queries returns guidance", async () => {
|
|
261
|
+
const { tools, ctx } = harness();
|
|
262
|
+
const calls: string[] = [];
|
|
263
|
+
stubInvoke(calls);
|
|
264
|
+
for (let i = 0; i < 5; i++) {
|
|
265
|
+
const r = await tools.munin_search.execute("id", { query: `query-${i}` }, undefined, undefined, ctx);
|
|
266
|
+
assert.equal((r.details as { dampened?: boolean }).dampened ?? false, false);
|
|
267
|
+
}
|
|
268
|
+
assert.equal(calls.length, 5);
|
|
269
|
+
const sixth = await tools.munin_search.execute("id", { query: "query-5" }, undefined, undefined, ctx);
|
|
270
|
+
assert.equal(calls.length, 5, "6th consecutive same-tool call must not reach the SDK");
|
|
271
|
+
assert.equal((sixth.details as { dampened: boolean }).dampened, true);
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
it("any non-munin tool call resets the run counter (protocol-compliant sessions never dampen)", async () => {
|
|
275
|
+
const { tools, ctx, handlers } = harness();
|
|
276
|
+
const calls: string[] = [];
|
|
277
|
+
stubInvoke(calls);
|
|
278
|
+
const nonMunin = handlers.tool_call[0];
|
|
279
|
+
for (let i = 0; i < 5; i++) {
|
|
280
|
+
await tools.munin_search.execute("id", { query: `q-${i}` }, undefined, undefined, ctx);
|
|
281
|
+
await nonMunin({ toolName: "read", input: {} });
|
|
282
|
+
}
|
|
283
|
+
assert.equal(calls.length, 5);
|
|
284
|
+
// All 10 searches executed — the interleaved non-munin work resets the run.
|
|
285
|
+
for (let i = 0; i < 5; i++) {
|
|
286
|
+
const r = await tools.munin_search.execute("id", { query: `p-${i}` }, undefined, undefined, ctx);
|
|
287
|
+
assert.equal((r.details as { dampened?: boolean }).dampened ?? false, false, `search ${i + 6} must execute`);
|
|
288
|
+
await nonMunin({ toolName: "read", input: {} });
|
|
289
|
+
}
|
|
290
|
+
assert.equal(calls.length, 10);
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
it("a different munin tool resets the run counter", async () => {
|
|
294
|
+
const { tools, ctx } = harness();
|
|
295
|
+
const calls: string[] = [];
|
|
296
|
+
stubInvoke(calls);
|
|
297
|
+
for (let i = 0; i < 5; i++) {
|
|
298
|
+
await tools.munin_search.execute("id", { query: `q-${i}` }, undefined, undefined, ctx);
|
|
299
|
+
}
|
|
300
|
+
await tools.munin_list.execute("id", {}, undefined, undefined, ctx);
|
|
301
|
+
assert.equal(calls.length, 6);
|
|
302
|
+
const r = await tools.munin_search.execute("id", { query: "fresh" }, undefined, undefined, ctx);
|
|
303
|
+
assert.equal((r.details as { dampened?: boolean }).dampened ?? false, false);
|
|
304
|
+
assert.equal(calls.length, 7);
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
it("guidance resets state — the next identical call executes again", async () => {
|
|
308
|
+
const { tools, ctx } = harness();
|
|
309
|
+
const calls: string[] = [];
|
|
310
|
+
stubInvoke(calls);
|
|
311
|
+
await tools.munin_get.execute("id", { key: "bug-fix/some-key" }, undefined, undefined, ctx);
|
|
312
|
+
await tools.munin_get.execute("id", { key: "bug-fix/some-key" }, undefined, undefined, ctx);
|
|
313
|
+
const third = await tools.munin_get.execute("id", { key: "bug-fix/some-key" }, undefined, undefined, ctx);
|
|
314
|
+
assert.equal((third.details as { dampened: boolean }).dampened, true);
|
|
315
|
+
assert.equal(calls.length, 2);
|
|
316
|
+
const fourth = await tools.munin_get.execute("id", { key: "bug-fix/some-key" }, undefined, undefined, ctx);
|
|
317
|
+
assert.equal((fourth.details as { dampened?: boolean }).dampened ?? false, false);
|
|
318
|
+
assert.equal(calls.length, 3);
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
it("munin_store never returns dampener guidance", async () => {
|
|
322
|
+
const { tools, ctx } = harness();
|
|
323
|
+
const calls: string[] = [];
|
|
324
|
+
stubInvoke(calls);
|
|
325
|
+
for (let i = 0; i < 3; i++) {
|
|
326
|
+
const r = await tools.munin_store.execute("id", {
|
|
327
|
+
key: "fact/repeat-key",
|
|
328
|
+
title: "Title",
|
|
329
|
+
content: "Content",
|
|
330
|
+
tags: "type:fact,domain:memory",
|
|
331
|
+
}, undefined, undefined, ctx);
|
|
332
|
+
assert.equal((r.details as { dampened?: boolean }).dampened ?? false, false);
|
|
333
|
+
}
|
|
334
|
+
assert.equal(calls.length, 3);
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
it("session_start resets the dampener", async () => {
|
|
338
|
+
const { tools, ctx, handlers } = harness();
|
|
339
|
+
const calls: string[] = [];
|
|
340
|
+
stubInvoke(calls);
|
|
341
|
+
await tools.munin_get.execute("id", { key: "bug-fix/some-key" }, undefined, undefined, ctx);
|
|
342
|
+
await tools.munin_get.execute("id", { key: "bug-fix/some-key" }, undefined, undefined, ctx);
|
|
343
|
+
await handlers.session_start[0]({ reason: "startup" }, ctx);
|
|
344
|
+
const r = await tools.munin_get.execute("id", { key: "bug-fix/some-key" }, undefined, undefined, ctx);
|
|
345
|
+
assert.equal((r.details as { dampened?: boolean }).dampened ?? false, false);
|
|
346
|
+
assert.equal(calls.length, 3);
|
|
347
|
+
});
|
|
348
|
+
});
|
package/package.json
CHANGED
package/skills/munin/SKILL.md
CHANGED
|
@@ -11,7 +11,7 @@ Use the Munin Pi extension tools to recover and preserve verified project knowle
|
|
|
11
11
|
|
|
12
12
|
## How It Works
|
|
13
13
|
|
|
14
|
-
1. The ceulen `munin` module provides native tools: `munin_search`, `munin_get`, `munin_store
|
|
14
|
+
1. The ceulen `munin` module provides native tools: `munin_search`, `munin_get`, `munin_store` (all three always declared), plus `munin_list`, `munin_recent`, `munin_delete`, `munin_capabilities`, `munin_share` (loaded on demand via `tool_search`).
|
|
15
15
|
2. Config lives at PROJECT level: `/config` → Memory → Munin (saved to `<repo>/.pi/settings.json` under a `munin` section). `MUNIN_API_KEY` / `MUNIN_PROJECT` / `MUNIN_BASE_URL` env vars (incl. trusted `.env.local` / `.env`) override it; a per-call `api_key`/`project`/`base_url` param overrides everything.
|
|
16
16
|
3. Print readable output by default, or raw JSON via tool details.
|
|
17
17
|
4. Store only durable knowledge that is verified and useful in a future session.
|