openclaw - 💡(How to fix) Fix [Performance]: sessions.json bloated by skillsSnapshot.prompt duplication across sessions

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

src/config/sessions/store-load.ts:289-296 stripPersistedSkillsCache() strips resolvedSkills but not prompt. src/agents/skills/workspace.ts:1148 uses entry.skillsSnapshot.prompt as fast-path. Multi-session storage of identical rendered prompts is never deduplicated.

Fix Action

Fix / Workaround

Running a local --require monkey-patch implementing approach A in 24h shadow mode for validation. Happy to share gist or PR once upstream maintainers indicate preferred direction.

RAW_BUFFERClick to expand / collapse

[Performance]: sessions.json bloated by skillsSnapshot.prompt duplication across sessions

OpenClaw version

2026.5.6 (also affects 2026.5.7 → 2026.5.16-beta.5 per codebase audit)

Problem

sessions.json per agent stores skillsSnapshot.prompt (rendered XML skill catalog) for every session entry. In a long-running deployment with 158 sessions across 7 agents:

  • 2096 KB total prompt content
  • Only 18 unique prompts (sha256 hash dedup)
  • ~89% redundant storage (some hashes shared by 61 sessions)
  • 2.4 MB single file for loop-orchestrator/sessions/sessions.json

Compounds with: V8 heap +10-15 MB per JSON.parse, 45s session-store-cache TTL forces frequent re-parses, multi-agent loads pile 5+ MB simultaneously.

Root cause

src/config/sessions/store-load.ts:289-296 stripPersistedSkillsCache() strips resolvedSkills but not prompt. src/agents/skills/workspace.ts:1148 uses entry.skillsSnapshot.prompt as fast-path. Multi-session storage of identical rendered prompts is never deduplicated.

Suggested approaches

A. External catalog file (lowest risk, recommended)

Move duplicated prompt to agents/{name}/sessions/_prompt-catalog.json keyed by sha256. Entries reference by hash. loadSessionStore inflates on read. ~89% file size reduction, schema unchanged for consumers.

B. Strip prompt field

Extend stripPersistedSkillsCache to drop prompt. Each turn calls buildWorkspaceSkillsPrompt() rebuild. Breaks store.skills-stripping.test.ts:103-114 (explicit assertion). Adds ~17 ms rebuild per turn (benchmarked, well below TTFT).

C. Manual openclaw sessions compact command

No runtime change. Lowest impact.

Local prototype

Running a local --require monkey-patch implementing approach A in 24h shadow mode for validation. Happy to share gist or PR once upstream maintainers indicate preferred direction.

Related

  • #74087 (cold-start optimization)
  • #67393 (memory bloat after gateway startup)

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Performance]: sessions.json bloated by skillsSnapshot.prompt duplication across sessions