Always-On Agents in Claude Code: Inbox, Timers, Memory, Permissions, Outbox#
Published by Alex Sorokoletov
An always-on agent sleeps between short runs, and five parts decide when it wakes, what it remembers and how it reaches you. In Claude Code they map to channels and scheduled-task triggers (inbox), /loop and cloud scheduled tasks (timers), auto memory (memory), auto mode and the hook defer decision (permissions), and PushNotification or a two-way channel (outbox).[1]
Anthropic published Building always-on agents on November 13, 2026, for teams that build on the Claude Platform. It names the parts but not the Claude Code setting behind each one. This page fills that gap, with the limits of each part, because the limits decide which setup survives a closed laptop.
The run cycle#
The guide's central point: an always-on agent is asleep most of the time. An event wakes it, it does one run inside a session (the transcript), saves what it learned, and sleeps again. A run ends in one of three ways: it sends a message, it decides nothing needs to be sent, or it stops at a tool call to wait for your approval.
In Claude Code, a run is one turn of a session that something other than your keyboard started: a cron fire, a channel event, a GitHub event, an API call or a claude -p invocation.
The five parts mapped to Claude Code#
| Part | What the guide asks for | Claude Code feature | Limit that matters |
|---|---|---|---|
| Event inbox | A durable list of events, one worker per inbox, batched events | Channels (an MCP server pushes events into an open session), cloud scheduled task GitHub and API triggers, Monitor | A channel event arrives only while the session is open. Channels are a research preview |
| Timers | Follow-ups the agent sets for itself, plus recurring schedules | /loop, CronCreate, ScheduleWakeup, Desktop and cloud scheduled tasks (/schedule) | /loop needs the session open, and recurring tasks expire after 7 days |
| Memory | A file directory: user instructions, user notes, past messages, task progress | Auto memory: MEMORY.md index plus one file per memory, CLAUDE.md for instructions | Auto memory is machine-local; a cloud task does not see it |
| Permissions | Credential proxy, auto mode, deferred tool calls | Auto mode, permissions.allow rules, PreToolUse "defer" with claude -p --resume | defer works only in -p runs with a single tool call in the turn |
| Outbox | A "send" tool, or a table of messages with a dispatcher | PushNotification, a two-way channel reply (Telegram, Discord, iMessage), a PR or issue comment | No pacing or retry: each send is immediate |
Event inbox: channels and triggers#
The guide routes every event source to one inbox so that two events cannot start competing runs and a crash cannot lose an event. Claude Code has three ways to get an event into a run:
- Channels. A channel is an MCP server that pushes events into the session you have open. Telegram, Discord and iMessage plugins ship in the research preview, and a channel can be two-way. Events arrive only while the session runs, so the session is the worker. Channels need claude.ai or Console authentication; they are not available on Bedrock, Google Cloud's Agent Platform or Microsoft Foundry, and Team and Enterprise organizations must turn them on.[2]
- Cloud scheduled task triggers. A task with a GitHub trigger runs on a matching repository event, such as
pull_request.opened. A task with an API trigger runs when you call its endpoint with its token. Each run is a fresh cloud session on a fresh clone.[3] Monitor. The tool runs a background command and feeds each output line back to Claude, or opens a WebSocket and treats each message as an event. It replaces polling inside a session that is already open.[4]
None of these is a durable queue. A channel event that arrives while the session is down is lost, and the guide's "inbox is the source of truth" rule is yours to build if you need it: write events to a table, and have a channel or an API trigger tell the agent to read the pending rows.
Timers: /loop, cron tools and scheduled tasks#
The guide's two kinds of timers both exist:
- Follow-ups the agent sets for itself. In a self-paced
/loop(no interval), Claude callsScheduleWakeupat the end of each iteration and picks the next delay, from one minute to one hour. It can also end the loop on its own withstop: true. A one-shot reminder ("in 45 minutes, check whether the tests passed") is aCronCreatetask that deletes itself after it fires. - Recurring schedules.
/loop 6h /growth-radarturns the interval into a cron expression. Cron has one-minute granularity, so seconds round up to a minute.[5]
Pick the scheduler by what must survive:
/loop and CronCreate | Desktop scheduled task | Cloud scheduled task | |
|---|---|---|---|
| Runs on | Your machine | Your machine | Anthropic cloud |
| Machine must be on | Yes | Yes | No |
| Session must be open | Yes | No | No |
| Local files | Yes | Yes | No (fresh clone) |
| Minimum interval | 1 minute | 1 minute when Claude sets it, 1 hour in the form | 1 hour |
| Permissions | Inherits the session | Per task | Auto mode by default |
Session timers have limits that a long-lived agent will hit:
- Recurring tasks expire 7 days after creation. The task fires one last time, then deletes itself. Recreate it before the seventh day, or use a cloud task.
- A missed fire does not catch up. If Claude is busy when a task comes due, it fires once when Claude is idle, not once per missed interval.
claude --resumerestores unexpired cron tasks, but does not restart background commands or monitors.- Fires have jitter: an hourly or daily task runs 0 to 30 minutes late, and a one-shot task set for
:00or:30can run up to 90 seconds early. Schedule time-sensitive tasks off the hour, for example3 9 * * *.[5]
Memory: auto memory and CLAUDE.md#
The guide's memory layout is Claude Code's auto memory; the guide names it as its example. The four kinds of memory it lists map to files Claude Code already loads:
| Guide's memory kind | Claude Code |
|---|---|
| User instructions, loaded every run | CLAUDE.md (project, user or managed), loaded in every session |
| User notes (role, preferences, corrections) | Auto memory files with type: user and type: feedback |
| Task progress | Auto memory type: project, or a progress file the task prompt names |
| Past messages | Not stored by auto memory; keep a sent-log file, or resume the same session |
Auto memory lives in ~/.claude/projects/<project>/memory/. MEMORY.md is the index, and Claude Code loads its first 200 lines or 25KB into every session; topic files load only when Claude reads them. That matches the guide's advice to load only an index and keep the rest on demand.[6]
Settings that matter for an unattended agent:
{
"autoMemoryEnabled": true,
"autoMemoryDirectory": "~/agents/inbox-agent/memory"
}
autoMemoryDirectory moves the store, for example onto a synced folder so a second machine shares it. CLAUDE_CODE_DISABLE_AUTO_MEMORY=1 turns auto memory off for one run. Auto memory is machine-local and is not shared with cloud sessions, so a cloud scheduled task needs its memory in the repository or behind a connector.[6]
The guide's rule "save a pointer, not a copy" is also auto memory's rule: it skips what it can derive from the code or git history, and its reference type stores where to find something, such as an issue tracker.
Permissions: auto mode and deferred tool calls#
A run holds your access and nobody watches it. The guide lists three parts.
Credential proxy. Claude Code has no general proxy that injects secrets into requests. The nearest equivalents keep the token out of the session: an MCP server or connector that holds its own credentials, and apiKeyHelper for the model API key. Keep tokens out of prompts and out of permissions.allow rules, where "Don't ask again" can save them in plain text.
Auto mode. A classifier checks higher-risk actions and blocks the dangerous ones, so a run does not stop at every prompt. Cloud scheduled tasks start in auto mode unless it is unavailable. One block does not end a run; after repeated blocks, a permission prompt appears in the run's session and waits for an answer.[3] /loop and session cron tasks inherit the session's mode, so start the session in the mode you want the timer to run in. A scheduled fire also asks before it runs a skill that declares allowed-tools or hooks; add Skill(name) to permissions.allow to run that skill unattended.[7]
Deferred tool calls. This is the guide's wait-for-approval mechanism, and in Claude Code it is a PreToolUse hook decision:
{
"hookSpecificOutput": {
"hookEventName": "PreToolUse",
"permissionDecision": "defer"
}
}
The round trip:
- A
claude -prun reaches a tool call, and your hook returns"defer". - The tool does not run. The result has
stop_reason: "tool_deferred"and adeferred_tool_usefield with the tool'sid,nameandinput. The session stays on disk with the call pending. - Your process shows the request to the user and waits; other work can run in the meantime.
- When the answer arrives, run
claude -p --resume <session-id>. The same call fires PreToolUse again, and the hook returns"allow"(with the answer inupdatedInputforAskUserQuestion) or"deny".[8]
Conditions, from the hooks reference:
| Condition | Result |
|---|---|
| Interactive session | defer is ignored with a warning |
| Several tool calls in one turn | defer is ignored; the call goes through the normal permission flow |
| Several hooks disagree | Precedence is deny > defer > ask > allow |
| Answer not ready on resume | The hook can return defer again; resume without a prompt until it allows or denies |
| Tool missing on resume (MCP server down) | stop_reason: "tool_deferred_unavailable"; CLAUDE_CODE_DROP_UNAVAILABLE_DEFERRED_TOOL=1 drops the call |
| How long it waits | No timeout; the session is kept until the cleanupPeriodDays sweep (30 days by default) |
| Permission mode on resume | Not restored; pass --permission-mode again |
So deferred calls fit an agent driven by claude -p or the Agent SDK. A /loop in an open terminal cannot use them; there, an ask rule stops the run at a prompt instead.
Outbox: notifications and channel replies#
Most agents need only the guide's "send" tool, and Claude Code has several:
PushNotificationsends a desktop notification from a local session, and a phone push with Remote Control or in a cloud session.[4]- A two-way channel replies on the platform the event came from. The terminal shows only the tool call and "sent"; the text appears in Telegram, Discord or iMessage.[2]
- The repository itself: a PR, an issue comment or a commit is an outbox that keeps history.
There is no dispatcher, so nothing paces or retries messages. The guide's advice still applies through the prompt: tell the agent when a run should end with no message, and start quiet.
Three setups, by how long the agent must live#
| Need | Setup | Breaks when |
|---|---|---|
| A watcher for a few hours or days, on your files | Open session with /loop, Monitor, auto memory, PushNotification | The session exits, or 7 days pass |
| A chat-driven assistant on your machine | Background session with a Telegram or Discord channel, auto memory | The machine sleeps, or the channel's research preview changes |
| An agent that outlives your laptop | Cloud scheduled task with schedule, GitHub or API triggers, auto mode, memory in the repo | It needs local files or a 1-minute interval |
| Your own product, with approvals in your UI | claude -p or the Agent SDK, your own inbox table, PreToolUse defer and --resume | You skip the inbox, and two events start two runs |
FAQ#
Is "Building always-on agents" a Claude Code feature launch? No. It is a design guide for the Claude Platform, published November 13, 2026. It cites Claude Code's auto memory, auto mode and hook-deferred tool calls as examples of three of its five parts.
Can Claude Code run an always-on agent without my machine? Yes, with a cloud scheduled task. It runs on Anthropic's cloud from a schedule, a GitHub event or an API call, starts in auto mode, and works on a fresh clone. The shortest interval is one hour, and it cannot read local files or local auto memory.
Why did my /loop stop after a week? Recurring session tasks expire 7 days after creation. The task fires a last time and deletes itself. Recreate it, or move the job to a cloud scheduled task.
Can a hook pause a /loop run until I approve?
No. "defer" works only in non-interactive claude -p runs, and only when Claude makes one tool call in the turn. In an interactive session it is ignored with a warning. Use an ask rule there, or run the agent through claude -p and resume with --resume.
Where does Claude Code keep an agent's memory between runs?
In auto memory, ~/.claude/projects/<project>/memory/, with a MEMORY.md index whose first 200 lines or 25KB load into every session. Set autoMemoryDirectory to move it.
Do channel events queue while the session is closed? No. A channel pushes events only into a session that is running. For events that must not be lost, store them yourself and let the agent read the pending ones on its next run.
Sources: [1] Building always-on agents, Anthropic, Nov 13, 2026; Reddit r/ClaudeAI thread. [2] Channels. [3] Cloud scheduled tasks. [4] Tools reference. [5] Scheduled tasks and /loop. [6] Memory. [7] Claude Code changelog. [8] Hooks reference: defer a tool call.
Related: Claude Code env-var glossary · Idle compaction · "Don't ask again" saved a secret · Claude Code versions