| description | Prep to /clear: persist durable memory to disk, optionally MemPalace (--mp flag), emit continuation prompt if work remains |
|---|---|
| argument-hint | [--mp] [what's next / handoff focus] |
Think silently. Print only:
- One status line:
Disk: <files|none> | MemPalace: <wing/room|none|skipped|pending> | Handoff: <yes|no> - If Handoff yes: one
```text ```block, 50–150 words, labeled —NEXT:ARTIFACTS:DONE:GOTCHAS:(omit empty fields), optionalGOAL:when NEXT doesn't imply it. Imperative voice. - Optional:
Skipped: <thing> (≤8 words why)if borderline save rejected.
Nothing else. No preamble, no narration.
Arguments: $ARGUMENTS — treat --mp as a flag (activates step 2), remainder as handoff focus.
Claude Code keeps per-project file memory at ~/.claude/projects/<project-slug>/memory/, auto-loaded each session through MEMORY.md. Write durable, cross-session facts there — facts not already in code, git history, or CLAUDE.md.
Format — one file per fact:
---
name: <short-kebab-case-slug>
description: <one-line summary, used to judge relevance on recall>
metadata:
type: user | feedback | project | reference
---
<the fact. For feedback/project, follow with **Why:** and **How to apply:** lines.
Link related memories with [[their-name]].>user= who the user is (role, preferences).feedback= how you should work (corrections/confirmed approaches + the why).project= ongoing work, goals, constraints not derivable from code.reference= pointers to external resources (URLs, tickets, dashboards).- After writing a file, add a one-line pointer to
MEMORY.md:- [Title](file.md) — hook. Never put fact content inMEMORY.md; it's an index. - Check for an existing file that already covers it — update over duplicating. Delete memories proven wrong.
Save: decisions, project state/goal/constraint changes, non-obvious gotchas, surfaced preferences, external refs (PR/URL/ticket) that matter later. Skip: one-offs, pure exploration, already-captured, anything the repo already records. Convert relative dates to absolute. Verify any named file/function/flag still exists before recording advice about it.
Skip unless --mp present — surface as MemPalace: skipped in status line. Requires the MemPalace MCP server connected; if absent, treat as skipped.
Wing = project snake_case, room = aspect (backend, plans, decisions, build_env, etc.). Run mempalace_check_duplicate first, then mempalace_add_drawer or mempalace_update_drawer. Store verbatim, not summarized. On MCP error/timeout → MemPalace: pending, move on; the disk write is the durable fallback.
If an obvious next phase exists: write the labeled block. If not: Handoff: no. Common handoff points: brainstorm→plan, plan→impl, impl→review, PR awaiting CI, debug→fix pending.