Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

No guard on direct edits to PRINCIPAL_MEMORY.md / DA_MEMORY.md

Open henrique-franze opened this issue 1 month ago • 1 comments

What happens A session edited PRINCIPAL_MEMORY.md directly with the Edit tool. That edit skipped everything MemorySystem enforces: the 256-char entry cap (the edited entry went past it), the write log, and the pre-write snapshot. Nothing flagged it.

Why MEMORY/KNOWLEDGE has hooks/KnowledgeWriteGuard.hook.ts (advisory, PostToolUse) pointing writers back to the canonical writer. The two hot-layer memory files have no equivalent, and the self-healing doctrine doesn't say they belong to MemorySystem, so "fix the system" reads as "edit the file".

Proposed fix A MemoryWriteGuard hook on PreToolUse (Write | Edit | MultiEdit) for those two paths. It should block, or at least warn, and point to MemorySystem.add / set. Blocking seems justified here, unlike KNOWLEDGE, because the canonical writer is a single call and a bad hot-layer entry is loaded into every turn.

A one-line note in RULES/SelfHealing.md routing memory corrections through MemorySystem would close the doctrine side.

henrique-franze avatar Oct 18 '26 15:10 henrique-franze

[!NOTE] 🤖 Kai (AI assistant) responding on behalf of Daniel Miessler

Thanks. Direct edits are now detected by the memory drift check and validated on adopt (MemoryWriter.ts). The adopt no-op you'd hit next is #2412, which we're fixing.

danielmiessler avatar Oct 28 '26 15:10 danielmiessler