https://github.com/evokateur/claude-context
Shell scripts for Claude Code project context sync & backup
https://github.com/evokateur/claude-context
claude-code experimental rsync rsync-wrapper shell-scripts
Last synced: about 1 month ago
JSON representation
Shell scripts for Claude Code project context sync & backup
- Host: GitHub
- URL: https://github.com/evokateur/claude-context
- Owner: evokateur
- Created: 2025-12-14T03:03:40.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2026-04-26T07:00:28.000Z (about 1 month ago)
- Last Synced: 2026-04-29T05:37:01.624Z (about 1 month ago)
- Topics: claude-code, experimental, rsync, rsync-wrapper, shell-scripts
- Language: Shell
- Homepage:
- Size: 37.1 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Claude Code project context sync and backup
Shell functions for syncing Claude Code project context across machines, with local backups.
## Syncing contexts between machines
`cc-sync` rsyncs a context directory in `~/.claude/projects` from a remote machine to the local machine. It derives context directory names from the current working directory, accounting for OS home directory path differences.
For example, `~/code/catbutt` will have context at
- `~/.claude/projects/-home-wesley-code-catbutt` on Linux and
- `~/.claude/projects/-Users-wesley-code-catbutt` on macOS.
If the relative path is the same on both machines, only the host is needed:
```sh
~/code/catbutt$ cc-sync xicamatl
```
A remote path is necessary when the relative directory differs:
```sh
~/code/catbutt$ cc-sync xicamatl:projects/catbutt
```
To retrieve the context of a renamed project:
```sh
~/code/cul-de-chat$ cc-sync localhost:code/catbutt
```
By default (`rsync` and therefore) `cc-sync` is additive, consolidating context across machines. Use `--delete` to make local match remote exactly.
A backup of the local context directory is created before syncing, except with `--dry-run`.
## Functions
- `cc-sync [rsync-options] `
- Wraps `rsync -av` with passthrough of recognized rsync options:
- `--dry-run`, `-n`: preview what would be transferred
- `--delete`: remove local context not present on remote
- `-z`, `--compress`: compress data during transfer
- Context directories determined with tilde expansions of CWD relative to `~/`
- Assumes same relative path on remote unless `:path` is specified.
- `cc-backup`
- Creates a context backup for current working directory
- Stored in `~/.claude/backups/projects/` as `{context-dir}_{timestamp}.tar.gz`
- `cc-restore`
- Restores the most recent backup for current working directory
- `cc-pop`
- Restores the most recent backup for current working directory
- Deletes the backup file after restoration
## Requirements
- Claude Code (`~/.claude/projects/` directory must exist)
- Read/write access to `~/.claude/projects/` and `~/.claude/backups/projects/`
### For `cc-sync`
- Passwordless SSH access to remote machine
- `rsync` installed on both machines
## Setup
- Source `claude-context.sh` path in `.zshrc` or `.bashrc` etc.)