Repository navigation
feat(cloud): move a chat between your Mac and the cloud with its memory - #167
Merged
Merged
Conversation
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
scripts/cloud/move-chat.ts moves a local Claude chat to an E2B box on the manager, carrying the checkout exactly as it is on disk and the agent's native Claude session, so the box continues the same conversation. The box imports the session with its own agent session importer, which also shows the history in T3. to-local pulls the box's session and workspace back. The cloud smoke now shares its RPC and pairing helpers with it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A moved agent lost every note, data dir and env file it had written or read outside its checkout. move-chat now finds those paths in the whole session record (main and subagent transcripts, tool inputs and outputs), carries the ones that are not code or tool config to the same absolute paths on the box within per-item and total caps, merges the repo's Claude memory, and tells the agent what came along and what did not. `carry` does the same for a box that was already moved; `--dry-run` prints the manifest only. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
andrewcai8
force-pushed
the
feat/move-chat-cloud
branch
from
October 5, 2026 16:33
d91d9c1 to
0e19f6b
Compare
…g URL never prints its token A finished or failed move's state is set aside, so a later move of the same chat no longer replays the old request and message ids against the old box. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…fect diagnostics Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moving a chat to the cloud used to mean pasting a summary into a new cloud chat. The agent lost its memory and had to rebuild context, and it got some of it wrong.
scripts/cloud/move-chat.tsmoves the chat 1:1. The box continues the same native Claude session, and the chat's history shows up in T3.Design
to-cloud --thread <local thread id> --message-file <first message>:handoff/move-<thread>-<commit>. The worktree, its index and its branch are left alone.environmentControl.provision, pinned to the same account and checked out at that branch. The chat's thread id is the one the box's importer will give the session.cwdrebased onto the box workspace. The box then runs its ownagentSessions.scanandagentSessions.import. That creates the thread bound to the native session and shows the last 200 messages.--resume <session id>.--include <path>copies local-only files such as.envinto the box workspace. They go through the E2B API and never touch git. The total is capped by--include-cap-mb.to-local --sandbox <id> --worktree <dir> --claude-config-dir <dir>reverses it. It snapshots the box workspace tohandoff/move-back-*, using the box server's git environment. It writes the box's session into the local Claude config dir withcwdrebased, keeping a backup of any existing file. Then it fetches the branch and prints theclaude --resumecommand. The local app is V1 and has no import, so the CLI is how you continue there.Re-running
to-cloudfor the same thread picks up where it stopped. The request id, command ids and message ids are kept in~/.t3/move-chat/<thread>.json. The transcript is only swapped in once.What it reuses from upstream
AgentSessionScannerandAgentSessionImporter(agentSessions.scanandagentSessions.import) build the thread, its visible history and its native thread binding.provider-session.detachcloses the header turn's CLI process. The next turn reopens it withresume, because a provider turn now exists.scripts/cloud/t3Rpc.ts, and the smoke now uses them too.Why the header turn
Today the V2 Claude adapter opens an imported thread's first turn with
sessionIdrather thanresume. It only resumes once a provider turn exists. Claude refuses a--session-idthat already has a transcript ("Session ID ... is already in use"). I checked this with the CLI. So the header turn creates a throwaway session under that id, the detach ends it, and the real history replaces it. A one-line adapter change would remove the header turn (resume when the provider thread came from an import). Boxes only pick that up after a host deploy, so it is left as a follow-up.Verified
The local "proactivity" chat moved to a new E2B box. The first cloud turn ran
claude ... --resume=b3bc7fd7-...and completed. Its reply named themind-trigger-consentbranch,/tmp/measure/snapshotsand pingdotgg#6499–pingdotgg#6629. All three appear in the local session and not in the earlier summary handoff.to-localwas run against the same box with a temporary config dir. It pushed the workspace snapshot and wrote a 6123-line transcript whosecwdfields point back at the Mac worktree.vp test run cloud/moveChat.test.ts cloud/turnProgress.test.tspasses. That covers Claude's project directory names, thecwdrewrite, GitHub remote parsing, and the snapshot (edits, deletions, untracked files, no ignored files, checkout untouched).Limits
state.sqlite).Ran with Claude Opus 5.5 (1M context) in Claude Code.
🤖 Generated with Claude Code
Carrying outside files (second commit). A moved agent also depends on files it used outside its checkout: design notes, measurement data, env files, and the repo's Claude auto-memory.
to-cloudnow finds them from the chat's own record (main and subagent transcripts plus saved tool outputs), skips git repos (reported with their remote), tool-config dot-dirs and anything over the caps, fills the budget smallest first, and extracts them on the box at the same absolute paths (the Mac home is linked to/home/user).carry --sandbox <id> --thread <id> [--dry-run]does the same for an already-moved chat. Used on 2026-10-05 to restore two chats on andrew.megpt.app (85 and 8 paths carried).