The Age of the Code Factory Demands Discipline

The factory pattern has been emerging as the new way to SHIP FAST. One engineer (or just one person), adequately equiped and with an ample token budget, can spin up a head-spinningly large cluster of agents to operate on a specification, test changes, review code, and manage CI to build out a masterpiece of software engineering.

It's dizzying. You had a thought as you slept about how to make the world a better place (or at least score some points on reddit). You wrote a few sentences in a markdown file. You instantiated an agentic army on your terminal. The code was brought into this world, tested and merged while you went back to sleep.

While you are getting your coffee, a user reports a bug. No sweat, we just broke some functionality when the agent merged this morning. We'll have the agent fix that. 68k output tokens, not bad. Another user is confused by how the feature works. Hmmm maybe this isn't quite ready yet. Lets hide it from the UI while I get my factory to tweak it. Ensure that there are tests so the core functionality doesn't break while its hidden. 146k tokens. Start the factory up and let it hum. Our biggest customer needs something, we'll switch gears and maybe get back to the new feature later.


There's an innate problem with a paradigm in which its easier to build software than to design and reason about it: it's simply easier to build the thing than to discern if you actually need it or how it should work. This problem compounds itself over time: a feature you add today needs to be maintained tomorrow, even if that feature adds no value it continues to add overhead to your agent and complexity to your codebase. Bad architecture compounds similarly across many features that do add value, and allowing LLMs to decide your architecture can be specious - its a pattern matching coin operated robot called in a loop with a bunch of scripts to help it out, don't anthropomorphasize the thing.

It's a funny world - there are cases in which an agent writes better code than I would - but only if I take the time to develop the idea myself, validate it, and write up what I need the agent to do before forcing the agent to take my plan and develop its own plan. Skipping a step tends to involve devolving into what is at best described as an expensive brain storming session with a lot of back and forth before I ditch the session altogether and start another one with a clearer picture (or just abandon it). And still there are some features that made it into the app that never get used - all resulted from me thinking "this should be neat" and then setting the clankers loose. And some of those features are pretty cool, but they aren't useful and they don't sell software but now their tests must keep passing until I decide its worth the effort to yank em out and they bloat the codebase and invisibly eat up tokens.

Herein lies the need for discipline. When you have a clever idea, you must be able and willing to:

  • Have a set of goals and clear idea of who your users are (easy right?)
  • Ask yourself if your clever idea is aligned with your goals or is it just a side quest? (Side Quests are fun! ...but rarely profitable)
  • Are your core users actually going to use this cool thing?
  • what other important work are you avoiding by doing this?

If the use case is clearly aligned, you have folks that will consume this, and its an appropriate time to do it, congrats! You passed the first test. Now onto the pre-ai planning:

  • document a high level goal and make sure it still makes sense once you've written it down
  • establish the key steps and architectural requirements in bullet points, and ensure it still makes sense once you've written these down
  • write down what you need to verify that its working and useful

After that, if it all still makes sense, fire your agent off in planning mode - there's probably a lot of detail to fill in. Then you can burn your tokens as fast as humanly possible to make it.

None of this is hard or earth shattering but the key is to just avoid building useless crap simply because you can. Then do the tiniest bit of labor to ensure that you don't end up with a mess that invisibly consumes tokens on every subsequent project.