Skip to main content
For the full guide, see Memory.
The runtime toggles shown below still depend on a memory-enabled build. If the binary was compiled without the relevant memory features, enable_memory and --tools full do not magically add semantic memory on their own.

Enable semantic memory

When memory is enabled, discarded conversation turns are indexed into a semantic store. The agent gains a memory_search tool to recall past context on demand.
When memory is enabled, the agent automatically gains the memory_search tool. It calls this tool when it needs to recall information from earlier, compacted-away turns. The tool call appears in the event stream like any other tool invocation:
Results are returned as a JSON array with similarity scores and the typed source handle (the half-open offset range of the source message(s) the entry was indexed from). Memory is scoped to a single session; results do not carry a session_id, and there is no cross-session recall:
Scores range from 0.0 (no match) to 1.0 (exact match). Useful results are typically above 0.7.

Compaction

Context compaction triggers automatically when the conversation history exceeds a token threshold. The compactor summarizes older turns, keeps recent ones, and indexes discarded messages into memory. The compaction cycle emits events into the session stream:
If the built-in summarization request fails with a recognized over-context or request-too-large error, Meerkat can use a deterministic mechanical handoff summary to shed old rows. This is allowed only when current history has no protected, unsummarized assistant transcript observations with source SpokenUnmeasured. With those observations, the compaction attempt emits compaction_failed and preserves the original transcript, as it does for ordinary LLM errors. A configured curator never falls back to the mechanical or LLM path. Custom thresholds via the Rust SDK:
max_request_bytes is a host cap, not an estimate of the current request. Compaction triggers at four-fifths of the effective cap. When the provider also supplies an exact request-body cap, the stricter cap wins.

Supply a compaction curator

Use a curator when a host application has its own deterministic or supervised handoff-summary path. The runtime still decides when compaction is required and validates the resulting rewrite.
There is no automatic LLM fallback. A curator error emits compaction_failed, records no transcript rewrite, and leaves the original history authoritative.

Budget limits

Cap resource usage per session with token, time, and tool-call limits. When a budget is exhausted, the agent loop terminates gracefully.
Configure the cumulative token budget in the active realm config:
--max-tokens limits each model call’s output, not cumulative consumption. The limits.budget setting above supplies the aggregate token limit corresponding to budget_limits.max_tokens in the API examples.

Budget events

When consumption nears a limit, a warning event is emitted before the budget is fully exhausted:

Retry policy

Transient LLM errors (rate limits, network timeouts) trigger automatic retries with exponential backoff. Each retry attempt emits an event carrying the typed failure and the scheduled retry plan:
Retries consume time budget but not token budget. If the time budget expires during a backoff wait, the agent terminates with a budget-exhausted error.

Next step