KAS Memory
An agent memory system that auto-extracts insights from coding sessions, recalls relevant memories in future conversations, and builds a growing reusable knowledge base - aimed squarely at not repeating the same mistakes across sessions.
View source on GitHubKey takeaways
- 01
Auto-extract insights at session end, not mid-flow
- 02
Recall is proactive: memories surface when relevant, not on demand
- 03
Coding mistakes are the highest-value memory category
Flows built on this research
Memory & Context
Design a Memory Index Loaded Every Session
Build the pattern behind minimalist memory systems: a compact index file the agent always loads, pointing to detail files it loads on demand.
3 steps · 60-90 minutes
Memory & Context
Cross-Session Project State
Keep long-horizon work coherent across many sessions: externalized project state that any session can load, advance, and hand off.
4 steps · 90-120 minutes
From the archive
Verbatim excerpts mined from our local archive of this repository — the prompts, schemas, and patterns worth stealing.
A portable memory bootstrap prompt for any CLI agent
You have access to a persistent memory system at ~/.claude/data/kas-memory/.
Before starting work, check relevant memories:
bash .../scripts/recall.sh <<< '{"prompt":"YOUR_TOPIC_HERE",...}'
After completing significant work, extract memories:
bash .../scripts/extract.sh <<< '{"session_id":"...","transcript_path":"..."}'
Memory Types - prioritize extracting:
1. Failed approaches (what didn't work and why)
2. User corrections
3. Decision records (why A over B)
4. Technical insights (workarounds, gotchas) The same memory system wired into Codex, Gemini, and Claude CLIs via a drop-in system prompt - and its extraction priority list starts with failures, not successes.
cross-cli/codex-system-prompt.md
Typed memory schema: failed-approach is a first-class type
export const SearchTagsInput = z.object({
tags: z.array(z.string()),
match_mode: z.enum(["any", "all"]).default("any"),
type_filter: z.enum([
"failed-approach",
"user-correction",
"decision",
"communication",
"technical",
"achievement",
"recent-focus",
"all",
]).default("all"),
});
server.tool("kas_recall", "Search related memories (keyword + semantic hybrid search with RRF)", ...) A Zod schema where memory types are an enum and 'failed-approach' comes first; recall is keyword+semantic hybrid fused with Reciprocal Rank Fusion.
mcp-server/src/schemas/index.ts