@mkhuda/agent-ps 0.4.0 → 0.6.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/CHANGELOG.md +36 -0
- package/README.md +65 -55
- package/agent-ps +0 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
Reclaiming what ended sessions leave behind.
|
|
6
|
+
|
|
7
|
+
- `agent-ps prune` removes the parts of an ended session that are not the
|
|
8
|
+
conversation: subagent transcripts, file history, task records, shell
|
|
9
|
+
snapshots, request dumps. On the machine it was written on that is 96M across
|
|
10
|
+
43 sessions, against 33M for deleting every session older than a month,
|
|
11
|
+
because the sessions holding the space are recent rather than old.
|
|
12
|
+
- It reports by default and removes only with `--apply`. Transcripts are never
|
|
13
|
+
removed, a session with a running process is never touched whatever its age,
|
|
14
|
+
and agents that keep sessions in a database are left alone entirely.
|
|
15
|
+
- `p` in the table does the same for the selected row, after a confirmation
|
|
16
|
+
naming what goes. On a running session it refuses and says why.
|
|
17
|
+
- The detail panel marks which parts of a session can be pruned, and the line
|
|
18
|
+
above the keys reports the total when there is one.
|
|
19
|
+
- One confirmation path now serves every destructive key, rather than each
|
|
20
|
+
growing its own.
|
|
21
|
+
- Release pages take their title and notes from the changelog instead of the
|
|
22
|
+
commit list.
|
|
23
|
+
|
|
24
|
+
## 0.5.0
|
|
25
|
+
|
|
26
|
+
The token counts four agents were already writing.
|
|
27
|
+
|
|
28
|
+
- Token counts for Claude Code, Codex, Pi and CommandCode, which all record
|
|
29
|
+
what a turn spent and were simply never read. Seven of the eight agents now
|
|
30
|
+
report what a session cost.
|
|
31
|
+
- The counts are summed over a whole log, which is the one thing here that
|
|
32
|
+
reads a file end to end, so it happens only for the session whose detail
|
|
33
|
+
panel is open. Logs are append only, so a session that grew costs the bytes
|
|
34
|
+
it just wrote rather than all of it again.
|
|
35
|
+
- `agent-ps list` now says when `ps` or `lsof` failed even where the table came
|
|
36
|
+
back with rows, rather than only when it came back empty.
|
|
37
|
+
- The tests run in CI, across every supported interpreter.
|
|
38
|
+
|
|
3
39
|
## 0.4.0
|
|
4
40
|
|
|
5
41
|
Antigravity, and a legend that was lying about one of the colours.
|
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@ curl -fsSL https://raw.githubusercontent.com/mkhuda/agent-ps/main/install.sh | s
|
|
|
28
28
|
`ps aux | grep claude` gives you PIDs. It will not tell you which one is the
|
|
29
29
|
session you are talking to, what model it is spending on, whether it has been
|
|
30
30
|
idle for three days, or which rows are background daemons that outlived the
|
|
31
|
-
terminal that started them. It also misses the other
|
|
31
|
+
terminal that started them. It also misses the other seven agents entirely.
|
|
32
32
|
|
|
33
33
|
agent-ps lists every session with its agent, model, working directory, uptime,
|
|
34
34
|
idle time and disk footprint, then stops one process tree, every background
|
|
@@ -68,8 +68,7 @@ pnpm dlx @mkhuda/agent-ps
|
|
|
68
68
|
bunx @mkhuda/agent-ps
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
one. Either way the command it gives you is `agent-ps`.
|
|
71
|
+
Either way the command it gives you is `agent-ps`.
|
|
73
72
|
|
|
74
73
|
### Just the file
|
|
75
74
|
|
|
@@ -98,7 +97,7 @@ looking at.
|
|
|
98
97
|
|
|
99
98
|
### What it needs, and how to remove it
|
|
100
99
|
|
|
101
|
-
Python 3.8 or later and nothing from PyPI. Tested on 3.8, 3.9, 3.
|
|
100
|
+
Python 3.8 or later and nothing from PyPI. Tested on 3.8, 3.9, 3.12 and 3.13.
|
|
102
101
|
macOS and Linux; Windows is out because `curses` is not in its standard library.
|
|
103
102
|
It shells out to `ps`, and on macOS to `lsof`, which is how a process is matched
|
|
104
103
|
to a session everywhere except Claude Code.
|
|
@@ -115,31 +114,23 @@ agent-ps only ever reads the agents' own files.
|
|
|
115
114
|
Each agent keeps its own colour in the table, and the same colours label the
|
|
116
115
|
legend above the keys.
|
|
117
116
|
|
|
118
|
-
| Agent | | Sessions in | Paired by |
|
|
119
|
-
|
|
120
|
-
| [Claude Code](https://claude.com/claude-code) |  | JSONL | the agent itself |
|
|
121
|
-
| [Pi](https://pi.dev) |  | JSONL | directory |
|
|
122
|
-
| CommandCode |  | JSONL | directory |
|
|
123
|
-
| [Codex CLI](https://github.com/openai/codex) |  | JSONL | directory |
|
|
124
|
-
| [OpenCode](https://github.com/sst/opencode) |  | SQLite | directory |
|
|
125
|
-
| Hermes |  | SQLite | directory |
|
|
126
|
-
| GitHub Copilot |  | VS Code storage | no process |
|
|
127
|
-
| Antigravity |  | SQLite per conversation | directory |
|
|
128
|
-
|
|
129
|
-
Only Claude Code records which process is running which session
|
|
130
|
-
pairing is matched on working directory and shown as a guess.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
showing are inside protobuf blobs rather than columns, so they are read out one
|
|
136
|
-
at a time. Its steps carry the same status whether a turn is running or has
|
|
137
|
-
finished, so it is the one agent whose busy and idle cannot be told apart.
|
|
138
|
-
|
|
139
|
-
Copilot is the exception to everything. It runs inside the VS Code extension
|
|
140
|
-
host, so it has no process of its own: no PID, no uptime, no CPU or memory, and
|
|
141
|
-
nothing to stop. What it does have is the credits each turn spent, which the free
|
|
142
|
-
tier meters and nothing else surfaces. A chat counts as open while its workspace
|
|
117
|
+
| Agent | | Sessions in | Paired by | Reopened with |
|
|
118
|
+
|---|---|---|---|---|
|
|
119
|
+
| [Claude Code](https://claude.com/claude-code) |  | JSONL | the agent itself | `claude --resume` |
|
|
120
|
+
| [Pi](https://pi.dev) |  | JSONL | directory | `pi --session` |
|
|
121
|
+
| CommandCode |  | JSONL | directory | `cmd --resume` |
|
|
122
|
+
| [Codex CLI](https://github.com/openai/codex) |  | JSONL | directory | `codex resume` |
|
|
123
|
+
| [OpenCode](https://github.com/sst/opencode) |  | SQLite | directory | `opencode --session` |
|
|
124
|
+
| Hermes |  | SQLite | directory | `hermes --resume` |
|
|
125
|
+
| GitHub Copilot |  | VS Code storage | no process | in the editor |
|
|
126
|
+
| Antigravity |  | SQLite per conversation | directory | `agy --conversation` |
|
|
127
|
+
|
|
128
|
+
Only Claude Code records which process is running which session. Every other
|
|
129
|
+
pairing is matched on working directory and shown as a guess. Tokens and cost
|
|
130
|
+
appear in the detail panel.
|
|
131
|
+
|
|
132
|
+
Copilot is the exception: it runs inside the VS Code extension host, so it has no
|
|
133
|
+
process of its own and nothing to stop. A chat counts as open while its workspace
|
|
143
134
|
is open in the editor.
|
|
144
135
|
|
|
145
136
|
## Usage
|
|
@@ -163,6 +154,7 @@ something.
|
|
|
163
154
|
| `S` | reverse the direction |
|
|
164
155
|
| `k` | stop the selected process and its children, after confirming |
|
|
165
156
|
| `b` | stop every background helper, after confirming |
|
|
157
|
+
| `p` | remove what the selected ended session left behind, after confirming |
|
|
166
158
|
| `y`, `n` | answer a confirmation |
|
|
167
159
|
| `e` | show or hide ended sessions |
|
|
168
160
|
| `/` | filter by session, title, agent, model, directory, or PID |
|
|
@@ -176,9 +168,8 @@ screen in its own colour and, on the right, what the table is sorted by:
|
|
|
176
168
|
|
|
177
169
|

|
|
178
170
|
|
|
179
|
-
That middle line
|
|
180
|
-
|
|
181
|
-
and it is where a note appears for a few seconds after you act on something.
|
|
171
|
+
That middle line is the key to the colours, names the sort order in words, and
|
|
172
|
+
is where a note appears for a few seconds after you act on something.
|
|
182
173
|
|
|
183
174
|
Backspacing a filter down to nothing leaves filter mode, so the key bar comes
|
|
184
175
|
back without reaching for escape.
|
|
@@ -209,20 +200,17 @@ ended sessions, then `s` until DISK is marked.
|
|
|
209
200
|
|
|
210
201
|
### The detail panel
|
|
211
202
|
|
|
212
|
-
Enter on a live session opens everything known about it,
|
|
213
|
-
the
|
|
214
|
-
|
|
215
|
-
question.
|
|
203
|
+
Enter on a live session opens everything known about it, in four groups: what
|
|
204
|
+
the session is, what it is doing to the machine, what it has cost, and the
|
|
205
|
+
command line.
|
|
216
206
|
|
|
217
207
|
<img src="https://raw.githubusercontent.com/mkhuda/agent-ps/main/images/agent-ps-detail.jpg" width="620"
|
|
218
208
|
alt="The detail panel for a Claude Code session, in four groups. Session: agent, id, status, model, title and directory. Process: pid with its parent, uptime, and time since the last turn. Usage: cpu, memory, and a 41M disk total broken into 28M of transcript, 11M of subagent logs and 2M of file history. Command: the command line that started it.">
|
|
219
209
|
|
|
220
|
-
The disk total is broken down
|
|
221
|
-
|
|
222
|
-
different answers, and until you can see which it is there is nothing to decide.
|
|
210
|
+
The disk total is broken down by what is holding it, since transcript and file
|
|
211
|
+
history call for different answers.
|
|
223
212
|
|
|
224
|
-
|
|
225
|
-
cost, Copilot reports the credits a turn spent:
|
|
213
|
+
Tokens and cost are here too, and Copilot reports the credits a turn spent:
|
|
226
214
|
|
|
227
215
|
```
|
|
228
216
|
provider opencode-free
|
|
@@ -236,14 +224,13 @@ directory rather than reported, so you know before pressing `k` that the pairing
|
|
|
236
224
|
is a guess.
|
|
237
225
|
|
|
238
226
|
Enter on an ended session reopens it in a new terminal tab instead. Copilot
|
|
239
|
-
chats
|
|
227
|
+
chats reopen in the editor.
|
|
240
228
|
|
|
241
229
|
### The advisory line
|
|
242
230
|
|
|
243
231
|
A line above the keys points out whatever is worth a look: background helpers
|
|
244
232
|
left running, sessions untouched for a day, or ended sessions you could resume.
|
|
245
|
-
It names the key that acts on it, and
|
|
246
|
-
warnings teaches people to ignore the line.
|
|
233
|
+
It names the key that acts on it, and shows one thing at a time.
|
|
247
234
|
|
|
248
235
|
## Scripting
|
|
249
236
|
|
|
@@ -253,6 +240,9 @@ agent-ps list --all # include ended sessions
|
|
|
253
240
|
agent-ps list --json # machine readable, with idle seconds
|
|
254
241
|
agent-ps list --limit 100 # how many ended sessions (default 40)
|
|
255
242
|
agent-ps list --filter benchmark # same match as the / key
|
|
243
|
+
agent-ps prune # what ended sessions left, minus the conversation
|
|
244
|
+
agent-ps prune --older-than 30d # only sessions idle that long (default 7d)
|
|
245
|
+
agent-ps prune --apply # actually remove it
|
|
256
246
|
agent-ps agents # which agents were found, and where
|
|
257
247
|
agent-ps --agent codex list # one agent, or a comma separated list
|
|
258
248
|
agent-ps stop 32244 # stop one process tree
|
|
@@ -267,6 +257,30 @@ agent-ps --version
|
|
|
267
257
|
Piping works without a subcommand: with stdout not a terminal, agent-ps prints
|
|
268
258
|
the table and exits.
|
|
269
259
|
|
|
260
|
+
## Reclaiming space
|
|
261
|
+
|
|
262
|
+
A session writes more than its conversation. Claude Code alone keeps subagent
|
|
263
|
+
transcripts, file history for `/rewind`, task records and a session
|
|
264
|
+
environment, and on this machine those came to a fifth of everything on disk.
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
agent-ps prune
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Reports and removes nothing. It lists what ended sessions left behind, grouped
|
|
271
|
+
by what it is and which sessions hold the most, and `--apply` removes it.
|
|
272
|
+
|
|
273
|
+
In the table, `p` does the same for the row you are on, and the detail panel
|
|
274
|
+
marks which parts of a session those are. On a session that is still running it
|
|
275
|
+
refuses and says why rather than going quiet.
|
|
276
|
+
|
|
277
|
+
Three things it will not do. It never touches a transcript, so every session
|
|
278
|
+
stays resumable. It never touches a session with a running process, whatever
|
|
279
|
+
its age, because file history is what `/rewind` reaches for. And it never
|
|
280
|
+
touches OpenCode, Copilot or Antigravity, whose sessions are rows in a database
|
|
281
|
+
the agent may have open: agent-ps reads, and does not write, the stores it
|
|
282
|
+
did not create.
|
|
283
|
+
|
|
270
284
|
## What each column means
|
|
271
285
|
|
|
272
286
|
| Column | Meaning |
|
|
@@ -281,18 +295,14 @@ the table and exits.
|
|
|
281
295
|
| CPU, MEM | the same `ps` call |
|
|
282
296
|
| DISK | everything that session left on disk |
|
|
283
297
|
| DIR | the working directory |
|
|
284
|
-
| TITLE | the session title, or its opening prompt
|
|
298
|
+
| TITLE | the session title, or its opening prompt |
|
|
285
299
|
|
|
286
|
-
UPTIME and ACTIVE often disagree
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
so an ended session shows a dash under UPTIME and only ACTIVE says how stale it
|
|
290
|
-
is.
|
|
300
|
+
UPTIME and ACTIVE often disagree: a process can be five days old and have
|
|
301
|
+
answered a minute ago. UPTIME comes from the process table, ACTIVE from the log,
|
|
302
|
+
which is appended on every turn.
|
|
291
303
|
|
|
292
|
-
Each agent
|
|
293
|
-
|
|
294
|
-
palette. A selected row keeps its own highlight rather than being broken up, so
|
|
295
|
-
the cursor stays unmistakable. Terminals without colour fall back to plain text.
|
|
304
|
+
Each agent has its own colour, and the legend above the keys is the key to it.
|
|
305
|
+
Terminals without colour fall back to plain text.
|
|
296
306
|
|
|
297
307
|
## A PID marked with a question mark
|
|
298
308
|
|
|
@@ -366,7 +376,7 @@ install fetches. The build is reproducible: the same source always produces the
|
|
|
366
376
|
same bytes, so the committed executable can be checked against the tree.
|
|
367
377
|
|
|
368
378
|
```
|
|
369
|
-
|
|
379
|
+
b57e60c153471ce8a5630d72a2688633b7d6ff9c5359b372e12fc03d0d9379d9 agent-ps
|
|
370
380
|
```
|
|
371
381
|
|
|
372
382
|
Adding an agent takes one class and one line in the registry. See
|
package/agent-ps
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mkhuda/agent-ps",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "A process table for coding agent sessions. Claude Code, Codex, OpenCode, Hermes, Pi, CommandCode and Copilot in one view, with models, idle time, disk use and one key to stop them.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|