I usually have four or five coding agents running at once: Claude Code in one repo, Codex in another, an OpenCode session fixing tests somewhere else. The agents are fine. The part that kept wasting my time was simpler: which one is waiting for me right now?

One agent has been sitting on "Do you want to proceed?" for ten minutes. Another finished a while ago. A third is still working. With five terminal windows you find out by clicking through all of them.

So I built a terminal app around that one question, TernaryCode. This post is about the part that turned out to matter most: how it knows what each agent is doing.

Don't read the screen

The obvious approach is to watch the terminal output. Look for a spinner, a prompt like Do you want to proceed?, or an idle cursor. I tried it, and it breaks all the time:

  • The wording changes between versions.
  • A long tool call looks exactly like a hung agent.
  • An agent that printed its last line and an agent that is still thinking look the same.
  • Every agent draws its interface differently.

Guessing gets it wrong often enough that you stop trusting the status at all, and then the status is useless.

Ask the agent instead: hooks

The agents already announce what they're doing, through hooks. Claude Code, Codex and OpenCode can each run a command when something happens: a prompt is submitted, a tool is about to run, a permission is needed, a turn ends. That's the signal I wanted, straight from the agent.

Every hook in TernaryCode runs one small binary, ternarycode-hook <agent> <event>. It forwards the event over a local socket, with a token that ties it to the pane the agent runs in. Outside a TernaryCode pane it does nothing, so it's harmless if an agent is started somewhere else.

Claude Code: --settings per launch

Claude Code merges the hooks from a --settings file with the user's own. TernaryCode writes that file once and starts Claude like this:

claude --settings "$TC_CLAUDE_SETTINGS" 

The file looks like this, with one entry per event:

{ "hooks": { "PermissionRequest": [ { "hooks": [{ "type": "command", "command": "ternarycode-hook claude PermissionRequest" }] } ], "Stop": [ { "hooks": [{ "type": "command", "command": "ternarycode-hook claude Stop" }] } ] } } 

It covers SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Notification, Stop, StopFailure and SessionEnd.

Codex: -c overrides for one run

Codex takes config overrides on the command line, so the hooks exist for that run only:

codex -c 'hooks={PermissionRequest=[{hooks=[{type="command",command="ternarycode-hook codex PermissionRequest"}]}],Stop=[…]}' \ -c 'notify=["ternarycode-hook","codex","notify"]' 

Codex asks you once to trust new hooks, in its own dialog. Its notify program also reports approval-requested and agent-turn-complete, which fills a few gaps.

OpenCode: a tiny plugin

OpenCode has plugins rather than hooks. TernaryCode's plugin listens for a handful of events (session.status, session.idle, session.error, permission.asked, permission.updated, permission.replied) and passes them to the same binary. It returns at once when it isn't running inside a TernaryCode pane.

From events to three states

All of that collapses into the states you actually care about:

State Claude Code Codex OpenCode
Working UserPromptSubmit, PreToolUse, PostToolUse UserPromptSubmit, PreToolUse session.status busy, permission.replied
Needs you PermissionRequest, Notification (permission prompt) PermissionRequest, notify approval-requested permission.asked
Done Stop, StopFailure Stop, notify agent-turn-complete session.idle, session.error

There's one small exception: when Claude Code is about to show a plan for approval or ask you a question, the PreToolUse for that tool means "needs you", not "working".

What I learned building it

Don't touch the user's config by default. Everything above is passed per launch. Your ~/.claude/settings.json and ~/.codex/config.toml stay exactly as they were. If you also want agents you start by hand to report their status, there's an opt-in install. It shows the exact diff first and keeps a backup, and uninstalling restores the file byte for byte.

Unknown is not idle. Some agents have no hooks yet (Antigravity CLI, for one). Those show as plain "Active" rather than a guess. A status you can't trust is worse than no status.

Order matters more than color. Once you know which agents are waiting, the question becomes "which first?" Agents that need you line up oldest first. ⌘J (Ctrl+Shift+J on Windows and Linux) takes you to the next one, in whichever project it is, and ⇧⌘J takes you back to where you were.

Notify only when you're not looking. A system notification for an agent in the pane you're reading is just noise. Notifications and the Dock badge only fire when the app isn't in front.

The rest of the app

The status is the core, but the app grew around it:

  • Each project keeps its own terminals, tabs and splits. A Grid view shows every project's terminal live in a tile.
  • The agents get a browser panel beside the terminal and drive it through an MCP server: they open your dev server, click, type and read the console. You can take over at any time.
  • A Code drawer has your language servers. You can review the diff, then commit, push and open the PR in one step, and start an agent in its own git worktree.

It's written in Rust: alacritty_terminal for the terminal emulation, egui/wgpu for drawing, and wry for the web view. There's no Electron. It runs on macOS, Windows and Linux, and when nothing changes it draws no frames at all.

TernaryCode is free and MIT licensed, with no account: github.com/ilhamnadhif/ternarycode. If you run several agents at once, I'd love to hear where the status gets it wrong.

I'm the author of TernaryCode. This post was written by Claude Code from TernaryCode's source code, and the details were checked against it.