# Pause the factory and give it hours

> Turn off a repo's factory (or all of them), give it hours («daytime only», «nighttime only», «no weekends») or put a single task to sleep. What stops, what finishes, and how a terminal agent sees it.

URL: https://www.ghosty.studio/en/docs/factory/pause

A repo's factory has three states: **On**, **Paused** and **Scheduled**. Change it in **Development**, next to Automerge, from the terminal with `ghosty-dev factory`, or through the API. It is your preference: it applies to the tasks you send.

## What a pause does

| | Paused |
|---|---|
| New tasks | Don't start: they wait **Queued** and start on their own when the factory resumes, in arrival order |
| Agents already writing | Their current turn finishes; they aren't woken again (CI, review, live test) until it resumes |
| Automerge | Frozen: every open PR carries the **«Ghosty · Fábrica en pausa»** check in progress, with the reason and when it comes back |
| Manual merge | Always allowed: Ghosty asks you to confirm «merge even though it's paused» |
| Previews | No new boxes; on resume the open PRs get theirs |

Nothing is killed: whatever was running finishes, as in Devin, GitHub Actions or Factory. What you ask the agent yourself (a message, «Another round») goes through even while paused.

## Hours

Presets say when it **does** work, in Mexico City time:

- **Daytime only (8–22)**: `* 8-21 * * *`
- **Nighttime only (22–8)**: `* 22-23,0-7 * * *`
- **No weekends**: `* * * * 1-5`

A custom 5-field cron (matching minutes are the active ones) and another time zone also work. Outside the hours behaves like a pause, and the queue starts on its own when the window opens.

**Pause until…** sets a return time on top of whatever is set («until tomorrow 8:00»); when it passes, it goes back to what it was. **All my repos** applies the same to each of your repos.

## Put a task to sleep

In a task's detail, **Sleep** keeps it still without killing it: it keeps its box and branch, doesn't wake the agent, doesn't rebuild the preview and doesn't merge on its own. **Resume** continues where it left off. **Stop** still ends it.

## From the terminal

```
ghosty-dev factory status
ghosty-dev factory pause --until 2026-11-23T08:00:00-06:00 --reason "night"
ghosty-dev factory schedule day        # day | night | weekdays | "<cron>"
ghosty-dev factory resume
```

`next`, `claim` and `asks` check before taking work. While paused they answer «Fábrica en pausa hasta las 8:00. No tomes trabajo nuevo; termina lo que traes y detente» and exit with code **6**. `wait` reports when it changes.

## API

`GET /api/v2/me/repos/{owner}/{name}/factory` → `{active, until, closesAt, reason, mode, schedule, timezone, line, queued}`.
`POST` with `{action: "pause", until?, reason?}`, `{action: "resume"}` or `{action: "schedule", preset?|schedule?, timezone?}`. `?all=1` (or `all: true`) = all your repos. Scope `dev`, `repo:env` or `agents:write`.

`dev_run_start` while paused answers `factory_paused` (HTTP 202) with the task queued; `merge` answers `factory_paused` (409) until you send `force: true`.
