lossless-claw-enhanced  by win4r

Lossless context management for LLM agents

Created 2 weeks ago

New!

512 stars

Top 61.0% on SourcePulse

GitHubView on GitHub
Project Summary

Summary

This project addresses critical inaccuracies in OpenClaw's lossless context management, specifically its token estimation for CJK languages and core reliability bugs. The lossless-claw-enhanced fork introduces CJK-aware token estimation, improving accuracy by up to 6x, and integrates essential upstream bug fixes. This ensures context window integrity, prevents data loss, and enhances agent reliability, particularly for users working with multilingual content.

How It Works

The enhancement replaces OpenClaw's default sliding-window compaction with a DAG-based summarization system. It persists all conversation messages in a SQLite database, summarizes older message chunks, and then condenses these summaries into higher-level nodes, forming a directed acyclic graph. A novel CJK-aware token estimation module replaces the upstream's ASCII-centric calculation, accurately mapping CJK characters to tokens (1.5 tokens/char vs. upstream's 0.25 tokens/char). Critical upstream bug fixes related to authentication errors, session rotation detection, and handling of empty/aborted messages are cherry-picked for improved production stability.

Quick Start & Requirements

  • Install: Clone and link: git clone https://github.com/win4r/lossless-claw-enhanced.git && openclaw plugins install --link ./lossless-claw-enhanced. Alternatively, use copy install: openclaw plugins install ./lossless-claw-enhanced.
  • Configure: Set contextEngine to lossless-claw in OpenClaw's plugin configuration.
  • Restart: openclaw gateway restart.
  • Prerequisites: An operational OpenClaw installation.
  • Dependencies: A configurable LLM for summarization is required.
  • Docs: Video tutorials are available: https://youtu.be/m21PNaIW3N4, https://www.bilibili.com/video/BV1MKXQBRE9d/.

Highlighted Details

  • CJK Token Estimation: Enhances token estimation accuracy for CJK text (6x improvement) and emoji/supplementary plane characters (4x), preventing context overflow and miscalculations.
  • Production Bug Fixes: Integrates critical upstream fixes for false-positive auth errors, session file rotation detection, and handling of empty/aborted messages, boosting reliability.
  • DAG Context Preservation: Implements a DAG-based summarization system that stores every message, enabling full recall and preventing data loss.
  • Recall Utilities: Offers lcm_grep, lcm_describe, and lcm_expand tools for agents to query and retrieve historical context.

Maintenance & Community

This project tracks the Martian-Engineering/lossless-claw main branch for upstream synchronization. No explicit community channels or contributor details are provided within the README.

Licensing & Compatibility

  • License: MIT.
  • Compatibility: The permissive MIT license supports commercial use and integration into closed-source projects.

Limitations & Caveats

The README does not detail specific limitations, alpha status, or known bugs. Functionality relies on an external LLM for summarization, introducing potential latency and operational costs.

Health Check
Last Commit

2 days ago

Responsiveness

Inactive

Pull Requests (30d)
6
Issues (30d)
10
Star History
521 stars in the last 15 days

Explore Similar Projects

Feedback? Help us improve.