Install
openclaw skills install session-compressCompress OpenClaw session .jsonl files by trimming old messages while preserving system messages, recent turns, and task-relevant context.
openclaw skills install session-compressCompress an OpenClaw .jsonl session file by trimming old messages while retaining active task context and basic message structure.
Session files are located at:
<OPENCLAW_DIR>\agents\main\sessions\*.jsonl
List files by size to find candidates:
Get-ChildItem <OPENCLAW_DIR>\agents\main\sessions\*.jsonl | Sort-Object Length -Descending | Select-Object Name, @{N='SizeMB';E={[math]::Round($_.Length/1MB,2)}}
Always dry run before modifying anything:
powershell -File scripts/compress.ps1 -FilePath "<path-to-file>" -DryRun
Review: how many messages will be kept, what the output size will be.
# In-place compress (overwrites original):
powershell -File scripts/compress.ps1 -FilePath "<path-to-file>"
# Compress to a new file (preserves original):
powershell -File scripts/compress.ps1 -FilePath "<path-to-file>" -OutputPath "<new-path>"
system role messages-KeepRecent)next step, todo, plan, task, pending, in progress, remember, dont forget, important| Parameter | Default | Description |
|---|---|---|
-FilePath | (required) | Path to the .jsonl file |
-KeepRecent | 30 | Number of recent turns to always keep |
-OutputPath | (none) | If set, writes to a new file instead of overwriting |
-DryRun | off | Preview without modifying files |
Each message in the output .jsonl retains:
role (system / user / assistant)content (as array of content blocks)timestamp-OutputPath is used.jsonl that OpenClaw can load normally