background: true
execute this way — the agent does its work, optionally pings you or reports
findings, and the fork is discarded.
Overview
When a background routine or reminder fires,run_agent_background creates
a temporary agent session. The agent’s text output is discarded — it
communicates only through MCP tools like ping_user, discord_embed, and report_updates.
After the task completes (or times out after 30 minutes), the forked
session is thrown away.
Background forks run without the agent lock. They execute concurrently
with your main conversation and with other background forks. State
isolation is handled through context variables — each fork gets its own
channel reference, config, and output tracking.
Each background fork session is limited to 1 non-critical ping
(hard-enforced in code). Additionally, when you’re mid-conversation
(the agent lock is held), non-critical pings return an error suggesting
the agent use
report_updates instead. critical: true bypasses all
three checks — per-session limit, busy state, and ping budget.Execution modes
Background forks support two execution modes that determine how the agent session is created.- Forked (default)
- Isolated
The default mode calls Forked mode is best when the task needs conversational context —
the agent knows what you’ve been working on and can make informed
decisions.
create_forked_client, which branches from
your current main session. The agent has access to your full
conversation history and context.routines/daily-review.md
| Field | Default | Description |
|---|---|---|
isolated | false | No conversation history instead of forking |
model | — | Model override. Isolated mode only |
thinking | true | Extended thinking override |
Communication
Background forks have two output channels: pinging (sending a visible Discord message) and reporting (queueing a summary for the main session). These are controlled independently.Pinging
The agent’s text output is discarded. To reach you, it must callping_user (plain text) or discord_embed (rich embed). These calls
are subject to the ping budget — each
non-critical ping consumes one token from the budget.
Set allow_ping: false to disable both tools entirely. This is enforced
at two levels: the tools are removed from the SDK’s tool list (the agent
never sees them), and the MCP handlers return errors as a fallback.
Unlike the ping budget, this is absolute — critical: true does not
bypass it. Use this for tasks that should never produce visible output.
Reporting to the main session
Thereport_updates tool queues a short summary to
~/.ollim-bot/state/pending_updates.json. These updates are prepended to the
next main session interaction, giving the agent context about what
happened in the background.
The update_main_session field controls when and whether the agent
must report:
| Mode | Behavior | Stop hook |
|---|---|---|
on_ping | Report if a ping/embed was sent | Blocks if pinged without reporting |
always | Must call report_updates | Blocks if not called |
freely | Reporting is optional | Never blocks |
blocked | report_updates returns error | Never blocks |
Tool restrictions
You can limit which MCP tools a background fork has access to. The agent never sees restricted tools — they’re removed at the SDK level.| Field | Default | Description |
|---|---|---|
allowed_tools | — | Whitelist. Bash(ollim-bot help) auto-included. |
disallowed_tools | — | Blacklist. Subtracted from default set. |
routines/email-check.md
follow_up_chain
propagates allowed_tools and disallowed_tools to child reminders
via ChainContext.
Configuration
All background fork fields available in routine and reminder YAML frontmatter:| Field | Type | Default | Description |
|---|---|---|---|
background | bool | false | Run as a background fork |
isolated | bool | false | Fresh session, no history |
model | string | — | Model override (isolated only) |
thinking | bool | true | Extended thinking override |
update_main_session | string | on_ping | always, on_ping, freely, blocked |
allow_ping | bool | true | Allow pings. critical does not bypass. |
allowed_tools | list[string] | — | Tool whitelist (SDK format) |
disallowed_tools | list[string] | — | Tool blacklist (SDK format) |
Examples
A fully configured background routine with all options:routines/accountability-checkin.md
routines/quiet-sync.md
reminders/take-medication.md
Next steps
Ping budget
How the refill-on-read budget controls background fork pinging.
Routines
Recurring cron-scheduled tasks that trigger background forks.
Reminders
One-shot and chainable reminders with follow-up chains.
Real-world examples
Background routine examples with conditional silence,
model overrides, and no-ping patterns.
