Skip to main content

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/pushbootstrap 基線、doctor 診斷/rebuild-state/break-lock/ack、 memory union + tombstone + MEMORY.md 索引重建、memory-merge(含跨群 --from 與模糊近似 --fuzzy)、SessionEnd nudge hook。
  • 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claude_code_session_sync-0.1.0.tar.gz (289.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claude_code_session_sync-0.1.0-py3-none-any.whl (194.4 kB view details)

Uploaded Python 3

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

Hashes for claude_code_session_sync-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7f4a0e1b4cc7aa2360abfba94222cec6dbb82cc55c2828b4c05ff2a29f00398d
MD5 6f10706dcc78deab4434bad1e25e90bd
BLAKE2b-256 22fb068958ddc4f2f8440fceb387bcd2e8841b75d5104b42101656df58de1b6f

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file claude_code_session_sync-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for claude_code_session_sync-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad7d1c1a11ddde0a696f0ed2d6c2b4a1d9457c344842de903e829f67fda5942a
MD5 2c6f72ec4db8bfad6dd0dad954b3b0f5
BLAKE2b-256 d85fa1a782676bda00488e3f4c2271620e3e6b46ef9ab3d1c9e51eb4fac457fe

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page