Skip to content

Feature request: make OpenClaw thread capture truncation configurable #101

@blessonism

Description

@blessonism

Feature request: make OpenClaw thread capture truncation configurable

Problem

In @nowledge/openclaw-nowledge-mem, OpenClaw conversation threads are currently not close to lossless when viewed later inside Nowledge Mem.

The main reason is that each captured thread message is hard-truncated to 800 chars before being written.

Current code path:

  • src/hooks/capture.js
  • const MAX_MESSAGE_CHARS = 800
  • normalizeRoleMessage() uses content: truncate(text)
  • appendOrCreateThread() writes message.content into the persisted thread

This means the stored thread message itself is already truncated, not just the UI preview.

Why this matters

For OpenClaw sessions, especially Telegram / Discord / long-running agent chats, a single user message can be much longer than 800 chars because it may contain:

  • conversation envelope metadata
  • relevant memory injection blocks
  • structured prompts
  • long analytical replies

So the current behavior makes thread history inside Nowledge Mem significantly less useful for:

  • conversation review
  • source-thread inspection
  • debugging memory capture quality
  • verifying what was actually said during long OpenClaw sessions

Important clarification

I verified that this is not only a pagination/UI issue:

  • thread pagination exists and is fine
  • lifecycle capture timing also explains why the latest turns may not appear immediately
  • but the bigger issue is that persisted thread message content is hard-truncated before storage

Suggested change

Please make the per-message thread capture limit configurable.

Proposed config key

maxThreadMessageChars

Suggested behavior

  • default: 800 (keep backward compatibility)
  • range: 200-20000
  • used only for OpenClaw thread capture persistence
  • exposed in:
    • openclaw.plugin.json configSchema
    • plugin UI hints
    • README / docs
    • status output (nowledge_mem_status)

Example

{
  "plugins": {
    "entries": {
      "openclaw-nowledge-mem": {
        "enabled": true,
        "config": {
          "maxThreadMessageChars": 4000
        }
      }
    }
  }
}

Local patch that worked

I tested a local patch with this approach:

  • add maxThreadMessageChars to src/config.js
  • thread it into src/hooks/capture.js
  • use it in normalizeRoleMessage(..., maxMessageChars)
  • expose it in src/tools/status.js
  • add it to openclaw.plugin.json and README

Using maxThreadMessageChars = 4000 already makes OpenClaw thread history much more usable without changing the default for existing users.

Nice-to-have follow-up

If you want to improve this further later, a second step could be smarter preprocessing for OpenClaw-specific thread capture, e.g. stripping or compacting injected envelope blocks before persistence. But the configurable limit alone would already solve the main issue.

Summary

This is not a request to remove truncation completely.
It is a request to turn a hard-coded implementation constant into a documented plugin config option so users can tune fidelity vs storage/noise for their own OpenClaw workflows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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