Feature: context file dispatch — trigger-based file loading from CLAUDE.md

Resolved 💬 2 comments Opened Mar 6, 2026 by CoonCat21 Closed Apr 3, 2026

Problem

Claude Code's auto-memory (MEMORY.md) has a 200-line cap, and only MEMORY.md and CLAUDE.md are auto-loaded into context. Other memory files persist on disk but are invisible unless Claude happens to read them.

Users accumulate project knowledge that doesn't belong in CLAUDE.md (private, session-specific context like branch hierarchies, deployment procedures, debugging notes). This knowledge needs to be discoverable and loaded when relevant, not always.

Currently the workaround is adding a manual index to MEMORY.md:

## Context Files (read these when relevant)
- `branch-chain.md` — Read when: PRs merge, branches deleted, branch status questions
- `deploy-notes.md` — Read when: deployment, release, infrastructure changes

This works but is fragile — it relies on Claude recognizing the trigger situation and choosing to read the file. There's no enforcement.

Proposal

Add a context_files mechanism (in CLAUDE.md, .claude/settings.json, or a new config) that maps trigger patterns to files:

context_files:
  - trigger: "PR merge|branch cleanup|branch status"
    file: ".claude/context/branch-chain.md"
  - trigger: "deploy|release|infrastructure"
    file: ".claude/context/deploy-notes.md"

When a user message matches a trigger pattern, the referenced file is automatically loaded into context before Claude responds — similar to how hooks trigger on events, but for context injection rather than shell commands.

Benefits

  • Reliable: No reliance on Claude choosing to read files
  • Scalable: Project knowledge grows in separate files without bloating MEMORY.md
  • Portable: If placed in CLAUDE.md or .claude/, it travels with the repo
  • Shareable: Team members can benefit from shared context files (vs. private auto-memory)

Alternatives Considered

  • Bigger MEMORY.md cap: Doesn't solve the relevance problem — most context isn't needed most of the time
  • Always-load all memory files: Wastes context window on irrelevant information
  • Manual index in MEMORY.md: Current workaround, fragile and non-portable

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗