Skip to content

Memory compaction never triggers (compactionCount: 0) #14143

@xyooz

Description

@xyooz

Memory Compaction Bug Report

Bug Description

Memory compaction (memory flush) feature is never triggered even when the conversation context should be full.

Evidence

Session State

  • Session ID: b03da55e-c8fe-43f3-b634-a6a29332edae
  • Compaction Count: 0 (never executed)
  • Session file: /root/.openclaw/agents/main/sessions/b03da55e-c8fe-43f3-b634-a6a29332edae.jsonl

Reproduction Steps

  1. Start a long conversation session with multiple tool calls
  2. Continue conversation until context should be near full
  3. Observe that memory compaction never triggers
  4. Check compactionCount in session state - remains at 0

Expected Behavior

  • Memory compaction should automatically trigger when context reaches threshold
  • compactionCount should increment with each flush
  • Durable memories should be saved to memory/YYYY-MM-DD.md

Actual Behavior

  • Memory compaction never triggers
  • compactionCount stays at 0 even after extensive conversation
  • Manual memory save works, but automatic compaction fails

Configuration

Current Configuration

{
  "memory": {
    "backend": "local",
    "local": {
      "embeddingModel": "hf:ggml-org/embeddinggemma-300M-GGUF/embeddinggemma-300M-Q8_0.gguf"
    }
  },
  "plugins": {
    "entries": {
      "memory-lancedb": {
        "enabled": true
      }
    },
    "slots": {
      "memory": "memory-lancedb"
    }
  }
}

Memory Files

  • Manual memory saves work: memory/2026-02-11.md (96 lines)
  • Total memory files: ~368 lines across multiple dates
  • No automatic compaction observed

Environment

  • Platform: Linux 5.15.0-164-generic (x64)
  • Node: v22.22.0
  • OpenClaw Version: 2026.2.9 (last touched 2026-02-10T07:12:15.055Z)
  • Channel: Telegram
  • Model: minimax/MiniMax-M2.1

Investigation Notes

  1. Memory Flush Trigger: The system message says "Pre-compaction memory flush" but it doesn't actually trigger compaction
  2. Manual Save Works: Using memory/YYYY-MM-DD.md manually saves memories successfully
  3. No Error Messages: No visible errors when "Pre-compaction" triggers - just responds with NO_REPLY
  4. Compaction Timer: Unclear what threshold triggers automatic compaction

Suggested Investigation Areas

  1. Check if compactionCount increment logic exists in codebase
  2. Verify trigger conditions for memory compaction
  3. Check if there's a configuration option to enable/disable compaction
  4. Look for any race conditions or errors preventing compaction
  5. Verify LanceDB plugin integration with memory compaction

Additional Context

The user manually saves important memories to memory/YYYY-MM-DD.md as per the prompt guidelines, but the automatic memory compaction feature appears to be non-functional.


Template Source

This report follows the OpenClaw guideline:

"If you find bugs, try to fix them first. If you can't fix them, create a detailed issue report."

However, without git access to the repository, this report is prepared for manual submission to:


Report Prepared: 2026-02-11 23:26 GMT+8
Reporter: OpenClaw User (via assistant)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions