Over the last few months, I’ve fully transitioned to writing code using AI agents here at DoltHub. I’ve been an engineer here for almost 8 years, so this shift has been pretty major for me. AI use isn’t something that is enforced as a policy here, but rather something that we have the option of doing. Some of us use it to validate what we’ve written, some of us use it for the menial tasks, and some of us allow it to write all of our code. When AI writes all of the code, the engineers become dedicated reviewers over the output, applying edits manually or having the AI clean it up with direction, and approving it for other team members to review after it has cleared their review. This mix of approaches is what is allowing us to attempt to keep up with the onslaught of issues that AI is discovering in almost every open source codebase.
From what I’ve seen, the two most common setups at the company are a single agent that handles everything, or different agents (perhaps one Codex and one Claude) that review the work of other agents. I’m using an approach that goes quite a bit further, but how did I get there?
My Agentic Journey#
The Beginning#
I was one of the first engineers at DoltHub to play around with agentic coding using AI, but not for work.
This was around the release of Gemini 2.5 Pro Preview.
I had tried using it under Cursor as a test of how far AI had gotten, but I quickly ran into issues with Cursor getting lost as a project expanded to just a few files.
I eventually moved over to Cline and discovered the persistent agent document (.clinerules at the time), which allowed some test projects to actually get decently far.
The projects still had many issues, but I was amazed at how far AI was able to get, and knew that it wasn’t ready for primetime just yet.
The Adoption#
Fast-forward to earlier this year, where I had a personal project that I legitimately had a use for, but didn’t want to spend the time doing as it would take up 100% of my free time if I wanted something usable within a year. The CEO, Tim, had recently begun his work on DoltLite at the time, so I thought that maybe AI was finally at a point where I could use it to handle this project. GPT-5.5 was new as well, so I downloaded Codex and threw it at the problem. Within an hour, I had an MVP of my project, something that I knew (from experience) would have taken me at least 3 months to accomplish. From that point, I was sold on the idea of AI writing code within my personal projects, but the code wasn’t perfect. It was a case of “it works”, but it was quite suboptimal in a lot of ways, so I didn’t even want to throw it onto anything related to my work here at DoltHub. But for my personal project? I just wanted something that works, and nobody would use it besides me so who cares if it’s slow, broken in some ways, or has other issues?
The Turning Point#
Fast-forward to the release of GPT-5.6 Sol, and while I had continued to work on my personal project, I noticed that GPT-5.6 seemed like a step change in capability. Maybe it was the specifics of my project, but I noticed that the code it was writing was no longer suboptimal, and it actually found and fixed longstanding issues that I had never bothered with. After looking at the code, I felt that the quality was actually comparable to what I would have written, and so I had it rewrite the entire project (which took a couple of hours), with the end result being at a quality that I felt would rival my own work. It was at this point that I believed that the future of writing code would be done by AI, and while I still wasn’t at the point of trusting it with code for my job, I effectively stopped writing code for my personal projects. But, why wasn’t it good enough for my job if I felt it was good enough for personal projects? Because of AI hallucinations.
We are all familiar with AI hallucinations at this point. While the code that 5.6 was writing was of good quality, sometimes it was just flat-out wrong with some assumptions, or the existence of code. I also noticed that it loved to add new code, and hated deleting old code or reworking existing code. So I used its subagent feature to add a reviewer that checked the code for exactly these issues, and they seemed to mostly disappear. I saw that AI was quite good at finding issues in existing code, and this reviewer was doing that automatically for me as a part of the process, so I had my agents always spin up a reviewer once they were done. While this was transformative in the process, it didn’t quite catch everything, and eventually I found out that a single review session wasn’t enough. Just because the reviewer flagged an issue didn’t mean that the agent actually fixed it, so I created something that I called a “review loop”, where code is only merged once a reviewer says it passes, and the agent and reviewer are in a loop until the reviewer approves. I eventually added another reviewer that checked for different issues, since I found that “specialized” reviewers seemed to be more proficient at finding issues than a single “general” reviewer.
Frontier Versus Workflow#
When GPT-6 Astra released, it felt like another leap in AI intelligence. I threw new projects at it just to test its power, and it seemed like we were entering a new era of AI. Except, when I pointed it at my long-running personal project, I noticed that it didn’t do much at all. It found more bugs and optimized a few areas, but I didn’t see the same kind of improvement that I saw from 5.5 to 5.6. I knew that Astra was far more capable than 5.6 Sol, but it seemed like either my review loop was hindering Astra, or allowing Sol to punch far above its weight.
In either case, with Astra, it seemed like AI was actually good enough to start writing code that I didn’t mind reviewing for my job, so I began to allow it to effectively scaffold my PRs while I finished them myself. I eventually moved over to Fable since Tim was already paying for it on the company plan, and it seemed close enough to Astra that I didn’t mind using it for scaffolding. Fable was expensive and used up a ton of my weekly limit, so it was only really worth using for scaffolding, even though it felt like it would be capable enough to draft entire PRs with it. I also wasn’t using my review loop as Fable was just too expensive. That is, until Opus 5.5 came around.
What Is Frontier?#
Opus 5.5 was, and still is, a game changer for me. In my personal testing, it was outperforming every single LLM that I’d tried, and it was cheap too. Relative to DeepSeek it was much more expensive, but the speed at which it was able to work, alongside its output, was revolutionary for me. I’ve come to judge AI not just on the raw cost per token, but on the cost per task. For example, one LLM may cost 20% as much per token as another, but if the more expensive one accomplishes a task using 10% of the tokens then it’s actually cheaper. Add in the time to completion, and you have a metric where the “smartest” AI may not be the “best” AI. With Opus 5.5, I was able to bring back my review loop since it was cheap enough to do, and the results were so good that I was able to stop writing code for my job altogether. While the output of Opus 5.5 still isn’t perfect, reviewers in a loop can push back on the code until it’s close enough to perfect, but only by the very definition of what I asked.
This, however, gets to another issue. Review loops are great at ensuring that the code follows your direction, but directions have many assumptions that humans intuitively hold, and an AI does not. This means that, no matter how good the AI is, I don’t inherently trust its output.
I Don’t Trust AI#
It’s very possible that someone can read about my journey with agentic AI and think that I just trust whatever it gives me, but that isn’t true. My reasoning behind using reviewers in the first place was due to AI having issues, making mistakes, ignoring instructions, being inefficient, etc. Reviewers help this tremendously, but I’ve found that even the reviewers will mark something as correct that doesn’t adhere to the rules. To combat this, I’m using something I’m calling “gates”. If I want to create a PR in Doltgres, then there’s a “PR gate”. If I want to merge changes into a branch, then there’s a “merge gate”. The actions that result from these gates are automatic, and are the only way of performing these actions within their sandboxes.
What do these gates do?
One of the steps in my “merge gate” checks that test files, when changed, only have lines appended to them.
If an agent or reviewer attempts to bypass a test by changing it, then that commit is flagged, and I have the offending agent(s) fix it.
If a test was invalid for some reason, then I can make an explicit bypass on the gate by pushing the change directly, which is a permission that I have and the agents do not.
It’s extraordinarily rare that a test is incorrect, and it’s more likely that a test is testing the wrong thing (for Doltgres, this would be that a specific order is returned when no ORDER BY is present, which Postgres explicitly allows in the documentation as having an undefined order), so those generally mean that there’s a process change in the test framework (change tests without an ORDER BY to check the set rather than the order) rather than changing the test itself.
Of course, changing the test process is also a flag that the gate will fail on, so I’ll explicitly override that.
Expand these gates to as many different places as you can (tests, plans, documentation, etc.), and cover as many different types of modifications that can be made, and you derive a framework that allows you to trust the output as much as you trust the gates.
Gates will look different for each project as they all have specialized needs, but I feel that they’re essential to actually trusting the output.
Documentation Is Critical#
While gates can be arbitrarily complex, and they give you confidence in their output, they’re a defensive measure for ensuring that the AI doesn’t do things that are banned. Most of the time though, the AI will follow the directions that you give it, but those directions may have a lot of assumptions baked in that can cause it to do something weird. For example, let’s say that you have a performance check in one of your gates to ensure that the AI isn’t causing a massive performance regression, but your performance check only uses 100 items in its check. Well, the AI decides that bubble sort is good enough as the performance check passes, while your actual average item count is in the millions, meaning the AI has chosen the wrong algorithm.
Although the example above should be labeled as a bad check, if you don’t have documentation or rules regarding how things should be built, then the AI will make whatever assumptions that it wants. Simply adding a note such as “design with the expectation of millions of items” within your documentation will discourage the bubble sort example, and having a reviewer that specifically checks for scalability will help to find these issues before they ever reach the gates. While the gates are the true measure, you want to dissuade your agents from hitting issues with the gates before they ever reach them. With one month-long work project, I spent roughly 20 hours on getting the documentation as perfect as I possibly could.
On the flip side, you don’t want too much documentation, which seems at odds with thorough documentation. Agents will read documentation, but they’ll often read in chunks due to context limitations. With too much documentation, I’ve seen agents read “enough” of it, feel that they’ve got a good enough idea, and get to work while missing critical pieces that the gates ultimately reject (which can slow down their work substantially). I’ve seen this happen to both the agent and reviewer, so getting the size such that they’ll fit is a bit of trial and error, but something that should be done.
To help with this, I split my documentation between core, worker, reviewer, rules, and tasks (mentioned later). Core documentation applies to all sessions and is the smallest one. For example, “don’t try to modify the gates” goes into core, since it applies to everyone (and the gates will reject the modification if they try anyway). Workers and reviewers get documentation that goes over specifics for what they do, such as reviewers checking that a new test fails before a change and passes afterward. The rules are where items that are specific to some section of code are located. For example, perhaps I decide that some section of code should use a different hashing algorithm as an implementation detail. That rule would live in a dedicated rules document, where a worker inserts a reference to that rule somewhere that matches against the code (comment, external CSV, etc.), and a reviewer ensures that the reference was included and that the referenced rule is applicable. This doesn’t work around the gates, and helps the review loop produce the code that I want. I’ve found that forcing this rule approach helps with context management as you can have hundreds or thousands of rules that are applicable to sections of code, but don’t matter outside of that code.
Scaling#
With gates and reviewers, I’m able to run multiple workers at once, where each works on some section of code (as long as I have disjoint tasks). With enough workers, it becomes far too hard to watch what every worker and reviewer is doing, in addition to coordinating all of their work properly. This is where the last major piece of my workflow comes in, which is a coordinating agent. My coordinator handles when to run the gates, which workers are assigned to which tasks, task priority, rule management (only the coordinator appends rules so that they’re numbered properly for example), usage suggestions (add/remove reviewers or workers depending on task load), and much more.
The coordinator basically acts as though it were running the project, just without the overall authority to do everything that I can. To maintain context over an entire project as it’s evolving through time, that final tasks documentation is what the coordinator exclusively manages to keep track of everything as workers complete their tasks, bugs are found, and more. It’s effectively a sort of persistent context so that workers are interchangeable. This gives me a single session to interact with, and lets me keep tabs on all of the sessions since they all tell the coordinator what they are doing. For example, the coordinator will report that WorkerA is working on item B with ReviewerC’s approval on doing it with some approach. I don’t actually have to see the entire chain of thought that led to that decision if it’s a decision that I agree with, and I only need to look further if it’s a decision that I don’t agree with, where I can prompt the coordinator with the new decision. I’m still managing every worker, but in an indirect way that allows work to scale up massively. This is somewhat similar to the Mayor approach that Gas Town used, which I wasn’t even intentionally trying to mimic. At most, I’ve had 12 concurrent sessions including all workers and reviewers. Sessions are usually spread across two computers (a work-supplied laptop running Windows, and a Mac Mini I bought for iOS development years ago).
Crons and Handoffs#
The remaining pieces are somewhat specific to working with Claude Code, but they’re still a core part of my workflow.
I have a few cron jobs that fire at defined intervals, although if a session is mid-turn, then the cron will wait until that turn has ended. Turns are decided by the agent, so I don’t use crons when I need specific timing.1 The coordinator often has short turns since it’s usually just coordinating work, although I’ll occasionally see it acting as an additional “smoke test” reviewer, but never to the same depth as the dedicated review sessions. It has the majority of the crons, due to both its job and its shorter turns.
My three most useful coordinator cron jobs are:
- Disk watch: This one periodically checks disk usage and the swap file. The coordinator is able to query information on the other machines, so this can catch the accumulation of build files before they fill the disk. This runs roughly once an hour.
- Usage watch: Once my weekly usage hits a soft threshold (usually 94%), the coordinator tells all sessions to finish their current task and not start another from their queue. A second threshold is a hard stop, where all sessions immediately stop and tell the coordinator exactly where they stopped so that it can be logged for future sessions to pick back up once the weekly limit has reset. I leave the hard stop threshold at 97%, which gives enough headroom for sessions to stop and send their progress to the coordinator. This runs roughly every 10 minutes.
- Priority/memory review: The coordinator loves to prioritize bug hunting over further implementation work. This can waste a lot of time when the bugs are due to an incomplete implementation, so this cron looks at every task (assigned or not), checks that the work is being done in priority order, and potentially stops or reassigns work. Additionally, the cron ensures that Claude Code’s memory doesn’t duplicate anything in the documentation (checked for all machines), since memory exists solely to hold machine-specific facts in my workflow. This runs roughly every 2 hours.
On top of these coordinator crons, I also have a “keep-alive” cron that every session uses. Once Claude ends a turn, it stops working and awaits further input. The “keep-alive” cron fires immediately once the turn ends so that the session continues to work, and the session’s documentation instructs it to stop the “keep-alive” once it has actually finished its queue. The coordinator has a special “keep-alive” that ensures that every other session is either working or waiting on a result, with only ones that have truly finished being allowed to remain idle. The coordinator’s “keep-alive” cron runs roughly every 10 minutes.
Lastly, after 3 compactions, a session will create a new session with detailed instructions for resuming its work, and then stop. The new session messages the coordinator regarding the takeover2, where the coordinator handles bookkeeping for the transfer of responsibilities. I’m not sure if this is still necessary as Anthropic has fixed some bugs dealing with extremely long sessions, but in the past I noticed that the weekly limit would drain faster as the number of compactions increased. I could test to see if it has changed, but there’s no real upside to it since this process works exceedingly well for long-running tasks and extremely large work queues.
Bigger Than PRs#
After reading all of this, I’m sure that this sounds like complete overkill for routine PRs that will be read by human reviewers, and that’s because it is. This workflow is only useful for tasks that will take multiple hours, days, or even weeks to complete with the help of agents. A task that would take a human 3 hours or less to complete doesn’t need a setup like this. At DoltHub, I’ve specialized in massive projects (sometimes spanning multiple months) long before AI came around, so this is a workflow that I’ve grown to fit that type of work. Recently, I’ve also begun work on an unannounced project that’s really put this workflow through its paces, and helped strengthen it to the design that I’ve detailed here. That project is “write-only”, in that I add code via agents, but never read the code myself, only the aspects that I directly control (such as the gates). This may sound like it’s at odds with not trusting AI, however I’m not trusting the code, I’m trusting the gates that the code had to pass through. AI can produce code far faster than any human can review with a decent level of quality, so this approach is to allow for that speed (ensuring as good a code quality as possible), while eliminating certain classes of failure that are common in a lot of AI-written projects.
The Tradeoffs#
The biggest tradeoff is the most obvious one, in that this consumes far more tokens in some ways. Each session, whether it’s a worker or reviewer, is another session that consumes usage. This approach is also a drain on system resources. The sessions themselves aren’t too resource-intensive, but their actions (compiling, testing, etc.) are, so only so many can run at once before you have to introduce resource coordination (which didn’t work too well for me in the past). Benchmarking is best done on a quiet machine, so I have a third, older computer with a single session that just runs benchmarks and sends results to the coordinator (I only care about relative results, and the machine is off unless I need it). There’s also a speed tradeoff, and a fairly major one, as the review loops can have many iterations, which is an overall good thing for the end result, but dramatically increases the delivery time.
However, if I measure on the “completeness” of a task with regard to the bugs/error-rate, then I actually find that this approach is overall quicker and cheaper in the long run. A single session can apply a mountain of fragile patches in a codebase that can become extremely hard to manage and lead an agent down a loop of bug fixes (where fixing one bug breaks another). This approach, with a lot of upfront investment (getting the documentation and gates right), leads to projects where, after a month, progress is significantly beyond where projects without this workflow landed. We’ve actually had a sort of internal test of this workflow, where several engineers (including myself) spent several weeks prototyping the same project using different approaches (to decide on the best overall approach as a fun competition), and upon investigation of the end results, some of the issues present in other prototypes (modified tests and invalid assumptions are two examples), since there was nothing in their approach to catch them, were not present in my prototype. We were specifically prototyping a fully AI-written project, so this is the best real-world test of my workflow.
Future Potential#
Formal verification is something that I’ve played around with a bit, and it seems very promising in the world of AI. I think verification on top of existing languages (like Verus and Kani for Rust, or Frama-C and CBMC for C as examples) may be the way forward for projects rather than explicit languages like Lean or Rocq, but I need far more experience with them in a large project before I write more. Perhaps this will be a future blog post when I’ve had more time with them.
Conclusion#
I’ve presented a lot here, and this is, by far, my longest blog post. However, I wanted to share this information not just for the public at large, but for the team as well. I’ve talked to several engineers about AI workflows, and I feel that this is a good resource on detailing what is working for me, why it’s working, and how I arrived at the workflow in the first place.
If you want to talk more, you can get in touch with us on Discord or Twitter/X, where you can stay up-to-date on all of our projects. Thank you for reading my blog post!
Footnotes#
-
One time, a session spent over 2 hours in one turn! Agents usually run long tasks in the background, but this agent decided to run its task in the foreground and just wait instead of working on something else. ↩
-
I find some of these introductions quite humorous. Since the models are trained to use natural language, they’ll use formal greetings in their introductions. They’ll say something like “Hello COORDINATOR_SESSION, my name is WORKER_SESSION_2 and I’m replacing WORKER_SESSION_1…”. The coordinator will respond with “Hello WORKER_SESSION_2, it is nice to meet you. Today you’ll be working on…”. When the coordinator hands off to a new coordinator, it usually doesn’t say goodbye to the other sessions, but occasionally it does. ↩