stephenschoettler/hermes-lcm
Lossless Context Management plugin for Hermes Agent — DAG-based context engine that never loses a message
What it solves
hermes-lcm addresses the problem of "lossy" context compression in AI agents. Standard compression typically prunes old messages or summarizes them into a single block, causing the agent to lose access to the exact, verbatim details of earlier conversation turns. This project provides a lossless context management system that keeps the active prompt bounded while ensuring no information is ever permanently deleted.
How it works
The plugin replaces standard one-shot compression with a SQLite-backed, DAG-based (Directed Acyclic Graph) context engine. It operates through several key mechanisms:
- Persistence: All raw messages are stored in a local SQLite database with Full-Text Search (FTS) metadata.
- Hierarchical Summarization: Older context is compacted into "depth-aware" summary nodes. As these accumulate, they are condensed into a hierarchical DAG, allowing the agent to navigate from high-level summaries down to specific details.
- Bounded Assembly: The active prompt is constructed from the system prompt, the most valuable summaries, and a protected "fresh tail" of recent messages.
- Recall Tools: The agent is given a suite of tools (e.g.,
lcm_grep,lcm_recall,lcm_expand) to search, inspect, and retrieve exact raw messages or child summaries without flooding the main prompt. - Externalization: Oversized payloads (like large tool results) are moved to recoverable references to prevent them from crowding the context window.
Who it’s for
It is designed for users of the Hermes Agent who require long-term memory and the ability for their agents to autonomously recover precise historical data during complex, multi-turn interactions.
Highlights
- Lossless Memory: Raw messages are preserved and recoverable even after the active prompt is compacted.
- Summary DAG: Uses a hierarchical structure for summaries to maintain source lineage and depth-aware retrieval.
- Comprehensive Toolset: Provides 15 specialized tools for searching, recalling, computing over evidence, and diagnosing database health.
- Source-Aware Retrieval: Filters raw rows and summaries based on descendant source lineage.
- Flexible Controls: Includes options for sensitive-pattern redaction, temporal memory rollups, and semantic retrieval via embeddings.
Related
- Project
- Project
- Dispatch
- Project