The Manual Instructions in AGENTS.md seems to only work for relative referecnes in the current project #1036

Open
opened 2026-02-16 17:29:09 -05:00 by yindo · 5 comments
Owner

Originally created by @nerdo on GitHub (Jul 31, 2025).

Originally assigned to: @thdxr on GitHub.

I've been experimenting with a set of rules primarily for use with Claude Code that I also want to try out with opencode.

I've relied on @file/references/like/this.md in Claude Code and it's worked pretty well, so when I saw the documentation on rules that alluded to similar functionality in opencode (https://opencode.ai/docs/rules/#manual-instructions-in-agentsmd), I was hoping I could use the same set of files as-is but that doesn't seem to be the case.

To clarify, I have my AGENTS.md and file references in ~/.config/opencode/AGENTS.md. Similar to my Claude Code setup, I have subfolders like standards/data.md referenced within AGENTS.md as @standards/data.md, but what I found is that when I ran prompts, it would try to read standards/data.md relative to the project directory I was in, not relative to the file that it was referenced from.

Perhaps this is by design, but the documentation on it is unclear. At a minimum, clarifying the documentation would be good to avoid confusion, but I would love for it to behave similar to Claude Code to make sharing system prompts with opencode trivial.

Originally created by @nerdo on GitHub (Jul 31, 2025). Originally assigned to: @thdxr on GitHub. I've been experimenting with a set of rules primarily for use with Claude Code that I also want to try out with opencode. I've relied on @file/references/like/this.md in Claude Code and it's worked pretty well, so when I saw the documentation on rules that alluded to similar functionality in opencode (https://opencode.ai/docs/rules/#manual-instructions-in-agentsmd), I was hoping I could use the same set of files as-is but that doesn't seem to be the case. To clarify, I have my AGENTS.md and file references in `~/.config/opencode/AGENTS.md`. Similar to my Claude Code setup, I have subfolders like `standards/data.md` referenced within AGENTS.md as `@standards/data.md`, but what I found is that when I ran prompts, it would try to read `standards/data.md` relative to the project directory I was in, not relative to the file that it was referenced from. Perhaps this is by design, but the documentation on it is unclear. At a minimum, clarifying the documentation would be good to avoid confusion, but I would love for it to behave similar to Claude Code to make sharing system prompts with opencode trivial.
Author
Owner

@JouckJack commented on GitHub (Jul 31, 2025):

log.txt

@JouckJack commented on GitHub (Jul 31, 2025): [log.txt](https://github.com/user-attachments/files/21541112/log.txt)
Author
Owner

@nerdo commented on GitHub (Jul 31, 2025):

I've also been trying to use the instructions property in ~/.config/opencode.json and it seems like that isn't working either. I've tried with both relative and absolute paths and I haven't been able to verify that it's loading.

I've tried a cursory check of the context usage, but I've also asked the AI if a specific copy & pasted text showed up in my system prompt and it responded with no.

So maybe neither of these methods properly work from ~/.config?

@nerdo commented on GitHub (Jul 31, 2025): I've also been trying to use the instructions property in ~/.config/opencode.json and it seems like that isn't working either. I've tried with both relative and absolute paths and I haven't been able to verify that it's loading. I've tried a cursory check of the context usage, but I've also asked the AI if a specific copy & pasted text showed up in my system prompt and it responded with no. So maybe neither of these methods properly work from ~/.config?
Author
Owner

@nerdo commented on GitHub (Aug 1, 2025):

More context. I found some documentation about using {file:...} in the opencode.json file (https://opencode.ai/docs/config/#files). It DID seem to expand the file contents - I verified it by looking at the logs and found where the processed config gets output. I can see my file contents there, but it did not seem to have any effect on the system prompt or size of the context window, so it seems like there's either out of date documentation on how this all works or something is broken.

@nerdo commented on GitHub (Aug 1, 2025): More context. I found some documentation about using {file:...} in the opencode.json file (https://opencode.ai/docs/config/#files). It DID seem to expand the file contents - I verified it by looking at the logs and found where the processed config gets output. I can see my file contents there, but it did not seem to have any effect on the system prompt or size of the context window, so it seems like there's either out of date documentation on how this all works or something is broken.
Author
Owner

@rekram1-node commented on GitHub (Aug 1, 2025):

regarding your last comment, that is a separate issue: #1240 (just for context)

@rekram1-node commented on GitHub (Aug 1, 2025): regarding your last comment, that is a separate issue: #1240 (just for context)
Author
Owner

@taqtiqa-mark commented on GitHub (Oct 14, 2025):

what I found is that when I ran prompts, it would try to read standards/data.md relative to the project directory I was in, not relative to the file that it was referenced from.

The overloading of @ and the merit of ahereing strictly to legacy apps like Claude Code is debated: #2965
Specifically, a claude_compat option has been suggested as a way to configure OC so that it resembles Claude behavior.

@nerdo, not sure if that issue addresses your itch enough the consider closing this and joining the discussion there?

@taqtiqa-mark commented on GitHub (Oct 14, 2025): > what I found is that when I ran prompts, it would try to read `standards/data.md` relative to the project directory I was in, not relative to the file that it was referenced from. The overloading of `@` and the merit of ahereing strictly to legacy apps like Claude Code is debated: #2965 Specifically, a `claude_compat` option has been suggested as a way to configure OC so that it resembles Claude behavior. @nerdo, not sure if that issue addresses your itch enough the consider closing this and joining the discussion there?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1036