How a script, hook or CLI can tell it was started by each harness, and which session started it. Children inherit these variables, so treat them as hints that an agent is involved, not as proof that no person is watching.
Detecting the harness
| Question | OpenCodechecked at 2.1.4 |
|---|---|
| The variable to check |
Because an existing |
| Which processes get it | Partly Commands the agent runs with its shell tool. Terminals OpenCode opens get only |
| Which session started the command |
|
Relying on it
| Question | OpenCodechecked at 2.1.4 |
|---|---|
| Telling the agent's commands from yours | Partly Use |
| Signs that nobody will answer a prompt | Partly Agent commands run with standard input closed, so a prompt reads end-of-file. |
| Removing or overriding it | Partly A plugin's |