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

# Set up Garnet as a coding agent

> Add Garnet to existing pull request workflows and verify the current-head Runtime Review.

See the [public Execution Profile from ghaw #8](https://app.garnet.ai/public/runs/41724401762?profile=01a1a35e-dafc-77da-9438-781a3c2f2a4b) for the artifact you are setting up. You do not need an SDK, an API token, or a repository secret.

## 1. Edit the existing pull request workflows

Find the existing workflows in `.github/workflows/` that run on `pull_request`. Keep their triggers and job conditions. Do not switch to `pull_request_target` to obtain credentials.

Re-read [pins.txt](https://garnet.ai/pins.txt) on every setup. Copy its `uses:` line only if `OK=1`; do not use a cached SHA or a floating tag. If the manifest is unavailable or reports `OK=0`, stop and report that you could not verify the pin. Leave `jibril_version` unset so the Action uses its bundled default. Place the pinned step like this:

```yaml wrap theme={null}
- uses: actions/checkout@v6
- uses: garnet-org/action@24833a47c19aad605bb10bcd9b8cad8f318ca187 # v2.6.0
```

Place Garnet immediately after `actions/checkout` in each [supported Linux x86\_64 job](https://docs.garnet.ai/coverage.md) that runs on pull requests. Move and update an existing Garnet step instead of adding a duplicate. For matrix jobs, set the step's `job_index` input to `${{ strategy.job-index }}`.

Grant `id-token: write` for GitHub OIDC and ensure `contents: read` or an existing higher grant. Preserve all other effective permissions, including inherited workflow grants. If every caller of a reusable workflow is in this repository, add Garnet to the reusable workflow and verify or update the grants through every caller, including nested and non-PR callers. Leave the reusable workflow unchanged if any caller is outside this repository or you cannot verify or update its grants; report what is needed. If OIDC is not available, see the fallback in [Quick start](https://docs.garnet.ai/quickstart.md#add-the-action-to-your-workflow).

## 2. Commit, push, and open a pull request

Commit the workflow changes on a new branch, push the branch to GitHub, and open a pull request. Do not stop after editing or validating the files.

## 3. Ask the human to install the App

If the App is not installed on the repository, send the human only this link:

[https://github.com/apps/garnet-runtime-review/installations/select\_target](https://github.com/apps/garnet-runtime-review/installations/select_target)

The human completes installation in GitHub. The Action records the job; only the App posts the PR comment.

## 4. Verify that head

Read the current pull request head SHA from GitHub, not the workflow's test-merge SHA.

Call `pr_review` on the [Garnet MCP](https://api.garnet.ai/api/v2/mcp) with `githubOrg` (the GitHub owner), `repo` (the bare repository name), and `pullNumber` (an integer). Require `status: finalized`, `bound_to_head: true`, and both `head_sha` and `marker_commit` equal to the current GitHub PR head. Read `result`, `capture_quality`, `reasons`, and `comment_url`. Use the product MCP for PR evidence, not the [docs MCP](https://docs.garnet.ai/mcp), which searches the documentation.

If MCP errors or returns no usable result, read the trusted `garnet-runtime-review[bot]` comment on the PR. In the raw comment, match `<!-- garnet:commit <sha> -->` and the `garnet:summary` JSON's `commit` to that same head, and require the summary's `status: finalized`. The comment calls the classification `outcome`; MCP calls it `result`. See [the comment contract](https://docs.garnet.ai/consume.md#the-comment-contract).

* **No comment or still recording:** `missing` while CI runs or `recording` is pending. Check once after CI finishes, or on the next requested review; do not wait or poll. If CI finished and there is no comment, check that the App is installed on this repository.
* **Wrong head or unusable record:** `stale`, `malformed`, `unsupported`, `incomplete`, and a classification of `not-recorded` do not verify the PR. Require `capture_quality` of `complete` or `best-effort` on either path; missing or `partial` capture is unknown. A finalized `first` is a record, not a comparison. `best-effort` can support a recorded observation, not completeness; a no-change result without `complete` capture is unknown, never clean.
* **No OIDC grant:** If the job lacks `id-token: write`, check the Garnet step log and correct the effective permissions. On eligible [fork pull requests](https://docs.garnet.ai/coverage.md#fork-pull-requests) without OIDC, check for the uploaded `garnet-run-*` artifact. The App on the base repository collects it after the run; an upload alone does not verify the comment.
* **Unsupported runner:** An unsupported platform or architecture is skipped and records nothing. Check [runner coverage](https://docs.garnet.ai/coverage.md); a green CI job does not prove recording.

**Return the proof:** Give the current head SHA, the verified `result` (or comment `outcome`), its capture limit, and the App comment URL. If the comment has a public **Full record in Garnet** link, include that exact Execution Profile URL. If there is no usable current-head record, report why instead of presenting an older or pending URL as proof.


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