feat(env): add crab env snapshot/restore for machine migration#57
Merged
MrFlounder merged 1 commit intomainfrom Mar 11, 2026
Merged
feat(env): add crab env snapshot/restore for machine migration#57MrFlounder merged 1 commit intomainfrom
MrFlounder merged 1 commit intomainfrom
Conversation
… migration Adds an agentic environment capture and restore system. `crab env snapshot` runs a quick prescan of the machine then launches a coding agent to explore deeply and build a comprehensive recipe. The recipe + configs, secrets, and DB schemas are encrypted into a portable bundle. `crab env restore` decrypts and launches an agent in safe mode to set up a new machine from the recipe. Key design decisions: - Agentic approach: adapts to any toolset, not hardcoded scripts - Prescan seeds the agent with concrete findings for completeness - Recipe is directional guidance (markdown), not literal bash scripts - Agent-agnostic: uses existing abstraction layer (Claude/Codex) - Snapshot uses autonomous mode; restore uses safe/interactive mode - Encryption via openssl aes-256-cbc with pbkdf2 (cross-compatible) Validated end-to-end on a clean macOS Sequoia VM (Tart) with Codex as the restore agent — all phases completed autonomously. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merged
MrFlounder
added a commit
that referenced
this pull request
Mar 11, 2026
## Summary Bump version `0.12.0` → `0.13.0`. Features since 0.12.0: - Agent-agnostic support — Claude Code + Codex CLI (#52) - `crab agent sync` for cross-agent config migration (#55) - `crab env snapshot/restore` for machine migration (#57) - Bats unit test framework + CI (#52) - `crab court` fresh-start prompt fix (#54) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Mar 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
crab env snapshot— launches an AI agent to explore the machine, build a comprehensive setup recipe, capture configs/secrets/DB schemas, and encrypt everything into a portable bundlecrab env restore --from <file>— decrypts the bundle and launches an agent in safe mode to set up a new machine from the recipeget_agent_safe_cmd()helper for non-autonomous agent invocationDesign
The agentic approach means no hardcoded collection scripts — the agent adapts to whatever toolset is on the machine. A quick bash prescan seeds the agent with concrete findings (brew packages, node versions, git repos, .env files, etc.) so it knows what to look for. The primary artifact is
recipe.md— directional guidance for another agent, not literal scripts.Tested
Validated end-to-end on a clean macOS Sequoia VM (Tart):
crab env snapshoton source machine → 53 files captured (16 configs, 9 DB schemas, 21 secret mappings, recipe, inventory)Test plan
crab env snapshot --dry-runto verify prescan outputcrab env snapshotend-to-end, verify recipe.md and encrypted bundlecrab env restore --from <file>on a clean machine or VMagent: claudeandagent: codexconfig🤖 Generated with Claude Code