limitcast 0.17.2 → 0.18.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 +147 -84
- package/bin/limitcast.mjs +215 -50
- package/package.json +1 -1
- package/src/cold.mjs +47 -10
- package/src/inflight.mjs +99 -0
- package/src/install.mjs +9 -0
- package/src/results.mjs +21 -1
- package/src/startup.mjs +28 -0
- package/src/toollimit.mjs +137 -0
- package/src/trim.mjs +10 -1
- package/src/where.mjs +53 -3
package/README.md
CHANGED
|
@@ -1,118 +1,181 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/assets/emblem.png" alt="Limitcast forecast gauge connected to Claude Code, Codex, and Grok provider badges" width="420">
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://www.npmjs.com/package/limitcast"><code>npm · limitcast</code></a>
|
|
7
|
+
<a href="https://github.com/SamStull9007/limitcast/actions/workflows/ci.yml"><img src="https://github.com/SamStull9007/limitcast/actions/workflows/ci.yml/badge.svg" alt="CI status"></a>
|
|
8
|
+
<a href="LICENSE"><code>MIT license</code></a>
|
|
9
|
+
<a href="https://nodejs.org"><code>Node.js 20+</code></a>
|
|
10
|
+
</p>
|
|
4
11
|
|
|
5
|
-
|
|
12
|
+
<p align="center">
|
|
13
|
+
<strong>See the limit. Stay ahead.</strong><br>
|
|
14
|
+
See when your usage window will run out, control subagent burn,<br>
|
|
15
|
+
and remove starting context you never use.
|
|
16
|
+
</p>
|
|
6
17
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
18
|
+
<p align="center"><code>npm install -g limitcast</code></p>
|
|
19
|
+
|
|
20
|
+
> **Follow Limitcast:** select **Watch → Custom → Releases** for updates. Enable email delivery in your GitHub notification settings to get release emails. [How to subscribe](docs/community.md#get-release-emails) · [Join Discussions](https://github.com/SamStull9007/limitcast/discussions)
|
|
21
|
+
|
|
22
|
+
<p align="center">
|
|
23
|
+
<a href="#quick-start">Quick start</a> ·
|
|
24
|
+
<a href="#see-it-in-action">Demo</a> ·
|
|
25
|
+
<a href="docs/tour.md">Visual tour</a> ·
|
|
26
|
+
<a href="docs/usage.md">Full guide</a> ·
|
|
27
|
+
<a href="https://limitcast.dev">Website</a> ·
|
|
28
|
+
<a href="CHANGELOG.md">Changelog</a>
|
|
29
|
+
</p>
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Less overhead. More room to build.
|
|
34
|
+
|
|
35
|
+
- **Forecast your windows.** See what's likely to run out first and pace your weekly allowance. `limitcast status`
|
|
36
|
+
|
|
37
|
+
- **Keep agents in check.** Hold new subagents when capacity is tight, with receipts and optional budgets. The guard also holds a second subagent of the same type and prompt while the first is still running. `limitcast install --guard`
|
|
38
|
+
|
|
39
|
+
- **Start lighter.** Inspect unused skills and MCP servers, then trim with backups and undo. `limitcast trim`
|
|
40
|
+
|
|
41
|
+
<a id="free-and-open-source"></a>
|
|
42
|
+
|
|
43
|
+
**Free and open source.** All features are included. No Limitcast account, license key, or subscription required. Runs locally on **macOS and Linux** with **Node.js 20+**.
|
|
10
44
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
45
|
+
<a id="install"></a>
|
|
46
|
+
|
|
47
|
+
## Quick start
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
npm install -g limitcast
|
|
51
|
+
limitcast onboard # Read-only setup checks and a first useful result
|
|
52
|
+
limitcast install # Add the status-line recorder
|
|
53
|
+
limitcast doctor # Check the integration
|
|
14
54
|
```
|
|
15
55
|
|
|
16
|
-
|
|
17
|
-
- **Subagent guard** for Claude Code and Codex: blocks a new subagent when that tool's own window is on pace to run out before it resets, and while a Claude window is tight runs new subagents on Sonnet instead of your main model. Free installs get a preview that never acts and shows what it would have done.
|
|
18
|
-
- **Subagent receipts and budgets:** when a subagent finishes you see what it cost: "that Explore subagent used ≈2.1% of your 5-hour window (34 calls)". Before a new one starts you see what that kind has cost you so far: "Explore subagents have cost you a median ≈1.2% (max ≈3.6%) of a 5-hour window over 7 runs" (once there are 3 priced runs, and only when a typical run is over 1% of a window or the window is NEAR). `limitcast budget subagents 15` holds new subagents once they have used 15% of the current window.
|
|
19
|
-
- **Cold-cache warning:** after a long pause (60 min, `LIMITCAST_CACHE_MINUTES`) the prompt cache has expired and your next message re-sends the whole context as new tokens. limitcast holds that first message once and tells you what it will cost; send it again to go ahead, or `/compact` first.
|
|
20
|
-
- **Large tool-output notice (with `install --alerts`):** when one tool result is very large (about 20k tokens or more; `LIMITCAST_TOOL_TOKENS` changes that), you see it once per tool per session with what to ask for next time: "that HubSpot get_crm_objects result was ≈25k tokens. Next time: ask for fewer fields and a smaller limit". It is shown to you, never to the model, and `limitcast report --why` lists the same advice for the sources that cost you most.
|
|
21
|
-
- **Limit-change alert:** limitcast re-measures how many tokens move your meter by 1% every day and notifies you when that shifts by 15% or more, so you know when the limit itself changed.
|
|
22
|
-
- **Daily allowance (free):** today's even share of each weekly window, so you can pace the week: `7d 41% · today 6% left`.
|
|
23
|
-
- **More controls:** desktop notifications (`limitcast notify on`), also to your phone (`notify ntfy <topic>`) or a Slack/Discord webhook (`notify webhook <url>`), run a job after the reset (`limitcast after-reset -- …`), a pointer to your other account when this one is near its limit, a `/compact` nudge in long sessions, and an HTML dashboard (`limitcast results --html`).
|
|
24
|
-
- **Capacity report:** `limitcast results` separates recorded consumption by provider, applied protection decisions and historical previews, and estimated Claude context tokens not re-sent relative to a recorded baseline. Calls crossing a week boundary are counted in the period they happened. It also shows lifetime context estimates, forecast replay and next steps. Unknown evidence stays unavailable; controls are not converted into invented saved tokens.
|
|
25
|
-
- **Burn report:** Claude Code, Codex and Grok tokens by day, project, model and session.
|
|
26
|
-
- **Runout forecast (free):** burn rate and the clock time each window runs out.
|
|
27
|
-
- **Local only.** Reads the limit readings Claude Code passes to your status line and the logs Claude Code, Codex and Grok already write. No logins, and your usage data never leaves your machine. No license validation or payment-service connection is required. If you turn on phone or webhook notifications (off by default), each notification's text goes to the service you chose (ntfy.sh or your webhook) and nothing else. The one other exception is also off by default: `limitcast grok-usage on` reads the login Grok keeps in `~/.grok/auth.json` and sends it to grok.com, and nowhere else, to ask for your weekly Grok usage (details under Grok below).
|
|
56
|
+
Restart Claude Code after installing. Your existing status line stays in place, with the Limitcast line underneath. Installation backs up your settings; `limitcast uninstall` restores them.
|
|
28
57
|
|
|
29
|
-
|
|
30
|
-
|---|---|---|---|
|
|
31
|
-
| Limit forecast (`status`) | ✓ status-line feed | ✓ session logs | spend from `usage.json`; % / runout after `limitcast budget grok <usd>` |
|
|
32
|
-
| Subagent guard | ✓ `Task`/`Agent` | ✓ `spawn_agent` | ✓ `spawn_subagent` (blocks once a dollar cap is set) |
|
|
33
|
-
| Token report (`report`) | ✓ | ✓ | ✓ per-turn ledger |
|
|
34
|
-
| Trim advisor (`trim`) | ✓ | `--codex` | `--grok` |
|
|
58
|
+
Want protection as well as visibility? Enable the optional guard:
|
|
35
59
|
|
|
36
|
-
|
|
60
|
+
```sh
|
|
61
|
+
limitcast install --guard
|
|
62
|
+
```
|
|
37
63
|
|
|
38
|
-
|
|
64
|
+
The guard holds **new** subagents when a usage window is on pace to run out; existing agents continue. `LIMITCAST_ALLOW=1` overrides a hold. [Guard behavior and thresholds →](docs/usage.md#subagent-guard)
|
|
39
65
|
|
|
40
|
-
|
|
66
|
+
<details>
|
|
67
|
+
<summary><strong>Homebrew or Claude Code plugin</strong></summary>
|
|
41
68
|
|
|
42
|
-
|
|
69
|
+
Install with Homebrew:
|
|
43
70
|
|
|
44
71
|
```sh
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
limitcast install # free: status-line recorder
|
|
48
|
-
limitcast install --guard # also the subagent guard (free; holds new subagents when a limit is on pace to run out)
|
|
49
|
-
limitcast doctor
|
|
72
|
+
brew trust samstull9007/limitcast
|
|
73
|
+
brew install samstull9007/limitcast/limitcast
|
|
50
74
|
```
|
|
51
75
|
|
|
52
|
-
|
|
76
|
+
Or add the Claude Code plugin for `/limitcast:status`, `/limitcast:results`, `/limitcast:trim`, `/limitcast:memory-audit`, and `/limitcast:memory-split`:
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
/plugin marketplace add SamStull9007/limitcast
|
|
80
|
+
/plugin install limitcast@limitcast
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The status-line recorder still comes from `limitcast install`.
|
|
84
|
+
|
|
85
|
+
</details>
|
|
86
|
+
|
|
87
|
+
## See it in action
|
|
53
88
|
|
|
54
|
-
|
|
89
|
+
**[Take the illustrated tour →](docs/tour.md)** Forecast your windows, give subagents a budget, and inspect what you load.
|
|
55
90
|
|
|
56
|
-
|
|
91
|
+

|
|
57
92
|
|
|
58
|
-
|
|
93
|
+
<p align="center"><sub>Actual CLI output, arranged for readability · synthetic demo data · estimates are not measured financial savings</sub></p>
|
|
59
94
|
|
|
60
|
-
|
|
95
|
+
<details>
|
|
96
|
+
<summary><strong>Watch the recorded terminal walkthrough</strong></summary>
|
|
61
97
|
|
|
62
|
-
|
|
63
|
-
|---|---|
|
|
64
|
-
| `limitcast onboard` | Read-only guided setup: local tools, readiness, free feature availability, personal context finding, keep/undo/override controls and next commands. Never changes settings |
|
|
65
|
-
| `limitcast status [--json]` | Used, burn rate, runout time and reset for each window, and today's share of each weekly one. When a window is on pace to run out, one line names the one that binds first and where else there is room ("You'll hit Claude 7d first (Thu 14:00). Grok 5h still has $38."). also lists your other Claude accounts |
|
|
66
|
-
| `limitcast trim --codex [--apply / --undo]` | Codex: AGENTS.md size and MCP servers in `~/.codex/config.toml` you haven't used. names them and turns them off (`enabled = false`; `--undo` restores the file exactly) |
|
|
67
|
-
| `limitcast trim --grok [--apply / --undo]` | Grok: system prompt and tool-definition size, and MCP servers in `~/.grok/config.toml` you haven't used. names them and turns them off (`enabled = false`; `--undo` restores the file exactly) |
|
|
68
|
-
| `limitcast notify on/off/test` | A desktop notification when a Claude window turns NEAR, AT_RISK or HIT, and when it resets after a HIT. On macOS they come from a tiny limitcast notifier app, listed as "limitcast" in System Settings → Notifications |
|
|
69
|
-
| `limitcast notify ntfy <topic or https URL>` / `notify webhook <https URL>` | Also send every notification to your phone through [ntfy](https://ntfy.sh) (install the app, subscribe to the topic) or to a Slack or Discord incoming webhook. `off` removes it. Sent in the background, so no hook waits on the network |
|
|
70
|
-
| `limitcast budget subagents <percent>` / `off` | Once subagents have used that share of the current 5-hour window, the guard holds new ones until it resets. Priced from your own readings (needs about a day of use first) |
|
|
71
|
-
| `limitcast budget today on` / `off` | The `today N% left` pace of a weekly window becomes an action. With `notify on` you get one notification a day at 80% of today's share. With `budget today on` the guard also holds new subagents once today's share is used up, until local midnight. Off by default; a window already at 100% is left to the tool; `LIMITCAST_ALLOW=1` overrides. Applied holds appear in `results` |
|
|
72
|
-
| `limitcast subagent-model <type> <sonnet\|opus\|haiku\|claude-id\|grok-id>` / `off` | Run new subagents of that type (for example `Explore` or `explore`) on that model, unless the spawn names a model itself. Grok ids also write `[subagents.models]` in `~/.grok/config.toml` (restart Grok). Without arguments it lists what is pinned and the types you ran in the last 30 days. Needs `install --guard`; `results` counts the subagents it moved |
|
|
73
|
-
| `limitcast plan [--days N]`, `limitcast plan set <pro\|max5\|max20>` / `off` | Does your Claude plan fit how much you use? From a long-lived record of the peak of every 5-hour and weekly window (kept 120 days; it starts when you install this version) it says whether you reached your limits often enough to look at the next plan, or used so little that a smaller one would have fit, with the monthly price difference, and shows what your Claude Code tokens would cost at API list prices. Tell it your plan first with `plan set`. Plan prices (Pro $20, Max 5x $100, Max 20x $200) and the 5x / 20x multipliers are from claude.com/pricing (2026-10-26; the Max 20x price was not on that page: change any price in `prices.json`, `{"plans": {"max20": 200}}`). It assumes weekly limits scale like the 5-hour limit, and it cannot see extra-usage spend |
|
|
74
|
-
| `limitcast budget grok <usd>` / `off` / `7d <usd>` | Dollar cap for Grok's aligned 5-hour window (optional 7-day cap). Turns Grok spend into a % so `status` can forecast runout and the guard can block `spawn_subagent` |
|
|
75
|
-
| `limitcast after-reset [--src claude/codex] [--window 5h/7d] [--detach] -- <cmd>` | Wait for the window to reset, then run the command |
|
|
76
|
-
| `limitcast results --html [--out FILE]` | Results, current windows and the burn report on one page, opened in your browser |
|
|
77
|
-
| `limitcast install [--guard] [--alerts]` / `uninstall` | Wire into Claude Code / restore your settings |
|
|
78
|
-
| `limitcast doctor [--fix]` | Check the setup, data freshness, this project's auto-memory index (see `memory`), and that Claude Code, Codex and Grok logs are still in a format limitcast reads. Also runs daily in the background and flags problems in the status line (the memory line only shows when you run `doctor` yourself). `--fix` re-installs with the current Node (after a Node upgrade) |
|
|
79
|
-
| `limitcast grok-usage [on\|off]` | Grok's real weekly % used, from grok.com with the login Grok already holds (off by default; see Grok above for exactly what it reads and sends). With no argument it shows the current reading |
|
|
80
|
-
| `limitcast memory [dir]` | Check this project's auto-memory folder (`~/.claude/projects/<project>/memory`): how much of `MEMORY.md` fits in what Claude Code loads each session (the first 200 lines or 25 KB; anything past that is never read), broken links, topic files nothing links to, and files over 150 lines. Read-only. In Claude Code, `/limitcast:memory-audit` takes it from there (stale, contradictory and unlinked notes) and `/limitcast:memory-split` splits an oversized file into a short hub plus topic files |
|
|
81
|
-
| `limitcast report [--days N] [--out FILE]` | Tokens by tool, day, project, model and session; subagent share; and the API-equivalent cost: what the tokens would cost at the API's list prices (Claude and Grok models; a subscription is not billed this way). Prices are in the code as of 2026-10-26; add or change a model in `~/.local/state/limitcast/prices.json` (`{"models": {"claude-opus-4-1": {"input": 15, "output": 75}}}`, dollars per million tokens) |
|
|
82
|
-
| `limitcast report --why [--days N]` | Where your new tokens went: subagents, session starts, cache rebuilds after idle, tool results by tool, model output, and the largest single steps (Claude Code only) |
|
|
83
|
-
| `limitcast report --jobs [--days N]` | The scheduled (headless) jobs that spend the most tokens just starting: runs, average start, share of all new tokens, and how to launch a job leaner (Claude Code only) |
|
|
84
|
-
| `limitcast trim [--days N] [--share]` | Measured starting context of your latest session and how much you haven't used in N days (default 7). names each item. `--share`: totals only, no names, safe to post |
|
|
85
|
-
| `limitcast saved` | How much the part of your starting context you control has dropped since limitcast first measured it, times your sessions since |
|
|
86
|
-
| `limitcast trim --apply` / `--undo` | Hide the unused skills from the model and turn off the unused MCP servers for that project, through Claude Code's own settings. Backed up; `--undo` reverses exactly what it changed |
|
|
87
|
-
| `limitcast trim keep <name>[,<name>]` | Servers or skills no `trim --apply` (Claude, Codex or Grok) ever turns off or hides, e.g. `trim keep ego-browser`. `--remove <name>` drops one; no name lists them. Free to set; `trim` shows what it would keep |
|
|
88
|
-
| `limitcast results [--days N] [--share]` | Capacity report plus forecast evidence: each limit window that reached 100% and how far ahead limitcast warned, and what the guard blocked and whether that window then ran out. adds baseline context estimates. `--share`: voluntary totals only; nothing uploads automatically |
|
|
89
|
-
| `install --alerts` | A SessionStart hook that tells you (never the model) when your starting context grew ~1k+ tokens, and what grew, plus a one-line weekly summary of what limitcast did |
|
|
90
|
-
| `limitcast license` | Show the free MIT license status; no network call |
|
|
98
|
+

|
|
91
99
|
|
|
92
|
-
|
|
100
|
+
</details>
|
|
93
101
|
|
|
94
|
-
|
|
102
|
+
### Find the context you carry into every session
|
|
95
103
|
|
|
96
|
-
|
|
104
|
+
Run `limitcast trim` to inspect what your sessions load. It names unused skills and servers and estimates their starting-context cost.
|
|
97
105
|
|
|
98
|
-
|
|
106
|
+
Your findings depend on your local sessions. `trim` inspects first. Use `trim keep <name>` to protect essentials, `trim --apply` to make the changes, and `trim --undo` to reverse them.
|
|
99
107
|
|
|
100
|
-
|
|
108
|
+
## Three tools. One place to understand usage.
|
|
101
109
|
|
|
102
|
-
|
|
110
|
+
| Capability | Claude Code | Codex | Grok |
|
|
111
|
+
| --- | --- | --- | --- |
|
|
112
|
+
| Usage forecast | Status-line readings | Session logs | Dollar budget or opt-in weekly readings |
|
|
113
|
+
| Subagent guard | `Task` / `Agent` | `spawn_agent` | `spawn_subagent` |
|
|
114
|
+
| Token report | Supported | Supported | Per-turn ledger |
|
|
115
|
+
| Context trim | `trim` | `trim --codex` | `trim --grok` |
|
|
103
116
|
|
|
104
|
-
|
|
117
|
+
**Codex:** forecasts and reports read your existing logs without setup. `install --guard` adds the hook; approve it in Codex before it runs.
|
|
105
118
|
|
|
106
|
-
|
|
119
|
+
**Grok:** reports read local spend. Set a dollar cap with `limitcast budget grok <usd>` for forecasts and guarding, or opt into real weekly usage with `limitcast grok-usage on`. [Provider setup and qualifications →](docs/usage.md#install)
|
|
107
120
|
|
|
108
|
-
|
|
121
|
+
<a id="commands"></a>
|
|
109
122
|
|
|
110
|
-
|
|
123
|
+
## Pick your next move
|
|
111
124
|
|
|
112
|
-
|
|
125
|
+
| I want to… | Run |
|
|
126
|
+
| --- | --- |
|
|
127
|
+
| See usage, burn rate, and reset times | `limitcast status` |
|
|
128
|
+
| Find what's consuming tokens | `limitcast report --why` |
|
|
129
|
+
| Limit subagent spend to 15% of a window | `limitcast budget subagents 15` |
|
|
130
|
+
| Pace the weekly allowance day by day | `limitcast budget today on` |
|
|
131
|
+
| Get a desktop alert | `limitcast notify on` |
|
|
132
|
+
| Review activity and protection decisions | `limitcast results` |
|
|
133
|
+
| Check the project's memory index | `limitcast memory` |
|
|
113
134
|
|
|
114
|
-
|
|
135
|
+
[All commands, notification options, model controls, and setup details →](docs/usage.md#commands)
|
|
136
|
+
|
|
137
|
+
## Your data stays yours
|
|
138
|
+
|
|
139
|
+
Limitcast reads usage readings and session logs already on your machine. Reports remain local, sharing totals is voluntary, and no billing-service connection is required.
|
|
140
|
+
|
|
141
|
+
Two optional features make network requests, both **off by default**:
|
|
142
|
+
|
|
143
|
+
- **Phone or webhook notifications** send notification text to the service you choose.
|
|
144
|
+
- **Grok weekly usage** reads Grok's existing login and sends it only to grok.com to retrieve your usage. Redirects are refused; the login is never stored or logged by Limitcast.
|
|
145
|
+
|
|
146
|
+
Context reductions are estimates against a recorded baseline, not measured causal savings or a lower subscription bill. Forecasts depend on observed usage. [How forecasting and measurement work →](docs/usage.md#how-the-forecast-works)
|
|
147
|
+
|
|
148
|
+
<details>
|
|
149
|
+
<summary><strong>Technical reference and upgrade notes</strong></summary>
|
|
150
|
+
|
|
151
|
+
<a id="subagent-guard"></a>
|
|
152
|
+
|
|
153
|
+
**Subagent guard:** [Thresholds, overrides, receipts, and cold-cache behavior](docs/usage.md#subagent-guard).
|
|
154
|
+
|
|
155
|
+
<a id="how-the-forecast-works"></a>
|
|
156
|
+
|
|
157
|
+
**How the forecast works:** [Sampling, burn rates, weekly pacing, and account separation](docs/usage.md#how-the-forecast-works).
|
|
158
|
+
|
|
159
|
+
<a id="measuring-recurring-value"></a>
|
|
160
|
+
|
|
161
|
+
**Measuring recurring value:** [Baselines, time windows, and what the evidence can establish](docs/usage.md#measuring-recurring-value).
|
|
162
|
+
|
|
163
|
+
<a id="upgrading-to-0150"></a>
|
|
164
|
+
|
|
165
|
+
**Upgrading from before 0.15.0:** All features are free. Previously preview-only guards enforce after upgrading. [Behavior changes and opt-out](docs/usage.md#upgrading-to-0150).
|
|
166
|
+
|
|
167
|
+
</details>
|
|
168
|
+
|
|
169
|
+
## Build with us
|
|
170
|
+
|
|
171
|
+
Found a rough edge? [Report a bug](https://github.com/SamStull9007/limitcast/issues/new/choose). Ask questions in [Q&A](https://github.com/SamStull9007/limitcast/discussions/categories/q-a), propose improvements in [Ideas](https://github.com/SamStull9007/limitcast/discussions/categories/ideas), or [try it for a week](docs/community.md#try-it-for-a-week) and share a reviewed check-in. [Contributions are welcome](CONTRIBUTING.md).
|
|
172
|
+
|
|
173
|
+
```sh
|
|
174
|
+
git clone https://github.com/SamStull9007/limitcast.git
|
|
175
|
+
cd limitcast
|
|
176
|
+
npm test
|
|
177
|
+
```
|
|
115
178
|
|
|
116
|
-
|
|
179
|
+
<a id="license"></a>
|
|
117
180
|
|
|
118
|
-
[MIT License](LICENSE)
|
|
181
|
+
Created by **Sam Stull** · [MIT License](LICENSE) · [Release history](CHANGELOG.md)
|