cd /news/ai-agents/keeping-your-ai-s-memory-in-the-repo… · home › topics › ai-agents › article
[ARTICLE · art-183007] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Keeping your AI's memory in the repository: work logs and commits that let work continue when the conversation breaks off

A developer describes keeping AI working memory in a Git repository rather than relying on chat history, storing dated work logs in docs/work-logs/ that record goals, considered and rejected options, decisions, completed work and next steps, with commits made at small breakpoints. The approach is meant to survive conversation endings, compaction of older exchanges into summaries, and switches between tools or accounts, since the AI can read the files and resume. The developer notes that logging rejected options is especially useful, because a fresh conversation otherwise tends to re-propose ideas already ruled out.

recommendation

Write dated work logs to docs/work-logs/ capturing goals, rejected options with reasons, decisions and next steps, and commit at small breakpoints so a new conversation can resume from the repository.

more in playbook: Designing agent systems
by read13 min views9 publishedDec 6, 2026

When you work with AI on something long, you run into moments where the AI doesn't remember what was decided in the previous conversation. Memory features and search over past conversations in AI tools can carry over some of that. But the AI decides what to keep, so the detail you need later isn't always there. And when older exchanges get replaced by a summary partway through a long conversation, the decision may survive while the reason behind it or the exact numbers drop out.

I keep what I want the AI to remember in a Git repository instead of relying on the conversation. If the work logs and change history are written to files, and commits are made at small breakpoints such as "finished fixing one file," the AI in the next conversation can read them and pick up where things left off. In this article I go through what I keep in which files, how small my commits are, and a hackathon example where I set things up so work could continue even on a different account.

When you rely on the conversation, the AI's memory breaks off in a few situations.

The first is when a conversation ends. Even in the same tool on the same account, the AI in a new conversation doesn't carry over the exchanges from the previous one as they were. What a memory feature keeps is the set of points the AI chose. Some tools let you search past conversations, but you may not find what you want unless you search with the words you used at the time. Even when you do find it, confirming what was decided and why means rereading the exchanges around it.

The second is when older exchanges get replaced by a summary partway through a long conversation (compaction). As a conversation grows, older exchanges are compressed into a summary so that everything fits in what the AI can handle. In that compression, details that didn't make it into the summary disappear. The conversation in which I am writing this series of articles, including this one, was replaced by a summary several times along the way. The summary still said "which article had progressed how far," but not which work log a number used in one article had come from, so I had to go looking through other records to confirm it again. The conversation the summary was made from still existed as a file, but digging the one line you need out of hours of exchanges was tedious work, even for the AI.

The third is when you switch tools or accounts. If you switch accounts depending on the purpose, or use a different tool for a particular kind of work, nothing from the previous conversation carries over at all.

In every one of these situations, memory that exists only inside the conversation is lost. It needs to be kept outside the conversation, in a place that can be read from any tool and any account.

In the private repository where I keep my instruction files and knowledge for AI, I keep three kinds of records as the AI's memory.

The first is work logs. Every time a piece of work ends, the AI creates a file in docs/work-logs/ named with the date and topic. I have it write what it set out to do (the background), which options it considered and which it passed on, why it chose the option it did, what got done, and what to do next. I have kept these work logs going since the work on the day I created the repository in February 2026.

Of these, keeping the options that were passed on has been especially useful. When the conversation changes, the AI sometimes brings back an option it had considered and passed on before, as if it were a new idea. If the passed-on options and the reasons are in the log, the AI can read why it passed on that option last time before proposing it again.

In the work log for applying some security-related updates, for instance, I had the AI put the options it considered in a table and write whether each was adopted or passed on. For one of those options, it wrote that it was passing on it this time for the same reason it had passed on the same option in work a month earlier. The AI didn't remember the conversation from a month ago, but it read the work log from that time and carried the same judgment forward.

The second is the change history. In the repository's CHANGELOG.md, the AI adds what each change to the instructions or knowledge was for. The Git history tells you what changed, and commit messages hold a short explanation too. But commit messages are scattered across individual changes and tend to end at a one-line heading. In the change history, I have the AI group entries by date and write down why something changed and what prompted it, so you can follow how things got here by reading one file. It is now over 1,200 lines. For example, when I consolidated the kinds of knowledge to keep from four to three, I had it write the following:

- agents/executive-assistant.md: Reduced the kinds in the required knowledge check from 4 to 3. Merged "client-specific" into factual information because the two overlap (noticed the overlap while reviewing an article)

Keeping the reason and what prompted the change, along with what changed, means that when I revisit that rule later I can think it over with the earlier judgment in view.

The third is commits. After writing the work log and the change history, the AI goes all the way to committing and pushing, every time. Getting these three in place is written as something that must always happen at the end of a piece of work, in the instruction file the AI always reads at the start of a conversation (the entry instruction file).

I described what goes into the entry instruction file in this article:

On top of these three, for frequent tasks, I keep an improvement log at the end of the procedure in each task's folder. If something was learned during that task, the AI adds a line at the end of the work. In the morning information-gathering task, for example, the AI once assumed it couldn't use the web search tool and skipped fetching the topics. The improvement log records that I added to the instructions that web search is a standard tool available from the start, so the same skip wouldn't happen again. The next time that task is requested, the AI reads this log along with the procedure, which makes it less likely to repeat the same mistake.

Each of the three records has its own use. When I want to start the next conversation from where the last one left off, I read the "what to do next" in the work log. When I want to know why a rule looks the way it does now, I read the change history. When I want to know exactly what changed, when, and how, I read the commits. When I want the AI to recall the previous work, it is enough to ask it to "read the work log from last time."

I don't commit only once at the end of a piece of work. I commit along the way too, every time a single file has been fixed. While writing a handful of articles, including this one, the commits passed 400. That works out to a commit for nearly every sentence I revised.

With small commits, you can trace one by one which change went in when. When polishing an article, the parts I fixed directly in my editor get mixed with the parts the AI fixed. So the rule is that the parts I fixed are committed separately, with a message that marks them as my edits, before the AI's fixes go in. Of those 400-plus commits, close to 40 are parts I edited directly without going through the AI. This way, when I look back later, I can tell which parts a person fixed and which parts the AI fixed. For the AI, too, it can check in the diff where and how I changed things before starting its next fix, so it never overwrites my changes.

Small commits also let you return to an earlier state when something goes wrong. In my instruction repository, 174 lines of important content in the entry instruction file once disappeared in a single change, but I pulled the content from before the deletion out of the Git history and rebuilt it. I wrote about this incident in detail in this article:

When I built Kokoroe, which I submitted to Built with Claude: Japan 2026, the records in the repository were especially useful for work that spanned conversations. During this hackathon, in the final stretch of the project, I kept Claude Code reviewing the project every 15 minutes through the night.

https://github.com/ikenyal/kokoroe

These reviews ran on a scheduled job (cron) inside a Claude Code session. Because the scheduled job is tied to the session, it has to be recreated whenever you restart Claude Code or continue the work on another account. So that a new session could start and pick up where the last one left off, I had Claude Code write a handoff file, docs/HANDOFF.md.

At the top of this file is the following sentence:

A new session (even on another account) starts here. It remembers nothing; this file, CLAUDE.md and the logs are the memory.

Besides the current state and the rules for running the reviews, I had the file hold the request to paste in when recreating the scheduled job, the time to stop working, and the things waiting on my decision. I had the AI update it with every review.

I also had the review rules written out concretely. The review perspectives were split into four and rotated one per round, and the log ended with which perspective the previous round had covered. Perspectives that actually ran things in the production environment cost API fees, so they were limited to once an hour, with a cap on cost per round and per day. I also decided that large rewrites would not be done on the spot; they would be written into the log as things for me to decide. Reading this file was enough for the AI in a new session to know what it could and could not do, without any conversation history.

That night the reviews kept running for hours and found three real bugs. Among them were a bug that only happened on the production screen, and a blank of about 10 seconds where the screen showed nothing during a slow process. At the start of each review, the AI read the handoff file and the end of the log, checked how far the previous round had gotten, and then continued from there.

There were failures too. In one round, it committed even though two tests were failing. The command that ran the tests only displayed the results and didn't stop on failure. It was noticed and fixed right away, and from then on a commit could not be made unless the tests passed; this was also written into the log. Because the records and commits were kept in small pieces, I could quickly confirm what had happened and fix it within a few minutes.

So that whether records get kept doesn't depend on the mood of the moment, I have a fixed signal for writing them. When I say something that marks the end of the work, such as "thanks," "that's it," or "commit this," the AI writes the work log, the change history, and the task improvement log, and goes on to commit and push. This procedure is packaged as a skill, and the skill is loaded when one of those end-of-work phrases comes up.

The records are mainly written for the AI in the next conversation to read. So the standard I use for how to write them is that "you can pick up where things left off even without the conversation history." The entry instruction file states the idea that "as long as these records and commits are in place, the AI in the next conversation can keep improving things without the conversation history." Something that came across as "that thing earlier" in the conversation won't reach the next AI unless the record says what that thing was.

I have the AI write the records, and I only read and check them. If a person had to write them every time, it wouldn't last, but having the AI write them costs almost no effort. If a record says something that isn't true, I fix it when I notice.

Recent AI tools have features that summarize conversations or remember information about the user. I use them too, and I find them convenient. But much of what these features keep is a summary of what the AI judged important. You can't decide yourself what gets kept, and details can drop out.

There is also a limit to how much can be carried over to the next conversation. Claude Code, for example, has an auto memory feature where Claude writes its own notes and carries them over to the next conversation. According to the official documentation, these notes are loaded in every conversation, but only the first 200 lines or 25KB.

https://code.claude.com/docs/en/memory

I use memory features and the repository for different things. Preferences about how I want answers, such as showing only what to do right now first when walking me through steps, are kept in the memory feature too. On the other hand, the full set of writing style rules lives in the style guide in the repository and is not in the memory feature. Short things like preferences that I want reflected in every conversation go into the memory feature, and things that are large and need to be accurate go into the repository.

That is why anything I want to reread accurately later goes into the repository: what was decided and why, the numbers used in the work, and where those numbers came from. When I write articles, I reread these records as primary sources. The date and line count of the incident where 174 lines disappeared from the entry instruction file also came from the change history and the Git history.

If you think of summaries and memory features as making it easier to start a conversation, and the repository records as something to check against later, it becomes easier to decide what goes where.

Since I started keeping the AI's memory in the repository, the way I start conversations has changed. Even when continuing from a previous conversation, I don't have to explain again how far things got and what is left. With the work logs, the change history, and the commits, the AI reads them and picks up where things left off.

This setup works the same way even when the AI model, the tool, or the account changes. The records are just text files, so any AI can read them. While a long conversation loses more detail to summaries the longer it goes on, the records in the repository keep growing as the work piles up, and they will keep becoming clues for the next conversation.

This is Day 7 of "A Year with AI," a 25-day advent calendar I am writing on my own. See Day 0 for what the series covers. The original Japanese version is on Zenn.

── more in #ai-agents 4 stories · sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/keeping-your-ai-s-me…] indexed:0 read:13min 2026-12-06 · —