merkhain

Recall remembered work

Use the read-only MCP tool memory_recall at the start of a task or before repeating an approach. Give it a few distinctive keywords and the directory you are working in:

{"query":"sqlite queue recovery","dir":"/absolute/project"}

merkhain returns useful details from the strongest matches, nearby memories from the same session, and a bounded part of their correction history. It uses the local search index; recall makes no model calls and fetches no remote raw transcripts. With an embedding or hybrid recall_search.backend (see Local memory) only the query is sent to the configured loopback embedding server; the result's backend and fallback say which method ranked and why full-text search served instead. All worktrees of a repository share its project identity.

Results label each record as match, neighbor, or history. current: true means no record explicitly supersedes that memory. It does not mean the claim was independently verified. Treat remembered claims as background to check against the current code and tests, which win when they disagree. Each record carries its provenance (session, agent, branch, commit) and timestamps; records pulled from a pool show their author, and describe what that person did, not a claim on the work. If nothing relevant is returned, continue normally: capture and extraction are asynchronous, so the newest work may not be indexed yet.

Each record carries two times. created_at (readable: "recorded") is when the memory was extracted or saved, which can be hours after the work. source_time (readable: "Work") is the first–last range of the record's cited source events that are stored on this device in the record's own project, with the number of events used; partial: true means the record cites more events than that range covers. Raw events never leave their device, so records shared by another device, imported records and saved records without citations have no source time ("Work time unknown on this device"); merkhain does not guess one. At most 256 citations per record are looked up. When the smallest budgets cannot fit the range, it is dropped with source_time_omitted: true; use memory_get for the per-event occurred_at.

When the current task shows a remembered claim is wrong, save a correction with memory_save (supersedes set to the wrong record's ID). There is no review queue; correct what you encounter rather than auditing memory.

A record that should never have been memory (status noise, a misread transcript) can be retracted: memory_retract, merkhain recall retract [--reason TEXT] mem_…, or Retract in the memory's detail view. A retracted record leaves search, recall (matches, neighbors and correction history), prompt context, extraction context and the Insights top memories, and is not published (publish --all and project bindings skip it; listing it is refused until you restore it). It stays readable with memory_get, and labeled in the timeline and the UI; restore undoes it. Records stay append-only. Retracting a record you authored that is in a pool shares the retraction with that pool (protocol); any other retraction stays on this device. To find older extracted records that only orchestration noise supports, preview merkhain rules cleanup --project .; its --apply retracts them locally and --undo restores them (Event filter).

The tool accepts the same projects, pools, author, session_id, kinds, since, until, include_resolved, and include_superseded filters as memory_search. Correction history can include earlier dates and different kinds to explain a matched record, but never bypasses project, pool, author, or session boundaries.

By default it expands three direct matches. max_details accepts 1–5, and max_bytes accepts 1,024–32,768 bytes (default 16,384). The budget covers the readable response and structured data together. Expansion searches at most 20 candidates, includes at most one neighbor on each side of a match and two correction ancestors per match, and returns at most 15 unique records. Direct matches get priority over supporting context. Raw payloads and source-event lists are excluded.

For a plain multi-word query, recall fills otherwise unused direct-detail slots with records matching some query terms when fewer than max_details records match all terms. Full matches stay first; mixed results carry match: "expanded". This applies to the requested count, including 1 or 5, within the same byte budget. Explicit phrases, OR, exclusions and prefix queries retain their existing meaning. memory_search keeps its existing all-term search and no-hit fallback; its pagination and cursors are unchanged.

If body_truncated, metadata_truncated, or context_truncated is set, use memory_get for the relevant ID with the same scope. Existing memory_search, memory_timeline, and memory_get remain available for deliberate browsing. Get now bounds correction-history traversal to 100 ancestors and reports history_truncated when that limit is reached; continue from the oldest returned ID when needed. It lists each distinct source event once, at most 256 of them, and reports sources_truncated when it dropped any.

Resolved work

Todo records expose resolution_state: "open" | "resolved". A resolved record keeps its original text and may still have current: true: resolution and correction are separate. resolved_by contains supporting memory IDs visible in the requested project/pool scope. Explicit memory_get / recall get always retains historical access.

Search, bounded recall, timelines, and session memory listings hide resolved todos by default. Pass include_resolved: true over MCP/HTTP, use --include-resolved for CLI search/timeline, or select Include resolved in the browser. Historical results are labeled resolved; contextual recall does not silently reintroduce them as outstanding work. A correction to a supporting outcome reopens the original todo unless another effective resolution exists.

Back up the SQLite database before installing schema 304. Rollback requires the matching database backup and binary; older binaries reject schema 304. Reconnect already-running MCP clients after installation so they use the new filters.