Skip to main content

Module history

Module history 

Source
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§

HistoryOwner
Whose history a lookup is about: the definition id its identity links are keyed by, and the working directory its transcripts record.
HistoryService
The history service exposed to the RPC layer.

Enums§

HistorySearchError
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_BEGIN also 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 no db_agents row — launching an agent does not create one, so a live agent commonly exists only here.
unix_time_to_ms
SearchHistory’s since/until in milliseconds. They’re documented as Unix seconds, but a hit’s own timestamp is 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).