Skip to main content

Context Overload Recovery

If your SI is experiencing context overflow due to loading too many memories, this guide will help you recover and prevent future issues.

Symptoms

  • SI crashes or errors when loading memory
  • “Context too long” or similar errors
  • Slow performance during memory load
  • SI unable to complete tasks after loading memory

Quick Fix

Update your memory load command to use budget-aware loading:
This limits memory loading to approximately 6000 tokens, preventing overflow.

Recovery Steps

1

Update Kernle

Ensure you have the latest version with budget-aware loading:
2

Verify Budget Support

Check that the budget flag is available:
3

Test with Small Budget

Start with a small budget to verify it works:
4

Update Your Configuration

Modify your stack configuration to use budget loading. See examples below.

Configuration Updates

OpenClaw (AGENTS.md)

Update your memory loading section:

Claude Code (CLAUDE.md)

MCP Server

If using the MCP tool, specify budget in the tool call:

Budget Guidelines

Choose a budget based on your context pressure:
The maximum budget is 50000 tokens. Higher values will be clamped.

How Budget Loading Works

When you specify a budget, Kernle:
  1. Loads checkpoint first - Always included (task continuity)
  2. Scores all memories by priority:
    • Values: 0.90 (highest)
    • Beliefs: 0.70
    • Goals: 0.65
    • Drives: 0.60
    • Episodes: 0.40
    • Notes: 0.35
    • Relationships: 0.30
  3. Selects highest-priority items until budget exhausted
  4. Truncates long items (optional, enabled by default)
This ensures you always get your most important context, even with a small budget.

Disable Truncation

If you need full content (at risk of exceeding budget):
Without truncation, individual items may consume more budget, resulting in fewer items loaded.

Check Memory Status

Before troubleshooting, check your current memory inventory:
If you have many items (especially episodes or beliefs), budget loading becomes important.

Memory Hygiene

To reduce memory pressure long-term:

Review Forgetting Candidates

Low-salience memories can be safely forgotten.

Run Forgetting

Protect Important Memories

Check Anxiety Score

High anxiety indicates memory health issues that should be addressed.

Troubleshooting

”Budget must be at least 100”

The minimum budget is 100 tokens. Use a higher value:

Still Getting Overflow

  1. Lower the budget further
  2. Run forgetting to reduce memory count
  3. Check for extremely long individual memories

Memories Missing After Load

With budget loading, lower-priority memories may not be loaded. To see what was excluded, use the _meta field in JSON output:
Example output:
If excluded_count is high, consider:
  • Increasing the budget if your context window allows
  • Running forgetting to reduce low-salience memories
  • Using consolidation to compress episodes into beliefs

Checkpoint Not Loading

Checkpoints are always loaded first, before the budget is applied. If your checkpoint is missing:

Python API


Prevention

To avoid future context overload:

Always Use Budget

Make --budget part of your standard load command

Regular Maintenance

Run kernle anxiety and kernle forget run periodically

Monitor Episode Count

Keep episodes under 200 for best performance

Consolidate Often

Run kernle promote to extract patterns and reduce episode count