Skip to content

Support AGENTS.override.md as a per-directory context override #7642

Description

@Marvae

What do you want to change?

Make Pi recognize AGENTS.override.md when discovering context files.

When both files exist in the same directory, Pi can load AGENTS.override.md for that directory instead of AGENTS.md. Context files from other directories continue to layer normally.

Why?

I work in repositories where I cannot change the checked-in AGENTS.md but need a local replacement. Codex supports this with an uncommitted AGENTS.override.md, and it would be useful to use the same file in Pi.

An extension can approximate this by rewriting the assembled system prompt, but Pi would still treat the original AGENTS.md as the selected context file. This seems more naturally handled during context discovery.

How? (optional)

Check for AGENTS.override.md before the existing candidates:

const candidates = [
	"AGENTS.override.md",
	"AGENTS.md",
	"AGENTS.MD",
	"CLAUDE.md",
	"CLAUDE.MD",
];

For example, when running Pi from repo/service:

repo/
├── AGENTS.md                 loaded
└── service/
    ├── AGENTS.md             skipped
    └── AGENTS.override.md    loaded

result: repo/AGENTS.md + repo/service/AGENTS.override.md

The existing ordering and one-file-per-directory behavior remain unchanged.

Metadata

Metadata

Assignees

No one assigned

    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