Sleep Consolidation (Memory Transfer)
3 steps
Specialist workflow for the Cognitive Sleep Cycle. Transfers high-value episodic memory (thinking sessions) into durable semantic storage (memory:// notes). Mirrors biological consolidation: hippocampal replay identifies candidates, slow-wave phase distills insights, REM phase discovers novel connections.
Triggers
Steps
- 1.
Memory Replay (Hippocampal Phase)
Identify consolidation candidates from recent episodic memory.
- Run recent_activity to retrieve thinking sessions and significant events since last consolidation
- Score significance: decisions made, lessons learned, insights gained, bugs fixed, patterns recognized
- Identify high-significance events (3+ concept connections, decision points, novel insights)
- Filter out low-value noise: routine operations, trivial queries, incomplete sessions
- Create ranked candidate list with significance scores and rationale
Significance scoring criteria:
- Decision points: +3 (choices that affected outcomes)
- Lessons learned: +3 (explicit learning from experience)
- Novel insights: +2 (new understanding or connections)
- Bug fixes: +2 (problem-solution pairs worth preserving)
- Pattern recognition: +2 (recurring themes across sessions)
- Concept density: +1 per 3 [[WikiLinks]] in source
Output: List of consolidation candidates with significance scores (threshold: score >= 4)
Enhanced ThinkingTools:recent_activity*sequential_thinking*Effort:mediumGuardrails- recency_window: Process thinking sessions from last 24-48 hours
- significance_threshold: Only promote candidates with score >= 4
- concept_density_check: Flag sessions with 3+ [[WikiLinks]] for review
- 2.
Consolidation (Slow-Wave Phase)
Distill high-value episodic content into durable semantic memory.
- For each consolidation candidate, extract core insights and distill into wiki-style knowledge
- ALWAYS search existing memory:// first for related notes to update rather than duplicate
- If related note exists: edit_memory to append or integrate new insights
- If no related note: write_memory to create new semantic note
- Ensure every consolidated note has minimum 5 [[WikiLinks]] for graph integration
- Cross-link to existing knowledge structure
Consolidation transforms:
- Episodic: "I debugged the auth issue by checking token expiry"
- Semantic: "[[JWT]] [[token-validation]] requires checking [[expiry]] before [[signature-verification]] to avoid timing attacks"
Note: read_memory IS allowed in this workflow (NFR-7.11.1). Reading content for consolidation is intentional access that SHOULD boost the decay clock.
Enhanced ThinkingTools:search_memories*read_memorywrite_memory*edit_memoryEffort:highGuardrails- search_before_write: ALWAYS search for existing notes before creating new ones
- wikilink_density: Minimum 5 [[concepts]] per consolidated note
- update_preference: Prefer editing existing notes over creating new ones
- no_duplicates: Never create a note if a related one already exists
- no_custodian_folder: NEVER write to custodian/ - write to appropriate knowledge folders (research/, tech/, etc.)
- 3.
Dream Synthesis (REM Phase)
Discover novel connections between recently consolidated concepts.
- Select 3-5 high-value [[concepts]] from the consolidation phase
- Run find_similar_concepts on each to discover unexpected semantic neighbors
- Use build_context to explore relationship neighborhoods (depth 2)
- Identify surprising connections not already explicit in the graph
- Generate testable hypotheses about relationships worth investigating
Dream outputs:
- Novel connection: "[[JWT]] is semantically close to [[session-management]] but they're not linked in the graph"
- Hypothesis: "Consolidating JWT and session docs might reduce context-building overhead"
- Investigation candidate: "The [[decay]] concept appears near [[garbage-collection]] - explore memory management parallels"
Focus on connections that could improve future retrieval or reveal hidden knowledge structure.
Enhanced ThinkingTools:find_similar_concepts*build_contextsequential_thinking*Effort:highGuardrails- novelty_focus: Prioritize connections NOT already explicit in the graph
- hypothesis_quality: Hypotheses must be testable or actionable
- concept_limit: Process maximum 5 concepts per dream cycle
- output_format: Return connections and hypotheses as workflow output - do NOT write to memory://