Top
Best
New

Posted by wilhelmklopp 5 days ago

Towards Self-Driving Codebases(blog.detail.dev)
121 points | 99 comments
CharlieDigital 5 days ago|

    > It’s actually fine if agents make a lot of boneheaded mistakes. What’s not ok is if they keep making the same mistakes. 
I worked in life sciences for a bit. There is a process in clinical trials called corrective and preventative actions (CAPA). You'll also find this in other areas where failure tolerance is low (e.g. aircraft).

It's simple: when a mistake happens, you run your CAPA process (Google CAPA form and see examples to extrapolate what that process might look like) and determine the root cause and the correction to the process that allowed the mistake to happen in the first place.

(At least as a SaaS vendor in life sciences, when we had a CAPA (e.g. after a SEV0 failure), it would be folded into our SOPs and then we would be required to retrain on the SOP. Auditors would want to see our evidence of CAPAs, the versions of our SOPs, the records of training. All to extreme for most shops, but I add this for context/color)

This is something most eng shops do not have the discipline for since it requires some diligence.

Should it be fully agentic? Should there be human intervention here to approve the CAPA? Open questions to be answered.

grey-area 5 days ago||
The more important question - how would you actually get LLM agents to follow the instructions in your ever-growing CAPA reliably?

It’s all very well having a list of actions to avoid but that doesn’t help if your agents won’t reliably follow it.

jaggederest 5 days ago|||
You stop relying on the agents following instructions exactly.

You need two pieces:

a) prompts, that tell the agents what to do and how to do it (and ideally, the why, where, etc, the full picture) - that's the positive half, that drives behavior the way you want it.

b) deterministic tooling that prevents negative outcomes, like linters, compilers, static analysis, fuzzing, testing, the more the better. This side should either be firewalled off from the AI or very carefully watched so that it doesn't drift.

The part that you put in the deterministic side is the "never do x" stuff - I have lint for long comments (which AI hits every single time it commits), all my dev scripts are in typescript, precommit hooks, massive CI, and I lint even for things like redirecting error to standard out, tiny stuff, and also e.g. static migration analysis so the AI never ships an exclusive full table lock in a migration, for example.

sarchertech 5 days ago|||
You can’t deterministically keep them from making even a tiny fraction of all the possible errors they can and do make though.

You can’t keep humans from making those errors either but you also don’t let an error prone human crank out 20k LOC per day without forcing other humans to understand it.

CharlieDigital 5 days ago|||
This may be platform dependent.

C# Roslyn Analyzers[0], for example, are quite powerful and can identify complex patterns in code. One approach to deterministic enforcement would be to ensure that the project is set up with an analyzers library and mistakes that can be deterministically flagged are

[0] https://learn.microsoft.com/en-us/visualstudio/code-quality/...

sarchertech 4 days ago||
Code analysis can’t detect a sizable fraction of all possible errors because for any Turing complete language the number of possible errors is infinite.
CharlieDigital 4 days ago||
I don't think I implied that they could.

Each of these are just layers of control at different lifecycles of agent code generation. Analyzers are nice because it gives targeted, static analysis that can prevent certain classes of errors very early and at lower iterative cost (e.g. a build)

sarchertech 4 days ago||
I said

“You can’t deterministically keep them from making even a tiny fraction of all the possible errors they can and do make though.”

And you replied

“This may be platform dependent.”

I’m unsure how else to read that other than an implication that this might be possible on some platforms.

CharlieDigital 2 days ago||
I would certainly consider Roslyn analyzers capable of covering "a tiny fraction" of possible errors :) They are quite capable of covering for many common types of structural coding mistakes.
jaggederest 5 days ago|||
I don't know if that's necessarily true in practice the way it is in theory. If you knock down 95% of the issues they create over a certain period of time, in practice you'll have better code than a human would write, and it's all upside from there.

I've been using languages with stronger type systems and that's also a huge boon.

sarchertech 4 days ago||
> better code than a human would write,

Why would that be the case? You can run human written code through the same “linters, compilers, static analysis, fuzzing, testing” as you do agent produced code.

CharlieDigital 4 days ago||
You would be surprised. Humans will do human things like be extremely inconsistent, ignore warnings (if they are not enforced as errors), skip steps because they are lazy (devs often chose to skip our pre-push hooks and preferred to run in CI and babysit the PR).

Agents can also do all of those things, but they are generally more compliant to instruction.

sarchertech 4 days ago||
That’s an assertion with no evidence that doesn’t match my experience.

Agents require far stricter guardrails than humans. Without linters, tests, static analysis, oracles etc… no agent can create a large program.

Even if you’re correct, you just build those checks into CI so that neither humans nor agents can skip them.

monknomo 5 days ago|||
yes, this is a very helpful approach. I take a similar approach, partly because I find bringing up negative directions seem to bring the undesired action/direction into the agent's view and makes it more likely that they will go there
CraigJPerry 5 days ago||||
Why couldn't you express all those as test cases rather than instructions?

In test cases i can do anything, a test framework is just a way of discovering and then scheduling functions to run. I can emit useful instructions to the agent from the failed test case: "After walking the AST of all use of state machine X, a branch was found at Y which reused stale state. Ensure stale references are dropped..."

I can force the agent to pass the test suite before it considers itself done. I can reject edits of such test cases to partially mitigate reward hacking. etc etc

CharlieDigital 5 days ago|||
You can express them as tests, but you also need a feedback mechanism that creates the rule that when the LLM generates some net new code or performs some refactor, that there are these CAPAs that it needs to cover with test cases.

The CAPA is a learning that sits outside of the mechanism of verification; it is a record of problem:root_cause:preventative_action. I see it as the instruction that would be required to generate the test case to prevent the next occurrence of a class of failures.

In a real-world process, for example, there is usually a QA lead that is verifying that the process is followed by looking at the paperwork and evidence.

palmotea 5 days ago|||
> Why couldn't you express all those as test cases rather than instructions?

How would prevent removing the test case and the code that it tests? That's a legitimate thing to do when you're modifying a codebase. My intuition is "corrective and preventative actions (CAPA)" is a level or two up from test cases.

CharlieDigital 5 days ago||||
This is a question of context management and I suppose some would classify this as "harness engineering" as the trend of the moment.

One approach, for example, might be to have the a standalone code reviewer agent that is solely responsible for interfacing with the CAPA system (e.g. via a tool, via MCP) and acts as a back stop. When it finds a new type of CAPA, it stores it (and the backend indexes it with enough metadata to support broad types of retrieval). When it reviews a piece of code, it finds past CAPAs. By file locality. By business domain in the application. By keywords.

Same tool and repository available to both building agents and review agents, but use the review agent as a dedicated back stop as part of the verification process.

juancn 5 days ago||||
I think the only way for now it through distillation of your own models, which can get expensive fast.
Ferret7446 5 days ago|||
The same way you do for humans, regular training and audits.
grey-area 5 days ago||
They don’t behave like humans.
Ferret7446 4 days ago||
On the contrary, they behave exactly like moderately autistic humans
ericmcer 5 days ago|||
That has been a part of post mortems everywhere I work, there was never a name for it though. Just someone would say: “how do we prevent this in the future?” which usually spawns a few tasks that the person who caused the issue or others will pick up.
skinfaxi 5 days ago|||
> Should it be fully agentic? Should there be human intervention here to approve the CAPA? Open questions to be answered.

I think a point we are grappling with is, what necessitates human intervention, like philosophically. Is it accountability? I was thinking about this in terms of code review and it's not like we would fire someone if they broke prod, so at what point do we need someone accountable. Maybe it's for approvals for certain classes of risk (like those associated with actual harm to life). It's also not lost on me that many human systems lack accountability.

jaggederest 5 days ago|||
I think there's a pretty clear and wide gulf between "nobody could have seen that coming", or "I just wasn't on my A game", and frank negligence.

I once worked at a very large company, and one of my coworkers was like "eh, I'm not going to do any of this work, because I don't have to", and that was a clear indicator that the problem wasn't (just) with the system, but with him individually.

skinfaxi 5 days ago||
I've had a similar experience, also at a very large organization. In my case this person chose that kind of environment because it allowed them to work on side stuff while waiting for approvals, etc. A lot of people in very large companies don't view the grind of organizational friction inhibiting their actions as problematic.
DonCrespo 5 days ago|||
[flagged]
jeffnash 5 days ago|||
Every place I've worked at has positioned their SEV review process as 'blameless' with respect to the engineers who created the code, processes, etc that led to the incident. On paper, it's not about pointing fingers (though I've found this to be somewhat idealistic), but about finding faults in the processes that let bad code slip through the cracks.

It will be interesting to see how the notion of 'responsibility' carries over as agents handle higher and higher levels of abstraction. Agents built using the popular frameworks of today are somewhere in between code, formerly written by engineers, and an actor (like an engineer). When an agent wrote the framework to audit and monitor ops agents who are monitoring the performance and reliability of the code that coding agents wrote, who is responsible for ultimately ensuring it doesn't happen again? Should the findings just be added to whatever RAG and a few prompts/hooks/skills changed by another agent? When does a human follow up and to what degree?

This is the sort of thing that makes me believe that software engineers will never truly go away; at the very least, they serve the very useful function of being ultimately responsible for something going wrong.

mlaretallack 5 days ago|||
This is a general principal in the eng shop I work for, its written into every step, including the SCRUM etc.. What when well, why did it fail, what could be done better. Its all part of root cause analysis.

I personally use it for the agents I use, so why did it fail, what was the root cause, what can we do to prevent it again.

nomel 5 days ago|||
I don't see how this could work, right now, since every failing I've had was just generic stupidity of the AI, which is brilliant one minute, and a complete idiot the next.

I think correction actions still require the ability to execute them, which (in all the cases I've had) would require more capable models.

Long term, I think you're probably correct.

drob 5 days ago|||
Agreed that domain experts should be making these kinds of decisions, and the right way for an agent mistake to get caught is going to depend a lot on the cost and probability of the mistake. My only point here is that the agent side of the system needs to learn. The software production machine needs to improve over time.
jayd16 5 days ago|||
Honestly I feel like I'm taking crazy pills these days.

Write a program! If it has a bug, debug it and update the program. Use an LLM to debug it if you must. If you're doing something repeatable, then use a traditional automation scheme.

If an LLM has to handle a subsection of the program, so be it. Just wrap that part with clean inputs and outputs.

Why does it feel like we've forgotten how to automate things?

andrekandre 5 days ago||

  > Why does it feel like we've forgotten how to automate things?
everybody is too busy everyday fighting fires to garden all those standard automations; its much "easier" to just throw it at an llm and move on (just saying what i see)
bryanrasmussen 5 days ago||
the history of assembly lines would be instructive. I don't think we have achieved a fully automated assembly line yet, but certainly they are much more automated than they were when Ford set up the first one.
calldacopsidc 5 days ago||
Sorry to get hung up on what is probably just flavor text, but the first sentence.. "Agents can oneshot games that are actually fun", uhhh such as?

Would love to be proven wrong here, feels like I've just seen the same basic one-level kart racer in like 3 model announcements. Not even sure if they were one-shotted, I certainly would not describe them as "fun"

simonw 5 days ago||
Yeah, that goes against my experience. Agents can absolutely one-shot games, but the gap between something that looks like a game and something that is fun to play and worth trying for more than a few minutes is gaping wide.
pwthornton 5 days ago|||
As someone who builds games, particularly games meant to be played in the browser or apps, it can 100% one-shot a game-like experience, but it will not be very good.

You need to playtest the hell out of games. Play a bit, iterate, play a bit more, iterate, etc. You will get way better results if you start small and don’t try to one-shot it. Start small, vertical slice, playtest, and go fro there.

xyst 5 days ago|||
Probably fun defined in the ephemeral context. As-in it was "fun" to play in the context of the short form video attention span, social media brain rotted individual. Then it was thrown away and never played again.

It's definitely not fun if you consider building an actual community around it and have a long term plan for it.

kdkdwkidkwk 5 days ago|||
I wouldn’t call these one-shot “games” fun either, but your definition of “fun” sounds more like “work” to me.
fragmede 5 days ago|||
That's a weird definition of fun.
bognition 5 days ago|||
I built this in one shot cube-sweeper.com

(If that doesn't load try cube-sweeper.onrender.com some isps block it)

I did make a bunch of changes after the initial "one shot" but the bulk of the game was done after a single prompt

miltonlost 5 days ago|||
If AI coding now is all about taste, when the first sentence shows off just how little taste the author has, I can't trust the rest of what they say.
Gander5739 5 days ago|||
Even very basic games can be fun (e.g. tetris). Though maybe the funness of a game is more an art than a science.
alasano 5 days ago|||
Honestly agents can't one shot shit except cool demos. I mean in a way they can but I let an Astra/Fable 5.1 duo build an android app and figured I'd really just loosely vibe code this for once instead of supervising.

It's a working pile of trash that has quadratic growth in the remote postgres database resulting in 10GB stored in a few days for what should have been like 5 MB of data.

It's not a skill issue, I know how to get good results but I figured maybe I don't need to be as cautious as I am all the time.

Not that I don't believe we can get there eventually.

andrekandre 5 days ago||

  > resulting in 10GB stored in a few days for what should have been like 5 MB of data
something for all those new datacenters to take care of (only half sarcastic i'm afraid)
ludamn 5 days ago||
Agreed, I read this and almost instinctively decided to close the page, agents can be used to build games for sure, but that "one shot" and "fun" in the same sentence is really misleading
palmotea 5 days ago||
FYI, it looks like you've been banned for the last ~8-9 months, for no obvious reason I can see. I vouched for your comment to make it visible, but they appears to show up as [dead] by default.
ramon156 5 days ago|||
i can see the comment now, so this seems undone?
ludamn 4 days ago|||
[dead]
drob 5 days ago||
Author here, hello! Happy to expand on how we're thinking about this if any of it is unclear.

We wrote this post as part of a launch, which you can check out here: https://x.com/danlovesproofs/status/2095182189499711759

geooff_ 5 days ago||
If you have a logo in the top left corner of your company blog the logo should route to the home page so I can see what product you're actually building.
rrook 5 days ago||
My bet is that we'll see a second layer of harness emerge, as self-driving codebases become the target. There will be an application facing harness, orthogonal to the agent facing harness. The app harness will represent the software factory that is emergent for the specific application being developed.

Anyway, here's mine, still wip:

https://hale-lang.org/docs/dna/

https://github.com/hale-lang/hale/issues/690

cyanydeez 5 days ago||
I suspect it won't be a harness, but just a more specific LLM trained in the universe of user-selected context of vetted resources.

Why? Because LLMs are always going to be dumb when they're trained at scale. Their ability to speak software diverges from their friendly user input layer. A harness won't overcome that, but an LLM saddle ontop of a larger model would provide the type of feedback loops you'd want to look into.

I don't think you'll find two deterministic systems will produce much.

rrook 5 days ago|||
I think that dissolves the "self driving" distinction, though? The mechanisms for driving the codebase must be present in the codebase itself. Otherwise its just a regular out-of-band development process.
verdverm 5 days ago||||
fine-tuning may be a more scalable approach to LLM personalization than sending all the same context to two LLMs

I'm working towards both in my homelab to see which works better with little qwen

cindyllm 5 days ago|||
[dead]
tdg5 5 days ago||
I’ve definitely had a hunch about a software factory harness kind of thing.

Your thoughts on the matter seem clearer than mine.

I’m kind of relieved to see so many stages; that’s something I’ve grappled with conceptually. The volume of (sometimes optional) stages has made it hard to resist the temptation to hack something together with a GHA workflow.

I salute your choice to support distributed; that’s a requirement in my book.

I look forward to trying it out.

rrook 2 days ago||
Expressing complex emergent workflows is fairly straightforward given how the workflow engine recurses:

- a workflow is a series of steps

- a step is one or more tasks that can be done in parallel

- a step is complete when all of its tasks are complete

- a task can be a unit of work, or a pointer to another workflow

ModernMech 5 days ago||
It's a losing proposition. Self-driving cars go from point A to point B, and it's really easy to specify point B. My experience so far using agentic AI 24/7 for almost a year has been the AI can drive almost anywhere, so the whole problem is specifying where to drive. This doesn't get solved with faster, better AI, because all that will do is allow it to autonomously drive your codebase to random places you didn't want it to go. Then you're still left with the problem of specifying the problem.

But then there's the cases where the AI can't actually drive. What if you tell the agent to invent AGI? Or time travel? Where does it drive to? Does it tell you that it can't? How does it know it can't just drive here? How you you know? At the end of the day these are not wish granting machines, so someone connected to reality is still going to have to make decisions. And that person is going to be the one held liable for whatever the AI does so would they want a self-driving codebase in the first place?

Sivart13 5 days ago|
Well put. I've found that agents are great at adding features to areas of the code that I already understand, where I can phrase my goals coherently and keep them on the rails.

Any attempt to describe software by "specification" leaves enough ambiguity that the agent will do deranged stuff like add a ton of code to satisfy error cases that can't happen. Or, like you imply, it will confidently create a bunch of nonsense to "solve" a problem in a way that is not really possible.

aerodexis 5 days ago||
Makes sense to me - I see it going down two separate routes in parallel:

One is to take the human out the OODA loop for cyber defense. Servlet libs (for example) are going to become fluid, self-modifying things w/ contracts that operate much differenlty from how they do today. The engineering practice around these things will need to change.

The second is that UX will be self-modifying. Just like how pi can modify itself, I can see this being a general practice for user-facing applications. Perhaps a text-box in which users can describe tweaks in can request changes to how the application functions. Engineering an application will focus on modeling the non-negotiables of how an application works, and providing the correct primitives for user-driven LLMs to modify software on the fly, as well as track and rollback changes. There'll also be funsies around how to ensure that ads get delivered regardless of the user trying to get rid of them.

smallmancontrov 5 days ago|
> fluid, self-modifying things w/ contracts

This smells like worm food. Those contracts had better be airtight.

aerodexis 5 days ago|||
What would you prefer: 99% of user requests to succeed but w/ 5% risk of getting O-day'd, or have 90% of user requests succeed but w/ 0.1% risk of getting 0-day'd.
bigstrat2003 5 days ago|||
The first and it isn't even close. Normal operation of the system is more important than preventing attacks, and trading it away at a 2:1 ratio is a bad trade.
imtringued 5 days ago||
You're trading it away at a 50:1 ratio though.

The point of the example is that with the first choice you have 5% legitimate customers and 5% malicious "customers" and by letting all of them in aka all 10%, you get maximum customer satisfaction including satisfaction of the malicious customers.

Alternatively you reject the malicious customers and as collateral damage accept that some customers do not get their request approved.

You're also confusing "normal operation" with what a user request is. A user request is a request to change something, so by definition it is not the continuation of the existing system. You're thinking that a user request is a HTTP request which is not what's being discussed.

aerodexis 4 days ago||
Personally - for banking - I'd be plenty happy dealing w/ 90% uptime if it gave me an order of magnitude more security against getting robbed. This tradeoff may not have been realistic a decade ago, but it seems to be where things are trending.

It also is de-facto the case today when logging in as per usual sometimes requires a captcha or additional verification.

aerodexis 5 days ago|||
I could imagine it going so far as to have an LLM re-impl core libs every time a request is processed. Lightning never strikes the same place twice.
wrs 5 days ago||
This would be more convincing if there were a simple stat on the home page of the dispositions of the reported bugs (fixed/no-repro/won't-fix).

As a random sample of one, I looked at one of the bugs this reported on Tailscale (first thing on the homepage) [0], and the pull request ends with "Apologies for the lack of due diligence here. I'll go ahead and close this out."

[0] https://github.com/tailscale/tailscale/pull/17843

drob 5 days ago|
We should publish some stats. The fix rates on bugs are around 45% baseline, increasing over time as we learn from behavior within a given codebase. The merge rates for the codebase health work we do (e.g. deleting dead code) are very high, at least 90%.
rafaelvasco 5 days ago||
Is our fate to become more and more product designers and less and less software engineers?

I feel that way.

But I'm now able to actually create and release things. Before, I used to obsess over code architecture, optimizing every single line. I could and can craft beautiful code. And then I always burned out and lost interest (gemini). Now I don't touch code at all and have been actually creating and releasing the ideas I've always had in mind. Then I realized that's what I always wanted. The code was always a means to an end. But that's me.

2001zhaozhao 5 days ago|
In the end, we already have processes that work for humans and we know the types of testing, verification and review that makes a codebase grow healthily. We just need to adapt these designs the best we can to AIs.

AI have a lot of advantages over humans like speed, controllability, good defaults (e.g. Claude will write helpful comments unprompted which is better than most engineers), and the ability to implement best practices like comprehensive testing with much lower cost than a human team. Using AI in my personal projects, I am able to write software at a much lower bug rate than manually, because now I can make an automated test suite whereas previously I had no time to do so. However, AI also has downsides like rigidity, limited context window, and lack of creativity by default which needs to be resolved with harnessing (e.g. different agents with separate, well-compressed contexts) or worked around with human review layers.

I suspect the best core pattern for coding automation will be to create an engineering manager agent layer that can flexibly apply a set of engineering practices to the concrete problems at hand. It would handle all coding agent pings before it reaches a human, with prompting so that it reliably considers the big picture when making decisions. Very rarely, it would escalate an issue or plan review directly to humans when it is truly blocking, but most likely it would organize the information it obtains from the lower layer coding agents and surface them as reports for humans to review.

More comments...