openclaw - 💡(How to fix) Fix Bug: sessions.json grows unbounded due to static schema serialized into dynamic session state [1 comments, 2 participants]

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…
GitHub stats
openclaw/openclaw#72327Fetched 2026-04-27 05:31:31
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Author
Timeline (top)
closed ×1commented ×1

Root Cause

sessions.json grows unbounded because skillsSnapshot (all skill descriptions + metadata for all 60+ skills) and systemPromptReport (full tool schemas for all 150+ tools) are serialized into every session entry. These are static data.

RAW_BUFFERClick to expand / collapse

sessions.json grows unbounded because skillsSnapshot (all skill descriptions + metadata for all 60+ skills) and systemPromptReport (full tool schemas for all 150+ tools) are serialized into every session entry. These are static data.

Real example: stock agent 12 sessions = 1.8 MB of duplicated static schema data. Trims to ~55 KB by removing these fields.

Suggested fix: Option A - Global skill/tool cache computed once on startup, serialize only a lightweight reference per session entry.

extent analysis

TL;DR

Store static configuration data in a global in-memory cache and serialize only a lightweight reference in each session entry to reduce data bloat.

Guidance

  • Identify the static data (skillsSnapshot and systemPromptReport) that is being duplicated across every session entry and determine the best approach to cache or load it dynamically.
  • Consider implementing Option A, which involves storing the static data in a global in-memory cache computed once on startup, and serializing only a lightweight reference in each session entry.
  • Evaluate the trade-offs between Option A and Option B, which involves loading the static data on-demand and not persisting it to sessions.json.
  • Verify the effectiveness of the chosen approach by measuring the reduction in session data size and improvement in performance.

Example

// Example of storing skillsSnapshot in a global in-memory cache
const skillsSnapshotCache = {};
function getSkillsSnapshot() {
  if (!skillsSnapshotCache.snapshot) {
    // Compute skillsSnapshot once on startup
    skillsSnapshotCache.snapshot = computeSkillsSnapshot();
  }
  return skillsSnapshotCache.snapshot;
}

// Serialize only a lightweight reference in each session entry
const sessionEntry = {
  // ...
  skillsSnapshotRef: 'v2026.4.11',
  // ...
};

Notes

The chosen approach may have implications for data consistency and availability, particularly if the static data is updated frequently. It is essential to consider these factors when implementing the solution.

Recommendation

Apply workaround by storing static configuration data in a global in-memory cache and serializing only a lightweight reference in each session entry, as this approach is likely to significantly reduce data bloat and improve performance.

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 Bug: sessions.json grows unbounded due to static schema serialized into dynamic session state [1 comments, 2 participants]