Stop paying your agent to re-plan the same job

ONE CODE-REVIEW JOB, TWO WAYSTokens used, numbers from the Swamp teamSkill in Codex~4.6M tokens · 23 agents · 12.8 minSwamp workflow~506K tokens · 3 agents · 6.6 minBars to scale: 506K / 4.6M is about 11%
Fig. 1. One code-review job, as the Swamp team measured it and @_avichawla shared on Nov 16: about 4.6M tokens as a skill in Codex versus about 506K as a Swamp workflow. Bars are to scale from zero (506K / 4.6M ≈ 11%). These are the Swamp team's numbers, not mine.

A skill is a set of instructions your agent reads before it does a job. That's great the first few times. By the twentieth run it gets expensive, because the agent reads the whole thing again and decides every step from scratch, every time.

Avi Chawla posted about Swamp today, an open-source CLI that goes after exactly that. You describe the task once. The agent breaks it into small behaviors with typed inputs and outputs, wires them into a workflow, and from then on plain code decides which step runs next. The model only gets called on the steps that actually need judgment.

The number that caught my eye is the team's own code-review test, as Avi shared it:

  • As a skill in Codex: about 4.6M tokens, 23 agents, 12.8 minutes
  • As a Swamp workflow: about 506K tokens, 3 agents, 6.6 minutes

Avi says most of that saving came from one change: the coordinator agent got replaced with code. I haven't run Swamp myself yet, so those are their numbers, not mine.

Why this lands for me

I optimize small local models on Mac hardware, and the lesson I keep relearning is the same one. Give the model less to figure out and it does better work for less.

My version is a Python sandbox I pair with LFM3 1.7B. The model hands off the math, and code runs it and checks it. On AIME the tool didn't raise the model's score. What it did do was cut tokens per solved problem by about 23%. In a separate 27-task tool test on my M1 Max, the Python runs averaged about 114 tokens a second end to end, tool and prompt time included.

Same idea, different scale. Swamp moves the loop into code. I moved the math into code. Either way you stop paying a model to rediscover something you already know how to do.

How I'd use it

  1. Keep writing skills while a task is new and you're still figuring it out.
  2. Once a skill runs the same way every time, that's your signal. Ask your agent to turn it into a workflow.
  3. Look at which steps still call the model. If a step doesn't need judgment, it should be code.
  4. For the steps that do need judgment, try a cheaper or smaller model there first.

The repo is at github.com/swamp-club/swamp. It plugs into Claude Code, Cursor, Codex, OpenCode and a few other harnesses, and it runs on macOS, Linux and Windows.

Credit to @_avichawla for the writeup and the numbers.

Tags: Cost Agents Agent workflow

All ship logs