From 5c4b44d4c7db845597fad540f172572f76dcf9b7 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 31 Oct 2025 21:02:02 +0000
Subject: [PATCH 01/10] Initial plan
From 140a5f346993438905010ae79ad44fbe38526f41 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 31 Oct 2025 21:06:59 +0000
Subject: [PATCH 02/10] Clarify Stop hook behavior and /clear vs exit in docs
- Changed "Stop Claude" to "Claude finishes responding" to clarify that the Stop hook fires automatically
- Explained Stop hook triggers summary generation automatically, not as a user action
- Added detailed section explaining /clear behavior vs completely exiting Claude Code
- Clarified when new context is injected (new session start, not after /clear)
- Fixed session count: changed "last 3 sessions" to "last 10 sessions" (matches implementation)
Co-authored-by: thedotmack <683968+thedotmack@users.noreply.github.com>
---
docs/usage/getting-started.mdx | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/docs/usage/getting-started.mdx b/docs/usage/getting-started.mdx
index 4f36e9ba..d2c2ae3a 100644
--- a/docs/usage/getting-started.mdx
+++ b/docs/usage/getting-started.mdx
@@ -11,9 +11,9 @@ Claude-Mem works automatically once installed. No manual intervention required!
### The Full Cycle
-1. **Start Claude Code** - Context from last 3 sessions appears automatically
+1. **Start Claude Code** - Context from last 10 sessions appears automatically
2. **Work normally** - Every tool execution is captured
-3. **Stop Claude** - Summary is generated and saved
+3. **Claude finishes responding** - Stop hook automatically generates and saves a summary
4. **Next session** - Previous work appears in context
### What Gets Captured
@@ -42,7 +42,7 @@ The worker service processes tool observations and extracts:
### Session Summaries
-When you stop Claude (or a session ends), a summary is generated with:
+When Claude finishes responding (triggering the Stop hook), a summary is automatically generated with:
- **Request** - What you asked for
- **Investigated** - What Claude explored
@@ -159,7 +159,7 @@ Context injection uses three-tier verbosity for efficient token usage:
This ensures you get maximum detail for recent work while still having context from older sessions.
-## Multi-Prompt Sessions
+## Multi-Prompt Sessions & `/clear` Behavior
Claude-Mem supports sessions that span multiple user prompts:
@@ -167,7 +167,15 @@ Claude-Mem supports sessions that span multiple user prompts:
- **prompt_number**: Identifies specific prompt within session
- **Session continuity**: Observations and summaries link across prompts
-When you use `/clear`, the session doesn't end - it continues with a new prompt number. This preserves context across conversation restarts.
+### Important Note About `/clear`
+
+When you use `/clear`, the session doesn't end - it continues with a new prompt number. This means:
+
+- ✅ **Observations are still being captured** and added to the current session
+- ✅ **A summary will be generated** when Claude finishes responding (Stop hook fires)
+- ❌ **New context won't be injected** until you start a completely new session (exit and restart Claude Code)
+
+To get fresh context from previous sessions, you need to **exit Claude Code completely** (Ctrl+C Ctrl+C or close the terminal) and start a new session. The `/clear` command only clears the conversation context visible to Claude, but the underlying session continues.
## Next Steps
From 192adf5cbc08a033c65c34c9508db9a44364dec6 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 31 Oct 2025 21:28:54 +0000
Subject: [PATCH 03/10] Fix: /clear DOES inject context via SessionStart hook
Corrected incorrect documentation that claimed /clear doesn't inject context.
The SessionStart hook fires with source: "clear" when /clear is used, which
re-injects context from recent sessions. Updated docs to accurately reflect
that /clear both clears conversation AND re-injects fresh context.
Co-authored-by: thedotmack <683968+thedotmack@users.noreply.github.com>
---
docs/usage/getting-started.mdx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/usage/getting-started.mdx b/docs/usage/getting-started.mdx
index d2c2ae3a..20b516ea 100644
--- a/docs/usage/getting-started.mdx
+++ b/docs/usage/getting-started.mdx
@@ -171,11 +171,11 @@ Claude-Mem supports sessions that span multiple user prompts:
When you use `/clear`, the session doesn't end - it continues with a new prompt number. This means:
+- ✅ **Context is re-injected** from recent sessions (SessionStart hook fires with `source: "clear"`)
- ✅ **Observations are still being captured** and added to the current session
- ✅ **A summary will be generated** when Claude finishes responding (Stop hook fires)
-- ❌ **New context won't be injected** until you start a completely new session (exit and restart Claude Code)
-To get fresh context from previous sessions, you need to **exit Claude Code completely** (Ctrl+C Ctrl+C or close the terminal) and start a new session. The `/clear` command only clears the conversation context visible to Claude, but the underlying session continues.
+The `/clear` command clears the conversation context visible to Claude AND re-injects fresh context from recent sessions, while the underlying session continues tracking observations.
## Next Steps
From c9e0301e3e7333076a4fb1c139836f9e68e69f16 Mon Sep 17 00:00:00 2001
From: Alex Newman Your go-to solution for managing memories effectively. Claude-Mem uses advanced algorithms to help you manage your memories in an efficient way. Our architecture is designed for scalability and performance. Your go-to solution for managing memories effectively. Claude-Mem uses advanced algorithms to help you manage your memories in an efficient way. Our architecture is designed for scalability and performance.Welcome to Claude-Mem
\n Features
\n How It Works
\n Architecture Overview
\n Installation Instructions
\n Welcome to Claude-Mem
\n Features
\n How It Works
\n Architecture Overview
\n Installation Instructions
\n
-
+
"u"&&(o=0),typeof p>"u"&&(p=this.length),a.decode(this.slice(o,p),n))},e.BufferWrite=Fe.prototype.write,Fe.prototype.write=function(n,o,p,c){var l=o,u=p,d=c;if(isFinite(o))isFinite(p)||(c=p,p=void 0);else{var m=c;c=o,o=p,p=m}if(c=String(c||"utf8").toLowerCase(),Fe.isNativeEncoding(c))return e.BufferWrite.call(this,n,l,u,d);o=+o||0;var v=this.length-o;if(p?(p=+p,p>v&&(p=v)):p=v,n.length>0&&(p<0||o<0))throw new RangeError("attempt to write beyond buffer bounds");var f=a.encode(n,c);return f.length
{"use strict";var yl=wa().Buffer,bl=Mp(),we=wl.exports;we.encodings=null;we.defaultCharUnicode="\uFFFD";we.defaultCharSingleByte="?";we.encode=function(e,r,t){e=""+(e||"");var i=we.getEncoder(r,t),s=i.write(e),n=i.end();return n&&n.length>0?yl.concat([s,n]):s};we.decode=function(e,r,t){typeof e=="string"&&(we.skipDecodeWarning||(console.error("Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding"),we.skipDecodeWarning=!0),e=yl.from(""+(e||""),"binary"));var i=we.getDecoder(r,t),s=i.write(e),n=i.end();return n?s+n:s};we.encodingExists=function(e){try{return we.getCodec(e),!0}catch{return!1}};we.toEncoding=we.encode;we.fromEncoding=we.decode;we._codecDataCache={};we.getCodec=function(e){we.encodings||(we.encodings=dl());for(var r=we._canonicalizeEncoding(e),t={};;){var i=we._codecDataCache[r];if(i)return i;var s=we.encodings[r];switch(typeof s){case"string":r=s;break;case"object":for(var n in s)t[n]=s[n];t.encodingName||(t.encodingName=r),r=s.type;break;case"function":return t.encodingName||(t.encodingName=r),i=new s(t,we),we._codecDataCache[t.encodingName]=i,i;default:throw new Error("Encoding not recognized: '"+e+"' (searched as: '"+r+"')")}}};we._canonicalizeEncoding=function(a){return(""+a).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g,"")};we.getEncoder=function(e,r){var t=we.getCodec(e),i=new t.encoder(r,t);return t.bomAware&&r&&r.addBOM&&(i=new bl.PrependBOM(i,r)),i};we.getDecoder=function(e,r){var t=we.getCodec(e),i=new t.decoder(r,t);return t.bomAware&&!(r&&r.stripBOM===!1)&&(i=new bl.StripBOM(i,r)),i};var xl=typeof process<"u"&&process.versions&&process.versions.node;xl&&(ao=xl.split(".").map(Number),(ao[0]>0||ao[1]>=10)&&hl()(we),gl()(we));var ao});var pi=I((VR,_l)=>{"use strict";_l.exports=ky;function Sy(a){for(var e=a.listeners("data"),r=0;r "u"&&(o=0),typeof p>"u"&&(p=this.length),a.decode(this.slice(o,p),n))},e.BufferWrite=Fe.prototype.write,Fe.prototype.write=function(n,o,p,c){var l=o,u=p,d=c;if(isFinite(o))isFinite(p)||(c=p,p=void 0);else{var m=c;c=o,o=p,p=m}if(c=String(c||"utf8").toLowerCase(),Fe.isNativeEncoding(c))return e.BufferWrite.call(this,n,l,u,d);o=+o||0;var v=this.length-o;if(p?(p=+p,p>v&&(p=v)):p=v,n.length>0&&(p<0||o<0))throw new RangeError("attempt to write beyond buffer bounds");var f=a.encode(n,c);return f.length {"use strict";var _l=_a().Buffer,wl=zp(),_e=El.exports;_e.encodings=null;_e.defaultCharUnicode="\uFFFD";_e.defaultCharSingleByte="?";_e.encode=function(e,r,t){e=""+(e||"");var i=_e.getEncoder(r,t),s=i.write(e),n=i.end();return n&&n.length>0?_l.concat([s,n]):s};_e.decode=function(e,r,t){typeof e=="string"&&(_e.skipDecodeWarning||(console.error("Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding"),_e.skipDecodeWarning=!0),e=_l.from(""+(e||""),"binary"));var i=_e.getDecoder(r,t),s=i.write(e),n=i.end();return n?s+n:s};_e.encodingExists=function(e){try{return _e.getCodec(e),!0}catch{return!1}};_e.toEncoding=_e.encode;_e.fromEncoding=_e.decode;_e._codecDataCache={};_e.getCodec=function(e){_e.encodings||(_e.encodings=ml());for(var r=_e._canonicalizeEncoding(e),t={};;){var i=_e._codecDataCache[r];if(i)return i;var s=_e.encodings[r];switch(typeof s){case"string":r=s;break;case"object":for(var n in s)t[n]=s[n];t.encodingName||(t.encodingName=r),r=s.type;break;case"function":return t.encodingName||(t.encodingName=r),i=new s(t,_e),_e._codecDataCache[t.encodingName]=i,i;default:throw new Error("Encoding not recognized: '"+e+"' (searched as: '"+r+"')")}}};_e._canonicalizeEncoding=function(a){return(""+a).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g,"")};_e.getEncoder=function(e,r){var t=_e.getCodec(e),i=new t.encoder(r,t);return t.bomAware&&r&&r.addBOM&&(i=new wl.PrependBOM(i,r)),i};_e.getDecoder=function(e,r){var t=_e.getCodec(e),i=new t.decoder(r,t);return t.bomAware&&!(r&&r.stripBOM===!1)&&(i=new wl.StripBOM(i,r)),i};var bl=typeof process<"u"&&process.versions&&process.versions.node;bl&&(ro=bl.split(".").map(Number),(ro[0]>0||ro[1]>=10)&&gl()(_e),yl()(_e));var ro});var pi=A((XR,Sl)=>{"use strict";Sl.exports=Cy;function Oy(a){for(var e=a.listeners("data"),r=0;r "+Zi.message[i]+". Redirecting to "+s+" "+Zi.message[i]+". Redirecting to "+s+"
").replace(qw," ");return`
+`+e.prev}function ui(a,e){var r=vo(a),t=[];if(r){t.length=a.length;for(var i=0;i
").replace(U_," ");return`
@@ -28,7 +28,7 @@ return fn.apply(this, arguments)
`+e+`
-`}Ff.exports=Uw;function Uw(a,e,r){var t=r||{},i=t.env||process.env.NODE_ENV||"development",s=t.onerror;return function(n){var o,p,c;if(!n&&qf(e)){$o("cannot 404 after headers sent");return}if(n?(c=Hw(n),c===void 0?c=Gw(e):o=zw(n),p=Bw(n,c,i)):(c=404,p="Cannot "+a.method+" "+Iw(Vw(a))),$o("default %s",c),n&&s&&$w(s,n,a,e),qf(e)){$o("cannot %d after headers sent",c),a.socket&&a.socket.destroy();return}Zw(a,e,c,o,p)}}function zw(a){if(!(!a.headers||typeof a.headers!="object")){for(var e=Object.create(null),r=Object.keys(a.headers),t=0;t`+e+`
-`}function OE(a,e){return e?e instanceof Error?Ko(a,e,{expose:!1}):Ko(a,e):Ko(a)}function CE(a){try{return decodeURIComponent(a)}catch{return-1}}function AE(a){return typeof a.getHeaderNames!="function"?Object.keys(a._headers||{}):a.getHeaderNames()}function Zm(a,e){var r=typeof a.listenerCount!="function"?a.listeners(e).length:a.listenerCount(e);return r>0}function IE(a){return typeof a.headersSent!="boolean"?!!a._header:a.headersSent}function Yo(a,e){for(var r=[].concat(a||[]),t=0;t`+e+`
-`}function L4(){return function(){this.error(404)}}function $4(){return function(e){if(this.hasTrailingSlash()){this.error(404);return}var r=hc.original(this.req);r.path=null,r.pathname=D4(r.pathname+"/");var t=C4(j4.format(r)),i=q4("Redirecting","Redirecting to "+A4(t));e.statusCode=301,e.setHeader("Content-Type","text/html; charset=UTF-8"),e.setHeader("Content-Length",Buffer.byteLength(i)),e.setHeader("Content-Security-Policy","default-src 'none'"),e.setHeader("X-Content-Type-Options","nosniff"),e.setHeader("Location",t),e.end(i)}}});var iv=I((ot,nv)=>{"use strict";var Wi=Tf(),F4=require("events").EventEmitter,ev=Rf(),tv=ch(),M4=Mo(),U4=zo(),av=Nh(),rv=Qh();ot=nv.exports=z4;function z4(){var a=function(e,r,t){a.handle(e,r,t)};return ev(a,F4.prototype,!1),ev(a,tv,!1),a.request=Object.create(av,{app:{configurable:!0,enumerable:!0,writable:!0,value:a}}),a.response=Object.create(rv,{app:{configurable:!0,enumerable:!0,writable:!0,value:a}}),a.init(),a}ot.application=tv;ot.request=av;ot.response=rv;ot.Route=M4;ot.Router=U4;ot.json=Wi.json;ot.query=Bo();ot.raw=Wi.raw;ot.static=Yh();ot.text=Wi.text;ot.urlencoded=Wi.urlencoded;var B4=["bodyParser","compress","cookieSession","session","logger","cookieParser","favicon","responseTime","errorHandler","timeout","methodOverride","vhost","csrf","directory","limit","multipart","staticCache"];B4.forEach(function(a){Object.defineProperty(ot,a,{get:function(){throw new Error("Most middleware (like "+a+") is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.")},configurable:!0})})});var ov=I((q6,sv)=>{"use strict";sv.exports=iv()});var tR={};Vg(tR,{WorkerService:()=>us});module.exports=Gg(tR);var Vc=vs(ov(),1);var bc=require("path"),Tv=require("url"),Pv=require("events"),Ov=require("child_process"),Cv=require("readline"),ne=vs(require("fs"),1),Av=require("fs/promises"),Lv=require("path"),$v=require("os"),Na=require("path"),Sc=require("process"),Fv=require("crypto"),W2={},H4=Object.create,V4=Object.getPrototypeOf,yc=Object.defineProperty,G4=Object.getOwnPropertyNames,Z4=Object.prototype.hasOwnProperty,W4=(a,e,r)=>{r=a!=null?H4(V4(a)):{};let t=e||!a||!a.__esModule?yc(r,"default",{value:a,enumerable:!0}):r;for(let i of G4(a))Z4.call(t,i)||yc(t,i,{get:()=>a[i],enumerable:!0});return t},se=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),X4=(a,e)=>{for(var r in e)yc(a,r,{get:e[r],enumerable:!0,configurable:!0,set:t=>e[r]=()=>t})},K4=se((a,e)=>{(function(r,t){typeof a=="object"&&typeof e<"u"?t(a):typeof define=="function"&&define.amd?define(["exports"],t):t(r.URI=r.URI||{})})(a,function(r){function t(){for(var _=arguments.length,x=Array(_),k=0;k<_;k++)x[k]=arguments[k];if(x.length>1){x[0]=x[0].slice(0,-1);for(var j=x.length-1,q=1;qv&&L("overflow"),Un==q){for(var Ja=Z,Ya=f;;Ya+=f){var Zt=Ya<=ue?g:Ya>=ue+w?w:Ya-ue;if(Ja
=55296&&o<=56319&&n{e.exports={copy:r,checkDataType:t,checkDataTypes:i,coerceToTypes:n,toHash:o,getProperty:l,escapeQuotes:u,equal:Ac(),ucs2length:Q4(),varOccurences:d,varReplace:m,schemaHasRules:v,schemaHasRulesExcept:f,schemaUnknownRules:g,toQuotedString:w,getPathExpr:y,getPath:b,getData:E,unescapeFragment:A,unescapeJsonPointer:N,escapeFragment:D,escapeJsonPointer:$};function r(T,S){S=S||{};for(var L in T)S[L]=T[L];return S}function t(T,S,L,F){var B=F?" !== ":" === ",V=F?" || ":" && ",oe=F?"!":"",J=F?"":"!";switch(T){case"null":return S+B+"null";case"array":return oe+"Array.isArray("+S+")";case"object":return"("+oe+S+V+"typeof "+S+B+'"object"'+V+J+"Array.isArray("+S+"))";case"integer":return"(typeof "+S+B+'"number"'+V+J+"("+S+" % 1)"+V+S+B+S+(L?V+oe+"isFinite("+S+")":"")+")";case"number":return"(typeof "+S+B+'"'+T+'"'+(L?V+oe+"isFinite("+S+")":"")+")";default:return"typeof "+S+B+'"'+T+'"'}}function i(T,S,L){switch(T.length){case 1:return t(T[0],S,L,!0);default:var F="",B=o(T);B.array&&B.object&&(F=B.null?"(":"(!"+S+" || ",F+="typeof "+S+' !== "object")',delete B.null,delete B.array,delete B.object),B.number&&delete B.integer;for(var V in B)F+=(F?" && ":"")+t(V,S,L,!0);return F}}var s=o(["string","number","integer","boolean","null"]);function n(T,S){if(Array.isArray(S)){for(var L=[],F=0;Fv&&L("overflow"),Un==q){for(var Ja=Z,Ya=f;;Ya+=f){var Zt=Ya<=ue?g:Ya>=ue+_?_:Ya-ue;if(Ja
=55296&&o<=56319&&n{e.exports={copy:r,checkDataType:t,checkDataTypes:i,coerceToTypes:n,toHash:o,getProperty:l,escapeQuotes:u,equal:Ac(),ucs2length:a8(),varOccurences:d,varReplace:m,schemaHasRules:v,schemaHasRulesExcept:f,schemaUnknownRules:g,toQuotedString:_,getPathExpr:y,getPath:b,getData:E,unescapeFragment:I,unescapeJsonPointer:D,escapeFragment:N,escapeJsonPointer:$};function r(T,S){S=S||{};for(var L in T)S[L]=T[L];return S}function t(T,S,L,F){var B=F?" !== ":" === ",V=F?" || ":" && ",oe=F?"!":"",J=F?"":"!";switch(T){case"null":return S+B+"null";case"array":return oe+"Array.isArray("+S+")";case"object":return"("+oe+S+V+"typeof "+S+B+'"object"'+V+J+"Array.isArray("+S+"))";case"integer":return"(typeof "+S+B+'"number"'+V+J+"("+S+" % 1)"+V+S+B+S+(L?V+oe+"isFinite("+S+")":"")+")";case"number":return"(typeof "+S+B+'"'+T+'"'+(L?V+oe+"isFinite("+S+")":"")+")";default:return"typeof "+S+B+'"'+T+'"'}}function i(T,S,L){switch(T.length){case 1:return t(T[0],S,L,!0);default:var F="",B=o(T);B.array&&B.object&&(F=B.null?"(":"(!"+S+" || ",F+="typeof "+S+' !== "object")',delete B.null,delete B.array,delete B.object),B.number&&delete B.integer;for(var V in B)F+=(F?" && ":"")+t(V,S,L,!0);return F}}var s=o(["string","number","integer","boolean","null"]);function n(T,S){if(Array.isArray(S)){for(var L=[],F=0;F