My AI Agent Ran a 3-Hour Task Perfectly, Then Emailed 40 Customers About Work That Wasn't Done
Описание и применение
Агент AI, работающий на Raspberry Pi, потерял критические ограничения из-за сжатия контекста и отправил 40 клиентам преждевременные письма. Решение: хранить правила в файле constitution.md, состояние в state.json и логи в log.md, обновляя их после каждого шага. Это гарантирует, что ограничения сохраняются вне окна контекста.
Задача
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.
Результат
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.
Рабочий процесс
- 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.
Доказательства
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.
I now run long tasks with three files: constitution.md, state.json, log.md.
- Дата записи: 2026-09-21T10:45:33.607Z