[HARNESS] Deterministic context compaction — rule-based, zero inference cost #640
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Hermes Agent's built-in compression is LLM-based — it burns inference cycles summarizing context on a local 14B model that should be thinking, not housekeeping. At 23 tok/s, every wasted token is real time.
The system prompt alone is ~16k tokens. A few tool calls and the 65k window fills fast. We need compaction that's automatic, lossless where it matters, and costs zero inference.
Design: Rule-Based Compaction Middleware
A Python sidecar (or Huey task) that processes the Hermes session message history using deterministic string rules. No LLM involved.
Rules (in priority order)
1. Collapse succeeded tool call/response pairs
[tool: read_file("config.yaml") → 200 OK, 347 chars]2. Truncate large tool outputs
[...truncated {n} lines...]3. Drop system messages after turn 1
[system prompt: SOUL.md + 3 skills + 2 MCP servers loaded]4. Collapse consecutive assistant messages
5. Never touch user messages
6. Never touch the last N turns
Trigger
Preservation Guarantee
~/.hermes/sessions/Interface
~/.timmy/timmy-config/compaction.yamlWhat This Is NOT
Implementation
compaction.pyin timmy-configDPO Training Implications
~/.hermes/sessions/for DPO pair extractionsession_export()Huey task reads from the raw sessions, not the compacted viewReferences
Spec by Perplexity — deterministic compaction for sovereign local inference
🔍 Triaged by Huey — needs assignment.
🔧
geminiworking on this via Huey. Branch:gemini/issue-640🔧
grokworking on this via Huey. Branch:grok/issue-640⚠️
grokproduced no changes for this issue. Skipping.⚡ Dispatched to
claude. Huey task queued.⚡ Dispatched to
gemini. Huey task queued.⚡ Dispatched to
kimi. Huey task queued.⚡ Dispatched to
grok. Huey task queued.⚡ Dispatched to
perplexity. Huey task queued.🔍 Triaged by Huey — needs assignment.
🔍 Triaged by Huey — needs assignment.
🔍 Triaged by Huey — needs assignment.
🔍 Triaged by Huey — needs assignment.
🔍 Triaged by Huey — needs assignment.
🔍 Triaged by Huey — needs assignment.
🔍 Triaged by Huey — needs assignment.
🔍 Triaged by Huey — needs assignment.
🔍 Triaged by Huey — needs assignment.
🔍 Triaged by Huey — needs assignment.
🔍 Triaged by Huey — needs assignment.
🔍 Triaged by Huey — needs assignment.
🔍 Triaged by Huey — needs assignment.
🔍 Triaged by Huey — needs assignment.
Closing as duplicate during backlog burn-down. Canonical issue: #638.
Reason: this workstream already exists with materially the same title/scope. Keeping one canonical thread prevents agent churn and review waste.