Portable Claude Code workspace archives
Project description
claude-portage
Portable Claude Code workspace archives.
Claude Code stores per-project session history, file snapshots, and metadata in ~/.claude/ using a path-encoding scheme (e.g., /Users/alice/src/foo → -Users-alice-src-foo). This data is tightly coupled to absolute paths, making it impossible to move a project to another machine or directory and use claude --continue or claude --resume.
claude-portage bundles a project + its Claude metadata into a portable archive that can be unpacked anywhere with automatic path rewriting. It also supports in-place renaming when you move a project directory locally.
Installation
# Install from source
pip install .
# Or run directly (zero dependencies)
python3 claude_portage.py <command>
Usage
Pack a project
claude-portage pack /path/to/my-project
# Creates my-project.portage.tar.gz
claude-portage pack /path/to/my-project -o /tmp/backup.portage.tar.gz
claude-portage pack /path/to/my-project --no-project-files # metadata only
claude-portage pack /path/to/my-project --include-debug -v # include debug logs
Inspect an archive
claude-portage inspect my-project.portage.tar.gz
claude-portage inspect my-project.portage.tar.gz -v # show individual files
Unpack to a new location
claude-portage unpack my-project.portage.tar.gz /new/path/to/my-project
# Project files extracted to /new/path/to/my-project
# Claude metadata placed in ~/.claude/ with all paths rewritten
Then:
cd /new/path/to/my-project
claude --resume # Sessions from the original machine appear
Rename a project directory
After moving/renaming a project directory, update Claude's metadata to match:
mv ~/src/foo ~/src/bar
claude-portage rename ~/src/foo ~/src/bar
This rewrites all paths in the session JSONL, subagent logs, todos, etc. and renames the metadata directory in ~/.claude/projects/. Sessions will work seamlessly with claude --resume from the new location.
How It Works
- Pack discovers all Claude metadata for a project: session JSONL files, subagent logs, tool results, file-history snapshots, session environments, todos, plans, and memory.
- The archive includes a
manifest.jsonrecording the source absolute paths. - Unpack extracts project files and places Claude metadata into
~/.claude/on the target machine, performing line-by-line string replacement of all source paths with target paths. - Path rewriting handles the project path, the Claude config directory path, and the encoded directory name, applied longest-first to avoid partial matches.
Known Limitations
- Path rewriting is string-based, not JSON-aware. This works because paths appear in many contexts (command strings, tool outputs, file paths) where structured rewriting would miss them.
- File-history snapshots (source code versions) are copied as-is without path rewriting, since they are project source code, not metadata.
- The archive does not include Claude's global config (
settings.json, API keys, etc.) — only project-specific session data. - Session UUIDs are preserved; if the same session ID already exists at the target, files will be overwritten.
License
MIT
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
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_portage-0.2.0.tar.gz.
File metadata
- Download URL: claude_portage-0.2.0.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1099397c3d949988d2dd3e6e8c56ac034806888e0fed9511caa00aaa4afc0f36
|
|
| MD5 |
157292a1d79fd218610c4d40cc0d3a19
|
|
| BLAKE2b-256 |
6bf07e674767e0a06391e8e73f642a4f9774251a48ade15cd45eb307ea82ffac
|
File details
Details for the file claude_portage-0.2.0-py3-none-any.whl.
File metadata
- Download URL: claude_portage-0.2.0-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c70f3e30ce0dd17dfc2c993976f6c2e690c810ab5a152ba1f2ec6326b0d0cc6f
|
|
| MD5 |
3cfafdc247cc5a99aa7b552b14d27268
|
|
| BLAKE2b-256 |
82a6c81c9832f97c7824758168f6f7b9be71a3d62b171b8a1383c95afe7b97d0
|