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
+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]