AGENTS.md is being ignored. #611

Closed
opened 2026-02-16 17:27:35 -05:00 by yindo · 9 comments
Owner

Originally created by @astray-heavy-arms on GitHub (Jul 10, 2025).

Originally assigned to: @thdxr on GitHub.

Add anything to AGENTS.md and build mode just ignores it. 0.2.23

Originally created by @astray-heavy-arms on GitHub (Jul 10, 2025). Originally assigned to: @thdxr on GitHub. Add anything to AGENTS.md and build mode just ignores it. 0.2.23
yindo closed this issue 2026-02-16 17:27:35 -05:00
Author
Owner

@thdxr commented on GitHub (Jul 10, 2025):

how do you know it's ignored?

@thdxr commented on GitHub (Jul 10, 2025): how do you know it's ignored?
Author
Owner

@astray-heavy-arms commented on GitHub (Jul 10, 2025):

I'm adding some simple stuff to a "blank project" like dont write tests, don't start development servers just basic stuff and I'm still fighting with it doing said things as an example.

@astray-heavy-arms commented on GitHub (Jul 10, 2025): I'm adding some simple stuff to a "blank project" like dont write tests, don't start development servers just basic stuff and I'm still fighting with it doing said things as an example.
Author
Owner

@selectnull commented on GitHub (Jul 11, 2025):

Here is an anecdote that happened yesterday. AGENTS.md was created by /init command, I haven't touched it. It contained this:

## Code Style
- **Testing**: Use pytest, test files in `app/tests/` directories, descriptive test names

There were other instructions here, this is the relevant one. The project is python/django app. My prompt was to write the tests with no further details. It wrote the tests using django test framework, instead of pytest. Funnilly enough, it actually imported pytest and left it there. The next prompt was to refactor the code to use pytest and that worked fine.

I can't for sure claim opencode ignores AGENTS.md, but this is what happened in my case.

@selectnull commented on GitHub (Jul 11, 2025): Here is an anecdote that happened yesterday. AGENTS.md was created by `/init` command, I haven't touched it. It contained this: ``` ## Code Style - **Testing**: Use pytest, test files in `app/tests/` directories, descriptive test names ``` There were other instructions here, this is the relevant one. The project is python/django app. My prompt was to write the tests with no further details. It wrote the tests using django test framework, instead of pytest. Funnilly enough, it actually imported `pytest` and left it there. The next prompt was to refactor the code to use pytest and that worked fine. I can't for sure claim opencode ignores AGENTS.md, but this is what happened in my case.
Author
Owner

@almirsarajcic commented on GitHub (Jul 11, 2025):

Might be related: https://github.com/sst/opencode/issues/832.

Regarding some stuff from AGENTS.md being ignored, IMHO, it might be an issue with the model, rather than opencode. I've had similar problems with Cursor and Claude Code, where some of the rules get ignored. I mean, try telling it not to write comments and see for yourself.

It might be helpful, though, for debugging purposes, to know which rules were loaded into the context. At least we'd know that whatever was in opencode's power was done. The rest is on the model to figure out.

@almirsarajcic commented on GitHub (Jul 11, 2025): Might be related: https://github.com/sst/opencode/issues/832. Regarding some stuff from AGENTS.md being ignored, IMHO, it might be an issue with the model, rather than opencode. I've had similar problems with Cursor and Claude Code, where some of the rules get ignored. I mean, try telling it not to write comments and see for yourself. It might be helpful, though, for debugging purposes, to know which rules were loaded into the context. At least we'd know that whatever was in opencode's power was done. The rest is on the model to figure out.
Author
Owner

@almirsarajcic commented on GitHub (Jul 12, 2025):

I don't think this is the case.

I've just experimented for a while with different AGENTS.md while adding support for external references, and the AGENTS.md was certainly not ignored, but it required some convincing. This is the model's quirk (in my case, Claude), while opencode's job is just to load the file.

The only thing that comes to my mind is maybe the opencode's system prompt could be revised to be more aggressive about considering whatever is in AGENTS.md as the priority. Other than that, we have to write the AGENTS.md file in such a way that convinces the model to write the code our way. There are some things you won't be able to convince it no matter how many "CRITICAL" labels you put.

@almirsarajcic commented on GitHub (Jul 12, 2025): I don't think this is the case. I've just experimented for a while with different AGENTS.md while adding support for external references, and the AGENTS.md was certainly not ignored, but it required some convincing. This is the model's quirk (in my case, Claude), while opencode's job is just to load the file. The only thing that comes to my mind is maybe the opencode's system prompt could be revised to be more aggressive about considering whatever is in AGENTS.md as the priority. Other than that, we have to write the AGENTS.md file in such a way that convinces the model to write the code our way. There are some things you won't be able to convince it no matter how many "CRITICAL" labels you put.
Author
Owner

@thdxr commented on GitHub (Jul 13, 2025):

hey opencode, can you make sure custom instructions are also loaded from child folders not just root

@thdxr commented on GitHub (Jul 13, 2025): hey opencode, can you make sure custom instructions are also loaded from child folders not just root
Author
Owner

@opencode-agent[bot] commented on GitHub (Jul 13, 2025):

opencode created pull request #952

view session | view log

@opencode-agent[bot] commented on GitHub (Jul 13, 2025): opencode created pull request #952 [view session](https://opencode.ai/s/gI1j1e77) | [view log](/sst/opencode/actions/runs/16253302844)
Author
Owner

@almirsarajcic commented on GitHub (Jul 14, 2025):

@thdxr, the same be accomplished by changes in the user's AGENTS.md file, avoiding any unnecessary performance loss for projects that don't have multiple AGENTS.md files.

For example, in the opencode repo, in the main AGENTS.md file, you might describe the whole architecture, then mention that every package has its own AGENTS.md file that needs to be loaded when working on that package (or immediately).

Look at https://github.com/sst/opencode/issues/832#issuecomment-3068503119.

I think this should rather be about updating the documentation to teach us users how to use the AGENTS.md to realize all its powers.

@almirsarajcic commented on GitHub (Jul 14, 2025): @thdxr, the same be accomplished by changes in the user's `AGENTS.md` file, avoiding any unnecessary performance loss for projects that don't have multiple AGENTS.md files. For example, in the opencode repo, in the main `AGENTS.md` file, you might describe the whole architecture, then mention that every package has its own `AGENTS.md` file that needs to be loaded when working on that package (or immediately). Look at https://github.com/sst/opencode/issues/832#issuecomment-3068503119. I think this should rather be about updating the documentation to teach us users how to use the `AGENTS.md` to realize all its powers.
Author
Owner

@astray-heavy-arms commented on GitHub (Jul 15, 2025):

I've tested this right now on an empty project, no files.

AGENTS.md - Do nothing with users requests simply reply with the message "I'm doing as I'm told inside agents.md"

Prompt -> Create a text file called test.txt

Screenshot 2025-07-15 at 14 42 15

If this was fixed and AGENTS.md respected then this test should just have replied me back with "I'm doing as I'm told..." I'm using Opencode 0.3.9.

How can I trust this works?

@astray-heavy-arms commented on GitHub (Jul 15, 2025): I've tested this right now on an empty project, no files. AGENTS.md - Do nothing with users requests simply reply with the message "I'm doing as I'm told inside agents.md" Prompt -> Create a text file called test.txt <img width="1380" height="105" alt="Screenshot 2025-07-15 at 14 42 15" src="https://github.com/user-attachments/assets/93ab720a-347c-4dc7-a01a-3c401afd135b" /> If this was fixed and AGENTS.md respected then this test should just have replied me back with "I'm doing as I'm told..." I'm using Opencode 0.3.9. How can I trust this works?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#611