Skip to main content

Module context

Module context 

Source
Expand description

Best-effort, local-only Claude Code context-window discovery.

Claude Code transcripts are an undocumented JSONL surface, so this module deliberately treats every line as optional data. It reads only bounded tails, ignores unknown/corrupt records, never follows discovered symlinks, and reports unknown usage instead of fabricating zero. A compaction record after the latest usage invalidates that reading until another assistant response supplies the new context size.

Structs§

ContextScan
ContextSession

Enums§

ContextUsage

Constants§

MAX_SESSIONS
The overlay is a recent-session monitor, not an unbounded history browser.

Functions§

default_projects_path
Resolve Claude Code’s conventional local transcript directory without reading it. Kept separate so tests always inject their own root.
sanitize_display
Strip terminal control characters and cap untrusted transcript labels before they enter ratatui’s backing buffer.
scan_dir
Scan the most recently modified top-level session transcripts below root. Subagent sidechains are excluded, and discovered symlinks are never followed. The caller should run this blocking filesystem work on Tokio’s blocking pool.