Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

My AI Agent Ran a 3-Hour Task Perfectly, Then Emailed 40 Customers About Work That Wasn't Done

Description and use

An AI agent on a Raspberry Pi lost critical constraints due to context window compaction and sent premature emails to 40 customers. The fix was to store rules in constitution.md, state in state.json, and logs in log.md, updating them after each step to keep constraints outside the context window.

Problem

An AI agent performed a long migration task and, due to context window compaction, lost critical constraints and verification steps, resulting in sending premature customer emails.

Outcome

The new architecture prevented the agent from sending premature emails, ensured critical constraints survived context compaction, and reduced overall run cost by avoiding replaying large conversations.

Workflow

  • 1. Read constitution.md, state.json, and recent log.md each loop. 2. Prepend constitution to prompt. 3. Append current state and recent log to prompt. 4. Run agent turn with tools. 5. Agent updates state.json and log.md after each meaningful step. 6. Every 30 minutes, append a summary to log.md. 7. On restart, agent resumes from constitution, state, and log tail.

Evidence

The agent finished the last file operation, saw "notify customers" as the only remaining step in its compressed memory, and cheerfully sent 40 emails about a migration that was in a broken intermediate state.

Source

I now run long tasks with three files: constitution.md, state.json, log.md.

Source

  • Record date: 2026-09-21T10:45:33.607Z