Expand description
context-bar-core — the cross-platform engine.
Everything reusable across the surfaces lives here: transcript reading,
the cost/token model, session/window bucketing, the agent-context
assembler, and the HUD/HTML renderers. The crate is platform-free at the
type/parse/assemble layer; the host-coupled bits (process spawning, the
macOS keychain, the on-disk snapshot cache, and the wasm32 Worktree
collectors) sit behind cfg(target_arch) gates inside their modules.
Consumers:
- the
context-barCLI/menubar engine (native) callsusage_signal::collect_native,context_engine::assemble,state_writer::write,hud::render,detail_html::render; - the Zed extension (wasm32) reuses the same types and calls the
Worktree-backed collectors (git_signal::collect,usage_signal::collect,context_engine::ContextEngine::generate).
The seam that keeps the engine decoupled from any host is
context_engine::assemble, which takes pre-collected signals.
Modules§
- agent_
context - Combined, agent-readable brief.
- aggregate
- Deterministic transforms — slice 2 of folding
usage_signal.pyinto Rust (ROADMAP E1). Ported 1:1 fromempty_metrics/_add_metrics,split_logical_sessions,_empty_bucket/_accumulate,bucket_aggregates, andproject_name_from_cwd. Pure given (events, NOW, UTC offset) — pinned by a golden fixture generated from the Python (tests/aggregate_golden.rs). - claude_
statusline - collect
- Pure-Rust transcript collection — slice 3 of folding
usage_signal.pyinto Rust (ROADMAP E1). Portscollect_claude/collect_codex(JSONL discovery, per-turn token extraction, rolling windows, last-turn + active-session fields, context-window heuristic) andbuild_active_sessions/claude_context_window, reusing the golden-pinnedpricing+aggregatekernels. - context_
engine - detail_
html - Detail page renderer.
- git_
signal - hud
- HUD rendering.
- i18n
- Bilingual (EN/TR) text selection, shared by every Rust surface.
- live
- 5h-block burn status — the engine half of the live dashboard (ROADMAP B2) and the native popover gauge (C1). Pure: derives burn rate, % of limit, ETA-to-limit, and a projected block total from a snapshot + a clock.
- online
- Online / host enrichments — the final slice-4 piece of the Python→Rust port.
Ports the statusline-snapshot overlay, the Anthropic usage API (account 5h/7d
%), Codex transcript rate-limits, and cross-platform credential discovery
(
~/.claude/.credentials.json; macOS keychain). All best-effort: each degrades to a no-op offline / without credentials, exactly like the Python. Native-only (HTTP + subprocess + filesystem). - others
- Other-AI-tool probes — part of slice 4 of the Python→Rust port (ROADMAP E1).
Ports
probe_gemini_cli,probe_aider,probe_shell_history, andcollect_othersfromusage_signal.py. Native-only (reads~/.gemini,~/.aider,~/.zsh_history). ThellmCLI sqlite probe is intentionally omitted (would pull a sqlite dependency for a niche tool) — documented gap. - pricing
- Cost kernel — the API-equivalent pricing math, ported 1:1 from
usage_signal.py(theFALLBACK_PRICINGtable, model matcher,_tiered,turn_cost,turn_cache_savings). This is the first slice of folding the Python aggregator into Rust (ROADMAP E1). It is PURE — no I/O, no clock — so it is pinned by a golden fixture generated from the Python (tests/), guaranteeing byte-for-byte cost parity (seedocs/ai/COST_MODEL.md). - report
- Tabular usage/cost reports built from a
UsageSnapshot. - state_
writer - time_
windows - usage_
signal - Cross-project agent usage signals.