Added Headroom evaluation summary + densification implementation notes. Cherry-picked the useful lossless densification for search_files.
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
# Headroom Evaluation & Densification Implementation for Hermes
|
||||
|
||||
**Source**: X post by @teknium (status 2067292705710031117) + detailed Hermes Agent self-evaluation.
|
||||
**Date**: 2026-06 (approx from context)
|
||||
**Status**: Partial integration - densification cherry-picked; CCR rejected.
|
||||
|
||||
## TL;DR
|
||||
Headroom (github.com/chopratejas/headroom) is a token compression proxy claiming 60-95% savings.
|
||||
For Hermes agent workloads (search_files JSON, multi-turn tool use, persistent context):
|
||||
- CCR (remove + <<marker>> + retrieve) is **net-negative** (duplication + cache disruption).
|
||||
- Lossless densification is **useful** (~60% on search_files per original eval).
|
||||
|
||||
**Action taken**: Implemented internal lossless densifier for search_files outputs (no external dep).
|
||||
|
||||
## Key Implementation
|
||||
File: `~/.hermes/profiles/leonard/scripts/densify_search_results.py`
|
||||
|
||||
```python
|
||||
def densify_search_results(result: dict) -> str:
|
||||
# Converts
|
||||
# {"total_count": N, "matches": [{"path":.., "line":.., "content":..}, ...]}
|
||||
# to
|
||||
# total:N
|
||||
# path|line|content
|
||||
# ./file.py|10|code here
|
||||
```
|
||||
|
||||
- Lossless (roundtrip parser included).
|
||||
- Escapes | and newlines.
|
||||
- Handles truncated, target fields.
|
||||
|
||||
## Measured Benefits (tests)
|
||||
- Small sample (6 matches): ~20% char savings.
|
||||
- Larger realistic (36 matches, long snippets): ~18% savings.
|
||||
- Expected higher on pure location searches or many short results (removes repeated JSON keys like "path","line","content" 100+ times).
|
||||
|
||||
Rough token impact: 15-30%+ reduction on search_files heavy paths (depends on content length vs structure).
|
||||
|
||||
## Why not full Headroom
|
||||
- CCR causes agents to re-retrieve → pay twice.
|
||||
- Breaks KV/prompt caching.
|
||||
- Conflicts with Hermes existing compression/memory.
|
||||
- Adds bloat/latency for our loop-heavy use.
|
||||
|
||||
## Replicable Ideas
|
||||
- Apply similar densification to other JSON tools (mcp_gitea responses, terminal structured output).
|
||||
- For search_files specifically: group by file or use minimal schema when context=0.
|
||||
|
||||
## Files
|
||||
- Densifier: `/home/vpsadmin/.hermes/profiles/leonard/scripts/densify_search_results.py`
|
||||
- Usage: After any `search_files(...)` call, `densify_search_results(result)` before injecting to context.
|
||||
|
||||
## Next
|
||||
- Test in live multi-turn sessions.
|
||||
- Add to agent tool response post-processing (optional flag).
|
||||
- Extend to other high-volume tools.
|
||||
- Monitor real token usage in daily briefs / opportunity scans.
|
||||
|
||||
See full evaluation in conversation history for details.
|
||||
Reference in New Issue
Block a user