How to Switch Between Cursor and Claude Code Mid-Task Without Losing Context: A Real Case Study
Switching from Cursor to Claude Code loses your context. Here are the commands that carry tasks, notes and verified test runs across, plus a real handoff log from my own repo.
On this page
- Quick answers
- Why do you lose context when you switch between Cursor and Claude Code?
- What actually goes wrong when you switch tools mid-task?
- 1. The second agent redoes finished work
- 2. A half-finished edit is read as the intended design
- 3. "All tests pass" was never true
- 4. A green result goes stale
- 5. A constraint disappears
- 6. A dead end gets explored again
- 7. The two tools follow different rules
- How do I switch without losing context? (the manual method)
- Step 1: Stop at a clean point if you can
- Step 2: Save the code state
- Step 3: Run the tests and write down the result
- Step 4: Write the handoff note
- Step 5: Start the second agent with a prompt that makes it check first
- Step 6: Keep the note updated as the second agent works
- Where the manual method falls short
- How can I automate the handoff with PCSKit?
- Set up once
- While you work in the first tool
- Before you switch
- In the second tool
- Case study: a real handoff from Claude Desktop to Cursor
- What this shows
- What this does not show
- What should I check before I switch?
- How do I check that a handoff is trustworthy?
- FAQ
- Can I switch between Cursor and Claude Code in the middle of a task?
- Does Cursor read what Claude Code did?
- What is the minimum I should write down?
- Should I commit before switching?
- Do I need PCSKit to do this?
- Do I need hooks?
- What if the first agent stopped without writing a handoff?
- Is my code sent anywhere?
- Does it work with other agents?
- Sources
To switch between Cursor and Claude Code mid-task without losing context, write down six things outside the chat: the task, what is done and how you know, what is in progress, what failed, what must not change, and the exact next step. Then make the second agent check that note against the repo before it continues.
Last updated: November 24, 2026 · Written by Kumar, founder of Causly. Disclosure: I build PCSKit, an open-source tool that automates the method below. The manual method works without it.
Quick answers#
| Question | Short answer |
|---|---|
| Does a Cursor chat carry over to Claude Code? | No. Each tool keeps its own conversation. The second tool only sees your files and its own instruction files. |
| What breaks when you switch? | Progress, intent, test status, constraints and failed attempts. They live in the chat, not in the code. |
| What should you write down? | Task, done (with evidence), in progress, failed attempts, do-not-touch, next step. |
| Can I do this by hand? | Yes. A template and a prompt for the second agent are below. |
| Can it be automated? | Yes. PCSKit records the same things while agents work. See the section after the manual method. |
| Did I test it on a real repo? | Yes, Claude Desktop then Cursor. The log, and its limits, are in the case study. |
Why do you lose context when you switch between Cursor and Claude Code?#
Both tools are good at reading your project. Neither can read the other's conversation.
- Claude Code keeps its own history.
claude -ccontinues the most recent Claude Code conversation in the current directory, andclaude -rresumes one by ID or name (see the CLI reference). Neither imports a chat you had in Cursor. - Cursor keeps its own chats too, so the reverse is also true.
- Each tool has its own instruction files (
CLAUDE.md,AGENTS.md,.cursor/rules). Those tell an agent how to behave. They do not say what happened in the last session.
So when you switch, the second agent gets two things: the files in your repo, and whatever you type into its first message. Everything the first agent learned, decided or tried is gone unless you carry it across.
What actually goes wrong when you switch tools mid-task?#
These are the failure modes I see most. The examples are illustrative scenarios, not logs from a specific project. The case study further down is the real log.
1. The second agent redoes finished work#
Example: In Cursor you ask the agent to move input validation into a shared validate.ts. It finishes three of the four endpoints. You switch to Claude Code and type "continue the validation refactor."
What happens: Claude Code sees four endpoints, one still with inline validation, and nothing that says which were done on purpose. It may redo all four, or add a second helper next to the first.
Why: The finished state is in the files. The intent and the progress are in the chat. The code shows what exists, not what was meant to be left alone.
2. A half-finished edit is read as the intended design#
Example: The first agent renamed getUser to fetchUser in three files and was about to do the fourth. The build is red. You switch.
What happens: The second agent sees the red build and the mixed names. With no context, "fix the error" can mean reverting the rename, or adding an alias so both names work. Either one undoes the plan.
Why: An uncommitted diff tells you what changed, not why or where it was heading.
3. "All tests pass" was never true#
Example: The first agent's last message says: "Implemented the export flag, all tests pass." You switch. The second agent builds on it, runs the tests, and three fail.
What happens: Now nobody can tell whether the first agent broke something, the claim was wrong, or the second agent's change caused it.
Why: A summary written by an agent that is running out of room is a claim. It may be accurate, or it may describe tests that never ran. A claim cannot be checked after the fact unless the command and result were recorded.
4. A green result goes stale#
Example: Tests passed at the start of the session. After that, two more files changed. The note says "tests passing."
What happens: The second agent trusts the note and skips running the tests, then ships a regression.
Why: A test result is true only for the exact code it ran against. Once the code changes, the result no longer describes it.
5. A constraint disappears#
Example: Early in the first chat you said, "Keep the CSV column order. A downstream script depends on it." The second agent decides to tidy the columns alphabetically.
What happens: Nothing in the repo or the new chat says why the order matters, so the change looks like an improvement.
Why: A rule you said once, in passing, lives only in that conversation.
6. A dead end gets explored again#
Example: The first agent spent forty minutes finding that a library's streaming API drops the last chunk on Windows, and switched to a different approach. The second agent proposes the streaming API, because it is the obvious choice.
Why: Failed attempts leave no trace in the code. Only the chat remembers them.
7. The two tools follow different rules#
Example: "Run the linter before every commit" is written only in CLAUDE.md.
What happens: Each tool reads its own instruction files, so a convention that exists in only one of them gives the other no reason to follow it.
Why: Instruction files are per tool, and they are easy to let drift apart.
The real log below touches problems 1 and 5: the second agent did not repeat finished work, and it left unrelated local changes alone.
How do I switch without losing context? (the manual method)#
You do not need any special tool for this. You need a note that is written down outside the chat, and a second agent that checks the note before trusting it.
Step 1: Stop at a clean point if you can#
Finish the function you are in, or at least get the code back to a state that compiles. It is much easier to hand over a stable state than a half-edited one.
Step 2: Save the code state#
Commit the work on a branch, even if it is rough:
git switch -c wip/export-flag
git add -A
git commit -m "WIP: export flag, handing off to another agent"
A commit is easy to find and easy to diff against. git stash is also an option, but a stash is hidden and easy to forget.
Step 3: Run the tests and write down the result#
Run the test command yourself, or ask the agent to, and note three things: the exact command, whether it passed, and the commit it ran on. This turns problem 3 and problem 4 into something checkable.
Step 4: Write the handoff note#
Put it in a file in the repo (for example HANDOFF.md) or anywhere both tools can read. This template covers the seven problems above:
## Task
What we are building, in one or two sentences.
## Done (with evidence)
- Parse --json option. Evidence: `npm test` passed on commit a1b2c3d.
- Update help text. No test run. Claimed done, not verified.
## In progress
- Wiring the flag into src/cli/export.ts. Uncommitted changes in that file.
Intended end state: the flag is read in parseOptions and passed to toJson().
## Tried and failed
- Streaming the output: drops the last chunk on Windows. Do not retry.
## Do not touch
- CSV column order. A downstream script depends on it.
## Next step
1. Finish wiring the flag in src/cli/export.ts.
2. Add a test for the JSON output.
## How to run tests
`npm test`
Notice that "Done" says what the evidence is, and that "in progress" says where the work was heading. Those two lines prevent most of the damage.
Step 5: Start the second agent with a prompt that makes it check first#
Read HANDOFF.md. Do not edit anything yet.
First run `git status` and `git diff --stat`, then run `npm test`.
Compare what you see with the note and list any differences.
Then continue from "Next step".
The important part is "check first." The note is a starting point, not proof. If the tests do not match what the note says, you want to find out before the second agent builds on it.
Step 6: Keep the note updated as the second agent works#
When it finishes a piece of work, ask it to update the note. That way the next switch starts from a current record.
Where the manual method falls short#
It works, but it has weak points:
- It depends on you remembering to do it, every time.
- If the agent writes the note, you are back to a claim written under pressure (problem 3).
- Test results go stale (problem 4) unless someone ties them to the exact code state.
- It is slow enough that people skip it when they are in a hurry, which is exactly when they switch.
How can I automate the handoff with PCSKit?#
PCSKit (Project Continuity Kit) is an open-source command line tool and MCP server that does the same steps and records the evidence itself. It stores its data in a .pcs/ folder inside your project, with no network access and no telemetry.
Here is how each manual step maps to a PCSKit command:
| Manual step | PCSKit |
|---|---|
| Write down the task | pcs task add "..." |
| Save the code state | A snapshot of git state and file hashes is taken when a session starts and ends |
| Run tests and record the result | pcs test --task <id> -- <command>. PCSKit runs the command and records the exit code and the code state |
| Record constraints and failed attempts | pcs note add avoid "..." and pcs note add issue "..." |
| Write the next step | pcs note add next "..." |
| Write the handoff | pcs session end --reason switched --note "...", then pcs handoff |
| Check before continuing | pcs resume |
Set up once#
npm install -g @knihal/pcskit
cd your-repo
pcs init
pcs connect claude-code
pcs connect cursor
pcs agents install
pcs hooks install
pcs doctor
pcs connectregisters the MCP server with each tool, so the agents can call PCSKit directly.pcs agents installadds a marked block toCLAUDE.md,AGENTS.mdand.cursor/rules, so both tools get the same instructions (this addresses problem 7).pcs hooks installis for Claude Code. Its sessions then start, checkpoint and end by themselves. Cursor and Claude Desktop connect through MCP tools, so the agent, or you, ends the session explicitly.
While you work in the first tool#
pcs task add "Add the --json flag to the exporter"
pcs test --task 1 -- npm test
pcs note add avoid "Do not change the CSV column order"
pcs note add next "Wire the flag into the CLI entry, then add tests"
A task counts as verified only when a passing test run that PCSKit executed is linked to it, and only while the code still matches the state that run saw. This is how PCSKit handles problems 3 and 4.
Before you switch#
pcs session end --reason switched --note "where you stopped"
pcs handoff
In the second tool#
The agent calls pcs_resume through MCP, or you run:
pcs resume --agent cursor
If no agent is connected, pcs resume --prompt prints a takeover prompt you can paste in. Resume runs its own checks first: whether the log is intact, whether the handoff file matches what PCSKit wrote, and whether the repo has moved since the handoff. Every line of the brief is labelled verified (PCSKit saw it), reported (a person or agent said it) or inferred (derived from other facts).
Case study: a real handoff from Claude Desktop to Cursor#
This is a real log from my own repo, causly-server, recorded on November 13, 2026. I use Claude Desktop as my main agent. The second agent ran inside Cursor with a Grok model. Both were connected to PCSKit through MCP.
The task: add a short Troubleshooting section to the README.
| Time (UTC) | Who | What the log shows |
|---|---|---|
| 06:10:12 | Claude Desktop (session 1) | Session starts. Task created and moved to in_progress. |
| 06:10:31 | Claude Desktop | Finds the README already has a ## Troubleshooting section (a 9-row table). Does not add a duplicate. Marks the task blocked, waiting for me to decide whether to extend it. |
| 06:13:32 | PCSKit | A new session starts before session 1 was ended. PCSKit records session 1 as interrupted, tagged inferred. |
| 06:13:51 | Cursor (session 2) | Moves the task from blocked back to in_progress, noting it is checking whether the section already exists before editing. |
| 06:14:22 | Cursor | Confirms the section exists. No second section added. Marks the task done. |
| 06:14:23 | Cursor | Adds a next note: no README edit needed, and leave the two unrelated local changes (packs/manifest.json and a generated release file) alone. |
| 06:14:31 | Cursor | Session ends as completed. |
The second session took about a minute and the log has 15 events. I re-checked the repo afterwards: the README still has exactly one Troubleshooting section, and the two unrelated local changes are still there, untouched.
What this shows#
- The second agent did not repeat work (problem 1). The first agent had already found the section. The blocked task and its note were where the second agent started.
- It checked instead of trusting. Its first recorded action was to look at the README itself before editing.
- Unrelated changes were left alone (problem 5). The do-not-touch idea carried across.
- A dropped session is labelled, not hidden. Session 1 was never ended, and PCSKit marked it
interruptedwith theinferredtag instead of pretending it finished.
What this does not show#
I want to be straight about the limits:
- The correct outcome was to do nothing. No code changed and no tests ran, so there is no
verifiedevidence linked to the task. PCSKit would list it asreported, notverified. - No
HANDOFF.mdwas generated in this run. The second agent worked from the recorded task state and notes. - It was Claude Desktop and Cursor, not Claude Code. Claude Code connects the same way (
pcs connect claude-code), but I have not recorded a Claude Code run, so I am not claiming one. - The agent name in the log is free text that the agent supplies. In session 2 the labels read
grokandcursor. That is why those lines are taggedreported.
It is a small real test, not a benchmark.
What should I check before I switch?#
A short checklist you can use with or without any tool:
- Does the code compile, or have I said exactly why it does not?
- Is the work committed, so the second agent can diff against it?
- Did I run the tests, and did I write down the command, the result and the commit?
- Is there a "do not touch" list?
- Is there a list of what was tried and failed?
- Is the next step specific enough that someone else could start on it?
- Did I tell the second agent to check the note against the repo before editing?
How do I check that a handoff is trustworthy?#
Do not rely on the wording of the note. Rely on what can be checked: the repo state, a fresh test run, and the diff. With PCSKit, run pcs verify. Events are stored in an append-only SHA-256 hash chain, so edits, deletions and reordering are detected. A claim an agent made is still only labelled reported, so if you need proof, link a test run PCSKit executed.
FAQ#
Can I switch between Cursor and Claude Code in the middle of a task?#
Yes, if the project's state lives outside the chats. Write down the task, what is done and how you know, what is in progress, what failed, what must not change and the next step, then have the second agent check that against the repo.
Does Cursor read what Claude Code did?#
Not by itself. They keep separate conversations. A shared record in the project, such as a handoff note or the PCSKit log, is what both can read.
What is the minimum I should write down?#
The task, the next step, and what must not change. If you have time for one more thing, add the test command and its result.
Should I commit before switching?#
It helps. A commit gives the second agent something exact to diff against. If the code is rough, commit it on a WIP branch.
Do I need PCSKit to do this?#
No. The manual method above works with any tools. PCSKit automates the recording and adds checks, such as labelling what was verified and detecting edits to the log.
Do I need hooks?#
Hooks are for Claude Code (pcs hooks install). For Cursor and Claude Desktop, the agent or you end the session with pcs session end.
What if the first agent stopped without writing a handoff?#
PCSKit builds one from the evidence log and marks the interrupted session as inferred. With the manual method, you can still reconstruct state from git status, git diff and a fresh test run.
Is my code sent anywhere?#
No. PCSKit is local-first, with no network access and no telemetry. Data stays in .pcs/ inside your project.
Does it work with other agents?#
It works with any MCP client (pcs mcp).
Sources#
- CLI reference, Claude Code docs
- PCSKit docs · GitHub
- causly-server (the repo used in the case study)
Get new posts by email
High-signal notes on AI, automation and building systems. No spam.