Claude Context banner
evokateur evokateur

Claude Context

Development community

Description

Shell functions for Claude Code project context sync & backup

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

Claude Code project context sync and backup

Shell functions for syncing and backing up Claude Code project context across machines.

Syncing context between machines

`cc-sync` (or `cc-sync from`) syncs the context for the CWD in `~/.claude/projects` from a remote.

`cc-sync to` syncs context for the CWD to a remote.

Since the remote path is determined relative to `$HOME`, the CWD must be within `$HOME`.

The remote OS is taken into account when determining the context directory; context for `~/code/catbutt` would be in

  • ~/.claude/projects/-home-username-code-catbutt on Linux and
  • ~/.claude/projects/-Users-username-code-catbutt on macOS.

Context for the same relative path on the remote is assumed:

~/code/catbutt$ cc-sync xicamatl 

.. is the same as:

~/code/catbutt$ cc-sync xicamatl:code/catbutt

The remote relative path can be specified if different:

~/code/catbutt$ cc-sync xicamatl:projects/catbutt

A relative path can be used with `localhost` to retrieve the context of a renamed project:

~/code/cul-de-chat$ cc-sync localhost:code/catbutt

To sync the local context *to* a remote:

~/code/catbutt$ cc-sync to xicamatl

As with `cc-sync [from]`, the remote relative path can be specified.

`cc-sync [from]` and `cc-sync to` are `rsync` wrappers. By default `rsync` commands are additive, consolidating context across machines.

Newer files at the destination will be skipped (with `--update`) unless `--delete` is specified.

The auto memory entrypoint, `memory/MEMORY.md`, will be merged rather than rsynced unless `--delete` is specified.

Using the `--delete` option (*without* `--find-args`, see below) will essentially clobber the destination with the source.

A backup of existing destination context, when it will be affected, is created before syncing, except with `--dry-run`.

Selecting what files to sync with `find` arguments

  • --find-args '' invokes rsync --files-from with t