Problem
When context compression triggers, early conversation turns are replaced with a summary. While the summary is well-structured (Goal, Progress, Decisions, Files, etc.), important details inevitably get lost — specific code snippets, error messages, configuration values, nuanced user preferences, and intermediate debugging steps.
The original conversation is stored in ~/.hermes/sessions/ and is searchable via session_search, but there's no mechanism connecting these two: the AI knows a section was compacted (thanks to the [CONTEXT COMPACTION — REFERENCE ONLY] prefix), but has no instruction to recover lost details when needed.
Proposal
When the AI encounters a compressed summary and finds it lacks specific information needed for the current task, it should be able to automatically search the original conversation to recover those details.
Suggested Implementation
-
System prompt addition — Add a rule in the system prompt:
When you encounter a [CONTEXT COMPACTION] section and find that specific details are missing (error messages, code snippets, exact values, commands, file paths), use session_search to recover the original information from past session transcripts.
-
Compaction metadata — When generating the summary, include the session context (timestamp range or session ID) so the AI can target its search more precisely:
[CONTEXT COMPACTION — REFERENCE ONLY]
[Original context: session 20260413_095900, turns 1-35]
...
-
(Optional) Explicit expansion trigger — The AI could annotate areas where it detected information loss during summarization:
[Compressed — details about X may be incomplete, search session for "X" if needed]
Why This Works
- All the building blocks already exist: compaction markers ✅, session storage ✅, session_search ✅
- It just needs to be wired together with a system prompt rule
- No architectural changes required — purely a prompt-level improvement
- Cost-effective: only triggers when the AI actually needs more detail, not proactively
Example Scenario
- User has a long debugging session (50+ turns)
- Compression triggers at 50% threshold, turns 1-30 become a summary
- Later, the AI needs a specific error message from turn 12
- Instead of guessing or asking the user to repeat, it runs
session_search("error message X") and recovers the exact text
Environment
- Hermes version: 2.1.104
- Context engine: compressor (default)
- Compression threshold: 50%
Problem
When context compression triggers, early conversation turns are replaced with a summary. While the summary is well-structured (Goal, Progress, Decisions, Files, etc.), important details inevitably get lost — specific code snippets, error messages, configuration values, nuanced user preferences, and intermediate debugging steps.
The original conversation is stored in
~/.hermes/sessions/and is searchable viasession_search, but there's no mechanism connecting these two: the AI knows a section was compacted (thanks to the[CONTEXT COMPACTION — REFERENCE ONLY]prefix), but has no instruction to recover lost details when needed.Proposal
When the AI encounters a compressed summary and finds it lacks specific information needed for the current task, it should be able to automatically search the original conversation to recover those details.
Suggested Implementation
System prompt addition — Add a rule in the system prompt:
Compaction metadata — When generating the summary, include the session context (timestamp range or session ID) so the AI can target its search more precisely:
(Optional) Explicit expansion trigger — The AI could annotate areas where it detected information loss during summarization:
Why This Works
Example Scenario
session_search("error message X")and recovers the exact textEnvironment