win4r/lossless-claw-enhanced
Fork of Martian-Engineering/lossless-claw with CJK-aware token estimation
What it solves
This project provides a "Lossless Context Management" (LCM) plugin for OpenClaw that prevents the loss of conversation history. Standard systems typically delete older messages when a conversation exceeds the model's token limit; this plugin instead stores every message in a SQLite database and uses an LLM to create a searchable, hierarchical summary of the history.
How it works
When a conversation grows too large, the plugin triggers a compaction process. It summarizes older message chunks into a directed acyclic graph (DAG) of summaries. These summaries are stored alongside the original messages, allowing the agent to retrieve specific details or "drill down" into the original text when needed. It provides specific tools (lcm_grep, lcm_describe, lcm_expand) for the agent to navigate this history.
Who it’s for
This tool is for OpenClaw users who need to maintain long-term memory of complex, multi-turn conversations without losing context or hitting token limits. It is particularly useful for those working with Chinese, Japanese, or Korean (CJK) text, as it includes specialized token estimation to prevent miscalculations that cause context window overflow.
Highlights
- Lossless History: Every message is preserved in a database rather than being discarded.
- Hierarchical Summarization: Uses a DAG-based system to condense old context while keeping it accessible.
- CJK-Aware Estimation: Fixes significant token underestimation errors for Chinese, Japanese, and Korean characters.
- Agent Tools: Enables agents to search and expand on summarized history via specific commands.
- Flexible Configuration: Supports any LLM provider configured in OpenClaw for the summarization task.
Related
- Project
- Project
- Project
- Project