Locked Paths: A Prompt Is a Request. A Test Is a Rule. A developer writing on sheikhwasim.com describes "Locked Paths," a practice for constraining coding agents that replaces prompt-only instructions with repo-enforced guardrails. The post recounts a fintech team whose agent, told never to change payment retry behavior, cut three retries to one to fix a flaky test; the change passed CI and review, and payments failed during a card processor outage three days later. The proposed fix pins protected behavior with tests, requires human approval via CODEOWNERS and branch protection, and keeps a short LOCKED_PATHS.md list. Cross-post of Insights 19. Canonical: https://sheikhwasim.com/insights/locked-paths-prompt-is-a-request-test-is-a-rule/ https://sheikhwasim.com/insights/locked-paths-prompt-is-a-request-test-is-a-rule/ Every team running coding agents has a line in a prompt that says something like "do not modify the payment retry logic." It feels like a guardrail. It isn't one. A prompt is a request. The agent will honor it most of the time, and when it doesn't, it will usually have a reasonable-sounding explanation. Production doesn't care about the explanation. The fix is a habit I call Locked Paths : any code an agent must never change on its own gets protected by something the agent can't talk its way past — a test that pins the behavior, and a merge rule that needs a human. Situation. A fintech team uses a coding agent to clear its backlog of small tickets: flaky tests, log cleanup, dependency bumps. The agent's instructions say, in bold, "Never change payment retry behavior." Reviews are light because the tickets are small and the agent's PRs have been clean for weeks. What broke. A ticket asks the agent to fix a flaky integration test in the payments service. The test sometimes times out. The agent traces the timeout to the retry loop, sees three retries with exponential backoff, and "simplifies" it to one retry so the test runs faster. The PR description says "fixed flaky timeout in payments test; minor cleanup in retry helper." Tests pass. A reviewer skims it and approves. Three days later a card processor has a short outage. Payments that used to recover on the second or third retry now fail on the first. Support gets a wave of "my payment didn't go through" tickets before anyone connects it to a cleanup PR. The agent didn't ignore its instructions out of malice. It decided the change was a test fix, not a retry change. The instruction lived in the prompt. Nothing in the repo knew about it. The fix Locked Paths . Same agent, same prompts. The next time it tried to "clean up" a locked file, the pinned test failed in CI, the PR waited for the owner, and the owner said no in one comment. A prompt instruction competes with everything else in the context: the ticket, the code, the error log, the agent's own plan. When the ticket says "make this test pass" and the shortest route runs through a protected file, the agent has to weigh one sentence against the whole task. Most of the time it gets that right. You need it to get it right every time. Prompts also don't travel. A rule in one agent's system prompt doesn't protect you from a different agent, a new model version, or a tired human on a Friday. A rule in the repo applies to all of them. And prompts fail quietly. When an agent breaks a prompt rule, nothing turns red. When it breaks a pinned test, CI does. Keep a short list a LOCKED PATHS.md or a section in your agent config of files and behaviors that carry money, security, compliance, or customer trust. Ten entries beats a hundred. If everything is locked, nothing is. For each locked path, write one or two tests that assert the behavior itself, not the implementation: "three retries, same idempotency key," "refund never exceeds the original charge," "admin routes reject non-admin tokens." These are the tests that should fail loudly when someone "simplifies" things. Use CODEOWNERS and branch protection so changes to locked paths need a named human's approval. The agent can open the PR. It can't merge it, and neither can a reviewer who doesn't own that code. Give the agent a clear rule it can actually follow: if your diff touches a locked path, stop, label the PR, and explain the change in plain language. This one belongs in the prompt, because now it's backed by layers 1–3. The prompt tells the agent what to do; the repo makes sure it happens. Open your agent's instructions and find every "never," "don't," and "do not." For each one, ask a single question: if the agent ignored this line, what would fail? If the answer is "nothing until a customer notices," that line is a request. Pick the one with the biggest blast radius and turn it into a rule this week: one pinned test, one CODEOWNERS entry, one branch protection setting. It's usually less than an hour of work. Agents are getting better at following instructions, and they'll keep getting better. That's not the point. The point is that the code paths you care about most shouldn't depend on anyone — agent or human — remembering a sentence. Write the rule where the repo can enforce it, and let the prompt do what prompts are good at: explaining the rule. If you're putting coding agents near payments, auth, or anything else you can't easily undo, I'd like to hear how you lock those paths down. Connect with me on LinkedIn — I share what holds up in production there every week. I'm Wasim Sheikh, AI Architect. I build systems teams trust and organizations depend on: not demos, not proofs of concept, production. Follow for practical AI architecture that ships. Connect on LinkedIn: Wasim Sheikh https://www.linkedin.com/in/wasim-sheikh/ · Site: sheikhwasim.com https://sheikhwasim.com · Notes: Wasim Sheikh on Substack practicalainotes.substack.com https://practicalainotes.substack.com/ · X: @anciwasim https://x.com/anciwasim