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

# Declare a pull request

> Tell the factory which pull request a session's work landed in.

A pull request joins a work item when a session on that item opens or declares it. A pull request the agent opened in the session is usually linked when the session syncs. Declare it yourself when it was not.

Run this inside the session, from the checkout where the pull request was opened:

```bash theme={"system"}
outerlayer work pr 418
```

To name a different repository, add `--repo <owner/name>`.

The command sends only the session id, the repository and the pull request number. Declaring the same pull request twice is a no-op.

## Open the pull request too

`outerlayer work open-pr --title <text> --body-file <path>` opens the pull request and declares it in one step. If a pull request is already open on the branch, it edits that one instead. Run it again after you change the title or description.

* **In a host build**, the gateway opens it as the factory's GitHub App.
* **In your own session**, it runs `gh` under your login and then declares the result.

See [`work open-pr`](/reference/cli-work#outerlayer-work-open-pr).

## When it refuses

| Message | What to do |
| - | - |
| `no repository` | Run from a checkout with a git remote, or pass `--repo <owner/name>`. |
| `no active session detected` | Run it inside the session that opened the pull request, or [name the session yourself](#name-the-session-yourself). Nothing is sent. |
| `this session is not launched on a work item` | The session was most likely started without `OUTERLAYER_WORK`. |
| `<repository> is not a workpiece of this factory` | The repository is not connected to this factory. See [Connect a repository](/connect-repository), or fix `--repo`. |

## Name the session yourself

When the CLI cannot detect the session, for example from another shell, pass its id. For Claude Code, it is the id `claude --resume` takes. The session must still be on a work item.

```bash theme={"system"}
outerlayer work pr 418 --session-id <id>
```


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