Menu

1 / 2

How I built memory for Claude Code and Codex: inject little, let them pull the rest

DEV Community: productivity·Dinesh Rajendran·about 15 hours ago
#hwBqePZH
#devtoproductivity#devto#dev#agent#session
Reading 0:00
15s threshold

Agent memory works best when it's on a diet: inject only what the agent can't find out for itself, and let it ask for the rest.

Key findings

Inject only what a coding agent can't find out for itself: decisions and rejected approaches, where you stopped, and what happened outside the agent. Let it pull the rest through MCP tools.

In 9,470 tool calls from my Claude Code transcripts, agents called memory tools 42 times. The median call returned about 160 tokens.

Cap every pushed item in code, label it as history rather than instructions, and keep it byte-stable so the prompt cache survives.

Picture a Monday morning. You open a fresh Claude Code session on a project you worked on all of last week and type, "Let's finish the export bug."

The agent does what a good engineer new to the codebase would do. It reads the README. It greps for "export". It opens the same six files it opened on Friday.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.