# Program status: OSC 7501

Let a program report working, blocked, done, or error state directly to its terminal.

Canonical page: https://thebestterminal.com/docs/program-status

Harness 2.3.2 · Documentation reviewed 2026-10-13

## Status is more than a notification

Harness reads OSC 7501 revision 0.2 from terminal output. A report can update a pane’s tab, session row, and waiting queue. The daemon scans the output even when no GUI window is open; the GUI parser uses the same report model.

An explicit report takes precedence over inferred agent activity. Use it when your program knows whether it is processing, asking permission, or finished.

## Send a minimal report

A sequence starts with ESC ] 7501 ; and ends with ESC followed by a backslash. The examples below report to the terminal in which the script runs:

**Report work from a shell script**

```shell
printf '\033]7501;state=working:app=my-tool\033\\'
# After work completes:
printf '\033]7501;state=done:app=my-tool\033\\'
```

The stored states are idle, working, done, blocked, and error. clear removes a record instead of becoming a stored state. blocked can include kind=permission, kind=question, or kind=auth.

## Choose the fields you need

| Field | Meaning |
| --- | --- |
| state | Required; unknown states discard the report. |
| app | An application token of 1–32 permitted characters. |
| id | An optional record path; absent means the root record. |
| progress | Integer 0–100, only for working or blocked. |
| kind | permission, question, or auth; only for blocked. |
| title / msg | Standard base64 of UTF-8 plain text, not markup. |

Pairs are separated with colons. Invalid base64 or decoded control characters discard the report. The entire sequence is limited to 4096 bytes; individual fields have smaller limits. Read the protocol reference below before building an encoder.

## Understand lifetimes and clearing

There is no heartbeat. Process exit or an OSC 133 shell-prompt mark clears working and blocked records. done and error remain until the pane receives focus and a keypress. idle persists until explicitly cleared or reset.

**Clear all status records in this terminal**

```shell
printf '\033]7501;state=clear\033\\'
```

A clear without an ID removes all records; one with an ID removes that record and its descendants. Full terminal reset clears status, but changing the alternate screen does not.

## Inspect and subscribe

**Terminal**

```shell
harness-cli api call pane.program_status --args '{}'
harness-cli events --follow --json
```

Program-status events are terminal.program_status and terminal.program_status_removed. The first command uses the calling or active pane; consult api describe pane.program_status when targeting another pane.

## Source references

- [docs/PROGRAM-STATUS.md](https://github.com/robzilla1738/harness-terminal/blob/2f843e5625086fbd33e58a724c632e47bfe66d1d/docs/PROGRAM-STATUS.md)

- [docs/COMMANDS.md](https://github.com/robzilla1738/harness-terminal/blob/2f843e5625086fbd33e58a724c632e47bfe66d1d/docs/COMMANDS.md)

## Related guides

- https://thebestterminal.com/docs/agents-and-notifications

- https://thebestterminal.com/docs/automation-and-api

- https://thebestterminal.com/docs/shell-integration

