r/cursor • u/Few-Ad-1358 • May 31 '26
Question / Discussion Where should trust checks happen for AI coding agents?
I’ve been using and studying AI coding agents more, and the part I keep getting stuck on is not whether they can write code. They obviously can. The harder question is where trust is supposed to enter the workflow. If an agent touches files outside the task, skips tests, makes assumptions, or opens a PR that takes longer to review than writing it manually, the damage is already kind of done.
I’m trying to understand where devs would actually want a check to happen. Before coding, when the task and allowed scope are being set? During coding, when the agent starts drifting? Before PR, so messy agent work does not enter review yet? Or during PR review, where you just need a short packet showing the original task, files touched, commands run, missing evidence, and what to inspect first?
For people using Claude Code, Codex, Cursor, or custom agents in real repos: where did trust break in your last real workflow, and where would a check like this need to sit for you to actually use it instead of ignoring it as process overhead?
2
u/clauwen May 31 '26 edited May 31 '26
Tbh the only solution for this is to have clearly defined tests that need to pass that make the issues you are worried about "impossible" to happen.
You can never test everything, and you shouldn't try, but it's the only way I found to consistently stop issues that keep popping up.
The responsibility for this should be on the guy doing the implementation and I think the PR review should actually mostly discuss what's tested.
I just see no other way to do this and it's kind of how it functions in the real world.
The government usually doesn't need to understand the process or implementation of how a meal in a restaurant is made, but it will test a bunch of things that it determined to either be harmful or that it considers to be good proxies of being harmful.
It doesn't care very much how the meal tastes, how much celery is used or if it's baked or fried.
This is, in my opinion, the only way to gain control over a system that you do not actually understand in detail, or can't.
It's very similar in software, we just interact with some programming language that only works because there is a gigantic stack of hardware and software underneath.
Most devs do not actually understand how they function, why would they. But they behave consistently and reproducibly because they are tested by millions and refined over time.
In my opinion coding with AI is just a very similar progression to further increase the size of this stack.
Another good example for this would probably be something like a company or corporate hierarchy. Each higher hierarchical level has less understanding of the lower levels because it's too much information and becomes less actionable/useful. So from level to level there are benchmarks, reports, laws, governance that hold this structure together and make it so higher level people in that hierarchy are able to get actionable information from the stack under them.
And if they don't, the incentives need to be aligned through better governance etc etc.
2
u/basilzakarov May 31 '26
The check isn't one place.
If it only exists right before PR, you've already paid most of the damage.
The sane model is the same one we already use for humans: review the spec, review the plan, review the code, run CI, run security checks, then have humans and/or another agent review the PR. Agents don't change that, they just make the failure mode faster and weirder
I basically treat coding agents like a team of juniors, or devs with ADHD who just got transferred from another team and have zero project context. They can be productive as hell, but you don't give them broad write access and vibes-based acceptance criteria. You give them a tight task, a sandbox, a diff boundary, and a way to prove what they ran.
So yeah: scope check before coding, drift check during coding, hard gate before PR, evidence packet in PR. And isolation matters too - sandboxes, rootless containers, microVMs, whatever fits your infra. If the agent can casually touch unrelated files or run commands on the host with your creds, trust already broke.
None of this eliminates breakage. It just lowers the blast radius. Same as normal engineering. Stuff breaks, CI catches some, review catches some, prod catches the rest, then we fix it. 🤷🏻♂️
1
u/mm_cm_m_km May 31 '26
honestly the part that fixed most of my drift wasnt anything in the code path. it was checking the rules surface itself. half of "agent touches files outside the task" or "makes assumptions" turned out to be CLAUDE.md saying X and .cursor/rules saying Y, agent picks whichever it read last, no signal at all that the two disagreed. catching that on the way IN (before-task scope-setting, your first slot) is what stopped most of it. i ended up running a linter on PRs to the rules files so they get audited before the agent reads them (agentlint.net fwiw). the during-coding piece i havent solved, "agent is drifting right now" is the signal im still missing. does your check fire on the agent's telemetry or on the work product?
1
u/SixCupaCoffee May 31 '26
Hi l!
Where trust breaks in real workflows:
· Agent touches files outside the task (silent scope creep)
· Skips tests thinking they're "redundant"
· Opens a huge PR that takes longer to review than rewriting manually
Where the check should happen:
Before PR, but after the agent finishes working — not during coding (too intrusive), not at PR review (too late / too costly).
What the agent should produce:
A short packet showing:
· Original task
· Files touched (and files touched unexpectedly)
· Commands run
· Tests run (yes/no + results)
· Missing evidence
· Which lines to inspect first
Why devs won't ignore it:
Keep it ultra-short — no extra clicks, no paragraphs. Just colored warnings in the PR description, e.g., "⚠️ modified 1 file outside scope."
Hmmm bottom line is:
Trust shifts from verify every line to verify only deviations. The most missing feature today: agents admitting, "I made an unauthorized change." Until then, trust stays broken.
1
u/madiamo May 31 '26
hi, we built a github gateway for agents
it does not try to prove semantic correctness, and it is not a secret scanner. the focus is narrower: checking whether an agent-proposed change is allowed to become PR impact
it currently checks things like:
would be curious if this is the kind of trust check you would want in a PR flow, or if you would need it earlier during implementation
1
u/Otherwise_Economy576 Jun 01 '26
trust checks for coding agents: pre-commit on agent branches, require human review on auth/billing paths, and sandbox tool calls that touch prod.
automate 'did tests pass + diff size under N lines' before merge suggestion.
where in your workflow do agents currently have write access?
1
u/Deep_Ad1959 Jun 02 '26
tests are the trust gate, not PR review written with ai
1
u/[deleted] May 31 '26
[removed] — view removed comment
1
u/[deleted] Jun 06 '26
[removed] — view removed comment