Skip to content
Flows
Tier 3 · Agent memory Agent memory · fetched 2026-07-02

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 GitHub

Key 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

From the archive

Verbatim excerpts mined from our local archive of this repository — the prompts, schemas, and patterns worth stealing.

Prompt

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

MCP & tools

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