agent-session
agent-session is the reusable Rust library for local AI coding-agent session
data. It owns agent-specific transcript discovery/parsing and exposes a common
session IR for applications such as AgentSight.
Responsibilities
- Discover and parse local Claude Code, Codex, and Gemini CLI session files.
- Normalize model usage, token totals, tool calls, file references, prompts, cwd, timestamps, and session identifiers.
- Match live process trees to sessions using real path evidence, sticky bindings, and recent cwd fallback.
- Expose PID-to-session lookup through
SessionProcessMatches::session_for_pid.
Non-goals
- No OpenTelemetry exporter in this crate. AgentSight owns OTEL and other product sinks.
- No UI, report rendering, database schema, or eBPF capture logic.
- No dependency on AgentSight collector internals.
OTel Alignment
agent-session remains a local IR. Its public fields use OTel-friendly names
where they fit: agent_type, conversation_id, and aggregate usage.
AgentSight maps those fields to OTLP only at export time and leaves
conversation_id unset when a native log has no real session/thread id.
Release
AgentSight's release workflow publishes agent-session before publishing
agentsight. The workflow finds the next available agent-session patch
version on crates.io, updates agent-session/Cargo.toml, updates the collector
dependency, regenerates collector/Cargo.lock, and commits that release
snapshot before packaging.
After crates.io publish, docs.rs builds the Rust API docs and the unofficial lib.rs index can discover the crate from crates.io metadata.
Continue exploring
Back to index
AgentSight: System-wide AI agent profiling and monitoring with eBPF
  
Next
agentpprof: pprof-style profiles for AI coding-agent sessions
An AI coding agent can finish a task and leave behind hundreds of events: user prompts, model calls, shell commands, file edits, package downloads, test runs, and retries.
- Last updated
- Jun 23, 2026
- First published
- Jun 23, 2026
- Contributors
- LinuxDev9002
Was this page helpful?