Schedules & Recurring Jobs
Create recurring repo jobs that run reusable prompts against a repository, store run history, and link every run back to a normal OpenCode session.
What Schedules Are Good For
Schedules make OpenCode Manager proactive instead of purely session-driven. Good examples include:
- Repo health reports for a quick morning review
- Dependency watchlists to catch upgrade pressure early
- Release readiness checks before a ship window
- Docs drift reviews to spot stale setup instructions
- Tech debt triage for recurring cleanup planning
Each run is stored with status, timestamps, logs, assistant output, and a linked session you can open and continue.
Cancelling during startup stops model loading and prevents later prompt submission. If session creation was already in flight, the returned session is interrupted rather than prompted.
Creating a Schedule
- Open a repository
- Click Schedules
- Click New Schedule
- Configure the job name, prompt, timing, and optional overrides
- Save the schedule
The schedule is scoped to the current repository. To see another repository's schedules, or every schedule at once, click the page title in the schedules header and pick a repository or All repos.

Timing Options
The schedule builder supports both simple presets and advanced cron:
- Interval - Repeat every N minutes
- Hourly - Run once each hour at a chosen minute
- Daily - Run once per day at a chosen time
- Weekdays - Run Monday through Friday
- Weekly - Pick one or more weekdays and a time
- Monthly - Run on a day of the month
- Advanced - Enter a cron expression directly
Cron-based schedules also store a timezone so runs happen when expected.

Prompt Templates
Built-in prompt templates help you start quickly with recurring jobs like:
- Repo health report
- Dependency watchlist
- Release readiness review
- Test stability audit
- Docs drift review
- Tech debt triage
- Security and config review
- CI and ops review
Applying a template fills the schedule name, description, and prompt so you can customize from a strong default instead of starting from scratch.

Agent and Model Overrides
Schedules can run with:
- the default workspace agent and model
- a custom agent slug
- a specific model override when needed
OpenCode Manager allows up to 15 seconds for a fresh worktree's model catalog to load before treating a missing requested or configured model as unavailable. It prefers the schedule override, then the configured model, then OpenCode's default, then the first enabled model. A fallback can use a different provider. Model-catalog requests are bounded by that deadline.
Skills
Each schedule can optionally attach skill slugs and notes. Skills modify the agent's behavior during the run — for example, you could attach a review-focused skill to a weekly code review schedule.

The Skills tab in the schedule dialog lets you:
- Select one or more skill slugs from a multi-select input
- Add free-form notes (max 2000 characters) that the agent receives as additional context
When the run starts, the Manager resolves the selected skill slugs against the skills available in the run's location and attaches the matching skills directly to the submitted prompt, making them available to the agent for that run only. Skill slugs that are not available in the location are omitted, and if the available skills cannot be listed the run continues without any skill attachments.
MCP Servers
The MCP tab attaches MCP servers to a schedule. A run in a worktree is a location OpenCode has not seen before. MCP servers you connected by hand in the repo are not connected there, so any server a run needs has to be attached here.
- Configured MCP servers - Choose from the servers available in the repo, including ones turned off in the OpenCode configuration. Each run connects the selected servers before it starts.
- Schedule-only MCP servers - Define a local or remote server that exists only for this schedule. It is added to each run's location and never written to the OpenCode configuration. The definition is stored with the schedule, so use
{env:NAME}or{file:path}placeholders instead of pasting secrets.
The Manager connects every attached server before it creates the run's session. The run fails with the server name and reason if a server is not configured for the location, cannot connect, or needs OAuth authorization. Runs are unattended and cannot complete an OAuth flow, so authorize OAuth servers in Settings > MCP Servers before attaching them.

Connections are made at the run's directory, so they do not affect other sessions. OpenCode stops a run location's MCP servers once that location has been idle for about an hour. Schedules without a worktree, such as Assistant schedules, run in the repo directory itself. There, a connection stays until OpenCode restarts, just like turning on the server in the repo's MCP panel.
Workspace Modes
The Workspace setting on the General tab chooses where a schedule's runs work:
| Mode | Where each run works | After the run |
|---|---|---|
| Fresh worktree, cleaned up (default) | A new worktree on branch schedule/{jobId}/run-{runId} | Changes are committed to the run branch and the worktree is removed. A branch without a commit is deleted. |
| Fresh worktree, kept | A new worktree on branch schedule/{jobId}/run-{runId} | Changes are committed to the run branch and the worktree stays on disk so you can continue in it. |
| Shared worktree | One worktree on branch schedule/{jobId}/shared, reused by every run | Changes are committed to the shared branch, so work builds up from run to run. |

Every schedule in a git repository runs in a worktree. Assistant schedules, and schedules in a folder that is not a git repository, run in the directory itself and have no workspace setting.
Run worktrees live under <workspace>/schedule-worktrees/, named job-{jobId}-run-{runId}, or job-{jobId}-shared for a shared worktree.
A run fails if its branch is already checked out somewhere else, such as your main checkout. Switch that checkout to another branch so the schedule can run.
The Workspace setting cannot be changed while a run is in progress, and a schedule or its repository cannot be deleted until its running run is cancelled. Deleting a repository removes its schedules' worktrees the same way deleting a schedule does.
Schedule worktrees do not run worktree setup commands, so have the prompt install anything the run needs.
A worktree gives a run its own checkout: ordinary checkout changes and branch switches happen there instead of in your working directory. A worktree is not a filesystem jail: shell commands may affect other accessible paths, including the main checkout.
Manager does not automatically push schedule branches, but an agent with shell access can push explicitly.
Deleting a run or clearing run history deletes the run branches of runs whose worktree is already gone. When kept worktrees are still on disk, you choose what happens to them:
- Commit and remove: pending changes are committed to each run branch, then the worktree folders are removed. The branches are kept.
- Force delete: the worktree folders are force-removed and their run branches deleted. Any uncommitted changes are lost.

Clearing history never touches the shared worktree or its branch. Deleting branches does not guarantee immediate erasure of Git objects or outputs saved elsewhere.
Managing Kept and Shared Worktrees
The job details list every worktree the schedule still has on disk, with its branch. Remove one, or use Remove all; a worktree in use by a running run cannot be removed. Removing a worktree commits any pending changes to its branch first and keeps the branch. Deleting the schedule does the same for all of its kept and shared worktrees.

A repository's Worktrees tab also shows schedule worktrees, grouped under their schedule, so you can open a session or a terminal in a kept run's worktree.
Branch Configuration
By default, run worktrees branch off the repository's default branch. You can override this by specifying a base branch in the schedule settings. A shared worktree only uses the base branch when it is first created.
Linked Servers
Schedules also run on linked OpenCode servers. Select a linked server in the switcher and click Schedules on one of its project rows, or open the project and use the same button, to create a job scoped to that server and project directory.
Remote schedules always use the in place workspace mode: each run works directly in the project directory on the linked machine. The workspace options and base branch are hidden, because there is no Manager checkout or worktree to branch from. Everything else works as it does locally, including timing, prompt templates, agent and model overrides, attached MCP servers, permissions, run history, and opening the linked session.
If the server is disabled or no longer registered when a run is due, the run is recorded as failed instead of starting. The All repos view of the schedules page includes linked-server jobs, labelled with the server name, and opening one goes to its project page on that server.
The Skills tab still lists the skills managed by the Manager and attaches the selected slugs to each run; a skill that the linked server does not expose is dropped from that run.
Permission Configuration
Every schedule includes a Permissions section in the General tab. These settings control what the agent can access and execute during unattended runs.

Allow Access Outside the Working Directory
When disabled (the default), OpenCode's external_directory permission is denied. This blocks file-tool operations that request that permission; it is not comprehensive filesystem confinement. Enable this if the schedule requires file tools to access paths outside its working directory (e.g., a shared configuration directory).
This is a file-tool boundary, not a per-worktree jail for shell commands. A sandboxed run's shell commands run in the run's own microVM, which mounts only that run's worktree (or the repo directory for Assistant schedules) and the repository's shared git directory, so it cannot reach other repositories or worktrees; see Sandbox.
Allow Questions
When disabled (the default), the agent's question tool is denied so an unattended run cannot stall waiting for an answer nobody is there to give. Enable it only when the run is supervised, since an unattended run that asks a question can stall waiting for an answer.
Blocked Bash Commands
The following bash command patterns are always blocked by default:
git push --force*
git push -f *
sudo *
dd *
mkfs*
shutdown*
reboot*
halt*
kill -9 *
killall *
These patterns prevent dangerous commands whose blast radius escapes the run's worktree. File-mutating commands (rm -rf, git reset --hard, etc.) are intentionally omitted because a worktree is meant to be disposable; a shell command can still reach paths outside the worktree, so treat the deny list as a guard against the worst host-level commands rather than a complete sandbox.
You can customize the deny list by adding or removing glob patterns. One pattern per line. Changes apply to all future runs of that schedule.
Sandbox
The General tab has a Sandbox section with Run in sandbox. When it is on, each run's session — and every subagent of that session — runs its agent shell commands inside a dedicated microVM instead of the Manager container. The Manager's own shells, file tools, and extensions are unaffected; see Agent Sandboxing.
- CPUs and Memory (GiB) are optional. Leave both blank to use the server defaults, or the sandbox defaults from Settings → OpenCode Config → Server maintenance → Sandbox when those are set. Enter both or neither: 1–64 CPUs and 1 GiB–1 TiB. A value above the host's CPUs or memory is rejected.
- The job details show the setting as Off, On · server defaults, or On · 2 CPUs · 4 GiB.
- Each run gets a fresh microVM, so guest storage and Docker data from one run never reach the next. Files a run writes to its working copy do persist, so an in-place run leaves them in the repository directory itself.
The switch is disabled, with the reason shown, when:
- Sandboxing is turned off in Settings → OpenCode Config → Server maintenance → Sandbox.
- The host cannot sandbox (no
/dev/kvm); see Host Requirements. - The job runs on a linked server. Sandboxed schedules run only on the local OpenCode server, and the option is hidden for a linked-server job.
A run's microVM mounts the run's own working copy — its worktree, or the repository directory for in-place and Assistant runs — plus the repository's shared git directory and the same Manager directories a session sandbox mounts. Only that working copy is a valid working directory, so a shell command cannot reach another run's worktree. Docker is available inside the guest after ocm-dockerd-start, with a data volume private to the run.
When the run finishes, fails, or is cancelled, the run's sandbox is removed along with its Docker data volume. Turning sandboxing off for the server while a job still has it enabled makes the next run fail with the reason instead of running unsandboxed.
Run History
Each schedule stores a run history panel with:
- Status - Running, completed, failed, or cancelled (a running run can be stopped with Cancel run)
- Trigger source - Manual or scheduled
- Log output - Execution metadata and captured results
- Assistant output - Rendered markdown, with a Read aloud button when Text-to-Speech is enabled
- Errors - Failure details when a run does not complete
This makes recurring jobs easy to review without digging through raw session data first.
Unread Reports
A completed or failed run stays unread until you open it. Unread runs show a NEW pill in the run list, and a schedule whose latest run is unread shows one too. The Reports bell lists unread reports and offers Mark all read. In the run drawer, Next unread (N) jumps to the next unread run. On mobile, the Schedules tab shows a badge while any report is unread.

Linked Sessions
Every run creates or attaches to a normal OpenCode session.
Use Open session to continue from the generated report, answer follow-up questions, or debug provider, permission, or tool issues.
What it opens depends on where the run worked:
- In the repository (Assistant schedules), in a kept or shared worktree, or still running: the run's own session.
- In a cleaned-up worktree that has finished: the worktree is removed when the run ends, so the original session can no longer do any work. Instead, a new session opens in the repository with the run's full output, any error, and the branch and commit holding the run's changes added as context. It uses your normal permissions rather than the run's unattended ones, and nothing is sent to the model until you write a message.
This keeps automation connected to the rest of the OpenCode Manager workflow instead of creating a separate silo.
On mobile, the native app exposes the same schedules through its Schedules tab, with an Inbox of unread reports that reads them in a row, each repository's Schedules screen, a run detail screen, and a header Reports tray with Mark all read. See Mobile & PWA.
Best Practices
- Keep prompts focused on one recurring outcome
- Prefer a few high-value schedules per repo over many overlapping jobs
- Use manual runs to validate a prompt before relying on the schedule
- Review failed runs quickly so broken provider or permission setups do not go unnoticed
- Treat schedules as reusable repo routines, not long-running background workers
Troubleshooting
Run Failed
- Open the run from Run History
- Check the Error tab for the failure message
- Use Open session to follow up on the failure with the agent
- Verify provider credentials, model availability, and any pending agent questions or permissions
No Assistant Output
If a run starts but does not produce assistant output:
- Open the linked session
- Check for a provider error
- Check whether the agent asked a question or needed permission
- Re-run the schedule manually after fixing the issue
Prompt Needs Iteration
Use Run now to test prompt changes immediately before waiting for the next scheduled run.