User Memory Recorder
Workflow
- Read project-root
MEMORY.md.MEMORY.mdis the rules source controlled bydoc-memory-rules; this Skill owns the runtime state inSHORT_MEMORY.mdandLONG_MEMORY.md. All three files are project assets registered in Router and committed to Git. - Route every lifecycle action through
.codex/hooks/memory-runtime.ps1(Capture,Read,Compact,Repair,Closeout,Validate). Do not let individual Hooks invent separate SHORT/LONG write logic. - On UserPromptSubmit, invoke
-Event Capture; decode Desktop stdin as strict UTF-8, redact secrets, preserve the original prompt Hash, timestamp, workspace/session/conversation/turn IDs, and Task/Plan links. High-confidence Codex internal, system, recommendation, or harness prompts go to the quarantine log and never enter SHORT or LONG. - At SessionStart, invoke
-Event Repair, then-Event Read. Quarantine legacy internal prompts; convert stale orphanreceivedrecords toneeds_userrather than silently deleting or falsely completing them. - Read only the current conversation from SHORT_MEMORY. Keep at most five detailed turns per open conversation and convert older turns to a rolling summary.
- Before every final response, use
memory-turn-closeoutthrough-Event Closeoutto compare the sanitized prompt with Task, Plan, issue/risk, Validation, and Acceptance evidence. Stop is a fallback integrity check, not the normal trigger. It may request exactly one continuation withdecision: block; it must not use legacycontinue: falseas a reinjection mechanism. - Keep
needs_userandblockedin SHORT_MEMORY. A nonterminal closeout is not successful until the detailed record, active summary, andmemory-index.jsonstate/location/conversation Hash all agree. Migratecompleted,cancelled,superseded, or user-approvedclosed_unresolvedthrough the two-phase script; destination verification must precede removal of the detailed record, rollup, and active summary from SHORT. - If SHORT_MEMORY has no relevant match, call
long-memory-retriever; never load LONG_MEMORY in full. - On PreCompact, update both the SHORT_MEMORY rolling summary and Handoff with the same IDs, without duplicating formal ledger bodies.
Never write secrets, raw credentials, or unnecessary personal data. Concurrent changes use project locks, stable IDs, per-conversation hashes, and transaction manifests. Validate must reject a missing/orphan index entry or any SHORT/index state, location, or Hash mismatch. Quarantine stores only metadata, hashes, and a short redacted preview when capture occurs; repaired historical records may omit the preview.


