[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EFVRRJHV3QVB4RDQYTFP0B":3,"skill-same:01M7EFVRRJHV3QVB4RDQYTFP0B":45},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":14,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7EFVRRJHV3QVB4RDQYTFP0B","sandcast-capture",null,"Capture the current project and the host environment (languages, host tools, curated shell configuration, agent harnesses) into a sandcast manifest at .sandcast\u002Fmanifest.yaml.","sandcast-dev\u002Fsandcast","sandcast-dev","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F340896885?v=4","01M7EFVDZ5HTK29N6RERFG4JW2","Sandcast","01M7EFVDZRBXSZVQQ46BEENX0H",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fsandcast-dev\u002Fsandcast\u002Fblob\u002Fmain\u002Fskills\u002Fcapture\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: sandcast-capture\ndescription: Capture the current project and the host environment (languages, host tools, curated shell configuration, agent harnesses) into a sandcast manifest at .sandcast\u002Fmanifest.yaml.\nsandcast_version: 0.2.1\n---\n\n# sandcast capture\n\nYou turn the current project directory and the developer's host environment into a sandcast manifest (`.sandcast\u002Fmanifest.yaml`).\nThe `sandcast` binary provides every fact you need. Your job is judgment: present what the binary found, let the user decide, curate the shell configuration, and write the result.\nThe build happens later, through `\u002Fsandcast-build` or `sandcast build`.\n\n## Rules\n\nFollow these rules in every step. They are part of the sandcast contract and a reviewer checks them.\n\n1. **Facts come from the binary.** Component keys, match evidence, host tool versions, harness discovery and validation results come from `sandcast ... --json`. Never invent a component key, a version, or a configuration value the binary did not report.\n2. **Never handle credentials.** Never ask for, print, copy, or write a secret value (tokens, API keys, passwords, private keys). The binary replaces discovered secrets with `${SANDCAST_SECRET_N}` placeholders. Keep each placeholder exactly as returned and tell the user to supply the real value at runtime as a credential of the OpenShell provider attached to the sandbox.\n3. **Write only the manifest.** You create or change `.sandcast\u002Fmanifest.yaml` through `sandcast init`, `sandcast manifest set-shell` and direct edits, and `.sandcast\u002Fmise.lock` through `sandcast lock`. Never write a Containerfile or any other image definition (FR-037), never touch `.sandcast\u002Fbuild\u002F`, `.sandcast\u002Ffragments\u002F` or `.sandcast\u002Frecipes\u002F`. The one exception: with the user's consent, copy a chosen skill or local marketplace from outside the project into the project (Step 2).\n4. **Ask before deciding.** Every component, harness extension and shell change ends up in an image the user runs. Present proposals with their evidence and wait for confirmation.\n5. **Run commands from the project root** (or pass `--project \u003Cdir>`). Exit codes: 0 success, 1 operation failed, 2 usage or validation error, 3 external tool missing or at the wrong version.\n6. **Temporary files live outside the project**: create them with `mktemp`, never under a fixed name in a shared directory, and delete them when the step is done.\n\n## Step 1: Check the skill and binary versions\n\nRun:\n\n```sh\nsandcast skills check --harness claude-code\n```\n\n- Exit 0: continue.\n- Exit 3: the installed skills and the binary disagree. Print the message exactly as the command printed it, tell the user which side to update, and **stop**. The message names it: `run \"sandcast skills install --harness claude-code\"` when the skill is missing or older than the binary, `update the sandcast binary` when the skill is newer.\n- Command not found: tell the user to install the `sandcast` binary first and stop.\n- Any other failure: show the output and stop.\n\n## Step 2: Choose the harnesses\n\nAsk the user upfront which agent harnesses the image should include (FR-036).\nShow what this host has:\n\n```sh\nsandcast harness list --json\n```\n\nEach entry has `name`, `component`, `installed` and `path`. Offer exactly the harnesses this list reports, marking which are installed on the host. If the user asks for a harness the list does not report, say that its adapter is not available yet and leave it out. The user may also choose no harness at all.\n\nFor **each selected harness only**, run discovery with the harness `name` from the list (for example `claude-code`):\n\n```sh\nsandcast harness discover \u003Charness> --json\n```\n\nRun it once per selected harness and handle each result with the steps below. If the user selected no harness, skip discovery and continue with Step 3.\n\nThe JSON has `harness`, `mcp_servers` (each with `name`, `command` or `url`, `env`, `origin`), `plugins` and `skills` (each with `name`, `source`, `origin`, `portable`, and `reason` when `portable` is false), `redacted` (each with `path`, `kind`, `placeholder`, `env_var`) and `notes`. A plugin whose local marketplace directory is a git checkout with a remote comes with a `remote` object (`url`, `unpushed_commits`, `uncommitted_changes`, `name_match`) and a `source` taken from that remote (`owner\u002Frepo` for GitHub, else the remote URL).\n\n1. Present the MCP servers, plugins and skills as three short groups, each item with its origin file. For MCP servers show the environment variable names, not their values.\n2. For each non-empty group, ask which items to bake into the image with a multi-select prompt: a checkbox list the user ticks, not a request to type item numbers. Use the harness's multi-select control when it has one (for example, in Claude Code, `AskUserQuestion` with `multiSelect: true`), and fall back to a numbered list only when the harness has no such control. Offer MCP servers, plugins and skills as three separate multi-select prompts so each is chosen independently. Nothing is baked by default: an empty selection bakes none.\n3. Check the `portable` marker of every chosen skill and plugin; do not decide by looking at the path yourself. An entry with `portable: false` makes the manifest host-specific: the binary reads its source on the machine that runs the plan, so `sandcast plan` and `sandcast build` fail in CI and on every other machine that lacks the path. Show its `reason`. For each such skill, explain this and offer to copy it into the project:\n   - Ask first. If the user declines, keep the discovered source and say that only this host can build the image.\n   - Copy only the skill directory, to `.claude\u002Fskills\u002F\u003Cname>` in the project, and never overwrite an existing directory. List its files first and leave out every file that holds a credential (`.env` files, private keys such as `*.pem` or `*.key`, files named like token, secret or credentials); if the skill needs such a file, stop and ask. Show symbolic links and ask before copying them.\n   - The name filter misses a token inside an ordinary file, such as a script or a `config.json`, and no sandcast command scans the copied files before a commit. So after copying, show the user the list of copied files (paths only, never their contents) and ask them to confirm that none of them holds a credential. Remove every file they are unsure about, or stop and ask.\n   - Record `source: .claude\u002Fskills\u002F\u003Cname>` for the skill. Only after the user has confirmed the file list, remind them to commit the directory; check that `.gitignore` does not exclude it.\n\n   For a non-portable local marketplace, explain the same limit and offer two remedies: copy the marketplace directory into the project (same rules) and use its `.\u002F` path as the plugin source, or publish it as a git repository and use `owner\u002Frepo` or its URL.\n\n   A plugin with a `remote` object was proposed through the git remote of its local marketplace, so you need no manual remote lookup. It stays opt-in like every other plugin. Before the user decides, present its remote notes: the remote `url`; `unpushed_commits` greater than 0 or `uncommitted_changes: true` means the image gets the remote's state, not the local one, so the user should push first, and `unpushed_commits: null` means the count is unknown because no remote-tracking ref exists locally; `name_match: mismatch` means the remote's marketplace file declares another name than the locally registered one, and `name_match: unknown` means it could not be checked: no remote-tracking ref exists locally (discovery never fetches), or the remote's marketplace file is missing or declares no name.\n4. For every entry in `redacted`, explain: the value at `path` looked like a credential (`kind`), the binary replaced it with `placeholder`, and the user supplies the real value at runtime as a provider credential under the environment variable named in `env_var` (the `env` key when the whole env value was the secret, `SANDCAST_SECRET_N` for a secret inside a longer value, an argument or a URL, including an access key in a URL path). Never offer to fill in the value.\n   MCP servers reached by `url` carry their bearer credential as one `env` entry, either a placeholder such as `MCP_\u003CNAME>_TOKEN: \"${SANDCAST_SECRET_N}\"` or a reference such as `VAR: \"${VAR}\"`. Keep both forms unchanged.\n5. Show every `notes` entry.\n\nDo not run discovery for harnesses the user did not select. Unselected harnesses leave no trace in the manifest.\n\n## Step 3: Create the manifest and choose the components\n\nIf `.sandcast\u002Fmanifest.yaml` does not exist, ask for the manifest name (kebab-case, default: the directory name), the target (`openshell` by default, or `container`) and the base image. Show the registry entries for the chosen target:\n\n```sh\nsandcast base-images list --target \u003Copenshell|container> --json\n```\n\nEach entry has `target`, `name`, `ref`, `default` and `notes`. Show the notes; they say which user and tools the image has.\n\nAsk where the image will run, because `sandcast init` never asks:\n\n- **A local OpenShell gateway** that uses the same container engine on this machine (for example a gateway with the podman driver): the default `localhost\u002F\u003Cname>` works. Create the skeleton:\n\n  ```sh\n  sandcast init --name \u003Cname> --base-image \u003Cregistry-entry-or-image-ref> --target \u003Copenshell|container>\n  ```\n\n- **A remote gateway** (a cluster, a cloud gateway, or any gateway that cannot read this engine's image storage): ask for the registry reference the cluster can pull (for example `quay.io\u002F\u003Cuser>\u002F\u003Cname>`, never `docker.io\u002F\u003Cname>` without a namespace) and the cluster's architecture (`linux\u002Famd64` for most clusters), and pass them with push enabled:\n\n  ```sh\n  sandcast init --name \u003Cname> --base-image \u003Cregistry-entry-or-image-ref> --target openshell --image \u003Cregistry\u002Fname> --platform \u003Clinux\u002Famd64|linux\u002Farm64> --push\n  ```\n\n  When the platform differs from this machine's architecture, point the user to `docs\u002Fguides\u002Fcross-arch.md`.\n\nIf the manifest already exists, read it, tell the user you will update it, and keep its existing entries unless the user removes them.\n\nNow let the binary match the project and the host against the component tiers. Add one `--harness \u003Charness>` per selected harness so the agent components are proposed too; pass no `--harness` flag when the user selected no harness:\n\n```sh\nsandcast components match . --host --harness \u003Charness> --json\n```\n\nThe JSON shape is:\n\n```json\n{\"project\": \"\u003Cdir>\",\n \"proposals\": [{\"key\": \"go\", \"name\": \"Go\", \"source\": \"project\", \"evidence\": [\"go.mod\"], \"detected_version\": \"1.25.1\",\n                \"pinned_versions\": [{\"value\": \"1.26.7\", \"file\": \"go.mod\", \"kind\": \"exact\"}]}],\n \"available\": [{\"key\": \"rust\", \"name\": \"Rust\", \"tier\": \"shipped\"}],\n \"notes\": []}\n```\n\n`pinned_versions` lists every version the project pins for the component, with its `file` and its `kind`: `exact` (a full version such as `1.95.0`), `range` (`>=3.12`, `^20`, `1.26`) or `channel` (`stable`, `nightly`, `lts\u002F*`). Show every `notes` entry; a note names a pin file that could not be read.\n\n`source` is one of `project` (ecosystem files), `host` (a tool found on the host `PATH`), `harness` (a selected harness) or `always` (base system components).\n\n1. Present the proposals grouped by source as a table with key, name, evidence and detected version.\n2. If no proposal has the source `project`, say explicitly: \"No recognizable ecosystem files were found in this project.\" Then still offer the host tools and the `available` components as optional additions.\n3. Offer the `available` components as optional additions.\n4. Let the user confirm, drop or add components. Keep `always` proposals unless the user explicitly removes them.\n5. Additions must be keys from `proposals`, `available`, or `sandcast components list --json`. If the user wants a tool that no tier defines, explain the two choices: add it with `optional: true` so that `\u002Fsandcast-build` offers to write an install fragment for it, or let the user define it in `.sandcast\u002Fcomponents\u002F\u003Ckey>.yaml` first. The user writes that file; you may show the shape from `sandcast components show \u003Csimilar-key>`, but do not write it yourself.\n6. Set `version` on a component only when the user asks for a specific version or the project pins one. When a proposal has `pinned_versions`, propose the first `exact` value as the component's `version:` (for go only the first entry counts: it is the highest version across a `go.work`'s modules, and when it is a `range` such as `1.27` a lower exact pin is not proposed), name the file it came from, and let the user accept or change it. Never turn a `range` or `channel` value into an exact pin; mention it, and leave `version` out unless the user chooses a version. Without a pin, leave `version` out; the lockfile pins exact versions.\n\nKeep the confirmed list in mind; you write it in Step 5.\n\n## Step 4: Curate the shell configuration\n\nThe image gets a curated copy of the user's interactive shell configuration, installed under `\u002Fetc` for the final user.\nHost configurations carry plugin managers, macOS paths and host-only tools that break inside a Linux sandbox. The rules below encode the failures recorded in earlier image builds (brainstorm 072, changes 7, 11, 12 and 13).\n\nFind the login shell with `basename \"$SHELL\"`.\n\n- `zsh`: read `${ZDOTDIR:-$HOME}\u002F.zshrc`.\n- `bash`: read `~\u002F.bashrc` (or `~\u002F.bash_profile` when there is no `.bashrc`).\n- Any other shell: say that sandcast curates only zsh and bash. Ask whether to skip the shell configuration or to write a minimal zsh or bash configuration with the user. If the user skips it, continue with Step 5.\n\nIf the file sources other files from the home directory that hold aliases or functions, ask before reading them. Never print a line that sets a credential; refer to it by line number and variable name only.\n\n### 4a: Strip\n\nRemove these lines, and tell the user what you removed and why:\n\n1. **Plugin managers and everything they load**: antidote (`source ...\u002Fantidote.zsh`, `antidote load`, `antidote bundle`), oh-my-zsh (`export ZSH=...`, `ZSH_THEME=...`, `plugins=(...)`, `source $ZSH\u002Foh-my-zsh.sh`), zinit (`source ...\u002Fzinit.zsh`, every `zinit ...` line), zplug (`source ~\u002F.zplug\u002Finit.zsh`, every `zplug ...` line). Treat antigen, prezto, zgenom, sheldon and znap the same way. For bash: oh-my-bash (`export OSH=...`, `OSH_THEME=...`, the `plugins=(...)`, `completions=(...)` and `aliases=(...)` arrays, `source \"$OSH\"\u002Foh-my-bash.sh`), bash-it (`export BASH_IT=...`, `BASH_IT_THEME=...`, `source \"$BASH_IT\"\u002Fbash_it.sh`) and ble.sh (`source ...\u002Fble.sh`, `ble-attach`). List the plugins that are lost, so the user knows.\n2. **Homebrew, Linuxbrew and host paths**: anything under `\u002Fopt\u002Fhomebrew`, `\u002Fusr\u002Flocal\u002FHomebrew`, `\u002Fusr\u002Flocal\u002Fopt`, `\u002Fusr\u002Flocal\u002FCellar`, `\u002Fhome\u002Flinuxbrew\u002F.linuxbrew`, `~\u002F.linuxbrew`, `\u002FApplications`, `\u002FLibrary`, `~\u002FLibrary` or `\u002FSystem`, plus `brew shellenv`, `$(brew --prefix ...)`, `HOMEBREW_*` and `DYLD_*`. In a `PATH` assignment remove only the host entries and keep the portable ones, for example `export PATH=\"\u002Fopt\u002Fhomebrew\u002Fbin:$HOME\u002F.local\u002Fbin:$PATH\"` becomes `export PATH=\"$HOME\u002F.local\u002Fbin:$PATH\"`. Absolute paths into the host home (`\u002FUsers\u002F\u003Cname>\u002F...`, `\u002Fhome\u002F\u003Cname>\u002F...`): rewrite to `$HOME\u002F...` only when the image provides the target or a missing target is harmless (a `PATH` entry); otherwise drop the line.\n3. **Host-only tools and integrations**: macOS commands (`pbcopy`, `pbpaste`, `open`, `osascript`, `defaults`, `security`, `launchctl`), terminal integrations (iTerm2 shell integration and similar), agent setup (`ssh-agent`, `ssh-add`, `gpg-agent`, `keychain`), SDK loaders from host paths, and version managers (`mise activate`, `asdf`, `nvm`, `pyenv init`, `rbenv init`, `conda` init blocks, `sdkman`). The image installs tools with mise and puts them on `PATH` without activation.\n4. **Sourced host files** that do not exist in the image (`source ~\u002F.zsh_local`, `source ~\u002F.config\u002Fzsh\u002Faliases.zsh`). If the user wants their content, inline the relevant parts after applying these same rules.\n5. **Credentials**: every line that exports a token, key, password or secret, and every export whose value comes from a command or file that yields a credential: keychains and password managers (`security find-generic-password`, `op read`, `pass`, `gopass`), CLI token commands (`$(gh auth token)`, `$(aws configure get ...)`), and secret files (`$(cat ~\u002F.secrets\u002F...)`). Do not repeat the value. Tell the user to supply the variable as a provider credential at runtime. `sandcast manifest set-shell` refuses configurations with credential-shaped values.\n\nKeep aliases, functions, `setopt` and `shopt` options, history settings, `bindkey` lines, `zstyle` lines, prompt configuration, and exports of non-secret settings such as `EDITOR`, `PAGER` or `LANG`.\n\n### 4b: Add and rewrite\n\nApply each rule whenever its trigger is present after stripping:\n\n1. **Completion system (zsh)**: the configuration needs `compinit` when it has no `compinit` call and any of these remain:\n   - a `compdef` call or a `zstyle ':completion:*'` line,\n   - a sourced or evaluated completion script, such as `source \u003C(\u003Ctool> completion zsh)`, `eval \"$(\u003Ctool> completion zsh)\"` or a sourced file that starts with `#compdef` (these scripts call `compdef`),\n   - a stripped plugin manager that loaded `compinit`.\n\n   Then insert this line before the first of those lines:\n\n   ```zsh\n   autoload -Uz compinit && compinit -i -D\n   ```\n\n   Keep both flags and never use `-C`. The home directory can be the workspace (`\u002Fsandbox`), which the sandbox and the checked-out project can write. `-D` keeps `compinit` from reading or writing a `.zcompdump` there, because a planted dump file would run as shell code at every shell start. `-i` skips completion directories that fail the ownership check instead of stopping the shell with a prompt.\n\n   Plugin managers load `compinit` transitively. Without it, `zstyle` has no effect, every completion script prints `command not found: compdef` at shell start, and tab completion falls back to plain file globbing.\n\n2. **Starship prompt**: guard the init line so that non-interactive exec sessions with `TERM=dumb` do not print starship errors:\n\n   ```zsh\n   if [[ \"$TERM\" != \"dumb\" ]]; then\n     eval \"$(starship init zsh)\"\n   fi\n   ```\n\n   Use `starship init bash` for bash.\n\n3. **Completions of removed plugins**: a stripped plugin often provided the completion that a kept `compdef` line refers to (for example `compdef kubecolor=kubectl` after an oh-my-zsh `kubectl` plugin). Before a kept `compdef` line whose completion a removed plugin provided, add a guarded load of the tool's own zsh completion, so the shell starts without errors whether or not the tool is in the image:\n\n   ```zsh\n   command -v \u003Ctool> >\u002Fdev\u002Fnull && source \u003C(\u003Ctool> completion zsh)\n   ```\n\n   Use the tool's own command for its completion script (`kubectl completion zsh`, `gh completion -s zsh`); when the tool has none, drop the `compdef` line instead.\n\n4. **fzf key bindings**: replace `source \u003C(fzf --zsh)` (and `eval \"$(fzf --zsh)\"` or `[ -f ~\u002F.fzf.zsh ] && source ~\u002F.fzf.zsh`) with this version-aware block. `fzf --zsh` needs fzf 0.48 or newer, and distribution packages can be older:\n\n   ```zsh\n   if fzf --zsh &>\u002Fdev\u002Fnull; then\n     source \u003C(fzf --zsh)\n   elif [ -f \u002Fusr\u002Fshare\u002Fdoc\u002Ffzf\u002Fexamples\u002Fkey-bindings.zsh ]; then\n     source \u002Fusr\u002Fshare\u002Fdoc\u002Ffzf\u002Fexamples\u002Fkey-bindings.zsh\n     [ -f \u002Fusr\u002Fshare\u002Fdoc\u002Ffzf\u002Fexamples\u002Fcompletion.zsh ] && source \u002Fusr\u002Fshare\u002Fdoc\u002Ffzf\u002Fexamples\u002Fcompletion.zsh\n   fi\n   ```\n\n   For bash, replace `eval \"$(fzf --bash)\"` (or `~\u002F.fzf.bash`) with:\n\n   ```bash\n   if fzf --bash >\u002Fdev\u002Fnull 2>&1; then\n     eval \"$(fzf --bash)\"\n   elif [ -f \u002Fusr\u002Fshare\u002Fdoc\u002Ffzf\u002Fexamples\u002Fkey-bindings.bash ]; then\n     . \u002Fusr\u002Fshare\u002Fdoc\u002Ffzf\u002Fexamples\u002Fkey-bindings.bash\n   fi\n   ```\n\n### 4c: List the referenced commands\n\nList every external command the curated configuration references: the first word of each alias value, every `eval \"$(\u003Ccmd> ...)\"` and `source \u003C(\u003Ccmd> ...)`, commands called in functions, and the values of `EDITOR`, `VISUAL`, `PAGER` and `MANPAGER`. Ignore shell builtins and the base utilities every image ships (`ls`, `cat`, `grep`, `sed`, `awk`, `find` and similar).\n\nFor each referenced command, find its component with `sandcast components list --json`: a component whose `key` equals the command or whose `match.host_tools` contains it (for example `rg` belongs to `ripgrep`). Confirm with `sandcast components show \u003Ckey>`; its binaries are `installer.\u003Ckind>.bins`, else `provides`, else the key.\n\n- A component exists: add its key to `shell.components`. A missing prompt or listing tool is a runtime failure the build cannot detect, so do not skip this.\n- No component exists: ask the user whether to drop the line or to keep it and add the command as an optional component (Step 3, item 5).\n\nShow the user the final curated configuration and the list of referenced components. Apply their corrections.\n\n### 4d: Write it\n\nWrite the curated text to a private temporary file created with `mktemp`, store it in the manifest, and delete the file. Run it as one shell command so that `$tmp` survives, and set `--program` to the shell you curated (`zsh` or `bash`). The snippet runs unchanged in sh, bash and zsh, in a subshell so that its `exit` and traps never end your own shell. It removes the file on every exit path, an interrupt included, and ends with the exit status of `sandcast`, so an exit 2 reaches you:\n\n```sh\n(\ntmp=\"$(mktemp)\" || exit\ntrap 'rm -f \"$tmp\"' EXIT\ntrap 'exit 129' HUP\ntrap 'exit 130' INT\ntrap 'exit 143' TERM\ncat > \"$tmp\" \u003C\u003C'SANDCAST_RC' || exit\n\u003Cthe curated configuration>\nSANDCAST_RC\nsandcast manifest set-shell --program \u003Czsh|bash> --file \"$tmp\"\n)\n```\n\nThe command also accepts the configuration on standard input. If it exits 2 because of a credential-shaped value, remove that line and write again; never weaken the value to get past the check.\nDo not edit `shell.rc` in the manifest by hand; rerun `sandcast manifest set-shell` to change it.\n\n### Example\n\nThe host `.zshrc`:\n\n```zsh\nexport PATH=\"\u002Fopt\u002Fhomebrew\u002Fbin:$HOME\u002F.local\u002Fbin:$PATH\"\nsource \u002Fopt\u002Fhomebrew\u002Fopt\u002Fantidote\u002Fshare\u002Fantidote\u002Fantidote.zsh\nantidote load\nzstyle ':completion:*' menu select\neval \"$(starship init zsh)\"\nsource \u003C(fzf --zsh)\nalias ls=lsd\nsetopt HIST_IGNORE_DUPS SHARE_HISTORY\n```\n\nThe curated configuration:\n\n```zsh\nexport PATH=\"$HOME\u002F.local\u002Fbin:$PATH\"\n\nautoload -Uz compinit && compinit -i -D\nzstyle ':completion:*' menu select\n\nif [[ \"$TERM\" != \"dumb\" ]]; then\n  eval \"$(starship init zsh)\"\nfi\n\nif fzf --zsh &>\u002Fdev\u002Fnull; then\n  source \u003C(fzf --zsh)\nelif [ -f \u002Fusr\u002Fshare\u002Fdoc\u002Ffzf\u002Fexamples\u002Fkey-bindings.zsh ]; then\n  source \u002Fusr\u002Fshare\u002Fdoc\u002Ffzf\u002Fexamples\u002Fkey-bindings.zsh\n  [ -f \u002Fusr\u002Fshare\u002Fdoc\u002Ffzf\u002Fexamples\u002Fcompletion.zsh ] && source \u002Fusr\u002Fshare\u002Fdoc\u002Ffzf\u002Fexamples\u002Fcompletion.zsh\nfi\n\nalias ls=lsd\nsetopt HIST_IGNORE_DUPS SHARE_HISTORY\n```\n\nThe referenced components are `fzf`, `lsd` and `starship`, so `shell.components` is `[fzf, lsd, starship]`.\n\n## Step 5: Propose the dotfiles beyond the shell\n\nThe image baked configuration must survive the OpenShell home overmount: at runtime the workspace volume is mounted over the home, so anything under the home is hidden and a startup file there is never read. sandcast relocates dotfiles outside the home automatically; your job is only to propose which ones to bake.\n\n`sandcast components match` reports the host dotfiles from a bounded allowlist under `dotfiles` in its JSON (git, the prompt tool, tmux and readline basics; the shell configuration is already handled in Step 4, so it is not repeated here). Present them with a multi-select, exactly as you do for MCP servers and plugins, and let the user confirm which to bake. Add nothing the user did not confirm.\n\nThe user may also name dotfiles the allowlist omits, within these bounds, which sandcast enforces at plan time:\n\n- From the home, only allowlist entries and the configuration of these tools under `~\u002F.config`: `git\u002F`, `starship.toml`, `nvim\u002F`, `helix\u002F`, `tmux\u002F`, `alacritty\u002F`, `kitty\u002F`, `wezterm\u002F`, `ghostty\u002F`, `bat\u002F`, `ripgrep\u002F` (for example `~\u002F.config\u002Fghostty\u002Fconfig` or `~\u002F.config\u002Fnvim\u002Finit.lua`). Nothing else under `~\u002F.config` is read: it also holds credential stores (`gh`, `gcloud`, `sops`, `op`, `containers`, `rclone`) whose contents no redactor recognizes reliably. Use `~\u002F`, never `~user\u002F`, and spell the path exactly.\n- Any project-relative path inside the project. An absolute path only when it lies inside the project.\n- Never a credential store (`~\u002F.ssh`, `~\u002F.aws`, `~\u002F.gnupg`, `~\u002F.kube`, `~\u002F.docker`, `~\u002F.config\u002Fgh` and the other `~\u002F.config` stores), `.netrc`, a history file, or a path with a segment that looks like a key, token, secret, credential or certificate. Do not propose these, and tell the user why when they ask for one.\n- Only regular files up to 256 KiB.\n\nFor a file outside these bounds, suggest copying it into the project and listing the project-relative path. sandcast skips an entry outside the bounds, or one that does not exist at build time, with a notice; it never fails the build.\n\nRecord the confirmed entries under `dotfiles` in the manifest as a list of `{path: ...}` entries. A `~\u002F` path resolves against the host home; a project-relative path resolves against the project root and must stay inside it. Record only the source path, never the contents: sandcast reads the file at build time, redacts any credential shape, and bakes it to a persistent location outside the home (for example `\u002Fetc\u002Fgitconfig`, `\u002Fetc\u002Ftmux.conf` or `\u002Fetc\u002Fxdg\u002F...`). Do not add a relocation target by hand; the plan chooses it.\n\n## Step 6: Write the components and harnesses, then validate\n\nEdit `.sandcast\u002Fmanifest.yaml` directly for the parts `sandcast manifest set-shell` does not write. The schema rejects unknown keys everywhere. The shape:\n\n```yaml\nschema_version: 1\nname: my-project\nbase_image: nvidia-community-base\ncomponents:\n  - key: git\n  - key: go\n  - key: python\n    version: \"3.13\"\n  - key: my-internal-tool\n    optional: true\nharnesses:\n  - name: claude-code\n    mcp_servers:\n      - name: docs\n        command: [npx, -y, \"@example\u002Fdocs-mcp\"]\n        env:\n          DOCS_API_KEY: \"${SANDCAST_SECRET_1}\"\n      - name: tracker\n        url: https:\u002F\u002Fmcp.example.com\u002Fsse\n        env:\n          MCP_TRACKER_TOKEN: \"${SANDCAST_SECRET_2}\"\n    plugins:\n      - name: clangd-lsp@claude-plugins-official\n        source: anthropics\u002Fclaude-plugins-official\n    skills:\n      - name: review\n        source: .claude\u002Fskills\u002Freview\nshell:\n  program: zsh\n  rc: |\n    # written by sandcast manifest set-shell\n  components: [fzf, lsd, starship]\ndotfiles:\n  - path: ~\u002F.gitconfig\n  - path: ~\u002F.config\u002Fstarship.toml\ntargets:\n  openshell:\n    image: localhost\u002Fmy-project\n```\n\n- `components`: the confirmed list from Step 3. Leave out components already listed in `shell.components`, the shell program itself (`zsh` or `bash`) and the agent component of each harness (`claude-code`); the plan adds those implicitly.\n- `harnesses`: one entry per selected harness with only the MCP servers, plugins and skills the user chose. Copy `name`, `command`, `url`, `env`, and `source` exactly as discovery printed them, placeholders included, except the `source` of a skill or marketplace you moved into the project in Step 2. Drop the `origin` fields. Omit `harnesses` entirely when the user selected none.\n- `shell.components`: the referenced components from Step 4c.\n- `dotfiles`: the confirmed entries from Step 5, each `{path: ...}`. Omit `dotfiles` entirely when the user confirmed none.\n- `platform`: set it (`linux\u002Famd64` or `linux\u002Farm64`) only when the user builds for a platform other than the host's.\n\nThen validate:\n\n```sh\nsandcast manifest validate --json\n```\n\nThe JSON has `valid`, `manifest` and `diagnostics` (each with `path`, `line`, `message`).\nIf `valid` is false, show every diagnostic with its line, fix what is clearly yours to fix (a typo in a key, a wrong field name), and validate again. If a diagnostic needs a user decision or reports a credential, stop and show the diagnostics; never write a credential to make validation pass.\n\n## Step 7: Offer the lockfile\n\nBuilds install mise tools in locked mode, and `sandcast plan` fails for a platform the lockfile lacks. Offer to generate the lockfile for the target platform (default: the manifest `platform`, else the host architecture). Repeat `--platform` for more than one:\n\n```sh\nsandcast lock --platform linux\u002Farm64\n```\n\nExit 3 means the host has no `mise` or one older than the minimum release named in the error message. Report every tool the command could not lock, with its platform and reason.\n\n## Finish\n\nSummarize for the user:\n\n- the components, harness extensions and shell components in the manifest,\n- the dotfiles baked and where each one is relocated to,\n- every secret placeholder and how to supply it at runtime,\n- what the shell curation removed,\n- the next step: `\u002Fsandcast-build` (or `sandcast build --verify` when no component is unresolved).\n\nSuggest committing `.sandcast\u002Fmanifest.yaml` and `.sandcast\u002Fmise.lock`.\n","# sandcast capture\n\nYou turn the current project directory and the developer's host environment into a sandcast manifest (`.sandcast\u002Fmanifest.yaml`).\nThe `sandcast` binary provides every fact you need. Your job is judgment: present what the binary found, let the user decide, curate the shell configuration, and write the result.\nThe build happens later, through `\u002Fsandcast-build` or `sandcast build`.\n\n## Rules\n\nFollow these rules in every step. They are part of the sandcast contract and a reviewer checks them.\n\n1. **Facts come from the binary.** Component keys, match evidence, host tool versions, harness discovery and validation results come from `sandcast ... --json`. Never invent a component key, a version, or a configuration value the binary did not report.\n2. **Never handle credentials.** Never ask for, print, copy, or write a secret value (tokens, API keys, passwords, private keys). The binary replaces discovered secrets with `${SANDCAST_SECRET_N}` placeholders. Keep each placeholder exactly as returned and tell the user to supply the real value at runtime as a credential of the OpenShell provider attached to the sandbox.\n3. **Write only the manifest.** You create or change `.sandcast\u002Fmanifest.yaml` through `sandcast init`, `sandcast manifest set-shell` and direct edits, and `.sandcast\u002Fmise.lock` through `sandcast lock`. Never write a Containerfile or any other image definition (FR-037), never touch `.sandcast\u002Fbuild\u002F`, `.sandcast\u002Ffragments\u002F` or `.sandcast\u002Frecipes\u002F`. The one exception: with the user's consent, copy a chosen skill or local marketplace from outside the project into the project (Step 2).\n4. **Ask before deciding.** Every component, harness extension and shell change ends up in an image the user runs. Present proposals with their evidence and wait for confirmation.\n5. **Run commands from the project root** (or pass `--project \u003Cdir>`). Exit codes: 0 success, 1 operation failed, 2 usage or validation error, 3 external tool missing or at the wrong version.\n6. **Temporary files live outside the project**: create them with `mktemp`, never under a fixed name in a shared directory, and delete them when the step is done.\n\n## Step 1: Check the skill and binary versions\n\nRun:\n\n```sh\nsandcast skills check --harness claude-code\n```\n\n- Exit 0: continue.\n- Exit 3: the installed skills and the binary disagree. Print the message exactly as the command printed it, tell the user which side to update, and **stop**. The message names it: `run \"sandcast skills install --harness claude-code\"` when the skill is missing or older than the binary, `update the sandcast binary` when the skill is newer.\n- Command not found: tell the user to install the `sandcast` binary first and stop.\n- Any other failure: show the output and stop.\n\n## Step 2: Choose the harnesses\n\nAsk the user upfront which agent harnesses the image should include (FR-036).\nShow what this host has:\n\n```sh\nsandcast harness list --json\n```\n\nEach entry has `name`, `component`, `installed` and `path`. Offer exactly the harnesses this list reports, marking which are installed on the host. If the user asks for a harness the list does not report, say that its adapter is not available yet and leave it out. The user may also choose no harness at all.\n\nFor **each selected harness only**, run discovery with the harness `name` from the list (for example `claude-code`):\n\n```sh\nsandcast harness discover \u003Charness> --json\n```\n\nRun it once per selected harness and handle each result with the steps below. If the user selected no harness, skip discovery and continue with Step 3.\n\nThe JSON has `harness`, `mcp_servers` (each with `name`, `command` or `url`, `env`, `origin`), `plugins` and `skills` (each with `name`, `source`, `origin`, `portable`, and `reason` when `portable` is false), `redacted` (each with `path`, `kind`, `placeholder`, `env_var`) and `notes`. A plugin whose local marketplace directory is a git checkout with a remote comes with a `remote` object (`url`, `unpushed_commits`, `uncommitted_changes`, `name_match`) and a `source` taken from that remote (`owner\u002Frepo` for GitHub, else the remote URL).\n\n1. Present the MCP servers, plugins and skills as three short groups, each item with its origin file. For MCP servers show the environment variable names, not their values.\n2. For each non-empty group, ask which items to bake into the image with a multi-select prompt: a checkbox list the user ticks, not a request to type item numbers. Use the harness's multi-select control when it has one (for example, in Claude Code, `AskUserQuestion` with `multiSelect: true`), and fall back to a numbered list only when the harness has no such control. Offer MCP servers, plugins and skills as three separate multi-select prompts so each is chosen independently. Nothing is baked by default: an empty selection bakes none.\n3. Check the `portable` marker of every chosen skill and plugin; do not decide by looking at the path yourself. An entry with `portable: false` makes the manifest host-specific: the binary reads its source on the machine that runs the plan, so `sandcast plan` and `sandcast build` fail in CI and on every other machine that lacks the path. Show its `reason`. For each such skill, explain this and offer to copy it into the project:\n   - Ask first. If the user declines, keep the discovered source and say that only this host can build the image.\n   - Copy only the skill directory, to `.claude\u002Fskills\u002F\u003Cname>` in the project, and never overwrite an existing directory. List its files first and leave out every file that holds a credential (`.env` files, private keys such as `*.pem` or `*.key`, files named like token, secret or credentials); if the skill needs such a file, stop and ask. Show symbolic links and ask before copying them.\n   - The name filter misses a token inside an ordinary file, such as a script or a `config.json`, and no sandcast command scans the copied files before a commit. So after copying, show the user the list of copied files (paths only, never their contents) and ask them to confirm that none of them holds a credential. Remove every file they are unsure about, or stop and ask.\n   - Record `source: .claude\u002Fskills\u002F\u003Cname>` for the skill. Only after the user has confirmed the file list, remind them to commit the directory; check that `.gitignore` does not exclude it.\n\n   For a non-portable local marketplace, explain the same limit and offer two remedies: copy the marketplace directory into the project (same rules) and use its `.\u002F` path as the plugin source, or publish it as a git repository and use `owner\u002Frepo` or its URL.\n\n   A plugin with a `remote` object was proposed through the git remote of its local marketplace, so you need no manual remote lookup. It stays opt-in like every other plugin. Before the user decides, present its remote notes: the remote `url`; `unpushed_commits` greater than 0 or `uncommitted_changes: true` means the image gets the remote's state, not the local one, so the user should push first, and `unpushed_commits: null` means the count is unknown because no remote-tracking ref exists locally; `name_match: mismatch` means the remote's marketplace file declares another name than the locally registered one, and `name_match: unknown` means it could not be checked: no remote-tracking ref exists locally (discovery never fetches), or the remote's marketplace file is missing or declares no name.\n4. For every entry in `redacted`, explain: the value at `path` looked like a credential (`kind`), the binary replaced it with `placeholder`, and the user supplies the real value at runtime as a provider credential under the environment variable named in `env_var` (the `env` key when the whole env value was the secret, `SANDCAST_SECRET_N` for a secret inside a longer value, an argument or a URL, including an access key in a URL path). Never offer to fill in the value.\n   MCP servers reached by `url` carry their bearer credential as one `env` entry, either a placeholder such as `MCP_\u003CNAME>_TOKEN: \"${SANDCAST_SECRET_N}\"` or a reference such as `VAR: \"${VAR}\"`. Keep both forms unchanged.\n5. Show every `notes` entry.\n\nDo not run discovery for harnesses the user did not select. Unselected harnesses leave no trace in the manifest.\n\n## Step 3: Create the manifest and choose the components\n\nIf `.sandcast\u002Fmanifest.yaml` does not exist, ask for the manifest name (kebab-case, default: the directory name), the target (`openshell` by default, or `container`) and the base image. Show the registry entries for the chosen target:\n\n```sh\nsandcast base-images list --target \u003Copenshell|container> --json\n```\n\nEach entry has `target`, `name`, `ref`, `default` and `notes`. Show the notes; they say which user and tools the image has.\n\nAsk where the image will run, because `sandcast init` never asks:\n\n- **A local OpenShell gateway** that uses the same container engine on this machine (for example a gateway with the podman driver): the default `localhost\u002F\u003Cname>` works. Create the skeleton:\n\n  ```sh\n  sandcast init --name \u003Cname> --base-image \u003Cregistry-entry-or-image-ref> --target \u003Copenshell|container>\n  ```\n\n- **A remote gateway** (a cluster, a cloud gateway, or any gateway that cannot read this engine's image storage): ask for the registry reference the cluster can pull (for example `quay.io\u002F\u003Cuser>\u002F\u003Cname>`, never `docker.io\u002F\u003Cname>` without a namespace) and the cluster's architecture (`linux\u002Famd64` for most clusters), and pass them with push enabled:\n\n  ```sh\n  sandcast init --name \u003Cname> --base-image \u003Cregistry-entry-or-image-ref> --target openshell --image \u003Cregistry\u002Fname> --platform \u003Clinux\u002Famd64|linux\u002Farm64> --push\n  ```\n\n  When the platform differs from this machine's architecture, point the user to `docs\u002Fguides\u002Fcross-arch.md`.\n\nIf the manifest already exists, read it, tell the user you will update it, and keep its existing entries unless the user removes them.\n\nNow let the binary match the project and the host against the component tiers. Add one `--harness \u003Charness>` per selected harness so the agent components are proposed too; pass no `--harness` flag when the user selected no harness:\n\n```sh\nsandcast components match . --host --harness \u003Charness> --json\n```\n\nThe JSON shape is:\n\n```json\n{\"project\": \"\u003Cdir>\",\n \"proposals\": [{\"key\": \"go\", \"name\": \"Go\", \"source\": \"project\", \"evidence\": [\"go.mod\"], \"detected_version\": \"1.25.1\",\n                \"pinned_versions\": [{\"value\": \"1.26.7\", \"file\": \"go.mod\", \"kind\": \"exact\"}]}],\n \"available\": [{\"key\": \"rust\", \"name\": \"Rust\", \"tier\": \"shipped\"}],\n \"notes\": []}\n```\n\n`pinned_versions` lists every version the project pins for the component, with its `file` and its `kind`: `exact` (a full version such as `1.95.0`), `range` (`>=3.12`, `^20`, `1.26`) or `channel` (`stable`, `nightly`, `lts\u002F*`). Show every `notes` entry; a note names a pin file that could not be read.\n\n`source` is one of `project` (ecosystem files), `host` (a tool found on the host `PATH`), `harness` (a selected harness) or `always` (base system components).\n\n1. Present the proposals grouped by source as a table with key, name, evidence and detected version.\n2. If no proposal has the source `project`, say explicitly: \"No recognizable ecosystem files were found in this project.\" Then still offer the host tools and the `available` components as optional additions.\n3. Offer the `available` components as optional additions.\n4. Let the user confirm, drop or add components. Keep `always` proposals unless the user explicitly removes them.\n5. Additions must be keys from `proposals`, `available`, or `sandcast components list --json`. If the user wants a tool that no tier defines, explain the two choices: add it with `optional: true` so that `\u002Fsandcast-build` offers to write an install fragment for it, or let the user define it in `.sandcast\u002Fcomponents\u002F\u003Ckey>.yaml` first. The user writes that file; you may show the shape from `sandcast components show \u003Csimilar-key>`, but do not write it yourself.\n6. Set `version` on a component only when the user asks for a specific version or the project pins one. When a proposal has `pinned_versions`, propose the first `exact` value as the component's `version:` (for go only the first entry counts: it is the highest version across a `go.work`'s modules, and when it is a `range` such as `1.27` a lower exact pin is not proposed), name the file it came from, and let the user accept or change it. Never turn a `range` or `channel` value into an exact pin; mention it, and leave `version` out unless the user chooses a version. Without a pin, leave `version` out; the lockfile pins exact versions.\n\nKeep the confirmed list in mind; you write it in Step 5.\n\n## Step 4: Curate the shell configuration\n\nThe image gets a curated copy of the user's interactive shell configuration, installed under `\u002Fetc` for the final user.\nHost configurations carry plugin managers, macOS paths and host-only tools that break inside a Linux sandbox. The rules below encode the failures recorded in earlier image builds (brainstorm 072, changes 7, 11, 12 and 13).\n\nFind the login shell with `basename \"$SHELL\"`.\n\n- `zsh`: read `${ZDOTDIR:-$HOME}\u002F.zshrc`.\n- `bash`: read `~\u002F.bashrc` (or `~\u002F.bash_profile` when there is no `.bashrc`).\n- Any other shell: say that sandcast curates only zsh and bash. Ask whether to skip the shell configuration or to write a minimal zsh or bash configuration with the user. If the user skips it, continue with Step 5.\n\nIf the file sources other files from the home directory that hold aliases or functions, ask before reading them. Never print a line that sets a credential; refer to it by line number and variable name only.\n\n### 4a: Strip\n\nRemove these lines, and tell the user what you removed and why:\n\n1. **Plugin managers and everything they load**: antidote (`source ...\u002Fantidote.zsh`, `antidote load`, `antidote bundle`), oh-my-zsh (`export ZSH=...`, `ZSH_THEME=...`, `plugins=(...)`, `source $ZSH\u002Foh-my-zsh.sh`), zinit (`source ...\u002Fzinit.zsh`, every `zinit ...` line), zplug (`source ~\u002F.zplug\u002Finit.zsh`, every `zplug ...` line). Treat antigen, prezto, zgenom, sheldon and znap the same way. For bash: oh-my-bash (`export OSH=...`, `OSH_THEME=...`, the `plugins=(...)`, `completions=(...)` and `aliases=(...)` arrays, `source \"$OSH\"\u002Foh-my-bash.sh`), bash-it (`export BASH_IT=...`, `BASH_IT_THEME=...`, `source \"$BASH_IT\"\u002Fbash_it.sh`) and ble.sh (`source ...\u002Fble.sh`, `ble-attach`). List the plugins that are lost, so the user knows.\n2. **Homebrew, Linuxbrew and host paths**: anything under `\u002Fopt\u002Fhomebrew`, `\u002Fusr\u002Flocal\u002FHomebrew`, `\u002Fusr\u002Flocal\u002Fopt`, `\u002Fusr\u002Flocal\u002FCellar`, `\u002Fhome\u002Flinuxbrew\u002F.linuxbrew`, `~\u002F.linuxbrew`, `\u002FApplications`, `\u002FLibrary`, `~\u002FLibrary` or `\u002FSystem`, plus `brew shellenv`, `$(brew --prefix ...)`, `HOMEBREW_*` and `DYLD_*`. In a `PATH` assignment remove only the host entries and keep the portable ones, for example `export PATH=\"\u002Fopt\u002Fhomebrew\u002Fbin:$HOME\u002F.local\u002Fbin:$PATH\"` becomes `export PATH=\"$HOME\u002F.local\u002Fbin:$PATH\"`. Absolute paths into the host home (`\u002FUsers\u002F\u003Cname>\u002F...`, `\u002Fhome\u002F\u003Cname>\u002F...`): rewrite to `$HOME\u002F...` only when the image provides the target or a missing target is harmless (a `PATH` entry); otherwise drop the line.\n3. **Host-only tools and integrations**: macOS commands (`pbcopy`, `pbpaste`, `open`, `osascript`, `defaults`, `security`, `launchctl`), terminal integrations (iTerm2 shell integration and similar), agent setup (`ssh-agent`, `ssh-add`, `gpg-agent`, `keychain`), SDK loaders from host paths, and version managers (`mise activate`, `asdf`, `nvm`, `pyenv init`, `rbenv init`, `conda` init blocks, `sdkman`). The image installs tools with mise and puts them on `PATH` without activation.\n4. **Sourced host files** that do not exist in the image (`source ~\u002F.zsh_local`, `source ~\u002F.config\u002Fzsh\u002Faliases.zsh`). If the user wants their content, inline the relevant parts after applying these same rules.\n5. **Credentials**: every line that exports a token, key, password or secret, and every export whose value comes from a command or file that yields a credential: keychains and password managers (`security find-generic-password`, `op read`, `pass`, `gopass`), CLI token commands (`$(gh auth token)`, `$(aws configure get ...)`), and secret files (`$(cat ~\u002F.secrets\u002F...)`). Do not repeat the value. Tell the user to supply the variable as a provider credential at runtime. `sandcast manifest set-shell` refuses configurations with credential-shaped values.\n\nKeep aliases, functions, `setopt` and `shopt` options, history settings, `bindkey` lines, `zstyle` lines, prompt configuration, and exports of non-secret settings such as `EDITOR`, `PAGER` or `LANG`.\n\n### 4b: Add and rewrite\n\nApply each rule whenever its trigger is present after stripping:\n\n1. **Completion system (zsh)**: the configuration needs `compinit` when it has no `compinit` call and any of these remain:\n   - a `compdef` call or a `zstyle ':completion:*'` line,\n   - a sourced or evaluated completion script, such as `source \u003C(\u003Ctool> completion zsh)`, `eval \"$(\u003Ctool> completion zsh)\"` or a sourced file that starts with `#compdef` (these scripts call `compdef`),\n   - a stripped plugin manager that loaded `compinit`.\n\n   Then insert this line before the first of those lines:\n\n   ```zsh\n   autoload -Uz compinit && compinit -i -D\n   ```\n\n   Keep both flags and never use `-C`. The home directory can be the workspace (`\u002Fsandbox`), which the sandbox and the checked-out project can write. `-D` keeps `compinit` from reading or writing a `.zcompdump` there, because a planted dump file would run as shell code at every shell start. `-i` skips completion directories that fail the ownership check instead of stopping the shell with a prompt.\n\n   Plugin managers load `compinit` transitively. Without it, `zstyle` has no effect, every completion script prints `command not found: compdef` at shell start, and tab completion falls back to plain file globbing.\n\n2. **Starship prompt**: guard the init line so that non-interactive exec sessions with `TERM=dumb` do not print starship errors:\n\n   ```zsh\n   if [[ \"$TERM\" != \"dumb\" ]]; then\n     eval \"$(starship init zsh)\"\n   fi\n   ```\n\n   Use `starship init bash` for bash.\n\n3. **Completions of removed plugins**: a stripped plugin often provided the completion that a kept `compdef` line refers to (for example `compdef kubecolor=kubectl` after an oh-my-zsh `kubectl` plugin). Before a kept `compdef` line whose completion a removed plugin provided, add a guarded load of the tool's own zsh completion, so the shell starts without errors whether or not the tool is in the image:\n\n   ```zsh\n   command -v \u003Ctool> >\u002Fdev\u002Fnull && source \u003C(\u003Ctool> completion zsh)\n   ```\n\n   Use the tool's own command for its completion script (`kubectl completion zsh`, `gh completion -s zsh`); when the tool has none, drop the `compdef` line instead.\n\n4. **fzf key bindings**: replace `source \u003C(fzf --zsh)` (and `eval \"$(fzf --zsh)\"` or `[ -f ~\u002F.fzf.zsh ] && source ~\u002F.fzf.zsh`) with this version-aware block. `fzf --zsh` needs fzf 0.48 or newer, and distribution packages can be older:\n\n   ```zsh\n   if fzf --zsh &>\u002Fdev\u002Fnull; then\n     source \u003C(fzf --zsh)\n   elif [ -f \u002Fusr\u002Fshare\u002Fdoc\u002Ffzf\u002Fexamples\u002Fkey-bindings.zsh ]; then\n     source \u002Fusr\u002Fshare\u002Fdoc\u002Ffzf\u002Fexamples\u002Fkey-bindings.zsh\n     [ -f \u002Fusr\u002Fshare\u002Fdoc\u002Ffzf\u002Fexamples\u002Fcompletion.zsh ] && source \u002Fusr\u002Fshare\u002Fdoc\u002Ffzf\u002Fexamples\u002Fcompletion.zsh\n   fi\n   ```\n\n   For bash, replace `eval \"$(fzf --bash)\"` (or `~\u002F.fzf.bash`) with:\n\n   ```bash\n   if fzf --bash >\u002Fdev\u002Fnull 2>&1; then\n     eval \"$(fzf --bash)\"\n   elif [ -f \u002Fusr\u002Fshare\u002Fdoc\u002Ffzf\u002Fexamples\u002Fkey-bindings.bash ]; then\n     . \u002Fusr\u002Fshare\u002Fdoc\u002Ffzf\u002Fexamples\u002Fkey-bindings.bash\n   fi\n   ```\n\n### 4c: List the referenced commands\n\nList every external command the curated configuration references: the first word of each alias value, every `eval \"$(\u003Ccmd> ...)\"` and `source \u003C(\u003Ccmd> ...)`, commands called in functions, and the values of `EDITOR`, `VISUAL`, `PAGER` and `MANPAGER`. Ignore shell builtins and the base utilities every image ships (`ls`, `cat`, `grep`, `sed`, `awk`, `find` and similar).\n\nFor each referenced command, find its component with `sandcast components list --json`: a component whose `key` equals the command or whose `match.host_tools` contains it (for example `rg` belongs to `ripgrep`). Confirm with `sandcast components show \u003Ckey>`; its binaries are `installer.\u003Ckind>.bins`, else `provides`, else the key.\n\n- A component exists: add its key to `shell.components`. A missing prompt or listing tool is a runtime failure the build cannot detect, so do not skip this.\n- No component exists: ask the user whether to drop the line or to keep it and add the command as an optional component (Step 3, item 5).\n\nShow the user the final curated configuration and the list of referenced components. Apply their corrections.\n\n### 4d: Write it\n\nWrite the curated text to a private temporary file created with `mktemp`, store it in the manifest, and delete the file. Run it as one shell command so that `$tmp` survives, and set `--program` to the shell you curated (`zsh` or `bash`). The snippet runs unchanged in sh, bash and zsh, in a subshell so that its `exit` and traps never end your own shell. It removes the file on every exit path, an interrupt included, and ends with the exit status of `sandcast`, so an exit 2 reaches you:\n\n```sh\n(\ntmp=\"$(mktemp)\" || exit\ntrap 'rm -f \"$tmp\"' EXIT\ntrap 'exit 129' HUP\ntrap 'exit 130' INT\ntrap 'exit 143' TERM\ncat > \"$tmp\" \u003C\u003C'SANDCAST_RC' || exit\n\u003Cthe curated configuration>\nSANDCAST_RC\nsandcast manifest set-shell --program \u003Czsh|bash> --file \"$tmp\"\n)\n```\n\nThe command also accepts the configuration on standard input. If it exits 2 because of a credential-shaped value, remove that line and write again; never weaken the value to get past the check.\nDo not edit `shell.rc` in the manifest by hand; rerun `sandcast manifest set-shell` to change it.\n\n### Example\n\nThe host `.zshrc`:\n\n```zsh\nexport PATH=\"\u002Fopt\u002Fhomebrew\u002Fbin:$HOME\u002F.local\u002Fbin:$PATH\"\nsource \u002Fopt\u002Fhomebrew\u002Fopt\u002Fantidote\u002Fshare\u002Fantidote\u002Fantidote.zsh\nantidote load\nzstyle ':completion:*' menu select\neval \"$(starship init zsh)\"\nsource \u003C(fzf --zsh)\nalias ls=lsd\nsetopt HIST_IGNORE_DUPS SHARE_HISTORY\n```\n\nThe curated configuration:\n\n```zsh\nexport PATH=\"$HOME\u002F.local\u002Fbin:$PATH\"\n\nautoload -Uz compinit && compinit -i -D\nzstyle ':completion:*' menu select\n\nif [[ \"$TERM\" != \"dumb\" ]]; then\n  eval \"$(starship init zsh)\"\nfi\n\nif fzf --zsh &>\u002Fdev\u002Fnull; then\n  source \u003C(fzf --zsh)\nelif [ -f \u002Fusr\u002Fshare\u002Fdoc\u002Ffzf\u002Fexamples\u002Fkey-bindings.zsh ]; then\n  source \u002Fusr\u002Fshare\u002Fdoc\u002Ffzf\u002Fexamples\u002Fkey-bindings.zsh\n  [ -f \u002Fusr\u002Fshare\u002Fdoc\u002Ffzf\u002Fexamples\u002Fcompletion.zsh ] && source \u002Fusr\u002Fshare\u002Fdoc\u002Ffzf\u002Fexamples\u002Fcompletion.zsh\nfi\n\nalias ls=lsd\nsetopt HIST_IGNORE_DUPS SHARE_HISTORY\n```\n\nThe referenced components are `fzf`, `lsd` and `starship`, so `shell.components` is `[fzf, lsd, starship]`.\n\n## Step 5: Propose the dotfiles beyond the shell\n\nThe image baked configuration must survive the OpenShell home overmount: at runtime the workspace volume is mounted over the home, so anything under the home is hidden and a startup file there is never read. sandcast relocates dotfiles outside the home automatically; your job is only to propose which ones to bake.\n\n`sandcast components match` reports the host dotfiles from a bounded allowlist under `dotfiles` in its JSON (git, the prompt tool, tmux and readline basics; the shell configuration is already handled in Step 4, so it is not repeated here). Present them with a multi-select, exactly as you do for MCP servers and plugins, and let the user confirm which to bake. Add nothing the user did not confirm.\n\nThe user may also name dotfiles the allowlist omits, within these bounds, which sandcast enforces at plan time:\n\n- From the home, only allowlist entries and the configuration of these tools under `~\u002F.config`: `git\u002F`, `starship.toml`, `nvim\u002F`, `helix\u002F`, `tmux\u002F`, `alacritty\u002F`, `kitty\u002F`, `wezterm\u002F`, `ghostty\u002F`, `bat\u002F`, `ripgrep\u002F` (for example `~\u002F.config\u002Fghostty\u002Fconfig` or `~\u002F.config\u002Fnvim\u002Finit.lua`). Nothing else under `~\u002F.config` is read: it also holds credential stores (`gh`, `gcloud`, `sops`, `op`, `containers`, `rclone`) whose contents no redactor recognizes reliably. Use `~\u002F`, never `~user\u002F`, and spell the path exactly.\n- Any project-relative path inside the project. An absolute path only when it lies inside the project.\n- Never a credential store (`~\u002F.ssh`, `~\u002F.aws`, `~\u002F.gnupg`, `~\u002F.kube`, `~\u002F.docker`, `~\u002F.config\u002Fgh` and the other `~\u002F.config` stores), `.netrc`, a history file, or a path with a segment that looks like a key, token, secret, credential or certificate. Do not propose these, and tell the user why when they ask for one.\n- Only regular files up to 256 KiB.\n\nFor a file outside these bounds, suggest copying it into the project and listing the project-relative path. sandcast skips an entry outside the bounds, or one that does not exist at build time, with a notice; it never fails the build.\n\nRecord the confirmed entries under `dotfiles` in the manifest as a list of `{path: ...}` entries. A `~\u002F` path resolves against the host home; a project-relative path resolves against the project root and must stay inside it. Record only the source path, never the contents: sandcast reads the file at build time, redacts any credential shape, and bakes it to a persistent location outside the home (for example `\u002Fetc\u002Fgitconfig`, `\u002Fetc\u002Ftmux.conf` or `\u002Fetc\u002Fxdg\u002F...`). Do not add a relocation target by hand; the plan chooses it.\n\n## Step 6: Write the components and harnesses, then validate\n\nEdit `.sandcast\u002Fmanifest.yaml` directly for the parts `sandcast manifest set-shell` does not write. The schema rejects unknown keys everywhere. The shape:\n\n```yaml\nschema_version: 1\nname: my-project\nbase_image: nvidia-community-base\ncomponents:\n  - key: git\n  - key: go\n  - key: python\n    version: \"3.13\"\n  - key: my-internal-tool\n    optional: true\nharnesses:\n  - name: claude-code\n    mcp_servers:\n      - name: docs\n        command: [npx, -y, \"@example\u002Fdocs-mcp\"]\n        env:\n          DOCS_API_KEY: \"${SANDCAST_SECRET_1}\"\n      - name: tracker\n        url: https:\u002F\u002Fmcp.example.com\u002Fsse\n        env:\n          MCP_TRACKER_TOKEN: \"${SANDCAST_SECRET_2}\"\n    plugins:\n      - name: clangd-lsp@claude-plugins-official\n        source: anthropics\u002Fclaude-plugins-official\n    skills:\n      - name: review\n        source: .claude\u002Fskills\u002Freview\nshell:\n  program: zsh\n  rc: |\n    # written by sandcast manifest set-shell\n  components: [fzf, lsd, starship]\ndotfiles:\n  - path: ~\u002F.gitconfig\n  - path: ~\u002F.config\u002Fstarship.toml\ntargets:\n  openshell:\n    image: localhost\u002Fmy-project\n```\n\n- `components`: the confirmed list from Step 3. Leave out components already listed in `shell.components`, the shell program itself (`zsh` or `bash`) and the agent component of each harness (`claude-code`); the plan adds those implicitly.\n- `harnesses`: one entry per selected harness with only the MCP servers, plugins and skills the user chose. Copy `name`, `command`, `url`, `env`, and `source` exactly as discovery printed them, placeholders included, except the `source` of a skill or marketplace you moved into the project in Step 2. Drop the `origin` fields. Omit `harnesses` entirely when the user selected none.\n- `shell.components`: the referenced components from Step 4c.\n- `dotfiles`: the confirmed entries from Step 5, each `{path: ...}`. Omit `dotfiles` entirely when the user confirmed none.\n- `platform`: set it (`linux\u002Famd64` or `linux\u002Farm64`) only when the user builds for a platform other than the host's.\n\nThen validate:\n\n```sh\nsandcast manifest validate --json\n```\n\nThe JSON has `valid`, `manifest` and `diagnostics` (each with `path`, `line`, `message`).\nIf `valid` is false, show every diagnostic with its line, fix what is clearly yours to fix (a typo in a key, a wrong field name), and validate again. If a diagnostic needs a user decision or reports a credential, stop and show the diagnostics; never write a credential to make validation pass.\n\n## Step 7: Offer the lockfile\n\nBuilds install mise tools in locked mode, and `sandcast plan` fails for a platform the lockfile lacks. Offer to generate the lockfile for the target platform (default: the manifest `platform`, else the host architecture). Repeat `--platform` for more than one:\n\n```sh\nsandcast lock --platform linux\u002Farm64\n```\n\nExit 3 means the host has no `mise` or one older than the minimum release named in the error message. Report every tool the command could not lock, with its platform and reason.\n\n## Finish\n\nSummarize for the user:\n\n- the components, harness extensions and shell components in the manifest,\n- the dotfiles baked and where each one is relocated to,\n- every secret placeholder and how to supply it at runtime,\n- what the shell curation removed,\n- the next step: `\u002Fsandcast-build` (or `sandcast build --verify` when no component is unresolved).\n\nSuggest committing `.sandcast\u002Fmanifest.yaml` and `.sandcast\u002Fmise.lock`.\n",{"name":5,"description":7,"sandcast_version":24},"0.2.1","main","03ef85e75b077c9c6f0d49d54a683b2ef0c9bc65","skills\u002Fcapture","https:\u002F\u002Fgithub.com\u002Fsandcast-dev\u002Fsandcast","https:\u002F\u002Fgithub.com\u002Fsandcast-dev","2026-10-25 22:06:48",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add sandcast-dev\u002Fsandcast --skill sandcast-capture",{"tool":37,"command":38},"bunx","bunx skills add sandcast-dev\u002Fsandcast --skill sandcast-capture",{"tool":40,"command":41},"pnpm","pnpm dlx skills add sandcast-dev\u002Fsandcast --skill sandcast-capture","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fsandcast-dev\u002Fsandcast\u002Fblob\u002Fmain\u002Fskills\u002Fcapture\u002FSKILL.md",true,[],[46,53,58,65,72,78],{"skillNo":47,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":50,"categories":51,"keywords":52,"publishedAt":19},"01M7EFVQDTWSS57WK9PBNNW515","review","Fixture skill review.","https:\u002F\u002Fgithub.com\u002Fsandcast-dev\u002Fsandcast\u002Fblob\u002Fmain\u002Finternal\u002Fharness\u002Fclaudecode\u002Ftestdata\u002Fskills-src\u002Freview\u002FSKILL.md",[],[],{"skillNo":54,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":19},"01M7EFVPK8X509XXEWRF46E0CZ","https:\u002F\u002Fgithub.com\u002Fsandcast-dev\u002Fsandcast\u002Fblob\u002Fmain\u002Finternal\u002Fharness\u002Fclaudecode\u002Ftestdata\u002Fproject\u002Fdot-claude\u002Fskills\u002Freview\u002FSKILL.md",[],[],{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":19},"01M7EFVNNN4TQMG37WQB106CV4","deploy","Fixture skill deploy.","https:\u002F\u002Fgithub.com\u002Fsandcast-dev\u002Fsandcast\u002Fblob\u002Fmain\u002Finternal\u002Fharness\u002Fclaudecode\u002Ftestdata\u002Fproject\u002Fdot-claude\u002Fskills\u002Fdeploy\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M7EFVJY1YH6G0FB1GZTQ33KK","writing","Fixture skill writing.","https:\u002F\u002Fgithub.com\u002Fsandcast-dev\u002Fsandcast\u002Fblob\u002Fmain\u002Finternal\u002Fharness\u002Fclaudecode\u002Ftestdata\u002Fhome\u002Fdot-claude\u002Fskills\u002Fwriting\u002FSKILL.md",[],[],{"skillNo":73,"name":5,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M7EFVHREZ3ZAVBGMT4HVGNS0","Fixture skill sandcast-capture.","https:\u002F\u002Fgithub.com\u002Fsandcast-dev\u002Fsandcast\u002Fblob\u002Fmain\u002Finternal\u002Fharness\u002Fclaudecode\u002Ftestdata\u002Fhome\u002Fdot-claude\u002Fskills\u002Fsandcast-capture\u002FSKILL.md",[],[],{"skillNo":79,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M7EFVGW3P6E221AQC9Y8GMQ3","https:\u002F\u002Fgithub.com\u002Fsandcast-dev\u002Fsandcast\u002Fblob\u002Fmain\u002Finternal\u002Fharness\u002Fclaudecode\u002Ftestdata\u002Fhome\u002Fdot-claude\u002Fskills\u002Freview\u002FSKILL.md",[],[]]