---
name: improve-simulate
description: "Run simulated conversations with a deployed agent on the platform: a simulated user drives each toward the owner's outcome, a fresh reviewer replies with one gap or good, then observations are synthesized. Use only when asked to run a simulation."
metadata:
  min-cli-version: "0.84.0"
  next: ""
---

# Improve: simulate

Hold conversations the owner describes with a deployed agent, so improve has evidence before real users bring it. Each conversation runs on the platform, gets one review reply in the same chat, and has its observations synthesized.

This is not `eval-simulate`, which builds fakes of the servers an eval binds. Here the agent is real and only the user is simulated.

## Before you start

You need the `introspection` CLI, at least this skill's `min-cli-version`, logged in to the project that runs the agent:

```sh
introspection whoami
```

Start this step only when the owner asks for a simulation; improve never runs one on its own. It creates tasks on the platform and changes nothing else: no branch, case, file in the repository or live setting.

Give the simulation an id, the UTC time it starts (`20261112-0930`), and keep its files in `runs/simulate/<id>/` in the build folder, beside the repository. Every task it creates carries the tag `simulation:<id>`, which is how improve finds it later.

## 1. Agree the brief

Ask the owner one question at a time, and write each answer into `runs/simulate/<id>/brief.md` as [the brief](references/brief.md) lays it out.

Where the question tool is unavailable, as in a headless or print session, ask these four and step 2's in one message instead, and go on once the owner answers.

Write the brief, and every later change to it, with your edit and write tools, directly in the file. Never write a script to fill it, in `/tmp` or anywhere else.

1. **The runtime and environment.** List the runtimes and offer only a lane that isn't production, staging by default. Refuse production: its simulated conversations would count as real users' evidence.

   ```sh
   introspection runtimes list
   ```

2. **The opening.** Offer the Recipe's own conversation starters, its `prompts/*.md` with `suggest: true`, read at the commit the environment serves, under the Recipe's `sub_path` in the repository (empty at its root):

   ```sh
   introspection runtimes get <slug> --resolve -o json > runs/simulate/<id>/runtime.json
   P=$(jq -r '.environments.<environment>.sub_path // "" | ltrimstr("./") | rtrimstr("/") | if . == "" or . == "." then "" else . + "/" end' runs/simulate/<id>/runtime.json)
   git -C <repository> show <git_commit_sha>:${P}prompts/<name>.md
   ```

   The opening is the starter's text below its frontmatter, with each argument placeholder (`$1`, `$@`, `$ARGUMENTS`, `${1:-default}`) replaced by the value the owner gives for it. Never send the command, `/<name>`: the agent's runtime adds the attached files' paths after the message, and expanding a command keeps only the words its placeholders use, so the agent never learns where the input is. Never invent an opening the Recipe doesn't offer. A Recipe with no starters: ask the owner for the first message, in their words.

3. **The input the owner provides,** such as the document the agent works on. Read what they share from the workspace's inputs folder.
4. **The outcome:** what the agent should have produced when the conversation succeeds, in the owner's words. Note what they know that the agent may ask about.

## 2. Choose how many

Ask how many conversations to run. Recommend about 10: improve groups their gaps, and a gap shows it recurs only across several conversations.

Suggest varying them: other inputs the owner has, each starter, and the questions a user would answer differently. Write one row per conversation into the brief: its number, input and opening.

## 3. Run the conversations

Start one `simulated-user` subagent per conversation, up to four at once, briefed from its row and the simulation's brief as [agents/simulated-user-brief.md](../../agents/simulated-user-brief.md) says.

Each creates the task, answers the agent's questions from what it was given until the outcome is produced or it has sent twelve messages, and returns the task id and how the conversation ended. As each one returns, write its id into `runs/simulate/<id>/tasks.txt` and its task and how it ended into the brief's row, then and there; never leave the rows for the end. A subagent that reports a failed command: record it in the brief's row and go on with the others.

A task that ended without a conversation, as when it failed before its agent started, has nothing to review. Record it in its row as failed, with the reason the subagent gave, and leave it out of `tasks.txt`, so the steps below skip it.

## 4. Review each conversation with fresh eyes

For each conversation in `tasks.txt`, gather what a reviewer needs into its own folder, then start one `simulation-reviewer` subagent on it, as [the review](references/review.md) says. It answers with exactly one clear gap, a quote from the input and the rule of the Recipe the outcome breaks, or with "good". When it isn't sure, the answer is "good". Take its answer as given, after only the check the review names.

Send the answer back to that conversation's `simulated-user`, which sends it as one user message in the same chat: "You missed …" for a gap, "Looks good, thanks." for good. Record the reply in the brief's row as soon as it is sent.

## 5. Synthesize observations

Once every conversation in `tasks.txt` has its reply, synthesize their observations, and wait for them:

```sh
introspection observations synthesize $(paste -sd, runs/simulate/<id>/tasks.txt) \
  --wait -o json > runs/simulate/<id>/observations.json
```

Each conversation in `.conversations[]` has its `observations`, each with `payload.lens` and `payload.summary`. Record in the brief's row how many it has. A conversation with none, or a command that fails: record the error and report it; the conversations and their replies stand without it.

Never run pattern recognition for a simulation. It clusters the runtime group's whole window, so it would mix the simulation into the owner's live patterns. Improve groups the gaps later, from the conversations, replies and observations.

## 6. Report

One table, one row per conversation: its number, input and opening, how it ended (outcome produced, twelve turns, or failed), and the reviewer's gap or "good". End each row with the link to its chat:

```sh
introspection open --task <task-id> --print
```

Then how many observations each conversation has, and any without them. Close with the next step in the owner's words: "let's improve based on the last simulation" starts improve from this evidence.

## Done when

- `runs/simulate/<id>/` holds the brief, the task ids and `observations.json`.
- Every conversation was reviewed, and its gap or "good" was sent in its own chat.
- The owner has the table and how to improve from it. The simulation ends here; it hands to no other step.
