Monitor AI agent sessions by intercepting API calls through a local proxy.
Logs all requests and responses to JSONL files and serves a real-time web dashboard.
Works with Claude Code and OpenAI Codex out of the box.
npm install -g liaoran-cliRequires Node.js >= 18. Zero runtime dependencies.
liaoran-cli launch <agent> [-- <agent-args>]Launch an AI agent with monitoring enabled. The CLI starts a local proxy, spawns the agent with the proxy URL injected via environment variable, and logs all traffic.
# Monitor a Claude Code session
liaoran-cli launch claude
# Monitor Codex
liaoran-cli launch codex
# Pass arguments to the agent
liaoran-cli launch codex -- -m o3When you run liaoran-cli launch, it prints:
[liaoran] Proxy started on http://127.0.0.1:9123 → https://api.anthropic.com
[liaoran] ANTHROPIC_BASE_URL=http://127.0.0.1:9123
[liaoran] Logging to /Users/you/.liaoran/sessions/2026-03-29-14-23-45-claude.jsonl
[liaoran] Dashboard: http://127.0.0.1:9124
[liaoran] Launching claude...
Open the dashboard URL in a browser to see requests and responses in real time.
| Agent | Binary | Env Var | Aliases |
|---|---|---|---|
| Claude Code | claude |
ANTHROPIC_BASE_URL |
claude-code |
| Codex | codex |
OPENAI_BASE_URL |
— |
Agent lookup is case-insensitive. The agent binary must be installed and in your PATH.
Proxy — Transparent HTTP proxy that forwards all traffic to the upstream API. Handles streaming (SSE), WebSocket, gzip/brotli/zstd compression, and CONNECT tunneling.
Logging — Every request/response pair is logged to ~/.liaoran/sessions/ as JSONL. Sensitive headers (authorization, x-api-key) are automatically redacted.
Dashboard — Real-time web UI with master-detail layout. Shows parsed prompt messages, tool calls, function arguments, token usage, and response content. Agent-specific adapters (Anthropic, OpenAI) extract structured data from raw API traffic.
Process management — Inherits agent stdio so you interact with the agent normally. Forwards SIGINT/SIGTERM for clean shutdown.
npm run build # Compile TypeScript + bundle dashboard
npm run dev # Watch mode (TypeScript only)
npm test # Run tests (build first)MIT