Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
TypeScript aiai-agentsai-memoryanthropicartificial-intelligencechromadbclaudeclaude-agent-sdkclaude-agentsclaude-codeclaude-code-pluginclaude-skillsembeddingslong-term-memorymem0memory-engineopenmemoryragsqlitesupermemory
var e=`/api/work-view/review-stack`;function t(t,n){let r=`${e}/media/${encodeURIComponent(t)}`;if(n===r)return n;let i=r+`?revision=`;if(!n?.startsWith(i))return;let a=n.slice(i.length);return a.length===64&&!/[^a-f0-9]/u.test(a)?n:void 0}function n(e){if(!e||/[?#\\\s]/u.test(e))return;if(/^\/api\/work-view\/file\/(?:work-state|observation)\/[1-9]\d*\/(?:0|[1-9]\d*)$/u.test(e))return e;let t=/^\/api\/deliverables\/[1-9]\d*\/([^/]+)$/u.exec(e);if(t)try{let n=decodeURIComponent(t[1]);return n===`.`||n===`..`||/[\x00-\x1f\x7f/\\]/u.test(n)?void 0:encodeURIComponent(n)===t[1]?e:void 0}catch{return}}var r=class extends Error{status;constructor(e,t){super(t),this.status=e}};async function i(e){if(!e.ok){let t=await e.json().catch(()=>null),n=t&&typeof t==`object`?t:null,i=typeof n?.error==`string`?n.error:typeof n?.message==`string`?n.message:`Review Stack returned ${e.status}.`;throw new r(e.status,i)}return e.json()}async function a(t,n){let a=new Set,o=null,s;do{let c=await i(await n(o?`${e}?cursor=${encodeURIComponent(o)}`:e,{signal:t,cache:`no-store`,credentials:`same-origin`}));if(!Array.isArray(c.cards)||!Array.isArray(c.reviews)||!Array.isArray(c.bookmarks)||!Array.isArray(c.followUps)||!Array.isArray(c.groups)||typeof c.revision!=`string`)throw Error(`Could not read the cards in this Review Stack.`);if(s||={revision:c.revision,cards:[],reviews:[],bookmarks:[],followUps:[],groups:[]},c.revision!==s.revision)throw new r(409,`Your Review Stack changed while loading.`);if(s.cards.push(...c.cards),s.reviews.push(...c.reviews),s.bookmarks.push(...c.bookmarks),s.followUps.push(...c.followUps),s.groups.push(...c.groups),o=c.nextCursor,o&&(typeof o!=`string`||a.has(o)))throw Error(`Could not read the next page of cards.`);o&&a.add(o)}while(o);return s}async function o(e,t=fetch){try{return await a(e,t)}catch(n){if(e.aborted||!(n instanceof r)||n.status!==409)throw n;return a(e,t)}}async function s(t,n,r,a){return i(await a(`${e}/${t}`,{method:`POST`,credentials:`same-origin`,cache:`no-store`,signal:AbortSignal.timeout(3e4),headers:{"Content-Type":`application/json`,"Idempotency-Key":r},body:JSON.stringify(n)}))}function c(e,t,n=fetch){return s(`action`,e,t,n)}function l(e,t,n=fetch){return s(`import`,{cards:e},t,n)}function u(e){if(e)try{let t=new URL(e);if(t.protocol===`https:`&&!t.username&&!t.password)return t.href}catch{}}export{o as a,t as i,n,c as o,u as r,l as s,r as t};