One call, two reads. Did the agent finish sooner?
Replay eight OpenCode sessions across two catalogue tasks. Watch one agent find the right facts in the wrong format and another lose two answers by cutting a document short.

Start here
Just curious
The first race ended with the right facts in the wrong format. In the rematch, a shorter tool result cut off two answers. Replay the four attempts
Running it yourself
Compare direct tools with native Code Mode on two frozen workloads. Inspect the code, HTTP reads, raw answers and tool-result sizes. Inspect the six-document race
Using a coding agent
Ask it to replay the example in a fresh folder and show you what failed and why.
Read the agent prompt
Inspect the public Code Mode experiment at https://github.com/loftwah/app-composer/tree/main/benchmarks/code-mode. Use the recorded pilot.json first. For each attempt, count the outer tool calls, actual catalogue reads and emitted model steps. Check the answer against the role pack documents and explain one difference between the two native attempts. Reading the receipts needs no model account or paid call.
The fastest run in our first race finished in 20.95 seconds. Then its answer failed JSON.parse(answer) on the next line.
We gave OpenCode a small job from App Composer. Our public catalogue contains instructions for roles including QA and programmer. Each document says what to hand back at the end of a job. Find the shortest and longest role IDs at version 1.0.0, open those documents and report the first and last field under Output. The manifest tells the agent which documents it needs. Open the catalogue.
The two answers were QA: Verdict → Release blocker, and programmer: Reproduction → Reviewer. You can check the documents yourself. QA pack · Programmer pack
Watch what the agent actually opened
In direct mode, the model names the document-reading tool on each call. In native Code Mode, the model can write a short program that invokes the same tool several times. Here is the entire second program from the first native run.
const [qa, prog] = await Promise.all([
tools.publicsite.read_page({ url: "/roles/v1/qa.md" }),
tools.publicsite.read_page({ url: "/roles/v1/programmer.md" })
]);
return { qa, prog };
One call appeared in the outer trace. The catalogue server recorded two reads. The server handled them sequentially, and the program returned both full documents. In our second experiment we asked the agent to extract the labels before returning its answer. Step through the tool-call replay.
Four attempts, one dependency
| Run order | Mode | Elapsed | Outer calls | Catalogue reads | Recorded model steps |
|---|---|---|---|---|---|
| 1 | Direct | 49.69 s | 4 | 4 | 3 |
| 2 | Native Code Mode | 22.74 s | 2 | 3 | 3 |
| 3 | Native Code Mode | 32.37 s | 3 | 3 | 4 |
| 4 | Direct | 20.95 s | 3 | 3 | 3 |
The prompt asked for a bare JSON array. In the fourth run, the model wrapped the right answer in a Markdown code fence. A person could read it; a program expecting JSON had to strip the fence first. In a separate raw-output check, three of the four answers parsed directly.
The first direct run also opened the architect pack. It still returned the correct two answers. In the second native run, the model tried to call the namespace itself. That attempt returned an error and read zero documents. It recovered through two calls to execute. This is the run to watch if you want to understand why the outer call count alone tells you so little. Run receipts.
Would we switch?
For this catalogue task, I’d keep direct tools as the default. Across two runs per mode, median elapsed time was 35.32 seconds direct and 27.55 seconds native, about 22% lower. The predeclared threshold was 25%. Median reported uncached input rose from 11,425 to 12,179.5 tokens. The alternative threshold was a 20% reduction. One native run also failed the strict check that every outer invocation used its assigned tool. Original experiment and thresholds.
The rematch with six documents
For the rematch we kept the model, tool and catalogue. This time we asked for the first and last Output fields in every role pack, sorted by ID. The twelve correct labels and the stopping rules were written down before the first run. Each agent had seven reads, enough for the manifest and all six documents. Replay the six-document race.
One agent wrote text.slice(Math.max(0, idx-100), idx+500) around the word “Output”. Its five outer tool results totalled 8,884 bytes. But the excerpts ended before the architect’s final label, Reviewers, and the programmer’s final label, Reviewer. By the time it tried to check again, it had used all seven reads. Its final JSON parsed cleanly with two wrong answers.
The other Code Mode run returned document text. Its two tool results totalled 55,229 bytes and it found every label. Both direct runs also found every label. All four read the same 58,388 bytes over HTTP. The tools reported different amounts of text back to the agent. We could measure both sides on this workload.
| Run | Time | Tool-result bytes | Correct labels |
|---|---|---|---|
| Direct 1 | 22.28 s | 58,904 | 12/12 |
| Code Mode 1 | 80.86 s | 8,884 | 10/12 |
| Code Mode 2 | 21.36 s | 55,229 | 12/12 |
| Direct 2 | 18.83 s | 58,904 | 12/12 |
On this workload the two native runs had a median of 51.11 seconds against 20.55 seconds direct. Median uncached input was 5.5% higher for native. We’re keeping direct calls for these catalogue jobs. A complete section parser might behave differently. Our offline checker extracted all six rows and their compact JSON is just 340 UTF-8 bytes. None of the four agents returned that exact representation as its intermediate tool result. Protocol and offline checker.
Reproduce the comparison
Download the two-role JSON or the six-role JSON. Each includes the prompt, model, per-document hashes, outer invocation inputs, tool timings, server reads and answer checks. Both sets of four runs used OpenCode 2.3.2 and opencode-go/beam-free in direct/native/native/direct order. Both arms read the same frozen public files through a loopback server. Each session had two minutes and a read budget of six for the first workload or seven for the second. The recorded step costs were zero. An independent invoice was unavailable. Reproduction files.
To independently check the second workload from the repository root, run this command.
node benchmarks/code-mode/verify-six-packs.mjs
This reads the frozen role documents, checks each recorded response against the corpus hash and reports each answer’s score. It runs offline.
Both pilots measured a local MCP inside OpenCode. Cloudflare’s Code Mode runs generated code in a different execution environment. Comparing that backend, remote latency, mutations or recovery after an external write would require a separate experiment. OpenCode tools · Cloudflare Code Mode.