hermes-lcm is a Lossless Context Management plugin for the Hermes Agent that replaces one-shot active-context compression with a SQLite-backed, DAG-based context engine. The problem it targets: when an agent's built-in compressor summarizes older conversation to keep the prompt bounded, the compacted turns are no longer in the active context verbatim and there is no structured drill-down path back to them. hermes-lcm keeps the live prompt bounded while persisting every raw message, so nothing is lost in normal operation: it stores messages in a plugin-local SQLite database with full-text search, compacts older context into depth-aware summary nodes, condenses those into a hierarchical summary DAG, and assembles the active context from the system prompt, highest-value summaries, and a protected recent tail.
The design is based on the LCM paper by Ehrlich and Blackman (Voltropy, 2026) and inspired by lossless-claw for OpenClaw. The agent gets recall tools — lcmgrep (search raw messages and summaries), lcmloadsession, lcmdescribe, lcmexpand, lcmexpandquery, lcmstatus, lcminspect, and lcmdoctor — with bounded, paginated responses so a retrieval call cannot flood the main prompt. Summaries retain source lineage down to the original raw messages, and oversized payloads keep stable references for later expansion.
Operational features include session and message-level noise filters, opt-in externalization of large tool outputs to files (with a guard that keeps base64 media blobs out of the SQLite store), opt-in redaction of sensitive patterns (API keys, bearer tokens, passwords, private keys) before storage — the one deliberately lossy path — backup-first repair and cleanup commands, an in-place "rotate" for long-running sessions, and an import script for backfilling OpenClaw/lossless-claw history. It targets Python 3.11+ with no required third-party runtime dependencies and is tunable for large context windows via a compaction-threshold setting.
