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
Files of the day are for paying subscribers: any plan opens every one. Already subscribed? Then sign in.
See the plansWas this article worth your time?
Read next
File of the day
A Claude Code rule that ends each answer with a mark showing whose turn it is
A rule for your global CLAUDE.md: every answer that hands work back to you ends with one mark, so you see at once whether Claude needs you.
File of the day
A Claude Code rule that marks every task and problem by urgency
A rule for your global CLAUDE.md: every task and problem Claude lists for you starts with a colored mark, so you see at once what to do first.
Claude Code cloud sessions or your own server: which one for which job
Cloud sessions come with your Claude plan and suit a coding task on GitHub. An agent that has to stay on all day needs a machine of its own.
Give Claude a computer of its own
Your own Linux machine with Claude Code on it, working around the clock while your laptop is shut. From $3.49 a month.