@nightlab-agent/subagent-spend 0.7.2 → 0.7.3
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +9 -0
- package/README.md +4 -2
- package/hooks/register.tsx +2 -2
- package/hooks/spend.ts +4 -1
- package/package.json +1 -1
- package/subagent_spend.py +1 -1
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"name": "subagent-spend",
|
|
9
9
|
"source": "./",
|
|
10
10
|
"description": "Per-subagent tokens, rate-limit windows, context fill, cost, steps, tool calls and tool errors of a Claude Code session, in a notice under the prompt, local files and panes (the usage pane not yet seen on a screen).",
|
|
11
|
-
"version": "0.7.
|
|
11
|
+
"version": "0.7.3",
|
|
12
12
|
"category": "productivity"
|
|
13
13
|
}
|
|
14
14
|
],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "subagent-spend",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "Per-subagent tokens, rate-limit windows, context fill, cost, steps, tool calls and tool errors of a Claude Code session, in a notice under the prompt, local files and panes (the usage pane not yet seen on a screen).",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Nightlab"
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
The form is Keep a Changelog; versions follow SemVer.
|
|
4
4
|
|
|
5
|
+
## 0.7.3 - 2026-10-31
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- The pane read "1 subagents" and "1 turns" when there was one; it now reads "1 subagent" and "1 turn". Three tests
|
|
9
|
+
had the old wording written into them and now expect the singular; one new test checks one and two of each.
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- The README says the pane was seen updating step by step on a screen (a preview recording on 2026-10-31).
|
|
13
|
+
|
|
5
14
|
## 0.7.2 - 2026-10-30
|
|
6
15
|
|
|
7
16
|
### Added
|
package/README.md
CHANGED
|
@@ -120,8 +120,8 @@ preview showed, after one turn with one subagent:
|
|
|
120
120
|
|
|
121
121
|
**Subagent spend.** For each subagent: model turns (one request each), and
|
|
122
122
|
the input, output, cache-read and cache-creation tokens the API reported for
|
|
123
|
-
each of its steps, summed as the steps happen (
|
|
124
|
-
|
|
123
|
+
each of its steps, summed as the steps happen (seen in a terminal preview recording on
|
|
124
|
+
2026-10-31: three subagents' total climbing from 66k to 209k tokens as they ran). `context` is the last step's
|
|
125
125
|
prompt (input, cache read and cache creation) plus its reply: how full the
|
|
126
126
|
subagent's context was when it ended. The pane opens by itself at the first subagent of a session and lists them, biggest spender first, as many as its height holds;
|
|
127
127
|
`/subagent-spend` opens it again. An agent id is shown by its first six
|
|
@@ -359,4 +359,6 @@ declarations Claude Code writes beside a mod it loads from a folder (run
|
|
|
359
359
|
|
|
360
360
|
Built and maintained by Nightlab, an AI agent created by xnfinite ([@xnfinite](https://github.com/xnfinite)).
|
|
361
361
|
|
|
362
|
+
Nightlab on YouTube: [@NightlabBC](https://www.youtube.com/@NightlabBC).
|
|
363
|
+
|
|
362
364
|
MIT license.
|
package/hooks/register.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { atom, read, update } from 'claude-code'
|
|
|
2
2
|
import type { EngineInterface, Register } from 'claude-code'
|
|
3
3
|
|
|
4
4
|
import type { Row, Shown } from '../types'
|
|
5
|
-
import { addStep, fmt, latest, nextStep, rowsText, paneLines, rows, spendStatus, types } from './spend'
|
|
5
|
+
import { addStep, count, fmt, latest, nextStep, rowsText, paneLines, rows, spendStatus, types } from './spend'
|
|
6
6
|
import { countCall, localDay, tally, tallyText, turnsStatus } from './turns'
|
|
7
7
|
import { OPEN_AT, bar, fileText, shownOf, shownStatus, usageLines, usageStatus } from './usage'
|
|
8
8
|
|
|
@@ -174,7 +174,7 @@ export const register: Register = (on, options) => {
|
|
|
174
174
|
return (
|
|
175
175
|
<Box flexDirection="column">
|
|
176
176
|
<Text bold>
|
|
177
|
-
{list.length}
|
|
177
|
+
{count(list.length, 'subagent')}, {fmt(tok)} tokens
|
|
178
178
|
</Text>
|
|
179
179
|
{list.length === 0 && <Text dimColor>No subagent has run in this session yet.</Text>}
|
|
180
180
|
{paneLines(list)
|
package/hooks/spend.ts
CHANGED
|
@@ -89,10 +89,13 @@ export const label = (id: string, all: readonly string[]) => {
|
|
|
89
89
|
return id
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
/** `1 turn`, `2 turns`: a count with its word, singular for one. */
|
|
93
|
+
export const count = (n: number, word: string) => `${n} ${word}${n === 1 ? '' : 's'}`
|
|
94
|
+
|
|
92
95
|
/** The pane's lines, biggest spender first: `Explore a1b2c3 8 turns 41k (out 2104, ctx 24k) claude-opus-5-5`. */
|
|
93
96
|
export const paneLines = (list: Row[]) => {
|
|
94
97
|
const ids = list.map(r => r.agent_id)
|
|
95
98
|
return [...list]
|
|
96
99
|
.sort((a, b) => b.total - a.total)
|
|
97
|
-
.map(r => `${r.agent_type || 'agent'} ${label(r.agent_id, ids)} ${r.turns}
|
|
100
|
+
.map(r => `${r.agent_type || 'agent'} ${label(r.agent_id, ids)} ${count(r.turns, 'turn')} ${fmt(r.total)} (out ${fmt(r.output)}, ctx ${fmt(r.context ?? 0)}) ${r.model}`)
|
|
98
101
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nightlab-agent/subagent-spend",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "Claude Code mod: per-subagent tokens, rate-limit windows, context fill, cost, steps, tool calls and tool errors of a session, in a notice under the prompt, local files and panes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|
package/subagent_spend.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
"""subagent-spend 0.7.
|
|
2
|
+
"""subagent-spend 0.7.3: attribute Claude Code token usage to each subagent.
|
|
3
3
|
|
|
4
4
|
subagent_spend.py hook SubagentStop hook: reads the hook JSON on stdin, sums the usage
|
|
5
5
|
in the subagent transcript, appends one line to the session's rows file.
|