MI. All notes

React Native · AI harness · 18 min

The React Native AI Harness That Gets Faster Every Week

The surprising partBun rewrote a 535,496-line Zig codebase in Rust in 11 days. It wasn’t one heroic prompt, and it definitely wasn’t zero tokens.

The model wrote code. The harness kept the work moving.

We’ll shrink that idea to one React Native team: less repeated context, safer parallel work, and a path from request to proof that survives whichever model you use next.

Build the harness

The eleven-day clue

The speed was outside the chat box.

Press Assemble. Watch one giant conversation turn into a production line.

One giant chat “Rewrite everything.” One context · self-review · no durable handoff
01Write decisionsPlans survive the chat
02Split the workIndependent files and worktrees
03ImplementOne narrow context
04Review twiceFresh, adversarial eyes
05Fix and testFailures become the queue
Harness waiting The model has no rails yet.
Bun's reported setup:
64 coding agents at full scale
4 isolated workflow shards
2 adversarial reviewers per change
1 implementation-independent test suite
What made this scale safer?

Bun first wrote its porting decisions into files. Then implementers, reviewers, and fixers received different jobs and different context.

The Rust compiler and roughly one million test assertions became a work queue. When agents learned a bad habit, the team fixed the workflow generator instead of hand-correcting every future result.

The honest token number

Bun reports 5.9 billion uncached input tokens, 690 million output tokens, and 72 billion cached input reads. The achievement was not low total usage; it was converting a huge amount of model work into reviewed, tested progress.

For a React Native team, the smaller goal is more useful: stop paying to repeat decisions, rediscover commands, and repair preventable mistakes.

Keep thisDon’t chase zero tokens. Chase zero repeated explanation and zero unverified output.

What does that production line look like for one ordinary mobile feature?

Pack the task

Save decisions. Don’t save the whole conversation.

Our recurring job is small: stop PaymentConfirmationScreen from sending twice. Pack only what the next worker needs.

0 / 4 useful signals

Choose the smallest packet that lets the agent inspect, change, and verify.

Think of context as a carry-on bag. AGENTS.md holds stable repo rules; FEATURE.md holds today’s destination; a skill is the folded route you open only for this kind of trip.

MCP is the socket for live systems: GitHub, a design file, an emulator, logs, or a test device. Connect the tool when it can answer today’s question, not because it exists.

At the end, write a compact handoff: decision, changed files, test result, open risk. A fresh worker can read that in seconds; it does not need the reasoning monologue that produced it.

One fact, one home

TaskToday’s goal, allowed surface, acceptance checks, and stop condition.

AGENTS.mdRepo commands, conventions, and proof required for every relevant change.

SkillA repeatable workflow with examples, references, and scripts loaded when needed.

Hook / CIA mechanical rule that must run, not another sentence the model may forget.

MCP / CLILive access to a device, issue, design, build, log, or external system.

Handoff fileThe compact state the next role needs: result, evidence, risk, next action.

Keep thisSerialize decisions, not conversations. Load methods and tools only when the task calls for them.

The packet is small. But who should receive it?

Separate the rooms

Don’t ask the author to forget why the code is “obviously right.”

Switch roles below. Each worker sees only the evidence needed for its job.

ReceivesFEATURE.md · nearby files · failing test
DoesMakes the smallest patch that turns the test green
ReturnsDiff · commands run · unresolved risk

The implementer gets the original behavior and a failing witness. The reviewer gets the contract and the diff—but not the implementer’s long explanation defending it.

The device verifier gets a build and one exact journey. Separate context reduces confirmation bias and keeps each window small.

This is what “use subagents” should mean. More agents are useful only when their work is independent or their perspectives must stay independent.

Repeated failure:
An agent stubs a hard function
just to make TypeScript compile.
Where should the permanent fix live?
Before editProtect the workspaceNo destructive Git · correct worktree · allowed files
After editReject cheap escapesNo stubs · no skipped tests · no unrelated rewrite
Before handoffDemand evidenceFormat · type-check · focused test · diff summary

A hook is a guardrail at a lifecycle boundary. It can block a dangerous command, run a fast check after edits, or require proof before handoff.

Keep hooks quick and deterministic. Slow, flaky hooks teach people—and agents—to route around the safety system.

Keep thisOne role creates. Another doubts. Hooks enforce the rules neither role should negotiate.

Good roles prevent bias. We still need a queue that tells them what to do next.

Turn failure into the queue

A failing check is a tiny, honest task description.

Our risk crosses a button, pending state, a hook, and an API call. Pick the cheapest witness that can see all four.

Risk: two quick taps may call submitPayment twice.

The reducer is correct.
The bug appears when UI and async state meet.
What should fail first?
Pure ruleUnitFormatting, reducers, parsers
UI + state + modulesInteractionPress, loading, errors, navigation intent
Native realityDevice / E2EKeyboard, permissions, deep links, real navigation

Tests do two jobs in an AI harness. They define the target before code, then turn every failure into a bounded next action.

TDD is useful when behavior is crisp or a bug needs a permanent witness. For a visual spike, explore on the phone first; once the behavior settles, lock it at the cheapest reliable layer.

Keep thisGive the agent a failure it can explain, not a feature request it can endlessly reinterpret.

The JavaScript proof is green. The original report came from Android.

Open the right socket

Use MCP when the answer lives outside the repository.

Focused interaction test: pass
Type-check: pass
Lint: pass

The bug was reported on Android.
What should the verifier do next?
Device verifier · Android · PaymentConfirmation
  1. 1Open the exact screen
  2. 2Press Confirm twice
  3. 3Inspect network requests
  4. 4Save the evidence
$ waiting for device proof

Device verification has not run.

An agentic device tool helps during discovery because the next tap depends on what the app shows. Once the journey is known, save it as a deterministic regression.

That keeps future agents from spending tokens rediscovering the route. They run the script, read the failure, and work on the smallest unexplained step.

Choose one exploration tool and one memory
agent-device

Agent-led inspection and actions, with replay scripts and export to Maestro flows.

Argent

Simulator control plus deeper component, log, network, and performance evidence.

Maestro

Readable black-box journeys that are easy to keep in CI.

Detox

React Native-focused gray-box E2E with synchronization around app activity.

Do not install every tool. The harness is better when each tool has a clear question it owns.

Keep thisTools answer live questions. Scripts remember settled answers.

One feature is safe. When should we add more agents?

Scale the harness, not the chaos

Sixty-four agents is a migration strategy, not a daily habit.

Choose the smallest team shape that keeps work independent and review honest.

Small bug One agent

Focused task · hooks · one test · human or fresh-context review.

Cross-file feature Three roles

Implementer · adversarial reviewer · device verifier.

Upgrade or migration Sharded worktrees

Independent slices · per-slice review · shared test queue · controlled merge.

Parallelize files, platforms, or failures that can be owned without stepping on the same code. If two agents need the same mutable truth, split the decision first—or keep the work sequential.

Every shard needs an owner, an allowed surface, a proof command, and a handoff format. Worktrees isolate edits; tests and merge checks reunite them.

The model can change between tasks. The contracts, role boundaries, tool interfaces, and evidence format remain useful.

Keep thisMore agents multiply a good queue. They also multiply an unclear one.

We can finally ask whether the harness is actually saving anything.

Measure the right economy

Spend fewer tokens on remembering. Spend enough on proving.

False target Minimum tokens per task

A tiny prompt followed by four corrections is not cheap.

Useful target Verified work per token
  • Time from request to device evidence
  • Repeated context pasted by a human
  • Corrections after the first “done”
  • Failures caught before review or release
  • Workflow lessons saved for the next task
RulesStop repeating repo truth
SkillsLoad the method on demand
HandoffsCarry results, not chat history
HooksFail early and mechanically
SubagentsKeep roles narrow and independent
TestsTurn uncertainty into a queue

Stable instructions may be cached by some harnesses and providers. Skills can keep large playbooks out of unrelated tasks, while compact handoffs let you start fresh when a role or goal changes.

Tool schemas, file reads, screenshots, and results still cost context, time, or money. Selective access is the saving; pretending tools are free is not.

Measure five similar tasks before and after the harness. If verified lead time falls and escaped bugs do not rise, the system is improving.

Keep thisThe cheapest workflow is not the one that generates least. It is the one that needs least rework.

Put the whole system on one screen and it becomes reusable.

The reusable harness

Build the road once. Let models drive on it.

The model-agnostic feature loop
01DefineOutcome + stop line
02RouteRules + skill + tools
03ImplementSmall context
04EnforceHooks + fast checks
05ReviewFresh adversarial eyes
06ProveTest + device
07RecordRegression + handoff
08ImproveFix the workflow
When a mistake repeats, don’t write a longer apology. Improve the road.
A compact task packet for any capable coding model
Goal: prevent duplicate payment submits.
Success: two quick taps create one request.
Scope: this screen and its hook; keep the API unchanged.
Route: follow AGENTS.md and the fix-rn-bug skill.
First proof: add the smallest failing interaction test.
Then: make the minimal patch; run hooks and focused checks.
Review: give the diff and contract to a fresh reviewer.
Device: verify the same flow on Android.
Return: changed files, evidence, risk, next action.
Stop: no unrelated refactor.

Start with one recurring task, not a grand platform. Write its finish line, save its method as a skill, and turn its repeated mistakes into hooks or review rules.

Add a device tool when the phone owns the answer. Add subagents when work or judgment can be cleanly separated.

Then watch the real number: how quickly a request becomes trusted behavior. That is the speed worth compounding.

Source notes

The claims behind the harness.

Primary sources for the migration story, context surfaces, testing boundaries, and mobile tools.