minnimemory 1.3.5 → 1.3.6
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 +5 -0
- package/package.json +2 -2
- package/pkg/chunks/{chunk-PJGN4FEC.js → chunk-LUEIBOGU.js} +1 -1
- package/pkg/chunks/{chunk-E2UW5CU2.js → chunk-XOD4IZ2R.js} +1 -1
- package/pkg/chunks/{mcpServer-VN7UXSKL.js → mcpServer-FRGKYD56.js} +1 -1
- package/pkg/cli.js +3 -3
- package/pkg/index.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
All notable changes to the `minnimemory` package. Dates are publish dates; an entry that has not
|
|
4
4
|
been published yet says `unreleased` and gets its date on the day it goes out.
|
|
5
5
|
|
|
6
|
+
## 1.3.6 - unreleased
|
|
7
|
+
|
|
8
|
+
- Changed: `@modelcontextprotocol/sdk` 1.30.0 -> 1.32.1 (the directory policy asks local servers to keep dependencies current). No behavior change; the full suite, the MCP client probe and the plugin e2e pass on the new SDK.
|
|
9
|
+
- Plugin: the generated README now defines what "memory" means (your files on disk, never chat history), names the surfaces (Claude Code and Cowork; ignored in claude.ai chat), discloses the bundle's unused `install`/`uninstall` commands and the `--profile full` tools, and gains "Try it on a sample first" and "Security reports" sections; `examples/CLAUDE.md` ships in the plugin tree; `plugin.json` carries `privacyPolicyUrl`, `termsOfServiceUrl` and `author.email`. The stale "measured offline, not yet in a live session" line is gone (gate (c) was live).
|
|
10
|
+
|
|
6
11
|
## 1.3.5 - 2026-10-17
|
|
7
12
|
|
|
8
13
|
- Fix: run from the Claude Code plugin (`server/cli.mjs`), every printed command (`apply`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "minnimemory",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.6",
|
|
4
4
|
"description": "MinniMemoryMCP: an MCP server that gives an AI coding agent curated memory. Tools audit the agent's memory file, compile it into a small AlwaysOnMemory body plus OnDemandMemory files, serve it back on demand and keep it maintained. Deterministic, lossless, offline. Built by MinniAI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"mcpName": "io.github.MinniAI-com/minnimemory",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"vitest": "^5.0.0"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
56
|
+
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
57
57
|
"zod": "^3.25.0"
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -154,4 +154,4 @@ ${i}`}catch(n){return process.stderr.write(`
|
|
|
154
154
|
`)}
|
|
155
155
|
`,"utf8"),zt.renameSync(r,t)}catch{}}let i={version:1,cwd:hn.resolve(e),sessions:[],files:{}};for(let r of o.slice(-rr)){let s;try{s=JSON.parse(r)}catch{continue}if(!s||typeof s.f!="string"||typeof s.t!="string")continue;let c=i.files[s.f]??{reasons:[],count:0,firstSeen:s.t,lastSeen:s.t};s.r&&!c.reasons.includes(s.r)&&c.reasons.push(s.r),s.m&&(c.memoryType=s.m),c.count+=1,s.t>c.lastSeen&&(c.lastSeen=s.t),s.t<c.firstSeen&&(c.firstSeen=s.t),i.files[s.f]=c,s.s&&!i.sessions.includes(s.s)&&i.sessions.push(s.s)}return i.sessions.length>hs&&(i.sessions=i.sessions.slice(-hs)),Object.keys(i.files).length>0?i:void 0}function Qp(e,t=new Date){if(!(!e.cwd||!e.file_path))try{let n=ys(e.cwd),o={t:t.toISOString(),f:hn.resolve(e.cwd,e.file_path)};e.load_reason&&(o.r=e.load_reason),e.memory_type&&(o.m=e.memory_type),e.session_id&&(o.s=e.session_id),zt.mkdirSync(hn.dirname(n),{recursive:!0}),zt.appendFileSync(n,`${JSON.stringify(o)}
|
|
156
156
|
`,"utf8")}catch{}}import qn from"node:fs";import ce from"node:path";function Vn(e){try{return R(qn.readFileSync(e,"utf8"))}catch{return 0}}var Kt=e=>ce.resolve(e).toLowerCase();function lm(e,t={machine:!0}){let n=ce.resolve(t.projectRoot??e),o=[],i=new Map,r=f=>{let b=Kt(f.abs);i.has(b)||(i.set(b,f),o.push(f))},s={walkCapped:!1,agentsNotLoaded:[]};for(let f of Hn(e,{machine:t.machine,projectRoot:n,report:s}))r({abs:f.abs,owner:f.owner,when:f.when,tokens:Vn(f.abs),via:f.trigger,readOnly:f.owner==="managed"||void 0});let c=ee();for(let f of[...o]){if(f.when==="on-demand")continue;let b=f.owner==="user"?c:n,{files:x,skipped:v}=Po(f.abs,b,t.machine);for(let $ of x)r({abs:$,owner:f.owner==="user"?"user":"project",when:f.when==="session"?"import":f.when,tokens:Vn($),via:f.abs,external:!H(b,$)||void 0});for(let $ of v)r({abs:$,owner:"project",when:"import",tokens:0,via:f.abs,external:!0})}let a=void 0;for(let f of[ce.join(n,".claude","OnDemandMemory"),ce.join(n,"OnDemandMemory")]){let b=[];try{b=qn.readdirSync(f).filter(x=>x.toLowerCase().endsWith(".md"))}catch{continue}for(let x of b.sort())r({abs:ce.join(f,x),owner:"project",when:"on-demand",tokens:Vn(ce.join(f,x))})}let d=t.machine?bs(e):void 0,l=[];if(d){for(let[f,b]of Object.entries(d.files)){let x=i.get(Kt(f));x?x.seen={reasons:b.reasons,count:b.count}:xt(f)&&l.push({abs:f,reasons:b.reasons,count:b.count})}for(let f of o)(f.when==="session"||f.when==="import")&&!f.external&&f.owner!=="auto-memory"&&!f.seen&&(f.notSeen=!0)}let u=o.filter(f=>f.when==="session"||f.when==="import"&&!f.external).reduce((f,b)=>f+b.tokens,0),h=f=>ce.relative(n,f).split(ce.sep).join("/"),p=s.agentsNotLoaded.filter(f=>!i.has(Kt(f.abs))).map(f=>{let b=ce.relative(f.dir,f.abs).split(ce.sep).join("/"),x=[h(f.dir),"CLAUDE.md"].filter(Boolean).join("/"),v=f.beside?Fd(ce.join(f.dir,f.beside),f.abs)?`${f.beside} names it but does not import it; make ${[h(f.dir),f.beside].filter(Boolean).join("/")} hold @${b}`:`${f.beside} in the same folder takes its place; other coding agents read this file`:`a CLAUDE.md on the path to this folder switches AGENTS.md off and none sits beside it; add ${x} holding @${b}`;return{abs:f.abs,tokens:Vn(f.abs),reason:v}});return{setup:Dd(n,h,f=>i.has(Kt(f))),notLoaded:p,cwd:ce.resolve(e),entries:o,sessionTokens:u,autoMemoryDir:a,machineIncluded:t.machine,log:d?{sessions:d.sessions.length,files:Object.keys(d.files).length}:void 0,unaccounted:l,walkCapped:s.walkCapped||void 0}}function Dd(e,t,n){let o=dn(e);if(!o)return;let i="";try{i=qn.readFileSync(o,"utf8")}catch{return}let r=Wn(o,i),s=t(o),c=r?t(r):void 0,a=c??s,d=at(e),l=d?.mode==="host"?d:void 0;return{host:s,pointerTo:c,...r&&!n(r)?{pointerNotImported:!0}:{},target:a,compiled:l!==void 0,routed:l?l.sources.reduce((u,h)=>u+h.routed.length,0):0,routedDir:l?.routedDir,compiledAs:l&&l.index.file!==a?l.index.file:void 0}}function Fd(e,t){let n;try{n=qn.readFileSync(e,"utf8")}catch{return!1}let o=Wn(e,n);return o!==void 0&&Kt(o)===Kt(t)}function Rd(e){let t=e.compiled?e.compiledAs?`compiled as ${e.compiledAs}, and the host file has changed since (run doctor)`:`compiled, ${e.routed} routed file(s) in ${e.routedDir}/`:"not compiled";return[" setup",` host file ${e.host}${e.pointerTo?e.pointerNotImported?`, names ${e.pointerTo} but does not import it`:`, a pointer to ${e.pointerTo}`:""}`,` file to change ${e.target}${e.pointerTo?e.pointerNotImported?` (Claude Code loads it only once ${e.host} holds @${e.pointerTo})`:" (the pointer is left as it is)":""}`,` state ${t}`]}var _d={session:"every session",import:"every session, imported",subfolder:"when Claude works in a subfolder","path-rule":"when a path rule matches","on-demand":"on demand (the agent opens it)"},ws=["session","import","path-rule","subfolder","on-demand"];function dm(e,t={}){let n=t.limit??40,o=i=>H(e.cwd,i)?ce.relative(e.cwd,i).split(ce.sep).join("/"):i;return{cwd:e.cwd,...e.setup?{setup:{host:e.setup.host,pointerTo:e.setup.pointerTo,pointerNotImported:e.setup.pointerNotImported,target:e.setup.target,compiled:e.setup.compiled,routed:e.setup.routed}}:{},sessionTokens:e.sessionTokens,groups:ws.map(i=>{let r=e.entries.filter(s=>s.when===i);return{when:i,tokens:r.reduce((s,c)=>s+c.tokens,0),files:r.slice(0,n).map(s=>({path:o(s.abs),tokens:s.tokens,owner:s.owner})),more:Math.max(0,r.length-n)}}).filter(i=>i.files.length>0),...e.notLoaded.length>0?{notLoaded:e.notLoaded.slice(0,n).map(i=>({file:o(i.abs),tokens:i.tokens,reason:i.reason}))}:{},machineIncluded:e.machineIncluded}}function fm(e){let t=o=>o.startsWith("(user)/")?"user":/^\((project|above|linked|confirmed)\)\//.test(o)?"project":e.claudeMemoryFolder?"auto-memory":"project",n=ke(e).map(o=>({abs:o.abs,owner:t(o.rel),when:"session",tokens:o.tokens,via:o.notLoadedFrom!==void 0?`first ${o.notLoadedFrom-1} lines`:void 0}));return{cwd:e.folderRoot??e.root,entries:n,sessionTokens:n.reduce((o,i)=>o+i.tokens,0),machineIncluded:!1,unaccounted:[],notLoaded:[],memoryFolder:!0}}function um(e,t={}){let n=t.limit??40,o=r=>H(e.cwd,r)?ce.relative(e.cwd,r).split(ce.sep).join("/"):r,i=["",` memory map for ${e.cwd}: every file Claude Code loads, by its own rules`];e.setup&&i.push("",...Rd(e.setup),""),i.push(` every session: ${j(e.sessionTokens)} tokens`);for(let r of ws){let s=e.entries.filter(a=>a.when===r);if(s.length===0)continue;let c=s.reduce((a,d)=>a+d.tokens,0);i.push("",` ${_d[r]} (${s.length} file(s), ${j(c)} tokens)`);for(let a of s.slice(0,n)){let d=[a.owner,a.readOnly?"read-only":"",a.external?"external, loads after you approve it":"",a.seen?`seen by Claude Code x${a.seen.count}`:"",a.notSeen?"NOT SEEN by Claude Code":""].filter(Boolean).join(", "),l=a.via?` <- ${a.when==="import"?o(a.via):a.via}`:"";i.push(` ${o(a.abs).padEnd(56)} ${j(a.tokens).padStart(7)} ${d}${l}`)}s.length>n&&i.push(` and ${s.length-n} more`)}if(e.notLoaded.length>0){i.push("",` not loaded by Claude Code (${e.notLoaded.length} file(s))`);for(let r of e.notLoaded.slice(0,n))i.push(` ${o(r.abs).padEnd(56)} ${j(r.tokens).padStart(7)} ${r.reason}`);e.notLoaded.length>n&&i.push(` and ${e.notLoaded.length-n} more`)}if(i.push(""),e.walkCapped&&i.push(` subfolder scan stopped at ${jo.toLocaleString("en-US")} folders or ${_o} levels deep: a CLAUDE.md below that is not in this map`),e.memoryFolder)i.push(" outside this folder, only the files that load it are read; user rules and parent-folder files are not");else if(!e.machineIncluded)i.push(" files outside this folder (managed policy, your user CLAUDE.md and rules, folders above it, auto memory) are not read");else if(!e.log)i.push(" Claude Code's own load log: none yet (install adds the hook; it fills as you use Claude Code here)");else{i.push(` Claude Code's own load log: ${e.log.files} file(s) over ${e.log.sessions} session(s)`),e.unaccounted.length===0&&i.push(" every file Claude Code logged is in the map above");let r=e.entries.filter(s=>s.notSeen).length;r>0&&i.push(` ${r} every-session file(s) above were never seen loading: a setting (claudeMdExcludes, --setting-sources) may be keeping them out`);for(let s of e.unaccounted.slice(0,n))i.push(` NOT IN THE MAP: ${o(s.abs)} (${s.reasons.join(", ")}, x${s.count})`)}return i.push(""),i.join(`
|
|
157
|
-
`)}var mm="1.3.
|
|
157
|
+
`)}var mm="1.3.6";export{Qe as a,_t as b,Yt as c,ke as d,ht as e,R as f,j as g,hr as h,uo as i,Id as j,yr as k,po as l,en as m,Ce as n,We as o,En as p,On as q,Vs as r,nf as s,F as t,Br as u,ee as v,Wr as w,W as x,H as y,cf as z,Tt as A,ff as B,$o as C,pe as D,Kr as E,vo as F,Ke as G,Yr as H,$f as I,vf as J,Vr as K,So as L,qr as M,In as N,Ta as O,Rf as P,te as Q,Cf as R,Do as S,Yf as T,B as U,_u as V,Vo as W,ju as X,Cu as Y,Tu as Z,Iu as _,Au as $,Nu as aa,Pu as ba,Uu as ca,Wl as da,Hu as ea,Bu as fa,Wu as ga,Xi as ha,Yi as ia,Kl as ja,Gl as ka,Jl as la,Gn as ma,Zi as na,wi as oa,No as pa,st as qa,At as ra,gi as sa,Nt as ta,Jc as ua,at as va,Vc as wa,un as xa,Yu as ya,Zu as za,Jn as Aa,Vu as Ba,er as Ca,Xn as Da,mn as Ea,ap as Fa,tr as Ga,od as Ha,mp as Ia,rs as Ja,ss as Ka,cs as La,nr as Ma,ud as Na,Dp as Oa,Fp as Pa,ls as Qa,Rp as Ra,_p as Sa,jp as Ta,ps as Ua,ms as Va,Pp as Wa,Ld as Xa,Gp as Ya,Jp as Za,Xp as _a,bs as $a,Qp as ab,lm as bb,dm as cb,fm as db,um as eb,mm as fb};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* MinniMemoryMCP (c) 2026 MinniAI. Licensed under the MinniMemoryMCP License, see LICENSE. */
|
|
2
|
-
import{$ as z,$a as He,A as V,Aa as H,Ba as je,C as de,Ca as W,D as Y,Da as oe,E as q,F as ce,Fa as De,G as M,H as F,I as pe,J as fe,K as ue,Ka as Ae,O as me,P as he,Qa as Ne,S as ge,U as j,Ua as Pe,V as ye,Va as Ie,W as N,X as we,Xa as Le,Ya as _e,Z as ve,Za as Fe,_ as be,_a as Ue,a as J,b as E,ba as $e,bb as We,ca as xe,cb as Be,da as Oe,db as Je,ea as K,eb as Ge,fb as re,ga as ke,ha as Se,ia as Me,ja as Te,ka as Re,la as X,m as ae,ma as Z,na as Q,qa as U,ra as Ee,s as x,sa as ee,t as _,ta as D,ua as te,va as P,wa as Ce,x as G,y as S,ya as ne,z as le}from"./chunk-
|
|
2
|
+
import{$ as z,$a as He,A as V,Aa as H,Ba as je,C as de,Ca as W,D as Y,Da as oe,E as q,F as ce,Fa as De,G as M,H as F,I as pe,J as fe,K as ue,Ka as Ae,O as me,P as he,Qa as Ne,S as ge,U as j,Ua as Pe,V as ye,Va as Ie,W as N,X as we,Xa as Le,Ya as _e,Z as ve,Za as Fe,_ as be,_a as Ue,a as J,b as E,ba as $e,bb as We,ca as xe,cb as Be,da as Oe,db as Je,ea as K,eb as Ge,fb as re,ga as ke,ha as Se,ia as Me,ja as Te,ka as Re,la as X,m as ae,ma as Z,na as Q,qa as U,ra as Ee,s as x,sa as ee,t as _,ta as D,ua as te,va as P,wa as Ce,x as G,y as S,ya as ne,z as le}from"./chunk-LUEIBOGU.js";import T from"node:fs";import qe from"node:os";import h from"node:path";import{McpServer as ze}from"@modelcontextprotocol/sdk/server/mcp.js";import{ListToolsRequestSchema as dt}from"@modelcontextprotocol/sdk/types.js";import{z as c}from"zod";var ct=["recall","modules","outline"],pt=["doctor","plan"],ft=["apply"],$n=["init","doctor","apply","undo"],xn=[];function B(e,t,o){let n=t??".";if((n==="~"||/^~[\\/]/.test(n))&&(n=h.join(qe.homedir(),n.slice(1))),h.isAbsolute(n)&&S(e,n)&&(n=h.relative(e,n)||"."),le(n))throw new M(ut(e,n,o));let s=h.join(e,n);if(!S(e,s))throw new M(`refusing ${o} that resolves outside the server root: ${n}`);return mt(n,o),s}function ut(e,t,o){let n=h.resolve(e,t),s=`refusing ${o} outside the server root: ${t}. This server reads only folders inside ${e}.`,d=!1;try{d=T.statSync(n).isDirectory()}catch{d=!1}return!d||!V(n)?s:o.startsWith("undo")?`${s} To undo that folder, run this in a terminal from ${e}, through the dev's own approval: \`${q(n)}\`. It restores the originals; if it refuses over later edits, it says so and names --force.`:`${s} To work on that folder, run this in a terminal from ${e}, through the dev's own approval: \`${ce(n)} --diff summary\`. It writes nothing; it prints the plan and the apply command for that folder.`}function mt(e,t){if(!V(e))throw new M(`refusing ${t}: its path holds a character a shell would act on ($, \`, ", % or !), so no command could name it safely. Rename the folder, or run minnimemory in a terminal from inside it.`)}var ht=12;function gt(e){let t=He(e);if(!t)return"";let o=Object.keys(t.files).sort(),n=o.slice(0,ht).map(d=>d.split(h.sep).join("/")),s=o.length-n.length;return`
|
|
3
3
|
|
|
4
4
|
Claude Code's load log for this project lists ${o.length} file(s)${s>0?` (first ${n.length} below)`:""}. Pass the ones you also see loaded in your context as loaded:
|
|
5
5
|
`+$(n.join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* MinniMemoryMCP (c) 2026 MinniAI. Licensed under the MinniMemoryMCP License, see LICENSE. */
|
|
2
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"./chunk-
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"./chunk-XOD4IZ2R.js";import"./chunk-LUEIBOGU.js";export{m as BASIC_PROMPTS,d as BASIC_READ_TOOLS,e as BASIC_WRITE_TOOLS,q as CONTENT_CAP_CHARS,i as DATA_CLOSE_LINE,h as DATA_OPEN_LINE,o as DISABLED_MESSAGE,j as MARKER_NOTE,a as SERVE_TOOLS,b as SETUP_TOOLS,c as WRITE_TOOLS,k as asData,p as createDisabledMcpServer,n as createMcpServer,g as dataClose,f as dataOpen,l as unwrapData};
|
package/pkg/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/* MinniMemoryMCP (c) 2026 MinniAI. Licensed under the MinniMemoryMCP License, see LICENSE. */
|
|
3
|
-
import{$ as We,$a as dt,A as Re,Aa as W,B as Pe,Ba as nt,E as De,F as Ae,G as E,Ga as rt,H as V,I as Ee,Ja as ot,K as Ie,L as D,M as X,N as Ne,O as Q,P as Fe,Q as Le,R as Be,Ra as st,S as He,Sa as it,Ta as oe,U as H,V as Ue,W as Je,Wa as at,X as _e,Ya as se,Za as ie,_a as ae,aa as Ge,ab as lt,b as P,ba as qe,bb as ut,ca as ze,cb as ct,da as Ye,db as pt,ea as Z,eb as de,fa as Ke,fb as le,g,ga as Ve,j as $e,la as Xe,n as xe,na as ee,o as Ce,p as Se,q as Oe,qa as U,r as Me,ra as te,s as Y,sa as J,t as K,ta as _,ua as ne,v as je,va as re,w as Te,wa as Qe,xa as Ze,ya as et,za as tt}from"./chunks/chunk-
|
|
3
|
+
import{$ as We,$a as dt,A as Re,Aa as W,B as Pe,Ba as nt,E as De,F as Ae,G as E,Ga as rt,H as V,I as Ee,Ja as ot,K as Ie,L as D,M as X,N as Ne,O as Q,P as Fe,Q as Le,R as Be,Ra as st,S as He,Sa as it,Ta as oe,U as H,V as Ue,W as Je,Wa as at,X as _e,Ya as se,Za as ie,_a as ae,aa as Ge,ab as lt,b as P,ba as qe,bb as ut,ca as ze,cb as ct,da as Ye,db as pt,ea as Z,eb as de,fa as Ke,fb as le,g,ga as Ve,j as $e,la as Xe,n as xe,na as ee,o as Ce,p as Se,q as Oe,qa as U,r as Me,ra as te,s as Y,sa as J,t as K,ta as _,ua as ne,v as je,va as re,w as Te,wa as Qe,xa as Ze,ya as et,za as tt}from"./chunks/chunk-LUEIBOGU.js";import{spawnSync as Xt}from"node:child_process";import S from"node:fs";import Qt from"node:os";import x from"node:path";import{fileURLToPath as Zt}from"node:url";import{parseArgs as en}from"node:util";import Et from"node:fs";function It(e){return e.split(/\r?\n/).map(n=>n.trim()).filter(n=>n!==""&&!n.startsWith("#"))}function ft(e){let n;try{n=Et.readFileSync(e,"utf8")}catch{throw new D(`cannot read workload file: ${e}`)}let t=It(n);if(t.length===0)throw new D(`workload file has no tasks: ${e}
|
|
4
4
|
one task description per line, # for comments`);return t}function G(e){return`${e.onDemandFile}:${e.startLine}`}function Nt(e){return`${e.onDemandFile} > ${e.heading}`}function Ft(e,n){let t=P(e).flatMap(o=>xe({name:o.name,file:o.file},Ee(n,o.file)));return Ce(t,new Map(P(e).map(o=>[o.name,o.triggers])))}function mt(e,n,t={}){let o=t.root?Ft(e,t.root):void 0,r=o?"section":"file",c=new Set,u=new Map,d=new Map,l=new Map;for(let i of P(e))u.set(i.name,i.tokens),d.set(i.name,i.name),l.set(i.name,i.name);if(o)for(let i of o.units)u.set(G(i),i.tokens),d.set(G(i),Nt(i)),l.set(G(i),i.onDemandFile);let y=[],v=0;n.forEach((i,h)=>{let C=o?Oe(Se(o,i)).map(f=>G(f.unit)):Me(e,i).filter(f=>f.score>0).map(f=>f.name);C.length===0&&v++;let $=C.filter(f=>!c.has(f));for(let f of $)c.add(f);let b=[...c].reduce((f,z)=>f+(u.get(z)??0),0);y.push({turn:h+1,task:i,opened:$.map(f=>d.get(f)??f),carried:[...c].map(f=>d.get(f)??f),compiledTokens:e.prefix.after+b,baselineTokens:e.prefix.before})});let w=y.reduce((i,h)=>i+h.compiledTokens,0),m=y.reduce((i,h)=>i+h.baselineTokens,0),k=new Set([...c].map(i=>l.get(i)??i)),j=P(e).map(i=>i.name).filter(i=>k.has(i)),R=[...c].reduce((i,h)=>i+(u.get(h)??0),0),A=e.prefix.after+R,s=e.prefix.before-A,a=m-w,p;return a>=0?(p=y.findIndex((i,h)=>y.slice(0,h+1).reduce(($,b)=>$+b.baselineTokens-b.compiledTokens,0)>=0),p=p>=0?p+1:void 0):s>0&&(p=y.length+Math.ceil(-a/s)),{unit:r,turns:y,baselineTotal:m,compiledTotal:w,saving:a,savingPct:m===0?0:a/m*100,onDemandOpened:j,onDemandNeverOpened:P(e).map(i=>i.name).filter(i=>!k.has(i)),unroutedTurns:v,steadyStatePerTurn:A,steadyStateGainPerTurn:s,breakEvenTurn:p}}function Lt(e,n){return n===0?"0.0%":`${(e/n*100).toFixed(1)}%`}function ue(e){return e>=0?`saves ${g(e)}`:`costs ${g(-e)} more`}function ce(e,n){let t=[""];return t.push(` exact, over ${g(e.turns)} turns. No workload, no assumptions.`),t.push(""),t.push(` original memory file ${g(e.baselinePerTurn).padStart(8)} tokens per turn`),t.push(` compiled always-loaded ${g(e.compiledPerTurn).padStart(8)} tokens per turn`),t.push(` OnDemandMemory, all of it ${g(e.totalOnDemandTokens).padStart(8)} tokens, on demand`),t.push(""),t.push(" best case, no OnDemandMemory file ever opened"),t.push(` ${g(e.baselineTotal)} -> ${g(e.bestCaseTotal)} tokens, ${ue(e.bestCaseSaving)} (${Lt(e.bestCaseSaving,e.baselineTotal)})`),t.push(""),t.push(" worst case, every OnDemandMemory file opened on turn 1 and carried"),t.push(` ${g(e.baselineTotal)} -> ${g(e.worstCaseTotal)} tokens, ${ue(e.worstCaseSaving)}`),t.push(""),t.push(` break-even: ${g(e.breakEvenCarriedTokens)} tokens of OnDemandMemory can sit in`),t.push(" context from turn 1 to the end and come out even. Past that the compiled"),t.push(" shape costs more than the file it replaced."),t.push(""),t.push(` tokenizer: ${n}, an offline estimate`),t.push(""),t.join(`
|
|
5
5
|
`)}function ht(e,n){let t=[""],o=e.turns.length;if(t.push(` MODEL, not a measurement. ${g(o)} turns from the workload you supplied.`),t.push(e.unit==="section"?" routed at section level, as recall() does: a hit carries the section, not the file.":" routed at file level, as an agent reading a whole file the OnDemandMemory list named would."),t.push(""),t.push(` memory tokens over the session ${g(e.baselineTotal)} -> ${g(e.compiledTotal)}`),t.push(` ${ue(e.saving)}${e.saving>=0?` (${e.savingPct.toFixed(1)}%)`:""}`),t.push(""),e.onDemandOpened.length>0){t.push(` opened and carried (${e.onDemandOpened.length}):`);for(let r of e.onDemandOpened)t.push(` ${r}`);t.push("")}if(e.onDemandNeverOpened.length>0){t.push(` never opened (${e.onDemandNeverOpened.length}) - this is where the saving comes from:`);for(let r of e.onDemandNeverOpened)t.push(` ${r}`);t.push("")}return t.push(" one more turn, once everything this workload opens is in context:"),t.push(` ${g(e.steadyStatePerTurn)} vs ${g(e.turns[0]?.baselineTokens??0)} baseline, ${e.steadyStateGainPerTurn>=0?`saves ${g(e.steadyStateGainPerTurn)}`:`costs ${g(-e.steadyStateGainPerTurn)} more`} per turn`),t.push(""),e.saving<0&&e.steadyStateGainPerTurn<=0?(t.push(" this workload never breaks even. The OnDemandMemory files it opens are large enough that"),t.push(" carrying them costs more every turn than the original file did, so a longer"),t.push(" session loses more, not less. Splitting differently, or not compiling this"),t.push(" file at all, is the honest answer here."),t.push("")):e.saving<0&&e.breakEvenTurn!==void 0?(t.push(` behind by ${g(-e.saving)} at turn ${g(e.turns.length)}, recovering ${g(e.steadyStateGainPerTurn)} per turn:`),t.push(` breaks even around turn ${g(e.breakEvenTurn)} if nothing further opens.`),t.push("")):e.saving>=0&&e.breakEvenTurn!==void 0&&(t.push(` ahead from turn ${g(e.breakEvenTurn)} onward.`),t.push("")),e.unroutedTurns>0&&(t.push(` ${g(e.unroutedTurns)} of ${g(o)} turns matched no OnDemandMemory file at all.`),t.push(" Those turns are cheap here, but a real agent may have needed something and"),t.push(" not been routed to it. Check them before trusting the total."),t.push("")),t.push(" what this number is conditional on:"),t.push(" - your workload being what a real session looks like. It is your file;"),t.push(" the tool cannot tell whether it is representative."),e.unit==="section"?(t.push(" - every section recall() returns being carried for the rest of the session,"),t.push(" up to its token cap per turn. A real agent may widen with outline() or"),t.push(" read the whole file anyway.")):(t.push(" - every OnDemandMemory file whose triggers match being opened in full. A real"),t.push(" agent may read one and stop, or ignore one the list offered.")),t.push(" - memory tokens only. Reasoning, tool results and conversation are excluded"),t.push(" from both sides, so this ratio is not a session bill."),t.push(""),t.push(" For observed usage against a live agent, measure a real multi-turn session with"),t.push(" and without the compile. That is the only path allowed to call a number measured."),t.push(""),t.push(` tokenizer: ${n}, an offline estimate`),t.push(""),t.join(`
|
|
6
6
|
`)}function gt(){return[""," No workload given, so only the exact bounds above are available.",""," A session number needs a workload: a file with one task description per line,"," describing what you actually do in this repo.",""," minnimemory bench --workload tasks.txt",""," minnimemory ships no default task list on purpose. A number produced from tasks"," the tool invented for itself would say more about the tool than about your repo.",""].join(`
|
|
@@ -215,7 +215,7 @@ ${t.content}`).join(`
|
|
|
215
215
|
`),2)}let o=n.profile??"basic";return o!=="basic"&&o!=="full"?(process.stderr.write(`
|
|
216
216
|
error: --profile must be one of basic, full (got "${o}")
|
|
217
217
|
|
|
218
|
-
`),2):((async()=>{let[{StdioServerTransport:r},{createMcpServer:c}]=await Promise.all([import("@modelcontextprotocol/sdk/server/stdio.js"),import("./chunks/mcpServer-
|
|
218
|
+
`),2):((async()=>{let[{StdioServerTransport:r},{createMcpServer:c}]=await Promise.all([import("@modelcontextprotocol/sdk/server/stdio.js"),import("./chunks/mcpServer-FRGKYD56.js")]);await c(t,{profile:o,allowWrite:n["allow-write"]===!0}).connect(new r)})().catch(r=>{process.stderr.write(`
|
|
219
219
|
mcp server failed: ${r.message??String(r)}
|
|
220
220
|
`),process.exitCode=1}),0)}function un(){let e=tt(),n=[];if(e.length>0){n.push("still compiled (they keep working without minnimemory; to put the originals back, undo each one):");for(let t of e)n.push(` ${De(t)}`)}return n.push(`kept: ${x.dirname(Ze())} (init records, the load log, undo backups); delete it yourself once you have checked undo-backups/.`),n.push("restart Claude Code."),n.join(`
|
|
221
221
|
`)}var cn=new Set(["init","doctor","apply","undo","bench"]);function pn(e){if(W(process.cwd()))return!0;let n=ye(e);return te(n)==="compiled"||re(n)!==void 0||Q(n)!==void 0}function ye(e){let n=x.resolve(e);return S.existsSync(n)&&S.statSync(n).isFile()?x.dirname(n):n}function fn(e){if(W(process.cwd()))return;let n=ye(e);return Q(n)?Ne(n):void 0}function mn(e){let n=`minnimemory ${e} <folder>`;if(process.stdin.isTTY!==!0){process.stderr.write(`
|
|
@@ -312,7 +312,7 @@ ${i.output}
|
|
|
312
312
|
`),2):(process.stderr.write(`
|
|
313
313
|
unexpected error: ${s.stack??String(s)}
|
|
314
314
|
|
|
315
|
-
`),2)}if(r==="mcp")return tn?((async()=>{let[{StdioServerTransport:s},{createDisabledMcpServer:a,DISABLED_MESSAGE:p}]=await Promise.all([import("@modelcontextprotocol/sdk/server/stdio.js"),import("./chunks/mcpServer-
|
|
315
|
+
`),2)}if(r==="mcp")return tn?((async()=>{let[{StdioServerTransport:s},{createDisabledMcpServer:a,DISABLED_MESSAGE:p}]=await Promise.all([import("@modelcontextprotocol/sdk/server/stdio.js"),import("./chunks/mcpServer-FRGKYD56.js")]);process.stderr.write(`
|
|
316
316
|
mcp: ${p}
|
|
317
317
|
|
|
318
318
|
`),await a().connect(new s)})().catch(s=>{process.stderr.write(`
|
package/pkg/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* MinniMemoryMCP (c) 2026 MinniAI. Licensed under the MinniMemoryMCP License, see LICENSE. */
|
|
2
|
-
import{a as q,b as z,c as Q,d as X,e as $,n as ee,o as re,p as oe}from"./chunks/chunk-
|
|
2
|
+
import{a as q,b as z,c as Q,d as X,e as $,n as ee,o as re,p as oe}from"./chunks/chunk-XOD4IZ2R.js";import{Da as N,Ea as H,Fa as v,G as E,Ga as A,H as O,Ha as U,Ia as W,Ja as g,K as S,Ka as h,La as B,Ma as K,Na as w,Oa as G,Pa as V,Ra as b,S as f,T as c,Ta as J,U as m,Ua as Y,Va as Z,W as I,Wa as j,X as F,Y as T,a as e,ba as _,c as r,d as o,e as t,f as p,fa as D,g as l,h as n,i as a,ia as x,j as i,k as d,l as y,na as R,oa as L,pa as k,qa as u,ra as C,ta as P,u as s,va as M}from"./chunks/chunk-LUEIBOGU.js";export{X as BASIC_READ_TOOLS,$ as BASIC_WRITE_TOOLS,r as DEFAULT_CONFIG,re as DISABLED_MESSAGE,u as DiscoveryError,m as FolderError,G as HOOK_CLOSE_LINE,w as HOOK_OPEN_LINE,L as HOST_FILES,n as INSTRUCTIONS,k as LIST_FILE_NAMES,E as McpTargetError,f as RULES,A as RecallDirError,q as SERVE_TOOLS,z as SETUP_TOOLS,e as SEVERITY_ORDER,t as TOKENIZER_ID,Q as WRITE_TOOLS,o as alwaysLoaded,F as applyFolderPlan,D as applyFolderUndo,H as auditWorkspace,s as compile,oe as createDisabledMcpServer,ee as createMcpServer,d as defaultProfile,C as detectPhase,P as discover,v as doctor,p as estimateTokens,j as exitCodeFor,h as fenceCode,x as folderPlanSummary,l as formatTokens,U as getDirIndex,K as hookClose,B as hookOpen,i as isProfileName,W as listDirFiles,O as loadManifest,J as parseHookInput,I as planFolder,_ as planFolderUndo,a as profile,M as readFolderManifest,S as recall,g as recallDir,T as renderFolderFiles,R as renderFolderPlan,b as renderHook,Y as renderHuman,y as renderInstructions,Z as renderJson,N as resolveConfig,c as ruleById,V as unwrapHook};
|