docs/design/2026-07-25-pinned-memory-protection.md
Managed auto-memory recursively discovers valid markdown topics below the project and user memory roots, subject to the existing index limits. Automatic extraction and Dream consolidation agents can write or edit paths inside their allowed memory roots, so a hand-curated file can be overwritten or consolidated like an automatically generated memory.
The recursive scanner already discovers valid files below pinned/; the
missing behavior is deterministic mutation protection during automated memory
maintenance.
Treat a top-level pinned/ directory inside a managed-memory root as protected
from automatic-extraction mutation and excluded from Dream consolidation:
write_file and edit operations
when the requested path is lexically below pinned/.pinned/.rm and every
other mutating shell command.The path check compares both literal and resolved paths case-insensitively.
Literal containment protects pinned/ even when that directory is itself a
symlink. Resolved containment prevents a writable-looking path elsewhere in
memory from symlinking back into pinned/.
Protection is an explicit option on the existing memory-scoped agent configuration and is enabled by the automatic extraction and forked Dream planners. This covers post-session extraction, scheduled Dream, and callers of the workspace-memory Dream endpoint. Explicit remember operations retain their current behavior.
pinned/ documents with the existing frontmatter schema./memory UI indicator./forget requests keep their current behavior.write_file
or edit, and their read-only shell policy blocks ln; a stronger threat
model would require a separate inode-based policy./dream slash-command turn receives the shared skip prompt rule,
but does not gain a deterministic tool gate in this change. The slash command
executes on the main Agent, which has no existing per-turn permission
override; adding one would be a separate cross-surface permission design.pinned/ directories receive the same protection.packages/core/src/memory/paths.tspackages/core/src/memory/memory-scoped-agent-config.tspackages/core/src/memory/dreamAgentPlanner.tspackages/core/src/memory/extractionAgentPlanner.tsdocs/users/features/memory.mdWhether the visible /dream slash command must receive the same deterministic
gate remains a maintainer scope decision. If required, it should be implemented
as a general per-turn permission override rather than by mutating the
session-wide permission manager around one asynchronous tool loop.