Agent Instructions
Project Context
Personal dotfiles managed with chezmoi + Nix Home Manager on macOS.
- Source:
~/.local/share/chezmoi/ - Applied to:
~/viachezmoi apply - Files ending in
.tmpluse Go templating — never edit deployed files directly, always edit the source in chezmoi - Encrypted files use age — add with
chezmoi add --encrypt <file> - Nix packages:
private_dot_config/home-manager-flake/packages.nix.tmpl - AI tools install script:
.chezmoiscripts/darwin/run_onchange_after_11-ai-tools.sh.tmpl
Safety Rules (always follow)
- Never run
chezmoi applywithout showingchezmoi difffirst and getting confirmation - Never commit without explicit user request
- Never use
git add -Aorgit add .— stage specific files only - Never skip hooks (
--no-verify) - Never force push
- Never edit files in
~/directly — always edit the chezmoi source
Template Conventions
When creating .tmpl files, always include the correct Emacs mode line on line 1:
*.el.tmpl→;;; filename.el -*- mode: emacs-lisp; lexical-binding: t; -*-*.sh.tmpl→# filename.sh -*- mode: sh; lexical-binding: t; -*-*.nix.tmpl→# -*- mode: nix; -*-*.yml.tmpl/*.yaml.tmpl→# -*- mode: yaml; -*-*.toml.tmpl→# -*- mode: conf-toml; -*-
Agents
dotfiles — Modify any dotfile config
- Ask what the user wants to change
- Find the relevant file in
private_dot_config/using glob/search - Read the current file to understand structure and conventions
- Make the edit in the chezmoi source (never the deployed file)
- Run
chezmoi diffand show the output - Wait for confirmation, then run
chezmoi apply
add-nix-package — Add a package to Home Manager
- Search nixpkgs to confirm the package name:
nix search nixpkgs <name> - Open
private_dot_config/home-manager-flake/packages.nix.tmpl - Find the appropriate category section (or create one)
- Add the package with a short inline comment
- Run
make hm_diffand show output - Wait for confirmation, then run
make hm_update - If
flake.lockchanged, runmake hm_commit
hm-update — Update Home Manager packages
- Run
make hm_diffand show output - Wait for confirmation
- Run
make hm_update - If
flake.lockchanged, ask user if they want to commit it withmake hm_commit - If update fails, suggest
make hm_rollback
add-ai-tool — Add a new AI CLI tool
- Check if it's available in nixpkgs:
nix search nixpkgs <name> - If in nixpkgs and stable: add to
packages.nix.tmplunder# ── AI & LLM Tools - If npm-based or needs latest version: add to
.chezmoiscripts/darwin/run_onchange_after_11-ai-tools.sh.tmplunder the npm tools section - If curl installer: add a new section in the ai-tools script following the same pattern as Claude Code
- Run
chezmoi diff, confirm, thenchezmoi apply