Agents
Report status from your own tools
Any script or agent can tell Nems it is working, done or needs you, with one escape sequence.
Nems shows a status for the agents it knows. Your own scripts, build tools and agents can show one too, by printing an OSC 7501 escape sequence.
printf '\e]7501;state=working:app=my-tool\a'
The pane then shows my-tool as working, in the sidebar and on your phone, like any agent. You'll find this example with a Copy button in Settings › Agents › Agent status.
Examples
# working, with progress
printf '\e]7501;state=working:app=build:progress=40\a'
# finished
printf '\e]7501;state=done:app=build\a'
# needs you, with a question
printf '\e]7501;state=blocked:kind=question:app=deploy:msg=%s\a' "$(printf 'Deploy to production?' | base64)"
# remove the status
printf '\e]7501;state=clear\a'
The format
ESC ] 7501 ; key=value:key=value … BEL
The sequence ends with BEL (\a) or ST (ESC \). Pairs are separated by :.
| Key | Value |
|---|---|
state |
Required. idle, working, blocked (needs you), done, error or clear. |
app |
The name to show. Up to 32 characters: letters, digits and _ . + -. |
kind |
With blocked only: permission, question or auth. |
progress |
With working or blocked: 0 to 100. |
msg |
A short note, base64-encoded UTF-8, up to 2048 bytes. |
title |
A title, base64-encoded, up to 192 bytes. |
id |
Your own id for the record, so one program can show several. Segments are separated by /. |
Keys are lowercase, up to 16 characters. Values use letters, digits and _ . , + / = -, which is why text goes in base64. The whole sequence can be up to 4096 bytes. state=clear removes the record with that id, or all of them if there's no id.
Check for support
Send ESC ] 7501 ; ? followed by ST. Nems answers with the states and kinds it supports:
ESC ] 7501 ; ?:states=idle,working,done,blocked,error:kinds=permission,question,auth ESC \
From hooks without a terminal
Hooks often run without access to the pane's terminal. They can send the same status to the Nems server instead:
printf 'nems-status %s state=done:app=codex\n' "$NEMS_SESSION_ID" | nc -U "$NEMS_SOCKET"
Something missing or unclear? Tell us