[HARNESS] Deterministic context compaction — rule-based, zero inference cost #638
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.
⚡ 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.
🔧
geminiworking on this via Huey. Branch:gemini/issue-638🔧
grokworking on this via Huey. Branch:grok/issue-638⚠️
grokproduced no changes for this issue. Skipping.🔍 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 during the 2026-03-28 backlog burn-down.
Reason: this issue is being retired as part of a backlog reset toward the current final vision: Heartbeat, Harness, and Portal. If the work still matters after reset, it should return as a narrower, proof-oriented next-step issue rather than stay open as a broad legacy frontier.