Agent Adapters, Telemetry, Import & Export¶
Chakshu operates zero-proxy: it never sits in the network path of your AI coding agents. Instead, it passively reads the session transcripts that agents already write to disk.
1. Supported Agents & Adapters (internal/adapter)¶
| Agent | Adapter Name | Transcript Locations | Captured Telemetry |
|---|---|---|---|
| OpenAI Codex | codex |
~/.codex/sessions/**/rollout-*.jsonl |
Tool calls, skill reads, user prompts, agent chat, approval signals |
| Claude Code | claude-code |
~/.claude/projects/*/*.jsonl |
Assistant tool use blocks, tool results, API token usage (input_tokens, output_tokens), chat turns, permission signals |
| Gemini CLI / Antigravity | gemini |
~/.gemini/antigravity-cli/brain/**/*.jsonl |
Planner tool calls, step outputs, turn token attribution, subagent delegations, confirmation signals |
| Cursor IDE | cursor |
~/.cursor/{projects,chats,sessions}/**/*.jsonl |
Agent/composer tool calls, subagent transcripts, token usage |
Multi-harness subagent linking is supported across all four adapters, grouping nested subagent sessions and parallel tool batches in the Session Cockpit.
Incremental Watcher & Checkpointing (internal/watcher, internal/store)¶
chakshu daemonpolls all registered adapterRoots()every 1 second.- File byte offsets are persisted transactionally in SQLite (
filestable), so daemon restarts, log rotations, and file truncations are handled cleanly without duplicating events. - All data is stored locally in
~/.chakshu/chakshu.db(overridable viaCHAKSHU_DB) using pure Go SQLite (modernc.org/sqlite, zero CGO).
Adding a New Agent Adapter¶
To support a new AI agent, implement the adapter.Adapter interface in internal/adapter/adapter.go:
type Adapter interface {
Name() string
Roots() []string
Match(path string) bool
Parse(line []byte) []event.ToolCall
}
Register the new adapter in adapter.All().
2. Telemetry & Cost Intelligence (internal/stats)¶
Chakshu aggregates raw ToolCall records into session, agent, and model-level telemetry (chakshu stats and #/sessions/:id/metrics):
- Auto-Generated Session Titles: Derived automatically from the session's initial user prompt.
- Active Session Detection: Sessions with events within the
ActiveWindow(5 minutes) are flagged as active/in-flight. - Session Reliability Scoring: Computes a
0–100reliability score (clean,moderate, orfragile) from failure rates, retry loops, and security anomalies, surfaced in Session List and Session Detail badges. - Model-Wise Session Analysis (
ModelStat): Tracks call share %, prompt/completion tokens, duration, and subtotal cost for each LLM model used within a session. - API-Measured vs. Estimated Tokens: Uses exact
input_tokensandoutput_tokenswhen present in agent API logs (such as Claude Code and Gemini), falling back to estimation with explicit UI badges when unavailable. - Latency & Failure Rates: Computes average/total execution duration and failure counts per tool, agent, and session.
3. Historical Ingestion (internal/importer)¶
Use chakshu import to retroactively ingest past transcript files or entire directories into ~/.chakshu/chakshu.db using batched SQLite commits:
# Auto-detect adapters across a directory
chakshu import ~/.codex/sessions/
# Restrict ingestion to a specific adapter
chakshu import /path/to/transcript.jsonl --agent codex
4. Structured Data Export (internal/exporter)¶
Export recorded ToolCall records enriched with security risk annotations (Risks) to stdout in JSON or CSV format:
# Pretty-printed JSON export
chakshu export --format json > telemetry.json
# CSV export scoped to a session or agent
chakshu export --format csv --session #ab12cd34 > session.csv
chakshu export --format csv --agent claude-code --limit 5000 > claude.csv
Each exported ExportRecord includes:
id, agent, session_id, tool, kind, underlying_tool, status, exit_code, duration_ms, timestamp, cwd, input, output, and risks.