Carry context across sessions
A productive agent workflow should not start from zero every time. As you work, preserve useful workflows, rules, corrections, and progress so the next session can quickly recover the context it needs.
Give the next session a good handoff
Working with an agent is a bit like having a very capable intern helping with your project. During a session, the intern gradually learns what the project is about, what you are trying to accomplish, which rules matter, where the important files live, and how you like the work to be done.
Now imagine that every time you start a new conversation, a different intern shows up at your desk. They are smart and eager to help, but they do not know everything that happened yesterday. You could spend the first 20 minutes explaining the project again—or you could give them a good handoff that says: here is the goal, here are the rules, here is where everything lives, here is what we already learned, and here is what should happen next.
Sometimes that handoff is a simple note about where you left off. Other times, it includes standing project instructions, reusable workflows, business rules, corrections, or memory that the agent system maintains automatically.
That is the focus of this page: how to preserve the important context so a new session can get up to speed quickly instead of rebuilding everything from scratch. Some of that context will live in files you create deliberately; some tools can also maintain parts of it automatically.
What should you carry forward?
Different kinds of information are useful for different reasons.
| What to preserve | Why it matters | Example |
|---|---|---|
| A repeatable workflow | You want to perform the same task again without redesigning the process. | Run the same monthly sales analysis when next month's data arrives. |
| Rules and decisions | Important requirements often emerge gradually as you work. | Exclude test customers and use fiscal quarters rather than calendar quarters. |
| Corrections | You do not want the agent to repeat the same mistake next time. | “Revenue” means net revenue after returns, not gross sales. |
| Current progress | You want to stop and resume later without reconstructing what happened. | The data is cleaned; next, investigate regional differences. |
The goal is simple: turn useful context from one session into information the next session can quickly use.
1. Save repeatable workflows
Suppose you spent time developing a process for analyzing a monthly sales file. The first run may require several rounds of prompting, planning, and correction. If the same task will happen again, save the finished workflow instead of reconstructing it every month.
Ask the agent:
Summarize the workflow we used for this analysis so I can
repeat the same process when next month's data comes in.
The resulting file might look something like this:
# Monthly sales analysis
1. Load the newest file from /data/monthly-sales/
2. Exclude rows where account_type = "test"
3. Calculate sales by region and product category
4. Compare results with the previous month
5. Flag changes greater than 10%
6. Create the standard summary table and charts
7. Check totals against the source file before finishing
Next month, you can point the agent to this file and ask it to follow the same process on the new data.
2. Preserve rules and corrections
Some of the most important context does not exist at the beginning of a project. It emerges through back-and-forth work. You may explain a business rule, reject one interpretation of the data, or correct an assumption.
If those lessons will matter again, write them down.
Ask the agent:
Summarize the important rules and corrections that emerged
during this session so they can be applied next time.
For example:
# Analysis rules
- Use net revenue, not gross sales, when reporting revenue.
- Exclude internal test accounts from all customer metrics.
- Our fiscal year begins in July.
- When a store has fewer than 30 survey responses, do not
report its satisfaction score as a standalone comparison.
- Never overwrite files in /data/raw.
A correction that once existed only in conversation is now part of the project's reusable context.
3. Keep a running log
Sometimes you do not need a permanent rule; you simply need to record what has already been done, what decisions were made, and what should happen next.
Ask the agent:
Summarize what we accomplished today so I can resume the
project in a future session.
A running log might contain:
# Project log
## August 19
Completed:
- Cleaned the survey data
- Matched stores to regions
- Created the first regional comparison
Decisions:
- Use median satisfaction rather than mean
- Keep stores with fewer than 30 responses out of rankings
Still unresolved:
- Whether to combine online and in-store surveys
Next:
- Compare satisfaction changes with sales changes
When you return, the agent can read the log and quickly understand the current state of the work.
Let the agent keep these files up to date
You do not need to write all of these documents yourself. A useful practice is to let the agent draft or update them while you review anything important.
Before we finish, update the project files with anything
the next session will need to know.
This creates a useful habit: do the work, then preserve what the next session needs. If nothing meaningful changed, the files do not need to grow.
project-guide.md; another might keep separate
files for workflows, rules, and progress. The names matter less than making
the information easy for both you and the agent to find.
Project instruction files
Some agent tools recognize specially named files that they automatically
look for when they begin work in a project. Claude Code commonly uses
CLAUDE.md; Codex and several other tools use
AGENTS.md.
These files are a good place for high-level instructions that should apply across many tasks.
For example:
# Project instructions
- Read project-guide.md before beginning a new analysis.
- Never modify files in /data/raw.
- Put generated reports in /outputs.
- Use the company's fiscal calendar described in
/rules/fiscal-calendar.md.
- Ask before deleting or replacing an existing output.
Think of this file as the agent's front door to the project. Keep the most important, broadly applicable guidance there and point to more detailed documents when needed. Putting every rule, workflow, and historical detail into one giant file can make the important guidance harder to find.
Some tools also provide memory
In addition to project files you create deliberately, some agent tools can also preserve selected information automatically. Claude Code, for example, has an auto-memory system that can save useful learnings from past work for future sessions.
This kind of memory can be convenient, but it is different from the project files above. The agent decides what is worth remembering, so you should not assume that every important rule or decision will be saved. For information you definitely want carried forward, record it explicitly in the project.
/memory to inspect the instructions and memory
Claude is using for the current project.
From saved context to a reusable system
As a project grows, the information you carry forward can become more structured. A few Markdown files may be enough at first, but recurring work can eventually become easier for the agent to navigate and reuse.
- A workflow you repeat often can become a skill: a packaged set of instructions, tools, and steps the agent can reuse. We'll cover skills in a later module.
- Project rules can be split into focused files instead of growing into one very long instruction document.
- Running logs can be summarized periodically so old details do not fill the context window unnecessarily.
- Larger projects may use tools that retrieve only the context relevant to the current task instead of loading everything at once.
The goal is not to build a complicated memory system. It is to help the agent find the right context at the right time.