Files
hx/docs/adr/0035-memory-search-and-extraction.md

857 B

Memory: byte-budgeted index, BM25 search, automatic extraction

Status: accepted (supersedes 0013)

Context

The 50-entry cap made write fail instead of letting memory grow, and the agent rarely wrote memory at all, so project decisions were lost between sessions.

Decision

No entry cap. The prompt index shows the most recently used hooks up to 2 KB per scope; memory_search (BM25 over slug, hook and body, no dependency) reaches the rest and bumps recency (topic file mtime). The prompt lists concrete write triggers and defaults to project scope. Compaction and session exit run one extraction call (max 5 entries, written without asking).

Consequences

Prompt cost stays flat as memory grows. Search scans all topic files per query. Embeddings can replace the ranking later without changing the tools.

Code: crates/hx-core/src/memory.rs