Skip to content

feat(contract): add R011 for tracked files under agent dirs - #29

Merged
loonghao merged 1 commit into
mainfrom
chore/tracked-agent-dir-rule
Oct 6, 2026
Merged

loonghao merged 1 commit into
mainfrom
chore/tracked-agent-dir-rule

Conversation

@loonghao

@loonghao loonghao commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Problem

R008 warns that an agent/IDE directory is committed. That turned out not to be enough: a whole SKILL.md tree committed under .kimi/skills/ in dcc-mcp-freecad produced a single directory-level warning, which is easy to scroll past, and the tree survived review and CI while every later agent run kept loading the previous version.

Change

New rule R011 no-tracked-agent-dirs — reports each tracked file under any agents_ide_dir at error severity, naming the file and the remediation:

.kimi/skills/code-review/SKILL.md is tracked under the agent/IDE directory
`.kimi/`; add `/.kimi/` to .gitignore and untrack it, or move the asset to a
committed path outside the agent directories

Listing the files rather than the directory also makes the migration reviewable: every path in the output is a decision about where that content should live. Output is capped at 20 files per directory with a ... and N more summary.

  • scripts/check_repo_contract.py — check_no_tracked_agent_dirs, registered in RULES. The check asks git ls-files which files are version-controlled, so output sitting inside an already-ignored agent directory is not reported; outside a git working tree it falls back to listing the directory.
  • contract/repo_contract.json — the rule entry.
  • docs/repo-contract.md — rules table row and a ### R011: catching a committed copy section.
  • tests/test_repo_contract.py — 8 tests: tracked file fails, whole tree reported, empty dir not reported, R008/R011 handover, files outside agent dirs untouched, output capped, baseline stays green, --rules R011 promotes it.
  • .gitignore — adds the organization-wide agent/IDE block to this repository, anchored at the root.

R008 handover. When R011 reports files under a directory, R008 no longer also warns about the directory, so a committed tree produces one set of findings instead of two overlapping ones. R008 still warns on an empty committed agent directory, where R011 has nothing to report.

Scoping

R011 is error severity but limited to the strict profile, the same ratchet R006–R010 use. Three repositories currently have tracked files under an agent directory (dcc-mcp-houdini, dcc-mcp-zbrush, dcc-mcp-core); landing it in baseline would turn their contract CI red on the next run while those migrations are still open. Adopt it early per repository with --rules R011 (or rules: R011 on the reusable workflow). It moves to baseline once those are clean.

Verification

  • python -m unittest discover -s tests — 264 tests, OK (256 before, 8 added)
  • python scripts/check_repo_contract.py --root . --profile strict — 0 errors, 2 warnings, exit 0. Both warnings (profile, requirements-profile-check.txt) are pre-existing R006 findings, unchanged.
  • Run against a real checkout of dcc-mcp-freecad at main: R011 reports all 12 tracked .kimi/skills/** files, and correctly does not report that repository's untracked .claude/ and /.monica/.

Notes

Stacked on #28 (agents_ide_dirs 15 → 23), which this rule needs in order to cover .kimi, .codex, .gemini, .aider, .continue, /.monica/, /.multica/ and .agent_context. Merge #28 first; this PR's diff then reduces to R011 plus this repository's .gitignore.

No rule is removed or renumbered. contract/**, docs/** and scripts/** are outside the paths filter of this repository's PR workflows, so the first automated run is the nightly.

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 19 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7371e24f-11c7-42a5-953b-5a61648ec488
📥 Commits

Reviewing files that changed from the base of the PR and between 1a9ec1b and e2225a5.

📒 Files selected for processing (5)
  • .gitignore
  • contract/repo_contract.json
  • docs/repo-contract.md
  • scripts/check_repo_contract.py
  • tests/test_repo_contract.py
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

R008 warns that an agent/IDE directory is committed. That turned out not
to be enough: a whole skill tree committed under .kimi/skills/ produced a
single directory-level warning, which was easy to scroll past, and the tree
survived review and CI.

R011 reports each tracked file under an agents_ide_dir at error severity,
naming the file and the remediation. Listing the files also makes the
migration reviewable -- every path in the output is a decision about where
that content should live.

The check asks `git ls-files` which files are version-controlled, so output
inside an already-ignored agent directory is not reported; outside a git
working tree it falls back to listing the directory.

R008 stands down on a directory once R011 has reported files under it, so a
committed tree produces one set of findings instead of two overlapping ones.

R011 is scoped to the `strict` profile while the handful of repositories
with a pre-existing committed agent tree are cleaned up, matching the
ratchet the other rollout rules use. Adopt it early with `--rules R011`.

Also adds the organization-wide .gitignore block for local agent/IDE
directories to this repository, anchored at the root.
@loonghao
loonghao force-pushed the chore/tracked-agent-dir-rule branch from e2fa088 to e2225a5 Compare October 6, 2026 17:50
@loonghao
loonghao merged commit e11cda1 into main Oct 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant