{"id":50074986,"url":"https://github.com/rogerreed/agentlens","last_synced_at":"2026-06-09T05:01:40.290Z","repository":{"id":361308196,"uuid":"1248500064","full_name":"RogerReed/agentlens","owner":"RogerReed","description":"Local observability for AI agent sessions — reads OTEL traces and local log files from Copilot, Claude Code, and Codex. Token usage, cost, summaries, and efficiency insights. VS Code extension, npx, and Docker.","archived":false,"fork":false,"pushed_at":"2026-06-03T01:27:54.000Z","size":4731,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-06-03T02:17:55.202Z","etag":null,"topics":["agent","ai-agents","claude","codex","context","copilot","cost","cost-estimation","docker","llm","observability","opentelemetry","otel","otlp","telemetry","token-usage","vscode-extension"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RogerReed.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-24T18:11:47.000Z","updated_at":"2026-06-03T01:27:56.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/RogerReed/agentlens","commit_stats":null,"previous_names":["rogerreed/agentlens"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/RogerReed/agentlens","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RogerReed%2Fagentlens","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RogerReed%2Fagentlens/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RogerReed%2Fagentlens/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RogerReed%2Fagentlens/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RogerReed","download_url":"https://codeload.github.com/RogerReed/agentlens/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RogerReed%2Fagentlens/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34092262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","ai-agents","claude","codex","context","copilot","cost","cost-estimation","docker","llm","observability","opentelemetry","otel","otlp","telemetry","token-usage","vscode-extension"],"created_at":"2026-05-22T06:01:04.578Z","updated_at":"2026-06-09T05:01:40.284Z","avatar_url":"https://github.com/RogerReed.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1\u003e\u003cimg src=\"media/mascot.png\" alt=\"\" width=\"48\" align=\"center\" /\u003e AgentLens\u003c/h1\u003e\n\n[![CI](https://github.com/RogerReed/agentlens/actions/workflows/ci.yml/badge.svg)](https://github.com/RogerReed/agentlens/actions/workflows/ci.yml)\n[![License](https://img.shields.io/github/license/RogerReed/agentlens)](LICENSE)\n\n![AgentLens demo](media/demo.gif)\n\nLocal observability that makes AI agent sessions more transparent — see what's happening inside each run. No data leaves your machine.\n\nAgentLens receives **OpenTelemetry traces** from Copilot, Claude Code, and Codex in real time — giving you span timing, time-to-first-token, loop detection, file diffs, and actionable recommendations. It also reads **local session log files** written automatically by each agent as a zero-config fallback, backfilling history and filling gaps when OTEL isn't configured. Both sources are shown in one unified dashboard; OTEL always takes precedence when available.\n\n## Getting Started\n\n### Local (OTEL and log files)\n\nThe fastest way to get started — run directly on your machine with no install required. Because it runs natively it has full access to your local session log files.\n\n```bash\n# One-off — always uses the latest published version\nnpx agentlens-dashboard\nbunx agentlens-dashboard\n\n# Or install globally and run by command name\nnpm install -g agentlens-dashboard\nagentlens\n```\n\nOpen \u003chttp://localhost:3000\u003e after the server starts. The OTLP receiver listens on port `4318`. Configure agents to point at `http://localhost:4318` (see [Manual Configuration](#manual-configuration)).\n\n\u003e **Log file ingestion** reads local session files from `~/.claude/`, `~/.codex/`, and `~/.copilot/` directly. See [Local Mode Options](#local-mode-options) for environment variables.\n\n### VS Code Extension (OTEL and log files)\n\nThe extension receives OTEL traces in real time **and** reads local session log files, so you get both live telemetry and full session history automatically.\n\nWorks in **VS Code, Cursor, Windsurf, VSCodium, Trae, and Kiro** — install from your IDE's extension marketplace or from the VS Code Marketplace directly.\n\n1. **[Install from the VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=agentlens.agentlens-dashboard)**\n2. Open the **AgentLens** view from the Activity Bar\n3. AgentLens auto-configures OTEL telemetry for Copilot, Claude Code, and Codex — restart any running agent sessions to start streaming traces\n4. Past session history loads automatically from local log files — no extra setup needed\n\n### Docker (OTEL only)\n\n\u003e **Note:** Docker cannot read local session log files from your host machine without explicit volume mounts for each agent directory. Docker mode receives OTEL traces only — log file ingestion is not available. Use the local option above if you need log file history.\n\n```bash\n# Ephemeral — data cleared on container stop (always pulls latest)\ndocker run --pull=always -p 127.0.0.1:3000:3000 -p 127.0.0.1:4318:4318 agentlens/agentlens\n\n# Persistent — data survives restarts (macOS/Linux)\ndocker run --pull=always -p 127.0.0.1:3000:3000 -p 127.0.0.1:4318:4318 \\\n  -v ~/.agentlens:/data \\\n  agentlens/agentlens\n\n# Persistent — data survives restarts (Windows)\ndocker run --pull=always -p 127.0.0.1:3000:3000 -p 127.0.0.1:4318:4318 `\n  -v \"$env:USERPROFILE\\.agentlens:/data\" `\n  agentlens/agentlens\n```\n\nOpen \u003chttp://localhost:3000\u003e after the container starts.\n\n#### Configuring Agents for Local / Docker\n\nUse the included setup scripts to configure agents automatically, or see [Manual Configuration](#manual-configuration) for the manual steps.\n\n```bash\n# macOS / Linux\nchmod +x scripts/configure-agents.sh\n./scripts/configure-agents.sh\n```\n\n```powershell\n# Windows (PowerShell)\nSet-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser\n.\\scripts\\configure-agents.ps1\n```\n\n## Features\n\n- **OpenTelemetry collection** — Built-in OTEL receiver captures real-time traces and logs from Copilot, Claude Code, and Codex with no external infrastructure; auto-configured on first activation\n- **Log file ingestion** — Reads local session files written automatically by each agent as a zero-config fallback, backfilling history when OTEL isn't configured (VS Code-family IDEs and native process only)\n- **Sessions Table** — Drill into any session: expand a row to see a full waterfall trace, turn-to-tool flow graph, tool distribution chart, and modified files — all without leaving the session list\n- **Analytics** — Aggregate charts across the active time range: per-agent breakdown, estimated cost with a daily total overlay, token usage per session, and context growth\n- **Advisor** — Project-scoped suggestions for improving your agent instruction file (CLAUDE.md, AGENTS.md, or similar): detects hot files the agent rediscovers every session, loop patterns, high turn-count trends, and scope problems — each suggestion includes ready-to-copy instruction text and an inquiry prompt you can paste directly into your agent. Also includes an efficiency scatter plot (cost vs. LLM calls, colored by cache hit rate) and hot files ranked by access frequency. Select a specific project from the filter for tailored suggestions; all-projects view surfaces only universal patterns.\n- **Cost Estimation** — Estimates session cost for Copilot (three billing models), Claude Code, and Codex, broken down by model in a day-grouped table\n- **Efficiency \u0026 Inefficiency Detection** — Surfaces context bloat, redundant tool calls, cache misses, and five loop/malfunction patterns with suggested prompts to correct course\n- **Configurable Alerts** — Threshold-based notifications for turns, errors, active time, and repeat tool calls — per-agent or shared\n- **Export** — Export filtered sessions as JSON (full or redacted); respects the active agent, source, time range, and text filters\n\n## Data Sources\n\nAgentLens collects data from two independent sources per agent. Each session row shows a badge — **OTEL** or **Log** — indicating where its data came from. If both capture the same session, OTEL always wins and the badge upgrades automatically.\n\n### OpenTelemetry traces (primary source)\n\nThe VS Code extension runs a built-in OTEL HTTP receiver on port `4318` and auto-configures each agent on first activation. The native process and Docker modes also expose the same receiver. OTEL data is the richest source: real-time span timing, time-to-first-token, per-tool latency, loop detection signals, file diff content, and streaming speed. Sessions from OTEL show an **OTEL** badge.\n\nSee [Manual Configuration](#manual-configuration) for the specific settings each agent needs. OTEL is the only data source available in Docker mode.\n\n### Log file ingestion (fallback source, VS Code-family IDEs and native process only)\n\nAgentLens also reads the local session files that Claude Code, Codex, Copilot CLI, and Copilot Chat write automatically to your home directory. This requires no configuration and backfills session history that predates OTEL setup. Log-sourced sessions show a **Log** badge. **Not available in Docker mode** — the container cannot access host log directories without explicit volume mounts for every agent path.\n\n| Agent | Log file location (Mac/Linux) | Windows |\n| --- | --- | --- |\n| **Claude Code** | `~/.claude/projects/\u003cproject\u003e/\u003csession\u003e.jsonl` | `%APPDATA%\\Claude\\projects\\...` |\n| **Codex CLI** | `~/.codex/sessions/\u003cproject\u003e/\u003csession\u003e.jsonl` | `%USERPROFILE%\\.codex\\sessions\\...` |\n| **Copilot CLI** | `~/.copilot/session-state/\u003csession\u003e/events.jsonl` | `%USERPROFILE%\\.copilot\\session-state\\...` |\n| **Copilot Chat** | `~/Library/Application Support/\u003cIDE\u003e/User/workspaceStorage/…/chatSessions/` | `%APPDATA%\\\u003cIDE\u003e\\User\\workspaceStorage\\…\\chatSessions\\` |\n\nCopilot Chat sessions are scanned across all installed VS Code-family IDEs automatically — VS Code, VS Code Insiders, Cursor, Windsurf, VSCodium, Trae, and Kiro.\n\nLoading is incremental and runs in the background, sorted newest-first so recent sessions appear immediately. A 30-second poll picks up new sessions as they complete.\n\n**What log data includes:** session ID, workspace, model, timestamps, token counts (input, output, cache read/write), tool calls and file operations (Claude Code only), user prompt (Claude Code and Copilot CLI).\n\n**What log data does not include:** time-to-first-token, per-tool execution timing, streaming speed, loop detection signals, or structured error telemetry. Enable OTEL for those.\n\nTo disable log ingestion: set `agentLens.enableLogIngestion` to `false` in VS Code settings.\n\n## Cost Estimation\n\nThe **Analytics** tab (Estimated Cost section) shows the dollar cost of Copilot, Claude Code, and Codex sessions.\n\n**Copilot** supports three billing models via a toggle:\n\n| Mode | Who it applies to |\n| ---- | ----------------- |\n| **Token-based AI Credits** (default) | Default Copilot plans from June 1, 2026 — charges per input/output/cache token at per-model rates |\n| **Annual plan request-based** | Annual-plan holders staying on request billing from June 1, 2026 — multiplier × $0.04 per user-initiated prompt |\n| **Request-based** *(deprecated)* | Plans on request billing before June 1, 2026 — multiplier × $0.04 per user-initiated prompt |\n\n**Claude Code** and **Codex** always use token-based pricing — no toggle required. Claude Code is billed against the Anthropic API at standard per-token rates (input, cache write, cache read, output) depending on model (Opus, Sonnet, or Haiku). Codex is billed against the OpenAI API.\n\nThe Estimated Cost section includes a per-session bar chart with a daily aggregate line (right axis), a multi-dimensional table grouped by date and agent showing input, output, cache create, cache read, total tokens, and cost, and a model breakdown table. Included Copilot models (GPT-4.1, GPT-5 mini) show $0 under token-based billing.\n\nAll figures are estimates — not your actual bill. Rates are sourced from each provider's public pricing docs; see [PRICING_SOURCES.md](PRICING_SOURCES.md) for the authoritative URL for each billing model and notes for maintainers on keeping rates current.\n\n## Exporting Session Data\n\nThe **Export** tab writes session summary files to your workspace root:\n\n- `export_sessions_\u003ctimestamp\u003e.json` — full export including prompt text, token counts, tool usage, file changes, and cost estimates for every recorded session\n- `export_sessions_\u003ctimestamp\u003e.json` (redacted) — same structure with prompt text (`userRequest`) removed\n\nExports draw from the full SQLite session history, not just the active window, so all past sessions are included regardless of when they ran.\n\n\u003e **Note:** Session summary exports cannot be replayed with `pnpm run demo --file`. Replay requires raw OTEL span data, which is not yet persisted to disk. This is tracked as a planned enhancement.\n\n## Recommendations \u0026 Malfunction Detection\n\nThe **Sessions** tab (Overview sub-tab) and **Analytics** tab surface two categories of signal per session:\n\n**Efficiency insights** — problems you can fix by adjusting your prompts:\n\n- Context bloat (input tokens growing rapidly across turns)\n- Files read multiple times, duplicate searches, large tool results\n- Tool failures, high turn count, oversized starting context\n- Low cache hit rate, tool definition overhead\n\n**Loop \u0026 malfunction signals** — patterns indicating the agent is stuck or spiraling. These appear first in the list with a ↺ icon:\n\n| Signal | Description | Trigger |\n| ------ | ----------- | ------- |\n| **Tool Call Deadlock** | Same tool + arguments called 3+ times (critical at 5+) | Agent not retaining tool results |\n| **State Corruption Spiral** | A file edited then reverted to a prior state | Agent oscillating between conflicting constraints |\n| **Hallucination Amplification Loop** | Same error recurring 3+ times | Fix attempts not resolving the root cause |\n| **Ambiguous Success / Escalating Scope** | Too many steps for the task complexity | No clear completion condition |\n| **Infinite Loop — Context Accumulation** | Input tokens growing while output ratio collapses 70%+ | Agent stuck, accumulating context without progress |\n\nEach signal includes a specific recommended action and a **Copy for {Agent}** button that copies the recommendation prompt to your clipboard so you can paste it into your AI session. Use the **Ignore** button to dismiss signals that represent intentional behavior.\n\n## Manual Configuration\n\nThe VS Code extension configures agents automatically on first activation. For standalone or Docker mode, run the included setup scripts (see [Configuring Agents for Local / Docker](#configuring-agents-for-local--docker) above). Replace `4318` with your custom port if you changed `agentLens.otlpPort`.\n\n### GitHub Copilot\n\n**VS Code-family IDE extension** — Add to User Settings (`Cmd+Shift+P` / `Ctrl+Shift+P` → *Preferences: Open User Settings (JSON)*) in VS Code, Cursor, Windsurf, or any VS Code-family IDE:\n\n```json\n{\n  \"github.copilot.chat.otel.enabled\": true,\n  \"github.copilot.chat.otel.exporterType\": \"otlp-http\",\n  \"github.copilot.chat.otel.otlpEndpoint\": \"http://localhost:4318\"\n}\n```\n\n**Copilot CLI (standalone)** — Add to your shell profile, then open a new terminal:\n\n```bash\n# macOS / Linux — add to ~/.zshrc or ~/.bashrc\nexport OTEL_EXPORTER_OTLP_ENDPOINT=\"http://localhost:4318\"\nexport OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true\n```\n\n```powershell\n# Windows — run once in PowerShell (persists across sessions)\n[System.Environment]::SetEnvironmentVariable(\"OTEL_EXPORTER_OTLP_ENDPOINT\", \"http://localhost:4318\", \"User\")\n[System.Environment]::SetEnvironmentVariable(\"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT\", \"true\", \"User\")\n```\n\n---\n\n### Claude Code\n\nThe CLI and VS Code extension both read the same file. Add to the `\"env\"` block:\n\n- **macOS/Linux:** `~/.claude/settings.json`\n- **Windows:** `%USERPROFILE%\\.claude\\settings.json`\n\n```json\n{\n  \"env\": {\n    \"CLAUDE_CODE_ENABLE_TELEMETRY\": \"1\",\n    \"CLAUDE_CODE_ENHANCED_TELEMETRY_BETA\": \"1\",\n    \"OTEL_TRACES_EXPORTER\": \"otlp\",\n    \"OTEL_EXPORTER_OTLP_PROTOCOL\": \"http/json\",\n    \"OTEL_EXPORTER_OTLP_ENDPOINT\": \"http://localhost:4318\",\n    \"OTEL_LOG_TOOL_DETAILS\": \"1\",\n    \"OTEL_LOG_TOOL_CONTENT\": \"1\",\n    \"OTEL_LOG_USER_PROMPTS\": \"1\"\n  }\n}\n```\n\n`CLAUDE_CODE_ENHANCED_TELEMETRY_BETA=1` enables span-level tracing — without it turns and LLM calls are indistinguishable and cache token breakdowns are unavailable. The three `OTEL_LOG_*` vars unlock tool details, file diff content (needed for the Files tab), and your typed prompt. If `settings.json` already exists, merge the `env` block — do not replace the whole file.\n\n---\n\n### Codex\n\nThe CLI and VS Code extension both read the same file. Add an `[otel]` section:\n\n- **macOS/Linux:** `~/.codex/config.toml`\n- **Windows:** `%USERPROFILE%\\.codex\\config.toml`\n\n```toml\n[otel]\nlog_user_prompt = true\nexporter = { otlp-http = { endpoint = \"http://localhost:4318\", protocol = \"json\" } }\ntrace_exporter = { otlp-http = { endpoint = \"http://localhost:4318\", protocol = \"json\" } }\n```\n\n`log_user_prompt = true` includes your typed prompt; without it sessions show `[session in progress]`. `exporter` sends log events; `trace_exporter` sends trace spans. Both point at the same endpoint. If `config.toml` already has an `[otel]` section, add only the missing keys.\n\n## Local Mode Options\n\nAgentLens runs as a local web server outside VS Code — useful for CI, remote machines, or when you prefer a browser tab over the VS Code sidebar.\n\n### Native process (recommended for local use)\n\nRuns directly on your machine — no Docker required. Gives the server full access to the local filesystem, which is required for log file ingestion. Quick-start commands are in [Getting Started](#local-otel-and-log-files) above.\n\nEnvironment variables:\n\n| Variable | Default | Description |\n| --- | --- | --- |\n| `OTLP_PORT` | `4318` | OTLP HTTP receiver port |\n| `UI_PORT` | `3000` | Dashboard port |\n| `DATA_DIR` | `~/.agentlens` | Directory for persistent span data |\n| `BIND_HOST` | `127.0.0.1` | Set to `0.0.0.0` for LAN access |\n\nThe local server uses the same port as the VS Code extension — only one can run at a time. To run both simultaneously, use different ports:\n\n```bash\nOTLP_PORT=4319 UI_PORT=3001 bunx agentlens-dashboard\n```\n\n### Docker (OTEL only)\n\n\u003e **Log file ingestion is not available in Docker mode.** The container is isolated from the host filesystem. Use the native process option above if you need local session log history.\n\nQuick-start commands are in [Getting Started](#docker-otel-only). Additional options:\n\n**LAN-accessible** — exposes the dashboard to other devices on your network:\n\n```bash\ndocker run --pull=always -p 3000:3000 -p 4318:4318 -v ~/.agentlens:/data agentlens/agentlens\n```\n\n**Custom ports** — if `4318` is already in use by the VS Code extension:\n\n```bash\ndocker run --pull=always -p 127.0.0.1:3001:3000 -p 127.0.0.1:4319:4318 \\\n  -v ~/.agentlens:/data \\\n  agentlens/agentlens\n```\n\nThen point your agents at `http://localhost:4319` and open \u003chttp://localhost:3001\u003e.\n\n### Node.js (from source)\n\nRequires Node.js 18+ and this repository cloned locally.\n\n```bash\npnpm install\npnpm run local\n```\n\n## Automation Prompts File\n\nWhen an automation threshold is crossed, AgentLens can write the generated prompt to a markdown file. To act on it automatically, configure your agent to watch or include that file as an input — for example, by pointing Claude Code at it via a hook or referencing it in a system prompt. Without that wiring, the file serves as a persistent, reviewable log you can paste from manually. For simpler workflows, leave **Write prompts file** off and use the **Copy Prompt** notification button instead.\n\n### How it works\n\nWhen **Write prompts file** is enabled for an automation rule, each trigger appends a timestamped entry to an agent-specific file:\n\n| Agent | File written |\n| --- | --- |\n| Claude Code | `agentlens-prompts-claude.md` |\n| GitHub Copilot | `agentlens-prompts-copilot.md` |\n| Codex | `agentlens-prompts-codex.md` |\n\nIn the VS Code extension, files are written to the workspace root. In local mode, files are written to the directory where the server is running.\n\nEach entry uses this format:\n\n```markdown\n## 2026-05-21 14:30:22 — Loop Breaker\n\n[AgentLens Automation: Loop Breaker]\n\n...generated prompt...\n\n---\n```\n\nWhen **Write prompts file** is off (default), triggering an automation shows a notification with a **Copy Prompt** button instead — click it to copy the prompt to your clipboard, then paste into your agent.\n\n## VS Code Commands\n\nOpen the VS Code Command Palette (`Cmd+Shift+P` / `Ctrl+Shift+P`) and search for **AgentLens**:\n\n| Command | Description |\n| ------- | ----------- |\n| `AgentLens: Open Dashboard` | Open the full dashboard in an editor panel |\n| `AgentLens: Export OTEL Data` | Write session data to JSON files in your workspace root (also available in the **Export** dashboard tab) |\n| `AgentLens: Export OTEL Data (Redacted)` | Same, with prompt text, tool inputs, tool results, and PII replaced with `[redacted]` |\n\n## Extension Settings\n\n| Setting | Default | Description |\n| ------- | ------- | ----------- |\n| `agentLens.otlpPort` | `4318` | Local port for the OTLP trace receiver |\n| `agentLens.enableLogIngestion` | `true` | Read local session log files from Claude Code, Codex, and Copilot CLI. Disable if you only want OTEL data. |\n| `agentLens.sessionRetentionDays` | `90` | How many days to keep session history in the local database |\n\n## Agent Data Formats\n\nAgentLens collects data from two sources per agent and normalizes both into a shared session model. The **Log** badge indicates log-file data; **OTEL** indicates telemetry data. When both are present for the same session, OTEL wins.\n\n### Claude Code\n\n**Log files** (automatic, no setup) — `~/.claude/projects/\u003cproject\u003e/\u003csession-uuid\u003e.jsonl`\n\nEach file is one session. `assistant` entries carry per-turn token counts (input, output, cache read/write). `user` entries carry the prompt text. Tool calls are embedded in message content blocks.\n\nAvailable from logs: prompt, model, workspace, timestamps, all token counts, tool names, files read/written.\nNot in logs: TTFT, per-tool latency, streaming speed, loop signals.\n\n**OTEL** (richer, requires env config) — trace spans via `/v1/traces` and supplemental log records via `/v1/logs`.\n\nWith the recommended configuration (all three `OTEL_LOG_*` vars): prompt text, token counts, model, tool names, tool arguments, file paths, and full file diff content are all available. The three `OTEL_LOG_*` vars are not enabled by default — without them, tool arguments are absent and prompt text is omitted.\n\n---\n\n### Codex CLI\n\n**Log files** (automatic, no setup) — `~/.codex/sessions/\u003cproject\u003e/\u003csession-uuid\u003e.jsonl`\n\n`turn_context` entries carry the model name. `event_msg` entries with `type: token_count` carry per-turn cumulative token usage. The user's prompt text is not present in this format.\n\nAvailable from logs: model, timestamps, token counts (input, output, cache read).\nNot in logs: prompt text, tool names, TTFT, latency.\n\n**OTEL** (richer, requires config) — primarily flat OTLP log records (`/v1/logs`); adding `trace_exporter` also emits timing spans. With `log_user_prompt = true` and both exporters: prompt text, token counts, model, TTFT, tool names and results, and span timing are all present.\n\n---\n\n### Copilot CLI\n\n**Log files** (automatic, no setup) — `~/.copilot/session-state/\u003csession-uuid\u003e/events.jsonl`\n\n`session.start` carries the model and workspace. `user.message` carries the user prompt. `assistant.message` carries per-turn output token counts. `session.shutdown` carries total context size.\n\nAvailable from logs: prompt, model, workspace, timestamps, output tokens, total context size, tool names.\nNot in logs: input tokens per turn (estimated from shutdown totals), TTFT, cache token breakdown.\n\n**OTEL** (richer, requires VS Code settings) — trace spans via Copilot's built-in OTEL exporter. Prompt text, token counts (input, output, cache read), model, TTFT, tool names, arguments, and results are all present natively. Cache write counts are not exposed — Copilot manages cache creation server-side.\n\n---\n\n\u003e **Note:** Agent observability is evolving rapidly. All three platforms are actively expanding what they expose, and the GenAI semantic conventions are still being standardized. AgentLens will be updated as richer data becomes available.\n\n## Additional Features\n\n- **Files Changed** — The Files tab tracks every file created or modified by the agent, organized by session with inline before/after diffs\n- **Multi-session Comparison** — The Analytics tab shows per-agent breakdown cards with side-by-side token totals, cache rates, TTFT, and top tools for Copilot, Claude, and Codex\n- **Automated Prompts** — The Automation tab lets you configure threshold-based automations (Loop Breaker, Turn Limit Wrap-up, Context Dump) that trigger a correction prompt when a session crosses a limit — delivered as a VS Code notification or written to a file for agent consumption\n\n## AI Usage Disclosure\n\nAgentLens was built primarily with [Claude Opus](https://www.anthropic.com/claude). Thank you to Anthropic for building tools that make projects like this possible.\n\n## License\n\nMIT\n\n## Disclaimer\n\nAgentLens is an independent open-source project and is not affiliated with, endorsed by, or associated with GitHub, Inc. or Microsoft Corporation (GitHub Copilot); Anthropic, PBC (Claude / Claude Code); or OpenAI, LLC (Codex CLI). All product names, trademarks, and registered trademarks are the property of their respective owners. AgentLens interacts with these products solely through their publicly documented OpenTelemetry telemetry interfaces.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frogerreed%2Fagentlens","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frogerreed%2Fagentlens","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frogerreed%2Fagentlens/lists"}