๐ช๐ต๐ ๐ฌ๐ผ๐๐ฟ ๐๐ ๐๐ด๐ฒ๐ป๐๐ ๐๐ผ๐๐ฒ ๐ง๐ต๐ฒ๐ถ๐ฟ ๐ ๐ฒ๐บ๐ผ๐ฟ๐
Your AI agent forgets everything after a few rounds.
You give it a problem. It asks questions. You answer. Then, it starts from scratch. It repeats questions you already answered. It ignores your previous rules. It contradicts its own logic from five minutes ago.
This is not an LLM bug. It is an architecture problem.
Most coding agents use subagents to do specific work. Every time the main agent calls a subagent, it creates a brand new session. There is no history. There is no context. There is no memory of what happened before.
The good news is that the tools you use already have the fix. They just do not use it by default.
How the problem works:
- A main agent calls a subagent using a task tool.
- The subagent works and then finishes.
- The next time you call that agent, it starts with a blank slate.
I looked into the source code of tools like OpenCode. I found that sessions already store everything. Every message and every reasoning step is saved in a database. Subagents cannot even delete their own sessions. They stay there, waiting.
The problem is indexing. The system knows the data exists, but the main agent does not know which session ID to reuse.
You can fix this with a simple handshake:
- Discovery: Find the correct task ID for a specific job.
- Scenario A (New): Call the agent, get a new task ID, and save it in a map.
- Scenario B (Resume): Look up the existing task ID in your map and pass it back to the agent.
When you pass the ID, the agent sees its entire history.
This gives you three major wins:
- Lower costs: You save tokens because the agent does not re-read things it already knows.
- Faster speed: You reduce latency by skipping repetitive tasks.
- Better accuracy: The agent builds on previous answers instead of starting over.
Industry leaders already use this pattern. LangGraph uses thread IDs for checkpoints. Temporal uses event history to resume workflows. Microsoft Agent Framework uses supersteps to save state.
You do not need new infrastructure. You just need a protocol to reuse the history you already have. Stop accepting fresh sessions every time. Use the session ID to keep your agents on track.
Optional learning community: https://t.me/GyaanSetuAi