hermes - 💡(How to fix) Fix feat: Persist compression summaries to SQLite + temp_memory.md for cross-session memory continuity

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Every time Hermes compresses a long conversation, the compression summary (_previous_summary) is stored only in memory inside the ContextCompressor instance. This means compression summaries are lost on agent restart, no structured knowledge survives across sessions, and memory quality degrades with each compression cycle.

This feature request adds three-phase persistence to the compression lifecycle.

Error Message

temp_memory_warn_at: 2 # Warn to start new chat after N compressions Note: The "warn after 2 compressions" feature already exists at run_agent.py:10314 — this spec just makes it configurable and adds gateway support.

Root Cause

Every time Hermes compresses a long conversation, the compression summary (_previous_summary) is stored only in memory inside the ContextCompressor instance. This means compression summaries are lost on agent restart, no structured knowledge survives across sessions, and memory quality degrades with each compression cycle.

This feature request adds three-phase persistence to the compression lifecycle.

Code Example

compression:
  temp_memory_enabled: true     # Enable temp_memory.md generation  
  temp_memory_warn_at: 2        # Warn to start new chat after N compressions
RAW_BUFFERClick to expand / collapse

Summary

Every time Hermes compresses a long conversation, the compression summary (_previous_summary) is stored only in memory inside the ContextCompressor instance. This means compression summaries are lost on agent restart, no structured knowledge survives across sessions, and memory quality degrades with each compression cycle.

This feature request adds three-phase persistence to the compression lifecycle.

Phase 1: Compression Summary → SQLite

  • Add compression_summary TEXT and compression_count INTEGER columns to the sessions table in hermes_state.py
  • Save _previous_summary to the old session row before rotation in run_agent.py::_compress_context()

Phase 2: temp_memory.md Generation

During compression, write a structured temp_memory.md file at ~/.hermes/profiles/<profile>/memories/temp_memory.md containing:

  • Summary (from _previous_summary)
  • Key Facts (extracted from "Key Decisions" section)
  • Completed Actions (from "Completed Actions" numbered list)
  • Pending Actions (from "In Progress" section)
  • Active State metadata
  • Tags

Phase 3: Auto-Ingest on Session End

When chat ends (/quit, /new, natural exit):

  • Parse temp_memory.md into structured entries
  • Ingest into profile's memory.db (facts and sessions tables) via mem.py
  • Optionally also write to project-level memory.db
  • Archive the temp_memory file

Config Knobs

compression:
  temp_memory_enabled: true     # Enable temp_memory.md generation  
  temp_memory_warn_at: 2        # Warn to start new chat after N compressions

Files Changed

FileChange
hermes_state.pyAdd columns to sessions table
run_agent.pySave summary to SQLite; write temp_memory.md; finalize on exit
agent/context_compressor.pyExpose _parse_summary_sections() utility
hermes_cli/config.pyNew config defaults
cli.pyCall finalize_temp_memory() on session exit paths
gateway/run.pyCall finalize_temp_memory() on gateway session end

Note: The "warn after 2 compressions" feature already exists at run_agent.py:10314 — this spec just makes it configurable and adds gateway support.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING