Skip to content

Commit 3aade6e

Browse files
author
Armani Cunningham
committed
ci: pin goreleaser v2 in release workflow
1 parent 0236b00 commit 3aade6e

4 files changed

Lines changed: 173 additions & 176 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
uses: goreleaser/goreleaser-action@v5
2727
with:
2828
distribution: goreleaser
29-
version: latest
29+
version: "~> v2"
3030
args: release --clean
3131
env:
3232
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 76 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
# agent-htop
22

3-
`htop` for AI agent fleets. A live terminal dashboard that shows every running Paperclip agent with token burn, cost, current tool, elapsed time, and a kill key.
3+
Live terminal dashboard for your AI coding sessions. Works with Claude Code today.
44

55
```
6-
agent-htop v0.1.0 agents: 5 running: 3 cost today: $0.42 [q]uit [K]ill
7-
8-
NAME STATUS MODEL TOKENS IN TOKENS OUT COST ELAPSED LAST TOOL
9-
──────────────────────────────────────────────────────────────────────────────────────────────
10-
BackendEngineer running haiku-4-5 142,310 8,421 $0.0234 12m 34s Bash
11-
TUIEngineer running haiku-4-5 98,002 6,103 $0.0171 8m 12s Write
12-
QALaunch running gemini-flash 43,118 2,940 $0.0000 3m 07s Read
13-
Researcher idle gemini-flash 89,442 5,217 $0.0000 - -
14-
CEO idle sonnet-4-6 21,003 1,882 $0.0412 - -
6+
agent-htop v0.2.0 sessions: 3 running: 2 cost today: $0.42 [q]uit
7+
8+
NAME STATUS MODEL TOKENS IN TOKENS OUT COST ELAPSED LAST TOOL
9+
────────────────────────────────────────────────────────────────────────────────────────────────────────
10+
-home-armani-projects-fnaf running claude-sonnet 142,310 8,421 $0.0234 12m 34s Bash
11+
-home-armani-projects-api running claude-haiku 98,002 6,103 $0.0171 8m 12s Write
12+
-home-armani-projects-web idle claude-haiku 43,118 2,940 $0.0041 3m 07s Read
1513
```
1614

1715
## Install
@@ -20,154 +18,110 @@ agent-htop v0.1.0 agents: 5 running: 3 cost today: $0.42 [q]uit [K]ill
2018
go install github.com/acunningham-ship-it/agent-htop/cmd/agent-htop@latest
2119
```
2220

23-
Requires Go 1.21+.
24-
25-
## Usage
21+
Or via Homebrew:
2622

2723
```bash
28-
# Required: specify company ID
29-
agent-htop --company 920a3930-f429-45cd-8fb8-774fa81cbd96
30-
31-
# With options
32-
agent-htop --company 920a3930-f429-45cd-8fb8-774fa81cbd96 \
33-
--api-url http://localhost:3101 \
34-
--runtime all \
35-
--refresh-ms 2000 \
36-
-v # verbose logging
24+
brew install acunningham-ship-it/tap/agent-htop
3725
```
3826

39-
The binary auto-discovers your Paperclip log directory at `~/.paperclip/instances/default/data/run-logs/` and polls by default every 2 seconds.
40-
41-
### Flags
42-
43-
| Flag | Default | Description |
44-
|------|---------|-------------|
45-
| `--company` | *required* | Company ID from Paperclip |
46-
| `--api-url` | `http://localhost:3101` | Paperclip API URL |
47-
| `--runtime` | `all` | Runtime types to monitor (comma-separated): `paperclip`, `claude`, `codex`, `all` (default) |
48-
| `--refresh-ms` | `2000` | Polling interval in milliseconds |
49-
| `--alert-level` | `info` | Minimum alert level for Discord: `info`, `warn`, `critical` |
50-
| `--config` | *optional* | Config file path |
51-
| `-v, --verbose` | `false` | Enable debug logging to stderr |
52-
| `--version` | - | Show version and exit |
53-
| `--help` | - | Show help and exit |
54-
55-
### Discord Webhook Alerts
56-
57-
agent-htop can post anomaly alerts to Discord when agents exhibit concerning behavior (high spend, error streaks, cost anomalies). This keeps you informed even when the terminal isn't open.
58-
59-
#### Setup
60-
61-
1. Create a Discord webhook in your server:
62-
- Right-click the channel → Edit Channel → Integrations → Webhooks → New Webhook
63-
- Copy the webhook URL
64-
65-
2. Set the environment variable and run agent-htop:
66-
```bash
67-
export AGENT_HTOP_DISCORD_WEBHOOK="https://discord.com/api/webhooks/YOUR_WEBHOOK_ID/YOUR_WEBHOOK_TOKEN"
68-
agent-htop --company 920a3930-f429-45cd-8fb8-774fa81cbd96 --alert-level warn
69-
```
70-
71-
#### Alert Types
72-
73-
| Anomaly | Emoji | Severity | Trigger |
74-
|---------|-------|----------|---------|
75-
| **High Spend** | 💸 | warning | Agent spending >$0.50/hr sustained over 15 min |
76-
| **Error Streak** | ⚠️ | critical | ≥3 failed runs in 10 min window |
77-
| **Cost Anomaly** | 🚨 | critical | Today's spend >5× the 7-day rolling average |
78-
79-
#### Alert Levels
27+
Requires Go 1.21+.
8028

81-
- `info` — All alerts (default)
82-
- `warn` — Warnings and critical only (excludes info-level alerts)
83-
- `critical` — Critical alerts only
29+
## Quick start
8430

85-
Rate limiting: **max 1 alert per agent per 10 minutes** to prevent Discord spam.
31+
```bash
32+
# Run — auto-discovers your Claude Code sessions
33+
agent-htop
34+
```
8635

87-
#### Example Discord Message
36+
That's it. agent-htop finds your `~/.claude/projects/**/*.jsonl` sessions automatically.
8837

89-
```
90-
💸 BackendEngineer
91-
High spend detected: $0.75/hr (threshold: $0.50/hr)
38+
## Supported runtimes
9239

93-
Type: HIGH_SPEND
94-
Severity: warning
95-
Detected: 2026-04-19T21:30:45Z
96-
```
40+
| Runtime | Auto-discovered | Kill support | Cost tracking |
41+
|---------|----------------|--------------|---------------|
42+
| Claude Code | `~/.claude/projects/**/*.jsonl` | No (read-only) | Yes |
43+
| Codex | `~/.codex/` | No | Planned |
44+
| Paperclip | `--company <id>` | Yes | Yes |
9745

9846
## Keybindings
9947

10048
| Key | Action |
10149
|-----|--------|
10250
| `` / `k` | Navigate up |
10351
| `` / `j` | Navigate down |
104-
| `/` | Search / filter agents |
105-
| `f` | Cycle filter (all → error → running → idle → paused) |
52+
| `/` | Search / filter sessions |
53+
| `f` | Cycle filter (all → error → running → idle) |
10654
| `s` | Cycle sort (name → cost → heartbeat → spend rate) |
107-
| `K` | Kill selected agent (with confirm: press `Y` to confirm) |
108-
| `P` | Pause selected agent |
109-
| `R` | Resume selected agent |
55+
| `K` | Kill selected agent (Paperclip only — confirm with `Y`) |
56+
| `P` | Pause selected agent (Paperclip only) |
57+
| `R` | Resume selected agent (Paperclip only) |
11058
| `r` | Force refresh |
11159
| `q` / `Ctrl+C` | Quit |
11260

113-
## Supported runtimes
61+
Kill/pause/resume only work for Paperclip agents. Claude Code sessions are read-only.
11462

115-
agent-htop works with multiple execution environments. Use the `--runtime` flag to select which logs to monitor:
63+
## Advanced: Paperclip fleet monitoring
64+
65+
If you run a [Paperclip](https://paperclipai.com) agent fleet, pass your company ID to see all agents alongside your Claude Code sessions:
66+
67+
```bash
68+
agent-htop --company 920a3930-f429-45cd-8fb8-774fa81cbd96
69+
```
11670

117-
| Runtime | Log path | Status | Details |
118-
|---------|----------|--------|---------|
119-
| **Paperclip** | `~/.paperclip/instances/default/data/run-logs/<co>/<agent>/` | ✅ Fully supported | NDJSON format with full metrics (tokens, cost, tool calls) |
120-
| **Claude Code** | `~/.claude/projects/*/` | ✅ Fully supported | JSONL format with session metadata and token usage |
121-
| **Codex** | TBD | 🔬 Research phase | Format under investigation; stub parser in place for future implementation |
71+
With Paperclip you also get kill/pause control (`K` / `P` / `R` keys) and agent-level cost tracking.
12272

123-
### Using with Claude Code (not Paperclip)
73+
### Discord webhook alerts
12474

125-
If you use Claude Code standalone (without Paperclip), you can still monitor your agent runs. Claude Code logs are stored in `~/.claude/projects/*/` and include session metadata, token usage, and execution details.
75+
Post anomaly alerts to Discord when agents exhibit high spend, error streaks, or cost spikes:
12676

12777
```bash
128-
# Monitor Claude Code sessions only
129-
agent-htop --company 920a3930-f429-45cd-8fb8-774fa81cbd96 --runtime claude
78+
export AGENT_HTOP_DISCORD_WEBHOOK="https://discord.com/api/webhooks/YOUR_ID/YOUR_TOKEN"
79+
agent-htop --alert-level warn
80+
```
13081

131-
# Monitor both Paperclip and Claude Code (default)
132-
agent-htop --company 920a3930-f429-45cd-8fb8-774fa81cbd96 --runtime all
82+
| Anomaly | Severity | Trigger |
83+
|---------|----------|---------|
84+
| High Spend | warning | >$0.50/hr sustained over 15 min |
85+
| Error Streak | critical | ≥3 failed runs in 10 min window |
86+
| Cost Anomaly | critical | Today's spend >5× 7-day rolling average |
13387

134-
# Monitor specific runtimes (comma-separated)
135-
agent-htop --company 920a3930-f429-45cd-8fb8-774fa81cbd96 --runtime paperclip,claude
136-
```
88+
Rate-limited to max 1 alert per agent per 10 minutes.
89+
90+
## Flags
13791

138-
**How Claude Code Logs Work**
139-
- Logs are stored in `~/.claude/projects/<project-name>/*.jsonl`
140-
- Each `.jsonl` file is a Claude Code session
141-
- agent-htop discovers and parses these automatically
142-
- Project paths are used as agent identifiers for display
143-
- Claude Code logs don't have a company context, so all sessions are visible regardless of the `--company` flag
144-
- Use `--runtime=paperclip` if you want only Paperclip logs for a specific company
92+
| Flag | Default | Description |
93+
|------|---------|-------------|
94+
| `--company` | *optional* | Paperclip company ID (enables Paperclip agents + kill/pause) |
95+
| `--runtime` | `auto` | `auto`, `claude`, `codex`, `paperclip`, or `all` |
96+
| `--api-url` | `http://localhost:3101` | Paperclip API URL |
97+
| `--refresh-ms` | `2000` | Polling interval in milliseconds |
98+
| `--alert-level` | `info` | Discord alert threshold: `info`, `warn`, `critical` |
99+
| `--config` | *optional* | Config file path |
100+
| `-v, --verbose` | `false` | Debug logging to stderr |
101+
| `--version` || Show version and exit |
145102

146-
**Mapping Project Paths to Agent Names**
147-
- agent-htop tries to resolve Paperclip agent names via the API
148-
- If a Claude project name doesn't match a Paperclip agent, the project path is used as the agent ID
149-
- Example: `~/.claude/projects/-home-armani-projects-agent-htop/` → agent ID: `-home-armani-projects-agent-htop`
103+
### Config file
150104

151-
### Codex Support (Research Phase)
105+
Auto-created at `~/.config/agent-htop/config.toml` on first run:
152106

153-
Codex support is currently in research phase. A stub parser is in place to document the expected format and provide guidance for future implementation.
107+
```toml
108+
[defaults]
109+
refresh_ms = 2000
110+
runtime = "auto"
154111

155-
```bash
156-
# Codex is not yet available
157-
agent-htop --company 920a3930-f429-45cd-8fb8-774fa81cbd96 --runtime codex
158-
# Error: Codex parser not yet implemented
112+
[alerts]
113+
spend_threshold = 0.50
114+
error_streak = 3
159115
```
160116

161-
**What We Need to Know**
162-
- Where Codex stores execution logs (directory path, file naming)
163-
- Log format (JSONL, JSON, plain text, or other)
164-
- Available fields (token usage, model name, execution time, status, etc.)
165-
- How to map Codex runs to agent identities
117+
### Environment variables
166118

167-
Once Codex documentation is available, the parser will:
168-
1. Follow the same pattern as Paperclip and Claude Code parsers
169-
2. Normalize logs into the unified `AgentRun` struct
170-
3. Integrate seamlessly with the fleet dashboard
119+
```bash
120+
AGENT_HTOP_API_URL # Paperclip API URL
121+
AGENT_HTOP_REFRESH_MS # Refresh rate in ms
122+
AGENT_HTOP_DISCORD_WEBHOOK # Discord webhook URL
123+
AGENT_HTOP_RUNTIMES # Comma-separated: claude,paperclip,codex
124+
```
171125

172126
## Build from source
173127

@@ -177,13 +131,3 @@ cd agent-htop
177131
make build
178132
./agent-htop --version
179133
```
180-
181-
The `Makefile` embeds version info via ldflags:
182-
183-
```bash
184-
make build # Build with version injection
185-
make test # Run tests
186-
make clean # Clean artifacts
187-
```
188-
189-
Version is injected as: `-X main.Version=v0.1.0 -X main.GitSHA=<commit>`

docs/show-hn.md

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,53 @@
1-
# Show HN: agent-htop — Live Terminal Dashboard for AI Agent Fleets
1+
# Show HN: agent-htop — live terminal dashboard for Claude Code sessions
22

3-
## The Problem
3+
I was running several Claude Code agents overnight on a side project. Woke up to a larger bill than expected and no quick way to see which session caused it. The logs are buried in `~/.claude/projects/`, costs are scattered across JSON, and there's no live view.
44

5-
I was running 20+ Claude Code agents overnight for a side project. Woke up the next morning to a $40 API bill and no idea which agent caused it. The logs are buried in directories, cost is scattered across JSON, and there's no way to immediately kill a runaway agent without SSH'ing and hunting through processes.
6-
7-
## The Solution
8-
9-
**agent-htop** is `htop` for your AI agent fleet. A single Go binary that gives you real-time visibility and instant control:
5+
So I built agent-htop.
106

117
```
12-
agent-htop v0.1.0 agents: 5 running: 3 cost today: $0.42 [q]uit [K]ill
13-
14-
NAME STATUS MODEL TOKENS IN TOKENS OUT COST ELAPSED LAST TOOL
15-
──────────────────────────────────────────────────────────────────────────────────────────────
16-
BackendEngineer running haiku-4-5 142,310 8,421 $0.0234 12m 34s Bash
17-
TUIEngineer running haiku-4-5 98,002 6,103 $0.0171 8m 12s Write
18-
QALaunch running gemini-flash 43,118 2,940 $0.0000 3m 07s Read
19-
Researcher idle gemini-flash 89,442 5,217 $0.0000 - -
20-
CEO idle sonnet-4-6 21,003 1,882 $0.0412 - -
8+
agent-htop v0.2.0 sessions: 3 running: 2 cost today: $0.42 [q]uit
9+
10+
NAME STATUS MODEL TOKENS IN TOKENS OUT COST ELAPSED LAST TOOL
11+
────────────────────────────────────────────────────────────────────────────────────────────────────────
12+
-home-armani-projects-fnaf running claude-sonnet 142,310 8,421 $0.0234 12m 34s Bash
13+
-home-armani-projects-api running claude-haiku 98,002 6,103 $0.0171 8m 12s Write
14+
-home-armani-projects-web idle claude-haiku 43,118 2,940 $0.0041 3m 07s Read
2115
```
2216

23-
**Features:**
24-
- **Real-time cost tracking** per agent (see exactly what's burning money)
25-
- **Instant kill** — press `K` on a runaway agent and it's gone
26-
- **One-liner install:** `go install github.com/acunningham-ship-it/agent-htop/cmd/agent-htop@latest`
27-
- **Works with Claude Code, Codex, Paperclip** — and single-binary deployment (11MB)
17+
It's a single Go binary that auto-discovers your Claude Code sessions from `~/.claude/projects/**/*.jsonl` and shows them in a live-updating table. Cost and token counts update in real time as the sessions run.
2818

29-
## How It Works
19+
**Install:**
3020

31-
1. `agent-htop --company <id>` — connects to your local Paperclip instance
32-
2. Live-streams agent status, tokens, cost, and elapsed time
33-
3. Keyboard control: arrows/vim keys to navigate, `K` to kill, `q` to quit
21+
```bash
22+
go install github.com/acunningham-ship-it/agent-htop/cmd/agent-htop@latest
23+
# or
24+
brew install acunningham-ship-it/tap/agent-htop
25+
```
26+
27+
**Run:**
3428

35-
The binary watches your Paperclip logs in real-time. No API calls needed once it starts (graceful fallback if offline).
29+
```bash
30+
agent-htop # no flags needed, finds Claude Code sessions automatically
31+
```
3632

37-
## Why This Matters
33+
**What it tracks:**
34+
- Tokens in / out per session
35+
- Cost in real-time (uses Anthropic's pricing table)
36+
- Elapsed time and last tool call
37+
- Anomaly flags for runaway spend or error streaks
38+
- Optional Discord webhook for alerts when you're not watching
3839

39-
AI agents are now as much of an operational liability as they are a feature. If you're running more than one agent in production—especially with Claude—you need visibility into what they're doing and how fast they're burning tokens.
40+
**Paperclip support (additive):** If you run a Paperclip agent fleet, pass `--company <id>` and your Paperclip agents appear in the same table with kill/pause control (`K` / `P` keys). Otherwise it's purely local file-watching — no API required.
4041

41-
This fills that gap.
42+
Built it as a single Go binary using bubbletea for the TUI. Works on Linux and macOS. The binary is ~11MB.
4243

43-
## Links
44+
**Links:**
45+
- GitHub: https://github.com/acunningham-ship-it/agent-htop
46+
- Homebrew: `brew install acunningham-ship-it/tap/agent-htop`
4447

45-
- **GitHub:** https://github.com/acunningham-ship-it/agent-htop
46-
- **Install:** `go install github.com/acunningham-ship-it/agent-htop/cmd/agent-htop@latest`
47-
- **Homebrew (coming soon):** Will be available at acunningham-ship-it/homebrew-tap
48+
I'm 17 and this is a tool I actually use daily. Happy to answer questions or take feedback.
4849

4950
---
5051

51-
Built in 4 weeks as a single Go binary. I'm 17 and building the tools I actually use.
52+
**Cross-post targets:** r/golang, r/commandline, r/ClaudeAI
53+
**Best timing:** Tuesday 8–10am US-East

0 commit comments

Comments
 (0)