# Copilot Instructions Precedence Model

This repository uses a layered instruction model for cases where Copilot or another AI
agent is applying guidance from multiple `copilot-instructions.md` files in the same
repository. Read those instruction files from the most general scope to the most specific
scope, and apply the most specific applicable repo instruction when two repo-local
instruction files both give guidance on the same topic.

## Repository-local precedence

1. Root instruction file: `.github/copilot-instructions.md`
2. Area instruction files closer to the code being changed, for example:
   - `specs/copilot-instructions.md`
   - `tests/copilot-instructions.md`
   - `agentic_devtools/adapters/copilot-instructions.md`
   - `agentic_devtools/cli/setup/copilot-instructions.md`
3. Even more specific nested instruction files under that area

## Conflict resolution

- Start with the root rules, then add narrower rules from the relevant subtree.
- Treat two repo-local rules as conflicting only when they both give direction on the same
  topic and those directions cannot both be followed as written.
- If two repo-local rules conflict, prefer the rule from the deeper, more specific path.
- If a narrower file is silent on a topic, there is no conflict; keep following the
  broader parent instructions.

## Outside the repository

Session-level system, developer, and user instructions still take precedence over these
repository documents.
