You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e09f2a7
Browse filesBrowse the repository at this point in the historyBrowse files
feat(levelcode): memory — the recall_sessions agent tool (M1 complete)
Deep, on-demand recall over the project's own past sessions. When the user
refers to earlier work — "what did we do about refunds?", "did we already fix
the webhook?" — the agent calls recall_sessions and gets cited outcomes with
dates instead of guessing. Read-only, searches only the local journal, and
offered ONLY when memory + the setting are on (it costs nothing otherwise).
- sessionMemory.js: recallRank(entries, query) — pure term-match ranking over
each outcome's summary/title/files, recency breaking ties (no file reads: it
searches the small journal, not every transcript).
- sessions.js: recall(query) over latestBySession(journal).
- agent.js: a RECALL_TOOL schema concatenated per-run only when ctx.recallSessions
is wired (token accounting updated to count it), and a dispatch branch that
mirrors use_skill — read-only, instant, a quiet "🧠 recalling" chip.
- extension.js: recallSessionsTool formats hits as a cited, verify-first result;
passed into runAgent, gated by sessions.memory.enabled + .recallTool.
- package.json: levelcode.ai.sessions.memory.recallTool (default true).
- tests: +1 sessionMemory (ranking), +1 sessions (recall by outcome+files),
+1 sessionsUi (tool schema, host-gating, dispatch, wiring). 31 files green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
// Cross-session memory recall (docs/levelcode-sessions-memory.md). Added to a run's tools ONLY when the host
74
+
// wires ctx.recallSessions (memory + the recall setting on), so it costs nothing otherwise. Read-only and
75
+
// instant like use_skill — it searches the project's OWN past-session outcomes, never the file system.
76
+
constRECALL_TOOL={name: 'recall_sessions',description: 'Search THIS project\'s past sessions for relevant earlier work — their recorded outcomes (what was built/fixed/decided) and the files they touched. Use when the user refers to earlier work ("what did we do about refunds?", "did we already fix the webhook?") or when prior context would clearly help before you start. Returns cited past-session outcomes with dates; treat them as memory — informative but possibly stale, so verify against the current code.',input_schema: {type: 'object',properties: {query: {type: 'string',description: 'keywords or a short question, e.g. "refund retries" or "MCP timeline rail"'}},required: ['query']}};
77
+
73
78
// How much of a background command's accumulated output the sniffers re-read on each chunk. Generous
74
79
// next to any single log line, so a url split across chunk boundaries is still found, yet small enough
75
80
// that a noisy watcher which never prints an address costs nothing to keep scanning.
@@ -479,6 +484,14 @@ async function runTool(tu, ctx) {
479
484
ctx.post({type: 'agentTool',icon: 'sparkle',text: '🧩 using skill: '+name});// quiet chip — only on success (🧩 is the marker; 'sparkle' falls back cleanly)
480
485
returnbody;// SKILL.md body → tool_result, steers the next turns
481
486
}
487
+
if(tu.name==='recall_sessions'){
488
+
if(typeofctx.recallSessions!=='function'){return'ERROR: session recall is not available in this session.';}
489
+
constquery=String(input.query||'').trim();
490
+
if(!query){return'ERROR: pass a non-empty query describing what to recall.';}
Copy file name to clipboardExpand all lines: extensions/levelcode-ai/package.json
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -451,6 +451,11 @@
451
451
"default": true,
452
452
"description": "When a substantive session finishes, make one small, fast-model call to refine its journal outcome into a concrete sentence (what was built/fixed/decided) instead of just its goal headline. Runs in the background and only summarizes outcomes and actions, never quoted code. Turn off to skip the model call and keep the plain headline (no cost)."
453
453
},
454
+
"levelcode.ai.sessions.memory.recallTool": {
455
+
"type": "boolean",
456
+
"default": true,
457
+
"description": "Give the agent a recall_sessions tool so it can search this project's past-session outcomes on demand — e.g. when you ask \"what did we do about refunds?\" it looks up the earlier work instead of guessing. Read-only, searches only the local journal. Turn off to remove the tool."
0 commit comments