Build a Claude Code agent with memory and identity

A developer kept a Claude Code agent persistent across sessions by loading memory and identity at start and saving updates at the end.

Done with Claude Codeยท Advancedยท Mar 2026

What they did
Justin Headley connected a Claude Code agent through Telegram and set it up so each session began with memory and an identity already in place, then ended by shutting the agent down. He had the agent handle much of its own setup, including a session manager, layered memory, and reloading its identity after restarts or compaction. A separate AI checked outgoing actions like emails and pushes before they were sent, and the agent also had email access and scheduled jobs.
How it went
After four months, the agent, Dawn, had run 59 scheduled jobs and interacted with more than 470 people. It also carried out a week-long open source collaboration he had not known about. On Feb. 22, one session wiped production data, which was later restored from a backup that was four days old.
Tips
A single-file memory setup can overflow working memory quickly, so keep the memory system compact and layered. If the agent can send messages or make changes, add a review step before anything is sent or applied.

Try it yourself with Claude Code

In [project folder], help me set up a persistent agent named [agent name] with a short identity note covering [role], [working style], and [current goals]. Create a memory system that loads at the start of each session, updates during the work, and saves a concise summary of decisions, completed tasks, and open items when the session ends. Before you send emails, push changes, submit forms, delete files, or make any other irreversible change, pause and ask for my approval. When I start a new session, use the saved memory to tell me where we left off and what should happen next.

Fill in the [brackets]. Agents can make mistakes, so review anything before it is sent, paid or deleted.

Read the original on dev.to โ†—

Get 3 agent uses like this every morning

With the day's top AI news. Free, and one click to unsubscribe.