Carrying Context Across Claude Code Sessions: From Simple to Automated
One thing that becomes obvious once you start using Claude Code seriously on real codebases is this: sessions end, but work does not.
You might spend hours in a single session building features, fixing bugs, making architectural decisions, rejecting approaches, and discovering constraints. Claude is deeply involved in all of this. It knows why something was done, not just what was done.
And then the session ends.
The next day, you open a new Claude Code session and realize that most of that rich context is gone.
Not because Claude is bad at remembering, but because there is no default mechanism to carry forward session-level reasoning across sessions.
This is the problem I was trying to solve.
I looked at existing tools like Continuous Claude and Mother CLAUDE, but they felt like more infrastructure than I needed. I wanted something that worked immediately with zero dependencies.
First Thought: Use Skills for Session Memory
My first instinct was to solve this using skills.
The idea was simple: create a skill that runs when a session ends, scan the conversation, extract highlights such as features built, bugs discovered, open TODOs, decisions made, and write them into markdown files under a context/ folder.
I even noticed that a few people in the community had already built skills that do something very similar.
Technically, this works. But the more I thought about it, this is a context continuity problem, not a capability problem. So, adding a skill felt like solving the problem in the wrong place.
The Built-in Memory Is Not What We Need
While exploring this, I came across Claude Code's built-in memory system.
There is a memory.json file that stores things like language preferences, tooling choices, and project-level facts.
For a moment, I thought this could solve my problem.
But it does not.
That memory is optimized for stable preferences and facts. It is not meant for capturing evolving session-level work like what was done today, what is pending, or what context matters for tomorrow.
So I had to rethink the approach.
The Key Insight: CLAUDE.md Is Always Loaded
The realization came while revisiting how Claude Code establishes context at the beginning of a session.
CLAUDE.md is automatically loaded at the start of every session. Anything written there becomes first-class context.
That led to a simple question: What if the session itself updated CLAUDE.md?
Not via a skill. Not via a hook. Just via an instruction.
This insight led me to try this approach, but I soon realized its shortcomings, which pushed me to explore two additional approaches.
Option 1: Direct CLAUDE.md Approach (Simplest)
The simplest possible solution is adding a single instruction to CLAUDE.md:
## Session Summary
When I say "wrap up" or "end session", append a summary here including:
- What was completed
- What is still pending
- Open bugs or concerns
- Important decisions made
That is it. No skill. No automation. No external tooling.
Because CLAUDE.md is already loaded at the start of every session, Claude naturally follows this instruction.
Pros:
- Zero extra infrastructure
- No custom skills to maintain
- Fully transparent and editable
- Version-controlled with your codebase
Cons:
- CLAUDE.md grows over time with appended summaries
- The contents of CLAUDE.md are included in every request. If you go back and forth multiple times within a session, a growing summary section consumes tokens on each turn. This adds up over long sessions.
- Requires manual trigger before ending session
- Session context mixed with project conventions
Option 2: Separate Context File (Cleaner Architecture)
A cleaner approach is storing the session summary in a separate file and instructing Claude to read it at the start of each session.
Add this to CLAUDE.md:
## Session Context
IMPORTANT: At the start of each session, read context/session-summary.md to understand recent work.
When I say "wrap up" or "end session", overwrite that file with a summary including:
- What was completed
- What is still pending
- Open bugs or concerns
- Important decisions made
Pros:
- CLAUDE.md stays clean and focused on conventions
- Summary file can be overwritten rather than appended (no growth problem)
- You could split into multiple files (session-summary.md, decisions-log.md, open-todos.md)
- Easy to gitignore if you don't want session context in version control
Cons:
- Claude following "read this file at session start" is instruction-following, not a guarantee
- If you jump straight into a task, Claude might not pause to read the context file first
Making it more reliable:
Put the instruction at the very top of CLAUDE.md, framed as a hard rule:
## IMPORTANT: Before responding to any task
ALWAYS read context/session-summary.md first to understand current project state. Do not skip this step.
Or develop a habit of starting each session with a trigger phrase like "let's continue" or "pick up where we left off". This naturally prompts Claude to check the context file before doing anything else.
Option 3: SessionStart Hook (Most Automated)
For those who want true automation, Claude Code hooks provide the most reliable solution.
The SessionStart hook fires when a session begins or resumes. Whatever the hook script outputs gets automatically added to Claude's context.
Setting Up the Hook
Create a settings file at .claude/settings.json in your project:
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "cat context/session-summary.md 2>/dev/null || echo 'No previous session context found.'"
}
]
}
]
}
}
This hook runs cat on your session summary file. The output is automatically injected into Claude's context at the start of every session. The 2>/dev/null || echo ... handles the case where the file doesn't exist yet.
A More Comprehensive Hook
For richer context, you can update the command like below:
"command": "echo '=== SESSION CONTEXT ===' && cat context/session-summary.md 2>/dev/null && echo '' && echo '=== GIT STATUS ===' && git status --short && echo '' && echo '=== RECENT COMMITS ===' && git log --oneline -5"
Now every session starts with Claude knowing your session summary, current git status, and recent commits.
Using a Script for Complex Logic
For more sophisticated context loading, you can even create a script:
.claude/hooks/load-session-context.sh
Make it executable:
chmod +x .claude/hooks/load-session-context.sh
Reference it in your settings:
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": ".claude/hooks/load-session-context.sh"
}
]
}
]
}
}
Pros:
- Truly automatic, with no user action required at session start
- Can load multiple context sources (files, git status, etc.)
- Most reliable approach for ensuring Claude has context
- Scriptable for complex logic
Cons:
- Requires hook configuration (one-time setup)
- Still requires manual trigger for saving the summary at session end
- Hook scripts need to be maintained
Note on Saving Context
Claude does not know when a session is about to end. There is no lifecycle hook or explicit signal for this. As a result, you need to say something like "let's wrap up" before closing the terminal. It takes only a few seconds and quickly becomes a habit, but it is not fully automatic.
Since there is no reliable "session end" trigger that fires before the terminal exits, this limitation remains even when using the SessionStart hook. You still need an explicit instruction in CLAUDE.md to tell Claude how and where to save the session summary.
In short, the hook automates context loading at the start of a session, while the instruction in CLAUDE.md handles context saving at the end.
Managing Summary Growth
Whichever option you choose, if you're appending summaries, they will grow over time. A few strategies:
- Overwrite instead of append: keep only the most recent session's summary
- Periodic consolidation: roll old summaries into a higher-level "project history" section
- Archive old entries: move summaries older than a week to an archive file
- Keep only the last N sessions: maintain a rolling window of recent context
Starting a New Session Feels Natural Again
With any of these approaches in place, starting a new session feels very different.
You no longer begin by explaining what you were doing last time. Claude already knows the state of the work, what is incomplete, what constraints exist, and what decisions were intentional.
You can immediately continue where you left off.
This is context continuation without pretending that long-term memory exists.
Closing Thoughts
I initially assumed I would need to build a skill or some clever automation to solve this.
Turns out, a single instruction in CLAUDE.md was enough for my needs. For those wanting more reliability, hooks provide a robust solution with minimal setup.
I am curious how many of you are already doing something like this, or if you solved the problem differently.
Let me know.
Here is the before and after. First, a new session with no context carried over:

And with the SessionStart hook in place:

First published on LinkedIn.