hermes-agent/website/docs/user-guide/features
Teknium ea01bdcebe
refactor(memory): remove flush_memories entirely (#15696)
The AIAgent.flush_memories pre-compression save, the gateway
_flush_memories_for_session, and everything feeding them are
obsolete now that the background memory/skill review handles
persistent memory extraction.

Problems with flush_memories:

- Pre-dates the background review loop.  It was the only memory-save
  path when introduced; the background review now fires every 10 user
  turns on CLI and gateway alike, which is far more frequent than
  compression or session reset ever triggered flush.
- Blocking and synchronous.  Pre-compression flush ran on the live agent
  before compression, blocking the user-visible response.
- Cache-breaking.  Flush built a temporary conversation prefix
  (system prompt + memory-only tool list) that diverged from the live
  conversation's cached prefix, invalidating prompt caching.  The
  gateway variant spawned a fresh AIAgent with its own clean prompt
  for each finalized session — still cache-breaking, just in a
  different process.
- Redundant.  Background review runs in the live conversation's
  session context, gets the same content, writes to the same memory
  store, and doesn't break the cache.  Everything flush_memories
  claimed to preserve is already covered.

What this removes:

- AIAgent.flush_memories() method (~248 LOC in run_agent.py)
- Pre-compression flush call in _compress_context
- flush_memories call sites in cli.py (/new + exit)
- GatewayRunner._flush_memories_for_session + _async_flush_memories
  (and the 3 call sites: session expiry watcher, /new, /resume)
- 'flush_memories' entry from DEFAULT_CONFIG auxiliary tasks,
  hermes tools UI task list, auxiliary_client docstrings
- _memory_flush_min_turns config + init
- #15631's headroom-deduction math in
  _check_compression_model_feasibility (headroom was only needed
  because flush dragged the full main-agent system prompt along;
  the compression summariser sends a single user-role prompt so
  new_threshold = aux_context is safe again)
- The dedicated test files and assertions that exercised
  flush-specific paths

What this renames (with read-time backcompat on sessions.json):

- SessionEntry.memory_flushed -> SessionEntry.expiry_finalized.
  The session-expiry watcher still uses the flag to avoid re-running
  finalize/eviction on the same expired session; the new name
  reflects what it now actually gates.  from_dict() reads
  'expiry_finalized' first, falls back to the legacy 'memory_flushed'
  key so existing sessions.json files upgrade seamlessly.

Supersedes #15631 and #15638.

Tested: 383 targeted tests pass across run_agent/, agent/, cli/,
and gateway/ session-boundary suites.  No behavior regressions —
background memory review continues to handle persistent memory
extraction on both CLI and gateway.
2026-04-25 08:21:14 -07:00
..
_category_.json
acp.md
api-server.md
batch-processing.md
browser.md feat(browser): CDP supervisor — dialog detection + response + cross-origin iframe eval (#14540) 2026-04-23 22:23:37 -07:00
built-in-plugins.md
code-execution.md
context-files.md
context-references.md
credential-pools.md
cron.md feat(cron): per-job workdir for project-aware cron runs (#15110) 2026-04-24 05:07:01 -07:00
delegation.md
extending-the-dashboard.md docs(dashboard): document page-scoped plugin slots (#15662) 2026-04-25 06:59:24 -07:00
fallback-providers.md refactor(memory): remove flush_memories entirely (#15696) 2026-04-25 08:21:14 -07:00
honcho.md
hooks.md docs(plugins): correct pre_gateway_dispatch doc text and add hooks.md section 2026-04-24 03:02:03 -07:00
image-generation.md
mcp.md
memory-providers.md
memory.md
overview.md
personality.md
plugins.md docs(plugins): correct pre_gateway_dispatch doc text and add hooks.md section 2026-04-24 03:02:03 -07:00
provider-routing.md
rl-training.md fix(docs): Add links to Atropos and wandb in user guide 2026-04-23 03:07:06 -07:00
skills.md refactor(commands): drop /provider, /plan handler, and clean up slash registry (#15047) 2026-04-24 03:10:52 -07:00
skins.md
spotify.md feat(spotify): wire setup wizard into 'hermes tools' + document cron usage (#15180) 2026-04-24 07:24:28 -07:00
tool-gateway.md
tools.md
tts.md
vision.md
voice-mode.md
web-dashboard.md docs(dashboard): document page-scoped plugin slots (#15662) 2026-04-25 06:59:24 -07:00