[PR #12096] feat(opencode): load .opencode/AGENTS.md instructions #14066

Open
opened 2026-02-16 18:18:53 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/12096

State: open
Merged: No


What does this PR do?

Closes #11454

Adds support for loading project rules from .opencode/AGENTS.md in addition to the existing local rule-file resolution.

  • Local rule discovery still traverses upward to find the first matching rule file among AGENTS.md, CLAUDE.md, and (deprecated) CONTEXT.md.
  • Any .opencode/AGENTS.md files found via upward traversal are loaded in addition to the local rule file above.
  • Documentation is updated to reflect .opencode/AGENTS.md and the local precedence behavior.

Why?

Allows projects to keep OpenCode-specific instructions in a dedicated .opencode/ folder without replacing existing AGENTS.md/CLAUDE.md usage.

How did you verify your code works?

  • Added tests for loading both AGENTS.md + .opencode/AGENTS.md, and for loading only .opencode/AGENTS.md when AGENTS.md is absent.
  • Ran: bun test test/session/instruction.test.ts (from packages/opencode)
  • Ran the project locally to verify

Notes

  • Only affects project-local rule loading; global rule precedence is unchanged.
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/12096 **State:** open **Merged:** No --- ### What does this PR do? Closes #11454 Adds support for loading project rules from `.opencode/AGENTS.md` in addition to the existing local rule-file resolution. - Local rule discovery still traverses upward to find the first matching rule file among `AGENTS.md`, `CLAUDE.md`, and (deprecated) `CONTEXT.md`. - Any `.opencode/AGENTS.md` files found via upward traversal are loaded _in addition_ to the local rule file above. - Documentation is updated to reflect `.opencode/AGENTS.md` and the local precedence behavior. ### Why? Allows projects to keep OpenCode-specific instructions in a dedicated `.opencode/` folder without replacing existing `AGENTS.md`/`CLAUDE.md` usage. ### How did you verify your code works? - Added tests for loading both `AGENTS.md` + `.opencode/AGENTS.md`, and for loading only `.opencode/AGENTS.md` when `AGENTS.md` is absent. - Ran: `bun test test/session/instruction.test.ts` (from `packages/opencode`) - Ran the project locally to verify ### Notes - Only affects project-local rule loading; global rule precedence is unchanged.
yindo added the pull-request label 2026-02-16 18:18:53 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14066