The answer to "how do I keep a workspace up while a long job or coding
agent runs?" only lived in the [reference
page](https://coder.com/docs/reference/#workspace-agents), which is hard
to find. This adds a **Keep a workspace running without a connection**
section to the scheduling page under Activity detection:
- Background processes (Claude Code in `tmux`, Herdr, `nohup` jobs)
don't count as activity.
- `coder schedule extend` from the CLI, and `PUT /extend` from a script
with a user token.
- **Keep coding agents running:** template examples for Claude Code and
Herdr. A `coder_script` uses the owner's build session token once to
mint a token scoped to `workspace:read` + `workspace:update` and
allow-listed to the workspace. It also installs a `coder-keepalive`
helper. Claude Code calls the helper from `managed_settings` hooks, and
Herdr calls it from a `post_start_script` loop. Neither needs a module
change. Matching README examples: coder/registry#1262.
This deliberately avoids app status / AgentAPI reporting.
<details>
<summary>Validation</summary>
On a local v2.38.8 deployment, I used three Docker workspaces with no
IDE, SSH, or terminal connection. Autostop was 2m, and Claude Code went
through dogfood's AI Gateway running about 30 sequential tool calls over
about 11 minutes. The template used the snippets from this page
verbatim, with the unmodified modules from registry `main`.
| Workspace | Result |
| --- | --- |
| Control (no keep-alive) | Stopped about 1 minute after its deadline
while Claude worked |
| Claude Code hooks | Deadline moved to now + 1h at 13:32, and again at
13:43. No changes after Claude finished |
| Herdr loop | Deadline moved to now + 1h at 13:32. No changes after the
agent went idle |
The scoped token from inside the workspace: `PUT /extend` returns 200.
Stopping or deleting the workspace returns 403. Other workspaces,
`/users/me`, and token creation return 404. A full `GET
/workspaces/{id}` is forbidden with the allow list, which is why the
helper uses `?include_related=latest_build`.
</details>
---
🤖 Generated with Coder Agents using Claude.