Offline cross-machine sync for Claude Code sessions (JSONL) and memory (.md).
Project description
claude-session-sync
讓 Claude Code 的對話 session(JSONL)與 memory(.md)透過外接 / 網路硬碟在多台機器間離線同步的 CLI 工具。
- 同群組多台共用一個 hub 目錄雙向同步;跨群組明確、可挑選地引入/送回特定 session。
- 核心原則:機械的事交給 Python,語意的事交給 AI;永不靜默丟資料。
- 與現成工具的差異:離線(不強制上雲/git)+可挑選+AI 輔助 memory 合併+多寫入者安全。
現況
核心功能已實作並收斂(跨模型 code review + 逐塊 fresh-gate;跨平台,Windows 綠)。
- 已完成:唯讀掃描/分類 →
sync雙向同步(安全寫入:read-verify-write + lock + tombstone + keep-both)、 跨群pull/push、bootstrap基線、doctor診斷/rebuild-state/break-lock/ack、 memory union + tombstone +MEMORY.md索引重建、memory-merge(含跨群--from與模糊近似--fuzzy)、SessionEndnudgehook。 - memory「同事實不同檔名」的模糊近似比對(P2 最後一項、最高風險)已完成——刻意只做唯讀建議(
memory-merge --fuzzy列候選、由你逐對放行才保留兩版,絕不自動合併)。 - 首個公開版 0.1.0(beta);尚未到 1.0 穩定版,介面/行為仍可能調整。
安裝
# 從 PyPI(推薦)— 套件名 claude-code-session-sync,安裝後指令仍是 claude-session-sync
pipx install claude-code-session-sync # 或: pip install claude-code-session-sync
# 或從原始碼安裝最新版
pipx install "git+https://github.com/weilung/claude-session-sync.git"
需 Python ≥ 3.11、零第三方相依(標準庫)。安裝後即有 claude-session-sync 指令。
快速開始
# 1) 設定自己群組的 hub(編輯設定檔;Windows 路徑用單引號)
# Windows: %APPDATA%\claude-session-sync\config.toml
# POSIX: ~/.config/claude-session-sync/config.toml
# own_hub = 'D:\SyncDrive\HomeJSONL'
# 2) 第一次先建基線
claude-session-sync bootstrap --map "本機專案夾=hub專案夾" --yes
# 3) 日常同步(先預覽,再 --apply 落地)
claude-session-sync status # 看差異(純唯讀)
claude-session-sync sync # 預覽
claude-session-sync sync --apply # 落地
(開發環境未安裝時,等價寫法為 python -m claude_session_sync.cli <子指令>。)
文件
開發
python -m unittest discover -t . -s tests
純 Python、零第三方相依(標準庫)。跨 OS CI 於 Ubuntu + Windows 跑 py3.11/3.13。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file claude_code_session_sync-0.1.0.tar.gz.
File metadata
- Download URL: claude_code_session_sync-0.1.0.tar.gz
- Upload date:
- Size: 289.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f4a0e1b4cc7aa2360abfba94222cec6dbb82cc55c2828b4c05ff2a29f00398d
|
|
| MD5 |
6f10706dcc78deab4434bad1e25e90bd
|
|
| BLAKE2b-256 |
22fb068958ddc4f2f8440fceb387bcd2e8841b75d5104b42101656df58de1b6f
|
Provenance
The following attestation bundles were made for claude_code_session_sync-0.1.0.tar.gz:
Publisher:
publish.yml on weilung/claude-session-sync
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_code_session_sync-0.1.0.tar.gz -
Subject digest:
7f4a0e1b4cc7aa2360abfba94222cec6dbb82cc55c2828b4c05ff2a29f00398d - Sigstore transparency entry: 2078472646
- Sigstore integration time:
-
Permalink:
weilung/claude-session-sync@ada6e70f3ba34a1c2be89379e40684c303a277e7 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/weilung
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ada6e70f3ba34a1c2be89379e40684c303a277e7 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file claude_code_session_sync-0.1.0-py3-none-any.whl.
File metadata
- Download URL: claude_code_session_sync-0.1.0-py3-none-any.whl
- Upload date:
- Size: 194.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad7d1c1a11ddde0a696f0ed2d6c2b4a1d9457c344842de903e829f67fda5942a
|
|
| MD5 |
2c6f72ec4db8bfad6dd0dad954b3b0f5
|
|
| BLAKE2b-256 |
d85fa1a782676bda00488e3f4c2271620e3e6b46ef9ab3d1c9e51eb4fac457fe
|
Provenance
The following attestation bundles were made for claude_code_session_sync-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on weilung/claude-session-sync
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_code_session_sync-0.1.0-py3-none-any.whl -
Subject digest:
ad7d1c1a11ddde0a696f0ed2d6c2b4a1d9457c344842de903e829f67fda5942a - Sigstore transparency entry: 2078472787
- Sigstore integration time:
-
Permalink:
weilung/claude-session-sync@ada6e70f3ba34a1c2be89379e40684c303a277e7 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/weilung
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ada6e70f3ba34a1c2be89379e40684c303a277e7 -
Trigger Event:
workflow_dispatch
-
Statement type: