Why an AI Agent Writes Slop: Ex-CTO of City Drive Explains How to Prepare a Repository
An agent writes slop not because the model is bad. It behaves like a newcomer who forgets yesterday's code review every morning, and the team's agreements are not written down in the code. The former CTO of City Drive recommends creating an AGENTS.md file of a couple hundred lines and enforcing the rules with linters, hooks, and CI. The easiest starting material for the file is the comments on pull requests from the past year. This way, the agent is less likely to step on the same rakes in every new session.
AI-processed from Habr AI; edited by Hamidun News
Skeptics of AI development usually tell the same story. They tried the tool, the code built and even passed the tests, but it was not written the way the team writes code. It copies the worst parts of the project and falls apart after the first edit. This is what AI slop, or "garbage," is. The author of this analysis, who left the CTO post at the car-sharing company City Drive almost a year ago to focus on agentic development, believes the problem is more often the repository, which was not prepared for an agent, than the model.
The Agent as a Newcomer Who Arrives for the First Time Every Morning
The author starts with a story from 2019. He led development of "Taxi VK" on VK Mini Apps, and a third developer, a strong engineer with different habits, joined the two-person team. There were no written rules, so one pull request of fifteen hundred lines got a record one hundred comments. After a dozen pull requests, the comments could be counted on one hand. But the newcomer had nowhere to get some of the knowledge. Some things lived only in people's heads, and some approaches the team had abandoned after getting burned left no trace in the repository.
Now imagine that this developer resets every morning. The agent behaves the same way. The model has no memory: with each request, the entire conversation history is sent to it, and when the context fills up, the conversation is compressed and the instructions from the start of the session are lost. The agent does not hold the whole project in its head and sees only what it has found itself.
The author cites three typical traps:
- The project has a hundred modules, ten recent ones are well written, and ninety old ones are legacy code. The agent does not know which ones are the model to follow, and it may take the very first and worst one as an example.
- Integration tests in a Java project run with the command
mvn test -P integration. The agent runs a plainmvn test, gets "No tests to run" and BUILD SUCCESS, and concludes that everything is green. - Data that was just written is read from the primary, because the replica may lag behind. A newcomer gets corrected once, but the agent repeats the mistake in every session.
Agent errors are now more often semantic than syntactic. The code builds and looks correct, but it rests on a wrong assumption: the agent misunderstood the business logic, did not ask a clarifying question, or missed an edge case. This is harder to catch in review than a broken build.
Write Down the Knowledge and Let the Agent See the Result
The first step is an AGENTS.md file in the root of the repository. Claude Code, Codex, and other agents read it. The author compares it to the sheet of A4 paper handed to a newcomer on the first day: it should take up a couple hundred lines, not fifty pages of wiki. It contains five things: what the repository is, where things are located, build and test commands, unwritten agreements, and the team's glossary. It should not restate the code, or there will be two sources of truth, and the real one is only the code running in production.
A quick way to collect the rules is to ask the agent to export all pull request comments from the past year, and then have a human keep only what is still relevant. If the agent keeps making mistakes in a multi-step task, such as setting up a feature flag, you need a skill, an instruction the agent loads when needed. Do not write it from scratch: complete the task together with the agent and ask it to describe the steps it took in the same session.
The agent also needs an environment where it can see the result of its work. For a small project, it runs locally. It is better to put the chain of commands into a script: the agent interprets the text of instructions differently each time, but a script runs the same way every time. For large projects, you need a preview environment for each pull request, and Vercel, Netlify, GitLab Review Apps, and Argo CD can all spin these up. The agent gets the address of the environment, calls the endpoints, checks the data in the database, or clicks through the browser following test cases.
Verify with Code and Limit Permissions
Any rule in AGENTS.md remains a request: the agent may not follow it, or may lose it after the context is compressed. So whatever can be checked by a program should be checked by a program:
- Tests first, then code. Otherwise the agent is tempted to adjust the test to fit the code.
- Linters with clear messages. The rule about the primary and the replica can be implemented as a check that forbids reading from the replica right after a write, with an error message that explains how to fix it.
- Hooks. Claude Code can run the linter itself after each edit.
- CI, without which nothing can be merged. CI configs and tests change only with approval from the owners listed in CODEOWNERS, and all checks must finish in 20–30 minutes, or they will eat up the speed gain.
Review changes too. If a developer used to close three or four tasks a week, they can now close three or four a day, and reading everything line by line is physically impossible. The author proposes a scheme: one agent writes the code, and another, in a fresh session, reviews it, because the author of the code checks it with the same context. A human looks at decisions that are hard to reverse: the database schema, access rights, security, and architecture. To avoid hunting for them in a diff of 20 thousand lines, the agent itself puts the key decisions in the pull request description.
On security, the author reminds readers that the agent acts on your behalf, and the main thing to fear is malicious code, for example from a compromised library. Safety is highest when the agent's machine has no access to production. Next comes a sandbox or container, where you can allow everything. The weakest option is human confirmation, which relies on hooks that check each command before it runs.
To get started, ask the agent about the part of the project you know best: where the relevant code lives. Look at which search commands it ran and how many rounds it took. Anything it searched for for a long time or found incorrectly becomes the first lines of your AGENTS.md. The author published the full version of his approach in a free book about Agentic SDLC on GitHub. This is one practitioner's personal experience, not a measured study, and the text contains no figures on the effect. But the advice is testable and costs nothing to try.
- Nov 21, 2026Anthropic and Claude Claim Proof of the Riemann Hypothesis, Stanford Responds Without AI
- Nov 21, 2026Karpathy-Inspired Four Rules for a Coding Agent in One File Gather 232,000 GitHub Stars
- Nov 21, 2026A hotel warned about a breach nine days late, and the author put Claude and Codex on hunting new vulnerabilities
- Nov 21, 2026Amazon Offers AWS Quick AI Agent with Claude for Free, Plus Tier at $25 a Month
Key Questions Answered
What are the key details on The Agent as a Newcomer Who Arrives for the First Time Every Morning?
The author starts with a story from 2019. He led development of "Taxi VK" on VK Mini Apps, and a third developer, a strong engineer with different habits, joined the two-person team. There were no written rules, so one pull request of fifteen hundred lines got a record one hundred comments. After a dozen pull requests, the comments could be counted on one hand. But the newcomer had nowhere to get some of the knowledge.
What are the key details on Write Down the Knowledge and Let the Agent See the Result?
The first step is an AGENTS.md file in the root of the repository. Claude Code, Codex, and other agents read it. The author compares it to the sheet of A4 paper handed to a newcomer on the first day: it should take up a couple hundred lines, not fifty pages of wiki. It contains five things: what the repository is, where things are located, build and test commands, unwritten agreements, and the team's glossary.
What are the key details on Verify with Code and Limit Permissions?
Any rule in AGENTS.md remains a request: the agent may not follow it, or may lose it after the context is compressed. So whatever can be checked by a program should be checked by a program: Tests first, then code. Otherwise the agent is tempted to adjust the test to fit the code. Linters with clear messages. The rule about the primary and the replica can be implemented as a check that forbids reading from the replica right after a write, with an error message that explains how to fix it. Hooks.
Test Frontier LLMs & Autonomous Agents in One Workspace
Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.
The AI world, distilled — once a week
Seven stories that actually mattered, hand-picked. No noise, no reposts, no press releases.
Done! Check your inbox for a confirmation.