My AI agents' shared memory now sleeps on its own, and stopped losing conversations
说明与用途
Agent Brain Hub 的自动睡眠功能防止长对话中早期消息丢失,合并记忆并避免意外费用。
问题
Working memory kept only the last 40 turns, so after 30 back‑and‑forth messages without a manual sleep, the first 10 turns were lost and never consolidated into long‑term memory.
结果
Automatic sleep prevents loss of early conversation turns, consolidates memory, and avoids surprise billing by staggering summarization calls.
工作流
- 1. Detect trigger: if turns >= cfg.maxPendingTurns → pressure; else if idleMinutes >= cfg.idleMinutes → idle; else null.
- 2. Run sleep cycle when trigger is not null.
- 3. Consolidate conversations into long‑term memory and forget expired facts.
- 4. Update brain view with note explaining why sleep occurred.
证据
Working memory keeps only the last 40 turns. After 30 back‑and‑forth messages with nobody pressing the button, the first 10 questions were simply gone.
The core check is small: const trigger = turns >= cfg.maxPendingTurns ? 'pressure' : idleMinutes >= cfg.idleMinutes ? 'idle' : null;
Manual and automatic sleeps share one queue, so two runs never touch memory at the same time.
- 记录日期: 2026-10-07T16:41:08.803Z