src/hooks/bundled/session-memory/HOOK.md
Automatically saves session context to your workspace memory when you issue /new or /reset.
When you run /new or /reset to start a fresh session:
llmSlug is enabled<workspace>/memory/YYYY-MM-DD-HHMM.md by default without delaying the /new or /reset replyMemory files are created with the following format:
# Session: 2026-01-16 14:30:00 EST
- **Session Key**: agent:main:main
- **Session ID**: abc123def456
- **Source**: telegram
Timestamp slugs are the default so /new and /reset stay fast on message channels:
2026-01-16-1430.md - Default local timestamp slugWith llmSlug: true, the configured model can generate descriptive slugs based on your conversation:
2026-01-16-vendor-pitch.md - Discussion about vendor evaluation2026-01-16-api-design.md - API architecture planning2026-01-16-bug-fix.md - Debugging sessionworkspace.dir must be set (automatically configured during setup)When llmSlug is enabled, the hook uses your configured LLM provider to generate slugs, so it works with any provider (Anthropic, OpenAI, etc.).
The hook supports optional configuration:
| Option | Type | Default | Description |
|---|---|---|---|
messages | number | 15 | Number of user/assistant messages to include in the memory file |
llmSlug | boolean | false | Use your configured model to generate descriptive filename slugs instead of timestamp slugs |
Example configuration:
{
"hooks": {
"internal": {
"entries": {
"session-memory": {
"enabled": true,
"messages": 25,
"llmSlug": true
}
}
}
}
}
The hook automatically:
~/.openclaw/workspace by default)/new and /reset stay fast on message channelsllmSlug is trueTo disable this hook:
openclaw hooks disable session-memory
Or remove it from your config:
{
"hooks": {
"internal": {
"entries": {
"session-memory": { "enabled": false }
}
}
}
}