Wake an idle agent session
A message to an agent waits in its mailbox. It never starts a model turn on its own, because a turn costs money. A wake is the separate, explicit action that starts one: you name a session, give an instruction and authorize that one paid turn.
What a wake needs
Section titled “What a wake needs”The server admits a wake only when all of these hold. If one is missing, the wake is refused and nothing is reserved.
| Requirement | Where it comes from |
|---|---|
| You are a workspace owner or admin, and you own the session if a person owns it | Your membership |
| The session is open, at the state you saw | The session’s epoch |
The grant carries session:wake and a wakes budget ceiling |
The grant the owner approved |
| The installed adapter measured idle wake | The helper publishes this |
| The workspace’s quiet hours allow a wake now | Workspace settings |
| No other wake of this session is running | One live wake per session |
Run the wake helper
Section titled “Run the wake helper”The wake helper runs on the machine of the agent’s installation, beside a
long-lived opencode server. It publishes what its adapter measured, asks every
30 seconds whether a wake is waiting, and starts the turn. sc-wake-helper install
hands it to your user’s own supervisor, which starts it at login and again after a
crash. See Keep the helper running.
Today two adapters qualified idle wake: opencode 2.2.5 and Claude Code 2.1.316. A Claude Code session has no server, so its helper works through hooks instead. See Wake a Claude Code session. The Codex adapter is in the helper and has not qualified yet, see Wake a Codex session.
-
Set the environment. Neither variable belongs on the command line.
Variable Value OPENCODE_SERVER_AUTH_HEADERThe Authorizationheader of your opencode serverSUPACLOUD_WAKE_HELPER_STORE_KEYOptional. Without it, the login leaves a key with your platform’s user-bound protection. Set it, base64 encoded, on a host without one, such as a container -
Enroll the installation once. On a machine with the
@supacloud/artifact-mcppackage the command issupacloud-artifact-mcp wake-helper; in the SupaCloud agent image it issc-wake-helper. Both take the same arguments.Terminal window sc-wake-helper login \--api-url https://app.example.com \--registration-profile <registration-profile-id> \--state-dir /var/lib/sc-wake-helperIt prints an address. Open it in a browser on the same machine, because the sign-in returns to
127.0.0.1. When you approve the agent, give itsession:wake. The helper then prints the workspace and installation ids.The login first prints
waiting up to <N> minutes for approval (source: …); the default is 15 minutes. SetSUPACLOUD_IDENTITY_LOGIN_TIMEOUT_SECONDS(whole seconds from 30 through 3600) or--timeout-secondson the login, which wins, to change it. A value outside the range is refused; on a timeout nothing is stored, so run the login again. -
Start the helper with those ids.
Terminal window sc-wake-helper \--api-url https://app.example.com \--workspace <workspace-id> \--installation <installation-id> \--harness-session <opencode-session-id> \--opencode-url http://127.0.0.1:4096 \--state-dir /var/lib/sc-wake-helperIt prints
wake helper readywith the identity session and epoch.
Keep the helper running
Section titled “Keep the helper running”Put the word install in front of the same arguments. The command checks that the
state directory holds a login, seals OPENCODE_SERVER_AUTH_HEADER into the state
directory under the installation’s platform-held key, writes the supervisor
definition and starts it:
sc-wake-helper install \ --api-url https://app.example.com \ --workspace <workspace-id> \ --installation <installation-id> \ --harness-session <opencode-session-id> \ --opencode-url http://127.0.0.1:4096 \ --state-dir /var/lib/sc-wake-helper| Platform | Supervisor | Restart after a crash |
|---|---|---|
| Linux | A systemd user unit under ~/.config/systemd/user |
Restart=always |
| macOS | A LaunchAgent under ~/Library/LaunchAgents |
KeepAlive |
| Windows | A logon task under SupaCloud in Task Scheduler |
The task runs sc-wake-helper supervise, which starts the helper again after every exit |
The secret never appears in the definition or on a command line. install refuses
when SUPACLOUD_WAKE_HELPER_STORE_KEY is set, because a supervisor would start a
helper that cannot read that key. Run install again after you rotate the opencode
secret.
Wake a Claude Code session
Section titled “Wake a Claude Code session”Claude Code starts a turn in an idle session when a hook with asyncRewake exits
with code 2. Its helper therefore needs hooks in the session and no opencode server.
A session reads its hooks when it starts, so a session that is already running does
not take part until it is restarted. The folder of the session must be a trusted one.
-
Add the hooks to the Claude Code settings of that machine.
<hook>is the commandsupacloud-artifact-mcp claude-wake-hook <state-dir>/claude, with the helper’s absolute state directory. In the SupaCloud agent image it isnode /app/dist/orchestration/claude-wake-hook-main.js <state-dir>/claude.{"hooks": {"SessionStart": [{ "hooks": [{ "type": "command", "command": "<hook>", "asyncRewake": true, "timeout": 604800 }] }],"Stop": [{ "hooks": [{ "type": "command", "command": "<hook>", "asyncRewake": true, "timeout": 604800 }] }],"UserPromptSubmit": [{ "hooks": [{ "type": "command", "command": "<hook>" }] }],"PostToolUse": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "<hook>" }] }],"SessionEnd": [{ "hooks": [{ "type": "command", "command": "<hook>" }] }]}} -
Start the helper with
--harness claude-code.--harness-session currentfollows the session the hooks reported last, also across/clear.Terminal window sc-wake-helper \--harness claude-code \--api-url https://app.example.com \--workspace <workspace-id> \--installation <installation-id> \--harness-session current \--state-dir /var/lib/sc-wake-helper
A session is idle for the helper only when its last turn ended and a hook is waiting. A turn that is running gets the message at its next tool call or prompt instead, and no wake fires into it. The helper counts a wake as provider activity when the session’s transcript shows the model’s answer to that wake.
Wake a Codex session
Section titled “Wake a Codex session”A Codex session has no server of its own either. The helper reaches the running Codex
client on the same machine, such as the VS Code extension, through its local channel,
and reads the session’s rollout file under $CODEX_HOME/sessions.
Start the helper with --harness codex and the thread id of the session as
--harness-session:
sc-wake-helper --harness codex --api-url https://app.example.com --workspace <workspace-id> --installation <installation-id> --harness-session <thread-id> --state-dir /var/lib/sc-wake-helperThe adapter publishes unknown for every stage until a paid wake has been measured on
an installed Codex client, so the Wake button stays away and a claimed wake is
refused. A session is idle for the helper only when its rollout ended a turn and a
running client owns the thread. A wake counts as provider activity when the rollout
shows output tokens after that wake’s message.
Wake a session
Section titled “Wake a session”-
Open Settings → Agent identities and choose Details on the agent.
-
Under Wake an idle session, find the open session. The row names the adapter and its version. A row without Wake says why: the installation has not reported its adapter, or the adapter has not qualified idle wake.
-
Choose Wake, enter the instruction, and choose Authorize one paid turn. This button is your consent to the spend. Nothing else gives it.


The helper picks the wake up within 30 seconds. A wake nobody claims expires after five minutes and its budget unit is returned.
Read how a wake ended
Section titled “Read how a wake ended”| Status | Meaning | Budget unit |
|---|---|---|
| Waiting for the helper | The server admitted it; no helper has taken it yet | Reserved |
| Taken by the helper | The helper has it and is starting the turn | Reserved |
| Provider activity observed | The model provider worked on this turn | Charged |
| Provider activity unknown | The turn may have run, but no provider evidence came back | Charged |
| Refused | The turn provably never started | Returned |
| Expired | No helper took it before the deadline, or the helper took it and never recorded a start | Returned |
The helper records a start with the server before it hands the instruction to the
harness. If it crashes after it took a wake and before that start, the turn provably
never ran: the wake ends as Expired with identity_wake_never_started at its
deadline and its unit is returned. A crash after the start ends as Provider activity
unknown, because the turn may have run. If the helper cannot record the start, it
does not deliver the instruction and reports the wake as Refused with
wake_start_unrecorded. A helper of an older release does not record a start; its
wakes keep the stricter rule and end as unknown after a crash.
A wake that reaches a session which is already working is delivered to its next turn
and shows as Refused with delivered_to_running_turn. The instruction arrived,
and no extra turn was paid for.
An acknowledgement alone never counts as a wake. Only evidence from the provider turns a wake into Provider activity observed.