spare10-mod
A quota circuit breaker for Claude Code and the OpenAI Codex CLI.
It keeps the last part of your 5-hour and weekly quota windows for you.
The idea comes from spare10 by Alessandro Diano.
spare10 wraps the claude command and stops Claude Code before the quota runs out.
spare10-mod keeps the idea and moves it into the agent, as a plugin.
Many texts and rules come from spare10.
Thank you, Alessandro.
spare10-mod is early access software.
In Claude Code, it uses function hooks, an early access feature of Claude Code 2.1.281 and later.
In Codex, it uses plugin hooks and a small MCP server. It is tested on Codex CLI 0.157.0.
The plugin name is spare10 in both.
What spare10 does
spare10 watches two quota windows: the 5-hour window and the weekly window.
By default, it keeps the last 10% of each window for you.
At the reserve of either window, spare10 holds all work at the next step.
It then asks you one question: Stop here or Resume.
- Resume continues all held work from the point where it stopped.
It lasts until the floor, by default until 5% is left.
There spare10 asks a second time.
A second Resume lets the work use the rest of the window.
- Stop here ends the work at its next step.
The session stays open.
At 100% used, spare10 holds all work until the reset, and asks once: Continue at the reset or Stop here.
Near the reset, a reserve that you do not use is lost.
So spare10 opens the reserve in the last 20 minutes of the 5-hour window and the last 8 hours of the weekly window.
Then, or after the reset, spare10 continues held and stopped work by itself.
You can switch each of these off.
Quick start
Claude Code
-
Switch on function hooks.
Put this env entry in ~/.claude/settings.json:
{ "env": { "CLAUDE_CODE_ENABLE_FUNCTION_HOOKS": "1" } }
If the file has an env block already, add only the CLAUDE_CODE_ENABLE_FUNCTION_HOOKS line to it.
This flag switches on function hooks for every installed plugin that has a hooks module.
Before you start tells you more.
Or add the entry with one jq command
Run this command in bash, zsh or sh. It needs jq. macOS has jq in /usr/bin.
sh -c 'f="${CLAUDE_CONFIG_DIR:-$HOME/.claude}/settings.json"; s="$f"; [ -e "$f" ] || s=/dev/null; t=$(mktemp) || exit 1; jq -s "if length > 1 then error(\"more than one JSON value\") else (.[0] // {}) | .env.CLAUDE_CODE_ENABLE_FUNCTION_HOOKS = \"1\" end" "$s" > "$t" || { rm -f "$t"; exit 1; }; mkdir -p "$(dirname "$f")" && cat "$t" > "$f" || { echo "Could not write $f. The new settings are in $t" >&2; exit 1; }; rm -f "$t"; echo "Function hooks are on in $f"'
The command keeps your other settings. jq rewrites the file with two-space indentation.
If jq cannot read or parse the file, the command shows an error and changes nothing.
If you export CLAUDE_CONFIG_DIR, the command uses that folder, as Claude Code does.
Run it once for each config folder that you use.
-
Install the plugin:
claude plugin marketplace add chrisns/spare10-mod
claude plugin install spare10@spare10
The install can say that 12 userConfig options are not set yet.
You do not have to set them. The defaults apply until you change them in /config.
-
Start a new Claude Code session in a terminal.
spare10 arms itself. You do not need a command.
The footer shows ⧗ spare10 until spare10 reads your quota. Then it shows ● spare10.
Type /spare10 to see the full status.
If spare10 does not load in Claude Code
- Type
/ to see the command list. If /spare10 is not in the list, spare10 did not load.
- Make sure that you use Claude Code 2.1.281 or later.
- Check step 1 and step 2, then start a new session.
- Claude Code ignores a settings file that has an error in it.
Run
claude doctor. If it shows Invalid settings, correct that entry.
- A
"0" in the env block of a project's .claude/settings.json switches function hooks off in that project.
- The desktop app and the IDE hosts are unattended.
There, spare10 only watches by default.
See Unattended runs.
Codex CLI
You need Node.js 20 or later.
spare10 looks for it in Homebrew, in /usr/local/bin, in /usr/bin and in Volta.
Then it tries the versions of nvm, mise, asdf and fnm, and last your PATH.
spare10 runs it outside the Codex sandbox.
Differences in Codex item 26 says where to install it.
-
Install the plugin:
codex plugin marketplace add chrisns/spare10-mod
codex plugin add spare10@spare10