# Quickstart

Six steps from nothing to Factory opening its first pull request.

Rendered page: https://agentrelay.com/docs/factory/quickstart
Markdown endpoint: https://agentrelay.com/docs/factory/markdown/quickstart.md

---

Follow these in order. Steps 1–4 touch nothing; the first real dispatch is step 6.

## 1. Install

```bash
npm install -g @agent-relay/factory
```

Factory talks to a relay broker through the `agent-relay` sidecar. Install and sign in to that separately — it's a peer, not a dependency.

## 2. Connect GitHub to your relay workspace

Give it push access to the repos you want worked on. Factory publishes branches and opens PRs through that workspace connection — a local `gh` login is **not** required.

## 3. Write a config

`factory.config.json`. A repo route is the only thing you truly need:

```json
{
  "repos": {
    "byLabel": { "pear": "AgentWorkforce/pear" },
    "clonePaths": { "AgentWorkforce/pear": "/path/to/your/pear/checkout" },
    "default": "AgentWorkforce/pear"
  }
}
```

`byLabel` maps an issue label to a repo. `clonePaths` tells the agent where that repo lives locally, so it has somewhere to make changes. Add `workspaceId` only to pin a workspace other than your active one.

For a GitHub-only setup, add `"issueSource": "github"` — or leave it out and Factory picks GitHub automatically when `/linear/issues` isn't connected.

> Don't hand-write this. `npx prpm install @agent-relay/factory-config` and let your coding agent author it — see [Configuration](/docs/factory/configuration).

## 4. Mark an issue for Factory

Nothing is picked up until it passes the [safety scope](/docs/factory/safety-scope). By default that means the title starts with the configured prefix, it carries the `factory` label, and it belongs to the configured team.

## 5. Dry run

Discovers and triages, writes nothing, spawns nothing:

```bash
factory run-once --config ./factory.config.json --dry-run
```

> Pulled some issues but dispatched none? That's the safety gate working. The issues are real but outside your scope.

## 6. Let it work

```bash
# one discovery → dispatch cycle, then exit
factory run-once

# or run continuously — the production form
factory start
```

## Next

- [Safety scope](https://agentrelay.com/docs/factory/safety-scope): Widen what Factory is allowed to touch, deliberately.
  - [Configuration](https://agentrelay.com/docs/factory/configuration): Repo routing, models per role, states, and writeback.
