diff --git a/.gitignore b/.gitignore index 16ef633..48f34d9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /target -examples* \ No newline at end of file +examples* +.DS_Store +.claude \ No newline at end of file diff --git a/README.md b/README.md index a494022..e655166 100644 --- a/README.md +++ b/README.md @@ -26,21 +26,7 @@ A terminal-native observability dashboard for AI coding agents. Real-time visibility into tool usage, token consumption, and productivity metrics. -``` -┌─ agenttop ────────────── Project: myapp Agent: Claude Code Active: 1h 47m ─┐ -│ Tokens In: 89K Out: 42K Cache: 25K (94% reuse) Session Total: 156K │ -├──────────────────────────────────────────────────────────────────────────────┤ -│ API: 47 calls │ 1.2s avg │ 2 errors │ -├──────────────────────────────────────────────────────────────────────────────┤ -│ TOOL CALLS ERR APR% AVG RANGE LAST FREQ │ -│ ▶ Read 89 0 100% 12ms 5ms-45ms 5s ██████████░░ │ -│ Bash 47 1 98% 234ms 50ms-2.1s 2s █████░░░░░░░ │ -│ Edit 34 2 94% 45ms 10ms-200ms 10s ████░░░░░░░░ │ -├──────────────────────────────────────────────────────────────────────────────┤ -│ MCP Tools │ -│ context7:* 15 1 93% 345ms 100ms-800ms 20s ██████████░░ │ -└───── [q]uit [s]ort [p]ause [d]etail [t]ime [r] project [a]gent ──────────────┘ -``` + ## Origin Story @@ -110,11 +96,13 @@ in all Claude Code versions. APR% may show as 100% when data is unavailable. - **Project Filtering** - Auto-detects project from file paths, filter with `[r]` - **Compaction Tracking** - Header shows compaction event count and last `pre→post` token delta (Claude Code 2026+) - **Token Tracking** - Input, output, and cache token metrics -- **Tool Table** - Real-time tool call metrics with: +- **Unified Tool Table** - Built-in and MCP tools in one sortable table with a `TYPE` column (`builtin` / `mcp`). MCP tools shown as `server:tool` (e.g. `context7:resolve-library-id`). Per-tool: - Call count and error count + - Approval rate (`APR%`) - Time since last call - Average duration and duration range - Relative frequency bar +- **Focus Switching** - `[Tab]` cycles focus between the Live sessions panel and the Tools table; `j/k`/arrows navigate whichever is focused - **API Metrics** - API calls, latency, active time - **Productivity Metrics** - Lines of code, commits - **Cache Reuse Rate** - Prompt caching efficiency @@ -190,8 +178,9 @@ That's it! agenttop automatically: | `t` | Cycle time filter | | `r` | Cycle project filter | | `a` | Cycle through detected agents | -| `↑`/`k` | Select previous | -| `↓`/`j` | Select next | +| `Tab` | Switch focus between Live sessions and Tools | +| `↑`/`k` | Select previous (in focused panel) | +| `↓`/`j` | Select next (in focused panel) | | `Esc` | Close detail view | ## Configuration @@ -314,8 +303,10 @@ Local FS / process tree │ Ratatui TUI └── sysinfo (CPU / MEM / load / RSS) ──►│ ``` -The scraper runs every refresh tick (~100 ms) but defers expensive ops like -port enumeration to a slow cycle (~5 s). +Refresh cadence is tiered to keep the UI responsive while avoiding I/O +storms: host vitals (CPU / MEM / load) sample every ~100 ms, heavier work +(process tree, transcript parsing, rate-limit sidecar, subagents) runs +once per second, and the slowest cycle (lsof for ports) is every ~10 s. ### Metrics Collected diff --git a/docs/preview.png b/docs/preview.png new file mode 100644 index 0000000..153cec2 Binary files /dev/null and b/docs/preview.png differ diff --git a/src/main.rs b/src/main.rs index 5caa11a..9f17ff6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,7 +15,11 @@ use crate::providers::PROVIDER_REGISTRY; use crate::storage::StorageHandle; #[derive(Parser)] -#[command(name = "agenttop", about = "htop for AI coding agents")] +#[command( + name = "agenttop", + about = "htop for AI coding agents", + version +)] struct Args { /// Run in headless mode (no TUI, OTLP receiver only) #[arg(short = 'H', long)]