Expand description
ai-memory boot — universal session-boot context primitive (issue #487).
Every AI-agent integration recipe (Claude Code SessionStart hook, Cursor
.cursorrules boot directive, Cline / Continue / Windsurf system-message,
Codex CLI / Claude Agent SDK / OpenAI Apps SDK programmatic prepend,
OpenClaw built-in, local models via LM Studio / Ollama / vLLM) calls this
same subcommand and consumes its stdout as the agent’s first-turn context.
Boot deliberately does not load the embedder. It returns the most-recently-accessed memories in the inferred namespace, falls back to the most-recently-accessed memories globally if the namespace is empty, and clamps output to a token budget so a misconfigured agent can’t bloat its first turn.
Failure modes are graceful by default:
- DB unavailable +
--quiet: exit 0, empty stdout (a hook that fails here would otherwise wedge the agent’s session). - DB unavailable + no
--quiet: write the error to stderr, emit only the header on stdout, still exit 0. - No memories found: emit the header (or nothing with
--no-header), exit 0.
§Diagnostic manifest (PR-4 of #487)
Boot’s header is a transparent, multi-field manifest — never a black box. Every field reflects a fact about this invocation so agents and humans always know exactly what was loaded and what’s configured. Fields:
version— binary version (CARGO_PKG_VERSIONat compile time)db— resolved DB path + schema version + total live memoriestier— active feature tier and configured (not loaded) embedder / reranker / llm modelslatency— wall-clock fromrun()entry to header emitnamespace— resolved namespace + how many memories matched
Structs§
- Boot
Args - Args for
ai-memory boot. Every field has a defaulted value so the subcommand is safe to invoke with no arguments — that is the contract every integration recipe relies on.
Enums§
- Boot
Format - Output formats supported by
ai-memory boot.
Constants§
- MAX_
SUPPORTED_ SCHEMA - Upper bound of the DB-schema range this binary supports.
- MIN_
SUPPORTED_ SCHEMA - Lower bound of the DB-schema range this binary supports. Below this
we emit a
warn-schema-unsupportedmanifest header so the user knows theirai-memorybinary is too new for an old DB. Set to the v0.6.3 baseline (16) — older schemas won’t have the columns the recall pipeline expects. v0.6.3.1 (PR-9h / issue #487 PR #497 req #72).
Functions§
- run
ai-memory bootentry point.- schema_
in_ supported_ range - Pure boundary check:
truewhenvlies within[MIN_SUPPORTED_SCHEMA, MAX_SUPPORTED_SCHEMA]. Extracted so the boundary semantics (inclusive both ends) can be unit-tested without needing a synthetic DB whoseschema_versionlies outside the migration ladder’s reach. v0.6.3.1 (PR-9h / issue #487 PR #497 req #72).