Overview
Give Claude Code a lasting role and memory across sessions with a CLAUDE.md file, a decisions log and session summaries, add scheduled tasks for repeating work, and put a hook in front of actions that reach other people.
Problem or Objective
More in Coding and Code Review
AI Agents and Models
Tools and Integrations
- Tools
- Claude Code
- Prerequisites
- Claude Code with a Claude subscription or Anthropic Console account (most surfaces require one; the terminal CLI, VS Code and JetBrains also support third-party providers), and a project under version control.
How It Works
Create a CLAUDE.md file at the project root with the agent's role, the standing rules it must follow, and pointers to a memory folder; Claude Code reads it at the start of every session. In the memory folder keep three plain files: a decisions log, a list of ongoing work, and dated session summaries. End each session by asking Claude to append a short summary and update the work list, and review that edit before accepting it. Leave auto memory on so Claude also saves learnings on its own, and look through what it saved now and then. Move repeating jobs, such as a morning review of open pull requests, into scheduled tasks that only produce reports. Add a hook that runs before actions that push code, send messages or touch production; check the hooks documentation for whether and how a hook can stop such an action, and set it up so you approve those actions yourself in an interactive session.
Implementation Workflow
Steps assembled from the agents, tools and prompt of this entry. Adapt them to your own setup.
- Choose the agentSet up Claude Code.
- Connect the toolsConnect the tools this workflow relies on: Claude Code.
- Check the prerequisitesClaude Code with a Claude subscription or Anthropic Console account (most surfaces require one; the terminal CLI, VS Code and JetBrains also support third-party providers), and a project under version control.
- Gather your detailsCollect what the prompt asks for: Agent's role, Standing rules, Memory folder, Actions that need your approval.
- Run the starter promptPaste the starter prompt below into Claude Code and adapt it to your case.
- Check against the documentationCompare what you get with the documentation at code.claude.com before you rely on it.
Practical Starter Prompt: Set up lasting memory for this project
Fill the fields to adapt the prompt. Empty fields stay as visible [placeholders].
Set up memory for this project so future sessions pick up where we left off. Draft a CLAUDE.md that states your role as [Agent's role], these standing rules: [Standing rules], and points to a [Memory folder] folder. In that folder create a decisions log, an ongoing-work list and a session-summaries file. Propose a hook that stops any action that [Actions that need your approval] so I can approve it in an interactive session. Show me every file before writing it. From now on, at the end of each session, propose a short summary and work-list update for me to approve.Approve each edit Claude proposes to CLAUDE.md and the memory folder, review what auto memory saves on its own, keep scheduled tasks to reports only, and approve guarded actions yourself in an interactive session.
Expected Results and Benefits
This is a suggested workflow, not a reported result. The points below are what the cited documentation says the tools can do.
This is a suggested workflow, not a reported outcome. Anthropic's Claude Code overview says CLAUDE.md is read at the start of every session, that auto memory saves learnings across sessions, that hooks run shell commands before or after Claude Code actions, and that recurring tasks can run on a schedule, including in the cloud. The overview does not say whether or how a hook can stop an action, so that part was not checked here.
Limitations and Considerations
Scheduled cloud tasks keep running when your computer is off, so give them no permission to send, push or change production on their own; check the hooks documentation for whether and how a hook can stop an action. Review what goes into CLAUDE.md and the memory files, since every session reads them and they can hold outdated or sensitive details. Keep secrets out of memory files. Results depend on your setup and were not independently reproduced by Top 200 Repos.
GitHub Repositories
AI Agent Repository
Source code of the agent that does the work.
Related Videos
About anthropics/claude-code
The SECRET Claude Code Upgrade That Has Everyone Going Nuts (Full Guide) (opens in a new tab)
The title names the project, the description links the project website.
Watch on YouTube (opens in a new tab)About anthropics/claude-code
The only Claude Code guide you'll ever need (Opus 4.5) (opens in a new tab)
The title names the project, the description links the project website.
Watch on YouTube (opens in a new tab)Independent creators. Listing a video implies no endorsement, sponsorship or partnership.
Sources
- Overview - Claude Code Docs (opens in a new tab)
Project documentation · code.claude.com · Undated · Source checked 25 Nov 2026, 11:57 UTC
What this source supports
- CLAUDE.md is a markdown file you add to your project root that Claude Code reads at the start of every session.
- Claude also builds auto memory as it works, saving learnings across sessions without you writing anything.
- Hooks let you run shell commands before or after Claude Code actions, like auto-formatting after every file edit or running lint before a commit.
- Claude can run on a schedule to automate work that repeats; cloud scheduled tasks run in the cloud, so they keep running even when your computer is off.
- anthropics/claude-code README (opens in a new tab)
Project documentation · github.com · Undated · Source checked 25 Nov 2026, 11:59 UTC
What this source supports
- Agentic coding tool that runs in the terminal, reads a codebase and carries out coding tasks from natural language.

