> ## Documentation Index
> Fetch the complete documentation index at: https://wiggum.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# agent

> Autonomously process your GitHub backlog — pick issues, generate specs, run Ralph loops, review diffs, and auto-merge PRs.

```bash theme={null}
wiggum agent [options]
```

Agent mode reads your GitHub backlog, selects the highest-priority issue, generates a spec, runs the full [Ralph loop](https://wiggum.app/docs/using-wiggum/ralph-loop.md), reviews the diff against the spec, and auto-merges when checks pass — then moves to the next issue. Zero intervention required.

## How it works

**1. Read backlog**

Fetches open GitHub issues and ranks them by priority labels (`P0` > `P1` > `P2`) and dependency order.

**2. Assess feature state**

For each issue, determines the right action: start fresh, generate a plan, resume an existing implementation, skip if already shipped, or comment on an existing PR.

**3. Generate spec**

Creates an implementation-ready spec from the issue context (title, body, labels) — same quality as `wiggum new`.

**4. Run Ralph loop**

Executes the full 5-phase Ralph loop: planning → implementation → E2E testing → verification → PR review.

**5. Review and merge**

Reviews the diff against the spec. In `merge` mode, auto-merges the PR when all checks pass, then moves to the next issue.

## Flags

**--labels** `string`

Comma-separated GitHub labels to filter issues. Only issues with at least one matching label are processed.

```bash theme={null}
wiggum agent --labels bug,P0
```

**--issues** `string`

Comma-separated issue numbers to process. Restricts agent to specific issues instead of the full backlog.

```bash theme={null}
wiggum agent --issues 42,38,15
```

**--max-items** `number`

Stop after completing this many issues.

```bash theme={null}
wiggum agent --max-items 3
```

**--max-steps** `number`

Stop after this many orchestrator steps (tool calls). Safety limit to prevent runaway execution.

**--review-mode** `string` (default: manual)

Controls what happens after loop completion:

* `manual` — Creates PR, stops for human review
* `auto` — Auto-reviews the diff, creates PR
* `merge` — Auto-reviews, creates PR, and auto-merges when checks pass

**--model** `string`

Override the AI model for the orchestrator.

**--dry-run** `boolean` (default: false)

Simulate the full workflow without executing loops or creating PRs. Useful for testing issue selection and spec generation.

**--stream** `boolean` (default: false)

Force headless streaming output. Skips the TUI even in interactive terminals.

**--diagnose-gh** `boolean` (default: false)

Run GitHub connectivity checks to debug authentication or permission issues.

## Routing behavior

| Condition | Output |
| - | - |
| Interactive TTY (not CI) | TUI with live orchestrator display |
| `--stream` flag | Headless streaming output |
| Non-TTY or CI | Headless streaming output |

## Examples

```bash Interactive theme={null}
wiggum agent
```

```bash Process P0 bugs only theme={null}
wiggum agent --labels P0,bug --review-mode merge
```

```bash CI pipeline theme={null}
wiggum agent --stream --review-mode merge --max-items 5
```

```bash Specific issues theme={null}
wiggum agent --issues 42,38 --review-mode auto
```

```bash Dry run theme={null}
wiggum agent --dry-run --labels P1
```

## Feature state assessment

Before processing each issue, the agent assesses the current state and decides the right action:

| State | Action |
| - | - |
| No branch, no spec | Start fresh — generate spec, run full loop |
| Spec exists, no branch | Generate implementation plan, run loop |
| Branch exists, partial work | Resume implementation from last checkpoint |
| PR already open | Comment on existing PR, skip to next issue |
| PR already merged | Check remaining tasks, close issue if done |

This prevents duplicate work and ensures the agent picks up where it left off after interruptions.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.