Nightshift
The fleet file reference
Everything Nightshift will do lives in one readable file. It is deliberately hand-editable, because reading it before starting an unattended run is the whole trust mechanism.
Last updated: July 25, 2026
Quick answer
nightshift.yaml defines a goal, a set of roles, and the limits they run under. Each role has a cron cadence, a standing prompt, a mode controlling how far it can reach, optional gates that must pass, and optional connector requirements. Unknown keys are rejected outright, so a typo is a loud error rather than a role that silently never runs.
- One file describes the entire system
- Roles carry cadence, prompt, mode, gates and connector needs
- Modes are read_only, draft or autopublish
- Sandbox defaults to workspace and never wider
- A typo in a key is an error, not a silent no-op
On this page
A complete example
version: 1goal: Grow this SaaS to 50 paying customersdefaults:provider: claude # or codexsandbox: workspace # readonly | workspace | fulltimeout: 20mmax_turns: 40limits:tokens_per_day: 2000000max_repair_attempts: 2catch_up_limit: 3wall_clock_per_cycle: 2hpolicy:never:- commit secrets or credentials- force push to the main branch- email the same person twicerequire_review:- pricing changes- increase ad spendroles:engineer:cadence: "0 2 * * *"prompt: Implement the highest-value unfinished task.gates:- run: npm test- run: npm run lintcontent:cadence: "0 */2 * * *"mode: draftprompt: Write one piece of content that serves the goal.gates:- run: test -n "$(ls -A .nightshift/content)"reviewer:cadence: "0 4 * * *"provider: codex # a different model reviews the workmode: read_onlyprompt: Review last night's changes and report problems.finance:cadence: "20 */6 * * *"mode: read_onlyneeds_mcp: [stripe]prompt: Write a short revenue report to .nightshift/reports/.
Role fields
- cadence: a five-field cron expression, or @hourly, @daily, @weekly, @monthly. Required.
- prompt: the standing instruction, describing what the role does every time it wakes up.
- mode: read_only, draft or autopublish. Defaults to draft.
- provider: claude or codex. Defaults to the fleet default.
- model: passed through to the provider, so cheap work need not use an expensive model.
- sandbox: readonly, workspace or full. Defaults to the fleet default of workspace.
- timeout: how long a single attempt may take.
- max_turns: a runaway guard. Honoured by Claude Code; Codex has no equivalent.
- gates: commands that must pass before the work is accepted.
- needs_mcp: connector capabilities this role cannot work without.
- add_dirs and allowed_tools: extra directories and per-task tool permissions, on Claude.
- enabled: set to false to keep a role in the file without running it.
Modes decide how far a role can reach
- read_only inspects and reports, and is forced into a read-only sandbox whatever else the file says.
- draft writes files for you to review, and never publishes, posts or sends. This is the default.
- autopublish acts on the outside world. It is always opt-in and is never produced by generation.
Autopublish is the real safety line
A draft role can still read your inbox or your revenue data through a connector, but it cannot send, post or spend. Turning on autopublish is the moment a role can affect other people, so it is never a default and never generated for you.
Limits are hard ceilings
- tokens_per_day stops the fleet when the day's budget is used, rather than failing halfway through the night.
- max_repair_attempts bounds gate-failure repair, so a permanently broken gate cannot loop until morning.
- catch_up_limit caps how many missed windows are considered after downtime.
- wall_clock_per_cycle bounds a single cycle, so one wedged role cannot consume the night.
Set a token ceiling
Validation warns when tokens_per_day is unset, because an unattended overnight run with no budget is how people end up surprised.
The policy layer
Policy rules are injected into the agent's own instructions, which is the only tier that understands intent. A coarse pre-execution screen also catches a task whose description obviously restates a forbidden action, and deterministic caps elsewhere (draft mode, budgets, secret scanning) are what actually stop runaway behaviour.
- never: actions that must not happen at all. The agent is told to refuse the task rather than find a way around the rule.
- require_review: actions allowed only after a human looks at them. The agent stops and writes what it would have done.
Cover the non-code risks too: contacting people, publishing claims, changing prices and spending money.
Sandbox levels
- readonly maps to a plan-only permission mode on Claude and read-only on Codex.
- workspace allows edits inside the working directory. This is the default everywhere.
- full removes isolation and requires allow_full_sandbox: true at the top level, so an escalation cannot hide inside one role's block.
Full access is refused on Codex
Codex has no per-task tool allowlist, so the sandbox level is the only containment that exists there. Nightshift refuses the combination of sandbox: full and provider: codex outright. Use Claude, or a narrower sandbox.
Frequently asked questions
What happens if I misspell a key in nightshift.yaml?
It is a hard error naming the unknown field. Silently ignoring a typo like cadance would mean the role never runs and you would not find out until morning, so unknown keys are rejected instead.
Can one fleet use both Claude Code and Codex?
Yes. Set provider per role. A common pattern is an engineer role on Claude and a reviewer role on Codex, so a different model reviews the work in the same run.
Why does my role show a downgrade warning?
Because the provider cannot honour something the role asked for. Codex has no turn cap, no per-task tool allowlist, no extra-directory flag and cannot be assigned a session id. Each unsupported option is reported rather than silently dropped, and nightshift doctor lists them all up front.
Was this page helpful?
Related articles
Nightshift
What Nightshift is
Nightshift runs a fleet of AI agents on your own machine on staggered schedules, driving the Claude Code or Codex CLI you already pay for.
Nightshift
Verification gates
Gates are shell commands that must pass before a role's work is accepted. How to write them for code, content, research and reports.
Nightshift
Scheduling, catch-up and budgets
How cadences, catch-up after downtime, token ceilings and pacing keep an unattended Nightshift run inside your plan's limits.