{"slug": "moving-one-deepseek-harness-session-to-another-machine-without-breaking-it", "title": "Moving one DeepSeek Harness session to another machine without breaking it", "summary": "A developer built Handoff, an MIT-licensed CLI that moves a DeepSeek Harness (DSH) session file between machines by rewriting the absolute cwd recorded in the session's first frame, from which DSH derives both the session's folder location and its workspace entry. The tool copies referenced attachments deduplicated by sha256, updates workspace.json first, and handles divergent copies with a byte-prefix test rather than timestamps, writing non-matching incoming files alongside the existing session. The developer reports two bugs found only on the receiving machine — an apply path that read its mapping from a flag instead of the config file, and a status check that trusted a stale session.lock — both now covered by exit-code recording and an lsof probe.", "body_md": "A DSH session file is not portable on its own. Copy it to another machine and one of two things happens: the app refuses it, or it opens into an empty group and no longer knows which project folder it belongs to.\n\nThe reason is one field. The first line of `session.v4.jsonl.zstd` records an absolute working directory:\n\n```\n{\"type\":\"session\",\"version\":4,\"id\":\"session-…\",\"cwd\":\"C:\\\\Knowledge base\",\"agentPreset\":\"standard\"}\n```\n\nDSH derives two things from that string: the folder the file must live in (`sessions/--<projectKey>--/<id>/`) and the workspace it belongs to (an entry in `storages/workspace.json`). Change machines, and that string is wrong. Fix the string, and both follow.\n\nI built a small CLI around that single fact. It is called [Handoff](https://www.dshtoolbox.com/tools/handoff/), it is MIT, and it moves the session plus the attachments it references.\n\n`cwd` rewritten — body frames are copied byte for byte`attachments/v1/`, deduplicated by sha256` workspace.json` first\nWhat does not move: credentials, profiles, skills, scheduled tasks, and any file the session did not reference.\n\nDeciding what to do when both machines have the same session and both appended to it. Timestamps turned out to be useless (clocks, time zones, resumed machines). The files are append-only frame sequences, so the honest test is a prefix test: if one file is a byte prefix of the other, that one is older. No prefix, no merge — the incoming copy is written next to yours as `session.…incoming-<stamp>` and both are kept.\n\nI broke my own tool twice while testing it on a real pair of machines (Windows and macOS), and both failures were only reproducible on the receiving side.\n\n`apply` read the path mapping from a flag instead of the config file. The auto-receive path passes only `--home` and `--yes`, so the mapping was empty and every macOS-to-Windows transfer died with \"no matching entry\".`status=ok` because it only checked whether the port came back up. The next attempt then skipped the ticket as \"already handled\" — and it never ran at all.\nBoth are now covered by the kind of check that would have caught them: the import records the apply exit code, and a stale `session.lock` is probed with `lsof` instead of being trusted as proof that DSH is running.\n\n`.receipt-<device>.json`) that travels back through the mailbox, so the sender sees \"received by …\" in its own list\n\n```\nnpm i -g @mrwilliam/dsh-handoff\ndsh-handoff status\n```\n\nThe mailbox is a git repository you own; `sync` commits and pushes, `pull` only fetches, and `prune` removes tickets older than N days. No account, no server, no port to open.\n\nSource and changelog: [github.com/FindSomeSkills/Skills](https://github.com/FindSomeSkills/Skills/tree/main/dsh-tools/dsh-handoff)", "url": "https://wpnews.pro/news/moving-one-deepseek-harness-session-to-another-machine-without-breaking-it", "canonical_source": "https://dev.to/mrwilliam_9596/moving-one-deepseek-harness-session-to-another-machine-without-breaking-it-gc8", "published_at": "2026-11-27 22:30:00+00:00", "updated_at": "2026-11-27 22:44:26.207449+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "ai-agents"], "entities": ["DeepSeek Harness", "Handoff", "GitHub", "macOS", "Windows", "npm"], "also_reported_by": [], "takeaway": "A DSH session's portability hinges on the absolute cwd in its first JSONL frame, so rewrite that field and derive the target folder and workspace entry from it rather than copying the file alone.", "recommendation": {"advice": "When moving agent session state between machines, rewrite the recorded working directory and verify the receiving side's config path and lock checks, since both bugs here only reproduced on the destination machine.", "playbook": "production-ops", "playbook_url": "https://wpnews.pro/playbooks/production-ops"}, "alternates": {"html": "https://wpnews.pro/news/moving-one-deepseek-harness-session-to-another-machine-without-breaking-it", "markdown": "https://wpnews.pro/news/moving-one-deepseek-harness-session-to-another-machine-without-breaking-it.md", "text": "https://wpnews.pro/news/moving-one-deepseek-harness-session-to-another-machine-without-breaking-it.txt", "jsonld": "https://wpnews.pro/news/moving-one-deepseek-harness-session-to-another-machine-without-breaking-it.jsonld"}}