AI usage and past sessions
Claude Code's and Codex's 5-hour and weekly limits on your phone, per account across your machines, and past agent sessions to pick up again in a new window.
AI usage
The apps show how much of their own usage limits Claude Code and Codex have used: the 5-hour window and the weekly one (and a model's own weekly limit when there is one), with when each starts over. Limits belong to your Anthropic or OpenAI account, not to a machine, so the app asks every machine it can reach and shows one card per account, with the machines that use it.
st usage # the same, on the computer
st usage poll off # st stops asking by itself (on to start again)
st hooks install --usage # read Claude Code's status line too
st hooks uninstall --usage # put your status line backEvery five minutes or so st (0.3.65 or later) asks Anthropic and OpenAI itself, with the logins
Claude Code and Codex keep on this computer, at the place each CLI's own
/usage asks. So the numbers are current while the agents sit idle, and the
first ones show a few seconds after st starts. There is nothing to install. An
st started with st --no-telemetry does not ask either.
- Codex also writes its limits into its session files, and st reads those too.
- Claude Code also gives its limits to its status line command. With
st hooks install --usagest becomes that command and gets the numbers after every answer; the status line you had (your own script, a HUD) keeps showing, because st runs it after itself with the same input. Withst usage poll offthis is the only way Claude Code's numbers arrive. - With more than one source, the newest reading wins;
st usagesays where its numbers came from. - Only a Claude.ai plan login (Pro, Max, Team) or a ChatGPT login has these limits; an API key does not.
On the phone: the AI usage row at the bottom of Machines ("Claude · 5h 42% · week 61%"), the machine's screen, and Settings. A bar turns amber at 80 % and red at 95 %, and you get one notification when a window passes either, however many of your machines use that account. A machine that is off keeps its last numbers, marked "Not updated since".
Tokens and account data
The login token used to ask goes to its own provider (Anthropic or OpenAI) and
nowhere else. st does not store it or refresh it; an expired one is skipped and
the last reading stands. The account is told apart by a hash of its id from
~/.claude.json (Claude) or ~/.codex/auth.json (Codex), shown as your masked
address (y***@example.com) and plan.
A machine signed in to your account carries the limits in the heartbeat it
sends link.sophonz.io every 30 seconds: the account hash, the masked address,
the plan, and each window's percentage and reset time. That is how the app
sees an account's limits without connecting to the machine. With st usage poll off or st --no-telemetry the heartbeat carries none, and the app reads
them from the machine through its own link. The 80 %/95 % notification is
encrypted to your phone apart from the agent and the level.
Goal and usage guard
From st 0.3.113 a Claude Code pane can be given a goal to keep working at, and st can stop such a loop before it eats the week's limit. Both are an answer of the Stop hook st already installs (agent hooks); nothing new runs and nothing is typed into the pane.
st goal set "fix the tests until they all pass, then st goal clear"
st goal set --file goal.md # a longer goal
st goal # this pane's goal
st goal clear # take it off
st goal set --pane %12 "…" # another pane of the same tmux server
st usage guard on # stop loops that run too fast (off by default)
st usage guard status # on or off, and what it would decide now, per agent
st usage guard off- A goal is a file in
~/.sophonz/goalsthat the pane's@st-goaloption names. Each time the agent ends its turn, st hands the goal back and it goes on, until it runsst goal clear(it is told to once the goal is met or cannot be). Only Claude Code follows it. - The guard looks at the weekly window. It stops a loop's turn, an
st goalone or Claude's own/goal, when the share left is more than 10 points behind the share of the week left (it is spending faster than the week), or under 10 %. The 5-hour window is not guarded, but the reason it gives says when that window resets. - With no reading, or one older than an hour, the loop goes on;
st usage guard statusshows that agent as "no data" and why. - Codex is not guarded: its
/goaldoes not stop for a Stop hook, andst usage guard statussays so on its line. - The settings are
~/.sophonz/usage/guard.json, e.g.{"on": true, "agents": {"claude": {"m": 0.1, "floor": 0.1}}}.
Past sessions
Resume a past session on a machine's screen (History on Android, and in a session's menu)
lists the Claude Code and Codex sessions on that computer, newest first: a
title (the name you gave it with /rename, or the first thing you typed),
its folder, when it was last used and how many messages. Tap one, pick the
tmux session, and st opens a new window in that folder and runs
claude --resume <id> or codex resume <id> in it.
st history # the same list, here
st history --cwd . # only this folderOnly that title line leaves the session file; the rest of the conversation stays on your computer. Resuming needs tmux.