-
Notifications
You must be signed in to change notification settings - Fork 1
Guide: Extraction
Thatch buffers your session's tool calls and extracts durable facts from them into memories. This happens automatically, without any prompt from you.
-
Buffering: As the session runs, thatch records tool calls (read, edit, bash, grep, etc.) in an in-memory ring buffer (up to 20 per session). The buffer is a parallel data structure, not derived from conversation history.
-
Extraction: When the session goes idle (after the agent's turn completes), the plugin creates a child session and prompts it to run the
thatch-fact-extractorskill. The child fetches the buffered tool interactions viathatch_get_extraction_payload, extracts durable facts, and writes them as memories viathatch_memory_remember. -
Cleanup: When the child finishes, the parent's buffer is drained and a toast notification shows the results (
[thatch] new: 2, updated: 1). The child session is deleted.
You see the toast. You do not see the nudge or the child session. The extraction runs in the background and does not interrupt your conversation.
On MCP hosts (Claude Code, Cursor), there is no SDK client to create
child sessions. The extraction nudge is injected into the next user
message instead. The agent dispatches a sub-agent to run the
fact-extractor skill, then calls thatch_extraction_done to acknowledge.
The fact-extractor skill decides what is worth saving. It looks for:
- Durable project facts (architecture, conventions, design decisions)
- Non-obvious gotchas and footguns
- Data model relationships
- User preferences and corrections
It does NOT save:
- Point-in-time facts (current file locations, line numbers, function names)
- Commit hashes or branch-specific history
- Anything re-derivable from the codebase faster than recalling it
-
OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true: enables async extraction (child sessions run in the background, fire-and-forget). Without this, extraction still works but the child session runs synchronously (blocking the turn briefly). Put it in your shell rc,mise.toml [env], or.envrc. OpenCode only; not needed for Claude Code or Cursor.
- The buffer caps at 20 tool interactions per session. If the session runs long, older interactions are dropped before the extraction fires.
- Extraction only runs when the session goes idle. If the agent is continuously active, the buffer grows until 20 and then stops recording.
- The fact-extractor is an LLM. Its quality depends on the model. Weak models may miss durable facts or save point-in-time noise.
- Compaction does not affect the buffer. The buffer is a parallel data structure that survives conversation compaction.
See memory.md for the memory system the extractor writes to.
User
- Guide: Behavior Engine
- Guide: Cli
- Guide: Code Review
- Guide: Commands
- Guide: Cross Session Chat
- Guide: Deduplication
- Guide: Default Behaviors
- Guide: Extraction
- Guide: Hygiene
- Guide: Memory
- Guide: Notifications
- Guide: Prediction Engine
- Guide: Overview
- Guide: Setup
- Guide: Skills
- Guide: Watchers
Developer
Dev Feature Guides
- Feature: Behavior Engine
- Feature: Cicd
- Feature: Cli
- Feature: Commands
- Feature: Compaction Recovery
- Feature: Cross Session Chat
- Feature: Database
- Feature: Deduplication
- Feature: Extraction
- Feature: Hygiene
- Feature: Memory Store
- Feature: Multi Host
- Feature: Notifications
- Feature: Nudge Pipeline
- Feature: Opencode Plugin
- Feature: Prediction Engine
- Feature: Qa System
- Feature: Overview
- Feature: Repo Identity
- Feature: Session Lifecycle
- Feature: Setup
- Feature: Sideband
- Feature: Watchers