You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Automatically load @ referenced files in AGENTS.md into context #2225
First of all, thank you for this great project. I really enjoy using it, and it is amazing how fast you improve it!
Claude Code has the very nice feature that you can reference other files using @ in your CLAUDE.md, and it is automatically loaded into the session. This is very helpful to split rules into multiple files or to directly load core files (like the package.json) in every session. With this feature, a minimal instruction file can then look like this:
# Instructions- Avoid excessive comments.
- Prefer a functional approach over classes.
- Create reusable functions to keep the code clean and readable.
## Relevant Files- @./README.md
- @./package.json
- @./tsconfig.json
- @./docs/bun.md
Unfortunately, OpenCode currently doesn't have the same behaviour with AGENTS.md.
@mannp AGENTS.md is automatically loaded. Where is the file located?, where are you running opencode?
Hi @rekram1-node it is the root of my project folder where I run opencode. These are the first lines of the file;
---
trigger: always_on
---
# 🤖 Agents Configuration - NixOS Configuration Project
## Overview
This document outlines the AI agents used in this comprehensive NixOS
configuration flake with custom packages, modules, and development tools. All
agents must adhere to the development rules and guidelines specified below.
## 📚 Reference Documentation
- **[README Generator Guide](./docs/guides/readme-generator.md)** - Professional
README.md generation using Best-README-Template structure
.......
I have been using Grok Code Fast 1 model.
opencode -v
0.10.4
Edited: removed comments on original op request as they seemed to be confusing to others.
Hi team! I wanted to share some observations about how AGENTS.md and instruction files are being loaded that might help inform this feature request.
I've noticed that while both project and global AGENTS.md files are definitely being read (I can see evidence of their content influencing responses), there seems to be inconsistent behavior with files specified in the instructions property of opencode.json.
My understanding is that these files are likely provided to the model in some kind of initial brief, but whether the model actually chooses to read their content appears to be left up to its discretion. This creates some uncertainty about what context is actually available.
I've been experimenting with progressive disclosure - I don't want everything eager-loaded, but I do need a guaranteed minimum amount of context for consistent operations. I've spent several hours trying to tweak configurations to get reliable loading, and while I can always coax the model into reading the intended files, I don't understand why this coaxing is necessary.
What I'm hoping for is a way to force-feed certain essential rules files into the start of every new session, ensuring a baseline level of context is always available. The @ referencing approach directly in AGENTS.md files could work beautifully for this.
Thank you for all your hard work on this project - it's improving at an amazing clip!
loading reference files with @ syntax is much needed, the only thing I see is that the IDE does not recognize these as paths and may not refactor correctly if the file is moved. If we can use .md links with spectial prefix like [@filename](./path/to/file)] that would be much better for bigger projects IMO
Activity
rekram1-node commentedon Aug 24, 2025
I tend to agree, especially to be consistent
mannp commentedon Sep 21, 2025
I agree, thanks to the devs 👍🏻
I am struggling to get AGENTS.md loaded into content for the project at all, never mind the referenced files.
Is just autoloading AGENTS.md already supported?
rekram1-node commentedon Sep 21, 2025
@mannp AGENTS.md is automatically loaded. Where is the file located?, where are you running opencode?
mannp commentedon Sep 21, 2025
Hi @rekram1-node it is the root of my project folder where I run opencode. These are the first lines of the file;
I have been using Grok Code Fast 1 model.rekram1-node commentedon Sep 21, 2025
Not really sure what this means
Not really following here either...
Are you asking about AGENTS.md? Or slash commands?
mannp commentedon Sep 21, 2025
I am asking for the ops request and merely commented that my AGENTS.md isn't loaded on startup.
mlanza commentedon Dec 1, 2025
Hi team! I wanted to share some observations about how AGENTS.md and instruction files are being loaded that might help inform this feature request.
I've noticed that while both project and global AGENTS.md files are definitely being read (I can see evidence of their content influencing responses), there seems to be inconsistent behavior with files specified in the instructions property of opencode.json.
My understanding is that these files are likely provided to the model in some kind of initial brief, but whether the model actually chooses to read their content appears to be left up to its discretion. This creates some uncertainty about what context is actually available.
I've been experimenting with progressive disclosure - I don't want everything eager-loaded, but I do need a guaranteed minimum amount of context for consistent operations. I've spent several hours trying to tweak configurations to get reliable loading, and while I can always coax the model into reading the intended files, I don't understand why this coaxing is necessary.
What I'm hoping for is a way to force-feed certain essential rules files into the start of every new session, ensuring a baseline level of context is always available. The @ referencing approach directly in AGENTS.md files could work beautifully for this.
Thank you for all your hard work on this project - it's improving at an amazing clip!
phall1 commentedon Jan 10, 2026
What would be great is if there was a slash command that just showed you what instruction filed were loaded
gavar commentedon Jan 20, 2026
loading reference files with
@syntax is much needed, the only thing I see is that the IDE does not recognize these as paths and may not refactor correctly if the file is moved. If we can use .md links with spectial prefix like[@filename](./path/to/file)]that would be much better for bigger projects IMOduckytan commentedon Feb 13, 2026
补充一个实际使用场景:子项目规则继承
我有这样一个需求:
场景:
my-workspace(包含完整的 AGENTS.md 规则)my-workspace/projects/learning-agent(学习项目的专属规则)当前问题:
在子项目创建 CLAUDE.md 时,只能手动复制父项目的规则。如果父项目规则更新,子项目无法自动同步,导致规则不一致。
期望的解决方案:
在子项目的 CLAUDE.md 中能够引用父项目的规则文件,例如:
这样父项目规则更新时,子项目自动生效,无需手动同步。
这个需求与 Issue #6316(目录自动发现)也高度相关,希望能够优先实现层级规则继承机制。
github-actions commentedon Apr 15, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.