Open-source · Self-hosted

Memory for your AI agents.

Source code, work history, and upcoming tasks — managed as one shared memory. No more cold boots, no more re-derivation.

Memory Architecture — Retrieval Pipeline · Autonomous TODO Loop · SKILL.state
1. ROUTE Where to look? 2. RETRIEVE Get the right context 3. PRUNE Keep what matters 4. INJECT Smaller, sharper context AGENT QUERY 💬 Why was the discount_threshold added and who uses it? ROUTER (Scoring) WORK HISTORY 0.82 KNOWLEDGE BASE 0.61 GRAPH INDEX 0.74 MEMORY INDEXES DECISION CHAINS Causal history, superseded by, why WORK HISTORY Decisions, facts, session outcomes KNOWLEDGE BASE Docs, plans, designs, notes GRAPH INDEX Code structure, calls, deps PRUNE & SUMMARIZE PRUNE Remove noise, dedupe, rank SUMMARIZE Compress to core facts (SUMMARY_LLM) ✓ AGENT / MODEL (LOCAL OR CLOUD) WRITE BACK Outcomes, decisions, new facts AUTONOMOUS TODO PIPELINE PM2 · DAILY 06:00 SCHEDULER todoRunner.js no commit · push · deploy TODO FILE todos/{date}.md skips if none pending SPAWN AGENT qwen -p default instructions EXECUTE 1 item at a time [ ] → [~] → [x] + summary AUTO-INGEST autoIngest.js refresh memory indexes same retrieval pipeline DAILY LOOP · RESUMES 06:00 SKILL.STATE — SURVIVING CONTEXT COMPACTION GATED · FOCUSMEMORY_SKILLSTATE=ON PRECOMPACT HOOK trigger: auto · manual spawns detached worker Σ EXTRACT transcript tail → state_patch parallel w/ native summary Σ MERGE Σ⊕Δ · null-deletes-key per-session + work_memory SESSIONSTART source: compact Σ + prose re-injected AGENT RESUME explicit state, not reconstructed history OFF = native compaction only (hooks no-op, fail-open)
FocusMemory qwen-code Extension logo

Memory infrastructure — zero modifications.

Plug FocusMemory into qwen-code with a single manifest file. Eight MCP tools, an auto-recall HTTP hook, and Hard Gate search rules — all loaded automatically on startup. No fork, no patch.

Learn more →

Neither remembers the decision that made it true.

Grep finds the code. Vectors find the meaning. Neither remembers why it's still that way.

↻

Search is stateless

Every session re-discovers the same files, re-reasons about the same architecture, from scratch — round-trips accumulate, context gets re-injected, tokens burn.

⊘

Schema drifts silently

What the code assumes about your database and what's actually running diverge — and nothing catches it until something breaks.

◇

Decisions vanish

Why a column was added, why a threshold was chosen — buried in a chat log that's gone the moment the session ends.

Three problems. Three matched fixes.

01
stateless search
→

A Routing precision

Structural queries hit the graph index, semantic queries hit the vector index — one call, not five.

02
silent drift
→

B Schema snapshots

Real DB state is indexed alongside code, with drift detection surfaced automatically.

03
vanishing decisions
→

C Causal decision chains

Every decision is stored as a linked node with supersedes/superseded_by relationships. Ask "why was this built this way?" — get back the full causal history: original rationale, every replacement with reasoning, and what's active now.

Not a disconnected session. A shared world.

Each work session is not a blank slate. FocusMemory manages source code, work history, and upcoming tasks as a single shared memory — eliminating grep/glob, excessive re-derivation, and cold boot.

⌨

Source code structure

Function graph via tree-sitter AST + semantic search over code chunks. The agent recalls "who calls X" without re-reading the file tree.

↺

Work history

Decisions, bug fixes, and session outcomes persist as causal chains. Next session starts where the last left off — not from zero.

☰

Task memory

Daily TODO files with progress tracking. The agent reads the plan, executes sequentially, and updates its own progress markers.

todoRunner.js (PM2-managed) schedules the daily backlog run at 06:00. It reads the most recent todos/{date}.md with pending items (the next day's work plan), spawns the agent with operational instructions, and triggers index refresh on completion.

[ ] → [~] in progress → [x] done  |  [!] interrupted (resumable)

Long sessions that never amnesia-compact.

A long agent run normally hits its context window and loses detail to a lossy auto-compact summary. With focus-llama's --fm-offload engine, the oldest conversation is evicted to FocusMemory verbatim and pulled back on demand — lossless.

⇄

Evict over threshold

Once the engine's prompt passes a threshold (set under the client's compact point), the oldest middle messages are PUT to FocusMemory and removed from the prompt. System and the last user message are never evicted.

⤓

Focus to recall

Evicted segments become virtual chunks (M+1…M+K). When the model emits <focus magic_chunks="N"> for one, the engine GETs its original text back and re-prefills it at the tail.

⛨

Dumb store, fail-open

FocusMemory only stores and returns the text — no chunking, embedding, or search. Any store error fails open: the segment stays in the prompt, so a downed store degrades to a normal session, never to data loss.

A recall re-prefills one evicted chunk and is lossless; an auto-compact replaces the conversation with a lossy summary. The engine decides which messages leave and how to bring one back; FocusMemory is just the external memory behind it.

PUT /v1/kv-offload/chunk  ·  GET /v1/kv-offload/chunk  ·  DELETE /v1/kv-offload/session  |  gated by FOCUSMEMORY_KVOFFLOAD=on
FocusMemory qwen-code Extension logo

qwen-code extension — zero modifications.

Plug FocusMemory into qwen-code with a single manifest file. Eight MCP tools, an auto-recall HTTP hook, and Hard Gate search rules — all loaded automatically on startup. No fork, no patch.

MCP Tools
search_memory · trace_decision_chain
remember_decision · query_graph
search_code · search_web
HTTP Hook
UserPromptSubmit auto-recall
Context injected before agent loop
SUMMARY_LLM prune & summarize inline
View on GitHub →

Removing the friction between what the model knows and what the agent can actually do.