---
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.

For standalone runs, read `introspection operator build/draft/runs-directory`.

## 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

The target cases are the new and revised cases and each baseline mode's failing cases. Run each on its runner, one trial. When one is a Harbor case, run the Harbor suite as a cloud trial of the attempt, pushed to a branch of its own, as `improve-baseline`'s Harbor case reference says:

```sh
git push -q origin <commit>:refs/heads/eval/$I/attempt-<n> && \
  introspection eval run -p evals/harbor -r <slug> --commit-sha <commit> --retry-errors 1
introspection eval compare --baseline <attempt-run-id> -o table
```

Run a Vitest target case locally at the attempt's commit (`eval-run`'s "Run at a commit"). Compare it with the cases commit's Vitest run, or with `--baseline` when there is none:

```sh
introspection eval run -p evals/vitest/<case>.eval.ts
```

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 target 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 eval/$I/attempt-<n>   # only for one you pushed
```

## 5. Prove it

On the fix commit, one trial each, compared as in step 4, run the Harbor suite when step 4 did, and the whole Vitest suite locally when there is one: the regression guard for build's cases. Never pass `--trials`; repeated trials are `optimize`'s.

```sh
introspection eval run -p evals/harbor -r <slug> --commit-sha "$(git rev-parse pr/improve-$I)" --retry-errors 1
introspection eval run -p evals/vitest
```

The target cases must pass, and no other case regress; one that doesn't goes back to step 4. When a Harbor suite exists that step 4 didn't run, ask with `ask_user_question` whether to run it too: "No, skip it" first, "Yes, run it" second. On no, its baseline predates the fix: say so in the pull request. Then promote the fix commit's runs as the baselines in their own commit and push it, as `eval-compare` says.

## 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` tables, before and after, per case, and whether every suite 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 target cases passing and nothing regressed, the owner chose on any Harbor suite left unrun, and the fix's runs are the baselines.
- 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.
