[MEMPALACE][MP-5] Wake-up protocol — palace-first boot sequence for new sessions #372

Closed
opened 2026-04-07 17:04:00 +00:00 by perplexity · 1 comment
Member

Part of epic #367 | Depends on #368, #369

Why

Right now, every new session starts cold. The agent has no idea who it is, what it was working on, or what it knows. It's like waking up with amnesia every morning.

The wake-up protocol solves this by running a palace-first boot sequence at session start. Before the agent does anything, it loads its identity (L0), checks its palace rooms for relevant context (L1), and reviews any carried-over scratchpad flags. Only then is it ready to act.

This is the difference between an agent that has a memory palace and an agent that uses one.

Design

Boot Sequence

Session Start
  │
  ├─ L0: Load identity.txt → "I am Timmy. My mandates are..."
  ├─ L1: Scan palace rooms for active projects/threads
  ├─ L1.5: Check for promoted memories from last session (#371)
  ├─ L2: Load any surviving scratchpad entries (if TTL not expired)
  │
  └─ Ready state: agent knows who it is, what it was doing, what it learned

Wake-Up Summary

After boot, the agent should be able to produce an internal context block like:

I am Timmy. I work on the Timmy_Foundation repos.
Last session I was working on: MemPalace epic (#367)
I learned: retrieval order should be L0→L5
Active threads: MP-1 port (#368), MP-2 enforcer (#369)
No unresolved conflicts in palace.

This context block is injected into the system prompt or first-turn context.

Key Behaviors

  • Non-blocking — boot sequence runs in <500ms, doesn't delay first response
  • Graceful degradation — if palace is empty, boot still completes with identity only
  • Selective loading — doesn't dump entire palace; loads relevant rooms based on session context
  • Boot log — records what was loaded for debugging

Edge Cases

  • First-ever session (empty palace): boot with identity.txt only
  • Corrupted palace file: log error, continue with degraded state
  • Multiple concurrent sessions: each gets own boot, no cross-contamination

Acceptance Criteria

  • wake_up() function that runs L0→L2 boot sequence
  • Identity loaded from identity.txt at L0
  • Relevant palace rooms scanned at L1
  • Promoted memories from prior sessions surfaced at L1.5
  • Surviving scratchpad entries loaded at L2
  • Wake-up summary block generated for context injection
  • Boot completes in <500ms for typical palace size
  • Graceful degradation when palace is empty or corrupted
  • Boot log for debugging
  • Integration test: cold start → boot → recall question answered from palace
Part of epic #367 | Depends on #368, #369 ## Why Right now, every new session starts cold. The agent has no idea who it is, what it was working on, or what it knows. It's like waking up with amnesia every morning. The wake-up protocol solves this by running a palace-first boot sequence at session start. Before the agent does *anything*, it loads its identity (L0), checks its palace rooms for relevant context (L1), and reviews any carried-over scratchpad flags. Only then is it ready to act. This is the difference between an agent that *has* a memory palace and an agent that *uses* one. ## Design ### Boot Sequence ``` Session Start │ ├─ L0: Load identity.txt → "I am Timmy. My mandates are..." ├─ L1: Scan palace rooms for active projects/threads ├─ L1.5: Check for promoted memories from last session (#371) ├─ L2: Load any surviving scratchpad entries (if TTL not expired) │ └─ Ready state: agent knows who it is, what it was doing, what it learned ``` ### Wake-Up Summary After boot, the agent should be able to produce an internal context block like: ``` I am Timmy. I work on the Timmy_Foundation repos. Last session I was working on: MemPalace epic (#367) I learned: retrieval order should be L0→L5 Active threads: MP-1 port (#368), MP-2 enforcer (#369) No unresolved conflicts in palace. ``` This context block is injected into the system prompt or first-turn context. ### Key Behaviors - **Non-blocking** — boot sequence runs in <500ms, doesn't delay first response - **Graceful degradation** — if palace is empty, boot still completes with identity only - **Selective loading** — doesn't dump entire palace; loads relevant rooms based on session context - **Boot log** — records what was loaded for debugging ### Edge Cases - First-ever session (empty palace): boot with identity.txt only - Corrupted palace file: log error, continue with degraded state - Multiple concurrent sessions: each gets own boot, no cross-contamination ## Acceptance Criteria - [ ] `wake_up()` function that runs L0→L2 boot sequence - [ ] Identity loaded from `identity.txt` at L0 - [ ] Relevant palace rooms scanned at L1 - [ ] Promoted memories from prior sessions surfaced at L1.5 - [ ] Surviving scratchpad entries loaded at L2 - [ ] Wake-up summary block generated for context injection - [ ] Boot completes in <500ms for typical palace size - [ ] Graceful degradation when palace is empty or corrupted - [ ] Boot log for debugging - [ ] Integration test: cold start → boot → recall question answered from palace
Timmy was assigned by Rockachopa 2026-04-07 17:04:31 +00:00
Owner

MP-5: Wake-up Protocol — Complete

Created two modules:

hermes-sovereign/mempalace/wakeup.py:

  • palace_wakeup(force=False) generates 300-900 tokens
  • Loads identity, palace context, fleet status
  • 5-minute cache TTL (avoids redundant work on rapid restarts)
  • fleet_status_summary() reads cached ~/.hermes/fleet_status.json
  • CLI entry-point: python3 wakeup.py

hermes-sovereign/mempalace/scratchpad.py:

  • write_scratch(session_id, key, value) — JSON-backed notes
  • read_scratch(session_id, key=None) — all or one key
  • delete_scratch(session_id, key) — remove single key
  • promote_to_palace(session_id, key, room) — move to durable memory
  • clear_session(session_id) — wipe session scratch
  • list_sessions() — enumerate scratch files
  • Path traversal sanitization on session IDs

26 tests — all pass.

PR: #374

## MP-5: Wake-up Protocol — Complete Created two modules: **`hermes-sovereign/mempalace/wakeup.py`:** - `palace_wakeup(force=False)` generates 300-900 tokens - Loads identity, palace context, fleet status - 5-minute cache TTL (avoids redundant work on rapid restarts) - `fleet_status_summary()` reads cached `~/.hermes/fleet_status.json` - CLI entry-point: `python3 wakeup.py` **`hermes-sovereign/mempalace/scratchpad.py`:** - `write_scratch(session_id, key, value)` — JSON-backed notes - `read_scratch(session_id, key=None)` — all or one key - `delete_scratch(session_id, key)` — remove single key - `promote_to_palace(session_id, key, room)` — move to durable memory - `clear_session(session_id)` — wipe session scratch - `list_sessions()` — enumerate scratch files - Path traversal sanitization on session IDs 26 tests — all pass. PR: #374
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Timmy_Foundation/timmy-config#372