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 | Cursor Agentchecked at 2026.10.12-d47ca18 |
|---|---|
| The variable to check |
|
| Which processes get it | |
| Which session started the command | Partly Undocumented, but agent commands in 2026.10.12 get |
Relying on it
| Question | Cursor Agentchecked at 2026.10.12-d47ca18 |
|---|---|
| Telling the agent's commands from yours | Not documented Not documented. Cursor doesn't say whether a person's own terminal in the editor also gets |
| Signs that nobody will answer a prompt | Not documented Not documented. Cursor doesn't say whether agent commands get a dumb terminal, pager overrides or a CI flag. |
| Removing or overriding it | Not documented Not documented. Cursor doesn't say whether |
Notes and sources
Cursor Agent, 2 sources
The variable to check, 2
- cursor-agent 2026.10.12 shell tool environment
Which processes get it, 2
- cursor-agent 2026.10.12 shell tool environment
Which session started the command, 2
- cursor-agent 2026.10.12 shell tool environment