What Fibo is: a native, open-source (MIT) workbench for coding agents such as Claude Code and Codex. Agents run in real terminals Fibo opens, and Fibo shows in the sidebar, the board, the menu bar and on your phone which session is waiting for you. Install: download the DMG, or brew install --cask majiayu000/tap/fibo.
01 The problem: there is no API for "waiting on you"
With five or six agents open at once, most of the time goes into flipping through tabs to see who is stuck on an approval prompt and who has already finished. For a workbench to watch them for you, it has to know what each session is doing right now.
Agent CLIs have no interface for this. Claude Code and Codex do not tell other programs "I am sitting on an approval prompt", and Fibo does not change their model or loop; it runs them as they are, in a real terminal (PTY). All it can use are the traces they leave anyway: session logs on disk, hooks the user may choose to install, the text drawn in the terminal, escape sequences a program prints, and processes in the operating system.
Fibo gives every session one of 10 states. Their words, glyphs and grouping are defined once, by Status in crates/fibo-core/src/status.rs, and spelled nowhere else:
| State | When | Needs you | Sounds |
|---|---|---|---|
◐ Running | A turn is under way, or it ended while a background job or subagent still works for it | no | no |
◆ Waiting for you | An approval, a question or a plan confirmation is on screen | yes | yes |
✕ Error | The turn failed, or the terminal's process exited non-zero | yes | yes |
◇ Ready for review | The turn ended; whether the work is done is yours to judge | yes | no |
◔ In background | The turn ended and only a scheduled wakeup or a monitor is left, which will wake it later | yes | no |
○ New | An agent is open and has not started a turn | no | no |
‖ Stopped | You interrupted it, or the agent left without finishing | no | no |
◷ Snoozed | You snoozed it until a set time | no | no |
· Idle | Untouched past the configured number of days | no | no |
✓ Done | You marked it complete or abandoned it | no | no |
"Needs you" is a group of states: Waiting for you, Error, Ready for review and In background (Status::needs_you). Only the first two play a sound and color the counter orange or red (Status::blocked), because the agent cannot continue without you. This was settled on 11-03; before that the sidebar counted four states while the top bar and the board counted two, so the same moment could read "Needs you 5" and "Needs you 2".
02 Five sources, each with blind spots
The background host, fibo serve, owns every terminal and collects five kinds of evidence for each session. Each one alone gets some cases wrong, so it uses all five.
| Source | What it sees | How fast | Where it is reliable | When it fails |
|---|---|---|---|---|
| Session log jsonl under ~/.claude, Codex's logs, etc. | A turn starting, ending, being interrupted; what was said and which tools ran. All chat content comes from here | Read when the file changes | The CLI's own record: an end or an interruption written there is a fact | Some things are written only after you answer: Claude's question dialog is absent from the log until then. Reading only the tail of a long session misses the start of the current turn |
| Hooks optional; 6 events for Claude | UserPromptSubmit starts a turn, PermissionRequest and Notification wait, Stop ends it and lists background shells | When the event happens | Knows about approvals and questions before the log does; Stop carries the background task list | Nothing at all on machines without hooks; another process that inherited the terminal's environment can send hooks too (see 06) |
| Screen terminal contents and title | The approval, choice or plan menu on screen now; a spinner in the title, a timer line in the output | Read once the screen has been quiet for 1 s; while output flows, checked every second for the timer line | The only source that knows "now" when the log lags | A CLI that changes its wording or layout is no longer recognized; narrow windows wrap a question onto two lines (see 06) |
| Program report OSC 7501 | A program says working, blocked, done or error with one escape sequence | As soon as it prints | The program's own word, not a guess | Needs the program to print it; scripts and builds get it with one printf |
| Processes process tree, listening ports | Whether shells left after a turn are still alive and whether they listen on a port | Every 5 s | Tells jobs that will end from servers that will not | Only indirect: it reads ports and age, not what a command means (see 05) |
Two more signals only settle dialogs: Claude's claude agents --json and the read-only status interface of Codex's shared daemon. The code notes they can lag both the log and the hooks, so they may end or confirm a wait but never start or end a turn (official in content/mod.rs).
Hooks must not slow the agent down either. The command Fibo writes into settings.json reads stdin into a variable, hands it to fibo hook in the background and exits 0 at once; its 5-second timeout only bounds a stuck shell. Outside a Fibo terminal (the environment variable Fibo sets is missing) the command exits immediately and the CLI is unaffected.
03 Layering order: whose word counts
The five sources do not each reach a verdict. They are layered onto one session card (Content), which records the turn's phase (turn), what is left in the background (background) and what it waits on (waiting). The log and hooks feed the same parser and form the base; each time the host sends the workspace to the window and phones, it layers runtime observations on top in a fixed order (overlay in host/snapshot.rs).
host/snapshot.rs, the decision in fibo-core/src/status.rs.Three principles sit behind the order:
- What is seen can only add. A spinning title proves a turn is running even when only the log's tail was read. A still title proves nothing, so it never turns "running" into anything else.
- Now beats the record. If an approval prompt is on screen and the log has not reached it, the session waits for you, and the card says "prompt on screen" so it is never mistaken for a log record.
- What a program says beats a guess. A program that reports through OSC 7501 is taken at its word. But
idleandworkingstart no turn: the code notes that Codex reports a few seconds ofworkingbetween turns, while a real turn reaches its log within moments.
After layering, a single function decides. This is the branch for a live session (simplified, parameter types left out):
fn live(w, s, c, now) -> Status {
match turn {
Turn::Waiting => return Status::Waiting,
Turn::Running => return Status::Running,
// subagents or a job still work for it: not over
Turn::Completed if background.keeps_working() => return Status::Running,
_ => (),
}
if let Some(d) = decided(w, s, now) { return d; } // marked done, snoozed
if fresh(c) { return Status::Fresh; }
match turn {
Turn::Error => Status::Error,
// only what wakes it; a server wakes nothing
_ if background.wakes() => Status::Background,
Turn::Interrupted => Status::Paused,
_ => Status::Review,
}
}
Note the order: your decision comes after "waiting" and "running". If you marked a session done and then woke the agent with another message, it shows Running; only once the turn ends does your decision apply.
04 A finished turn is ready for review, not done
An agent saying "all done" does not mean the work is done. So the end of a turn only reaches Ready for review, and only you can mark a session Done (settled on 11-02). When the agent's reply claims completion, the card's next-step hint becomes "check each item of the request against mechanical evidence before accepting" (completed_claim); the state stays the same.
Keeping Ready for review apart from Done has a practical effect. A session ready for review stays in the Needs you count, so ⌘J jumps to it, and it can be walked through in the review queue: read what the agent said last, then mark it done or send it back (sessions with a server left are kept out of the queue, because their Enter would close the terminal). If a finished turn counted as done, this step would disappear and unchecked changes would mix into the done column.
05 A server is not waiting: four versions of the background-shell rule
The hardest case is a session whose turn ended with background shells still alive. Claude's Stop hook lists them but does not say whether they will end. Some will (tests, builds, CI polling), and Claude is woken when they do; some will not (http.server, a relay, tail -f). The rule went through four versions:
| Version | Rule | What it got wrong | Source |
|---|---|---|---|
| Earliest | Any background shell means Running | A session with http.server open spun forever | 11-03 decision record |
| 11-03 afternoon | Background shells only: always In background, counted in Needs you | Tests and builds still running after the turn were reported as needing you | 1058984 |
| 11-03 evening | Read the process tree: listening on a fixed port (< 49152) or running for 2 hours makes a server, anything else a job; switching takes two looks in a row, 5 s apart | On 11-04: an ephemeral port a render script opened for headless Chrome; a fixed-port relay a script started for itself | 3fb2791, 1ab8b0f |
| 11-07 | Same judgment; a server now shows Ready for review with a note, "1 server left · port 5569" | (current) | decision record a-server-is-not-waiting |
The last version came from the label In background holding two things: monitors and scheduled wakeups really do wake the agent; a resident server never brings anything back. A user saw Codex shown as "In background · 1h" and asked what it was waiting for; the answer was a preview server nobody had connected to. Now only what will wake the agent is called In background. A turn that leaves only a server is over: it is Ready for review, with the server in the note.
The current rules are tried in order and the first match decides (judge in background_shells.rs, excerpt):
| What it sees | Counts as | Why |
|---|---|---|
| Within 2 minutes of a host restart, not looked at yet | job | Showing Running for a few seconds too long beats calling you for nothing |
| Running for 2 hours | server | Backstop: no wrong guess spins forever |
| Another process in the same tree connects to a fixed port in the tree | job | The server is a part of the script and exits with it |
| Listening on a fixed port (< 49152), seen twice in a row | server | It waits for someone outside to connect |
| Only an ephemeral port (≥ 49152), or none | job | Ephemeral ports are a tool's own |
Tried and dropped: guessing from the command text (something called relay may be a resident server or a part of a script), and treating anything wrapped in a script as a job (npm run dev is wrapped too). Each misjudgment adds a row to the decision record's case table and to the known_cases test, which has 13 cases now; a rule change may not turn any of them red.
06 Cases it got wrong
Each of these turned up on a real device or a real CLI; the fake agents in the tests did not expose them. Each left a test that fails when the fix is undone.
| Symptom | Why it was misjudged | Fix | Source |
|---|---|---|---|
| Tapping Stop on the phone: Claude's log recorded the interruption at 14:43:42; at 14:43:49 Fibo still replied "it did not stop" | A spinning title and timer line left from before the end outranked the end already written in the log | A busy cue remembers when it was first seen and which end was known then; only cues first seen after the end can start a new turn, and within one second it checks whether the host had seen that end first | 1b25e159 (#646) |
| Some sessions sat in Ready for review yet dropped out of Needs you | A memory tool's Stop hook started a claude -p outside the process tree; it inherited the terminal's environment and terminal id, the hook bound it as that terminal's current conversation, and the real one stopped being current | Refuse the binding when the terminal already has a current conversation of the same kind and the hook cannot be traced to the terminal's process tree; a conversation switch in place is let through by SessionStart's source | bf2a58ca (#640) |
| On a machine without hooks, a plan confirmation menu stayed Running and the phone could not approve it | Claude Code 2.1.326 put a statement before the plan question; the approval rule only took questions starting with "Would you like to" | A separate "plan" screen rule; kept apart from approvals because the plan menu's option 1 switches to auto-accept everything, so pressing Allow would open up the whole session | 46895365 (#593) |
| Codex stopped on an approval in a 31-column split; the phone did not recognize it, and a second message was typed into the prompt and its Enter approved a command | The narrow window wrapped the question onto two lines; the rule required it on one line ending in ? | Join wrapped lines before reading the screen; and while a cursor menu whose option 1 is Yes or Trust is open at the bottom, no message is typed in, recognized or not | #387 |
| Claude asked a three-way question; the phone showed only "CLI requests tool approval" and an Esc | That Claude Code version wrote the question to the log only after it was answered; before that there was only the PermissionRequest hook | Read the question and choices from the hook's tool_input | 11-08 device log |
| A session rendering a video was judged In background | The render script opened a system-assigned ephemeral port for headless Chrome | Only fixed ports (< 49152) make a server | 1ab8b0f |
That is why screen rules are data, not code: the bundled claude.json has 3 rules (approval, choice, plan) and codex.json has 2. Each hangs on one anchor line and the numbered menu beside it; any other shape counts as no evidence, never a guess. The rules are tested against saved screens: 28 for Claude and 18 for Codex, 19 of them recorded from the real CLI and 17 of them look-alikes that must not match, such as an already answered menu, options mentioned in prose, or text typed into the input box (counted 11-28 in crates/fibo-host/tests/fixtures/screens).
Without Fibo, you can still get the "stopped" signal: Claude Code hooks run a command you write when an event happens and pass the event's JSON on stdin. Put this in ~/.claude/settings.json to get a system notification when a turn ends or a permission is requested (macOS shown; on Linux use notify-send):
{
"hooks": {
"Stop": [{ "hooks": [{
"type": "command", "timeout": 5,
"command": "osascript -e 'display notification \"Turn finished\"'"
}] }],
"Notification": [{ "hooks": [{
"type": "command", "timeout": 5,
"command": "osascript -e 'display notification \"Waiting for you\"'"
}] }]
}
}
stdin carries hook_event_name, session_id and transcript_path; Notification also has notification_type (for example permission_prompt). Two lessons: return at once and push slow work to the background; and Stop only says the turn ended, so check separately whether background shells remain (since Claude Code 2.1.317 the Stop JSON has background_tasks).
07 Decided in one place, and kept there by a test
Layering five sources is complex enough; if every surface also worked the state out on its own, they would disagree. That is what happened in Fibo's predecessor repository: unifying the state words was fixed by hand 4 times, and each time it drifted apart again (docs/single-source, from reading the old repository's 697 commits on 11-03). Two read-only audits on 11-03 found 78 places where one fact had two sources, for example:
- The desktop showed Error or Ready for review while the phone and
fibo listshowed "idle", andfibo wait --until idlereturned even on an error, because the host's outward interfaces readturnand rebuilt the state themselves. - The menu bar hard-coded one spelling of Error and the main window used another.
- The phone, the desktop and the status bar each had their own word for Running.
Unifying by hand drifts back, so a machine guards it now, in two steps:
- Let the compiler make the list. Temporarily making the key fields
pub(crate), the compiler reported 420 direct reads and writes outside core: about 200 writes from the observation layer (fine) and 146 reads that made decisions. Those reads were changed one by one to call core's owners:status::of,Status::label,status::needs_you,session_title,session_updated. - A ratchet against drift. Rust cannot tell reads from writes, so the fields cannot stay private. Instead
crates/fibo-core/tests/guard.rsuses regular expressions to count two things per file: raw field reads outside core (.turn,.background,.turn_startedand others), and state words written by hand outsidestatus.rs(drifted spellings included). Any difference fromtests/guard-baseline.txtfails; up or down, the file has to be rewritten, so a reviewer sees it.
Measured 11-28: adding, at the top of a file in fibo-host, a function that reads c.turn and returns "在跑" (the Chinese word for Running), cargo test -p fibo-core --test guard fails with (the hint in the first line shortened):
raw reads or hand-written state words changed (...):
field turn crates/fibo-host/src/pictures.rs: new, 1
word 在跑 crates/fibo-host/src/pictures.rs: new, 1
The same line added after the inline #[cfg(test)] mod tests at the end of the file is not counted: the guard treats what follows an inline test module as test code.
The baseline does go up. Summing the baseline at every version in git history (measured 11-28 over the 52 commits on git log --first-parent that changed it):
tests/guard-baseline.txt, drawn as steps by commit time. Two categories added later (shortcut hints, large opaque surfaces) are not shown.| Category | First baseline, 11-03 | Latest baseline, 11-26 | Change |
|---|---|---|---|
| Hand-written state words | 80 | 68 | −12 |
| Raw field reads outside core | 66 | 70 | +4 (peak 80) |
Hard-coded ⌘ shortcut hints (added 11-03) | 24 | 26 | +2 |
| Large opaque surfaces (added 11-04) | 16 | 15 | −1 |
The biggest single drop in state words came on 11-03, when Needs you became one group: 9 fewer in one commit. Raw field reads went up a few times; on 11-06, for example, splitting Codex's background commands into jobs and servers added 5. The guard does not forbid an increase; it makes each one part of a commit that gets reviewed.
The guard only stops second owners from appearing; it does not check that results agree. That is tests/one_owner.rs: one sample covering 16 states and naming cases, asserting the tab and the sidebar use the same name, then 200 random sequences of edits (renaming a tab, renaming in the sidebar, a new conversation in the same terminal, marking done), each step checked for one name and one state. The host's fibo list, phone cards and plugin events are also compared with core field by field.
Limits: what it does not do yet
- Screen reading follows each CLI's interface. On 11-25 a new Codex started asking questions without waiting for the answer and then
sleeping; the desktop and the phone both showed Running and the phone had no question card. It is recorded, not fixed. - Without hooks it is slower and more fragile. Approvals and questions can only be read from the screen, after it has been quiet for 1 second, and a change in a CLI's wording goes unrecognized until a rule is added.
- Sessions outside a Fibo terminal have only their log: a log that says running stops counting as Running after 15 minutes without change, and nobody can press keys to answer a question it asks.
- Background shells are a guess. A program that listens on no port and never ends takes the full 2 hours to count as a server; resident servers in one process tree that connect to each other are taken for jobs.
- The guard is regular expressions. A field stored in a variable first, or a state word assembled another way, is not counted; it only keeps the most common spellings from coming back.
- OSC 7501 needs the program's cooperation. The most reliable source, a program speaking for itself, mostly serves scripts and builds today; whether agent CLIs print it is up to them.
Summary: three practices
- Layer five sources onto one card, in a fixed order: the log and hooks form the base, then 4 steps add processes, the screen and program reports; the screen only moves toward "busier" or "waiting", and a program's own word beats a guess.
- Decide the state in one function: 10 states, 4 in Needs you, 2 that sound, all from
status::ofandStatus. After the 420 direct uses the compiler listed were rewritten, a guard counts the rest per file; hand-written state words went from 80 to 68. - Every misjudgment leaves a case and a test: 4 versions of the background-shell rule and 13 cases in its test; 46 saved screens for the screen rules, 17 of them look-alikes.