A local, backup-first macOS app for comparing and mirroring Claude Desktop Code Recents between accounts on the same Mac.
Important
Claude Recent Sync is an unofficial local utility and is not affiliated with Anthropic. It mirrors the local Claude Desktop Code Recents index only. It cannot update Claude.ai web or mobile conversation history, cloud memory, or any server-side account data.
Claude Desktop keeps Code sidebar entries in account-specific local directories. After switching accounts, existing Claude Code transcripts can remain on disk while their Recents entries are missing or stale for the newly signed-in account.
Claude Recent Sync treats one local account as the authoritative source, previews the difference, backs up the target, and makes the target index match the source. The mirror includes additions, updates, branch changes, and target-only deletions; it is not limited to a fixed number of sessions.
- Visual discovery of local accounts and profile/organization directories.
- Session-by-session comparison of titles, branch IDs, turn counts, activity times, and working directories.
- One action performs source validation, conflict handling, backup, mirroring, transcript checks, and a delayed stability check.
- Stale target-account Claude backends are stopped only when they could rewrite an older session branch.
- Timestamped target backups with restore support from the History tab.
- Optional synchronization after an account switch and optional launch at login.
- Local service bound to
127.0.0.1; no credentials, cookies, or transcript bodies are copied.
- macOS 12 or newer
- Python 3.10 or newer (
python3 --version) - Claude Desktop and local Claude Code session data on the same Mac
Node.js is required only for frontend development, not for the installed app.
git clone https://github.com/Beiciccc/claude-recent-sync.git
cd claude-recent-sync
./scripts/install-macos-app.sh
open "$HOME/Applications/Claude Recent Sync.app"The installer creates ~/Applications/Claude Recent Sync.app, bundles the Python modules and compiled interface, and applies a local ad-hoc signature. It does not require administrator access or Node.js.
In the app:
- Sign in to the account that should receive the local Recents entries.
- Confirm that 上个账号 · 来源 (Previous / Source) contains the authoritative sessions and 当前账号 · 目标 (Current / Target) is the newly signed-in account.
- Review the added, updated, deleted, and unchanged rows.
- Select 开始安全同步 (Start safe sync).
- Keep the app open until the delayed verification finishes.
Caution
Mirroring is directional. Target-only local_*.json entries are deleted so the target matches the source. A complete target-index backup is created before every write, but you should still verify the selected direction before starting.
To upgrade, pull the repository and run the installer again:
git pull --ff-only
./scripts/install-macos-app.shClaude Desktop stores Code Recents indexes under:
~/Library/Application Support/Claude/claude-code-sessions/<account-id>/<profile-id>/local_*.json
Each small index references a durable Claude Code transcript through cliSessionId, usually located under:
~/.claude/projects/.../<cliSessionId>.jsonl
Claude Recent Sync mirrors the index files and verifies that their referenced transcripts exist. It does not copy transcript JSONL files, OAuth tokens, cookies, credentials, Claude.ai conversations, or cloud memory.
Each visual sync performs the following steps:
- Rediscover the current account and the selected source account.
- Resolve the active profile/organization directory for each account.
- Validate every source index and its transcript reference.
- Compare each source and target session.
- Stop only stale target backends that reference a branch being replaced or removed.
- Back up the complete target index directory.
- Mirror additions, updates, and deletions.
- Validate the resulting target and compare it with the source.
- Wait for Claude Desktop to settle, verify again, and reconcile once if needed.
An empty source is rejected by default to prevent accidental target clearing.
The Settings tab provides two opt-in controls:
- 账号切换同步 (Account-switch sync) tracks the active account and uses the account active immediately before a switch as the next source.
- 登录时运行 (Run at login) installs a user LaunchAgent that starts the local service after macOS login.
Both options are disabled by default. Review the first few account switches manually before enabling unattended synchronization.
Backups and app state are stored locally:
~/.claude/backups/claude-recent-sync/
~/.claude/claude-recent-sync/
Open the 运行记录 (History) tab to inspect prior runs, reveal a backup in Finder, or restore it. Restoring also backs up the target's current state before replacing it.
Run the CLI directly from the repository:
./bin/claude-recent-sync list
./bin/claude-recent-sync diff --from previous --to current
./bin/claude-recent-sync mirror --from previous --to current --dry-run
./bin/claude-recent-sync mirror --from previous --to current
./bin/claude-recent-sync doctor current
./bin/claude-recent-sync uiInstall Python entry points for shell-wide use:
python3 -m pip install -e .
claude-recent-sync uiThe polling CLI is also available:
claude-recent-sync watch --from previous --to current --interval 10Use --no-delete for a union-style copy that preserves target-only indexes. Use explicit account IDs or unique prefixes when aliases are ambiguous:
claude-recent-sync mirror \
--from <source-account-prefix> \
--to <target-account-prefix> \
--dry-runcurrent is read from:
~/Library/Application Support/Claude/cowork-enabled-cli-ops.json
For manual commands, previous resolves to the non-current account with the newest Code Recents index. The automatic account-switch watcher separately records the account that was active immediately before the switch.
If an account contains multiple profile or organization directories, the app selects the profile with session files and the newest local activity. CLI users can override this with --source-profile and --target-profile.
- Current account is not detected: open Claude Desktop, complete sign-in, and refresh the dashboard.
- Source validation fails: confirm that the referenced transcript still exists under
~/.claude/projects; invalid or missing source references block writes. - The app does not open a browser: run
./bin/claude-recent-sync-uiand openhttp://127.0.0.1:47631. - Port
47631is occupied: run./bin/claude-recent-sync-ui --port 47632. - Installed-app startup fails: inspect
~/.claude/claude-recent-sync/launcher.log.
- All synchronization is local to one Mac. The app does not upload session data to GitHub, Anthropic, or another service.
- Indexes and backups contain local metadata such as titles, paths, account/profile IDs, and timestamps. Backups remain on disk and should be protected like other local Claude data.
- The tool depends on Claude Desktop's current, undocumented local storage layout. A future Claude Desktop update may require a compatibility update.
- Only macOS is supported by the app installer and process-management workflow.
- The current visual interface is in Simplified Chinese; the CLI remains usable from an English shell.
- This tool cannot make local Recents visible on claude.ai or a phone; those surfaces use server-side data controlled by Anthropic.
Run backend tests:
PYTHONPATH=src python3 -m unittest discover -s tests -vRebuild the React interface:
cd frontend
npm ci
npm run buildThe production bundle is written to src/claude_recent_sync/web_dist and served by the Python standard-library HTTP server.
