Expand description
History module — discovers and indexes past CLI agent conversations from disk.
Modules§
- adapter
- History adapter trait and shared types.
- claude_
adapter - Claude Code history adapter. Scans for session JSONL files across both the user’s global Claude homes and the AgentMux-isolated homes that current agents actually write to:
- index
- In-memory session index built from adapter discovery.
- record 🔒
- What AgentMux’s own record says about an agent’s conversations.
Structs§
- History
Owner - Whose history a lookup is about: the definition id its identity links are keyed by, and the working directory its transcripts record.
- History
Service - The history service exposed to the RPC layer.
Enums§
- History
Search Error - Why a history search could not answer.
Constants§
- HISTORY_
INDEX_ BUILDING - A search’s answer while the first index build after srv start is running.
- WARM_
DELAY - How long after srv start the first index build waits
(
HistoryService::warm_in_background): past the window in which the user opens their first agents. The spec protects the first 30 s (SPEC_AGENT_OPEN_LATENCY_2026_09_27.md §5), and a cold build can take 25 s on its own, so a start inside that window would still overlap it (Codex P2 on #3930). A search before then starts the build early (HistoryService::refresh_for_search).
Functions§
- accounts_
linked_ 🔒to_ several_ agents - Account ids linked to more than one agent (
db_agent_identity_links). - build_
first_ 🔒index - Run the index’s first build unless another caller has finished it or is
running it now — never a second full pass right after theirs (Codex P2s on
#3930) — then clear
pending. - lower_
current_ 🔒thread_ priority - Lower the calling thread’s scheduling priority for background work. On
Windows,
THREAD_MODE_BACKGROUND_BEGINalso lowers its I/O and memory priority — the index build is mostly file reads. On Linux, a nice of 10 for this thread only. Best-effort: a failure leaves normal priority. - record_
meta 🔒 - What a search knows about a session only AgentMux’s record holds.
- registry_
record 🔒 - The global named-agent registry record for
agent_id, for agents that have nodb_agentsrow — launching an agent does not create one, so a live agent commonly exists only here. - unix_
time_ to_ ms - SearchHistory’s
since/untilin milliseconds. They’re documented as Unix seconds, but a hit’s owntimestampis in milliseconds and is the natural value to pass back; a value this large is already milliseconds (as seconds it would be the year 5138).