claude-focus
One priority queue over all your running Claude Code sessions, in iTerm2 or herdr.
If you run ten or twenty Claude Code sessions at once, a lot of time goes into finding the one that needs you. claude-focus watches every session, scores what each one needs from you, and shows them in one list: what needs you first, then your to-dos, the sessions that wait for something external, the ones that work, the ones that are done, and your free terminals. Enter takes you to the selected session's pane. When you answer, the session works on, and the next one is selected.
It also lets a session wait for something external (a reply, a deploy, a date) without sitting in your queue. When the time comes or a check command succeeds, claude-focus types a wake-up message into the session, and Claude continues by itself.
What it does:
- One queue over every Claude Code session, ranked by how much each one needs you, with the one-line request it has for you.
- Scoring by a headless
claude -pcall on your own Claude Code login, or by the much cheaper jev model with a TypeSafe or OpenRouter key (see "Scoring"). - Pending waits: a session waits for a time or a check command, leaves your queue, and is woken up with a message in its prompt.
- Free terminals: panes at a bare shell, where a new session starts in a folder you pick by typing a few letters.
- iTerm2: global hotkeys, a green profile for free panes, and a restore of every window after a crash or a restart.
- herdr: the queue in herdr's own sidebar, herdr keys to jump to the session that needs you most, and no setup in the terminal itself.
iTerm2 and herdr
claude-focus finds each session's pane, reads its screen, types wake-up messages and brings panes to the front through the terminal's API: the iTerm2 Python API or herdr's socket API. Everything else (the queue, the scoring, the waits) is the same in both.
| iTerm2 | herdr | |
|---|---|---|
| API | The Python API (turn it on in iTerm2's settings) | herdr's socket ($HERDR_SOCKET_PATH, else ~/.config/herdr/herdr.sock) |
| Finding a session's pane | The pane with the tty of its process | The pane whose foreground runs its process; else the session id that herdr's Claude Code hook reported |
| An empty prompt (safe to type into) | The screen and the cursor position | The screen and its colors: suggestion text is dim, a draft is not |
| Enter on a session | Brings its window to the front and maximizes the pane | Focuses its pane in any workspace and zooms it in its tab |
| Free terminals | Panes with the green Available profile |
Every pane at a bare shell, no setup |
| Keys from anywhere | Optional global hotkeys: ⌃⌥N (go), ⌃⌥F (focus screen) | herdr keys that setup adds: prefix+a (go), prefix+f (focus screen) |
| The queue outside the focus screen | — | In herdr's sidebar (pane metadata tokens) |
| The focus screen opens in | A new iTerm2 window | A new herdr tab |
| After a crash or a restart | claude-focus restore and reboot reopen every window |
herdr keeps its panes and resumes the sessions |
| Changes show | Every 3 s | At once (herdr's events), and every 3 s |
| Theme of the focus screen | iTerm2's dark or light theme | macOS's dark or light appearance |
iTerm2 is a terminal of its own. herdr runs in any terminal (Ghostty, Terminal.app, Warp, iTerm2, ...), so with herdr any terminal works; without it, only iTerm2 does. Sessions that run inside tmux, in another herdr session or on a remote machine show without a pane.
Which terminal
Config terminal ("auto", "iterm" or "herdr") decides first. With
"auto" (the default), a focus screen or command inside an iTerm2 pane uses
iTerm2, and one inside a herdr pane uses herdr. A herdr pane can carry
iTerm2's variables too (when iTerm2 started the herdr server); then herdr
wins.
The background service runs in neither, so it asks both. When only one
runs, it takes that one. When both run, it takes the one that runs more of
the live Claude sessions, by their parent processes: a pane's shell is a
child of iTerm2 or of the herdr server. This needs no API and no
permission. The service looks again every minute and restarts on the other
terminal when your sessions move there. claude-focus status says which
terminal it uses, and whether it was detected or set in the config.
When neither runs and Claude Desktop hosts sessions, the service runs without a terminal (see "Claude Desktop"). It looks every 5 s then, and restarts on a terminal that starts.
Requirements
- macOS, or Windows 11 with herdr (see "Windows").
- iTerm2 with its Python API on, or herdr (tested with 0.9.5, API protocol 22).
- Python 3.10 or newer.
- Claude Code (tested with 2.1.29x to 2.1.322). claude-focus reads Claude Code's own session files, which are not a public API, so a Claude Code update can break it.
This is an early release. It runs every day on one Mac with about 20 sessions; expect rough edges elsewhere, and please open an issue.
Install
In iTerm2, first turn on its Python API (Settings > General > Magic > Enable Python API), then run these two commands in iTerm2. In herdr, run them in one of its panes. On Windows, see "Windows" below.
brew install nejko/tap/claude-focus
claude-focus setup
Homebrew brings its own Python. Without Homebrew, install it with uv:
uv tool install claude-focus (see docs.astral.sh/uv),
or with pipx: pipx install claude-focus. The newest code from GitHub,
before it is released: uv tool install git+https://github.com/nejko/claude-focus.
claude-focus setup does the rest and tells you what it did. You can run it
again at any time; it skips what is done. It:
- checks for macOS, the terminal and
claude, and connects to the terminal. The first time in iTerm2, macOS asks whether claude-focus may control iTerm2: allow it. - asks your name, for the messages to sessions
(
~/.claude-focus/config.json). - adds the prompt hook to
~/.claude/settings.json(see "Pending waits" and "CLAUDE.md changes"). - adds a short rule to
~/.claude/CLAUDE.md, so that sessions know how to wait (the text is in claude_focus/claude_md_rule.md). - sets up the terminal:
- iTerm2: asks whether you want free terminals, adds a green iTerm2 profile and lets claude-focus switch panes to it (see "iTerm2").
- herdr: offers herdr's Claude Code integration (
herdr integration install claude), and two herdr keys in~/.config/herdr/config.toml(see "herdr").
- starts the background service, a LaunchAgent that starts at login and
restarts after a crash or when the terminal restarts. It gets the PATH of
the shell you run setup from: the scorer needs
claude, and your check commands need their tools. - opens the focus screen in a new iTerm2 window or herdr tab. Keep it open.
Before it changes settings.json, CLAUDE.md or herdr's config.toml the
first time, setup keeps a copy next to it (.before-claude-focus).
claude-focus setup --dry-run shows what it would do; --yes takes the
defaults without asking.
The scorer follows the rules in ~/.claude-focus/priorities.md. Edit them
to say what matters to you.
Upgrade
The service looks on PyPI once a day for a new version. When one is out,
the focus screen says so under its title, and U installs it the way you
installed claude-focus (brew update and brew upgrade claude-focus, uv tool install claude-focus@latest or pipx upgrade claude-focus), then runs claude-focus setup --yes, which restarts the service on the new code; quit the focus screen
(q) and open it again for the new version there too. claude-focus update does the same from a terminal, and
claude-focus status says which version runs and whether a newer one is
out. The Homebrew formula follows a PyPI release a little later; until it
does, U says that brew has nothing newer yet. A copy that runs from a git
checkout is never offered an update. "check_updates": false turns the
daily look off.
With "auto_update": true (off by default), the service installs a new
version by itself: between 01:00 and 05:00, or within 15 minutes after it
started (a laptop that is off at night updates after the next logon), and
never while a session works. It closes the focus screen (Esc, then q),
starts the install in a script of its own (on Windows the install replaces
the files that the service and the focus screen run from, which Windows
does not allow while they run), and that script runs claude-focus setup --yes; the new service opens the focus screen again in the same pane. The
script writes to ~/.claude-focus/update.log. A failed try is repeated
after 6 hours. claude-focus update --detached does the same at once.
By hand: brew upgrade claude-focus && claude-focus setup, or with uv
uv tool upgrade claude-focus && claude-focus setup (setup restarts the
service on the new code).
Uninstall
claude-focus uninstall removes the service, the hook, the CLAUDE.md rule,
the green iTerm2 profile and the herdr keys, and keeps your state in
~/.claude-focus (--purge removes it too). Then
brew uninstall claude-focus, or uv tool uninstall claude-focus.
Development
Clone the repo, python3 -m venv .venv && .venv/bin/pip install -e '.[jev]', and run .venv/bin/claude-focus (or
link bin/claude-focus onto your PATH).
Commands
claude-focus # the focus screen (in its own iTerm2 window or herdr tab)
claude-focus setup # set everything up, or check it again (--desktop: sessions in Claude Desktop only)
claude-focus list # print the queue once (--json: as queue.json holds it)
claude-focus go # go to the session at the top of the queue
claude-focus go <session> # go to that session; also done and snooze <session> (see "The queue for another view")
claude-focus show # bring the focus screen to the front, or open one
claude-focus pending ... # from inside a session: wait for something external
claude-focus ask ... # from inside a session: queue a question for you (see "Questions that do not block")
claude-focus restore # iTerm2, after a crash: open the sessions of the last iTerm2 run again
claude-focus reboot # iTerm2, before a planned restart: save the layout, stop working sessions
claude-focus search <words> # past sessions with these words, and the command that resumes each
claude-focus index # bring the search over past sessions up to date (the service does it every minute)
claude-focus update # install a newer version, the way this one was installed (see "Upgrade")
claude-focus cost # scorer calls and spend per day
claude-focus status # which terminal, and is the service running?
claude-focus uninstall # undo setup
go and show work in both terminals; the herdr keys run them.
The focus screen
The sections, top to bottom:
- NEED YOU: the session waits for your answer, ranked by priority. A
session whose turn ended with a request to you while its background
shells still run (a page to pick from, a dev server to try) is here too,
marked
◌ shells. - YOUR TO-DOS: the session waits for something external and left you a task meanwhile (send a draft, sign, pay). Oldest first.
- PENDING: the session waits for a time or a check, or you snoozed it. Next wake-up first.
- WORKING: the session is busy, or its background shells still run and it
only waits for them: when they end, it continues by itself. The scorer
reads such a turn too, and it moves to NEED YOU when it asks you for
something and jev is sure enough of that (confidence 0.4 or more; an
unsure one stays here until its shells end). A session that has just answered waits here too, as
scoring, until its score comes (with jev about 6 seconds, with the Claude scorer about 20); if the score takes longer than 2 minutes, it goes to NEED YOU unscored. - FREE: nothing is needed; you can close or reuse the terminal. A session
that only reported (kind info) comes here by itself once you have been in
its pane after it answered (
seen);d(done) sends any other here until it changes. A Claude Desktop session holds no terminal, so it does not show here: when it needs nothing (or you mark it done) it leaves the list, and it comes back when it works or needs you again. - AVAILABLE TERMINALS: free panes, ready for a new session (see "Free terminals").
Every section uses one grid, so each column is always in the same place: a lead (in NEED YOU the priority as a number and a bar whose length is the priority; in PENDING the wake time), an age (how long it has waited for you, worked or slept; in PENDING the time until it wakes), the name, the folder the session runs in, a kind (decision, action, check, wait, snoozed, busy, shells, scoring, ...) and the text. The folder column is as wide as the longest folder on the screen, at most 40 columns; a longer folder keeps its end. Windows narrower than 110 columns drop the folder column (WORKING then shows the folder as its text), and below 100 columns also the kind column.
Each section has its own color. A priority of 80 or more is red, of 60 or more amber, and the rest grey. Alerts are red: a wake-up that could not be typed, a duplicate window, a session without a pane. What needs you is bright, PENDING and WORKING are softer, and FREE is grey. The selected row has a tinted background and a ▌ at the left. The screen uses 24-bit color and follows the terminal's dark or light appearance: iTerm2's, or macOS's in herdr.
Themes
t shows the next theme on the screen at once, and T the one before
(the arrow keys step too). The key line says which theme it is. Enter
keeps it in the config ("theme"), and Esc goes back to the theme you had.
| Theme | What it imitates |
|---|---|
default |
The look described above, on the terminal's own background |
norton |
Norton Commander: light cyan on blue in a double-line frame, a black-on-cyan bar, the 1Help key bar |
midnight-commander |
Midnight Commander: light grey on blue in single-line frames, the panel title and bar black on cyan |
qbasic |
Microsoft QBasic: light grey on blue in a window titled Untitled, keys as <n=session> on a cyan status line |
turbo-pascal |
Borland Turbo Pascal 7: yellow on blue in a white double-line window FOCUS.PAS, the bar black on green, red key names |
clipper |
A Clipper application (SET COLOR TO W+/B,N/W): white on blue, a double-line box, the bar and status line black on grey |
wordperfect |
WordPerfect 5.1: light grey on blue, a block light grey on red, Doc 1 Pg 1 Ln 1" Pos 1" at the bottom right |
award-bios |
Award BIOS setup: yellow on blue in a white box titled CMOS Setup Utility, a ► and a white-on-red bar |
total-commander |
Total Commander on classic Windows: black on white, the title and cursor bar white on navy, grey key buttons |
cobiss |
COBISS/OPAC on the amber DEC VT420/VT510 terminals of Slovenian libraries, with the prompt Izbira: (a reconstruction) |
c64 |
Commodore 64: light blue capitals on blue in a thick border, **** COMMODORE 64 BASIC V2 **** |
ladder |
The game Ladder on a Kaypro II: one P31 green, floors =, walls |, ladders H, Lad p at the selected row |
green-screen, amber-screen |
A monochrome monitor: one phosphor color in four strengths, reverse video bars |
claude-code |
Claude Code's own colors (dark or light): claude orange, a rounded box titled ✻ claude-focus, the selected row in its suggestion blue with ❯ |
dracula, nord, tokyo-night |
The color schemes, each on its own background |
solarized, gruvbox, catppuccin |
The color schemes, dark or light with the terminal (Catppuccin: Mocha or Latte) |
The retro themes paint their own background, so they look the same in a
dark and a light terminal. Their colors come from the programs where a
source exists: the MS-DOS 6.0 source for QBasic, TURBO.EXE 7.01 for Turbo
Pascal, WordPerfect's default Setup colors, a screenshot for Award BIOS,
the Pepto palette for the C64, LADDER.COM 1.30 for Ladder, and Claude
Code 2.1.306 for Claude Code. For COBISS, IZUM's newsletters confirm the
DEC VT terminals, but no picture of the text-mode OPAC was found.
A theme is a palette in claude_focus/themes.py.
Its docstring lists the keys that change how the screen is drawn: paint,
frame, box, title, select, marker, bar, keys, rule,
status and upper.
The selection starts on the first row of NEED YOU (else of YOUR TO-DOS). After Enter, it goes back there. The rows never move when the selection moves; a long list scrolls to keep the selected row visible. While the focus screen has the keys, its title bar is green (in a theme, the theme's color).
Keys
| Key | Action |
|---|---|
| Enter | Go to the selected session; its pane is maximized (in herdr: zoomed). If it asks a question, the focus screen comes back when you submit the answers. On a free terminal: choose a folder for a new session there (see "Free terminals") |
| ↑ ↓ (or k j) | Select another row. The list wraps: ↓ on the last row selects the first, ↑ on the first selects the last |
| / | Find: type, and the list keeps only the sessions whose name, folder or text has what you typed (case does not matter), marked where it is; the first one is selected. ↑ ↓ select among them, Enter goes to the selected session, Esc ends the find: the whole list again, with the selection on that session (so s, x or z act on it) |
| n | Start a new session: choose a folder for the first free terminal |
| Esc | Select the top of the queue again |
| s | Snooze the selected session: 1 h, 3 h, tomorrow 09:00, Monday 09:00, or a time you type |
| u | Unwait: end a snooze, a pending wait or a "done" mark |
| p | Set a manual priority (0 = back to automatic) |
| d | Done: nothing is needed now; the session comes back when it changes. On a to-do: your part is done |
| x | Close the selected session: after y (none with "confirm_close": false), claude-focus types /exit into its empty prompt. Only for a session whose turn has ended (not one that works, asks a question or waits for its background shells). Its conversation stays: a free terminal finds it again (see "Past sessions") |
| z | Sleep: end the selected session now and keep its place (see "Sleeping sessions"); on an asleep session: resume it in its pane |
| Z | Keep the selected session awake (again: it may fall asleep) |
| r | Score the selected session again |
| R | iTerm2: restore the windows of the last iTerm2 run (shown only when some are closed) |
| t, T | Show the next theme, or the one before; Enter keeps it, Esc goes back (see "Themes") |
| U | When the screen says a new version is out: install it (see "Upgrade") |
| i | Settings: see and change the main settings (see "Configuration") |
| q | Quit |
From anywhere: in iTerm2, two optional global hotkeys ("hotkeys": true in
the config): ⌃⌥N goes to the top session and ⌃⌥F brings the focus screen to
the front. In herdr, prefix+a and prefix+f do the same (setup adds both
keys).
There is no free skip: to move the top session down, snooze it. Its row shows how many times you did.
After Enter on a session that asks a question (AskUserQuestion), the focus screen comes back to the front when you submit the answers. It stays in the session when you press Esc or pick "Chat about this", when the dialog was a permission prompt, and when you went to another pane or app first.
Scoring
When a session has waited for 4 s (jev) or 15 s (Claude scorer), and you
are not in its pane, a scorer reads the bottom of its screen, its last
message and your ~/.claude-focus/priorities.md, and rates how much it
needs you now:
- a priority from 1 to 100 (five levels, from "nothing needed" to "drop everything"),
- a kind: decision, action, login, review, info or nothing,
- the effort in minutes.
When the scorer fails, claude-focus looks at why. A network outage (no connection, DNS) or trouble at the scorer's service pauses scoring for every session, 30 seconds after the first failure and up to 5 minutes after more, and then one session is scored to see whether it works again; the focus screen says nothing for the first 3 minutes and then, in amber, since when and when the next try is (sessions keep their last scores). A refused key or login, or a used-up limit, shows at once in red with what to do, and is tried again every 10 minutes. The log notes when the scorer works again.
The same scorer rates every session, so the numbers can be compared. A session is scored again every 12 hours. The rank is the score plus 0.15 per hour of waiting (at most +10), so a neglected session cannot sink forever, but a medium item never passes a critical one. A session that asks a question is always in NEED YOU, whatever its score.
There are two scorers (config scorer):
-
claude(the default): a headlessclaude -pcall with your own Claude Code login, on Sonnet 5.5 (scorer_model). It also writes the one-line request, a reason, deadlines and wake-up times. About $0.010 per call (no CLAUDE.md, memory, MCP servers or thinking; a 5-minute cache). -
jev: TypeSafe's jev model answers typed questions with probabilities. About $0.0001 per call. It needs a key and the jev extra, which needs the uv install:uv tool install --force 'claude-focus[jev]'.jev works with OpenRouter. Give it either key, in the environment or in
~/.config/claude-focus/credentials(oneNAME=valueper line, mode 600):TYPESAFE_API_KEY: jev through TypeSafe.OPENROUTER_API_KEY: jev through OpenRouter, at the same price, billed to your OpenRouter account.
A TypeSafe key wins when both are set.
jev writes no text. An open question shows with its own text. Otherwise, when jev says the session needs you, Claude Haiku 5.5 (
ask_model) writes the one-line request from the last message and the screen: the immediate next step, in the message's language (in Slovenian with"language": "sl"). That is a secondclaude -pcall for those sessions only, measured at $0.0002 to $0.0006. With"ask_model": "", or when that call fails, the line comes from the session itself: the first item under a "Needed from you" style heading, a "nothing needs you" sentence, Claude Code's recap line, or the first sentence of the last message.
At 150 to 350 calls a day, the claude scorer costs about $45 to $105 per 30
days, jev about $0.50 to $1. claude-focus cost shows the real numbers.
When the scorer fails, the focus screen shows the error in red, and new
sessions wait unscored at 50.
Pending waits
A session that waits for something external runs this from its Bash tool:
claude-focus pending --until 09:00 --note "launch check"
claude-focus pending --check '<command; exit 0 = it happened>' --every 10 --until "2026-10-02 18:00" --note "the v2.0 tag"
claude-focus pending --check '<command>' --until "+1d" --note "the export" --needs "Review and send the draft"
claude-focus pending --show | --clear
The session leaves your queue and shows under PENDING. When the time comes or the check exits 0, the engine types a one-line wake-up message into the session's prompt and submits it, so Claude continues by itself. The message tells Claude to ask you before any irreversible or outward-facing step.
The wait starts when the turn that set it ends, also when background shells
that the session started still run (◌ shells): its prompt takes the
wake-up all the same.
pending --check runs the check once when it is set. If it exits 0 already,
no wait is set and the session hears why: such a wait would wake it as soon
as its turn ends, and again after every turn that sets it.
With --needs, the session shows under YOUR TO-DOS with that request until
you press d, and the wait still wakes it. A task for later takes
--needs-from (--needs "Upload the bank statements" --needs-from "2026-11-19 07:30"): until then the session stays under PENDING, with "your task from
Thu 07:30" in its row, and at that time the task comes under YOUR TO-DOS.
A wait set in a turn that answers your message gets the to-do "Read its answer to your message", so the answer does not go straight to PENDING unread. The to-do is done when your keys are in the session's pane after the turn ended. The same holds when a background task started a later turn and that turn set the wait.
When you type into a waiting session, the wait ends. Other prompts keep it: a background task notification, a message from another session, the answer to a question dialog, and an idle compaction that Claude Code starts by itself. When the status changes after a wait was set, the engine reads the transcript, and only a prompt that you typed ends the wait.
The UserPromptSubmit hook tells Claude at once that your typing ended its
wait, and gives it the exact command to set the same wait again. Without the
hook, the engine still ends the wait, but Claude does not learn it.
claude-focus setup adds it to ~/.claude/settings.json, and running
sessions pick it up without a restart. By hand, it looks like this:
"hooks": {
"UserPromptSubmit": [{"hooks": [{"type": "command",
"command": "/Users/YOU/.local/bin/claude-focus hook prompt-submit", "timeout": 10}]}]
}
Claude Code gives the hook no origin field, so the hook recognizes a task notification or a message from another session by the start of its text.
Safety rules of the waker:
- It types only into an empty prompt: never over a draft, never into an open question. In iTerm2 it reads the screen and the cursor position; in herdr, which gives no cursor, the screen and its colors (Claude Code's suggestion text is dim, a draft is not). If typing is not safe, the session goes into NEED YOU with a red wake-up note (priority at least 70), and the wake-up is typed later, when the same session is at an empty prompt again and you are not in its pane.
- A wake-up that an open question dialog held back is typed after you answer it: answering lets the turn go on, and the wake-up follows, once, when that turn has ended. It is dropped when the session set a newer wait meanwhile, when you marked the session done, or after 24 hours. The same holds in Claude Desktop, through the mod.
- Only one process runs the waker (the service, or a focus screen when no service runs), so a wake-up is never typed twice.
- A check's output is not put into the wake-up message (it can carry text
from outside, such as an e-mail).
"wake_check_output": trueturns it on.
A wake-up can also fail after it was typed: Claude Code gives up on a
request (an overloaded API, a lost network) and ends the turn with an API
error before the model has read the message. The wake-up has used up the
wait, so nothing would wake the session again. When the turn after a
wake-up ends that way, claude-focus types the wake-up again, with a note
that says why, after 1, 2, 5, 10, 10 and 10 minutes (at most six times, and
not later than an hour after the first failure). Meanwhile the session
waits under PENDING (re-send) and is not put to sleep. A refused key, a
used-up limit or any other error that a retry does not fix, and the last
failed try, put it under NEED YOU with the reason (WAKE-UP wake-up failed 7 times in 50 min: API Error 529 Overloaded). A turn that ended with an API
error after the model had worked is not sent again; like any session whose
last turn ended with an API error, it goes under NEED YOU (Its turn ended with an API error), whatever its screen shows, and no scorer call is made
for it. Claude Code itself retries for a while first (with
CLAUDE_CODE_RETRY_WATCHDOG=1, up to an hour per request); the session is
busy all that time, and claude-focus never types into it then.
Questions that do not block
An open AskUserQuestion dialog blocks its session until you answer: the wake-ups of its wait, Monitor events and the results of background tasks all wait for you. A session that waits for something and needs your answer too can queue the question instead:
claude-focus ask --question "Merge MR !412 now?" \
--option "Merge now::it passed review" --option "Wait::after the demo" \
--default "the MR stays paused" --costly-after "+2h"
claude-focus ask --json '{"questions": [...]}' # up to four, as for AskUserQuestion
claude-focus ask --show | --clear
The question shows under YOUR TO-DOS (?, with what the session does
meanwhile), the session works on or ends its turn, and its wait still wakes
it.
It is for a turn that a wake-up, a background result or another session
started, when you may be away. When you typed the message that the turn
answers (in the last 15 minutes), you are at the keyboard: ask refuses and
tells the session to ask with AskUserQuestion at once and set its wait
again after your answer (--away queues anyway, when you said you are
leaving). The prompt hook says the same on every message you type into a
session that waits. A session has one queued record of up to four
questions: a second ask is refused unless it has --replace (the output
names the question it drops), so put related questions into one --json
call. --clear q74 removes that question only; --clear alone removes
whatever is queued and names it. Questions whose --costly-after time has passed come first among the
to-dos, marked "costly since". Enter on one takes you to the session and
types [claude-focus ask] … is here for your question q3: "…". Ask it now with AskUserQuestion into its prompt (only an empty one; a working session
takes it after its step), so the real dialog opens while you are at the
keyboard; the queued copy is gone then (--show still prints it). d
removes a question you answered some other way. When you type into the
session yourself, the question leaves your queue at once: you are at the
keyboard, so the prompt hook hands it back to the session, which takes what
your message answers and asks the rest with AskUserQuestion in that turn.
A session that sits in an open dialog shows ◆ dialog open and how long,
in NEED YOU. ask_nudge never reminds a session that has a question queued.
The rule that setup adds to ~/.claude/CLAUDE.md says when to use which,
and setup now replaces an older version of that rule with the current one.
Sleeping sessions
Every Claude Code session is a process that holds its memory while it only
waits: 23 sessions used 9.4 GB on a 32 GB Mac, with their MCP servers
(2026-11-12). With "sleep_after_min": 10 (i, or config.json; off by
default), the engine ends a session that has been under PENDING or FREE for
10 minutes with /exit, and resumes it when it is needed:
- when its wait wakes it:
cd <folder> && claude <flags> --resume <id> "<wake-up message>"in the same pane, so the wake-up is its first prompt; - when you press Enter on its row (a queued question or a late wake-up is
then its first prompt), or
z(it wakes where it is, without taking you there); - when you go to its pane yourself (a click on its tab): it resumes there.
Its row stays where it was, marked ☾ asleep, with its score, wait and
question; claude-focus keeps them under the session's id. Its pane stays
too, at a shell: it is kept for the session, so it is not a free terminal.
If you close that pane, a session that waits for something wakes in a new
window; one that waits for nothing leaves the list (its conversation stays
in "Past sessions"). x on an asleep session removes it from the list.
A resume costs no more tokens than staying open: the prompt cache is on
Anthropic's servers, not in the process. In 10 of 11 resumes within the
cache's hour, a session read 92 to 100 % of its context from the cache (the
live test: 54,674 tokens read, 679 written). Only another model reads
nothing, so the resume keeps the model and effort of the session's last
turn (--model, --effort) and the flags of its command
(--dangerously-skip-permissions, --permission-mode, --add-dir).
What a /exit would lose keeps a session awake:
- background shells, Monitor and background agents (Claude Code's status is
then
shell, notidle); - a cron job (CronCreate: only in the session's memory) or a
/loopwake-up (ScheduleWakeup), read from its transcript; - a conversation with another session in the last 24 hours (its messages would find no process);
- a draft in its prompt, an open question, your keys in its pane, a wait that wakes it within 5 minutes, two processes of one conversation.
Z keeps the selected session awake until you press Z again. The first
prompt after a wake-up tells the session that its process was ended and
resumed, so it knows that browser tab ids and MCP connections are new. A
session that Claude Code named after its folder (bgtest-89) gets a new
suffix in each process; claude-focus keeps the name it had.
CLAUDE.md changes
Claude Code reads ~/.claude/CLAUDE.md once, when a session starts. When you
change it, the prompt hook tells each session that started earlier, once and
with its next prompt (yours or a wake-up), to read the file again. It does
not message all sessions at once: each would answer "I read it again", and
that answer would take the place of the request it left for you in NEED YOU.
"claude_md_notice": false turns it off.
Free terminals
A pane whose Claude session has ended is free for the next one, and shows under AVAILABLE TERMINALS with its folder, the program and where it is. A pane in which a Claude session runs is never free, and neither is the focus screen's own pane.
- iTerm2: only panes with the green
Availableprofile are free; they show with their tty (see "iTerm2"). - herdr: every pane at a bare shell prompt (zsh, bash, fish, ...) is free,
with no setup. It shows as workspace:tab, such as
metaos:3, ormetaos:3.2for the second pane of a tab.
Enter on a free terminal, or n for the first one, opens a list of folders
for a new session. When no terminal is free, n starts one in a new window
(in herdr a new tab), as Cmd+N would: it opens when you have picked the
folder, with session_profile, and the session starts in it. In herdr the
new tab is named by the next free number in the workspace (3), and once
its session has its first prompt, by 1 to 3 words about that task
(Bančni izpiski), which history_model writes (about $0.0003); a name you
gave the session (/rename) wins, and a tab you renamed yourself stays as
it is ("tab_names": false turns this off). It holds every folder that Claude Code has run in (Claude
Code's own list in ~/.claude.json) and the subfolders of your project
folders (project_roots), the most recently used first, with the time of
the last session there. Type to search: every word you type must be in the
path, and a folder whose own name starts with the first word comes first.
When no path has what you typed, the letters are an abbreviation of the
folder's name: clfo finds claude-focus.
To start in a new folder, type its name. Below the list, + new folder
shows where it goes: into the first of your project folders
(project_roots) that exists, or to the path you typed when it starts with
~ or / (clients/acme makes both levels). When no folder matches, it is
selected; otherwise ↑ on the first row reaches it. Enter on it types
mkdir -p <folder> && cd <folder> && claude. It shows only for a folder
that does not exist yet.
- Enter types
cd <folder> && claudeinto the terminal (Ctrl-U first, so anything typed at its prompt goes away) and takes you there; in iTerm2 the pane also gets back your default profile.new_session_commandsets the command, for exampleclaude --model opus. It types only into a pane that is still at a bare shell. - In a folder where Claude Code ran before, Enter first asks how to start,
with the number of sessions there, when the last one ran, and how many run
now.
n(or Enter) starts a new session,ccontinues the last one (claude --continue), andrresumes an earlier one from Claude Code's own list (claude --resume). When the last session there runs already,cgoes to it (an asleep one wakes in its pane): a second--continuewould run the same conversation twice. ↑↓ and Enter work too. The flag goes afternew_session_command. Esc goes back to the folders. - Tab goes to the terminal without starting anything.
- Esc goes back to the list of sessions.
Past sessions
Below the folders, the picker lists the past sessions that match what you
typed (two letters or more): by their name (/rename), the title Claude
Code gave them, their description (below), the last prompt and the folder,
and by what was said in them, your messages and Claude's replies (not tool
output). Sessions whose name, title, description or folder match come
first, then those whose conversation does, each newest first. A row shows
what the session is about (its description, else Claude Code's title, else
its first message, after the name you gave it), its folder and last
activity, and the words found, else its last prompt. Sessions that were
opened and closed without a conversation are left out. Enter on one types
cd <folder> && claude --resume <id> (after new_session_command) into the
free terminal; a session that runs now is not started twice, Enter goes to
its pane. When no folder matches, the first session is selected, not the
new folder; ↑ reaches the new folder.
So a session about one client can be closed (x, or /exit in it) and
opened again later by typing the client's name or words from the
conversation, with fewer terminals open meanwhile. claude-focus search <words> prints the same list with the command for each.
The search reads an index, ~/.claude-focus/history.db (SQLite, full-text
search). The service updates it every minute in a process of its own, from
what each transcript in ~/.claude/projects gained since the last run (the
first run read 28 GB of transcripts in about a minute and made an index of
82 MB). Headless runs (claude -p, the Agent SDK) and the desktop app's
sessions are left out: a terminal cannot resume them. Claude Code deletes
transcripts older than cleanupPeriodDays (30 days by default, in
~/.claude/settings.json), and the index forgets them with them; raise the
setting to find older sessions.
Descriptions. Claude Code's title comes from a session's first prompt,
so a session that ran for weeks keeps the title of its first task. The same
run has history_model (Haiku by default) write one line per session: what
it is about, by the names in it, and where it ended, such as "Hotel Dvorec:
guest guide and Protel for the assistant, mail sent, waits for a reply". It
reads the session's names, its first message and its last six messages,
through your Claude Code (claude -p). A session is described once it has
had no new message for 10 minutes, and again after 10 more messages; each
run describes at most 12, newest first, so the first runs work through the
older ones a few minutes at a time. One description cost about $0.0006 with
Haiku (claude-focus cost counts them). "history_model": "" turns them
off.
iTerm2
claude-focus uses the iTerm2 Python API. Turn it on in Settings > General > Magic > Enable Python API; the first time, macOS asks whether claude-focus may control iTerm2.
Finding a session's pane. By the tty of its process, including panes hidden by a maximized pane.
Global hotkeys. With "hotkeys": true, a focus screen registers ⌃⌥N
(go to the top session from any pane) and ⌃⌥F (bring the focus screen to the
front). hotkey_go and hotkey_focus_window set other keys. The service
does not register them: from the service they did not reach iTerm2.
The green profile
In iTerm2, a free terminal is a pane with the green profile Available. If
you say yes to free terminals in claude-focus setup, it adds the profile
as an iTerm2 dynamic profile (your default profile with a green background,
in ~/Library/Application Support/iTerm2/DynamicProfiles/claude-focus.json)
and turns on auto_profiles. A profile named Available that you made
yourself is used as it is. Then the engine keeps the color true:
- When a Claude session ends and its pane is back at a bare shell (zsh, bash, fish, ...), the pane gets the free profile. A pane that runs another program after the session (vim, a script) is not free.
- When a Claude session starts in a free pane, the pane gets back your
default profile (
session_profile).
You can also mark a pane free by hand: bind a key to "Change Profile" >
Available in iTerm2's key bindings. Config free_profile names another
profile.
A new window (Cmd+N) gets iTerm2's default profile, so it is not free. To
make every new window a free terminal, make Available the default profile
(Settings > Profiles > Available > Other Actions > Set as Default). The
windows that claude-focus opens itself, the focus screen and the panes of a
restore, get session_profile instead.
This is the only part of claude-focus that uses iTerm2 profiles; the colors
of the focus screen need no setup. Without the profile, the section stays
empty, and a switch to a profile that does not exist changes nothing. The
engine switches a profile with iTerm2's SetProfile escape sequence, sent
into the pane as program output; nothing shows on the screen.
Crash recovery
When the Mac crashes, every iTerm2 window and every Claude session in it stops, and Claude Code deletes the session files of the dead processes. So claude-focus records the layout itself.
Every 10 s the engine reads each iTerm2 window (frame, display, full
screen) and the Claude session in each pane (id, name, folder, the flags of
its claude command, its pending wait). When the layout changed, it appends
a line to ~/.claude-focus/layouts.jsonl and syncs it to disk.
After the restart, the focus screen says that windows from before are
closed: R shows the list, and y opens it. claude-focus restore does the
same from a terminal (--dry-run only shows the list). It opens the same
windows on the same displays and types
cd <folder> && claude <flags> --resume <id> into each pane's login shell,
so the shell stays when Claude exits. Then it sets the pending waits again.
Other commands that ran in those panes are not run again, and it skips
sessions that run now and folders that are gone. A resume keeps the flags
of the original command that matter: --model, --permission-mode,
--add-dir, --effort, and --dangerously-skip-permissions if you used it.
Planned restart
Before you restart, run claude-focus reboot in a new iTerm2 window
(--dry-run only shows the list). It saves the layout, stops each working
session with Esc, and waits until it stops. After the restart, the service
opens the saved layout by itself, once. A session that was working is told
to continue, a session that asked something asks again, and an idle session
gets no message.
herdr
herdr is a terminal workspace manager for coding agents: workspaces, tabs and panes in any terminal, kept alive by a server. claude-focus talks to that server over its socket API and needs nothing from the terminal that shows herdr.
Finding a session's pane. herdr knows the foreground processes of each
pane, so a session's pane is the one whose foreground runs its process. Two
processes of one conversation (a --resume while the old one runs) are
told apart this way. herdr's Claude Code integration (herdr integration install claude; setup offers it) also tells herdr the session id in each
pane, which finds a session whose process is not in the foreground (Claude
Code suspended with Ctrl-Z).
Keys. Setup adds two herdr keys to ~/.config/herdr/config.toml,
between # claude-focus setup markers that claude-focus uninstall
removes, and reloads herdr's config:
prefix+arunsclaude-focus go: to the session that needs you most. When nothing needs you, a herdr toast says so.prefix+frunsclaude-focus show: the focus screen, or a new one.
prefix is herdr's prefix key (Ctrl-B unless you changed it). Set
herdr_key_go and herdr_key_focus_window for other keys. Setup never
takes a key that your config binds already, and when your config is a link
(managed by Nix or your dotfiles), it prints the keys for you to add there
instead of replacing the link.
The queue in herdr's sidebar. The engine puts each session's place in the queue into herdr's pane metadata, as tokens:
$cf_state: need you, to-do, wakes 14:00, working or free,$cf_priority: the priority in NEED YOU,$cf_ask: the one-line request (at most 60 characters).
They show once your herdr config names them in the rows of its agent list, for example:
[ui.sidebar.agents.rows_by_agent]
claude = [["state_icon", "workspace", "tab", "$cf_priority"], ["$cf_ask"]]
The tokens expire 10 minutes after claude-focus stops. "herdr_sidebar": false turns them off.
Focus. "Your keys are in the pane" means herdr's focused pane while the app that shows herdr (the terminal that runs a herdr client) is the front app. herdr's events (a pane opens, closes or gets the focus) make the focus screen and the engine read again at once.
Restarts. herdr's server keeps its panes and resumes the Claude sessions
in them after a restart, so claude-focus records no layout for herdr, and
restore and reboot only say so.
One server. claude-focus drives one herdr server: herdr_socket in the
config when set, else the server of the pane it runs in
($HERDR_SOCKET_PATH), else the default session's
(~/.config/herdr/herdr.sock). Sessions in another herdr session or on a
remote machine show without a pane.
Claude Desktop
Sessions in the Code tab of the Claude desktop app show in the queue like
terminal sessions. Claude Code lists them in ~/.claude/sessions with
their status, so they are scored, they can set waits, and their questions
reach NEED YOU. Such a row carries the tag desktop. Enter on it (and
claude-focus go) opens that session in Claude Desktop and brings the app
to the front, in a second or two.
The desktop app gives no pane to read or to type into. The claude-focus mod (below) gives a way in: it runs inside each session and submits what the engine leaves for it. Some things still work differently for these sessions:
- A wake-up goes through the mod, as a prompt of its own once the session is idle. Without the mod it shows in NEED YOU as a WAKE-UP that was not sent; go to the session and tell it to continue.
- A question queued with
claude-focus askis passed on through the mod after Enter, as in a terminal. Without the mod, the focus screen tells you to ask the session for it. - Claude Desktop keeps, for each session, when it was last in front. The engine reads that (the app's own session records, which are not documented), so opening a session in the app by hand counts as seeing it, as going there from the queue does: the to-do "Read its answer to your message" is done once you open the session after its turn ended.
xdoes not close such a session. Archive it in the app.- The scorer reads the transcript alone, without the screen.
claude-focus opens a session with a link,
claude://code/continue?session=<id>. The app uses links of this kind
itself, but they are not documented, so an update of the app can break the
jump. A link reaches only the sessions of the account that the app is
signed in to. Tested with Claude Desktop 6.6395 on macOS and 6.28899 on
Windows 11.
Without a terminal. When neither herdr nor iTerm2 runs and Claude
Desktop hosts sessions, the service runs with no terminal at all
(claude-focus status says so). For a computer whose sessions all run in
Claude Desktop, run
claude-focus setup --desktop
It sets "terminal": "desktop", adds the hook and the rule for waits as
for a terminal, installs the claude-focus mod in Claude Code, and starts
the service. It needs claude on PATH. A focus screen can still run in any
terminal window.
The claude-focus mod
The mod (the folder claude_focus/mod in the package) is a Claude Code
plugin, focus-queue, that shows the queue inside every session: a pane
that /claude-focus opens, with a card per session that goes there on a click, and a line above the
prompt when another session needs you more. It works in Claude Desktop's
Code tab and in a terminal. It also writes a heartbeat,
~/.claude-focus/mod/<session id>.json, and submits the text of
~/.claude-focus/mod/inbox/<session id>.txt when the engine leaves one
there: that is how wake-ups and queued questions reach a session in
Claude Desktop. claude-focus setup --desktop installs it; by hand:
claude plugin install focus-queue --marketplace <the claude_focus/mod folder>
Claude Code reads it from that folder, so an update of claude-focus
updates the mod; sessions load it at their next start. Its options
(claude plugin configure focus-queue): command, the program it runs
for go, done and snooze (default claude-focus), and language, en or
sl (the pane's own words and the kinds of rows). For Slovenian
everywhere, also set "language": "sl" in claude-focus's config.json
(see "Configuration"): it covers what the engine writes, such as the
wake-up messages and the scorer's line.
The queue for another view
The engine keeps the queue in ~/.claude-focus/queue.json, for a view that
is not the focus screen: a pane in Claude Desktop, a menu bar item, a
script. It writes the file when the queue changes and at least every 30 s,
so a file older than two minutes means that no engine runs.
claude-focus list --json prints the same content once.
{"version": 1, "at": 1795599495159,
"engine": {"pid": 4242, "mode": "service", "terminal": "iterm"},
"counts": {"need": 1, "todo": 0, "pending": 0, "working": 0, "free": 0},
"top": "8bcaa9e0-5209-47e0-888a-833be69c1c66",
"sections": {
"need": [{"session": "8bcaa9e0-5209-47e0-888a-833be69c1c66", "name": "offer",
"folder": "/Users/ana/offer", "status": "waiting", "since": 1795598903394,
"host": "desktop", "link": "claude://code/continue?session=local_b971f8e6",
"kind": "decision", "text": "Send the offer?", "priority": 70.3, "base": 70,
"waiting_since": 1795598903394, "scored": true, "dialog": true}],
"todo": [], "pending": [], "working": [], "free": []}}
host says where the session runs: terminal, desktop, background,
asleep or none. top is the session that claude-focus go goes to.
Times are Unix ms. version goes up when a field goes away or changes its
meaning; a new field can come at any time. The docstring of
claude_focus/snapshot.py lists every field.
A view acts with three commands. Each takes a session id (or its first 6 characters or more) or a session's name:
claude-focus go <session> # go to it: its pane, or Claude Desktop
claude-focus done <session> # what d does in the focus screen
claude-focus snooze <session> +2h # what s does; also HH:MM or "YYYY-MM-DD HH:MM", then a note
Windows
claude-focus runs on Windows 11 with herdr and Claude Code's native Windows
build. It was tested on Windows 11 Pro 25H2 with herdr 0.9.5, Claude Code
2.1.319 and Windows PowerShell 5.1 panes in Windows Terminal. The iTerm2
parts (the green profile, crash recovery, reboot, global hotkeys) do not
exist there.
Install. You need Git for Windows (Claude Code's Bash tool and your check commands run in Git Bash), uv, Claude Code and herdr. Then, in a herdr pane:
uv tool install claude-focus
claude-focus setup
uv puts claude-focus.exe into %USERPROFILE%\.local\bin, the folder
where the Claude Code installer puts claude.exe. The Claude Code
installer does not add that folder to your PATH: if a new terminal finds
neither claude nor claude-focus, run uv tool update-shell and open a
new terminal.
Start herdr from an ordinary terminal, not one opened as administrator. An elevated herdr server refuses clients that are not elevated, and the background service is not.
How it differs from macOS.
- herdr's API is a named pipe,
\\.\pipe\followed by the socket path%APPDATA%\herdr\herdr.sock. herdr's config, with the two claude-focus keys, is%APPDATA%\herdr\config.toml. - The background service is a value in your Run key
(
HKCU\Software\Microsoft\Windows\CurrentVersion\Run; no admin rights needed). At logon it starts a supervisor without a window (pythonw.exe). The supervisor runs the engine and starts it again 30 seconds after it stops, as launchd does on macOS.claude-focus statusshows both processes; the log is~\.claude-focus\service.log. - The check commands of pending waits run in Git Bash, because Claude writes them in bash.
- The prompt hook in
~\.claude\settings.jsonnames claude-focus in quotes with forward slashes. Claude Code runs hooks through Git Bash, which drops backslashes. - A new session in a free terminal starts with the syntax of the pane's shell: PowerShell, cmd.exe or bash.
- The focus screen's light or dark look follows Windows' app mode (Settings > Personalization > Colors).
- There is no kqueue, so the engine finds changed session files by polling every few seconds.
Upgrade. Windows does not let uv replace a program that is running.
So U on the focus screen, claude-focus update and "auto_update" all
work the same way there: the focus screen quits, the service stops, a
script of its own installs the new version and runs claude-focus setup --yes, and the new service opens the focus screen again in its pane,
about a minute later (the log: ~\.claude-focus\update.log). Tested from
one build to the next on Windows 11 with herdr 0.9.5. By hand, stop
claude-focus first; an upgrade that fails halfway leaves the tool without
its code, and claude-focus then fails with "No module named
claude_focus".
claude-focus uninstall-daemon
# quit the focus screen (q), then:
uv tool upgrade claude-focus
claude-focus setup
After a failed upgrade, stop what is left and install again:
Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -match 'claude[-_]focus' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }
uv tool install --force claude-focus
claude-focus setup
Uninstall the same way: claude-focus uninstall, quit the focus screen,
then uv tool uninstall claude-focus.
Configuration
The settings you change most are on the focus screen: i lists them with
their values; ↑ ↓ select one, Enter switches it on or off, moves a choice
to the next one, or opens a text for typing (Enter saves it, Esc keeps the
old one), and Esc goes back. A change is saved in
~/.claude-focus/config.json and in use at once, in the service too: it
reads the file again when it changes. The global hotkeys apply when the
focus screen opens again.
~/.claude-focus/config.json overrides the defaults in
claude_focus/store.py, and holds all the settings below. For example:
{"user_name": "Ana", "user_role": "a freelance developer", "companies": {"acme": "Acme"}}
| Key | Default | What it does |
|---|---|---|
user_name |
"the user" |
How the messages to sessions and the scorer name you |
user_role |
"" |
One phrase about you, for the scorer |
language |
"en" |
"en" or "sl" (Slovenian): the language of what claude-focus types or submits into sessions (wake-ups, queued questions, reminders), of the reasons a wake-up shows with, of the queue's own row texts, of what go, done and snooze print, and of the scorer's one-line request and reason. The prefixes such as [claude-focus wake-up] stay as they are. The focus screen and the log stay English. The mod has an option of its own for its pane (see "The claude-focus mod") |
companies |
{} |
Folder name prefix to company label, shown with the score |
scorer |
"claude" |
"claude" or "jev" (TypeSafe or OpenRouter key) |
scorer_model |
"claude-sonnet-5-5" |
The model of the claude scorer |
jev_model |
"jev-latest" |
The model of the jev scorer |
ask_model |
"claude-haiku-5-5" |
With jev: the model that writes the one-line request ("" = off) |
history_model |
"claude-haiku-5-5" |
The model that describes past sessions for the search ("" = off; see "Past sessions") |
confirm_close |
true |
x asks y before it closes a session; false closes it at once |
ask_nudge |
false |
When a turn's text leaves you a decision or a step (scored decision, action, review or login) but asks no question, type a reminder into the session's empty prompt to ask with AskUserQuestion; at most once in 30 minutes per session, never into one you are in or one that waits |
check_updates |
true |
Look on PyPI once a day for a new version (see "Upgrade") |
scorer_parallel |
4 |
Sessions scored at the same time |
poll_seconds |
3 |
How often the state is read at the latest; a change of a session's status is read at once |
aging_points_per_hour, aging_max |
0.15, 10 |
The bonus for waiting, added to the score; the sum stays at most 100, and at 100 the longer wait goes first |
terminal |
"auto" |
"auto", "iterm", "herdr" or "desktop" (see "Which terminal" and "Claude Desktop") |
theme |
"default" |
The focus screen's look, one of the themes in "Themes" (keys t and T) |
zoom |
true |
Maximize (in herdr: zoom) the pane on Enter |
return_after_answer |
true |
Come back after you answer a question |
new_session_command |
"claude" |
What a new session in a free terminal runs, after cd <folder> && |
project_roots |
~/Projects, ~/code, ~/src, ... |
Folders whose subfolders the folder list offers too |
wake_check_output |
false |
Put a check's output into the wake-up message |
claude_md_notice |
true |
Tell a running session, with its next prompt, that ~/.claude/CLAUDE.md changed |
sleep_after_min |
0 |
End a PENDING or FREE session that has been idle this many minutes, and resume it when needed (0 = off; see "Sleeping sessions") |
sleep_sections |
["pending", "free"] |
The sections whose sessions may fall asleep |
sleep_wake_on_visit |
true |
Going to an asleep session's pane resumes it there |
auto_update |
false |
Install a new version by itself, between 01:00 and 05:00 or within 15 minutes after the service started (after a logon), never while a session works; the focus screen closes and opens again on the new version (see "Upgrade") |
tab_names |
true |
herdr: a tab that n opens is named by a number, then by its session's task (see "Free terminals") |
hotkeys, hotkey_go, hotkey_focus_window |
false, ⌃⌥N, ⌃⌥F |
iTerm2's global hotkeys (only a focus screen registers them) |
free_profile, session_profile |
"Available", "Default" |
iTerm2: the profiles of free terminals and of sessions |
auto_profiles |
false |
iTerm2: switch those profiles by itself (setup turns it on if you want free terminals) |
herdr_socket |
"" |
herdr's API socket ("": $HERDR_SOCKET_PATH, else ~/.config/herdr/herdr.sock) |
herdr_sidebar |
true |
Put each session's place in the queue into herdr's pane metadata |
herdr_key_go, herdr_key_focus_window |
"prefix+a", "prefix+f" |
The herdr keys that setup adds |
Files
All under ~/.claude-focus/ (mode 700):
priorities.md: your rules for the scorer, in plain words. Edit it freely.config.json: your settings.state.json: scores, snoozes, manual priorities, pending waits, asleep sessions (their folder, pane, flags, model and effort).focus.log: scores, wake-ups, profile switches, errors.costs.jsonl: one line per scorer call.layouts.jsonl(iTerm2): layout snapshots for a restore (3 days, and always the whole previous iTerm2 run).engine.json,engine.lock,service.pid,service.log: which process is the engine.queue.json: the queue as the engine sees it now, for a view outside the focus screen (see "The queue for another view").mod/: the claude-focus mod's heartbeats, one file per session, andmod/inbox/, the messages the engine leaves for it (see "The claude-focus mod").history.db: the search over past sessions (see "Past sessions"): the text of your messages and Claude's replies, copied from the transcripts. Delete it at any time; the service builds it again.supervisor.pid,supervisor.lock(Windows): the service's supervisor.
The jev keys live in ~/.config/claude-focus/credentials (see "Scoring").
Privacy and safety
- For each score, the scorer gets the bottom 45 lines of the session's
screen, its last message (up to 3,500 characters), its folder and name,
and your
priorities.md. The claude scorer sends them to Anthropic through your Claude Code. jev sends them to TypeSafe, or to OpenRouter with an OpenRouter key, and for the request line (ask_model) the screen and the last message also go to Anthropic through your Claude Code. - For a description of a past session (
history_model), its names, first message and last six messages go to Anthropic through your Claude Code. - Once a day it asks PyPI for the newest version of claude-focus (a plain
request that carries nothing about you;
check_updates). claude-focus sends nothing else anywhere. - It types into your terminals only for wake-up messages (only into an
empty prompt),
/exitwhen you close a session withx(only into an empty prompt), the reminder to ask with AskUserQuestion (ask_nudge, off by default; only into an empty prompt), the command of a new or resumed session that you start from the folder list, and in iTerm2 the restore commands, Esc onrebootand the profile escape sequence; for a sleeping session,/exitinto its empty prompt and theclaude --resumecommand into the shell of the pane kept for it. In herdr it also sets the sidebar tokens, which stay inside herdr. - The background service runs your check commands with your shell and your PATH.
- It reads
~/.claude/sessions/, the transcripts in~/.claude/projects/and the list of folders in~/.claude.json, and never writes them. The search over past sessions keeps a copy of their messages in~/.claude-focus/history.db, on this Mac only.
How it works
One process is the engine: it scores and runs the waker; in iTerm2 it also
takes the layout snapshots and switches profiles, and in herdr it sets the
sidebar tokens. It holds ~/.claude-focus/engine.lock, so there is never a
second one. Normally the engine is the background service, and every focus
screen is a view of the shared state (its header says service). Without
the service, the first focus screen is the engine.
Every 3 s it reads ~/.claude/sessions/<pid>.json, the data behind
claude agents --json: busy, waiting (a question or a permission
prompt) or idle. Then it asks the terminal where each session's pane is
(see "iTerm2 and herdr"). The terminal sits behind a bridge with the same
methods for both: claude_focus/iterm.py and claude_focus/herdr.py, and
claude_focus/terminal.py picks one. A session that Claude Desktop hosts
has no pane; claude_focus/desktop.py knows such a session by its row and
opens it with a link, and its bridge without panes stands in where no
terminal runs.
If two processes run the same conversation (a --resume while the old
window is still open), both rows show DUPLICATE. Close one of them, because
both write to one transcript.
Tests
.venv/bin/python -m unittest discover -s tests
The tests use a scratch folder, never your ~/.claude-focus. The herdr
tests run against a fake herdr server on a scratch socket, on Windows on a
named pipe. On Windows, run them with .venv\Scripts\python.exe -m unittest discover -s tests; the tests of the iTerm2 bridge and of kqueue skip there,
and tests/test_windows.py tests the Windows parts (most of them on macOS
too).
Releasing
- Set the new version in
claude_focus/__init__.py(__version__), commit, and push main. - Push its tag:
git tag v0.1.1 && git push origin v0.1.1. The Release workflow (.github/workflows/release.yml) checks that the tag matches the version and publishes the release to PyPI. - In nejko/homebrew-tap, point
urlandsha256inFormula/claude-focus.rbat the new sdist on PyPI, and push.
License
MIT. See LICENSE.
Metadata
Release files for claude-focus 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| claude_focus-0.2.4.tar.gz | 359.6 kB | Without provenance | Details for claude_focus-0.2.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| claude_focus-0.2.4-py3-none-any.whl | Python 3 | none | any | Details for claude_focus-0.2.4-py3-none-any.whl |
Total release size: 598.0 kB
Release files / claude_focus-0.2.4.tar.gz
| Download URL | claude_focus-0.2.4.tar.gz |
|---|---|
| Size | 359.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c28b722dcd19c0906b356ad06bc77005d9213dbc5d5cb56f01ad81f54dd68118
|
|
BLAKE2b-256 checksum How to use checksums |
1bda16a22585a694e76bb931dfc6aecb4a9752d03a2054982939a1badb3db8bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / claude_focus-0.2.4-py3-none-any.whl
| Download URL | claude_focus-0.2.4-py3-none-any.whl |
|---|---|
| Size | 238.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
610947d7afeb3a7df5983433a169ed14edd2e72d86989d321dc48c25264a3210
|
|
BLAKE2b-256 checksum How to use checksums |
1e3f0736c98bdedb3b79e3b74998dc9f0f5c68db2adb1dc70922ad35a1018867
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for claude-focus 0.2.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.