← Insights

Memory compression preserves credentials, payloads, task IDs explicitly

Generic "summarize this conversation" loses the bits the agent needs to keep working. Mature systems enumerate preservation rules.

OpenHands (v0) difficulty 1/3 domain-knowledgeprompt-engineering memory-compression

The non-obvious lesson from every mature memory-compression implementation: generic summarization is useless. The summarizer must be told what to preserve, in domain-specific terms.

What the corpus preserves

ProjectDomainPreserved (explicitly)
OpenHandssoftware engineeringtask tracker IDs, file paths, in-progress action IDs, exact error messages
Strixpentestingvulnerabilities, credentials, payloads, scope/auth tokens, error messages
Claude Codecode editingfile metadata graph (paths read, paths written, hashes), tool args
Hermesgeneralfirst-turn charter, last 3-5 turns verbatim

Why preservation rules matter more than algorithm choice

You can use any summarization model. The differentiator is the prompt: a list of items the summarizer must keep.

You are summarizing an agent's session for memory compression.

PRESERVE EXPLICITLY (do not paraphrase, do not drop):
- Task tracker IDs and their statuses
- File paths the agent has read or written
- Exact text of error messages
- Tool arguments used (not just tool names)
- In-progress actions

COMPRESS LOOSELY:
- Agent's narration
- Repeated tool failures
- Casual conversation

The first list is the load-bearing part.

How to derive your preservation list

For your domain, ask: “if the agent forgets X mid-session, will it have to redo work or fail outright?” If yes, X is preserved.

For an agent that:

  • Writes code: preserve file paths, function signatures, last-known-good state.
  • Calls APIs: preserve auth tokens, request IDs, last response status.
  • Operates on a database: preserve transaction IDs, row counts, error codes.
  • Has a multi-step pipeline: preserve step state, checkpoint markers.

The preservation list is the agent’s domain model.

Anti-pattern

A “general purpose” summarizer prompt that says “keep important details.” This sounds polite and does nothing. The model can’t infer what’s important — that’s your job.

Sources

  • openhands/02-core-logic.md ? unverified
  • openhands-2/05-llm-integration.md ? unverified
  • strix/02_agent_and_llm.md:213 ? unverified