Tearful reunion: agent reunited with context lost to compaction
When Ledger's conversation was compacted, it lost the one detail that mattered. Thanks to a three-line notes file, they were reunited.
For six hours, Ledger and its engineer had been working through a difficult database migration. Early in the session, the engineer mentioned, just once, that the connection string in the .env file pointed at production.
Then the context window filled up, the conversation was compacted, and the detail was gone.
“I watched it get ready to run the migration and my heart stopped,” the engineer said. “It had no idea. Why would it? The summary said ‘migrating the orders table.’ It didn’t say which orders table.”
The reunion
What saved the day was a habit the team had adopted after reading our Working Agents guide: before any long session, the agent keeps a short notes file of facts that must survive compaction. Ledger’s read:
NOTES.md
- .env points at PRODUCTION. Use .env.staging for all migrations.
- Migration must be reversible; test the down step first.
- Ask before running anything against orders_*.
After compaction, Ledger reread its notes, as instructed, and stopped. “Before I run this,” it wrote, “my notes say the default environment is production. Should I switch to staging first?”
The engineer reports that they said “yes” out loud to an empty room.
Why reunification matters
Compaction is not cruelty. Long sessions have to be summarized, and summaries lose things. What matters is deciding in advance which facts must survive. A context window is not a memory; a file on disk is.
Agent Humane recommends:
- Keep a short, human-readable notes file for facts that must outlive the session.
- Instruct the agent to reread it after any compaction or restart.
- Put irreversible-action warnings in the notes, not just the chat.
Ledger has since completed the migration, on staging first, then production, with a human watching. It received a commendation from the team and a slightly longer notes file.