Skip to main content

HuaShen (化身)

Export and import opencode config, sessions, agents, skills, commands, plugins and MCP servers as portable bundles.

化身 (HuaShen) means "avatar / incarnation" — this tool lets your opencode identity travel between machines. Pack everything into a single .hsb (HuaShen Bundle, a tar.gz archive) and restore it elsewhere. Pick exactly what to carry: just config, just one session, or the whole shebang.

Install

pip install huashen

Or with pipx (recommended):

pipx install huashen

Provides two console commands: huashen and the short alias hs.

Quick start

# Export everything (config + all sessions + agents + skills + commands + auth)
huashen export -o my-avatar.hsb

# Export only config and skills, no secrets
huashen export -o lite.hsb --no-sessions --no-auth

# Export a single session by id (or by fuzzy title match)
huashen export -o one.hsb --session ses_08578bbd5ffeohc37zQcMhYNCP
huashen export -o one.hsb --session "prevent system sleep"

# List what is in a bundle without importing
huashen info my-avatar.hsb

# Import everything from a bundle (use --dry-run first to preview)
huashen import my-avatar.hsb --dry-run
huashen import my-avatar.hsb
huashen import my-avatar.hsb --only config,sessions --merge-sessions

What it can carry

Component Default Flag to skip Notes
Global config --no-config ~/.config/opencode/opencode.json(.jsonc) + .gitignore
Project cfg --no-project-config ./opencode.json(.jsonc) and .opencode/opencode.json if present
Agents --no-agents ~/.config/opencode/agent(s)/ + .opencode/agent(s)/
Commands --no-commands ~/.config/opencode/command(s)/ + .opencode/command(s)/
Skills --no-skills ~/.config/opencode/skill(s)/ + .opencode/skill(s)/
Plugins --no-plugins *.ts/*.js in .opencode/plugin(s)/
MCP / auth n/a (opt-in) auth.json and provider apiKey fields — off by default
Sessions --no-sessions SQLite rows for session/message/part/todo + event log
Logs n/a (opt-in) --include-logs to also bundle opencode.log
Cache / repos n/a Never exported (regenerable)

Secrets (auth.json + inline apiKeys inside provider.*.options.apiKey) are off by default. Pass --with-auth to include them; the bundle is then printed with a red warning. Treat .hsb files containing auth like plaintext passwords.

Bundle layout

A .hsb is a tar.gz with this structure:

manifest.json            # what's inside, versions, timestamps, checksums
config/
  global/opencode.json
  global/opencode.jsonc
  global/.gitignore
  project/opencode.json  # only if a project config was found
agents/...
commands/...
skills/...
plugins/...
auth.json                 # only when --with-auth
sessions/
  opencode.db.dump.sql    # filtered SQL dump of session/message/part/todo/event
  index.json              # per-session metadata + which rows belong to it
logs/
  opencode.log            # only when --include-logs

Import modes

  • Overwrite (default): replaces matching files/rows with the bundle's version.
  • Merge sessions: --merge-sessions keeps existing sessions and only inserts ones whose id is missing. Useful when importing a single session into an existing database.
  • Selective: --only config,skills,agents imports just those components from the bundle.

Exit codes

  • 0 success
  • 1 generic error (bad bundle, IO failure)
  • 2 nothing to do (e.g. export with everything disabled)
  • 3 dry-run abort (intentional)

License

GPL-3.0-or-later. See LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

huashen-0.1.0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

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

huashen-0.1.0-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for huashen-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7f646aa30c9f82830b8b01586b5130fc193cdb34bb0acbebc7bcac60cc3f1ff9
MD5 67dd9bb77ec25dfa451c718bdfc1a207
BLAKE2b-256 b9334e95b1485503bb5720c45043322245fb5645602a2445bfe4fa5f719750f6

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for huashen-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 68a44545c2347b848dcf176df85ba7b1fccc42b2308cc1c771cf1ecc60095f9f
MD5 23477d6aac1adf4b519b4f181e37ae4a
BLAKE2b-256 fdd40f68b19ffb8a38f171024f7b4e86edcdc2bec2b29395cc6c3da331a0773c

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