Skip to content
RasaGet a free license
Menu
Guides for AI teams

Guide

Are your coding agent’s paths and import rules current?

Find stale paths and import rules the code already breaks before a coding agent relies on your repository instructions.

by Rod Rivera

About 4 minutes to readAI product engineer

Key takeaways (3)
  • Verify path claims against the current file tree when you move code.
  • Check the existing imports before you describe a dependency rule as enforced.
  • Record migration targets and current exceptions where the agent can find them.

Your repository tells a coding agent where to find a module and which modules may import it. A folder move can break the first instruction. The second can be wrong the day you write it. Before you hand those instructions to an agent, check what the current code supports.

Ghimire and Damian studied claims in 3,602 context files across 3,346 open-source projects. They compared files such as AGENTS.md and CLAUDE.md with the code and its history. Their results give you a reason to check paths and import rules at different points in a change. Preprint, sections 3 and 4.

Check each claim against the branch

What the file saysWhat the paper foundWhat to inspect
A file or directory exists at a stated path.After manually sampling automated flags, the authors estimated that 2.2% of all path claims were wrong.Check the path when a change moves or deletes files.
One part of the application may only import certain modules.The authors confirmed violations in 33 of 184 rules at the commit that introduced the rule.Review the imports already in the branch before you add the instruction.

When to check each rule

The history matters. The authors found that 706 of 1,151 stale path claims were removed or corrected, most of those fixes in the same commit as the code change. For 26 of the 33 confirmed import violations, every offending import was already present before the first context file. A move checklist can catch the first problem. The second needs an initial review of existing code. Preprint, sections 4.2 and 4.3.

Where to look when an instruction and the code disagree
FigureWhere to look when an instruction and the code disagree

A rule that arrived after the code

We checked a SQLFluff rule against directly importing dialect modules that appears in the authors’ replication data. We checked the rule’s introduction commit and parent, f6742cbe. The commit adds agent instructions and changes no Python source. In both revisions we found the same eleven lines in production Python that directly import from the ANSI dialect module. We searched Python files under src/ for direct from imports of dialect modules, excluding keyword tables. Our search did not cover dynamic imports or build dependencies. Replication data and SQLFluff commit and its diff.

One of the eleven imports is in the aliasing rule that uses the ANSI alias operator segment. Its original location helps explain why a clean pull-request diff can miss a contradiction. The import exists in code outside the changed files. To check a new boundary, inspect the full source that the rule applies to. Pinned aliasing rule. Recorded output from both revisions.

Separate enforced rules from migration goals

Take one rule in your file and look for a counterexample in the branch you expect the agent to edit. A rule that the UI never imports the database, for example, needs a check of what the UI imports today. If older imports remain, write down where they are and what should happen to new imports. Turn a boundary you intend to enforce into a build check. Ask the reviewer of the next folder move to update any reference pointing at the old path.

Make the next review repeatable

Show a review note for an existing exception

Record the instruction, the source path that contradicts it, and the person who can remove the exception. Ask that reviewer to distinguish an existing import from a newly added one. Recheck the exception when its source file moves or its owner removes it.

Use the result as a review checklist for repository instructions. The study looked at public repository history and static imports. It did not test how agents respond to conflicts between the file and the code, or run the checklist above.