This is my dotfiles repo. There are many like it but this one is mine.
xcode-select --install
cd ~
git clone --recursive https://github.com/sodiumjoe/dotfiles.git .dotfiles
cd .dotfiles
./bootstrap.shbootstrap.sh prompts for the environment on first run, or takes it as a flag for non-interactive use (./bootstrap.sh --env=devbox). It stages prospective generated configs and checks every deployment destination before publishing the configs, reconciling symlinks, and writing ~/.dotfiles-env. A failed preflight leaves the existing environment identity, canonical generated files, and live links unchanged. Bootstrap then installs the pinned npm tools in node-bin/. If ~/.npm/_cacache is a symlink to a missing directory, which some other tools leave behind, and npm_config_cache is not set, bootstrap points npm at ~/.cache/npm-dotfiles instead and says so.
Bootstrap then installs Agency's build dependencies in every environment, builds it with Node 24.13.0, checks its default backend, and runs agy status --json to start or reuse the devbox's local Handler. The pinned runtime must already exist under ${NODENV_ROOT:-$HOME/.nodenv}/versions/24.13.0/; install it with nodenv install 24.13.0 if missing. Agency setup failures produce a warning and leave the completed dotfile setup in place. Fix the reported error and rerun ./bootstrap.sh --env=<env> from the repository. Agency derives its standard Codex configuration at runtime from the deployed acp-codex wrapper, pinned ACP adapter, and Codex configuration; no provider profile file or prior bootstrap step is required by the runtime. An optional private catalog/providers.json overrides that default, including explicit empty or disabled configurations. Existing profiles, backend defaults, and Codex settings are preserved. Bootstrap checks that the default backend has an enabled provider and compatible installed files before starting the Handler. Invalid overrides are reported without replacement or fallback. Backend-native login remains separate; see agency/README.md.
The laptop's remote and remotes commands automatically enroll the selected devbox with Agency in the background. They run remote agy status --json with a 30-second deadline, then save only its SSH hostname and host ID locally. Both hosts need agy on the noninteractive SSH session's PATH. Successful enrollment is quiet and repeated connections are a no-op. Enrollment failures warn without delaying or blocking terminal attachment; identity conflicts preserve the existing record. Enrollment persists after disconnect, so the global Agency picker can query previously visited devboxes while they are running.
Post-install:
brew-syncto install Homebrew packages./macosto apply macOS defaults- FileVault, caps-lock-to-ctrl, generate SSH keys, rustup
- Template inputs remain outside
home/. home/contains deployed content and ignored generated outputs.- Bootstrap creates real directories and relative file links.
.agents/skillsis canonical; Claude aliases individual skills; Codex reads.agents/skillsdirectly.- Runtime roots remain outside the repository.
- Legacy ignored runtime state is not migrated.
The repo serves three environments via DOTFILES_ENV:
| Value | Machine | OS |
|---|---|---|
work |
Work laptop | macOS |
devbox |
Work devbox | Linux |
home |
Home laptop | macOS |
Identity: ~/.dotfiles-env declares DOTFILES_ENV. Created by bootstrap.sh on first run, or non-interactively via ./bootstrap.sh --env=devbox. Exported by zshenv, defaulting to home if the file is missing.
Bootstrap deliberately ignores the ambient $DOTFILES_ENV, since zshenv always exports it. Trusting the variable would make the prompt unreachable and would silently re-commit a stale value whenever you delete ~/.dotfiles-env in order to re-select.
To switch environments: ./bootstrap.sh --env=<name> followed by dotfiles-generate --reset, then restart your shell. Bootstrap regenerates and applies the Claude settings for the new environment; the --reset is what rewrites the mutable Codex config.
A machine on pre-multi-env master has claude/settings.json, codex/config.toml, and Brewfile as tracked files, almost certainly with local runtime modifications. A plain git pull refuses to proceed over those (harmless, but stuck). The migration script handles backup, reset, pull, and re-bootstrap — but it lives in the very commits being pulled, so fetch it from origin first:
cd ~/.dotfiles
echo "DOTFILES_ENV=work" > ~/.dotfiles-env # or devbox — BEFORE pulling, see below
git fetch origin
git show origin/master:home/bin/migrate-multi-env > /tmp/migrate && bash /tmp/migrateWrite ~/.dotfiles-env first because the new zshenv defaults DOTFILES_ENV to home when the file is missing: any shell opened between pull and bootstrap on a work machine would otherwise silently load home config (no Stripe shellinit, no work aliases). Run the script from a downloaded copy, not piped into bash — it may prompt, and a piped script's stdin is the script itself.
The script backs up dirty tracked configs from both the legacy claude/ and codex/ paths and the current home/.claude/ and home/.codex/ paths, including staged changes, before resetting those files and pulling. After migration, it prints diff commands comparing the backups with the canonical generated outputs under home/. Run those commands: accumulated runtime permissions in the old settings.json must be promoted into claude/settings.base.json or claude/settings.work.json manually.
Devbox provisioning must be updated: the new bootstrap deliberately ignores an ambient DOTFILES_ENV variable, so DOTFILES_ENV=devbox ./bootstrap.sh (the old contract) now fails at the interactive prompt when non-interactive. Update .devbox-init to call ./bootstrap.sh --env=devbox. Bootstrap also now hard-requires jq (it refuses to write settings without it rather than silently dropping every overlay) — confirm the devbox image provides it.
home/bin/dotfiles-generate produces config files from base + environment overlays. All per-environment decisions live in one table at the top of the script (which settings overlay, which Brewfile overlay, whether codex applies); nothing further down branches on DOTFILES_ENV.
Static files (always regenerated -- tools never modify them):
Brewfile.base+Brewfile.$DOTFILES_ENV->Brewfile(skipped on devbox, which declares no Brewfile, and on Linux, which has no Homebrew -- separate conditions)shared/*.md+ overlay ->home/.claude/CLAUDE.md,home/.codex/AGENTS.md
Applied files (always regenerated, then merged into a live ordinary file):
claude/settings.base.json+claude/settings.work|home.json->home/.claude/settings.json(merged viaclaude/settings-merge.jq), applied to~/.claude/settings.jsonin every environment
Mutable files (generated once on first bootstrap, then hands-off -- tools modify them at runtime):
codex/config.base.toml->home/.codex/config.toml
~/.claude/settings.json is not a symlink. The Stripe claude wrapper rewrites it on every run: it sorts the keys, sets its own keys (model, effortLevel, enabledMcpjsonServers, its plugins and marketplaces), and replaces the file, which would break a symlink. Agency also refuses to fingerprint a symlinked provider configuration file, so a symlink there stops new Claude sessions from starting. Instead, dotfiles-reconcile applies home/.claude/settings.json to the live file with jq's * rule: objects merge key by key, values and lists from source replace the live ones, and keys only the live file has are kept. Source therefore wins for every key it declares, and keys it does not declare belong to the wrapper, the model picker and /config. Leave a setting out of source if you do not care about its value. The apply writes the file with a single rename, and only when the merged result differs from the live file, so an unchanged file keeps its identity. A live symlink into the repository is replaced by an ordinary file, and live JSON that does not parse stops reconciliation.
settings-merge.jq is a generic recursive merge: objects merge key-by-key, arrays concatenate (base first), scalars take the overlay's value. Adding a new array-valued key to the settings needs no change to the filter. Note that arrays concatenating means an overlay can only add hooks and permissions, never remove one the base declares.
Use dotfiles-generate --reset to force-regenerate the mutable Codex config, and --out DIR to generate into a scratch directory without touching the working tree. Scratch output includes Brewfile on macOS; bootstrap publishes it at the repository root, never into the deployed home tree.
Generation fails loudly rather than degrading: a missing jq or a missing overlay aborts, because writing base-only settings would silently drop every work permission, MCP server, and plugin.
home/bin/dotfiles-diff shows what tools have changed in live configs vs. what the source files would generate. It works by running dotfiles-generate --out into a temp directory, so drift detection stays consistent with generation by construction. Exit codes are 0 no drift, 1 drift, 2 could not check.
For Claude settings it compares ~/.claude/settings.json with the result of applying the sources to it. Differences the next dotfiles-reconcile would correct count as drift. Keys that only the live file has are listed separately for promotion and do not count, because the wrapper writes its own keys on every run.
Codex rewrites last_updated and last_revision in its marketplace block on every refresh; those keys are stripped from both sides before diffing, and should never be committed to config.base.toml.
The workflow for promoting runtime changes back to source:
- Run
dotfiles-diffto see what changed - Edit the appropriate source file (base or overlay)
- Run
dotfiles-generate --reset
Codex and Karabiner-Elements save their configs by replacing the file, which turns the deployed symlink into an ordinary file. dotfiles-reconcile adopts those two paths instead of refusing: when ~/.codex/config.toml or ~/.config/karabiner/karabiner.json is an ordinary file, it copies any changed contents into the repository copy, reports the adoption, and relinks the path. Review adopted changes with git diff or dotfiles-diff and promote them as above. Every other ordinary file at a managed path is still a conflict that stops reconciliation. Links are replaced with a single rename, so a tool watching its config never sees the file disappear. A link in a managed directory whose target was inside home/ and no longer exists is removed; links pointing elsewhere are left alone.
The repository sets its own core.hooksPath=hooks, because Stripe's global core.hooksPath=/etc/stripe/git_hooks would otherwise replace it, and Stripe's post-merge does not pass through to a repository's own hook. hooks/stripe-hook, linked as commit-msg, post-checkout, post-rewrite, pre-commit and pre-push, runs Stripe's hook of the same name, so the PII scan and Stripe's other checks still run. hooks/post-merge runs Stripe's post-merge first, then regenerates static files after git pull when sources changed, runs dotfiles-reconcile when files under home/ were added, deleted or renamed, and runs dotfiles-diff --quiet to warn about drift in mutable files. Reconcile creates links for new files and prunes links whose source was deleted, so a merge that adds or removes a Neovim module takes effect without a manual relink. Git does not run post-merge for rebases at all, so git pull --rebase skips it; run dotfiles-generate by hand after one.
Claude settings are applied as the ordinary file ~/.claude/settings.json in every environment. Codex instructions, Codex config, and work-cli are only symlinked when DOTFILES_ENV is work or devbox. Skills are deployed under ~/.agents/skills in every environment, with individual Claude aliases under ~/.claude/skills. Codex reads the shared skill directory directly.
home/.config/zsh/.zshrc sources work.zsh or home.zsh from the same directory based on $DOTFILES_ENV. Neovim does not read $DOTFILES_ENV: its only ACP provider is Agency, whose default backend is Claude Opus whenever Claude is enabled.
Three lockfiles, one rule: commit them, so every environment resolves to the same versions.
- Vim plugins:
lazy-lock.json(commit after:Lazy update, restore with:Lazy restore) - npm tools:
node-bin/package-lock.json(installed bybootstrap.shvianpm ci, updated byupgrade --npm) - Homebrew:
brew-sync(installs missing packages viabrew bundle --no-upgrade; intentional upgrades viahome/bin/upgrade)
node-bin/ holds pinned npm tool binaries -- ACP providers, language servers, formatters. It is the right home for anything that has to exist on both macOS and Linux, because the Brewfile is skipped entirely on devbox. Both ACP providers (claude-agent-acp, codex-acp) live here for exactly that reason; do not add them to a Brewfile, where work and devbox would end up on different implementations.
node-bin/bin is generated from direct dependencies only by npm run sync-bins --prefix node-bin. Use that directory on PATH, not node-bin/node_modules/.bin, because npm exposes transitive dependency binaries there.
Run bash test.sh for the routine workflow suite. It builds Agency once and runs deployment, work-cli, Agency, packaged-provider, shell enrollment, Neovim and tmux tests. It requires Node 24.13.0 (uses the pinned nodenv installation when needed), Python 3, jq, Git, zsh, tmux, Neovim, installed Neovim plugins, and the existing Agency/node-bin dependencies. Missing dependencies fail the run. It prints elapsed time and the directory containing per-suite logs.
Coverage concentrates on bootstrap and config regeneration, preservation of existing files and Markdown, work creation/completion/archive, review stash recovery, agent start/prompt/cancel/stop/restore, permission arbitration, remote routing, editor streaming and Hop selection/cancellation. External providers and SSH are replaced with local fixtures. Tests use temporary deployment trees and private tmux servers; they do not install packages or change live configuration.
Helper/schema matrices, configuration and keymap inventories, legacy migrations, exhaustive race permutations and tests of test infrastructure have been removed. The suite deliberately trades those guarantees for a small set of everyday workflows. bash test-env.sh, npm --prefix work-cli test, npm --prefix agency test, npm --prefix node-bin test and bash test-nvim.sh remain available for targeted work.
Both Claude Code and Codex CLI receive instructions generated from a shared base with agent-specific overlays:
shared/base-instructions.md --+
shared/work-tracking.md --+--> home/.claude/CLAUDE.md (+ shared/neovim.md + claude-overlay.md)
|
`--> home/.codex/AGENTS.md (+ codex-overlay.md)
shared/neovim.md is included only in home/.claude/CLAUDE.md (not AGENTS.md). AGENTS.md is generated only for work and devbox environments.
dotfiles-generate concatenates these on every run. The generated files are gitignored -- edit the source files in shared/ or the overlay files, never the generated output.
shared/ contains agent-agnostic content: communication style, code conventions, work tracking. The overlay files contain agent-specific tool references and skill invocation syntax.
Skills live in home/.agents/skills/ and deploy to ~/.agents/skills/. Claude aliases each skill through home/.claude/skills/; Codex uses ~/.agents/skills/ directly. Each skill is a directory containing SKILL.md (with optional supporting files and scripts).
Location: ~/.dotfiles/work-cli/; binary at work-cli/bin/work, symlinked to ~/bin/work. Also referenced by .claude/settings.local.json (permission allowlist) and home/.config/nvim/lua/sodium/plugins/agentic.lua (work_bin variable).
Work vault: ~/stripe/work/ (configured in home/.config/work/config.json).
Neovim keybindings: <leader>ap (pick project file), <leader>aP (create project), <leader>at (add task), <leader>st (task state picker for the current project) and <leader>sT (task state picker across all projects).
Code review workflow:
work review enter-pr <n>-- check out PR n for review and write session state under.review/work review submit <EVENT> [body]-- submit a PR review and exit the sessionwork review exit-- restore the previous branch/stash and remove review session state
PR review recovery state lives in .review/session.json, which is written before checkout or stash mutation. work review exit is session-driven and idempotent; rerun it to recover branch/stash state after an interrupted review.
home/.claude/CLAUDE.md-- generated (do not edit directly)home/.claude/settings.json-- generated desired settings (permissions, hooks, MCP servers), applied to the ordinary file~/.claude/settings.jsonin every environmentclaude/settings-merge.jq-- jq filter for merging base + overlay settingshome/.claude/agents/-- plan-reviewer, code-reviewer (Claude-only)home/.claude/commands/-- note, name, archive-plans, etc. (Claude-only)home/.claude/hooks/-- notify-on-idle.sh, session-project.shhome/.codex/AGENTS.md-- generated (do not edit directly)home/.codex/config.toml->~/.codex/config.toml(model, sandbox, MCP)claude/andcodex/-- template inputs for generated settings and config- Project-specific overrides in
.claude/settings.local.json
Devbox initialization clones this repo and runs bootstrap.sh, which sets up everything: work-cli symlink, skills, agents, commands, hooks, generated instruction files. remotes and remote use _devbox_sync_loop in home/.config/zsh/work_sync.zsh to sync only .md files in ~/stripe/work/ bidirectionally via Unison in the background. Each cycle selects Markdown paths from both replicas, including nested notes and deletions, then waits 5 seconds before scanning again. Other files remain where they are and are not synchronized or removed. Connections wait for the setup checks, then attach tmux without waiting for the initial scan or transfer. Remote notes can be stale or absent until that sync finishes. On disconnect, the tracked worker finishes any active transfer, performs one final Markdown sync in the background, and exits. The prompt returns without waiting, so the last edits can still be syncing afterward. Reconnecting stops the previous worker and waits for its transfer to exit before starting another. Sync diagnostics are retained in /tmp/unison-sync-HOST.log.
zimfw update/zimfw upgradebrew-sync(incremental) orhome/bin/upgrade(full upgrade)vivid generate sodiumfast-theme home/.config/zsh/sodium