@sejuneoh/aitop 0.33.2 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +488 -85
- package/bin/aitop.mjs +31 -1
- package/package.json +1 -1
- package/src/attention.mjs +10 -7
- package/src/i18n.mjs +91 -7
- package/src/line.mjs +15 -7
- package/src/pricing.mjs +40 -7
- package/src/report.mjs +16 -4
- package/src/sources/claude.mjs +58 -25
- package/src/text.mjs +29 -0
- package/src/trace.mjs +659 -0
- package/src/ui/chrome.mjs +47 -12
- package/src/ui/draw.mjs +9 -7
- package/src/ui/glyphs.mjs +38 -6
- package/src/ui/table.mjs +40 -14
- package/src/ui/theme.mjs +1 -1
package/README.md
CHANGED
|
@@ -5,143 +5,546 @@
|
|
|
5
5
|
|
|
6
6
|
**`top` for your AI coding agents.** One live terminal screen for every Claude Code, Codex CLI and Antigravity CLI session on your machine. No hooks, read-only.
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
npm i -g @sejuneoh/aitop
|
|
11
|
-
|
|
8
|
+
> `npx @sejuneoh/aitop`
|
|
9
|
+
>
|
|
10
|
+
> `npm i -g @sejuneoh/aitop`
|
|
11
|
+
|
|
12
|
+
- The first line tries it with no install.
|
|
13
|
+
- The second installs it. Then just run `aitop`.
|
|
12
14
|
|
|
13
15
|

|
|
14
16
|
|
|
15
|
-
- **See who needs you.**
|
|
16
|
-
-
|
|
17
|
-
-
|
|
17
|
+
- **See who needs you.**
|
|
18
|
+
- A waiting session jumps to the top and `n` takes you there.
|
|
19
|
+
- Add `--notify=waiting,done,context` for desktop alerts, or `aitop --line` for a tmux status line.
|
|
20
|
+
- **Know which session is which.**
|
|
21
|
+
- Every row shows the session name (your `/rename` or the tool's title).
|
|
22
|
+
- `y` copies a resume command, and `--report sessions` prints yesterday's sessions with cost for your standup.
|
|
23
|
+
- **No hooks, nothing sent.**
|
|
24
|
+
- Claude Code, Codex CLI and Antigravity CLI side by side, from [several history folders](#several-claude-or-codex-profiles) (`~/.claude`, `~/.claude-work`, ...).
|
|
25
|
+
- aitop only reads the logs they already write. It changes no settings and needs no network, ports or dependencies.
|
|
18
26
|
|
|
19
|
-
**
|
|
27
|
+
**Contents**
|
|
20
28
|
|
|
21
|
-
- [
|
|
22
|
-
- [
|
|
23
|
-
- [
|
|
24
|
-
- [
|
|
29
|
+
- [Quick start](#quick-start)
|
|
30
|
+
- [Features](#features)
|
|
31
|
+
- [Subagents](#subagents) · [Daily and monthly reports](#daily-and-monthly-reports) · [Session report](#session-report) · [Call tree](#call-tree)
|
|
32
|
+
- [Notifications](#notifications) · [tmux status line](#tmux-status-line) · [Several Claude or Codex profiles](#several-claude-or-codex-profiles)
|
|
33
|
+
- [Resume a session elsewhere](#resume-a-session-elsewhere) · [JSON output](#json-output) · [Language](#language)
|
|
34
|
+
- [How it differs from similar tools](#how-it-differs-from-similar-tools) · [Install](#install) · [License](#license)
|
|
25
35
|
|
|
26
|
-
##
|
|
36
|
+
## Quick start
|
|
27
37
|
|
|
28
|
-
|
|
38
|
+
> `aitop`
|
|
29
39
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
- Live screen.
|
|
41
|
+
|
|
42
|
+
> `aitop --all`
|
|
43
|
+
|
|
44
|
+
- Include sessions that ended in the last 24 hours.
|
|
45
|
+
|
|
46
|
+
> `aitop --once`
|
|
47
|
+
|
|
48
|
+
- Print the current state once and exit.
|
|
49
|
+
|
|
50
|
+
> `aitop --json`
|
|
51
|
+
|
|
52
|
+
- Print a snapshot as JSON and exit. See [JSON output](#json-output).
|
|
53
|
+
|
|
54
|
+
> `aitop --doctor`
|
|
55
|
+
|
|
56
|
+
- Check which tools and logs aitop can see.
|
|
57
|
+
|
|
58
|
+
> `aitop --line`
|
|
35
59
|
|
|
36
|
-
|
|
60
|
+
- Print one short status line and exit (for tmux, e.g. `$54.13 wait 2 fix-login 3m run 3 $3.1/h`). See [tmux status line](#tmux-status-line).
|
|
61
|
+
|
|
62
|
+
> `aitop --report sessions`
|
|
63
|
+
|
|
64
|
+
- Yesterday's sessions with cost, for standups (`--md`, `--json`). See [Session report](#session-report).
|
|
65
|
+
|
|
66
|
+
> `aitop --help`
|
|
67
|
+
|
|
68
|
+
- All options.
|
|
69
|
+
|
|
70
|
+
**Keys on the live screen**
|
|
71
|
+
|
|
72
|
+
- `↑↓` select · `n` next session to check · `/` search · `s` sort · `g` group
|
|
73
|
+
- `p` pin · `f` changed files · `?` help · `q` quit
|
|
74
|
+
|
|
75
|
+
**Config file**
|
|
76
|
+
|
|
77
|
+
- Settings can also go in `~/.config/aitop/config.json` (`%APPDATA%\aitop\config.json` on Windows).
|
|
78
|
+
- See `aitop --help` or the [detailed manual (Korean)](https://github.com/SejuneOh/aitop/blob/main/docs/README.ko.md).
|
|
37
79
|
|
|
38
80
|
## Features
|
|
39
81
|
|
|
40
|
-
- **Live status** of every session and its subagents: thinking, running a tool, waiting for you, idle, or stopped by an error
|
|
41
|
-
-
|
|
42
|
-
- **
|
|
43
|
-
- **
|
|
44
|
-
- **
|
|
45
|
-
- **
|
|
46
|
-
- **
|
|
82
|
+
- **Live status** of every session and its subagents: thinking, running a tool, waiting for you, idle, or stopped by an error.
|
|
83
|
+
- Subagent rows show how long they have run ([details](#subagents)).
|
|
84
|
+
- **Stopped by an error**: `! Login needed`, `! Connection lost`, read from the API error lines Claude Code already logs.
|
|
85
|
+
- **Prompt cache countdown** for Claude sessions waiting on you or idle: `cache 3:12` after the status text.
|
|
86
|
+
- **Tool run time** while a session runs a tool: `Tool · Bash · 4m12s`.
|
|
87
|
+
- **Waiting alerts**: blocked sessions jump to the top, with optional bell, desktop notification or hook command.
|
|
88
|
+
- **Tokens and cost** per session and for today / last 7 days, estimated at public API list prices. This is not your bill.
|
|
89
|
+
- **Changed files and diffs** per session and per prompt.
|
|
90
|
+
- **Read-only**: no network, no ports, no dependencies. It only reads the session logs each CLI already writes.
|
|
47
91
|
|
|
48
|
-
>
|
|
92
|
+
<details>
|
|
93
|
+
<summary>Details: stopped sessions, cache countdown, tool run time</summary>
|
|
49
94
|
|
|
50
|
-
|
|
95
|
+
**Stopped by an error**
|
|
51
96
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
aitop --json print a snapshot as JSON and exit
|
|
56
|
-
aitop --doctor check which tools and logs aitop can see
|
|
57
|
-
aitop --line print one short status line and exit (for tmux, e.g. $54.13 wait 2 fix-login 3m run 3 $3.1/h)
|
|
58
|
-
aitop --report daily daily cost table and exit
|
|
59
|
-
aitop --report monthly monthly cost table (last 12 months) and exit
|
|
60
|
-
aitop --report sessions yesterday's sessions with cost, for standups (--md, --json)
|
|
61
|
-
aitop --help all options
|
|
62
|
-
aitop --lang ko Korean screen, help, doctor and error messages (also AITOP_LANG=ko or "lang": "ko" in the config file)
|
|
63
|
-
```
|
|
97
|
+
- It sorts right under waiting and pinned sessions.
|
|
98
|
+
- It is counted on its own as `! 1 stopped` in the header, the window title (`(2◆ 1! 1●)`), `n` and `--line`.
|
|
99
|
+
- It never counts as done.
|
|
64
100
|
|
|
65
|
-
|
|
101
|
+
**Prompt cache countdown**
|
|
66
102
|
|
|
67
|
-
|
|
103
|
+
- Warning color under a minute, dim `cache expired` after.
|
|
104
|
+
- Estimated from the log's `cache_creation` 5m/1h tokens and the last request start, per the [prompt caching docs](https://platform.claude.com/docs/en/build-with-claude/prompt-caching).
|
|
105
|
+
- Dropped first on narrow screens, except under a minute, when the status text is shortened instead.
|
|
106
|
+
- `--json` has `cacheExpiresAt`.
|
|
68
107
|
|
|
69
|
-
|
|
108
|
+
**Tool run time**
|
|
70
109
|
|
|
71
|
-
|
|
110
|
+
- Measured from the open tool call's start (Claude `tool_use`, Codex `function_call`, Antigravity running step).
|
|
111
|
+
- Shown after one minute, in a dim warning color from ten minutes (Claude Code's Bash timeout max).
|
|
112
|
+
- Not counted while waiting for approval.
|
|
113
|
+
- Dropped first on narrow screens; `--json` has `toolStartedAt`.
|
|
72
114
|
|
|
73
|
-
|
|
115
|
+
</details>
|
|
74
116
|
|
|
75
|
-
|
|
117
|
+
## Subagents
|
|
76
118
|
|
|
77
|
-
|
|
119
|
+
Subagents show as `├─` rows under their session, on the live screen.
|
|
78
120
|
|
|
79
|
-
|
|
121
|
+
> `aitop`
|
|
80
122
|
|
|
81
|
-
|
|
123
|
+
- While one works, its row shows how long it has run, marked with `◷` so it is not read as IDLE (`◷42s`, `◷3m12s`, `◷1h05m`; `~3m12s` with `AITOP_AMBIGUOUS=wide`).
|
|
124
|
+
- A dim `stalled?` appears when a working subagent's log has not changed for 3 minutes. It is only a guess.
|
|
125
|
+
- While it runs a tool that can be slow, the limit is 10 minutes.
|
|
126
|
+
- When an Antigravity subagent waits for your approval, its parent row waits too, as `<agent>: <tool>`.
|
|
82
127
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
aitop --report daily --by project --days 7
|
|
86
|
-
```
|
|
128
|
+
<details>
|
|
129
|
+
<summary>Details: <code>stalled?</code> and Antigravity waits</summary>
|
|
87
130
|
|
|
88
|
-
|
|
131
|
+
**`stalled?`**
|
|
89
132
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
133
|
+
- Slow tools: Bash, PowerShell, a nested agent, web fetch or search, an MCP tool, agy `run_command`.
|
|
134
|
+
- It never shows while the session waits for you.
|
|
135
|
+
- It does not change sorting, alerts, the window title or `--line`.
|
|
136
|
+
- `--json` has it per member as `stalled`, with `startedAt` and `lastActivityAt`.
|
|
93
137
|
|
|
94
|
-
|
|
138
|
+
**Antigravity subagent waits**
|
|
95
139
|
|
|
96
|
-
|
|
140
|
+
- The session jumps to the top and counts for `n`, `--notify` and `--line`.
|
|
141
|
+
- If the parent waits itself, its own wait shows first.
|
|
142
|
+
- Other waiting subagents show on their own rows.
|
|
97
143
|
|
|
98
|
-
|
|
144
|
+
</details>
|
|
99
145
|
|
|
100
|
-
|
|
146
|
+
## Daily and monthly reports
|
|
101
147
|
|
|
102
|
-
|
|
103
|
-
aitop --report sessions --md --plan 200
|
|
104
|
-
aitop --report sessions --since 7d --json
|
|
105
|
-
```
|
|
148
|
+
Tokens and cost (API list price, like the header) per day or per month, newest first, with a total row, then exit.
|
|
106
149
|
|
|
107
|
-
|
|
150
|
+
> `aitop --report daily`
|
|
151
|
+
>
|
|
152
|
+
> `aitop --report daily --by model --days 14`
|
|
153
|
+
>
|
|
154
|
+
> `aitop --report daily --by project --days 7`
|
|
155
|
+
>
|
|
156
|
+
> `aitop --report monthly --by model --months 6`
|
|
108
157
|
|
|
109
|
-
|
|
158
|
+
- `aitop --report daily`: daily cost table and exit.
|
|
159
|
+
- `aitop --report monthly [--by tool|model|project] [--months N] [--json]`: monthly cost table (last 12 months) and exit, for up to 12 months.
|
|
160
|
+
- `--by`: columns per tool by default, per model with `--by model`, or per project with `--by project`.
|
|
161
|
+
- `--days N`: goes back up to 30 days.
|
|
162
|
+
- `--json`: the same numbers for scripts.
|
|
110
163
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
164
|
+
<details>
|
|
165
|
+
<summary>Details: projects, first run, monthly archive</summary>
|
|
166
|
+
|
|
167
|
+
**Project columns**
|
|
168
|
+
|
|
169
|
+
- A project is the last folder name of the working directory: Claude log `cwd`, Codex `turn_context.cwd`, agy workspace.
|
|
170
|
+
- Claude Code worktrees under `<repo>/.claude/worktrees/` count as the repo.
|
|
171
|
+
- `(unknown)` when missing.
|
|
172
|
+
- Extra columns beyond the terminal width are merged into `(others)`; `--json` lists all with a `paths` map.
|
|
173
|
+
|
|
174
|
+
**First run**
|
|
175
|
+
|
|
176
|
+
- The first daily run reads up to 30 days of logs, so it can take a while (progress shows on stderr).
|
|
177
|
+
- Later runs use the cache.
|
|
178
|
+
|
|
179
|
+
**Monthly archive**
|
|
180
|
+
|
|
181
|
+
- Past days are folded into `monthly.json` in the cache folder (`~/.cache/aitop`, outside the versioned cache) about two days later.
|
|
182
|
+
- So monthly totals survive cache rebuilds and Claude Code deleting old transcripts.
|
|
183
|
+
- The first monthly run reads up to a year of remaining logs once.
|
|
184
|
+
- `*` marks this month.
|
|
185
|
+
- `~` marks a month only partly counted (for example before the oldest remaining Claude log).
|
|
186
|
+
- `no data` marks a month with neither logs nor archive (unknown, not zero).
|
|
187
|
+
- The archive keeps token counts per type, so costs are recomputed when the price table changes.
|
|
188
|
+
- In `--json`, rows have `month`, `current` and `status` (`complete`, `partial` or `missing`).
|
|
189
|
+
- With several history folders, see the monthly rule in [Several Claude or Codex profiles](#several-claude-or-codex-profiles).
|
|
190
|
+
|
|
191
|
+
</details>
|
|
192
|
+
|
|
193
|
+
## Session report
|
|
194
|
+
|
|
195
|
+
Every session that used tokens in the period, highest cost first, for standups.
|
|
196
|
+
|
|
197
|
+
> `aitop --report sessions`
|
|
198
|
+
>
|
|
199
|
+
> `aitop --report sessions --md --plan 200`
|
|
200
|
+
>
|
|
201
|
+
> `aitop --report sessions --since 7d --json`
|
|
202
|
+
|
|
203
|
+
- Full form: `aitop --report sessions [--since yesterday|today|Nd|YYYY-MM-DD] [--plan USD] [--md|--json] [--show-prompts]`.
|
|
204
|
+
- `--since`: default is since midnight yesterday; at most 30 days back.
|
|
205
|
+
- `--plan 200`: adds how many times the period's share of a $200/month subscription (period days / 30) you used. Still in API list price and not your bill.
|
|
206
|
+
- `--md`: Markdown you can paste (`|` and line breaks escaped).
|
|
207
|
+
- `--json`: the same numbers for scripts.
|
|
208
|
+
- `--show-prompts`: first prompts are hidden unless you pass it, so they do not end up in shared output (session names still show).
|
|
209
|
+
- A summary card on top shows the total, the share per tool and the session count.
|
|
210
|
+
- The card's last line totals the waits (`Agents waited for you 1h12m (estimate)`).
|
|
211
|
+
|
|
212
|
+
<details>
|
|
213
|
+
<summary>Details: columns</summary>
|
|
214
|
+
|
|
215
|
+
- Tool.
|
|
216
|
+
- Main model (`+N` more).
|
|
217
|
+
- Project (same rule as `--by project`).
|
|
218
|
+
- Session name: your `/rename` name, then the tool's title, then the folder.
|
|
219
|
+
- Start and end of activity within the period.
|
|
220
|
+
- Time the agent waited for you (see below).
|
|
221
|
+
- Tokens.
|
|
222
|
+
- Cost (API list price). Unpriced models are left out, not guessed, and `--json` marks them with `unpriced`.
|
|
223
|
+
- Files changed (`-` when unknown, always for agy).
|
|
224
|
+
- Claude subagents are counted in their parent session.
|
|
225
|
+
|
|
226
|
+
</details>
|
|
227
|
+
|
|
228
|
+
<details>
|
|
229
|
+
<summary>Details: how "waited" is estimated</summary>
|
|
230
|
+
|
|
231
|
+
- Waited is an **estimate**: the sum of gaps from the agent's last line (reply or tool result) to your next input.
|
|
232
|
+
- Inputs for Claude: prompts you typed (slash commands included) and answers you picked in a permission dialog or AskUserQuestion.
|
|
233
|
+
- Inputs for Codex: `user_message`.
|
|
234
|
+
- Prompts queued while the agent worked and background task notifications do not count.
|
|
235
|
+
- An interrupt restarts the clock.
|
|
236
|
+
- The logs do not say whether you were at the screen, so **time away cannot be told apart** from waiting.
|
|
237
|
+
- Each gap counts for at most 2 hours, so a session left open overnight does not swamp the total.
|
|
238
|
+
- A Claude permission dialog's start time is not logged. The gap runs from the tool call to its result and includes the tool's run time after approval.
|
|
239
|
+
- Codex does not log approvals, so only prompts count there.
|
|
240
|
+
- Gaps crossing the period start count only the part inside.
|
|
241
|
+
- Subagents are not counted (parent session only).
|
|
242
|
+
- Each session is summed on its own, so with sessions running side by side the total can exceed wall-clock time.
|
|
243
|
+
- agy shows `-`.
|
|
244
|
+
- `--json` has `waitedMs` (milliseconds, `null` when unknown) per session and in `summary`.
|
|
245
|
+
|
|
246
|
+
</details>
|
|
247
|
+
|
|
248
|
+
## Call tree
|
|
249
|
+
|
|
250
|
+
The call tree of one Claude Code session with cost per tool call: each prompt, the tool calls under it and subagents under their `Agent`/`Task` call.
|
|
251
|
+
|
|
252
|
+
> `aitop --report trace fix-login`
|
|
253
|
+
>
|
|
254
|
+
> `aitop --report trace 1a2b3c4d --json`
|
|
255
|
+
|
|
256
|
+
- Full form: `aitop --report trace <session> [--md|--json] [--show-prompts]`.
|
|
257
|
+
- Each line has duration, tokens and estimated cost (API list price).
|
|
258
|
+
- `<session>`: the start of its id (as in `--json` and the resume command), a log file path, or a `/rename` name or title.
|
|
259
|
+
- `--md`, `--json`: Markdown or JSON output.
|
|
260
|
+
- `--show-prompts`: commands, paths and prompt text are hidden unless you pass it. Secrets are masked either way.
|
|
261
|
+
- It reads the log once and writes nothing.
|
|
262
|
+
- Codex and Antigravity sessions are not supported yet.
|
|
263
|
+
|
|
264
|
+
<details>
|
|
265
|
+
<summary>Details: cost split, folding, markers</summary>
|
|
266
|
+
|
|
267
|
+
- A tool line gets the cost of the reply that called it, split across the tools that reply called.
|
|
268
|
+
- Subagent and prompt lines total their whole branch.
|
|
269
|
+
- Totals can differ slightly from the session cost in other reports (subagent lines in very old logs are not placed in the tree).
|
|
270
|
+
- Repeated calls of one tool are grouped (`Grep ×38`).
|
|
271
|
+
- Branches deeper than a subagent's own steps are folded.
|
|
272
|
+
- Past 300 lines, the oldest prompts, and then the earliest steps inside a prompt or subagent, are left out and marked `N earlier steps left out`.
|
|
273
|
+
- Failed calls show `✗`, calls without a result yet `●`.
|
|
274
|
+
- `(no result)` shows when a later prompt came first or the log has not changed for over 15 minutes.
|
|
275
|
+
|
|
276
|
+
</details>
|
|
277
|
+
|
|
278
|
+
## Notifications
|
|
279
|
+
|
|
280
|
+
Alerts when a session starts waiting, finishes a long turn or fills its context. Off by default and only on the live screen.
|
|
281
|
+
|
|
282
|
+
> `aitop --notify`
|
|
283
|
+
>
|
|
284
|
+
> `aitop --notify=waiting,done,context`
|
|
285
|
+
>
|
|
286
|
+
> `aitop --on-waiting 'my-hook.sh'`
|
|
287
|
+
|
|
288
|
+
- `--notify`: desktop notification when a session starts waiting (notify-send on Linux, Windows notification on WSL, osascript on macOS).
|
|
289
|
+
- `--notify=waiting,done,context`: pick the kinds. Plain `--notify` uses the config file kinds, or waiting only when none are set.
|
|
290
|
+
- `--on-waiting`: run a command with `/bin/sh -c` for the same events (10 second limit, runs as you).
|
|
291
|
+
- Sessions already waiting (or already over 90% context) when aitop starts are not reported.
|
|
292
|
+
|
|
293
|
+
**Kinds**
|
|
116
294
|
|
|
117
295
|
- `waiting`: a session starts waiting for your approval or answer.
|
|
118
|
-
- `done`: a session that was busy for over 3 minutes in one turn (config `doneMinutes`; time spent waiting for approval does not count) goes idle and stays idle for 5 seconds.
|
|
119
|
-
- `context`: context use passes 90%, once
|
|
296
|
+
- `done`: a session that was busy for over 3 minutes in one turn (config `doneMinutes`; time spent waiting for approval does not count) goes idle and stays idle for 5 seconds. Once per turn.
|
|
297
|
+
- `context`: context use passes 90%, once. It re-arms after it drops below 85% (for example after compaction).
|
|
298
|
+
|
|
299
|
+
<details>
|
|
300
|
+
<summary>Details: <code>done</code> exceptions, hook, config file</summary>
|
|
301
|
+
|
|
302
|
+
**Not reported as `done`**
|
|
303
|
+
|
|
304
|
+
- Brief idle gaps between tool calls, approval waits, ended sessions and subagents.
|
|
305
|
+
- Sessions stopped by an API error and sessions whose status is guessed from file times.
|
|
120
306
|
|
|
121
|
-
|
|
307
|
+
**Hook**
|
|
122
308
|
|
|
123
|
-
|
|
309
|
+
- The hook keeps its name (`--on-waiting`) for all kinds.
|
|
310
|
+
- It gets `AITOP_EVENT` (`waiting`, `done` or `context`) in its environment.
|
|
311
|
+
- It also gets `AITOP_TOOL`, `AITOP_PROJECT`, `AITOP_SESSION_ID`, `AITOP_CWD` and `AITOP_WAITING_FOR`.
|
|
124
312
|
|
|
125
|
-
|
|
313
|
+
**Config file and switches**
|
|
126
314
|
|
|
127
|
-
|
|
315
|
+
- `"notify": true` or `"notify": ["waiting", "done", "context"]`.
|
|
316
|
+
- `"onWaiting": "..."` (the file must be `chmod 600`).
|
|
317
|
+
- `"doneMinutes": 5`.
|
|
318
|
+
- Plain `--notify` keeps the kinds from the config `notify` list (waiting only when there is none).
|
|
319
|
+
- `--no-notify` turns off only the desktop notification: the hook still follows those kinds.
|
|
320
|
+
- `--bell` stays waiting only.
|
|
128
321
|
|
|
129
|
-
|
|
322
|
+
</details>
|
|
130
323
|
|
|
131
|
-
|
|
324
|
+
<details>
|
|
325
|
+
<summary>Details: WSL, D-Bus, notification text</summary>
|
|
326
|
+
|
|
327
|
+
- On WSL, aitop shows a Windows notification through `powershell.exe` (as Windows PowerShell, no setup needed).
|
|
328
|
+
- It falls back to notify-send when `powershell.exe` is not on the PATH.
|
|
329
|
+
- notify-send needs a D-Bus session bus. When `DBUS_SESSION_BUS_ADDRESS` is unset or its socket file is missing, notifications cannot show and `--doctor` marks the line with `!`.
|
|
330
|
+
- A missing tool or a failed notification is skipped quietly.
|
|
331
|
+
- The body shows the session's own name when it has one (Claude Code `/rename`, or a name given by a peer session; Codex `thread_name`), otherwise the project.
|
|
332
|
+
- Desktop notifications can appear on the lock screen, so the name is visible there too.
|
|
333
|
+
|
|
334
|
+
</details>
|
|
335
|
+
|
|
336
|
+
## tmux status line
|
|
337
|
+
|
|
338
|
+
One short status line for tmux, then exit.
|
|
339
|
+
|
|
340
|
+
> `aitop --line`
|
|
341
|
+
>
|
|
342
|
+
> `aitop --line=tmux`
|
|
132
343
|
|
|
133
344
|
```tmux
|
|
134
345
|
set -g status-right '#(aitop --line=tmux)'
|
|
135
346
|
set -g status-interval 15
|
|
136
347
|
```
|
|
137
348
|
|
|
138
|
-
|
|
349
|
+
**What it shows** (items that are 0 are left out)
|
|
350
|
+
|
|
351
|
+
- Today's cost (API list price, `/$<budget>` when a daily budget is set).
|
|
352
|
+
- The sessions waiting for you, with the longest waiting one's name and wait time: `wait fix-login 3m` for one, `wait 2 fix-login 3m` for more.
|
|
353
|
+
- The Claude Code sessions stopped by an API error (`stop 1`, read live).
|
|
354
|
+
- The number of sessions running (`run 3`).
|
|
355
|
+
- Spend over the last hour.
|
|
356
|
+
|
|
357
|
+
**Options**
|
|
358
|
+
|
|
359
|
+
- `--line=tmux`: adds tmux colors. `NO_COLOR` turns them off.
|
|
360
|
+
- `--line-width N` (default 40): drops items from the end.
|
|
361
|
+
- In tmux always use `--line=tmux`: it escapes `#` in session names.
|
|
362
|
+
|
|
363
|
+
<details>
|
|
364
|
+
<summary>Details: width, cache, escaping</summary>
|
|
365
|
+
|
|
366
|
+
**Waiting and width**
|
|
367
|
+
|
|
368
|
+
- Waiting sessions are read live for Claude Code. Names are cut to 12 columns with `~`.
|
|
369
|
+
- The waiting name goes before the waiting count, after `stop`.
|
|
370
|
+
- With a daily budget and a waiting name, `$/h` often does not fit in 40, so raise `--line-width` to keep it.
|
|
371
|
+
|
|
372
|
+
**Cache**
|
|
373
|
+
|
|
374
|
+
- It reads only aitop's cache, so it is fast once `aitop` has run before.
|
|
375
|
+
- With no cache yet it prints `...` after about 1.5 seconds.
|
|
376
|
+
- The running count (and waiting Antigravity sessions with their names) come from a small summary that the live screen, `--once` and `--json` write to the cache.
|
|
377
|
+
- When no summary is newer than 60 seconds, `run` is left out rather than shown wrong.
|
|
378
|
+
|
|
379
|
+
**Escaping**
|
|
380
|
+
|
|
381
|
+
- Session names come from your sessions. Plain output could let tmux expand a `#{...}` or `#(...)` inside a name.
|
|
382
|
+
- In a zsh prompt with `PROMPT_SUBST`, a `%` in a name can be expanded by zsh.
|
|
383
|
+
- So escape `%` (for example `${$(aitop --line)//\%/%%}`) or use the line only in tmux.
|
|
384
|
+
|
|
385
|
+
</details>
|
|
386
|
+
|
|
387
|
+
## Several Claude or Codex profiles
|
|
388
|
+
|
|
389
|
+
aitop reads `~/.claude` and `~/.codex` by default. List more profiles to read them too.
|
|
390
|
+
|
|
391
|
+
> `AITOP_CLAUDE_DIRS=~/.claude:~/.claude-work aitop`
|
|
392
|
+
>
|
|
393
|
+
> `aitop --print-config`
|
|
394
|
+
>
|
|
395
|
+
> `aitop --doctor`
|
|
396
|
+
|
|
397
|
+
- Config file: `"claudeDirs": ["~/.claude", "~/.claude-work"]` and `"codexHomes": ["~/.codex", "~/.codex-alt"]`.
|
|
398
|
+
- Or set `AITOP_CLAUDE_DIRS` / `AITOP_CODEX_HOMES` with paths joined by `:` (`;` on Windows).
|
|
399
|
+
- Order: `AITOP_*` > config file > an inherited `CLAUDE_CONFIG_DIR` / `CODEX_HOME` > default.
|
|
400
|
+
- `aitop --print-config` shows which source is used.
|
|
401
|
+
- `aitop --doctor` lists every folder it reads, plus folders that hold logs but are not read, with how to add them.
|
|
402
|
+
|
|
403
|
+
<details>
|
|
404
|
+
<summary>Details: paths, duplicates, monthly reports, look-alike folders</summary>
|
|
405
|
+
|
|
406
|
+
- Because of the order, a `CLAUDE_CONFIG_DIR` exported for Claude Code does not hide your config list.
|
|
407
|
+
- A value that is itself an existing folder is never split, so an old single path containing `:` keeps working.
|
|
408
|
+
- The same folder listed twice (also through a link) is read once.
|
|
409
|
+
- A session log copied into two folders is counted once.
|
|
410
|
+
- For monthly reports, a month counts as complete only from the day after the oldest remaining log of the folder that was cleaned most recently.
|
|
411
|
+
- So a folder with old logs cannot make a month look complete when another folder already lost logs for it.
|
|
412
|
+
- aitop does not read look-alike folders on its own.
|
|
413
|
+
- `--doctor` reports as not read: `~/.claude-*`, `~/.config/claude`, `~/.codex-*` and similar owned by you, and a `CLAUDE_CONFIG_DIR` / `CODEX_HOME` the config list left out.
|
|
414
|
+
|
|
415
|
+
</details>
|
|
416
|
+
|
|
417
|
+
## Resume a session elsewhere
|
|
418
|
+
|
|
419
|
+
Continue a session elsewhere, for example when you cannot jump to its tab, as in Windows Terminal with WSL. The detail panel shows a `Resume` command and `y` copies it.
|
|
420
|
+
|
|
421
|
+
> Claude: `cd <dir> && claude --resume <id>`
|
|
422
|
+
>
|
|
423
|
+
> Codex: `cd <dir> && codex resume <id>`
|
|
424
|
+
>
|
|
425
|
+
> Antigravity: `cd <dir> && agy --conversation <id>`
|
|
426
|
+
|
|
427
|
+
- None for Gemini CLI.
|
|
428
|
+
- `y` copies the command to the clipboard with OSC 52.
|
|
429
|
+
- `--json` has the same command as `resumeCmd` per session (`null` if none).
|
|
430
|
+
- Nothing is sent to the session.
|
|
431
|
+
|
|
432
|
+
<details>
|
|
433
|
+
<summary>Details: data folders, when no command is made, clipboard</summary>
|
|
434
|
+
|
|
435
|
+
**Data folders**
|
|
436
|
+
|
|
437
|
+
- A session from a data folder other than `~/.claude` / `~/.codex` gets `CLAUDE_CONFIG_DIR=<dir>` / `CODEX_HOME=<dir>` before the tool, so it finds the right history.
|
|
438
|
+
- The same happens for any session while `CLAUDE_CONFIG_DIR` / `CODEX_HOME` is set.
|
|
439
|
+
|
|
440
|
+
**When no command is made**
|
|
441
|
+
|
|
442
|
+
- Claude finds sessions per folder, so without a known folder no command is made.
|
|
443
|
+
- Ids that are not UUIDs make none either.
|
|
444
|
+
- A short detail panel leaves the command out; use `y` or `--json` then.
|
|
445
|
+
- Paths and ids are shell quoted and control characters are stripped.
|
|
446
|
+
|
|
447
|
+
**Clipboard (OSC 52)**
|
|
448
|
+
|
|
449
|
+
- Windows Terminal, WezTerm, iTerm2 and kitty accept OSC 52.
|
|
450
|
+
- tmux needs `set -g set-clipboard on`.
|
|
451
|
+
- Other terminals ignore it silently, so copy the command from the panel.
|
|
452
|
+
|
|
453
|
+
</details>
|
|
454
|
+
|
|
455
|
+
## JSON output
|
|
456
|
+
|
|
457
|
+
> `aitop --json`
|
|
458
|
+
>
|
|
459
|
+
> `aitop --doctor --json`
|
|
460
|
+
|
|
461
|
+
- `--json` prints a snapshot as JSON and exits.
|
|
462
|
+
- For scripts, use `phaseKind`, a stable state name: `think`, `write`, `tool`, `team`, `waiting`, `idle`, `stopped`, `done`, `ended` (or `null`).
|
|
463
|
+
- `stopReason` says why a session is `stopped`: `{ "kind": "auth" }` login needed, `network` connection lost, `api` any other API error. `null` otherwise.
|
|
464
|
+
|
|
465
|
+
<details>
|
|
466
|
+
<summary>Details: text fields and where other fields are described</summary>
|
|
467
|
+
|
|
468
|
+
**Text fields**
|
|
469
|
+
|
|
470
|
+
- `phase` stays the Korean status text in every language (as does `AITOP_WAITING_FOR` for `--on-waiting`).
|
|
471
|
+
- Session `name` uses the same user-given names as the table.
|
|
472
|
+
- A Codex session's `name` changes from the folder name to its `thread_name` once it has one.
|
|
473
|
+
- `stopped` is an idle Claude session whose last log entry is an API error.
|
|
474
|
+
- Other text fields follow their own rules: with English selected, `--doctor --json` has Korean `tools.*.hint` but English `config.problems`.
|
|
475
|
+
|
|
476
|
+
**Other fields**
|
|
477
|
+
|
|
478
|
+
- `cacheExpiresAt`, `toolStartedAt`: [Features](#features).
|
|
479
|
+
- `stalled`, `startedAt`, `lastActivityAt`: [Subagents](#subagents).
|
|
480
|
+
- `resumeCmd`: [Resume a session elsewhere](#resume-a-session-elsewhere).
|
|
481
|
+
- Report output (`month`, `current`, `status`, `paths`, `unpriced`, `waitedMs`): [Daily and monthly reports](#daily-and-monthly-reports), [Session report](#session-report).
|
|
482
|
+
|
|
483
|
+
</details>
|
|
484
|
+
|
|
485
|
+
## Language
|
|
486
|
+
|
|
487
|
+
The UI follows your locale: English by default, Korean when the locale starts with `ko`.
|
|
488
|
+
|
|
489
|
+
> `aitop --lang ko`
|
|
490
|
+
>
|
|
491
|
+
> `AITOP_LANG=ko aitop`
|
|
492
|
+
|
|
493
|
+
- `--lang ko`: Korean screen, help, doctor and error messages.
|
|
494
|
+
- Set `AITOP_LANG=ko|en` (or `--lang`) to pick one, or `"lang": "ko"` in the config file.
|
|
495
|
+
- It covers the live screen, `--once`, `--help`, `--doctor`, error messages and desktop notifications.
|
|
496
|
+
- Keys and options work the same in both.
|
|
497
|
+
|
|
498
|
+
<details>
|
|
499
|
+
<summary>Details: how the language is picked</summary>
|
|
500
|
+
|
|
501
|
+
- Order: `--lang`, then `AITOP_LANG`, then `lang` in the config file, then `LC_ALL`, `LC_MESSAGES` and `LANG`.
|
|
502
|
+
- Korean when the locale starts with `ko`, English otherwise (including `C.UTF-8` and unset).
|
|
503
|
+
- If you used aitop on a `C.UTF-8` or `en_US` locale before, the screen, help and doctor output are now in English.
|
|
504
|
+
- Set `AITOP_LANG=ko` to keep Korean.
|
|
505
|
+
|
|
506
|
+
</details>
|
|
507
|
+
|
|
508
|
+
## How it differs from similar tools
|
|
509
|
+
|
|
510
|
+
- [ccusage](https://github.com/ryoppippi/ccusage)
|
|
511
|
+
- Reports token usage and cost from local logs (daily, monthly, session, 5-hour blocks).
|
|
512
|
+
- aitop is a live session monitor first, with smaller cost reports on the side.
|
|
513
|
+
- [abtop](https://github.com/graykode/abtop)
|
|
514
|
+
- A Rust live dashboard for Claude Code, Codex CLI and OpenCode, with rate limits, ports and keys to kill sessions.
|
|
515
|
+
- aitop installs with npm, also covers Antigravity, and only watches.
|
|
516
|
+
- [claude-code-monitor](https://github.com/onikan27/claude-code-monitor)
|
|
517
|
+
- Watches Claude Code on macOS through hooks it adds to `~/.claude/settings.json`, with a phone web view.
|
|
518
|
+
- aitop adds no hooks and only reads existing logs, on Linux, macOS, WSL and Windows.
|
|
519
|
+
- [Agents Stack](https://marketplace.visualstudio.com/items?itemName=MykD.agents-stack)
|
|
520
|
+
- A VS Code extension for Claude Code, Antigravity, Codex and Gemini CLI.
|
|
521
|
+
- It adds hooks to each agent's config. Antigravity has no hook for approval waits, so those do not show.
|
|
522
|
+
- aitop runs in any terminal, adds no hooks and shows Antigravity sessions waiting for approval.
|
|
523
|
+
|
|
524
|
+
## Install
|
|
525
|
+
|
|
526
|
+
Requires Node.js 22+ on Linux, macOS, WSL or Windows.
|
|
527
|
+
|
|
528
|
+
> `npx @sejuneoh/aitop`
|
|
529
|
+
>
|
|
530
|
+
> `npm install -g @sejuneoh/aitop`
|
|
531
|
+
>
|
|
532
|
+
> `aitop`
|
|
533
|
+
|
|
534
|
+
- `npx` runs the latest version without installing.
|
|
535
|
+
- `npm install -g` installs it. Then run `aitop`.
|
|
139
536
|
|
|
140
|
-
|
|
537
|
+
<details>
|
|
538
|
+
<summary>Windows: what works and what does not yet</summary>
|
|
141
539
|
|
|
142
|
-
|
|
540
|
+
- Native Windows support is early (Windows Terminal recommended).
|
|
541
|
+
- Works: Claude Code and Codex sessions, `--once`, `--json`, `--report` and `--doctor`.
|
|
542
|
+
- Not there yet: process detection, desktop notifications and `--on-waiting` ([#195](https://github.com/SejuneOh/aitop/issues/195)-[#197](https://github.com/SejuneOh/aitop/issues/197)).
|
|
543
|
+
- Until then a Codex session counts as running while its log was written in the last 10 minutes.
|
|
544
|
+
- So it drops out during a long step that writes nothing for over 10 minutes, and a crashed session can stay up to 10 minutes.
|
|
545
|
+
- Cache, log and config live in `%LOCALAPPDATA%\aitop\cache`, `%LOCALAPPDATA%\aitop\state` and `%APPDATA%\aitop` unless `XDG_*` is set.
|
|
143
546
|
|
|
144
|
-
|
|
547
|
+
</details>
|
|
145
548
|
|
|
146
549
|
## License
|
|
147
550
|
|