Skip to main content
TACAVAR
•Build in Public

A $0.01 Multi-File Refactor Using Three Models in a Triangle

I ran a 12-file infra refactor for $0.01. Three models, three jobs, zero overlap. Not a toy. It was the kind of migration that normally eats a founder's weekend: three MCP services moving across two droplets, with config, deploy scripts, health checks, and docs all changing in lockstep. At Tacavar.com, we tested a different pattern. Instead of throwing one expensive model at the whole repo, we split the work into a delegation triangle. The result was cheaper, faster, and cleaner than a single-model run.

The 12-file, 2-droplet MCP migration

Tacavar.com runs a small but real production surface. The migration touched 12 files: MCP service definitions, environment templates, systemd units, Caddy config, deploy scripts, and runbooks. Two droplets had to stay consistent. One was primary, one was failover. A single model would need all 12 files, the target topology, the constraints, and the rollback plan in one context window. That is where most llm orchestration fails: the prompt gets huge, the model gets expensive, and attention still drifts.

We broke it into three artifacts. A brief. An audit. An execution pass. That let us use ai cost optimization without trading away quality.

The failure mode wasn't technical complexity. It was context sprawl. A single prompt containing every file, every constraint, and the full target state turns into a fog. The model answers the first requirement and forgets the fifth. At Tacavar.com, we wanted a migration we could audit before it ran, not a heroic one-shot prompt we had to trust.

Opus 4.6 for architecture, never touching files

Claude Opus 4.6 got the architecture job. We gave it a short prompt: here are the file paths, here is the current topology, here is the target topology, here are the constraints. It never touched a file. That rule matters. Opus is excellent at reasoning about dependencies, ordering, failure modes, and rollback. It is not the best value for editing the same YAML shape twelve times.

The output was a markdown brief: step order, per-file intent, required env vars, validation commands, and rollback triggers. It named the two files most likely to break: the Caddy upstream config and the systemd reload order. That single brief cost less than a cent. For a founder-operator, the lesson is simple: use claude opus for the plan, not the patch.

We kept the Opus prompt under 2,000 tokens. It saw the file tree, the diffs we expected, and the rollback policy. It did not see the full contents of every file. That constraint forced the brief to be precise. If Opus cannot read the implementation details, it has to define the intent and the checks. That is exactly what we want from architecture.

Haiku 4.5 as the $0.001 plan auditor

A plan is not a plan until something adversarial reads it. We sent the Opus brief to Haiku 4.5 with one instruction: find what will break. Haiku is cheap, fast, and surprisingly good at logical gaps. It cost $0.001. It did not write code. It did not edit files. It audited the brief.

It found seven issues. Five were real. The failover droplet was missing a shared secret reference. The systemd reload order could drop connections if Caddy reloaded first. The rollback step assumed a symlink that did not exist. One env var was documented but never exported. One health check path was wrong. We merged those fixes into the brief before any file was touched. That is the quality argument for multi-model delegation: the cheapest model caught the most expensive mistakes.

The audit prompt was deliberately narrow: you are reviewing a migration plan. List every missing dependency, ordering error, and rollback gap. Do not rewrite the plan. Do not write code. Return a numbered list. Haiku produced seven items in one pass. That is the whole value of a cheap auditor: it has no ego about the outcome and no incentive to defend the plan.

Codex for 120k-token implementation at subscription cost

Codex handled execution. We ran it inside an isolated workspace with --dangerously-bypass-approvals. It consumed 120k+ tokens across the 12 files: applying patches, running validation commands, checking diffs, and iterating until the tests passed. Marginal cost: $0/token because it ran through a ChatGPT Pro subscription. The subscription was already paid for. That turns a potentially multi-dollar implementation pass into capacity we already owned.

Codex is not the architect. It does not need to be. The brief was precise enough that execution was mechanical. Codex is good at large-scale file manipulation, not at deciding what the system should become. At Tacavar.com, we treat it as the executor, not the strategist.

We pinned the repo to a commit before execution. Codex worked in a separate branch, with the audit checklist as its only source of truth. When it finished, the diff was reviewable in one sitting. No architecture debates. No surprise refactors. Just the audited changes, applied and validated.

The delegation triangle: brief, audit, execute

The pattern is a triangle. Opus produces the brief. Haiku audits the brief. Codex executes the audited brief. Each handoff has one artifact and one job. No model does everything. No model does its worst job.

That is the operational definition of multi-model delegation. It is not routing by price alone. It is routing by cognitive shape. Architecture goes to the model that reasons best. Gap-finding goes to the model that is cheap and adversarial. Bulk implementation goes to the model that handles large token budgets without losing the plot.

For Tacavar.com, this triangle has become a default for any change that touches more than five files or more than one deploy target. The overhead is one extra audit call. The payoff is fewer rollbacks, shorter review, and a cost line that looks like a rounding error.

The artifacts are versioned in the repo. The brief explains why. The audit explains what could break. The execution produces the diff. Six months later, a new operator can read the triangle and understand the migration without asking the original author. That is the difference between a clever prompt and an operational system.

Cost and quality math vs a single expensive model

The headline number is $0.01. A single expensive model doing the same work would have consumed 120k+ tokens just for implementation, plus the architecture prompt, plus retries. Even before quality, that math is ugly. But quality is the bigger gap.

A single model asked to architect and execute a 12-file migration has to hold two modes at once: strategic reasoning and mechanical file editing. In practice, it drifts. It forgets the failover constraint. It renames a variable in one file and misses another. It truncates long patch sequences. It spends expensive tokens on repetitive YAML.

The triangle avoids that. Opus stays short and architectural. Haiku stays cheap and adversarial. Codex stays broad and mechanical. The total cost at Tacavar.com was $0.01 for the refactor. The audit cost $0.001. The execution rode on subscription capacity. The quality was better because every model was used where it was strongest.

This is not about spending less for its own sake. It is about ai cost optimization as a forcing function for better division of labor. When you assign each model a narrow job, you can measure it. You can swap it. You can audit it. You can keep the brief, not just the code.

For a team, the leverage compounds. One architect brief can seed many execution passes. One audit can protect multiple deploys. The expensive model is used at the smallest possible token count. The cheap model is used at the highest possible leverage point. The subscription model absorbs the bulk. That is not a hack. It is a purchasing strategy for cognition.

Founders often ask whether this adds coordination overhead. It does, but only in the same way a good deployment pipeline does. The brief is written once. The audit is one extra call. The execution is isolated and repeatable. For a 12-file, 2-droplet migration, that overhead is trivial compared with the cost of a bad rollback.

The bigger opportunity is cultural. Once your team stops treating the model as a single monolith, llm orchestration becomes an operational discipline. You start asking which model should own the brief, which should own the audit, and which should own the execution. You stop paying premium rates for mechanical work. You stop accepting cheap execution for architectural decisions.

Tacavar.com now runs this triangle on migrations, multi-file refactors, documentation sweeps, and config hardening. The pattern holds because the jobs are distinct. The brief needs judgment. The audit needs skepticism. The execution needs stamina. Three models, three jobs, zero overlap.

See Tacavar's multi-model delegation templates at tacavar.com/delegation.