Skip to content

feat: cac env import — migrate from bare Claude Code #33

@nmhjklnm

Description

@nmhjklnm

Summary

Users who already use bare Claude Code have sessions, memory, credentials in ~/.claude/. After installing cac, they need a way to migrate their existing state into a cac environment.

Proposed API

cac env import <name> [--from ~/.claude]    # default: import from ~/.claude

What to migrate

Source Destination Action
~/.claude/ (sessions, settings.json, CLAUDE.md, projects/) ~/.cac/envs/<name>/.claude/ Copy
~/.credentials.json ~/.cac/envs/<name>/.claude/.credentials.json Copy
.claude.json userID/anonymousId Regenerate (isolated identity)
statsig Regenerate
Telemetry cache (numStartups, etc.) Do NOT migrate

What to generate fresh

  • uuid, stable_id, user_id, machine_id, hostname, mac_address
  • mTLS client certificate

Reverse operation

cac env export <name> [--to ~/backup/]      # export environment snapshot

Implementation notes

  • Add to src/cmd_env.sh as _env_cmd_import
  • Similar flow to _env_cmd_create but copies existing .claude/ instead of creating empty

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions