Skip to content

feat: support .local.md variants for instruction files#16108

Open
clansty wants to merge 1 commit intoanomalyco:devfrom
clansty:feat/local-instruction-files
Open

feat: support .local.md variants for instruction files#16108
clansty wants to merge 1 commit intoanomalyco:devfrom
clansty:feat/local-instruction-files

Conversation

@clansty
Copy link

@clansty clansty commented Mar 5, 2026

Issue for this PR

Closes #16110

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds .local.md variant support for instruction files. Users can create AGENTS.local.md (or CLAUDE.local.md) alongside the base file — the local variant is loaded additively and can be gitignored for personal, machine-specific instructions.

The change is in instruction.ts only:

  • systemPaths(): after finding a base file via findUp, also searches for its .local.md variant. Either file alone is enough to select the file family (AGENTS > CLAUDE > CONTEXT priority preserved).
  • globalFiles(): restructured from flat list to location-based groups so both base and local files at the same location are loaded.
  • find() / resolve(): find() now returns string[] to include both variants; resolve() iterates over the array.

This mirrors the CLAUDE.local.md pattern from Claude Code.

How did you verify your code works?

  • Added 4 new test cases covering: both files loaded together, local-only loading, subdirectory injection with both files, subdirectory injection with local-only.
  • All 10 tests pass (6 existing + 4 new), zero regressions.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Add support for AGENTS.local.md, CLAUDE.local.md, etc. alongside
their base counterparts. This allows users to keep personal,
machine-specific instructions in .local.md files that can be
gitignored, while shared instructions remain in the base files.

- .local.md files are loaded additively alongside base files
- Having either base or .local variant selects that file family
- Works for project-level (findUp), global, and subdirectory injection
- Follows same priority rules (AGENTS > CLAUDE > CONTEXT)
@github-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Mar 5, 2026
@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Mar 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Support .local.md variants for instruction files (AGENTS.local.md, CLAUDE.local.md)

1 participant