[FEATURE] Session-pinned memory: persist specific memory file contents through context compaction
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
In long sessions, critical procedures documented in memory files are forgotten after context compaction. The memory system writes files to disk and indexes them in MEMORY.md, but after compaction only the index titles survive — the agent sees the title but does not re-read the
file before acting, repeating documented mistakes.
Real-world impact: a 12+ hour debugging session required a specific launch procedure documented in a memory file. After each compaction, the agent forgot this rule and used the wrong procedure, wasting 3+ hours on multiple occasions. The rule was in memory the whole time — just
never re-read.
Proposed Solution
Allow users to pin memory files to the current session so their contents survive context compaction. Pinned files are re-loaded into every context window for the remainder of the session, similar to how CLAUDE.md is always loaded — but scoped to one session, not all sessions.
Example usage:
/pin-memory my_procedure.md
The pinned file contents would be included in the post-compaction context window alongside the compaction summary, ensuring the agent has the procedures available without needing to proactively read the file.
## Why this must be session-scoped, not global
- CLAUDE.md (global): Always loaded in every session. Domain-specific procedures should not pollute unrelated sessions.
auto_load: truein frontmatter (global): Same problem — loads in every session regardless of relevance.- Session-pinned: Only loads in sessions where the user explicitly pins it. Different sessions can pin different files. No cross-session pollution.
## Why existing workarounds fail
- MEMORY.md index: Only titles visible after compaction. Adding "MUST READ" to the description does not reliably trigger the agent to open the file.
- User instruction "read memory first": Also summarized away during compaction.
- Putting all content in MEMORY.md: Not scalable — truncated after 200 lines.
- Re-telling the agent each time: Defeats the purpose of having a memory system.
Alternative Solutions
_No response_
Priority
High - Significant impact on productivity
Feature Category
Configuration and settings
Use Case Example
- User runs
/pin-memory <file>during a session - The file contents are marked as session-pinned
- On every context compaction within that session, pinned file contents are included in the new context window
- Pins expire when the session ends
- Multiple files can be pinned per session
Additional Context
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗