Skip to content

[Feature] sessions_history: add pagination/offset and export support #90981

Description

@J0eyQiao

Problem

sessions_history has no pagination/offset support and returns at most ~80KB, silently truncating older messages. For long conversations, this makes it impossible to retrieve the complete history.

Context

  • The limit appears to be DEFAULT_MAX_BYTES * 2 hardcoded in the tool implementation
  • There is no configurable parameter to increase it
  • The returned JSON includes "truncated": true but there's no way to request the next page
  • The trajectory file (6.9MB) stores everything, but it's a debug/audit format unsuitable for reading

Proposed solution

One or more of:

  1. Add offset / pageToken parameters to sessions_history for pagination
  2. Add a dedicated session export endpoint that returns the full history without truncation
  3. Add a sessions_export tool that produces a clean, readable conversation log (text/markdown, no tool calls, no thinking chains — just user↔assistant messages)
  4. Make the output size limit configurable via openclaw.json

Impact

Cannot export complete conversation logs, which is a basic need for reviewing past discussions, sharing context, or archiving.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions