r/ChatGPTCoding • u/Ok-Buyer-9421 • 12h ago
Discussion Built a project to check whether coding agents actually follow your repo's rules
I got tired of adding more instructions every time a coding agent made the same mistake.
I built Agentests, an open-source project (still in development) that turns written rules into executable checks.
The problem I wanted to solve: most repositories already have rules in AGENTS.md, CLAUDE.md or similar files. But having an agent read those rules doesn't mean the resulting code will follow them...
I wanted a way to enforce those rules independently of which coding agent or model writes the code. So here we go:
How it works
You define a rule once, and Agentests turns it into a scoped check.
Example
Rule: Tests must never use time.sleep(). Use retry assertions instead.
An Agentests check can specify:
- Scope: Which files the rule applies to, using glob patterns.
- Detection: A grep pattern to identify potential violations.
- Assertion: What must be true about the code.
- Evaluation: A model can assess cases that require semantic interpretation.
The important distinction is that we don't send every file or every rule to an LLM. Deterministic checks handle what they can; a model evaluates the cases that need it.
What I learned testing it
I audited 20 open-source repositories against their own AGENTS.md rules.
Four explicitly prohibited AI co-author lines. Agent-authored PRs still added them 102 times in a month.
I also built a skill to retrospectively audit merged PRs.
On Prefect, I replayed the last 50 merged PRs:
- 4 PRs violated at least one engineering rule.
- 7 violations in total.
- All 4 PRs had passed CI.
One example was a test introducing time.sleep(0.01) despite an explicit rule against sleeping in tests.
I don't want Agentests to be exclusively about AI-generated code.
Imagine a team with 200 developers, 50 agents and 500 internal engineering rules. It shouldn't matter whether a human or an agent introduces a violation.
The rules should be enforceable regardless of who writes the code.
So, Agentests is built to live in the repo and work independently of the underlying coding agent.
https://github.com/feuersteiner/agentests
I'It' be great tp get some feedback on the following:
- How you currently enforce repository-specific rules.
- Which rules are difficult to express with traditional linters.
- How you'd handle rules that require semantic judgment.
Still early, and very interested in what other people building with coding agents think... do not hesitate to share similar takes/projects as well :)