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

# Improve an OpenClaw Agent from its traces

> Diagnostics finds recurring problems in your agent's turns, the BenchGen agent proposes the fix, and with your harness repository connected the fix arrives as a pull request.

Every turn of a connected agent is traced (see [Connect an OpenClaw Agent](/docs/agentspace/connect-openclaw-agent.md)). The **Diagnostics** tab reads those traces and turns recurring problems into issues you can act on, without opening a single trace yourself.

## Issues

**Diagnostics** scans the last hour of turns every five minutes, plus the whole day once a night, with mechanical rules: a reply that says "shown above" when nothing was shown, a link no tool printed, a tool error the reply hides, the same tool called in a loop, an empty reply, a reply in another alphabet than the question. Each recurring problem is one issue with its severity, how often and when it happened, which users it hit, example turns and the likely cause.

The scan is off for a new agent. Switch it on with the **Auto** pill above the issues; **Run diagnostic** scans the last day right away. Each new issue is also sent to you in your last chat with the agent.

![Diagnostics tab of an agent with a list of issues and the detail of one issue](https://mintcdn.com/benchgen-8fc81371/b-xfJTchoYe9xqEK/images/agentspace/openclaw/11-diagnostics.png?fit=max\&auto=format\&n=b-xfJTchoYe9xqEK\&q=85\&s=9f12fb2f150d54048d48647062ecfa54)

The Diagnostics tab: open issues on the left, the selected issue on the right with when it was seen, how often, the summary and the agent's fix

**Review with the agent** goes further than the rules: the BenchGen agent reads up to 20 recent turns and files what only a reader sees, such as a reply that misses the question, a reply in the wrong language, a price or date that appears nowhere in the question or the tool output, or a poor tone. Its note on each example says what is wrong. This is one turn of the BenchGen agent, billed like a chat turn; a turn is reviewed once.

## Ask for a fix

On an issue, **Ask the agent for a fix** gives the BenchGen agent the example turns and asks for the cause and the fix. The analysis lands on the issue page in a minute or two. **Continue in chat** puts the issue into your chat with the BenchGen agent when you want to discuss it.

Without a repository connected, the fix is text you apply yourself. With one connected, the fix comes as a change to your files.

## Connect your harness repository

Your agent's behaviour lives in its workspace files: `AGENTS.md`, the skills under `skills/`, prompts. Keep them in a GitHub repository and connect it, and a fix becomes a pull request there.

**1. Make a token for the repository**

On GitHub, open **Settings** → **Developer settings** → **Personal access tokens** → **Fine-grained tokens** → **Generate new token**. Limit it to the one repository and give it two permissions: **Contents: Read and write** and **Pull requests: Read and write**.

![GitHub fine-grained token form with one repository selected and Contents and Pull requests permissions set to read and write](https://mintcdn.com/benchgen-8fc81371/b-xfJTchoYe9xqEK/images/agentspace/openclaw/10-github-token-harness-repo.png?fit=max\&auto=format\&n=b-xfJTchoYe9xqEK\&q=85\&s=ec2f361145b3816d8e33043cec31fd5b)

The token: one repository, Contents and Pull requests set to read and write

**2. Connect it on the agent's Settings tab**

**Settings** → **Harness repository**: enter the repository as `owner/name` or its URL, paste the token, and keep or edit the list of harness files. The default, `AGENTS.md` and `skills/**/SKILL.md`, matches the OpenClaw workspace layout; `**` spans folders.

![Harness repository card with empty Repository and GitHub token fields and the default harness file patterns](https://mintcdn.com/benchgen-8fc81371/b-xfJTchoYe9xqEK/images/agentspace/openclaw/12a-harness-repository-form.png?fit=max\&auto=format\&n=b-xfJTchoYe9xqEK\&q=85\&s=8eb142b6c33c43e5a0481765b511218b)

The card before connecting: repository, token, and the harness files a proposal may change

**Connect** reads the repository at once and lists the files it found.

![Harness repository card on the Settings tab showing the connected GitHub repository, its branch and the harness files](https://mintcdn.com/benchgen-8fc81371/b-xfJTchoYe9xqEK/images/agentspace/openclaw/12-harness-repository.png?fit=max\&auto=format\&n=b-xfJTchoYe9xqEK\&q=85\&s=5488f5065bc8df540b7eb3fef955728b)

A connected repository: the branch and the harness files found

The token is stored encrypted and never shown again. BenchGen uses it to read those files and to open pull requests; it is never handed to an agent.

The same works from the chat: tell the BenchGen AI agent "connect Jeka95/northwind-support-agent to my support bot" and paste the token in the message. The platform takes the token out of the message before the agent sees it and keeps it for 15 minutes; the agent connects the repository with a reference to it and reports the branch and the files. Everything on this page (issues, scan, review, fix, pull request, resolve) can be asked of the agent in the same way.

**3. Get the fix as a pull request**

Now **Ask the agent for a fix** also returns the change itself, shown on the issue as a diff with the files it touches. Read it, then **Open a pull request**: BenchGen puts the change on a branch `benchgen/diagnostic-<id>` and opens the pull request with the analysis and the example turns. The link stays on the issue.

![Agent fix box with the analysis, a diff of skills/order-status/SKILL.md and a link to the pull request](https://mintcdn.com/benchgen-8fc81371/b-xfJTchoYe9xqEK/images/agentspace/openclaw/13-agent-fix-pull-request.png?fit=max\&auto=format\&n=b-xfJTchoYe9xqEK\&q=85\&s=72586acbee1c546256b4a84dc95833a7)

The agent's fix on an issue: the analysis, the proposed change as a diff, and the link to the pull request it became

![GitHub pull request opened by BenchGen with changes to AGENTS.md and two skill files](https://mintcdn.com/benchgen-8fc81371/b-xfJTchoYe9xqEK/images/agentspace/openclaw/14-github-pull-request.png?fit=max\&auto=format\&n=b-xfJTchoYe9xqEK\&q=85\&s=a9c2c30df76cab98a00a48b7ee22a746)

The same change as a pull request in the owner's repository, one commit per file

Nothing is written to the repository before that click, and nothing is merged: review the pull request on GitHub as you would any change, merge it, and let the agent pick up the new files (for an OpenClaw gateway that clones the workspace at start, a restart).

> [!NOTE]
>
> BenchGen does not measure a change to your own agent before and after: it has no benchmark of it unless you make one. The pull request says so. For an agent you want measured, run a benchmark on it before and after the merge (see [Benchmark an OpenClaw Agent](/docs/agentspace/benchmark-openclaw-agent.md)).

## Close the loop

After the merge, the next scan shows whether the problem is gone: a resolved issue stays resolved for the turns it was about, and only new turns can open it again. Resolve an issue with **Resolve** once the fix is in; reopen it if the problem returns.


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