claude-usage-limits 1.6.1 → 1.7.1
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/plugin.json +1 -1
- package/.codex-plugin/plugin.json +40 -0
- package/README.md +70 -7
- package/agents/openai.yaml +4 -0
- package/bin/cli.js +16 -3
- package/commands/check.md +7 -2
- package/hooks/hooks.json +12 -1
- package/package.json +5 -3
- package/skills/usage-limits/SKILL.md +113 -16
- package/skills/usage-limits/agents/openai.yaml +4 -0
- package/skills/usage-limits/scripts/brief.js +252 -52
- package/skills/usage-limits/scripts/codex.js +855 -0
- package/skills/usage-limits/scripts/host.js +96 -0
- package/skills/usage-limits/scripts/install-codex-hook.js +448 -0
- package/skills/usage-limits/scripts/pulse.js +227 -0
- package/skills/usage-limits/scripts/usage.js +574 -50
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "usage-limits",
|
|
3
3
|
"displayName": "Usage Limits",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.7.1",
|
|
5
5
|
"description": "Puts your remaining Claude Code usage limit into Claude's context before every prompt, so it opens with what fits in the budget instead of starting work that gets cut off. Reports headroom as turns rather than percentages, prices a job before you start it, and detects your plan tier.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Ridelink",
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "usage-limits",
|
|
3
|
+
"version": "1.7.1",
|
|
4
|
+
"description": "Reports how much of your Codex usage limit is left as turns of work rather than a percentage, prices a job before you start it, and counts the other agents sharing the same budget.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Ridelink",
|
|
7
|
+
"url": "https://github.com/ridelink0"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/ridelink0/claude-code-usage-limits",
|
|
10
|
+
"repository": "https://github.com/ridelink0/claude-code-usage-limits",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"usage",
|
|
14
|
+
"limits",
|
|
15
|
+
"quota",
|
|
16
|
+
"rate-limit",
|
|
17
|
+
"budget",
|
|
18
|
+
"cost",
|
|
19
|
+
"planning",
|
|
20
|
+
"effort"
|
|
21
|
+
],
|
|
22
|
+
"skills": "./skills/",
|
|
23
|
+
"interface": {
|
|
24
|
+
"displayName": "Usage Limits",
|
|
25
|
+
"shortDescription": "How much usage limit is left, in turns of work",
|
|
26
|
+
"longDescription": "Reads the usage figures Codex already writes to disk and turns them into something you can plan with: which window binds, how many turns of work is left in it, and whether the job in front of you fits before the reset. Prices a job before you start it, notices when several agents are sharing one budget, and says what to land and what to leave when the limit is close. Everything is read locally; nothing is uploaded and no credentials are read.",
|
|
27
|
+
"developerName": "Ridelink",
|
|
28
|
+
"category": "Developer Tools",
|
|
29
|
+
"capabilities": [
|
|
30
|
+
"Read"
|
|
31
|
+
],
|
|
32
|
+
"websiteURL": "https://github.com/ridelink0/claude-code-usage-limits",
|
|
33
|
+
"defaultPrompt": [
|
|
34
|
+
"How much usage do I have left?",
|
|
35
|
+
"Will this job fit before my limit resets?",
|
|
36
|
+
"Finish this using as little usage as possible"
|
|
37
|
+
],
|
|
38
|
+
"brandColor": "#0C0A03"
|
|
39
|
+
}
|
|
40
|
+
}
|
package/README.md
CHANGED
|
@@ -392,6 +392,63 @@ own account reports, so it is right on any tier, including ones that did not
|
|
|
392
392
|
exist when this was written. The plan only decides which line of advice you
|
|
393
393
|
get at the bottom of the report.
|
|
394
394
|
|
|
395
|
+
## Codex
|
|
396
|
+
|
|
397
|
+
It reads Codex's limits too, from the same repo and the same commands.
|
|
398
|
+
|
|
399
|
+
Codex writes its session rollouts to `~/.codex/sessions`, one JSON object per
|
|
400
|
+
line, and every model request appends a record carrying both the account meter
|
|
401
|
+
and what that request cost in tokens. That is the same pair of things this tool
|
|
402
|
+
needs from Claude Code, so the window arithmetic, the turn estimates, the
|
|
403
|
+
forecast and the concurrent-session counting all work unchanged. Nothing is
|
|
404
|
+
uploaded and no credentials are read.
|
|
405
|
+
|
|
406
|
+
```
|
|
407
|
+
npx claude-usage-limits --host codex
|
|
408
|
+
npx claude-usage-limits --host codex --refresh
|
|
409
|
+
npx claude-usage-limits codex-hook on
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
The host is detected, so `--host` is only needed on a machine with both
|
|
413
|
+
installed. `--refresh` asks Codex itself for a live reading rather than the
|
|
414
|
+
newest one it happened to write; it starts a short-lived `codex app-server` and
|
|
415
|
+
takes about a second, and it is the Codex equivalent of `/usage`.
|
|
416
|
+
|
|
417
|
+
As a plugin, Codex installs it from this repo directly:
|
|
418
|
+
|
|
419
|
+
```
|
|
420
|
+
codex plugin marketplace add https://github.com/ridelink0/claude-code-usage-limits
|
|
421
|
+
codex plugin add usage-limits@usage-limits
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
### One thing is different, and it is worth being straight about
|
|
425
|
+
|
|
426
|
+
Under Claude Code the budget line arrives on its own, because a plugin can ship
|
|
427
|
+
hooks. Under Codex it does not, and not for want of trying:
|
|
428
|
+
|
|
429
|
+
- Codex has the whole hook engine. The binary carries `UserPromptSubmit`,
|
|
430
|
+
`SessionStart`, `PreToolUse` and the rest, and `codex features list` reports
|
|
431
|
+
`hooks` as stable and enabled.
|
|
432
|
+
- A plugin cannot ship one: `plugin_hooks` is reported as `removed`.
|
|
433
|
+
- And on `codex-cli 0.151.0-alpha.7.2` nothing fires it. Tested with a hook
|
|
434
|
+
whose only job was to write a file, from `~/.codex/hooks.json`, from a
|
|
435
|
+
`[hooks]` table in `config.toml`, and from `~/.codex/hooks/`, in both
|
|
436
|
+
`codex exec` and the desktop app. The engine is present and inert.
|
|
437
|
+
|
|
438
|
+
So `codex-hook on` installs two things. A marked block in `~/.codex/AGENTS.md`,
|
|
439
|
+
which Codex reads at the top of every session and which is what actually works
|
|
440
|
+
today; and the hooks themselves, ready for the build that runs them. `status`
|
|
441
|
+
reports both, `off` removes both, and neither touches anything else in those
|
|
442
|
+
files.
|
|
443
|
+
|
|
444
|
+
The practical difference is that under Codex the budget is read deliberately,
|
|
445
|
+
once at the start of a piece of work, rather than being handed to you before
|
|
446
|
+
every prompt.
|
|
447
|
+
|
|
448
|
+
Two smaller differences. There is no money column: Codex meters a share of an
|
|
449
|
+
allowance and never quotes a price, so the percentages stand alone. And
|
|
450
|
+
`lowpower` is Claude Code only, because it writes Claude's `settings.json`.
|
|
451
|
+
|
|
395
452
|
## Where it works
|
|
396
453
|
|
|
397
454
|
Every surface of Claude Code on a machine shares one config directory, so
|
|
@@ -502,12 +559,17 @@ names, the formulas, and the rest of it.
|
|
|
502
559
|
## Layout
|
|
503
560
|
|
|
504
561
|
```
|
|
505
|
-
.claude-plugin/plugin.json plugin manifest
|
|
562
|
+
.claude-plugin/plugin.json plugin manifest, Claude Code
|
|
506
563
|
.claude-plugin/marketplace.json lets the repo serve itself
|
|
507
|
-
|
|
508
|
-
|
|
564
|
+
.codex-plugin/plugin.json plugin manifest, Codex
|
|
565
|
+
agents/openai.yaml how Codex lists the plugin
|
|
566
|
+
skills/usage-limits/SKILL.md what the agent reads
|
|
567
|
+
skills/usage-limits/agents/ how Codex lists the skill
|
|
568
|
+
skills/usage-limits/scripts/ usage.js, brief.js, pulse.js, codex.js,
|
|
569
|
+
host.js, lowpower.js, install-codex-hook.js
|
|
509
570
|
skills/usage-limits/references/ the longer notes
|
|
510
|
-
hooks/hooks.json runs brief.js before each prompt
|
|
571
|
+
hooks/hooks.json runs brief.js before each prompt, and
|
|
572
|
+
pulse.js during long turns
|
|
511
573
|
commands/check.md the /usage-limits:check command
|
|
512
574
|
bin/cli.js the npx entry point
|
|
513
575
|
tools/sync-version.js keeps the manifest version in step
|
|
@@ -520,9 +582,10 @@ test/ node --test, no dependencies
|
|
|
520
582
|
node --test
|
|
521
583
|
```
|
|
522
584
|
|
|
523
|
-
|
|
524
|
-
the status line, the before-prompt line, job forecasting,
|
|
525
|
-
attribution, the
|
|
585
|
+
248 tests over the pricing, the window arithmetic, plan and credit detection,
|
|
586
|
+
the status line, the before-prompt line, the mid-turn pulse, job forecasting,
|
|
587
|
+
per-project attribution, the Codex reader and its installer, the CLI,
|
|
588
|
+
packaging, and the settings save/restore.
|
|
526
589
|
|
|
527
590
|
## Status
|
|
528
591
|
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "Usage Limits"
|
|
3
|
+
short_description: "How much usage limit is left, in turns of work"
|
|
4
|
+
default_prompt: "Use Usage Limits before starting anything long, when the limit is getting close, when asked how much usage is left or whether a job fits before the reset, and when asked to work cheaply or stretch what is left."
|
package/bin/cli.js
CHANGED
|
@@ -5,20 +5,28 @@
|
|
|
5
5
|
// under skills/usage-limits/scripts directly; this just gives npx users a
|
|
6
6
|
// single command that reaches the same code.
|
|
7
7
|
|
|
8
|
-
const HELP = `claude-usage-limits - how much
|
|
8
|
+
const HELP = `claude-usage-limits - how much agent usage is left, and whether the job fits
|
|
9
9
|
|
|
10
10
|
claude-usage-limits the report
|
|
11
11
|
claude-usage-limits --json the same numbers, machine readable
|
|
12
12
|
claude-usage-limits --status one short line, for a status line
|
|
13
13
|
claude-usage-limits --forecast 15 what a 15 turn job would cost
|
|
14
14
|
|
|
15
|
+
claude-usage-limits --host codex read Codex's limits instead
|
|
16
|
+
claude-usage-limits --host codex --refresh ask Codex for a live reading
|
|
17
|
+
|
|
15
18
|
claude-usage-limits lowpower status show the current effort setting
|
|
16
19
|
claude-usage-limits lowpower on lower effortLevel, remembering the old value
|
|
17
20
|
claude-usage-limits lowpower on --effort medium --model sonnet
|
|
18
21
|
claude-usage-limits lowpower off put back exactly what was there
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
claude-usage-limits codex-hook status is the Codex prompt hook installed
|
|
24
|
+
claude-usage-limits codex-hook on install it into ~/.codex/hooks.json
|
|
25
|
+
claude-usage-limits codex-hook off remove it
|
|
26
|
+
|
|
27
|
+
Reads the usage figures the agent already keeps on disk, plus its own session
|
|
28
|
+
history, to report the remaining headroom as turns of work. Works with Claude
|
|
29
|
+
Code and with Codex; the host is detected, or state it with --host. Nothing is
|
|
22
30
|
uploaded and no credentials are read.
|
|
23
31
|
|
|
24
32
|
https://github.com/ridelink0/claude-code-usage-limits
|
|
@@ -42,6 +50,11 @@ function run(argv) {
|
|
|
42
50
|
return Promise.resolve(lowpower.main(args.slice(1)));
|
|
43
51
|
}
|
|
44
52
|
|
|
53
|
+
if (args[0] === 'codex-hook') {
|
|
54
|
+
const installer = require('../skills/usage-limits/scripts/install-codex-hook.js');
|
|
55
|
+
return Promise.resolve(installer.main(args.slice(1)));
|
|
56
|
+
}
|
|
57
|
+
|
|
45
58
|
const usage = require('../skills/usage-limits/scripts/usage.js');
|
|
46
59
|
return Promise.resolve(usage.main(args));
|
|
47
60
|
}
|
package/commands/check.md
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Report how much
|
|
2
|
+
description: Report how much usage limit is left and how many turns of work it buys
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
Run the usage report and read it back to me.
|
|
6
6
|
|
|
7
7
|
1. Run `node "${CLAUDE_PLUGIN_ROOT}/skills/usage-limits/scripts/usage.js"`.
|
|
8
|
+
Under Codex, add `--host codex`, and add `--refresh` as well if the report
|
|
9
|
+
says the snapshot is old.
|
|
8
10
|
2. Tell me which window is binding, how many turns of headroom is left, and
|
|
9
|
-
whether that window resets before the budget runs out.
|
|
11
|
+
whether that window resets before the budget runs out. If it reports a
|
|
12
|
+
runway in minutes, lead with that rather than the turn count: a count that
|
|
13
|
+
looks generous can be minutes away when several sessions are sharing the
|
|
14
|
+
budget.
|
|
10
15
|
3. If I have already said what I want built, size it against the turns left
|
|
11
16
|
and say whether it fits. If it does not fit, say what to cut rather than
|
|
12
17
|
starting and hoping.
|
package/hooks/hooks.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"description": "Tells Claude how much usage budget is left,
|
|
2
|
+
"description": "Tells Claude how much usage budget is left: once before each prompt, and again during long turns so the figure it is working from does not go stale.",
|
|
3
3
|
"hooks": {
|
|
4
4
|
"UserPromptSubmit": [
|
|
5
5
|
{
|
|
@@ -11,6 +11,17 @@
|
|
|
11
11
|
}
|
|
12
12
|
]
|
|
13
13
|
}
|
|
14
|
+
],
|
|
15
|
+
"PostToolUse": [
|
|
16
|
+
{
|
|
17
|
+
"hooks": [
|
|
18
|
+
{
|
|
19
|
+
"type": "command",
|
|
20
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/skills/usage-limits/scripts/pulse.js\"",
|
|
21
|
+
"timeout": 10
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
14
25
|
]
|
|
15
26
|
}
|
|
16
27
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-usage-limits",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"description": "Puts your remaining Claude Code usage limit into Claude's context before every prompt, so it opens with what fits in the budget instead of starting work that gets cut off. Reports headroom as turns rather than percentages, prices a job before you start it, and detects your plan tier.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude",
|
|
@@ -32,7 +32,9 @@
|
|
|
32
32
|
"skills/",
|
|
33
33
|
"commands/",
|
|
34
34
|
"hooks/",
|
|
35
|
-
"
|
|
35
|
+
"agents/",
|
|
36
|
+
".claude-plugin/",
|
|
37
|
+
".codex-plugin/"
|
|
36
38
|
],
|
|
37
39
|
"engines": {
|
|
38
40
|
"node": ">=18"
|
|
@@ -40,6 +42,6 @@
|
|
|
40
42
|
"scripts": {
|
|
41
43
|
"test": "node --test",
|
|
42
44
|
"usage": "node bin/cli.js",
|
|
43
|
-
"version": "node tools/sync-version.js && git add .claude-plugin/plugin.json"
|
|
45
|
+
"version": "node tools/sync-version.js && git add .claude-plugin/plugin.json .codex-plugin/plugin.json"
|
|
44
46
|
}
|
|
45
47
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: usage-limits
|
|
3
|
-
description: Check how much
|
|
3
|
+
description: Check how much usage limit is left in this agent (Claude Code or Codex) and plan the work to fit inside it. Use before starting anything long, when the 5-hour or weekly limit is getting close, when asked how much usage or quota is left, whether there is enough left to finish, whether a job fits before the reset, when to stop and hand off, and when asked to work cheaply, burn fewer credits, or stretch the rest of the limit.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# usage-limits
|
|
@@ -18,6 +18,11 @@ node scripts/usage.js
|
|
|
18
18
|
Paths here are relative to this skill's own directory, not the project you are
|
|
19
19
|
working in. Run them from there, or prefix them with the skill's path.
|
|
20
20
|
|
|
21
|
+
This works the same in Claude Code and in Codex. The host is detected from the
|
|
22
|
+
environment; add `--host codex` or `--host claude` if a machine has both
|
|
23
|
+
installed and the wrong one is picked. Everything below applies to both unless
|
|
24
|
+
it says otherwise.
|
|
25
|
+
|
|
21
26
|
It prints the real percentages and reset times from the CLI's own cache, plus
|
|
22
27
|
a pace measured from the local session transcripts:
|
|
23
28
|
|
|
@@ -34,7 +39,13 @@ by what a turn has actually been costing over the last hour, on this account,
|
|
|
34
39
|
at this effort level. Add `--json` when you want the raw fields.
|
|
35
40
|
|
|
36
41
|
If it says no snapshot was found, run `/usage` once in Claude Code and try
|
|
37
|
-
again. That populates the cache the script reads.
|
|
42
|
+
again. That populates the cache the script reads. In Codex the equivalent is
|
|
43
|
+
`node scripts/usage.js --refresh`, which asks Codex itself for a live reading
|
|
44
|
+
instead of using the newest one it happened to write.
|
|
45
|
+
|
|
46
|
+
`Left` is money, so it only appears under Claude Code. Codex meters a share of
|
|
47
|
+
an allowance and never quotes a price, so its report has no money column and
|
|
48
|
+
its percentages are exactly what they say they are.
|
|
38
49
|
|
|
39
50
|
The last line names the plan (Pro, Max 5x, Max 20x, Team, Enterprise) and what
|
|
40
51
|
it means for spending. Pro has the least room and the 5-hour window usually
|
|
@@ -68,12 +79,26 @@ not tight.
|
|
|
68
79
|
**It fits only if nothing goes wrong.** Say so, switch to low power for the
|
|
69
80
|
run, and reorder the work so the valuable part lands first.
|
|
70
81
|
|
|
71
|
-
**It does not fit.** Say so before starting,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
82
|
+
**It does not fit.** Say so in one line before starting, and name the
|
|
83
|
+
wall-clock time the window resets so the user knows when the rest can happen.
|
|
84
|
+
Then do the whole thing anyway, ordered so that being cut off costs as little
|
|
85
|
+
as possible.
|
|
86
|
+
|
|
87
|
+
That is the part to get right, because the tempting move is the wrong one.
|
|
88
|
+
Deciding on the user's behalf to do less of what they asked spends their
|
|
89
|
+
request to protect a budget that expires regardless, and they did not ask for
|
|
90
|
+
that trade. Scaling the work down is their call, not yours.
|
|
91
|
+
|
|
92
|
+
So take the whole request, and make a cutoff cheap instead:
|
|
93
|
+
|
|
94
|
+
- Order it so the most valuable part lands first.
|
|
95
|
+
- Save at clean boundaries as you go, rather than once at the end.
|
|
96
|
+
- Keep a short running note of what is done, what is next, and which files are
|
|
97
|
+
mid-change, so stopping at any moment loses nothing.
|
|
98
|
+
|
|
99
|
+
Half a feature, committed and working, still beats a whole one abandoned
|
|
100
|
+
mid-edit. The difference is that you get there by sequencing the work, not by
|
|
101
|
+
refusing part of it.
|
|
77
102
|
|
|
78
103
|
**The window resets first.** If the reset lands before the budget runs out,
|
|
79
104
|
the limit is not the constraint. Say that and stop optimising for it.
|
|
@@ -222,6 +247,20 @@ to `low` is the largest per-turn saving available without changing model or
|
|
|
222
247
|
scope. The file change applies to new sessions; for the session already
|
|
223
248
|
running, `/effort low` takes effect immediately.
|
|
224
249
|
|
|
250
|
+
Do not take that on trust: the report measures it. Under the model table it
|
|
251
|
+
says how much of the output was reasoning and what that cost, for example
|
|
252
|
+
|
|
253
|
+
```
|
|
254
|
+
Of that output, 74k was reasoning (40%, about $1.85), the part effort controls.
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
That share is the ceiling on what lowering effort can save, so read it before
|
|
258
|
+
deciding whether the saving is worth the loss of reasoning. Forty per cent of
|
|
259
|
+
output is worth acting on; four per cent is not, and turning effort down for it
|
|
260
|
+
would cost more in rework than it saves. The same figure covers reasoning asked
|
|
261
|
+
for per prompt, by `ultrathink` or any other means, because it is all the same
|
|
262
|
+
spend on the same meter and the transcript does not separate them.
|
|
263
|
+
|
|
225
264
|
The behaviour, which applies **even at xhigh or max effort**, because the
|
|
226
265
|
effort setting does not control any of it:
|
|
227
266
|
|
|
@@ -245,16 +284,70 @@ one.
|
|
|
245
284
|
|
|
246
285
|
## 5. Checkpoint before the wall
|
|
247
286
|
|
|
248
|
-
When the binding window is under roughly
|
|
249
|
-
of headroom,
|
|
287
|
+
When the binding window is under roughly 10 percent, or under about ten turns
|
|
288
|
+
of headroom, keep working and start keeping the work landable:
|
|
250
289
|
|
|
251
|
-
1. Commit or otherwise save the working state
|
|
252
|
-
|
|
253
|
-
|
|
290
|
+
1. Commit or otherwise save the working state, at every clean boundary rather
|
|
291
|
+
than once at the end.
|
|
292
|
+
2. Keep `HANDOFF.md` current as you go: what is done, what is next, which files
|
|
293
|
+
are mid-change, what the next session should read first.
|
|
254
294
|
3. Say when the window resets, as a clock time and not just a duration, plus
|
|
255
295
|
what to run on the way back in.
|
|
256
296
|
|
|
257
|
-
|
|
297
|
+
The point of the handoff is that it costs almost nothing and removes the reason
|
|
298
|
+
to stop early. With one in place, being cut off loses a turn instead of an
|
|
299
|
+
afternoon, so there is no longer anything to buy by winding down.
|
|
300
|
+
|
|
301
|
+
The one thing not to economise on is the handoff itself. Everything else can be
|
|
302
|
+
picked up next session; a session that ends without one cannot.
|
|
303
|
+
|
|
304
|
+
## Running under Codex
|
|
305
|
+
|
|
306
|
+
Everything above works the same. The numbers come from a different place and
|
|
307
|
+
one thing about how they arrive is different, and both are worth knowing.
|
|
308
|
+
|
|
309
|
+
Codex writes its session rollouts to `~/.codex/sessions`, one JSON object per
|
|
310
|
+
line, and every model request appends a record carrying both the account meter
|
|
311
|
+
and what that request cost in tokens. So the two things this skill needs, the
|
|
312
|
+
percentages and the pace, come out of the same files. Nothing is sent anywhere
|
|
313
|
+
and no credentials are read.
|
|
314
|
+
|
|
315
|
+
```
|
|
316
|
+
node scripts/usage.js --host codex
|
|
317
|
+
node scripts/usage.js --host codex --refresh
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
`--refresh` asks Codex itself for a live reading instead of the newest one it
|
|
321
|
+
happened to write. It starts a short-lived `codex app-server`, takes about a
|
|
322
|
+
second, and is the Codex equivalent of running `/usage` in Claude Code. Use it
|
|
323
|
+
when the report says the snapshot is old, not routinely.
|
|
324
|
+
|
|
325
|
+
The difference that matters: **there is no budget line in front of the prompt.**
|
|
326
|
+
Claude Code lets a plugin ship hooks, so it gets one automatically. Codex will
|
|
327
|
+
not load hooks from a plugin, and on current builds it does not run them from
|
|
328
|
+
`~/.codex/hooks.json` or `config.toml` either, so nothing puts the figures in
|
|
329
|
+
front of you before you start.
|
|
330
|
+
|
|
331
|
+
What replaces it is an instruction, installed by:
|
|
332
|
+
|
|
333
|
+
```
|
|
334
|
+
node scripts/install-codex-hook.js on
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
That writes a marked block into `~/.codex/AGENTS.md` saying to run the report at
|
|
338
|
+
the start of a substantial piece of work, and it stages the hooks for the build
|
|
339
|
+
that runs them. `status` says what is installed, `off` removes both, and neither
|
|
340
|
+
touches anything else in those files.
|
|
341
|
+
|
|
342
|
+
So under Codex, read the budget deliberately rather than waiting to be told it.
|
|
343
|
+
Once at the start of a piece of work, and again if the job grows or starts
|
|
344
|
+
looping. The rest of this skill applies unchanged.
|
|
345
|
+
|
|
346
|
+
The report has no money column under Codex. Codex meters a share of an
|
|
347
|
+
allowance and never quotes a price, so the percentages are exactly what they
|
|
348
|
+
say and there is no dollar figure to attach. `scripts/lowpower.js` is for Claude
|
|
349
|
+
Code only: it writes Claude's `settings.json`, so it must not be run under
|
|
350
|
+
Codex. Change model or effort through Codex's own controls instead.
|
|
258
351
|
|
|
259
352
|
## When to skip this skill
|
|
260
353
|
|
|
@@ -266,8 +359,12 @@ a turn, which is the thing it is trying to save.
|
|
|
266
359
|
|
|
267
360
|
| Path | What it is |
|
|
268
361
|
| --- | --- |
|
|
269
|
-
| `scripts/usage.js` | The report. `--json` for raw fields, `--status` for a one-line readout that skips the transcript scan, `--forecast N` for what an N turn job would cost. |
|
|
362
|
+
| `scripts/usage.js` | The report. `--json` for raw fields, `--status` for a one-line readout that skips the transcript scan, `--forecast N` for what an N turn job would cost, `--host codex` to read Codex's limits, `--refresh` to ask Codex for a live figure. |
|
|
270
363
|
| `scripts/brief.js` | What the hook runs before each prompt. Not meant to be called by hand. |
|
|
271
|
-
| `scripts/
|
|
364
|
+
| `scripts/pulse.js` | What runs after tool calls, to re-check the budget during a long turn. Not meant to be called by hand. |
|
|
365
|
+
| `scripts/host.js` | Works out which agent this is running inside, so one host's percentages are never reported against the other's turns. |
|
|
366
|
+
| `scripts/codex.js` | The Codex reader: the meter and the pace out of `~/.codex/sessions`, plus the live `--refresh` call. |
|
|
367
|
+
| `scripts/install-codex-hook.js` | `status`, `on`, `off`. Installs the Codex-side instruction, which Claude Code does not need. |
|
|
368
|
+
| `scripts/lowpower.js` | `status`, `on`, `off`. Restores what it replaced. Claude Code only. |
|
|
272
369
|
| `references/tactics.md` | Every lever that lowers cost, and why it works. |
|
|
273
370
|
| `references/how-it-works.md` | Where the numbers come from and where they are soft. |
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "Usage Limits"
|
|
3
|
+
short_description: "Read the remaining usage limit and size the work to fit inside it"
|
|
4
|
+
default_prompt: "Use $usage-limits whenever the size of a job matters against the budget: before starting anything long, when asked how much usage is left, whether the work fits before the reset, when to stop, or how to finish using less. Run it once at the start of a piece of work rather than on every reply."
|