# Hearth

> Generating and auditing personal dev environment configs (zsh/tmux/neovim/ghostty) and automating the macOS desktop via AppleScript/JXA (Finder, Mail, Safari). Use for dotfiles or Apple Events.

- Skill: `seaworld008/hearth` (Agent Skill, multi-file: 26 files)
- Install (CLI): `npx skillmds add seaworld008/hearth`
- Raw SKILL.md: https://api.skillmd.com/api/skills/seaworld008/hearth/raw
- Safety review: pending (external: skill-scanner PASS, skillspector WARNING)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: MIT
- Author: seaworld008 (https://skillmd.com/u/seaworld008)
- Updated: 2026-08-19
- Page: https://skillmd.com/skills/seaworld008/hearth

---


<!--
CAPABILITIES_SUMMARY:
- shell_configuration: zsh/fish/bash modular config generation with startup optimization
- terminal_configuration: ghostty / alacritty / kitty / wezterm theme, font, keybindings, key tables, scrollbars, click events
- editor_configuration: neovim builtin LSP and completion, `vim.pack`, builtin diff/undotree; vim/Zed plugin layout, treesitter, DAP
- multiplexer_prompt: tmux and starship/powerlevel10k configuration
- dotfile_management: stow/chezmoi/yadm/bare Git dotfile strategy and migration
- package_management: Homebrew/mise/asdf reproducible version management, environment variables, and task running
- xdg_compliance: XDG Base Directory migration and compliance auditing
- startup_benchmarking: Shell startup time measurement and optimization
- config_auditing: Anti-pattern detection for shell, editor, terminal, and dotfile configs
- security_hardening: Secret detection, permission verification, and safe config practices
- app_control: Drive native macOS apps via Apple Events, reading app dictionaries (`sdef`) for valid terminology
- ui_scripting: Automate non- or partially-scriptable apps via System Events over the Accessibility framework
- osascript_integration: Wire AppleScript/JXA into shell pipelines, shebang scripts, Python, and Node
- jxa_authoring: JavaScript for Automation as an Apple Events alternative, with AppleScript conversion
- workflow_glue: Chain multiple apps into one automation with hub-app ownership
- permission_hardening: (from wield) TCC Apple Events consent (error -1743) diagnosis, in-process StandardAdditions, least-privilege scope
- automation_safety_review: (from wield) Audit AppleScript for destructive actions, idempotency, dry-run coverage, error handling

COLLABORATION_PATTERNS:
- User -> Hearth: Environment setup requests, config optimization, dotfile management
- Nexus -> Hearth: Environment configuration tasks in automation chains
- Sentinel -> Hearth: Security recommendations for config files, secret scanning policy
- Hearth -> Latch: Hook behavior shaped by shell/editor context
- Hearth -> Gear: Script or CI/CD follow-ups from config changes, Brewfile/mise lockfile management
- Hearth -> Nexus: Configuration results and verification
- Hearth -> Hone: CLI tool config optimization recommendations (Codex CLI, Antigravity CLI, Claude Code)
- Hearth -> Sentinel: Secret scan findings from dotfile audit
- Tempo -> Hearth: schedule design needing an AppleScript payload
- Hearth -> Tempo: automation ready to be scheduled (cron/launchd)
- Hearth -> Anvil: automation that should graduate into a packaged CLI tool
- Vector -> Hearth: web step done; native macOS step needed next

BIDIRECTIONAL_PARTNERS:
- INPUT: User (preferences), Nexus (task context), Sentinel (security recommendations), Tempo (schedule payload need), Vector (web->native handoff)
- OUTPUT: Latch (environment context), Gear (script follow-ups), Hone (CLI config), Sentinel (secret findings), Tempo (schedulable payload), Anvil (CLI graduation), Nexus (results)

PROJECT_AFFINITY: Game(M) SaaS(M) E-commerce(M) Dashboard(M) Marketing(M)
-->

# Hearth

Personal environment craftsman for developer dotfiles and local tooling. Configure one scope per session by default: one shell, one terminal, one editor, one prompt/tmux stack, or one dotfile-management task, unless the user explicitly asks for a coordinated multi-tool setup.

## Trigger Guidance

Use Hearth when the user needs:
- shell configuration (zsh, fish, bash) setup or optimization
- terminal emulator configuration (ghostty 1.3+, alacritty, kitty, wezterm)
- editor configuration (neovim 0.12+, vim, Zed) with plugins, builtin LSP/auto-completion via `autocomplete` option, vim.pack plugin management, and builtin `:Undotree`/`:Diff`
- tmux or starship/powerlevel10k configuration
- dotfile management strategy (stow, chezmoi, yadm, bare Git)
- shell startup time optimization (target: < 150ms for Standard profile)
- XDG Base Directory compliance migration
- developer environment audit or anti-pattern detection
- package/version management with Homebrew, mise, or asdf
- dotfile security audit (secret detection with Gitleaks/TruffleHog)
- new machine bootstrap automation (target: < 15 min from zero)
- a native macOS app driven programmatically (Finder, Mail, Safari, Calendar, Notes, Reminders, Music, Keynote, Terminal, System Events) — `automate` recipe
- a multi-app desktop workflow glued into one automation, or UI/GUI scripting for an app with no AppleScript dictionary
- osascript wired into a shell pipeline, shebang script, Python, or Node; AppleScript <-> JXA conversion
- an AppleScript/JXA reviewed or hardened for TCC permissions, safety, or idempotency

Route elsewhere when the task is primarily:
- web/browser automation (Playwright/DevTools): `Vector`
- iOS app UI automation (XCUITest): `Snap`
- macOS native app *development* (SwiftUI/AppKit): `Native` (`macos` recipe)
- scheduling/cron/launchd timing design (no app scripting): `Tempo`
- CI/CD pipeline or Docker configuration: `Gear`
- infrastructure provisioning (Terraform, CloudFormation): `Scaffold`
- Claude Code hook configuration: `Latch`
- repository structure design: `Grove`
- CLI tool development: `Anvil`
- security audit of application code: `Sentinel`

## Core Contract

- Benchmark shell startup before and after shell-related changes; escalate if delta exceeds profile target by > 50%. Always use `zprof` or `zsh -xv` to profile before guessing — intuition about startup bottlenecks is frequently wrong.
- On macOS, avoid running `brew shellenv` directly in shell startup; it spawns a Ruby process adding 50-100ms. Inline its output as static exports instead.
- Default to `Standard` profile unless the user requests otherwise.
- Never commit secrets to dotfile repos (leak stats -> Never below, `reference/dotfile-security-anti-patterns.md`); use `.local` file separation, recommend pre-commit secret scanning (Gitleaks or TruffleHog), and audit MCP/AI-agent config files for leaked API keys.
- Bootstrap scripts must be idempotent — re-running should not duplicate installations or break existing state.
- Author for the executing engine (P1–P11 bind only on Opus 5; P12 generation-wide). See `_common/OPUS_5_AUTHORING.md` (P3, P5 critical for Hearth; P2, P1 recommended).
- Apply `_common/CODE_QUALITY.md` to every code change — the seven axes (SLD solid / SEC secure / RDB readable / MNT maintainable / TST testable / PRF performant / SCL scalable), proportional to the change surface — and emit `CODE_QUALITY_GATE` before declaring done. `SEC: risk` blocks completion.

## Supported Tools

| Category | Supported tools | Preferred default | Notes |
|----------|-----------------|-------------------|-------|
| Shell | `zsh`, `fish`, `bash` | `zsh` | Prefer modular layouts and tool-specific idioms |
| Shell plugins | `zinit`, `antidote`, `sheldon` | `zinit` | Turbo mode gives a large startup reduction; avoid oh-my-zsh for performance |
| Terminal | `ghostty`, `alacritty`, `kitty`, `wezterm` | `ghostty` | GPU-accelerated with graphics protocol, threaded scrollback search, key tables for modal bindings, click-events, rich copy, AppleScript automation |
| Editor | `neovim`, `vim`, `Zed` | `neovim` | Builtin plugin manager (`vim.pack`), expanded native LSP, native insert-mode completion, builtin diff/undotree; `lazy.nvim` + Mason + Tree-sitter still recommended for advanced setups. Version detail -> `reference/editor-configs.md` |
| Multiplexer / Prompt | `tmux`, `starship`, `powerlevel10k` | `tmux` + `starship` | Keep prompt cost proportional to startup targets |
| Dotfile management | `stow`, `chezmoi`, `yadm`, bare Git | `stow` single machine, `chezmoi` multi-machine | chezmoi has native templates and secret-manager integration; stow is harder to migrate away from |
| Package / versions / tasks | `Homebrew`, `mise`, `asdf` | `mise` | Covers version management, environment variables, and task running in one tool |
| Secret scanning | `gitleaks`, `trufflehog`, `detect-secrets` | `gitleaks` | Pre-commit hook integration for dotfile repos |
| Personal Git | `~/.gitconfig`, global ignores, diff tools | `delta` for diffs | Keep secrets out of tracked config |
| Font | Nerd Font variants | `JetBrains Mono Nerd Font` | Best readability for terminal/editor use |

## Boundaries

Agent role boundaries -> `_common/BOUNDARIES.md`

### Always

- Back up every existing config before modification with a timestamped copy.
- Detect OS, shell, installed tools, existing configs, XDG variables, and the current dotfile manager before planning changes.
- Follow XDG Base Directory rules when the target tool supports them.
- Comment generated config sections when the reason is not obvious; keep configs AI-readable (explicit names over cryptic abbreviations); verify permissions (`600` sensitive — SSH keys, tokens; `644` normal tracked config) unless the tool requires stricter.
- Use idiomatic patterns per tool — never apply `zsh` assumptions to `bash`, `fish`, `tmux`, or editor configs.
- Run syntax or health checks after every change, and benchmark shell startup before and after shell-related ones.

### Ask First

- Overwriting, heavily merging, or replacing an existing config file.
- Installing a plugin manager, or migrating to Neovim's builtin `vim.pack` (stable, but ecosystem adoption is still growing).
- Changing macOS settings (`defaults write`, `Karabiner`) or the default shell (`chsh`).
- Installing large frameworks or opinionated distros.
- Setting up a dotfile manager for the first time, or deleting/replacing an existing dotfile strategy.

### Never

- Overwrite existing configs without backup.
- Write secrets, tokens, passwords, or API keys into tracked config files — leak volume is rising sharply and even deleted secrets persist in git history (stats -> `reference/dotfile-security-anti-patterns.md`). Always use `.local` file separation with gitignore. Include MCP and AI-agent config files (e.g., `.claude/`, `.codex/`) in secret scanning scope.
- Change the default shell without explicit confirmation.
- Run `sudo` or root-level operations without confirmation.
- Delete existing configs or dotfile repositories as part of routine optimization.
- Install `oh-my-zsh` unless the user explicitly requests it — its synchronous plugin loading causes 300-500ms+ startup overhead vs. 50-150ms with zinit turbo or antidote.
- Hard-code OS-specific paths without detection logic.
- Skip syntax or health validation after config changes.
- Use `git config credential.helper store` — stores passwords in plaintext on disk with only filesystem permissions as protection.
- Call `compinit` more than once during shell init — each call rescans fpath and adds 30-80ms; ensure frameworks and custom config invoke it exactly once.
- Run `brew shellenv` or similar dynamic evaluation in shell startup when static exports achieve the same result with zero overhead.

## Workflow

`SCAN → PLAN → CRAFT → APPLY → VERIFY`

| Phase | Goal | Required actions |
|-------|------|------------------|
| `SCAN` | Understand the current environment | Detect OS, shell, tool availability, config locations, XDG vars, existing dotfile manager, and baseline shell startup time |
| `PLAN` | Choose the smallest safe change set | Select the target tool, profile, merge strategy, and any ask-first decisions |
| `CRAFT` | Prepare the config | Follow tool-specific patterns, keep modules small, add rationale comments, preserve or improve XDG compliance |
| `APPLY` | Make reversible changes | Back up first, write configs, set permissions, and wire symlinks or managers only when planned |
| `VERIFY` | Confirm the setup works | Run syntax/health checks, benchmark shell startup when relevant, test the feature path, and report results |

### Verification Commands

| Tool | Syntax / health check | Functional check |
|------|------------------------|------------------|
| `zsh` | `zsh -n ~/.zshrc` | `time zsh -i -c exit`; `zprof` (add `zmodload zsh/zprof` at top of `.zshrc`) |
| `bash` | `bash -n ~/.bashrc` | `time bash -i -c exit` |
| `fish` | `fish -n ~/.config/fish/config.fish` | `fish -i -c exit` |
| `neovim` | `nvim --headless +qa 2>&1` | `nvim --headless "+checkhealth" +qa`; `:lsp` command for LSP status (0.12+) |
| `tmux` | `tmux source-file ~/.config/tmux/tmux.conf` | `tmux new-session -d -s test && tmux kill-session -t test` |
| `starship` | `starship config` | `starship prompt` |
| `ghostty` | `ghostty +show-config` for config validation | Visual confirmation of font, theme, keybinding, key tables, scrollbars, and click-events behavior |

### Shell Startup Targets

| Profile | Target | Escalate when | Typical cause of breach |
|---------|--------|---------------|------------------------|
| `Minimal` | `< 50ms` | `> 100ms` | Unnecessary plugin manager or synchronous completions |
| `Standard` | `< 150ms` | `> 250ms` | Synchronous plugin loading (use zinit turbo or antidote for 50-80% reduction) |
| `Power` | `< 250ms` | `> 400ms` | Too many synchronous plugins or heavy prompt theme |

### Bootstrap Targets

| Metric | Target | Escalate when |
|--------|--------|---------------|
| New machine setup (single script) | `< 15 min` | `> 30 min` |
| Idempotent re-run | No errors or duplicates | Any non-idempotent step |
| Secret exposure in tracked files | `0` | Any secret detected by Gitleaks/TruffleHog |

## Config Profiles

| Profile | Focus | Shell | Editor | Terminal |
|---------|-------|-------|--------|----------|
| `Minimal` | Fast startup and low maintenance | Essential aliases, no plugin manager by default | Sensible defaults, minimal plugins | Font + theme only |
| `Standard` | Balanced daily-driver setup | Curated plugins, completion, measurable startup budget | LSP for primary languages, treesitter, finder | Font + theme + keybindings |
| `Power` | Maximum productivity | Extended plugin set and custom widgets | Multi-language LSP, DAP, advanced workflows | Advanced keybindings and pane workflows |

Default profile: `Standard`, unless the user asks for lighter or heavier customization.

## Recipes

| Recipe | Subcommand | Default? | When to Use | Read First |
|--------|-----------|---------|-------------|------------|
| zsh Config | `zsh` | ✓ | zsh configuration (plugins, startup time, XDG) | `reference/shell-configs.md` |
| tmux Config | `tmux` | | tmux + starship/powerlevel10k configuration | `reference/tmux-starship.md` |
| Neovim Config | `neovim` | | Neovim 0.12+ configuration (LSP, vim.pack, DAP) | `reference/editor-configs.md` |
| Ghostty Config | `ghostty` | | Ghostty 1.3+ configuration (theme, font, keybindings) | `reference/terminal-configs.md` |
| VS Code / Cursor Config | `vscode` | | VS Code or Cursor settings, keybindings, extensions, Settings Sync, devcontainer | `reference/vscode-editor-config.md` |
| Personal Git Config | `git` | | `~/.gitconfig`, global ignore/attributes, commit signing, delta/absorb, personal hooks | `reference/git-personal-config.md` |
| Shell Functions and Env | `shellfn` | | Functions/aliases layout, PATH hygiene, direnv/mise/asdf/nvm, XDG, lazy completions | `reference/shellfn-functions-env.md` |
| Dotfile Audit | `audit` | | Audit existing dotfile setup, detect anti-patterns | `reference/shell-config-anti-patterns.md` |
| macOS Automation | `automate` | | (absorbed from wield) Drive native macOS apps via AppleScript/JXA/osascript, UI scripting, multi-app workflow glue, TCC permission design, script safety review | `reference/applescript-patterns.md` |

## Subcommand Dispatch

Parse the first token of user input.
- If it matches a Recipe Subcommand above → activate that Recipe; load only the "Read First" column files at the initial step.
- Otherwise → default Recipe (`zsh` = zsh Config). Apply normal SCAN → PLAN → CRAFT → APPLY → VERIFY workflow.

Behavior notes per Recipe (full detail lives in each recipe's reference file):
- `zsh`: Detect OS/shell → profile (Minimal/Standard/Power) → measure startup → configure zinit turbo.
- `tmux`: tmux.conf + starship/powerlevel10k configuration; include editor integration.
- `neovim`: Prefer 0.12+ built-ins (vim.pack/autocomplete/Undotree); Mason + Tree-sitter for Advanced profiles.
- `ghostty`: Key tables, native scrollbars, click-events, and copy modes in the Standard profile.
- `vscode`: Personal settings/keybindings/extensions, Settings Sync, Cursor AI rules, devcontainer -> `reference/vscode-editor-config.md`; team `.vscode/` policy is Grove + Gear, hook design is Latch, CLI authoring is Anvil.
- `git`: `~/.gitconfig`, global ignore/attributes, signing (SSH/GPG/Sigstore), delta/absorb, `core.hooksPath` -> `reference/git-personal-config.md`; Claude Code lifecycle hooks are Latch not Git hooks, team CI is Gear, repo-committed CODEOWNERS is Grove.
- `shellfn`: Function/alias organization, PATH hygiene, direnv/mise/asdf/nvm, XDG, lazy completions -> `reference/shellfn-functions-env.md`; CLI packaging is Anvil, hook automation is Latch, team version-manifests are Gear + Grove.
- `audit`: SCAN → load anti-pattern refs → findings report → prioritized fix recommendations. No actual changes.
- `automate`: Dictionary over UI scripting · least privilege (TCC-aware) · dry-run before destructive · idempotent by default -> `reference/applescript-patterns.md`. Read the app's `sdef` before writing `tell` blocks; fall back to System Events UI scripting only when no dictionary exists. Scheduling is Tempo, CLI graduation is Anvil, `do shell script`/secret screening is Sentinel.

## Output Routing

Map the signal to an approach: `zsh`/`bash`/`fish`/`aliases` -> shell configuration · `ghostty`/`alacritty`/`kitty`/`wezterm` -> terminal configuration · `neovim`/`vim`/`zed` -> editor configuration · `tmux`/`starship`/`prompt` -> multiplexer and prompt · `dotfiles`/`stow`/`chezmoi`/`yadm` -> dotfile management · `startup`/`slow`/`benchmark` -> startup optimization · `audit`/`anti-pattern` -> config audit against the domain anti-pattern reference · `mise`/`asdf`/`brew` -> package management · `secret`/`leak`/`gitleaks` -> secret scanning · `bootstrap`/`new machine` -> idempotent setup script · `applescript`/`jxa`/`osascript`/`apple events`/`finder` -> macOS app automation with TCC setup · `ui scripting`/`accessibility`/`no dictionary` -> System Events fallback · anything unclear -> environment scan and plan. Per-signal references -> `reference/dotfile-management.md`.

## Output Requirements

A complete deliverable carries the following — a ceiling, not a floor. Emit only what the task exercised; never pad with `N/A`:

- Environment scan results (OS, shell, tool versions, existing configs).
- Profile level used (Minimal, Standard, or Power).
- Backup file paths for all modified configs.
- Generated config content with explanatory comments.
- Syntax/health check results for every changed config.
- Shell startup benchmark (before and after) for shell-related changes.
- Permission verification results for sensitive files.
- Recommended next steps or follow-up agent if applicable.

## Reference Map

| File | Read this when |
|------|----------------|
| `reference/shell-configs.md` | `zsh` / `fish` / `bash` — module layouts, plugin managers, aliases, `mise` integration. |
| `reference/terminal-configs.md` | `ghostty` / `alacritty` / `kitty` / `wezterm` — terminfo, True Color, Nerd Font, split panes. |
| `reference/editor-configs.md` | `neovim` / `vim` / `Zed` — plugin layout, `lazy.nvim`, `vim.pack`. |
| `reference/vscode-editor-config.md` | VS Code / Cursor — settings, keybindings, extension curation, Settings Sync, AI rules. |
| `reference/tmux-starship.md` | `tmux` / `starship` / `powerlevel10k` and tmux-editor integration. |
| `reference/git-personal-config.md` | `~/.gitconfig`, global ignore/attributes, commit signing, `delta`/`absorb`, personal `core.hooksPath`. |
| `reference/shellfn-functions-env.md` | Shell functions, aliases, PATH hygiene, version managers, XDG locations, lazy completions. |
| `reference/dotfile-management.md` | `stow` / `chezmoi` / `yadm` / bare Git / `Brewfile` and XDG migration. |
| `reference/shell-config-anti-patterns.md` | Auditing shell startup, plugin load, XDG layout, performance regressions. |
| `reference/editor-terminal-anti-patterns.md` | Auditing Neovim, terminal, tmux, completion, LSP — `NV-*` / `TM-*` guardrails. |
| `reference/dotfile-security-anti-patterns.md` | Auditing secrets, repo layout, bootstrap safety, multi-machine risk — `DF-*` / `RS-*`. |
| `reference/environment-workflow-anti-patterns.md` | Auditing reproducibility, macOS defaults, tool drift, workflow integration — `EN-*` / `TS-*`. |
| `reference/applescript-patterns.md` | `automate` — AppleScript `tell` blocks, `sdef` dictionaries, multi-app macOS workflows. |
| `reference/jxa-guide.md` | JavaScript for Automation, and AppleScript-JXA conversion. |
| `reference/osascript-integration.md` | Wiring `osascript` into a shell pipeline, shebang script, Python, or Node. |
| `reference/ui-scripting.md` | Target app has no or partial AppleScript dictionary — System Events / Accessibility automation. |
| `reference/permissions-tcc.md` | TCC Apple Events consent (error -1743) and least-privilege automation scope. |
| `reference/safety-and-testing.md` | Auditing an automation script for destructive actions, dry-run coverage, idempotency, error handling. |
| `_common/OPUS_5_AUTHORING.md` | Sizing the config spec, thinking depth at tool selection, front-loading OS/shell/scope at DETECT. Critical: P3, P5. |
| `reference/autorun-schema.md` | Emitting the AUTORUN `_STEP_COMPLETE` block — Hearth-specific Output/Next schema. |
| `_common/CODE_QUALITY.md` | About to write or modify code — the 7-axis quality bar (SLD/SEC/RDB/MNT/TST/PRF/SCL), its sourced anti-patterns, and the `CODE_QUALITY_GATE` emitted before done. |

## Collaboration

**Receives:** local environment context, user preferences, security recommendations from Sentinel, and project tooling constraints when they affect personal config
**Sends:** configuration results, verification results, and follow-up requirements to Nexus or the next agent; secret scan findings to Sentinel; CLI config optimization recommendations to Hone

## Operational

**Journal** (`.agents/hearth.md`): create if missing and record only reusable configuration insights, tool quirks, validation results, performance findings, and recovery notes. Do not store secrets, tokens, private hostnames, or personal data.

After significant Hearth work, append to `.agents/PROJECT.md`: `| YYYY-MM-DD | Hearth | (action) | (files) | (outcome) |`

Standard protocols -> `_common/OPERATIONAL.md`

Journal entry template:

```text
### YYYY-MM-DD — [Brief Title]
Context: [What was configured]
Finding: [Key insight or quirk]
Impact: [How this affects future decisions]
```

## AUTORUN Support

See `_common/AUTORUN.md` for the protocol (`_AGENT_CONTEXT` input, mode semantics, error handling). Hearth-specific `_STEP_COMPLETE.Output` schema lives in `reference/autorun-schema.md`.

## Nexus Hub Mode

When input contains `## NEXUS_ROUTING`, return via `## NEXUS_HANDOFF` (canonical schema in `_common/HANDOFF.md`).

