Skip to main content

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.

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

How It Works

  1. Pack discovers all Claude metadata for a project: session JSONL files, subagent logs, tool results, file-history snapshots, session environments, todos, plans, and memory.
  2. The archive includes a manifest.json recording the source absolute paths.
  3. 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.
  4. 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

claude_portage-0.1.0.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

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

claude_portage-0.1.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file claude_portage-0.1.0.tar.gz.

File metadata

  • Download URL: claude_portage-0.1.0.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for claude_portage-0.1.0.tar.gz
Algorithm Hash digest
SHA256 837ecc4fdf87f755938fef7c7d640ec8e68af7d6c7ed17b7c532c51a7f998b20
MD5 55ffc842781e80e833ac904eb29f278c
BLAKE2b-256 856e2831fea4ede953877e9b6d77b1aabd98a2fe0fd30e293653df225726f424

See more details on using hashes here.

File details

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

File metadata

  • Download URL: claude_portage-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for claude_portage-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1e85c142b87cf7c5e2b6ac6a568806a6dd8347fceefd239d7b34fab108533eab
MD5 3668b672998ce1978d93301ecef0b12b
BLAKE2b-256 5039b13f1ade12904bb321c42bcc899bf09c0dfca892fbbb2ec91a238d6a8b6e

See more details on using hashes here.

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