-
-
Notifications
You must be signed in to change notification settings - Fork 40.1k
Open
Description
Problem
When users send images via Discord/Telegram, OpenClaw:
- Saves the image file to
~/.openclaw/media/inbound/✓ - Also embeds the full base64 data in the session .jsonl file ← Problem
This causes:
- A 972KB PNG becomes 1.15MB in session history (base64 overhead)
- Session files grow rapidly (3.3MB+ with just a few images)
- Context window fills up quickly since the base64 is loaded into LLM context
- Images cannot be pruned by
contextPruningsince they're part of user messages
Current Behavior
// In session .jsonl
{
"type": "message",
"message": {
"role": "user",
"content": [
{"type": "text", "text": "..."},
{"type": "image", "data": "iVBORw0KGgo...(1MB base64)...", "mimeType": "image/png"}
]
}
}Proposed Solution
Store images as path references:
{
"type": "image",
"path": "/Users/.../.openclaw/media/inbound/xxx.png",
"mimeType": "image/png"
}When loading context:
- If image is recent (within TTL): read from disk and include
- If image is old: replace with placeholder like
[Image: screenshot.png - pruned]
Additional Enhancement
After image analysis, optionally replace base64 with text summary:
{"type": "image_summary", "text": "[Screenshot showing terminal with sessions.json file size of 5.6MB]"}Environment
- OpenClaw 2026.2.12
- macOS
- Discord channel
Impact
This would significantly reduce:
- Session file sizes
- Context consumption
- API costs (fewer tokens for images that don't need re-analysis)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels