---
name: improve-propose
description: "Fix the chosen failure mode: the owner picks one of up to three remedies, a proposer writes it without seeing the evals, a fresh reviewer accepts it, and one run proves it against the baseline. Use after improve-baseline."
metadata:
  min-cli-version: "0.92.0"
  next: "deploy-try"
---

# Improve: propose

Make one change that fixes the chosen failure modes, prove it against the baseline, and open its pull request. Several modes share one remedy question, one proposer, one proof and one pull request. You need the issue key `I-…`, the branch `pr/improve-I-…` with its baseline, and the runtime's slug from `improve-baseline`.

`improve-baseline` starts steps 1 and 2 while it measures the baseline; pick up from where it is. This step pushes the branch and opens a pull request. It never merges, deploys, or changes a runtime, a binding or a judge, and never switches the agent's model or provider.

## 1. Agree the remedy

Read the Recipe at the branch's baseline commit and the failing cases' runs in the baseline. Then, for each mode, suggest up to three different ways to fix it, checking the capabilities Recipes ship first (`introspection operator build/draft/capabilities`): one of them beats a library, a converter or a script, each one sentence on what changes and where (an instruction, a skill, a tool, configuration), smallest first.

Ask the owner which one with `ask_user_question`, one question per mode and one option per remedy, all in one call; the owner can type their own instead. Write the chosen remedies to `runs/improve/remedy.md`, one section per mode, outside the repository, in the owner's words when they typed one. It is your note for the proposer and reviewer: to the owner it is "the fix we agreed".

The proposer can't ask questions, so leave it nothing to guess: name the files it changes, and every value, name or wording the owner gave, exactly. The remedy changes what the agent does in every conversation: it never mentions the cases or answers anything only a case's setup brings.

## 2. Have a proposer write it

You know the cases and their checks, so you don't write the change: a change written to the checks fits them rather than the users. Give a `proposer` subagent a worktree of its own without `evals/`, on the baseline commit:

```sh
B=$(git rev-parse pr/improve-$I); W=runs/improve/wt-<n>
git worktree add --no-checkout --detach $W $B
git -C $W sparse-checkout set --no-cone '/*' '!/evals/' && git -C $W checkout
```

Brief it as [agents/proposer-brief.md](../../agents/proposer-brief.md) says, with `remedy.md` word for word as its hypothesis, the files it names as the paths it may change, and the baseline's failing runs and one that passed as its reflection packet.

It commits one change and replies with the commit.

## 3. Have a fresh reviewer accept it

Before any trial, start a `reviewer` subagent briefed as [agents/reviewer-brief.md](../../agents/reviewer-brief.md), "The integrity review", says: the repository, `git diff $B <proposer's commit>` under review, `remedy.md` as the approved change, and the proposer's paths as the edit surface. A rejection starts a new proposer from the same baseline commit, told in words what to avoid. Once accepted, remove the worktree.

## 4. Run the cases on the attempt

Run only the new and revised cases, on the attempt's commit and the same path as the baseline. Run each one's Vitest file yourself, locally, in the checkout at that commit, with one trial:

```sh
git switch -q --detach <commit> && introspection eval run -p evals/vitest/<case>.eval.ts   # once per new or revised case
introspection eval compare <the case's baseline run> <attempt-run-id> -o table
```

A suite the baseline ran as a cloud trial runs as one here too, on the attempt pushed to a branch of its own, and a Harbor suite as `improve-baseline`'s Harbor case reference says:

```sh
git push -q origin <commit>:refs/heads/pr/improve-$I-attempt-<n> && \
  introspection eval run -p <the case's file> -r <slug> --commit-sha <commit>
```

Read each changed case in the run's own artifacts, not just its score (`eval-run`, `eval-compare`):

- **The agent still gets it wrong:** start a new proposer from the baseline commit with what the attempt showed, described as behaviour.
- **A check failed a reply that does what the remedy asks:** the check misjudged it. Send that case's eval author the run's folder, as its brief says, and run again; it isn't a new attempt.

After three attempts without a pass, stop and ask the owner how to go on. With several modes, one mode's failing cases never hold the others: offer to ship the modes that pass and keep the rest open on their issues. When an attempt passes the new and revised cases, make it the branch's fix commit, and delete any attempt branches:

```sh
git switch -q pr/improve-$I && git merge -q --ff-only <commit> && git push -q origin pr/improve-$I
git push origin --delete pr/improve-$I-attempt-<n>   # only for one you pushed
```

## 5. Prove it

Run the new and revised cases again on the fix commit, one trial each, the same way, and compare each with its baseline run. Repeated trials are `optimize`'s; never pass `--trials` here.

```sh
introspection eval run -p evals/vitest/<case>.eval.ts
introspection eval compare <the case's baseline run> <fix-run-id> -o table
```

Each must now pass. Then ask with `ask_user_question` whether to run every case, to check nothing else changed, with "No, skip it" as the first option and "Yes, run every case" as the second. On yes, run the suite once; a case that no longer holds goes back to step 4, and otherwise promote the run as the baseline in its own commit and push it, as `eval-compare` says. On no, the committed baseline still predates the fix: say so in the pull request.

## 6. Open the pull request

Write `docs/PULL_REQUEST.md` for the owner, in plain words:

- **What went wrong:** each failure mode, how many conversations showed it, its issue key, and each case's conversation link.
- **What we changed:** the fix we agreed and where it is.
- **How we know it worked:** the `eval compare` table, before and after, per case, and whether every case was run.
- **For reviewers:** the version and commit the evidence came from, the baseline and fix commits, and their run ids.

Commit and push it, and open the pull request with it as the description. Hand the pull request over for review on the issue, as `platform-issues` says, with the owner as its reviewer:

```sh
gh pr create --head pr/improve-$I --title "fix: <the failure mode>" --body-file docs/PULL_REQUEST.md
introspection issues update <issue-id> --links '[{"url":"<pull request URL>","title":"Pull request"}]' \
  --reviewer <owner's member-id> --status waiting
introspection issues comment <issue-id> "<what to review, and how to try it with deploy-try>"
```

On a hosted repository with no pull requests, the pushed branch and its `docs/PULL_REQUEST.md` are the review package.

## Done when

- The owner chose the remedy, a proposer wrote it without `evals/`, and a fresh reviewer accepted it before any trial.
- The proof shows the new and revised cases passing, and the owner chose whether to run every case.
- The pull request is open and handed over for review on its issue.

Then go on with `deploy-try`, giving the owner the pull request, the before-and-after table and the chat link to the branch's version.
