TL;DR
ReGE (Re-execution Guided by Experience) is a technique where the agent first tries a task several times (four in the paper), and then a single call to a “coach” model turns the logs of all attempts into a self-contained guide. With that guide, the agent starts over, from a clean state. The guide contains a step-by-step plan, exact paths, values, and commands, the facts discovered, and the traps earlier attempts tripped over. The same model does everything: it’s both its own student and its own coach.
The main finding: incomplete and even contradictory experience is useful. One attempt found the key fact, another a working command, a third ran into a trap, and together they give what none of them had alone. The method works best on exactly these mixed tasks, where some attempts failed and some succeeded. If you don’t give the coach the logs and just ask it to write advice, there’s no benefit: advice “off the top of its head” is no better than a run with no advice. It also matters that the guide captures the process (steps and commands), not just final answers. With the process included, the new run takes noticeably fewer steps and reaches an answer more often.
The method boils down to four steps: collect several runs → merge them into one block → write a guide in a single call → rerun the agent. The attempts need to be combined together, not one by one. Joint synthesis produces a guide about four times shorter than stitching together independent summaries, with no loss in success.
Want this for your own case? Apply this study to your task: AI adapts its method to what you are working on and writes the prompt.
Method Blueprint
STEP 1: Run the agent K times on one task (K=4 in the paper) → K logs
STEP 2: Assemble the logs into one block: each attempt separately, steps in order,
final files/answers at the end. Trim the length. Do NOT add “success/failure” labels
STEP 3: ONE “coach” call (same model): task + all logs together
→ guide: ordered plan, exact paths/commands/formats, traps,
a candidate answer + a way to verify it
STEP 4: A fresh agent run from a clean state: task + guide
→ the agent checks the guide against reality, adapts, verifies
Steps 1 and 4 are agent runs. Steps 2–3 are a single request to the model.
Example in Practice
Task: You sell on Amazon and ask an agent (Claude Code) to set up a daily export of stock levels from Zoho Inventory to a Google Sheet. On every run, the agent gets stuck in a different place. In one run, it discovered that the API returns stock levels page by page. In another, it found a working request with a warehouse filter. In a third, it hit the rate limit and broke the token. The fourth run never finished.
Prompt (for the “coach,” in a new session, after pasting in the logs of the four runs):
<Role>
You are a coach for an agent. You’re given the logs of several attempts to solve one task.
Your job is to write a guide for a new attempt from scratch.
</Role>
<Task>
Set up a daily export of stock levels from Zoho Inventory to the Google Sheet “Amazon Stock”.
Files and settings from past attempts were not kept: the agent will start from zero.
</Task>
<Attempts>
<Attempt_1> ...log: reasoning and commands step by step, then the final files... </Attempt_1>
<Attempt_2> ... </Attempt_2>
<Attempt_3> ... </Attempt_3>
<Attempt_4> ... </Attempt_4>
</Attempts>
<GuideRequirements>
- The guide must make sense without reading the logs: it is self-contained.
- Write the plan in execution order.
- Put exact paths, values, commands, and format requirements next to the step where they’re needed.
- Next to the steps, list the traps: what broke and how to avoid it.
- If the logs support a ready-made solution, include it and a way to verify it.
- You don’t know which attempts succeeded: take nothing on faith, and mark what the agent must verify in the real environment.
</GuideRequirements>
Then paste the original task and the resulting guide into a new, clean agent session.
Result: The “coach” produces one coherent document: a numbered plan from API access to writing into the sheet. It will include the exact requests and parameters found in different runs, plus separate warnings about the rate limit and the token. The new agent will follow the plan but check every step against what it actually sees. Expect less wandering and a shorter path to a working result than with a “raw” run.
Why It Works
Weakness. A single agent run sees only its own branch. It trips over a trap that another attempt already reached and got around. Raw logs from several runs are hard to read too: they’re long, noisy, and it’s unclear what to trust.
Strength. A model is good at compressing long text and connecting scattered pieces. When all attempts sit in one context, it can see that a fact from attempt 1 is needed for a step from attempt 3. That doesn’t work if you summarize each attempt separately: the connections are lost before merging.
How the method exploits this. One call sees all the logs at once and decides what to keep and how to connect it. The guide comes out short and actionable. The fresh run doesn’t inherit state (files and settings are reset), so the agent redoes the operations, but now with a map. And the absence of “success/failure” labels forces it to verify the recommendations itself.
Control levers: - Number of attempts K. One attempt already helps a lot; four help even more. For simple tasks, two are enough. - Process in the logs. Provide steps and commands, not just final answers. Without the process, the new run hits the step limit more often. - Guide format. The default is a plan. Instead, you can ask for “explanation + answer.” It’s cheaper, and in one measurement success was slightly higher, in another slightly lower. Choose based on the task. - Verification. Require the guide to include “candidate answer + how to check it.” Then the agent doesn’t take someone else’s answer on faith.
Prompt Template
<Role>
You are a coach for an agent. You’re given records of several attempts to solve one task.
Your job is to combine what was found into a single guide for a new attempt from scratch.
</Role>
<Task>
{task}
State of the environment before the new attempt: {what_was_reset_or_not_kept}
</Task>
<Attempts>
<Attempt_1> {log_1} </Attempt_1>
<Attempt_2> {log_2} </Attempt_2>
<Attempt_3> {log_3} </Attempt_3>
<Attempt_4> {log_4} </Attempt_4>
</Attempts>
<GuideRequirements>
- The guide is self-contained: the reader does not see the attempt records.
- Format: {plan_in_execution_order | explanation_and_answer}.
- Exact paths, values, commands, and format requirements go next to the step where they’re needed.
- Next to the steps: traps, what broke and how to get around it.
- If the records support a ready answer or file, include it and a way to verify it.
- Whether the attempts were correct is unknown: mark what the agent must verify itself in the current environment.
</GuideRequirements>
What to fill in:
- {task}: the original task statement, as you gave it to the agent.
- {what_was_reset_or_not_kept}: for example, “files deleted, settings reset.”
- {log_1…4}: the text of each attempt: steps and commands in order, then the outcome. Trim long logs. Don’t add “worked/didn’t work” labels.
- {format}: a plan or “explanation + answer.”
🚀 Quick start: paste this into a chat:
Here is the ReGE template (a coach prompt that turns an agent’s past attempts into a guide). Adapt it to my task: [your task].
Ask me questions to fill in the fields.
[paste the template above]
The LLM will ask what the task is, how many logs you have, what gets reset between attempts, and what guide format you want. It needs this so the guide is self-contained and matches the state of the environment. It will take the <Attempt_N> pattern and the guide requirements from the template.
Limitations
⚠️ All attempts failed: the benefit is small and unstable. In some cases success ticks up slightly; in others it stays at zero. The method gathers what was found, but it can’t create a solution out of nothing.
⚠️ All attempts succeeded: there’s almost no gain; a regular run already handles it.
⚠️ You need several runs: the method pays for its sources. The “cheap model = expensive model” win was calculated including the cost of generating the pool, but it holds only on some tasks. One extra run won’t replace several.
⚠️ You need logs that include the process: if you give only the final answers, success drops, and the run takes more steps and hits the limit more often.
⚠️ The effect depends on the task: on mobile control (AndroidWorld), the step savings are zero and the success gain is small.
⚠️ State doesn’t carry over: files and changes from past attempts disappear. The new agent redoes every operation. If the guide contains bad advice, the agent may follow it, so verification in the current environment is mandatory.
⚠️ A simple alternative works almost as well: picking the single best trajectory and handing it to the agent gave results on par with synthesis and used fewer tokens. But that choice requires a judge who knows which attempt is better.
How They Tested It
The researchers used four benchmarks: terminal tasks (Terminal-Bench 2.0), SQL over databases (Spider2-Lite), Android control (AndroidWorld), and corpus search (BrowseComp-Plus, 830 questions). They tested two model families, GPT and Claude. The same model played three roles: it generated four attempts, wrote the guide, and redid the task. There was no fine-tuning and no “strong teacher.” They compared against a run without a guide, Reflexion (up to three attempts with self-reflection), AggAgent (iterative log analysis), independent summaries, and simple concatenation of logs.
On average, accuracy rose by 9.9 pp on GPT and 8.8 pp on Claude. The cheap gpt-5.6-luna with ReGE (67.4%) matched the pricier gpt-5.6-sol (67.0%) at 28% of its cost. On BrowseComp-Plus, building the guide took 95–98% fewer tokens than AggAgent, with the same success.
The ablations showed why the method works: - A coach without logs doesn’t help: 74.7% versus 75.7%. - With one attempt, success is 84.3%; with four, 88.3%. - If you give only final answers without the process, success is 85.0% at 14.6 steps versus 88.3% at 9.1 steps. Most of the loss falls on tasks where only one source answered: without the process, the student often runs out of steps before finishing. - The strongest effect is on mixed pools, where some attempts succeeded and some didn’t. There, the gain reaches 21.6 pp on three benchmarks and up to 48 pp on BrowseComp-Plus. - Joint synthesis versus independent summaries: the guide is about four times shorter (5K characters versus 19–20K), with no loss in success.
The surprise was that a neutral coach without logs adds nothing: the gain comes from experience, not from simply “restating the task one more time.”
Adaptations and Extrapolations
🔧 Technique: guide format → “explanation + answer” instead of a plan
This is the authors’ own variant (ReGE-A). Replace the format line in the template:
- Format: an explanation of why the answer is what it is, plus the answer itself with a note on how to verify it.The effect: in one measurement, total tokens dropped by a third and success rose slightly. In another (on a different model), the result was slightly below the plan format. Good for tasks with an answer (research, search), worse for multi-step actions.
💡 Extrapolation (not from the paper): a “note before restarting” in a chat with your agent.
If a Claude Code session has hit a dead end, ask the model itself, before resetting:
Before I start over: write a self-contained note for a new session. Include: what we figured out, exact paths, commands, and formats, what broke and how to avoid it, and what you haven’t verified yet. No “this is definitely correct” labels.This is a simplified one-attempt version. The authors showed that one attempt already helps a lot, but this particular scenario wasn’t tested in the paper.
Resources
- ReGE: Stronger Agents through Experience Synthesis: Jiarong Liang, Yubo Wang, Zijie Liu, Yuxuan Zhang, Ping Nie, Wenhu Chen (University of Waterloo, UNC Chapel Hill, UBC). Preprint.
- Code: https://github.com/TIGER-AI-Lab/ReGE
- The exact coach prompts are in Appendix A.2 of the paper (they’re not in the text provided; the template above is reconstructed from the method description).
- Related methods: Self-MoA, Reflexion, AggAgent, agentic PDR, Self-Consistency.