Docs
AgentLens reads the session logs your AI coding agents already write and turns them into usage, cost and performance analytics. Nothing sits in front of your model calls.
Before you start
You need an AgentLens workspace and Node 20.9 or newer. If you don't have a workspace yet, create one — the Solo plan is free and needs no card.
1. Connect a machine
Create a collector token in AgentLens under Settings → Collector tokens, then run the collector on the machine your agents run on:
npx @sinaispace/agentlens connect --token al_...This detects the agents installed locally, verifies the token against the server, writes ~/.agentlens/config.json with mode 600, and backfills the history it finds. Useful flags:
--url— point at a self-hosted install instead of the cloud.--redact— upload metrics only and leave all prompt and response text on the machine.--no-sync— connect without the initial backfill.
2. Sync
npx @sinaispace/agentlens sync # upload anything new since last sync
npx @sinaispace/agentlens status # what is connected, how far it has syncedRe-syncing is always safe. The server deduplicates on session and event identity, so --full re-reads everything without creating duplicates. Use --dry-run to preview a batch and --max-sessions <n> to cap a large first backfill.
Supported agents
Agents that write session logs locally are detected automatically by the collector:
- Claude Code (Anthropic) — Local session logs + OTel hooks
- Codex CLI (OpenAI) — Session rollouts + API usage
- Gemini CLI (Google) — Telemetry export + local history
- OpenCode (SST) — Storage dir + server events
- Grok CLI (xAI) — API usage + local transcripts · beta
- Qwen Code (Alibaba) — Local history + DashScope usage · beta
- Aider (Open source) — Chat history + analytics file
- Cline (Open source) — Task store + provider usage · beta
- Continue (Open source) — Dev data events · soon
Agents that only report at organisation level can't be seen from a developer machine. An admin connects those once in the web app with org credentials:
- GitHub Copilot (GitHub) — Copilot metrics API + CLI logs
- Cursor (Anysphere) — Admin usage API · beta
- Windsurf (Codeium) — Teams analytics API · soon
- Amp (Sourcegraph) — Thread export API · soon
Anything else can push straight to the ingest API.
Environment variables
The collector reads these, in preference to its config file:
AGENTLENS_TOKEN— collector token, overrides the config file.AGENTLENS_URL— server URL, for self-hosted installs.AGENTLENS_CONFIG— config path, default~/.agentlens/config.json.CLAUDE_CONFIG_DIR— Claude Code data directory, default~/.claude.
Source
The collector is MIT licensed and has no runtime dependencies — read it on GitHub or on npm. It is read-only by design: no proxy in front of your model calls, no provider API keys read or transmitted, and if AgentLens is unreachable your agents keep working and the collector backfills next run.