> For the complete documentation index, see [llms.txt](https://docs.currents.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.currents.dev/ai/agent-evidence/bug-and-fix.md).

# Record a bug and its fix

Have an AI agent record a bug and its fix in the browser, with screenshots, page snapshots and a Playwright trace, and post the before and after on the pull request as proof the change works

An agent fixed a bug that no test covers. To approve the fix, a reviewer needs to see the bug, then see it gone, without running the branch. Have the agent record the browser before the fix and after it, in one [session](/ai/agent-evidence.md), and post the [session link](/ai/reference/share-links.md) on the pull request. The session page puts the two screenshots side by side and lists what changed on the page.

<figure><img src="https://3745692499-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqmFDEiUa9mr11LUlxDnt%2Fuploads%2Fgit-blob-6e8ba33f5fc3b74301bc1f3288755fc8dc23c898%2Fsession-timeline-changes.png?alt=media" alt="A session with the before and after of a checkout fix: the two screenshots side by side, and the page changes: Applying… became Apply, the discount and the total changed"><figcaption></figcaption></figure>

When a CI test covers the bug, you do not need a recording: the failing run is the before and the passing run is the after. See [Prove a change with CI tests](/ai/agentic-testing/prove-a-change.md).

## What you need

* A [skill](/ai/agent-skills.md) that has the steps, so you do not have to describe them.
* A browser the agent can drive. There are two ways: [Playwright MCP](/ai/agent-evidence/bug-and-fix/playwright-mcp.md), an MCP server, or [Playwright CLI](/ai/agent-evidence/bug-and-fix/playwright-cli.md), shell commands. Each page has the setup.
* A tool that can post on the pull request, such as the GitHub CLI. Currents does not post the comment.

## Ask the agent

Name the skill in the prompt and say what to fix:

```
Use the Currents browser-evidence skill. Reproduce the checkout bug at
http://localhost:3000: entering save10 leaves Apply stuck on "Applying…".
Record it, fix it, record the fix, and post the session link on the pull
request.
```

The agent records the bug, fixes the code, records the same steps again, shares the session and replies with the link. Claude Code with this prompt, sped up:

<figure><img src="https://3745692499-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqmFDEiUa9mr11LUlxDnt%2Fuploads%2Fgit-blob-f5c295bc28dbb49f232fa332d991bd225052bd54%2Fterminal-bug-and-fix.gif?alt=media" alt="A terminal: Claude Code starts a session, records the checkout before the fix with playwright-cli, attaches it captioned before, edits app.js, records and attaches the after, shares the session, and replies with the cause, the fix and the session link"><figcaption></figcaption></figure>

## What the reviewer sees

The comment on the pull request has the before and after, and links to the session:

<figure><img src="https://3745692499-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqmFDEiUa9mr11LUlxDnt%2Fuploads%2Fgit-blob-3deeca8c135cc2e44298b3313535f537d3f96d4e%2Fgithub-comment-session-evidence.png?alt=media" alt="A pull request comment with the before and after screenshots side by side, links to each session page and trace digest, and the accessibility tree changes as a diff"><figcaption></figcaption></figure>

The session page has:

* The before and after screenshots, side by side or with a slider
* What changed on the page: elements added, removed, and text that changed
* The trace of each recording, with the clicks and requests
* The commit and the pull request the fix is on

To post the evidence in Slack or Linear, see [Post evidence to GitHub, Slack and Linear](/ai/agentic-artifacts/post-evidence.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.currents.dev/ai/agent-evidence/bug-and-fix.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
