# Let your coding agent act on review comments

People are good at spotting what's wrong in a prototype, and agents are good at the edit that fixes it. This guide connects the two: reviewers comment in Ollav and your agent reads the comments, edits the source, ships a new version and resolves the threads.

## Prerequisites

- An Ollav API key in `OLLAV_API_KEY` (create one at https://app.ollav.app/keys)
- Ollav connected to your agent over MCP ([setup for each client](https://ollav.app/docs/agents)), or a shell with curl

## The loop

```text
share_html ──► reviewers comment ──► get_review ──► edit source ──► publish_new_version ──► resolve_comment
                     ▲                                                                      │
                     └──────────────────────────────────────────────────────────────────────┘
```

### 1. Share

```text
Build the prototype as a single HTML file and share it on Ollav. Give me the link.
```

### 2. Read the open threads

`get_review` returns the open threads as Markdown, then as JSON. Each thread has:

- `comment`: what the reviewer said
- `anchor.quote`: the text of the element it's pinned to. **Search your source for this.**
- `anchor.reproduceNote` and `breadcrumbs`: how to reach the state where the element is visible
- `anchor.selector`: a selector for the rendered DOM (useful for checking, but not a source location)
- `onCurrentVersion`: false if the comment was made on an earlier build

### 3. Fix and publish

Edit the source, rebuild, and publish a new version at the same link. If the build is a file on disk, upload the file instead of pasting it into a tool call:

```bash
curl -F "file=@dist/index.html" -H "Authorization: Bearer $OLLAV_API_KEY" -H "X-Ollav-Client: agent" https://app.ollav.app/api/documents/$SLUG/versions
```

### 4. Close the loop

Resolve each thread you fixed and reply with a one-liner on what changed, so the reviewer can check it:

```text
resolve_comment {comment_id}
add_comment {slug, parent_id: comment_id, body: "Fixed in v3: moved the CTA above the fold."}
```

## Polling without repeats

`get_review` returns a `cursor`. Pass it back as `since` and you get only threads with new activity, or nothing. That makes it safe to run on a schedule:

```bash
curl -s "https://app.ollav.app/api/review?slug=$SLUG&since=$CURSOR&format=markdown" -H "Authorization: Bearer $OLLAV_API_KEY"
```

In Claude Code, `/loop 15m check Ollav for new comments on <slug> and address them` does this for you.

## Guardrails worth keeping

- Don't change visibility to `public` unless the user asked for it.
- Don't resolve a thread you didn't fix. Reply with a question instead.
- If a comment is on an earlier version (`onCurrentVersion: false`), check the element still exists before acting on it.

[Agent quickstart](https://ollav.app/docs/agents) · [OpenAPI](https://ollav.app/openapi.json)
