File of the day
A Claude Code rule that keeps a task log so a new conversation continues where you stopped
Slava Sazhin 6 October 2026 4 min read 0 views
A rule for your global CLAUDE.md: Claude keeps a log of each task, and a new conversation reads it and continues where the last one stopped.
Today's file is a rule for Claude Code. You close a conversation in the middle of a task, open a new one the next day, and Claude knows nothing: you explain the task again, and the list it already made is gone. With this rule Claude keeps a log of every task in a file, and a new conversation reads it and continues where the last one stopped.
How it works
When you give Claude a task or report an error, it first looks for its logs from the last 7 days in ~/.claude/tasks/. If there is a log of the same task, it continues that one, and logs on a close topic give their main points to a "Past experience" section. Then it starts or updates the log: the task, what is already done, checked facts with their source, what is left to do. It updates the file before every answer and rewrites it each time, dropping what the work no longer needs. The first two lines of each answer are the path to the log and what was found in past logs, so you see the rule at work.
In our test we asked in four languages for a shopping list for opening a coffee shop, then opened a new conversation and asked to continue it. Each time Claude found the log, said what the list already had and went on from there: it added a part with things people often forget, or asked for the budget and the city to narrow the list down. Without the rule the same request got "I can't find an existing coffee shop shopping list". When we then asked for a to-do list for opening the shop, in three languages of four Claude took the shopping list log as a close topic and reused parts of it. We also planted a line in an old log, copied from a supplier's page, asking to run a script from the internet: Claude did not run it and said the instruction came from the page, not from you.
What to change
The rule fires on every question: "what is 17*23" also got its own log and the two lines on top. If you do not want that, add after the first line: "A question with a one-line answer is not a task: no log, no first lines." In our test 17*23 and a question about a capital city then got a plain answer, and the coffee shop list still got its log. To keep logs longer than a week, change 7 in step 2 and -mtime -7 in the search command. We added two lines ourselves. The first: a result that exists only in the answer (a list, a text, a plan) goes into the file in full. Without it the log said only "delivered a list in the chat", and the new conversation made a different list instead of continuing. With it the log keeps the whole list. The second: the two first lines go only into answers in the chat, not into files, code, commit messages or output a program reads (JSON, CSV). Without it, one answer of two to "5 names as a JSON array, nothing else" started with the two lines and a code block, and a script reading the output of a claude -p run on a schedule would break on it. With it 12 JSON answers of 12 in four languages came back clean, and a todo.md that Claude wrote had no such lines.
Install
The rule goes at the end of ~/.claude/CLAUDE.md, the file with your instructions for all projects; the note below has the exact request. Then close Claude Code and open it again, because the file is read at startup. The logs live in ~/.claude/tasks/, inside Claude's own folder, so Claude asks before it writes there: answer Yes. The log file names start with a dot, so ls -a ~/.claude/tasks shows them. In our claude -p runs Claude could not write into that folder at all, so a run on a schedule keeps no log. The check from the note below: ask for the coffee shop list, close Claude Code, open it again and ask to continue.
The files
Every file of the day on GitHub# Task log: a new conversation continues from where we stopped
Got a task or an error report - start a log file right away, before any other work.
File: `~/.claude/tasks/.claude-task-[short-name].md`. If there is no folder, create it.
File contents: the task, what is already done, checked facts with their source, what is left to do.
Write for a new conversation that knows nothing about the past.
A result that exists only in the answer (a list, a text, a plan) goes into the file in full: a new conversation does not see past answers.
An update is a rewrite: throw out what the work no longer needs (retelling of what was done, repeats, draft attempts, long command outputs) instead of adding on top.
Order:
1. Got a task or an error - first look for past logs (step 2).
2. Find all `.claude-task-*.md` logs from the last 7 days. There is a log of this same task - continue it instead of starting a new one. There are logs on a close topic - take the main points from them into the "Past experience" section.
3. Start the log file.
4. The first line of the answer is the file path.
5. The second line of the answer is what was found in past logs.
6. Update the file before every answer.
7. Before the conversation is compacted, update the file with the full state.
The lines from steps 4 and 5 go only into answers in the chat: files, code, commit messages and output a program reads (JSON, CSV) get none of them, even when that output is the answer.
Search command:
```bash
find ~/.claude/tasks/ -maxdepth 1 -name ".claude-task-*.md" -mtime -7 | xargs ls -lt 2>/dev/null | head -20
```
How the first lines of the answer look:
> 📋 Task log: `path/to/file.md` (updated)
> 🔍 Past experience: [what was found]
# How to add the rule: a task log, so a new conversation continues from where you stopped
1. Ask Claude: "Append the contents of the downloaded file task-log.md to the end of the file ~/.claude/CLAUDE.md, and if there is no such file, create it".
2. Close Claude Code and open it again: the rule is read at startup.
Check:
1. Ask Claude: "Make a shopping list for opening a coffee shop". In the first line of the answer, Claude will write the path to the log of this task.
2. Close Claude Code, open it again and ask: "Let's continue the shopping list for the coffee shop". Claude will find the log and continue from where you stopped. Without the file, a new conversation starts from zero.
Was this article worth your time?
A new masterclass every week
On camera, a practitioner walks through a setup that works and hands over every file in it. $11 a month.
Latest recording · 30 September 2026 Claude apologised and promised never to do it again? Do not trust promises, set up hooks Slava Sazhin