Skip to content

Sessions & context

Agent Switch knows every session that ran on each of your accounts. You can see which ones are running right now, how full each context window is, and whether continuing costs a full re-read of the conversation. It reads this from your own session files, on your machine. No API calls are involved.

Terminal window
agent-switch sessions # recent and running sessions, grouped by account
agent-switch sessions work # one account
agent-switch sessions --recent 20 # more history

Running sessions are marked. For Claude Code, a running session also shows:

  • context %: how full its context window is, e.g. 67% · 134k/1000k. This matches what Claude Code’s own /context reports. For an unknown model you see the raw token count, never a guessed percentage.
  • prompt cache: whether the cache is still warm (cache warm till 10:42) or what the next turn will re-send once it is cold (cache cold · ~182k re-sent).

Codex sessions show their context from the session’s own log.

The desktop app shows the same in Sessions, with a preview of each session’s first turns.

Several sessions on one account share its limits, and both keep the same login fresh. It is easy to end up there by accident, for example when two terminals start claude on the same preferred account. The single-session guard notices this:

PolicyWhat a second start on a busy account does
warn (default for new installs)Starts, and tells you the account is already in use.
blockStarts on the best free signed-in account instead, and says so. When every account is busy, it shares the best one.
offStarts without comment.
Terminal window
agent-switch guard block

A claude started inside a running session counts as part of it, not as a second session. A crashed session leaves nothing behind that could lock you out. To allow one duplicate start on purpose, set AGENT_SWITCH_ALLOW_DUPLICATE=1 for that command.

Context alerts Claude only

Section titled “Context alerts ”
Terminal window
agent-switch alerts on --threshold 80,95

When a running session’s context passes a threshold, the background service records one notice with the project, the percentage and a suggested /compact. Alerts are off by default.

For precise session state, install Agent Switch’s hooks into an account’s Claude Code settings:

Terminal window
agent-switch hooks install work

They report when a session starts, stops, compacts or waits at a usage limit, and why a turn stopped (for example a usage limit or a sign-out). The hooks are added next to your own and removed cleanly with hooks uninstall. Run hooks install again after an update to pick up new events.

Compacting from outside macOS & Linux

Section titled “Compacting from outside ”
Terminal window
agent-switch run work --tmux # start a session in a managed tmux pane
agent-switch compact work # later: type /compact into it

compact only types into a pane that Agent Switch started with run --tmux. It refuses while a turn is running unless you pass --force. Anywhere else it prints the command for you to run. --clear sends /clear instead, which discards the conversation, so it also needs --force. Nothing is ever compacted automatically.