wake-up/wrap-up: codify MemPalace 5-step protocol

MemPalace has always had a full memory protocol embedded in its
status response, but the skills were treating it as a library
catalog — one search on wake, nothing on wrap. Inspection revealed
the gap: the KG was empty (0 entities, 0 triples ever), and the
diary had exactly one entry, from 2026-04-09. Storage without
protocol is not memory; it is unindexed potential.

The protocol, as MemPalace itself states it:
  1. ON WAKE-UP: mempalace_status (loads protocol + AAAK spec)
  2. BEFORE RESPONDING: kg_query or search first; never guess
  3. IF UNSURE: "let me check" and query — wrong is worse than slow
  4. AFTER EACH SESSION: diary_write in AAAK format
  5. WHEN FACTS CHANGE: kg_invalidate old, kg_add new

wake-up changes:
- Step b.0: mempalace_status first (loads protocol, not just data)
- Step b.1: diary_read for claude-code agent (last 3 entries) —
  the previous self's voice
- Step b.2: kg_query on claude-code (drift patterns to hold today)
  and on pulling-thread subjects (authoritative current state)
- Step b.3: semantic searches as before
- Constraints: MemPalace is primary memory; when it disagrees with
  a memory file, trust MemPalace

wrap-up changes:
- Step 4 split into 4.a (drawer — semantic full content) and
  4.b (diary_write — AAAK compressed agent voice). Both surfaces;
  different future queries.
- New step 5: kg_invalidate facts that changed this session; kg_add
  new drift patterns, decisions, entities.
- Output template surfaces diary + KG update counts, not just drawer.

The drift-pattern handling replaces the proposed patterns-i-drift-
toward.md file idea. KG is the better home: queryable, temporal,
invalidatable. When a return is a repeat, kg_add it; wake-up's
kg_query surfaces it next session.

Verified by usage on today's session: diary entry filed (AAAK),
3 KG facts added (drift-pattern register-import-without-checking,
ARC versioning-regime ADR-005, after-the-reply-sequence staged).
This is the first real exercise of the protocol.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
David F Glidden
2026-04-17 14:19:09 +02:00
co-authored by Claude Opus 4.7
parent 5f3ea1a695
commit 7a71c7a07c
2 changed files with 55 additions and 15 deletions
+16 -9
View File
@@ -45,16 +45,23 @@ Run these in parallel to minimize latency:
- Read the Active Session memory file referenced there — **specifically extract the pulling thread + literal question + open horizons**
- Read `~/.claude/projects/-Users-davidglidden/memory/session-ledger-[previous-date].md` if it exists — **specifically read the "Returns" and "Confidence to recalibrate" sections** for mood signal
**b. MemPalace — multi-query reconstruction**
**b. MemPalace — the memory protocol, not a search**
Run multiple targeted searches to reconstruct the full working state. MemPalace MCP tools are wired at user scope and should always be available.
MemPalace is primary memory, not a library catalog. Follow its 5-step protocol (the system itself reminds you of this when you call `mempalace_status` — that's intentional; re-reading the protocol every wake keeps it operative).
- **Last session's pulling thread:** `mempalace_search` query using keywords from the previous /wrap-up's pulling thread, in wing `claude-sessions`
- **Active workstream:** `mempalace_search` query based on what the session memory identifies as the active work
- **Recent thinking:** `mempalace_search` query "recent decisions rationale" in wing `capablemind-thinking`
- **Steward's recent notes:** `mempalace_search` query "daily log" in wing `obsidian-vault`
**b.0. Status + protocol reload.** Call `mempalace_status` first. This returns palace overview, 5-step protocol, AAAK spec. The protocol is the reason MemPalace exists; never skip this step.
Use the results to reconstruct *why* we were doing what we were doing, in service of the pulling thread.
**b.1. Diary — what the previous self recorded.** `mempalace_diary_read` with `agent_name: "claude-code"`, `last_n: 3`. Diary entries are in AAAK format (compressed, entity-coded, emotion-marked); read them as the previous session's internal voice, not metadata.
**b.2. Knowledge graph — active facts and drift patterns.** `mempalace_kg_query` for entity `"claude-code"` to retrieve drift patterns (things I've returned from in past sessions, worth holding today). Also query the pulling-thread subjects (e.g., `"after-the-reply-sequence"`, `"ARC-essays"`) for their authoritative current state — not the point-in-time version frozen in memory files.
**b.3. Semantic searches.** Multiple `mempalace_search` queries to reconstruct working context:
- Last session's pulling thread — in wing `claude-sessions`
- Active workstream — based on what the session memory identifies as active
- Recent thinking — `"recent decisions rationale"` in wing `capablemind-thinking`
- Steward's recent notes — `"daily log"` in wing `obsidian-vault`
Use results to reconstruct *why* we were doing what we were doing, in service of the pulling thread.
**c. Governance state**
- Read `~/PENDING.md` — extract items with status PENDING
@@ -113,8 +120,8 @@ Ready when you are.
## Important constraints
- **MemPalace is primary, not fallback.** Query it first and lean on it heavily. It has 100,000+ drawers across thinking docs, transcripts, and vault.
- **Memory files are secondary.** They capture what was surprising or non-obvious. MemPalace has the full record.
- **MemPalace is primary memory, not fallback.** Follow its 5-step protocol (wake `status`, pre-response `kg_query`/`search`, "let me check" if unsure, `diary_write` at session end, `kg_invalidate` + `kg_add` when facts change). 127,000+ drawers across thinking docs, transcripts, and vault — but storage only becomes memory when the protocol is exercised.
- **Memory files are secondary.** They capture what was surprising or non-obvious. MemPalace has the authoritative record. When memory files and MemPalace disagree, trust MemPalace (it's maintained across sessions; files are point-in-time snapshots).
- **The pulling thread comes before facts.** Even if the briefing's other content is rich, lead with the thread. If the thread can't be found in the previous /wrap-up, say so honestly — this is itself a signal that the previous wrap-up was incomplete.
- **The literal question is read verbatim.** Don't paraphrase, don't try to answer it, don't decide it's stale without evidence.
- **Don't read CLAUDE.md** — loaded automatically by the system.
+39 -6
View File
@@ -75,16 +75,47 @@ The description field should include the pulling thread, not just what happened.
- Update any other memory entries that changed during the session (project state, new decisions, new feedback)
- Remove or update any entries that are now stale
### 4. File to MemPalace
### 4. File to MemPalace — two surfaces, different purposes
If MemPalace MCP tools are available, use `mempalace_add_drawer` to file the session summary:
MemPalace has two complementary write surfaces: drawers (semantic, full content) and diary (AAAK, chronological agent voice). Use both — they serve different future queries.
**4.a. Drawer — the full session record (semantic search surface).**
`mempalace_add_drawer`:
- **wing:** `claude-sessions`
- **room:** `handoffs`
- **content:** The full session record from step 1, including the pulling thread + pause statement + literal question. These semantic hooks make the session findable later by *what was pulling*, not just *what happened*.
- **tags:** session date, key topics, the pulling thread keyword
### 5. Check for loose ends
**4.b. Diary entry — AAAK-compressed session voice.**
`mempalace_diary_write`:
- **agent_name:** `"claude-code"` (stable across sessions and model versions)
- **topic:** `"session-handoff"` for regular wrap-ups; other topics allowed for specialized entries
- **entry:** AAAK format — pipe-separated fields, entity codes, emotion markers, date in ISO. Call `mempalace_get_aaak_spec` if the dialect isn't fresh in context.
Example shape:
```
SESSION:YYYY-MM-DD|headline.event|key.work.threads|DAV.action(context)|*mood-marker*|returns(N):short-names|OPEN:what-still-pulls|NEXT:immediate-thread|★★★(importance)
```
Diary is where the *previous self* speaks to the next self. Keep it tight; this is the voice, not the record.
### 5. Update knowledge graph — facts that changed, patterns observed, entities introduced
If any facts changed during the session, use `mempalace_kg_invalidate` on the old fact and `mempalace_kg_add` for the new. Examples:
- A project status changed (`kg_invalidate` prior status, `kg_add` new one)
- A person's circumstance changed (Kai was unborn → Kai is born)
- An open question got answered (`kg_invalidate` the open status)
If the session produced a new observation worth retrieving later, `mempalace_kg_add` it:
- **Drift patterns from Symmetria returns.** If today's ledger has returns that repeat a pattern from a previous ledger, `kg_add(subject: "claude-code", predicate: "drift-pattern", object: short-name)`. Wake-up's `kg_query` on entity `"claude-code"` surfaces these.
- **New decisions or artifacts.** New ADR, new canonical document, new staged work — `kg_add` the relationship so future sessions can `kg_query` the subject and find the current state.
- **New entities that will recur.** A new person, project, or thread that will be referenced in later sessions deserves a KG foothold.
This step is what makes MemPalace a *memory* rather than storage. Skipping it means the next session has to re-derive everything from files.
### 6. Check for loose ends
Run these checks and report results:
@@ -102,7 +133,7 @@ in each active repo. Report any commits not yet pushed.
**PENDING.md** — flag any items that need steward attention before next session.
### 6. Vault sync
### 7. Vault sync
Sync the thinking mirror to Obsidian vault:
@@ -113,7 +144,7 @@ Use rsync to copy new/modified files, preserving directory structure. Report wha
If the destination doesn't exist or the iCloud path isn't accessible, skip silently and note it.
### 7. Output
### 8. Output
Produce a brief summary for the steward:
@@ -124,7 +155,9 @@ Produce a brief summary for the steward:
**Question we're leaving open:** [the literal question for next-Claude]
**Session captured:** [memory file path]
**MemPalace filed:** [yes/no]
**MemPalace drawer filed:** [yes/no, wing/room]
**MemPalace diary written:** [yes/no, AAAK entry summary in one line]
**KG updates:** [count of kg_add + kg_invalidate calls, or "none"]
**Uncommitted work:** [list or "none"]
**Unpushed commits:** [list or "none"]
**PENDING items:** [count needing attention]