Skip to content

feat(antigravity): write directory-scoped rules to nested .agents/rules/ - #3385

Merged
dyoshikawa merged 3 commits into
mainfrom
resolve-issue-2666-antigravity-nested-rules
Oct 11, 2026
Merged

dyoshikawa merged 3 commits into
mainfrom
resolve-issue-2666-antigravity-nested-rules

Conversation

@dyoshikawa

Copy link
Copy Markdown
Owner

Summary

Covers the "subprojectPath nesting for the Antigravity rule adapters" item of #2666.

Antigravity reads a .agents/rules/ directory in any subdirectory and loads it for files under that directory, just as it does AGENTS.md/GEMINI.md (rules docs: "You can place an AGENTS.md or GEMINI.md file—or a .agents/rules/ directory—in any subdirectory of your project").

  • Generate (project scope): a non-root rule with agentsmd.subprojectPath is written to <subprojectPath>/.agents/rules/<name>.md instead of the project-root .agents/rules/. antigravity-ide and antigravity-cli write the same file, as they already do for the root directory. The root rule and global rules are never nested.
  • Import: .agents/rules/ folders in subdirectories are read back through getNestedFilePatterns as rules carrying that agentsmd.subprojectPath and targets: ["antigravity-ide", "antigravity-cli"]. This follows the Trae precedent (feat(trae): write directory-scoped rules to nested .trae/rules/ #3258), so the next generate neither surprises other tools with new nested files nor folds the rule into their root files. Folders under hidden directories, node_modules and build outputs are skipped. rulesync gitignore already ignores **/.agents/rules/, so ownedDirPath keeps the gitignore filter from dropping them.
  • Plugin: antigravity-plugin inherits from the IDE class. It turns nesting off and keeps every rule in its own rules/ directory.
  • Shared helpers: the logic shared by both adapters lives in antigravity-rule.ts. A new co-located antigravity-rule.test.ts covers generate, import, round-trip, the scan patterns and the plugin opt-out for both targets.
  • Docs: a new "Antigravity note (rules)" in docs/reference/file-formats.md.

Like the other nested outputs, these files sit outside the root .agents/rules/, so generate --delete does not remove them.

Still open on #2666: sidecars, the plugin root rule trigger, the unsandboxed / .antigravityignore items on hold, and the undocumented "new workflows system".

Refs #2666

🤖 Generated with Claude Code

https://claude.ai/code/session_01TMP9AiZudwa2b154EMY4FS

dyoshikawa and others added 3 commits October 11, 2026 16:24
Antigravity reads a .agents/rules/ directory in any subdirectory and loads it for files under that directory. In project scope, a non-root rule with agentsmd.subprojectPath is now written by antigravity-ide and antigravity-cli to <dir>/.agents/rules/ instead of the project-root .agents/rules/, and such folders are imported back with that subprojectPath and both Antigravity targets. The antigravity-plugin target keeps every rule in its own rules/ directory.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TMP9AiZudwa2b154EMY4FS
…ren only

Nested rule files are flattened and keep their case in both the IDE and the CLI, so an imported codeStyle.md is written back to the same file instead of a kebab-case duplicate. The nested scan reads only the direct .md children of a rules directory, which is all Antigravity loads. The docs describe derived subprojectPath, the file naming, and import collisions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TMP9AiZudwa2b154EMY4FS
Regenerate src/generated/docs-content.ts after the conflict. Also drop a duplicated comment and treat a subprojectPath of "." like the project root.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TMP9AiZudwa2b154EMY4FS
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