agentlen
Health Uyari
- No license — Repository has no license file
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 5 GitHub stars
Code Basarisiz
- exec() — Shell command execution in dashboard/src/App.tsx
- network request — Outbound network request in dashboard/src/App.tsx
- network request — Outbound network request in dashboard/src/components/EnhancedTraceDetail.tsx
- network request — Outbound network request in dashboard/src/components/SourceEventsBlock.tsx
Permissions Gecti
- Permissions — No dangerous permissions requested
Bu listing icin henuz AI raporu yok.
Local-first Claude Code and Codex session log viewer with search, replay, and usage analytics.
AgentLens
Local-first session intelligence for coding agents.
Website · Install · Screenshots · HTTP API
AgentLens is an open-source, local-first AI agent log viewer and agent session viewer for Claude Code and OpenAI Codex CLI. It reads local session logs, normalizes them into structured records, stores them in SQLite, and serves a searchable inbox, hierarchy explorer, analytics overview, and per-session replay from a FastAPI + React dashboard.
If you are looking for a Claude Code log viewer, Codex log viewer, or cc-log-viewer that keeps coding history on your own machine, AgentLens provides one interface for both agent formats.
It is not a remote-control platform, a hosted telemetry SaaS, or a generic OpenTelemetry backend. The product is a local forensic replay and analytics layer for agent history already on your machine.
Table of contents
- Highlights
- Screenshots
- How it works
- Requirements
- Install
- Run
- Configuration
- Project layout
- HTTP API
- Development
- Troubleshooting
- Contributing
- License
Highlights
- Hierarchy explorer. Browse Claude Code global settings, Codex global settings, projects, sessions, subagents, LLM activity, vision, and tasks. Recap text drives session labels so the most recent intent is visible.
- Session inspector with Recap card. Every session surfaces an
away_summaryrecap, prompt-thread list, tool calls, subagent activity, and provenance (project path + source JSONL). - Structured control-plane cards.
<task-notification>,<bash-stdout>,<bash-stderr>,<bash-input>,<bash-output>, and<bash-exit-code>wrappers are decoded into typed UI cards with explicit无输出/无错误输出/不完整badges. - Slash commands as first-class prompt threads.
/loop,/clear,/model,/compactand friends are preserved with theircommand-name/command-args/command-messagefields and rendered as standalone rows./loopdedupes across itsisMeta: trueskill expansion. - Lightweight hierarchy projection. Lazy
/api/v1/hierarchy+/api/v1/hierarchy/childrenkeep the inbox responsive on long sessions. - Project metadata panel. CLAUDE.md instructions,
MEMORY.mdindex, local.claude/settings.local.jsonpermissions, git worktrees, and counts of session/subagent/task artifacts. - Date-range filter on sessions, overview stats, and project rollups.
- Bilingual dashboard. Toggle English/中文 from the header. The language preference is persisted locally, including the custom date-range calendar.
- Codex support. Ingests Codex rollout JSONL from
~/.codex/sessions/and exposes~/.codex/AGENTS.md,config.toml, and installed skills in the hierarchy. - Local-first, no cloud dependency. SQLite at
~/.agentlens/agentlens.db; no third-party services required.
See FEATURES.md for the full list and CHANGELOG.md for release-by-release notes.
Screenshots
Session overview with the Recap card and provenance.

Hierarchy explorer with sessions bucketed under each project.

Per-session LLM prompt-thread list with control-plane cards.

Prompt-thread detail with tool calls and assistant turns.

LLM node with prompt-thread counts and assistant-turn summarization.

How it works
Claude Code + Codex session logs (JSONL)
│
▼
CollectorManager + platform collectors
│ historical backfill + watch mode
▼
SessionAggregator (collectors.py)
│ parse messages, attach tools, attach subagents,
│ collect vision references, capture recap, model commands
▼
SQLiteStorage (storage.py)
│ session projection + traces-compatible persistence
▼
FastAPI (api.py)
│ /sessions, /sessions/{id}, /stats, /hierarchy, /projects/by-path
▼
React dashboard (dashboard/)
│ inbox, hierarchy, inspector, control-plane cards
▼
You
The collectors are the canonical ingestion entrypoint. src/agentlens/api.py starts them on FastAPI startup. session_scanner.py is a thin CLI wrapper around the same pipeline for use as a standalone process.
Requirements
- Python ≥ 3.10
- Node.js ≥ 18 (for the dashboard)
- Claude Code logs under
~/.claude/projects/, Codex logs under~/.codex/sessions/, or both.
Optional:
xdg-open(Linux),open(macOS), orstartfile(Windows) for the "Open project" / "Open folder" actions.
Install
git clone https://github.com/QJ-Chen/agentlen.git
cd agentlen
# backend
pip install -e .
# frontend
cd dashboard
npm install
cd ..
On Windows, use PowerShell or CMD as needed. python or py -3 may be available instead of python3.
Run
Three processes make up the local dev workflow. They can each run in their own terminal.
# 1. backend (auto-backfills local Claude Code sessions on startup, then watches)
python3 -m src.agentlens.api
# 2. dashboard (Vite dev server with HMR)
cd dashboard
npm run dev
# prints a URL like http://localhost:5173
The backend listens on http://localhost:8080. The dashboard reads API_URL = 'http://localhost:8080' by default — see Configuration to point it elsewhere.
To run a dedicated local scanner (for example, on a machine that does not run the API):
python3 session_scanner.py --watch --interval 5
Sanity check
curl -s http://localhost:8080/api/v1/sessions | python3 -m json.tool | head
You should see sessions indexed from ~/.claude/projects/... and/or ~/.codex/sessions/....
Configuration
| Env var | Default | Purpose |
|---|---|---|
AGENTLENS_API_URL |
http://localhost:8080 |
Frontend API base URL. Edit dashboard/src/App.tsx API_URL if you change it for the dev server. |
AGENTLENS_DB_PATH |
~/.agentlens/agentlens.db |
SQLite database file. Set this if you want the DB to live outside your home directory. |
AGENTLENS_LOG_LEVEL |
INFO |
Standard Python logging level. |
The backend port (8080) is hardcoded in src/agentlens/api.py. Frontend dashboard/src/App.tsx mirrors it via API_URL. If you change one, change the other.
Project layout
agentlen/
├── src/agentlens/
│ ├── api.py # FastAPI backend
│ ├── storage.py # SQLite persistence + query helpers
│ ├── collectors.py # Claude Code + Codex ingestion pipelines
│ ├── realtime.py # background collector watch
│ └── ...
├── dashboard/
│ └── src/
│ ├── main.tsx # mounts App
│ ├── App.tsx # dashboard shell
│ ├── components/ # HierarchyTree, NodeDetailPane, EnhancedTraceDetail, ...
│ └── lib/ # sessionUtils, conversationModel, sessionNormalization, ...
├── session_scanner.py # CLI around CollectorManager
├── docs/
│ ├── architecture.md
│ ├── session-log-formats.md
│ └── PLATFORM_LOGS.md
├── tests/
└── pyproject.toml
HTTP API
Base URL: http://localhost:8080.
Sessions
GET /api/v1/sessions— list sessions, withstart_time,end_time,period_hours,limit,status, and free-text search parameters.GET /api/v1/sessions/{session_id}— full session record (prompt threads, tool calls, LLM calls, subagent logs, tasks, vision, recap).
Stats
GET /api/v1/stats/overview— totals, model mix, status counts, top tools, active days. Supportsstart_time,end_time,period_hours.GET /api/v1/stats/projects— project rollups. Same date-range parameters.
Hierarchy
GET /api/v1/hierarchy— lightweight root with grouped Claude Code global, Codex global, and project branches.GET /api/v1/hierarchy/children— children for a givennode_id. Opens a session / project lazily.
Project metadata
GET /api/v1/projects/by-path?project_path=...— CLAUDE.md instructions, memory index, local config, worktrees, session/task artifact counts.
Global configuration is exposed in the hierarchy under separate Claude Code global and Codex global branches. Claude Code reads ~/.claude/CLAUDE.md, ~/.claude/settings.json, and ~/.claude/skills/; Codex reads ~/.codex/AGENTS.md, ~/.codex/config.toml, and recursively discovers ~/.codex/skills/**/SKILL.md.
Ingestion
POST /api/v1/ingest/rescan— request a manual rescan.GET /api/v1/ingest/status— current job state and per-collector health.
Session actions
POST /api/v1/sessions/{session_id}/open?target=project|session_folder— open the project or session folder in the OS file manager.
Compatibility
POST /api/v1/tracesandPOST /api/v1/traces/batchremain available for Claude Code-shaped payloads. They are not the primary product path.
Full schema is best discovered via OpenAPI: GET /openapi.json.
Development
# backend
pytest
pytest tests/test_collectors.py::test_loop_command_threads_attach_through_meta_expansion
ruff check .
mypy
# frontend
cd dashboard
npm run lint
npm run build
npm run preview
Recommended workflow:
- Open a branch off
main. - Make the change.
- Run the targeted test (e.g.
pytest tests/test_collectors.py -k loop). - Run the full lint + test sweep before pushing.
- Reference the affected module in your commit body.
If you change backend models, verify both tests/test_api.py and tests/test_collectors.py still pass — the API uses a RangeCaptureStorage test double so date-range additions are usually covered with a small new test.
Troubleshooting
- "Path does not exist" from
/api/v1/sessions/{id}/open— the session'ssession_file_pathno longer points to a real file. Run a rescan (POST /api/v1/ingest/rescan) to repopulate provenance. - Inbox shows 0 sessions but
~/.claude/projects/has data — confirm the backend is on port 8080 and that the Vite dev serverAPI_URLmatches. Check~/.agentlens/agentlens.dbmtime. <task-notification>shows as不完整— the collector truncateslast_user_promptto 500 chars, so a long task notification may have its closing tag clipped. The parser tolerates this and marks the block as incomplete. This is by design.- Hierarchies are slow on huge sessions — confirm
SQLiteStorageis using the lightweight projection table. Re-run the migration by deleting~/.agentlens/agentlens.dband restarting the backend (it will re-ingest from local logs). - Watcher misses new sessions — confirm the backend is still running (
GET /api/v1/ingest/statusshould reportwatching: true). Restart if it died.
Contributing
Issues and pull requests are welcome. Useful entrypoints for newcomers:
src/agentlens/collectors.py— Claude Code log parsing.src/agentlens/storage.py— SQLite schema and query helpers.dashboard/src/lib/sessionUtils.ts— text and control-plane parsing for the UI.dashboard/src/components/EnhancedTraceDetail.tsx— session inspector.dashboard/src/components/HierarchyTree.tsx+NodeDetailPane.tsx— hierarchy surfaces.
When changing backend models, add or update the matching test in tests/. When changing the UI, add or update the dashboard/src/lib/conversationModel.ts snapshot tests if they apply to your change.
License
Yorumlar (0)
Yorum birakmak icin giris yap.
Yorum birakSonuc bulunamadi