Skip to content

Feature Request: Configurable Session History Retention #11884

@mdisturbed

Description

@mdisturbed

Feature Request: Configurable Session History Retention

Problem

OpenClaw currently compacts session history within 24 hours with no way to configure retention policy. This causes critical context loss when troubleshooting issues or reviewing past work.

Use Case

User experienced a comprehensive .env key scan that ran for 8+ hours on Feb 7, mentioned in every heartbeat. By Feb 8 at 4:03 AM, all session history from Feb 7 was compacted and lost. No way to verify what ran, retrieve results, or debug the issue.

Requested Feature

Add configurable session history retention policies:

{
  "session": {
    "history": {
      "retentionDays": 7,           // Keep detailed history for 7 days
      "summaryRetentionDays": 30,   // Keep high-level summaries 7-30 days
      "archiveAfterDays": 30,       // Archive (compress/export) after 30 days
      "autoExport": {
        "enabled": true,
        "path": "~/.openclaw/session-archives/",
        "format": "jsonl"           // or "markdown"
      }
    }
  }
}

Benefits

  1. Troubleshooting - Review what happened when issues occur
  2. Audit trail - Track long-running operations and their results
  3. Memory - AI agents can reference past work without re-running
  4. Recovery - Restore context after crashes or restarts

Current Workaround

None effective. Memory files help but don't capture full session context.

Priority

High - This is a blocker for production use where accountability and audit trails matter.

Related

  • Current compaction settings only control in-session summarization
  • memory_search helps but doesn't preserve full session transcripts

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    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