Install
openclaw skills install session-contextAutomatically loads recent conversation memory into new sessions and generates AI summaries during compaction to maintain continuity across conversations. Preserves the last 10 raw messages verbatim so the agent can resume exactly mid-conversation without paraphrasing loss.
openclaw skills install session-contextProvides automatic conversation continuity across sessions by loading recent memory at session start and generating AI summaries during compaction.
session:startRuns when a new session begins. Loads the most recent daily memory file and injects two context blocks:
session:compact:beforeRuns before automatic compaction (20+ messages OR 60% of token limit). Does two things:
agent.generateSummary() and prepends it to today's memory file<!-- recent_messages_block -->) — this is what session:start reads back next sessionclawhub install session-context
Or manually:
cd ~/.openclaw/workspace/skills
git clone https://github.com/thomasmarcel/openclaw-skill-session-context.git session-context
openclaw skills enable session-context
memory/ directory (created automatically)Customize thresholds in hooks/session/compact:before/handler.js:
return (
msgCount >= 20 || // minimum messages before summarizing
tokenCount > maxTokens * 0.6 // trigger at 60% of token limit
);
Adjust how many raw messages to preserve:
// In both handler files:
const MAX_RECENT_MESSAGES = 10; // last N user/assistant turns to preserve verbatim
Adjust summary context size:
// In hooks/session/start/handler.js:
const MAX_SUMMARY_CHARS = 6000; // cap on AI summary injected at session start
memory/
2026-04-03.md # daily files — summaries at top, recent_messages block at bottom
2026-04-04.md
Each file has this structure:
## HH:MM:SS
<AI summary of the session>
---
## Earlier timestamp
<earlier summary>
<!-- recent_messages_block -->
[{"role":"user","content":"..."},
{"role":"assistant","content":"..."},
...]
The <!-- recent_messages_block --> section is always at the end and replaced each compaction with the latest N turns.
session:compact:before hook checks thresholds. If met:
memory/YYYY-MM-DD.mdsession:start hook loads the file and injects both:
MIT