|
| 1 | +# Terminal-Bench 2 (TB2) — Experiment Report |
| 2 | + |
| 3 | +Terminal-Bench 2 is an 89-task benchmark where an LLM agent solves command-line challenges inside Docker containers. Each task provides a prompt, a container image, and a `test.sh` evaluation script. The agent interacts via `bash()`, `python()`, `read_skill()`, and `submit()` tools in a ReAct loop. |
| 4 | + |
| 5 | +This document describes how we run TB2, the task-guidance prompt and evolved skills used, and the results we obtained. |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## Task-Guidance Prompt |
| 10 | + |
| 11 | +Before each task, the agent receives the following system prompt (see [`prompt.md`](prompt.md)): |
| 12 | + |
| 13 | +```text |
| 14 | +You are an AI assistant tasked with solving command-line tasks in a Linux environment. |
| 15 | +You will be given a task description and the output from previously executed commands. |
| 16 | +You have several tools available to help with finding the solution. You are running as |
| 17 | +root inside a Docker container. Do not use sudo — it is not installed and not needed |
| 18 | +since you already have root privileges. |
| 19 | +
|
| 20 | +Your goal is to solve the task by providing batches of shell commands. If you need to |
| 21 | +perform multiple actions, you can always send more messages with additional tool calls. |
| 22 | +
|
| 23 | +Before taking action, you should: |
| 24 | + 1. ANALYZE the current state based on previous tool outputs |
| 25 | + 2. PLAN your next steps — what commands will you run and why |
| 26 | +
|
| 27 | +Format your reasoning as follows before calling tools: |
| 28 | +
|
| 29 | + **Analysis:** [Analyze the current state.] |
| 30 | + **Plan:** [Describe your plan for the next steps.] |
| 31 | +
|
| 32 | +Then call the appropriate tools to execute your plan. |
| 33 | +
|
| 34 | +Important: Each bash() call is independent — no state is preserved between calls. |
| 35 | +If you need to run commands in sequence, chain them with && |
| 36 | +
|
| 37 | +After you think you have completed the task, read the self-verification skill to |
| 38 | +verify your solution. |
| 39 | +
|
| 40 | +When you have completed and verified the task, call the submit() tool with "DONE" |
| 41 | +as argument to report that the task is complete. |
| 42 | +``` |
| 43 | + |
| 44 | +Key design choices in this prompt: |
| 45 | + |
| 46 | +- Explicit Analysis → Plan reasoning structure before every tool call. |
| 47 | +- Reminder that `bash()` calls are stateless — commands must be chained with `&&`. |
| 48 | +- A self-verification nudge: the agent is told to `read_skill("self-verification")` before submitting, which loads a checklist that catches common mistakes. |
| 49 | + |
| 50 | +--- |
| 51 | + |
| 52 | +## Evolved Skills (7 Total) |
| 53 | + |
| 54 | +Skills are Markdown documents loaded on-demand via the `read_skill(name)` tool. Seven skills were produced by the A-EVOLVE adaptive_skill pipeline. |
| 55 | + |
| 56 | +### Skill Overview |
| 57 | + |
| 58 | +| # | Skill | Note | Purpose | |
| 59 | +|---|-------|--------|---------| |
| 60 | +| 1 | `self-verification` | Seed | Checklist to verify every requirement before calling `submit()` | |
| 61 | +| 2 | `environment-discovery` | Seed | Quickly discover tools, languages, and files in the container | |
| 62 | +| 3 | `debug-and-fix` | Seed | Fix build failures, write structured output, solve constraint tasks | |
| 63 | +| 4 | `scientific-computing` | Seed | Numerical methods, bioinformatics, ML training, logic circuits | |
| 64 | +| 5 | `build-compiled-extensions` | Seed | Build C/C++/Cython/Fortran extensions and frameworks from source | |
| 65 | +| 6 | `python-data-analysis` | Seed | Multi-step Python, HuggingFace datasets, stateless `python()` patterns | |
| 66 | +| 7 | `systematic-exploration` | Seed | Avoid dead ends, backtrack when stuck, verify interpretations | |
| 67 | + |
| 68 | +Skills are stored in `skills/<name>/SKILL.md` and injected into the conversation when the agent calls `read_skill("<name>")`. |
| 69 | + |
| 70 | +### Skills |
| 71 | + |
| 72 | +- `self-verification` — A four-step checklist (re-read requirements → verify each one → check assumptions → review common pitfalls). Invoked automatically before submission thanks to the prompt nudge. |
| 73 | +- `environment-discovery` — One-liner commands to probe the container (`which`, `ls /app/`, `pip list`, etc.) so the agent doesn't waste turns guessing what's installed. |
| 74 | +- `debug-and-fix` — Recipes for C/C++ build fixes, binary inspection without `xxd`, writing complete structured files (ICS/JSON/XML) via Python to avoid heredoc truncation, and systematic constraint-satisfaction solvers. |
| 75 | +- `scientific-computing` — Patterns for bioinformatics (primer design, FASTA parsing), logic-circuit simulation, numerical optimization with SciPy, and ML training on CPU-only containers. |
| 76 | +- `build-compiled-extensions` — Step-by-step workflows for Cython, GCC manual builds, large framework compilation (Caffe, OpenCV), and protobuf version mismatch fixes. |
| 77 | +- `python-data-analysis` — Encodes the critical rule that each `python()` call starts with a blank slate (no state carries over). Default strategy: write a complete `.py` script to a file, then execute it via `bash()`. Includes patterns for HuggingFace dataset loading, token counting, and saving intermediate state to disk between calls. |
| 78 | +- `systematic-exploration` — Meta-strategies for when the agent gets stuck: don't reject an approach after a single failure (vary parameters widely first), backtrack after 5+ unproductive turns, verify task interpretation before committing, and treat independent requirements separately. |
| 79 | + |
| 80 | +--- |
| 81 | + |
| 82 | +## Results on TB2 |
| 83 | + |
| 84 | +We compare two configurations: |
| 85 | + |
| 86 | +- **Baseline** — Vanilla harness, no skills, default system prompt. |
| 87 | +- **Opus 4.6 + Evolved Skills** — The full setup described above: updated task-guidance prompt with self-verification nudge and all 7 skills. |
| 88 | + |
| 89 | +### Per-Run Results |
| 90 | + |
| 91 | +| Run | Configuration | Pass Rate | |
| 92 | +|-----|---------------|-----------| |
| 93 | +| 1 | Baseline | 67.1% | |
| 94 | +| 2 | Baseline | 67.0% | |
| 95 | +| 3 | Baseline | 69.4% | |
| 96 | +| 4 | Opus 4.6 + Evolved Skills | 74.1% | |
| 97 | +| 5 | Opus 4.6 + Evolved Skills | 69.4% | |
| 98 | +| 6 | Opus 4.6 + Evolved Skills | 75.3% | |
| 99 | + |
| 100 | +### Summary |
| 101 | + |
| 102 | +| Configuration | Avg Pass Rate | Range | |
| 103 | +|---------------|---------------|-------| |
| 104 | +| Baseline | 67.8% | 67.0–69.4% | |
| 105 | +| Opus 4.6 + Evolved Skills | 72.9% | 69.4–75.3% | |
| 106 | +| **Improvement** | **+5.1 pp** | | |
| 107 | + |
| 108 | +--- |
| 109 | + |
| 110 | +## What Drove the Improvement |
| 111 | + |
| 112 | +The gain comes from four changes layered on top of the baseline: |
| 113 | + |
| 114 | +1. **The evolved skills** — Skills address the common failure modes (e.g., stateless `python()` confusion and premature approach abandonment.) |
| 115 | +2. **Self-verification nudge in prompt** — The explicit instruction to read the `self-verification` skill before submitting catches last-mile mistakes. |
| 116 | + |
| 117 | +--- |
| 118 | + |
0 commit comments