Skip to content

AGENTS.md not loaded after /new #11532

Closed as not planned
Closed as not planned

Description

@jacekpoplawski

Description

I expect /new to clear the current conversation context and start a new session within the same project.

After running /new, OpenCode does NOT automatically load AGENTS.md. I have to explicitly ask it to read the file again.

If this is expected behavior?

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. github-actions commented on Jan 31, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  2. rekram1-node commented on Jan 31, 2026

    @rekram1-node
    Contributor

    which AGENTS.md isn't "loaded", where are u running opencode and where is the file located?

  3. jacekpoplawski commented on Jan 31, 2026

    @jacekpoplawski
    Author

    I run opencode in folder with my project, AGENTS.md is in the folder, I use local setup

  4. rekram1-node commented on Jan 31, 2026

    @rekram1-node
    Contributor

    if u have:

    project:
    |- AGENTS.md

    and you run opencode in project

    then AGENTS.md should ALWAYS be included in the system prompt sent to the model

  5. jacekpoplawski commented on Jan 31, 2026

    @jacekpoplawski
    Author

    in that case maybe it's a problem with the model (GLM 4.7 Flash on llama.cpp, but it does great in general, I use it with opencode for many days now), I observe that after /new when I talk to opencode, model skips all the instructions from AGENTS.md, I will check other models, thanks

  6. TheBlueSky commented on Feb 1, 2026

    @TheBlueSky

    I notice the same (similar?) issue. I am on the latest version of OpenCode, and opened it in the root directory of the repo where I have AGENTS.md files:

    • Started a new session on a repo that I have never used OpenCode on.
    • Selected a model; in my case it was kimi-k2.5-free.
    • Asked it to plan a change.
    • It reported that it read the relevant files, and AGENTS.md was not one of them.

    Not sure however whether the file is expected to show on the list of read files, or how to verify that is read.

  7. bakaburg1 commented on Feb 2, 2026

    @bakaburg1

    it could be useful to have a visual clue in the TUI and GUIs of what files the context is made of. Probably we should just trust that AGENTS are parsed in every time, but seeing would make us feel better, I believe. Cursor and copilot do this

  8. DrOptix commented on Feb 2, 2026

    @DrOptix

    This is something I've noticed as well. Mostly I see the file not read, but rarely I've seen it inspected. Can't figure out what makes OpenCode read it without me explicitly asking for it.

  9. rekram1-node commented on Feb 2, 2026

    @rekram1-node
    Contributor

    Okay when I say "read" i just mean it's included in context, like the global and project root ones are in the system prompt, but yeah having more transparency around the context is a good idea that we should have.

    The desktop app actually has this, just haven't done it in tui yet

  10. lindelleric commented on Feb 5, 2026

    @lindelleric

    I had this issue as well, but since updating to 1.1.49 I cannot reproduce it anymore. Now it has the AGENTS.md-file from the start.

  11. patrickveltrop-coda commented on Feb 11, 2026

    @patrickveltrop-coda

    Same issue unfortunately, switching models or even adding an instruction in opencode's config to always read the agents.md file doesnt work

  12. x8code commented on Feb 23, 2026

    @x8code

    Same problem here ....

    • AGENTS.md file is in the root of my project directory.
    • I'm launching OpenCode from the root of my project directory.
    • AGENTS.md file is not being read.

    I'm using LM Studio with its API exposed, and the model is nvidia/nemotron-3-nano.

    Every time I try to use OpenCode, and think I'm going to make progress this time, I am disappointed by a new problem .....

  13. celestial-rose commented on Apr 10, 2026

    @celestial-rose

    Same issue, is there a way to have it being read without having to put it in. .opencode folder ?

  14. tdhung80 commented on Apr 15, 2026

    @tdhung80

    The same issue occurs on OpenCode Desktop version 1.4.4. My project folder is a junction directory, and I start OpenCode from that junction. How can I check whether the new session has loaded AGENTS.md from the project root directory?

  15. superDuperCyberTechno commented on Apr 15, 2026

    @superDuperCyberTechno

    It seems that changing model (and back) fixes it in the TUI, at least temporarily.

  16. enricollen commented on Apr 19, 2026

    @enricollen

    same here:
    opencode from VS code extension and qwen 3.5 27B (opus distilled) on llama.cpp
    it completely ignores the AGENTS.md i put inside the project root folder...

  17. matthieu-vergne commented on Apr 29, 2026

    @matthieu-vergne

    Same issue here, but let's be concrete rather than speculative. My project has AGENTS.md at its root:

    user@laptop:~/project$ ls
    AGENTS.md  [...other files...]

    If I run opencode in there and run it, it does not include AGENTS.md in the context, only the default system prompt + my prompt + tools definition:

    {
        "model": "qwen/qwen3-coder-30b",
        "max_tokens": 32000,
        "temperature": 0.55,
        "top_p": 1,
        "messages": [
            {
                "role": "system",
                "content": "You are opencode, (...) rather than after mistakes.\n"
            },
            {
                "role": "user",
                "content": "Analyse the project"
            }
        ],
        "tools": [
            (functions def for question, bash, read, glob, grep, edit, write, task, webfetch, todowrite, skill)
        ],
        "tool_choice": "auto",
        "stream": true,
        "stream_options": {
            "include_usage": true
        }
    }

    If I run opencode web and prompt from there, same thing.

    For those who want to do the same, you can use mitmproxy as a proxy between opencode and the LLM. Configure opencode to send to mitmproxy and mitmproxy to send to the LLM.

  18. removed
    bugSomething isn't working
    on May 3, 2026
  19. Biogasbottle commented on May 13, 2026

    @Biogasbottle

    Same issue.

    This is my first time using openCode, the latest version. I used the opencode command in the repo root directory and started a dialog, but it apparently wasn't reading AGENTS.md.

  20. kikoreis commented on May 14, 2026

    @kikoreis

    For random travelers, this bug is about AGENTS.md in working trees; the global rules file in ~/.config/opencode/AGENTS.md is correctly read (as of 1.14.48 in my testing at least) by /new. However, watch out if you use https://github.com/dotCipher/opencode-claude-bridge as it currently clobbers the global rules.

  21. lemonvlt commented on May 26, 2026

    @lemonvlt

    Still an issue. instructions in the config dont work, global and project AGENTS.md get ignored, but opencode will read the README.md file instead and thats it?

    Happening with any Ollama Cloud model.

  22. mrkprdo commented on May 31, 2026

    @mrkprdo

    It seems to be an issue, i have to steer and let agent parse AGENTS.md for every new session

  23. rekram1-node commented on May 31, 2026

    @rekram1-node
    Contributor

    I think there is a misunderstanding here, AGENTS.md is always included in context, there must be a misconfiguration on ur end or ur using small local models that arent abiding by ur rules.

    If you can run opencode through mitm and show me that the AGENTS.md are actually being dropped instead of trying to verify by asking llm / seeing what llm does then I can reopen, but rn I cannot reproduce this at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions