Import/reference support
With this feature, paths can be listed within a rules file to specify dependencies.
- These referenced files get added to context whenever the rules file is in context
- Both relative and absolute paths are supported
- Example: If
naming-conventions.mdcmentions@personality.mdc, the personality file gets included whenever the naming conventions file is - Dependencies can't be removed from context independently --
@personality.mdccan't be removed from context untilnaming-conventions.mdcis removed.
Prior art
- Claude Code's imports: https://docs.anthropic.com/en/docs/claude-code/memory#claude-md-imports
- Cursor's file references: https://docs.cursor.com/en/context/rules#rule-anatomy
- Zed's includes: https://zed.dev/docs/ai/text-threads#slash-commands-in-rules
- Amp Code's includes: https://ampcode.com/manual#AGENTS.md
Great timing! Just posted about a similar modular approach on LinkedIn.
I've been using this pattern with Claude Code for months - the import functionality is a game changer for maintaining complex contexts.
Happy to share implementation patterns and real-world usage examples.
LinkedIn post:
https://www.linkedin.com/posts/joserprieto_manage-claudes-memory-activity-7364033253990719490-944Y
Until OpenAI adds this (super important) feature to AGENTS.md and Codex CLI, you can use my Python script to flatten Markdown files that use Claude’s @foo.md file-reference syntax:
https://gist.github.com/PaulRBerg/3c78def758cec459b987f6968c8e018d
I'm a maintainer on Gemini CLI. We're exploring the option of making AGENTS.md our standard context file but we have an import feature with @ style references in GEMINI.md. I'd love to see an equivalent reference feature added to the AGENTS.md standard. This would make it much easier for us to support AGENTS.md by default. Issue in our repo that is tracking this: https://github.com/google-gemini/gemini-cli/issues/12345
There are workarounds to achieve include-like functionality with AGENTS.md:
- File references in AGENTS.md
## Core Context
You MUST read the following files:
- @./core-conventions.md
- @./domain-rules.md
- Directory-based isolation
/project
/.ai/AGENTS.md # Generic instructions
/contexts/backend/AGENTS.md # Backend-specific
/contexts/frontend/AGENTS.md # Frontend-specific
Navigate agents to specific directories; their AGENTS.md is loaded automatically.
Not perfect, but functional with most agents.
I'm primarily interested in this feature being standardized in order to support LLM-driven dynamic rewriting of files imported by the AGENTS.md. AGENTS.md files are currently hand-written, but LLMs have a tendency to collapse large volumes of text. To support maintaining both domains (strict adherence to a hand-written policy and general advice produced by an LLM), references to other files are needed, so that the LLM can freely mess up specific imported segments but not affect others.