Agents, CLIs and status
Supported CLIs
| CLI | nsq run … | Status from |
|---|---|---|
| Claude Code | claude | Claude Code’s hooks, checked against its session transcript |
| Codex CLI | codex | Codex hooks |
| OpenCode 1.x and 2.x | opencode | an OpenCode plugin (nsq tells the two versions apart itself) |
| Any command | -- <command…> | its output (no hooks), or its own reports over the herdr status protocol |
Install and sign in to each CLI the usual way — nsq starts the copy on your PATH, under your own
login. More CLIs will follow on demand:
ask for one .
Your CLI’s own command line
nsq run -- claude …, nsq run -- codex … and nsq run -- opencode … (also by path, e.g.
./node_modules/.bin/codex) start that CLI as its agent, exactly like nsq run claude: hooks
or plugin, status, session tracking and resume. Its own flags are passed through on every start
(--effort high, -c key=value, --agent build…), and nsq takes over what it manages itself:
nsq run -- claude --effort high "fix the flaky test"
nsq run -- codex -c model_reasoning_effort=high| The CLI’s own | nsq takes it as |
|---|---|
the prompt (Claude Code, Codex: the positional argument; OpenCode: --prompt) | the first prompt (sent once, not on a resume) |
--model / -m | the agent’s model (m in the dashboard) |
--dangerously-skip-permissions, --dangerously-bypass-approvals-and-sandbox / --yolo, OpenCode’s --auto | dangerous mode |
OpenCode’s [project] | the folder to start in |
nsq keeps the agent’s session itself, so --resume, --continue, --session-id, --fork-session,
codex resume / codex fork and OpenCode’s --session, --continue and --fork are refused —
nsq restart resumes it. So are flags that would switch off nsq’s status: Claude Code’s
--settings and --bare, OpenCode’s --pure. A run that is not an interactive session
(claude -p, codex exec, opencode run, --version, mcp…) runs as a plain command.
nsq run --raw -- claude … runs any of them as a plain command, exactly as written.
How nsq knows what an agent is doing
nsq does not guess from the screen. Each CLI reports its own lifecycle through hooks (a plugin
for OpenCode) to nsq on this machine only (127.0.0.1, a secret per agent):
- working — a turn started;
- needs you — the CLI is blocked on you: a permission prompt (“Claude wants to run: npm test”), a question, a plan to approve. You see the CLI’s own text;
- finished — the turn ended and the answer is on screen;
- idle — back at its prompt with nothing new (you dismissed a question, interrupted, or it restarted).
Your own keys count too: answering a waiting agent in its terminal moves it to working at once. For Claude Code, nsq also reads the tail of the session transcript, which catches interrupts, API errors and queued prompts that send no hook.
A plain command (nsq run -- …) has no hooks: output means working, a few seconds of silence mean
finished, and it never claims to need you — unless it reports its own state (below).
Quiet while working
Hooks only report what the CLI itself asks. A tool inside a command the agent runs fires no hook:
git asking for a password or a passphrase, an installer’s Continue? [y/N], sudo, ssh’s “Are you
sure you want to continue connecting”, a dev server that waits — and neither does a command that
simply hangs. The agent stays working, and nothing would call you.
So nsq watches the screen as a fallback. When an agent is working and its screen has not changed
for quietAfter minutes (default 5, 0 turns it off — see Configuration),
it is flagged quiet: quiet 7m — check it on its tile, in the sidebar, in the header
(1 needs you · 1 quiet), in nsq ls and on the phone. It calls you like “needs you” — desktop
notification, terminal bell, ntfy push — but with no y / a / n:
nsq does not know what the tool waits for. Open the agent and look.
- A spinner is not output. A turning spinner, a rotating “thinking” word or a counting timer does not reset the clock; new lines, text on an empty row or a number that moves (tokens streaming, a percentage) do.
- A hint, never an answer. When the last lines look like a prompt (
Password:,[y/N],(yes/no), a passphrase,[sudo],Press Enter…), nsq says so: looks like it’s asking: Password for ‘https://github.com ’:. It never types anything. - What clears it: any new output, anything you type or paste into the agent, a prompt sent, an interrupt, or the CLI reporting progress through a hook. It never fires while the agent is idle, finished or needs you.
An agent that thinks for longer than the threshold with nothing moving on screen is flagged too —
raise quietAfter (or nsq set <agent> --quiet-after 15 for one agent) if that is normal for your
work. A plain command (nsq run -- …) goes finished after a few seconds of silence, so it is never
quiet.
Agents that speak the herdr status protocol
herdr is a terminal multiplexer for coding agents. It publishes a small protocol an agent uses to report its own state (Add Herdr support to your agent ), and several agents implement it — Crush, Kiro CLI, Command Code and others. nsq speaks the receiving end of that protocol, so such an agent works in nsq out of the box as a plain command:
nsq run -- crushnsq tells the command it runs in a herdr pane (HERDR_ENV, HERDR_PANE_ID, HERDR_SOCKET_PATH,
HERDR_BIN_PATH). An agent that speaks the protocol then reports to nsq, and nsq stops guessing
from its output:
| It reports | nsq shows |
|---|---|
working | working |
blocked (with a message) | needs you, with its message (“crush is waiting for your decision” without one) |
idle after a turn | finished |
idle on start | idle |
| its session id | recorded, like a supported CLI’s own session |
| a resume command | used by nsq restart and after nsq down / nsq up, instead of starting over |
Answer it in the agent itself (Enter in the dashboard, or nsq attach): its permission
dialog is its own, so the dashboard’s y / a / n do not apply. Each
agent gets its own pane id, so one agent cannot report for another. Only the state reports are
implemented — the rest of herdr (splits, waits, events) is herdr’s own. Commands that do not speak
the protocol ignore the variables. Thanks to herdr for publishing the protocol.
Your configuration is never written
Everything nsq needs is passed per agent — command-line flags, environment variables and files in
~/.neurosquad-cli/layers/. Your ~/.claude, ~/.codex and opencode.json are never touched.
Sessions and resume
Each agent keeps its CLI session. nsq restart, nsq start and the daemon’s own restart
(nsq down, then nsq up) resume the session instead of starting over — Claude Code with
--resume, Codex with codex resume, OpenCode with its session id, and a plain command with the
resume command it reported over the herdr status protocol (other plain commands start over). If the
CLI no longer has that session, a fresh one starts.
Interrupting
i in the dashboard or nsq interrupt <agent> sends the key that CLI actually uses to stop a turn
— Escape for Claude Code and Codex, Escape twice for OpenCode — not Ctrl+C, which would quit some of
them.
The approvals log
Every “needs you” question, across all agents, and how it ended goes into one append-only file,
~/.neurosquad-cli/logs/approvals.jsonl — so after a bad call you can see which agent asked, what
exactly, and who said yes from where.
nsq log approvals # the last 50, newest last
nsq log approvals --agent api-fix --since 2h
nsq log approvals -n 20 --json # every field, for scriptsTIME AGENT HARNESS ANSWER BY QUESTION
10-11 14:02:07 api-fix Claude Code yes dashboard Bash: npm test
10-11 14:05:31 api-fix Claude Code always phone (LAN, iPhone · Safari) Edit: src/db.ts
10-11 14:09:12 docs Codex no terminal (attach) Bash: rm -rf dist
10-11 14:12:40 docs Codex interrupted nsq interrupt Bash: git pushOne JSON line per question: when it was asked and when it ended; the agent’s id and name, its CLI
and folder (your home shown as ~); the question as the CLI put it — its text and, where the CLI
says, the tool and its command, path or url; and how it ended:
| Outcome | What happened |
|---|---|
answered | yes / always / no through nsq — by says who: the dashboard, nsq answer, or the phone (local, lan or internet, and the device) |
terminal | someone typed into the agent’s own terminal (full screen in the dashboard, nsq attach); the answer when the key says it — Escape is “no” |
cli | the CLI went on by itself (its own rule, an automatic approval) |
ended | the turn ended with no answer (the CLI gave up, timed out or failed) |
interrupted | an interrupt ended the turn while it waited — by says whose |
exited | the agent stopped, restarted or was removed while it waited |
unanswered | nsq itself stopped while it waited |
Quiet episodes go into the same file with "kind": "quiet": when nsq flagged the agent
(quiet while working), when its screen last changed, what the screen showed (quiet; looks
like it’s asking: Password for …) and what ended it — output, input (with who typed),
hook, finished, needs-input, idle, setting (quietAfter turned off or raised), exited
or unanswered.
Never in the log: the environment, keys or tokens, your prompts — only the question.
Secret-looking parts of a command (--token …, API_KEY=…, Authorization: …,
user:password@, known key formats) are masked and long text is cut. On macOS and Linux the file
is readable only by you; at 10 MB it moves to approvals.1.jsonl and three old files are kept.
Questions that dangerous mode approves are never asked, so they are not logged.
nsq config set approvalsLog false stops writing the log (what is already there stays); true
turns it back on — at once, without a restart.
Dangerous mode
--dangerous (or d in the dashboard, or nsq set <agent> --dangerous on) lets the agent
run without asking for permission. For Claude Code it switches live; for the other CLIs it applies
from the next start, and nsq tells you when a restart is needed.
In dangerous mode an agent can run any command and change any file it can reach. Use it in a worktree or a throwaway folder.