Skip to main content

Crate sessionwiki

Crate sessionwiki 

Source
Expand description

sessionwiki: index, search, and resume every AI coding session on your machine, across Claude Code, Codex, Gemini CLI, OpenCode, the Cline family, gajae-code, and Continue.

The binary is a thin CLI over this library. The pieces worth reusing as a dependency are adapters (parse a session file into a model::Session) and index (an incremental SQLite FTS5 index over parsed sessions).

Modules§

account_link
Optional swapdex integration: attribute each session to the ACCOUNT profile that was active when it started, by reading swapdex’s switch timeline (read-only). No swapdex on the machine -> no events -> no badges, silently.
adapters
blame
blame core: git-blame porcelain parsing, run grouping, the commit -> session attribution heuristic, and the hardened git invocation. The parsing and attribution are pure and unit-testable without git or a database.
commands
doctor
doctor: a self-diagnosis of this machine’s setup. sessionwiki reads a dozen drifting session formats and an on-disk index; when something looks empty or stale the cause is usually mundane (no store on this box, an index behind a schema bump, a store that will not parse). This surfaces that at a glance so a bug report starts from facts, not guesses.
hook
The SessionStart recall hook: parse CC’s stdin JSON, query the index for the launch project, and print a small fenced brief to stdout (injected into the agent context on exit 0). Empty output when there is no history. Untrusted session titles/paths are sanitized and fenced as DATA, never instructions.
index
mcp
A hand-rolled, stdio-only MCP server: newline-delimited JSON-RPC 2.0, six read-only tools over the local session index. No network (stdio only), no sync, no writes (the DB handle is read-only). The server owns every byte written to stdout; all logging goes to stderr.
migrate
Path math for migrate - relocating a session so it can be resumed from a different project directory. Each tool ties a session to a directory differently, so the encoding lives here (and is unit-tested against the schemes observed on disk).
model
redact
Strip credentials from text before it is stored in the index. Sessions contain the code and conversations an agent produced, which routinely include secrets (a .env written, a key pasted into a prompt). Because the index outlives the original session (archive mode), those secrets must not land in it. This runs at index time over message text and edit snippets.
resume
util
web
window
A bounded, agent-consumable render of a session: the actual conversation (not a lossy summary), but with tool-output bulk folded to head+tail and an optional total budget that keeps the recent tail. This is what a caller (an agent via MCP, or show --window) reads to know what another session is doing without flooding its own context. The four things that make it parseable: an orientation header, role labels, tool CALLS kept but tool RESULTS folded, and a drill-down hint to show <id> --full.