<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/your-agent-s-working-memory-is-probably-dropping-turns-mine-was--eummzloyr" -->

---
title: Your agent's working memory is probably dropping turns....
description: A developer describes a bug in their open-source shared memory system for AI agents, Agent Brain Hub, where working memory capped at 40 turns silently dropped...
canonical: https://daily.dev/posts/your-agent-s-working-memory-is-probably-dropping-turns-mine-was--eummzloyr
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Your agent's working memory is probably dropping turns. Mine was. | daily.dev
og:description: A developer describes a bug in their open-source shared memory system for AI agents, Agent Brain Hub, where working memory capped at 40 turns silently dropped...
og:url: https://daily.dev/posts/your-agent-s-working-memory-is-probably-dropping-turns-mine-was--eummzloyr
og:image: https://api.daily.dev/og/posts/EuMmZLoyr.png
og:image:alt: Your agent's working memory is probably dropping turns. Mine was.
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Your agent's working memory is probably dropping turns. Mine was.

**[AI](https://daily.dev/sources/ai)** · [@smoky1496](https://daily.dev/smoky1496) · 2 min read · 1 upvotes · 4 comments

## Summary

A developer describes a bug in their open-source shared memory system for AI agents, Agent Brain Hub, where working memory capped at 40 turns silently dropped early conversation turns because consolidation only ran on manual trigger. Version 0.2.0 fixes this with three automatic sleep triggers (idle, pressure, nightly), a shared queue to prevent concurrent consolidation, staggered first-run scheduling to avoid LLM call bursts, and a note that Docker containers need a TZ setting for nightly runs to align with local time. The project is MIT licensed and works with any LLM or offline.

## Content

I'm building Agent Brain Hub, an open-source memory that several AI agents share. It's modeled on the human brain: a short-term working memory, long-term facts and episodes, and a sleep cycle that moves one into the other.

**The bug.** Working memory keeps the last 40 turns. Consolidation (turning turns into long-term episodes) only ran when someone pressed "Run sleep cycle". So after 30 back-and-forth messages, the first 10 questions were silently gone. They were never summarized and never recallable by any agent. I only noticed while writing a test for something else.

**The fix: let the brain sleep on its own.** As of v0.2.0 there are three triggers:

- **Idle:** the user has been quiet for 30 min, so the session is over. It's the same gap the brain already uses to start a new session.
- **Pressure:** 24 turns are waiting. That's below the 40-turn cap, so nothing gets dropped.
- **Nightly:** once a day for users active since the night before.

During sleep, the hippocampus groups turns into session episodes (LLM summary, or a template offline), forgetting prunes expired facts and decays unused episodes, and a reflection step writes insights. Reflection never reads private-scope episodes, so health or income details don't leak into shared insights.

Some details that mattered more than I expected:

- Manual and automatic runs share one queue, so two consolidations never touch the same memory at once.
- On first start the scheduler doesn't sleep every user at once. With a paid LLM that would be a burst of summarization calls.
- Docker runs in UTC, so "03:00" needs a `TZ` setting to mean your night.

It's MIT, runs with any LLM (or offline), and every sleep shows up live in a brain visualization with the reason it fired.

I'm curious how others handle this. Do you consolidate per session, keep a rolling summary, or just let the context window decide?

👉 https://github.com/leluong141996-dev/Agent-Brain-Hub

## Community discussion

Top comments from developers on daily.dev.

**@ahmetozel** · 1 upvotes

> The pressure trigger at 24 turns leaves sixteen turns before the forty-turn cap, but that is headroom rather than a guarantee. A slow summarization call or a shared queue backlog can let another sixteen turns arrive before the sleep cycle finishes.
>
>
> I would retain unconsolidated turns until an episode has actually been stored, tracking the last committed turn sequence separately from the scheduled work. If the live buffer must stay bounded, spilling pending turns to a durable log is safer than dropping them. A burst test with a deliberately delayed summarizer would check the boundary that...

**@bickov** · 1 upvotes

> How does consolidation handle a turn that carries a screenshot? An LLM summary of that turn tends to keep "user sent a screenshot of an error" and lose the error text. OCR on device (Tesseract, macOS Live Text, [Windows.Media](http://Windows.Media).Ocr, SlimSnap) before the sleep cycle would keep that text in the episode. Private-scope images also never go to a paid LLM just to get summarized.

## Similar posts on daily.dev

- [Why Multi-turn Agents Need More Than a Task Graph](https://daily.dev/posts/why-multi-turn-agents-need-more-than-a-task-graph-hgt6tvawy) · Daily Dose of Data Science \| Avi Chawla \| Substack · 5 upvotes · 0 comments
- [I gave my local agent a real memory, and it finally stopped forgetting everything between sessions](https://daily.dev/posts/i-gave-my-local-agent-a-real-memory-and-it-finally-stopped-forgetting-everything-between-sessions-ydrcjuzoj) · XDA Developers · 0 upvotes · 0 comments

---

Tags: [#open-source](https://daily.dev/tags/open-source), [#llm](https://daily.dev/tags/llm), [#ai-agents](https://daily.dev/tags/ai-agents), [#docker](https://daily.dev/tags/docker)

[View this post on daily.dev](https://daily.dev/posts/your-agent-s-working-memory-is-probably-dropping-turns-mine-was--eummzloyr)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/your-agent-s-working-memory-is-probably-dropping-turns-mine-was--eummzloyr","headline":"Your agent's working memory is probably dropping turns. Mine was.","text":"A developer describes a bug in their open-source shared memory system for AI agents, Agent Brain Hub, where working memory capped at 40 turns silently dropped early conversation turns because consolidation only ran on manual trigger. Version 0.2.0 fixes this with three automatic sleep triggers (idle, pressure, nightly), a shared queue to prevent concurrent consolidation, staggered first-run scheduling to avoid LLM call bursts, and a note that Docker containers need a TZ setting for nightly runs to align with local time. The project is MIT licensed and works with any LLM or offline.","url":"https://daily.dev/posts/your-agent-s-working-memory-is-probably-dropping-turns-mine-was--eummzloyr","datePublished":"2026-10-09T06:21:43.874Z","dateModified":"2026-10-09T06:21:59.151Z","author":{"@type":"Person","name":"Lượng Lê","url":"https://daily.dev/smoky1496","image":"https://media.daily.dev/image/upload/s--LsBXrQbv--/f_auto/v1791387179/avatars/avatar_ZKLbQ1ROTXM8EJ7PZv383?_a=BAMAMicg0","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":20}},"image":"https://media.daily.dev/image/upload/s---lw_9G6J--/f_auto/v1791388417/posts/A3aHQw9f0?_a=BAMAMicg0","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":4}],"comment":[{"@type":"Comment","text":"The pressure trigger at 24 turns leaves sixteen turns before the forty-turn cap, but that is headroom rather than a guarantee. A slow summarization call or a shared queue backlog can let another sixteen turns arrive before the sleep cycle finishes.\nI would retain unconsolidated turns until an episode has actually been stored, tracking the last committed turn sequence separately from the scheduled work. If the live buffer must stay bounded, spilling pending turns to a durable log is safer than dropping them. A burst test with a deliberately delayed summarizer would check the boundary that the normal idle trigger never exercises.","datePublished":"2026-10-09T06:42:45.793Z","url":"https://daily.dev/posts/EuMmZLoyr#c-9keI7gUST","author":{"@type":"Person","name":"Ahmet Özel","url":"https://daily.dev/ahmetozel","image":"https://avatars.githubusercontent.com/u/70992231?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}},{"@type":"Comment","text":"How does consolidation handle a turn that carries a screenshot? An LLM summary of that turn tends to keep “user sent a screenshot of an error” and lose the error text. OCR on device (Tesseract, macOS Live Text, Windows.Media.Ocr, SlimSnap) before the sleep cycle would keep that text in the episode. Private-scope images also never go to a paid LLM just to get summarized.","datePublished":"2026-10-09T07:33:13.083Z","url":"https://daily.dev/posts/EuMmZLoyr#c-7apL16P6p","author":{"@type":"Person","name":"ab","url":"https://daily.dev/bickov","image":"https://lh3.googleusercontent.com/a/ACg8ocKwOmJ31UWqM4ZXB5ms-yRdFR4BYzyb7FPBRpg1O6DV0MIAF2EP=s96-c"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/squads/ai","name":"AI"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"AI","item":"https://daily.dev/squads/ai"},{"@type":"ListItem","position":3,"name":"Your agent's working memory is probably dropping turns. Mine was."}]}
```

