Skip to content
fpigeonjrPublic

About

my dotfiles for my adventures in Linux

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Dotfiles

Personal configuration files managed with GNU Stow.

⚠️ Important Notes

Git Configuration

  • Default email: Set to personal email
  • Work projects: Manually configure work email per repository:
    cd ~/Code/work-project
    git config user.email "work@example.com"

Breaking Changes from Previous Configs

  • Default branch: Uses main (not master)

  • Pull strategy: Uses rebase by default for cleaner history

  • Email: Defaults to personal email (override per project as needed)

  • New aliases: Added co, br, ci, st for common git commands

  • Signature verification: SSH-signed commits verify locally against ~/.config/git/allowed_signers, which is intentionally not tracked. Create it on a new machine with:

    mkdir -p ~/.config/git
    printf '%s %s\n' "4629398+fpigeonjr@users.noreply.github.com" \
      "$(awk '{print $1, $2}' ~/.ssh/id_ed25519.pub)" > ~/.config/git/allowed_signers

    The awk drops the trailing comment field of the public key file (which often holds a personal email), keeping the signers file to the key and public identity only.

    Without it, committing and pushing still work — only git verify-commit and git log --show-signature exit non-zero until the file exists.

Cross-Platform Compatibility

This repo is organized around a shared Zsh setup plus OS-specific overlays:

  1. Shared shell base: shell/.zshrc loads shell/.config/zsh/common.zsh
  2. OS overlays: shell/.config/zsh/macos.zsh and shell/.config/zsh/linux.zsh
  3. Local overrides: Copy shell/.config/zsh/local.zsh.example to ~/.config/zsh/local.zsh for machine-specific settings and secrets

When using on Linux systems that have existing git configs:

  1. Backup existing config: cp ~/.gitconfig ~/.gitconfig.backup
  2. Check for conflicts: Compare settings before stowing
  3. Merge manually if needed: Combine useful settings from both configs

OMArchy/Hyprland Integration

The Hyprland configuration is designed for OMArchy systems:

  • Keybindings: Custom app launchers (Super+A for ChatGPT, Super+B for Brave)
  • Theme integration: Sources OMArchy theme system
  • Hardware: Configured for modern displays with proper scaling
  • Input: Natural touchpad scrolling and fingerprint authentication

Note: Hyprland configs only apply to OMArchy/Linux systems with Hyprland installed.

Machine-Specific Linux Fixes

  • scripts/install-lid-wakeup-fix.sh: Installs a small systemd service that disables ACPI lid wakeup on boot for laptops that immediately wake from suspend with the lid open.
  • This is intentionally managed as an install script plus service template instead of a stowed ~/.config file, because it writes to /etc/systemd/system/ and is machine-specific.

Worktrunk for repos with uppercase names

  • Local override: ~/.config/worktrunk/config.toml includes a repo-specific override for projects where the repo name contains uppercase characters
  • Why: Worktrunk's default sibling worktree naming can preserve uppercase repo names, which breaks Podman/Lazydocker compose project naming
  • Behavior: New worktrees are created under .worktrees/{{ branch | sanitize_db }} so paths stay lowercase-safe
  • Shell integration: Loaded in shell/.config/zsh/common.zsh — enables auto-cd after wt switch and tab completions (no-op if wt is not installed)

Codex shared skills

Personal skills live in the separate ~/Code/skills repository. Run python3 ~/dotfiles/scripts/sync-codex-skills.py to link them into ~/.agents/skills. Existing overlapping copies are backed up under ~/.local/share/skill-backups/; Codex-only, system, and plugin skills are preserved. Re-run after adding new shared skills. Existing links follow repo edits and pulls automatically. Deleted repo skills require a separate review of stale links.

OpenCode

  • Disabled (2026-11-20): subscription cancelled. brew "opencode" is commented out in homebrew/Brewfile and OPENCODE_API_KEY is commented out in local.zsh (which also removes Pi's opencode/opencode-go providers). Config below is kept as-is; to re-enable, uncomment both and run brew bundle
  • Global config: config/.config/opencode/opencode.json is stowed to ~/.config/opencode/opencode.json
  • Custom agents: Store reusable agents in config/.config/opencode/agents/
  • Current custom agent: study.md adds a primary study mode focused on guided learning, hints, and knowledge checks
  • Plugins: Global plugins live in config/.config/opencode/plugins/ and are auto-loaded at startup (no config entry needed)
  • Current plugin: cmux-notify.js fires cmux notify on session.idle, session.error, and permission.asked — triggers the blue pane ring and sidebar badge in cmux. Safe outside cmux (gated on CMUX_SOCKET_PATH)
  • Apply changes: Run stow -R config from ~/dotfiles after adding or updating OpenCode config files

cmux

  • What it is: Native macOS terminal built on libghostty with vertical tabs, notification rings, and an in-app browser — designed for running multiple AI coding agents in parallel
  • Reads existing Ghostty config: No separate cmux config needed; it uses ~/.config/ghostty/config for fonts, themes, and colors
  • CLI on PATH: macos.zsh adds /Applications/cmux.app/Contents/Resources/bin to PATH automatically when cmux is installed
  • OpenCode integration: cmux omo launches OpenCode with the oh-my-opencode plugin in a shadow config — each subagent gets its own native cmux pane. Your ~/.config/opencode/ is never modified
  • Notification ring: cmux-notify.js plugin bridges OpenCode session events to cmux's visual pane ring
  • Install: brew tap manaflow-ai/cmux && brew install --cask cmux

Herdr

  • Config: herdr/.config/herdr/config.toml stows to ~/.config/herdr/config.toml
  • Keymap style: Prefix-free first, with ctrl+alt chords that survive Ghostty/macOS; ctrl+b remains the prefix escape hatch
  • Core pane shortcuts: ctrl+alt+d splits right, ctrl+alt+shift+d splits down, ctrl+alt+w closes the pane
  • Navigation: ctrl+alt+h/j/k/l focuses panes left/down/up/right; ctrl+alt+z zooms
  • Tabs/sidebar: ctrl+alt+c creates a tab; ctrl+alt+b toggles the sidebar
  • Install/apply: Run stow herdr on a new system, or stow -R herdr after updates; if an existing ~/.config/herdr/config.toml is present, back it up or move it before stowing

Herdr desktop app sub-agents (herdr-core)

  • What: The Herdr desktop app delegates through herdr-core (hc). Role templates live in herdr-core/.config/herdr-core/templates/ and stow to ~/.config/herdr-core/templates/; the agent-facing guide is the herdr-core skill in ~/Code/skills
  • Roles: scout, worker, reviewer, planner, adversarial-reviewer, visual-tester — ports of the pi-herdr-roles roles used with the old herdr multiplexer, each pinning its model and tools in command:
  • Launching: Template commands use zsh -ic 'exec pi …' because herdr-core starts programs with a minimal PATH (no fnm Node, no local.zsh API keys)
  • Use: hc templates; hc run --bg --name review --cwd "$PWD" reviewer "<task>; report with hc send $HC_TERMINAL_ID"; hc wait --children all
  • Install/apply: stow --no-folding herdr-core (no folding keeps ~/.config/herdr-core a real directory so only the template files are symlinked and herdr-core runtime files stay out of the repo)
  • Coexistence: Inside the old multiplexer (HERDR_ENV=1) Pi keeps using pi-herdr-agents; inside the desktop app (HC_TERMINAL_ID set) it uses hc

Amazon Bedrock Model Access

  • Disabled in Pi (2026-11-20): the /a family carries disabled: "Bedrock access paused" in model-tiers.ts; delete that line to re-enable. The opt-in flexion-* shell helpers are unchanged
  • Profile: employer-bedrock (template only — real values in ~/.aws/config, never committed; see aws/.aws/config for setup instructions)
  • Permitted providers: Anthropic (Claude), DeepSeek, Meta Llama, Amazon Nova, Mistral, Qwen, MiniMax, Moonshot AI (Kimi), Z.AI (GLM), NVIDIA Nemotron, Google Gemma, Writer Palmyra, OpenAI OSS, TwelveLabs Pegasus
  • Auto-discovery: bedrock:ListFoundationModels is now permitted — OpenCode will discover models available in us-east-2. However, discovered models may still fail if they require an inference profile or don't support tool call streaming
  • Verified working (tool calls + streaming): qwen3-coder-480b, nova-pro, kimi-k2.5, minimax-m2.5, glm-5, gemma-3-27b, ministral-14b, gpt-oss-120b, gpt-oss-20b
  • Confirmed working recently: nova-2-lite, qwen3-next-80b
  • Blocked by IAM in us-east-2: kimi-k2-thinking — denied on bedrock:InvokeModelWithResponseStream for moonshot.kimi-k2-thinking
  • Configured but not yet verified here: claude-opus-4-6, mistral-large, devstral, qwen3-coder-30b, llama4-scout
  • Requires inference profile (use us. prefix): llama4-maverick — must use us.meta.llama4-maverick-17b-instruct-v1:0
  • DeepSeek: IAM policy permits deepseek.*; R1 (deepseek-r1) is configured with tool_call: false — useful for reasoning/analysis but not agentic tasks
  • Nova Premier: Access denied — requires 30 days of prior active usage per AWS policy
  • Magistral Small: Works but over-eager, makes unnecessary tool calls for simple tasks
  • Tool call limitation: tool_call: false in the config is currently ignored by upstream OpenCode — tools are always sent, causing failures on models that don't support streaming + tool use. Tracked upstream at anomalyco/opencode#19966, fix pending in anomalyco/opencode#20040. A colleague's Flexion fork (flexion/opencode, flex branch) already ships this fix — worth watching for when it merges upstream
  • Models with tool_call: false: llama4-maverick, llama4-scout, deepseek-r1 — usable for read-only/chat queries now, but will fail in agentic sessions until the upstream fix lands
  • Adding new models: Find the Bedrock model ID in the AWS docs and add an entry under provider.amazon-bedrock.models in opencode.json

Pi Agent models.json

  • Do not use models.json to override Bedrock model metadata. The pi-ai package ships a bundled models.generated.js with correct contextWindow, maxTokens, and real per-token cost values for all Bedrock models.
  • Overriding with a local models.json (even with zeros or conservative window sizes) silently replaces the bundled values — causing the context fill bar to saturate too early, premature compaction, and $0.000 cost in the footer.
  • Only add models.json for genuinely custom providers (Ollama, vLLM, proxies, NVIDIA NIM) or models not yet in the bundled registry. Check node_modules/@earendil-works/pi-ai/dist/models.generated.js first before adding any Bedrock entry.
  • models.json is gitignored — it's machine-local and may contain API key resolvers. NVIDIA NIM is not in it: Pi's built-in nvidia provider covers it (NVIDIA_API_KEY, set in local.zsh from NVIDIA_NIM_API_KEY), with model metadata maintained upstream. NIM retires free-tier models often (HTTP 410), so check pi --list-models nvidia and re-test tool calls before changing /n.
  • GitHub Copilot limit overrides are the exception. The bundled/cached catalog reports ~1M context for newer Copilot models (gemini-4-*, gpt-6.2-sol), but Copilot accepts far less (200k–983k). Set providers.github-copilot.modelOverrides contextWindow/maxTokens from Copilot's live max_prompt_tokens/max_output_tokens (the copilot-models skill's --overrides does this). These models aren't in Pi 1.5.2's bundled list, so a new machine also needs one online start (or pi update --models) before /cg and /co pro resolve.

Pi Model Tiers

The model-tiers extension registers seven provider families. Each family scopes Ctrl+P to an instant → thinking → pro ladder.

command instant thinking pro
/a Anthropic·Bedrock (disabled) haiku-4-5 sonnet-5 opus-5
/c GitHub Copilot haiku-5.5 sonnet-5.5 opus-5.5
/co Copilot·OpenAI gpt-6-luna gpt-6.1-terra gpt-6.2-sol
/cg Copilot·Gemini gemini-4-hydrogen (thinking low) gemini-4-neon (thinking medium) gemini-4-carbon (thinking high)
/g Google·Gemini (disabled) gemini-3.8-flash (thinking low) gemini-3.8-flash (thinking medium) gemini-3.8-flash (thinking high)
/n NVIDIA NIM nemotron-3.5-lightning nemotron-3.5-super-vl nemotron-3-ultra
/o OpenAI·Codex gpt-6-luna gpt-6.1-terra gpt-6.2-sol
  • /c thinking — jump directly to a named tier
  • Ctrl+P / Shift+Ctrl+P — cycle forward / backward within the active family
  • Footer shows active family and tier: c·instant, co·thinking, cg·pro
  • Thinking levels baked in: instant=off, thinking=medium, pro=high; /cg starts instant at low
  • Disabled families (/a Bedrock, /g Gemini API) keep their definitions in model-tiers.ts with a disabled: reason: no command is registered and /tiers lists them dimmed. Delete the disabled line (and uncomment the provider's key in local.zsh, for /g) to re-enable
  • /co and /cg route OpenAI and Gemini models through GitHub Copilot, so they share /c's billing
  • /cg drops from ~983k (hydrogen) to 200k (neon, carbon) when escalating — /compact a long session before Ctrl+P; neon also costs more per token than carbon
  • /model (Ctrl+L) escapes the tier system: picking a non-tier model clears family tracking; picking a tier model joins that tier
  • GFE profiles are maintained separately in the Helix dotfiles collection. This repository retains personal and contractor configuration; do not deploy those profiles on a GFE.

Model Cheat Sheet

Model Best For Speed Notes
claude-sonnet-4-6 Reliable everyday work Medium Previous default
claude-haiku-4-5 Small model, cheap follow-ups Fast Current small_model
kimi-k2.5 General coding, alternative default Medium (but can stall) Good Bedrock non-Claude default; occasional high-latency stalls — give it 10m before Esc
qwen3-coder-480b Complex coding, large refactors Slow Largest coding-specific model
qwen3-coder-30b Everyday coding, faster Qwen Fast Can hallucinate on simple tasks
qwen3-next-80b General coding, faster Qwen Fast Good candidate for cheaper day-to-day use
gpt-oss-120b General coding, alternative to Kimi Medium OpenAI open-weight on Bedrock
gpt-oss-20b Fast tasks, lightweight coding Fast Smaller GPT OSS variant
nova-2-lite Long-context reasoning, AWS-native Fast Newer Nova option with large context window
nova-pro General purpose, AWS-native Fast Amazon's flagship, reliable
gemma-3-27b General coding Medium Google, clean responses
glm-5 General coding Medium Z.AI, good quality
minimax-m2.5 Titles, summaries, small tasks Very fast Fast Bedrock utility model
ministral-14b Lightweight coding tasks Fast Mistral small model
mistral-large Reasoning-heavy tasks Medium Mistral's flagship, 4.4s
devstral Coding-specific (Mistral) Fast Mistral coding model, 4.4s
llama4-maverick Multimodal, general Medium No tool calls on Bedrock; chat/read-only only
llama4-scout Huge context, multi-doc analysis Medium 10M token context; no tool calls on Bedrock
deepseek-r1 Hard reasoning, math, STEM Slow Chain-of-thought; no tool calls on Bedrock; 64K context
deepseek-v3.2 Coding, general (latest DeepSeek) Medium Newer/stronger than V3; bare model ID deepseek.v3.2
claude-opus-4-7 Hardest coding and review tasks Medium Previous Pi default (current default is claude-haiku-5.5 via /c)
claude-opus-4-6 Hardest coding and review tasks Slow Strong upgrade path when Sonnet is not enough

Quick picks (pi — use tier commands):

  • Start any session → /c (Copilot instant), then Ctrl+P to escalate
  • Large context → /n (NIM Nemotron: ~1M ctx across all tiers) or /cg instant (hydrogen: ~983k)
  • OpenAI reasoning → /o (Codex: gpt-6-luna → 6.1-terra → 6.2-sol) or /co (Copilot: gpt-6-luna → 6.1-terra → 6.2-sol)
  • Gemini pro tier → /cg pro (gemini-4-carbon via Copilot)
  • Hard problem / big codebase → /c pro, /co pro, or /o pro

Quick picks (OpenCode — disabled):

  • Default everyday work → claude-sonnet-4-6
  • Hard problem / big codebase → qwen3-coder-480b
  • Need speed → claude-haiku-4-5, qwen3-next-80b, or minimax-m2.5
  • AWS-native long context → nova-2-lite

Structure

dotfiles/
├── claude/          # Claude Code configuration
│   └── .claude/
│       ├── settings.json  # Bedrock/SSO settings, status bar command
│       └── statusline.sh  # Status bar renderer
├── config/          # Modern config files (~/.config/)
│   └── .config/
│       ├── ghostty/ # Ghostty terminal configuration
│       ├── opencode/ # OpenCode config and custom agents
│       ├── hypr/    # Hyprland window manager (OMArchy)
│       ├── nvim/    # Neovim configuration (LazyVim + GitHub Copilot)
│       ├── waybar/  # Waybar status bar (OMArchy) with VPN module
│       └── zed/     # Zed editor settings and keymaps
├── git/             # Git configuration
│   ├── .gitconfig
│   └── .gitignore_global
├── homebrew/        # Homebrew package management
│   └── Brewfile     # List of installed packages
├── herdr/           # Herdr terminal multiplexer configuration
│   └── .config/herdr/
│       └── config.toml # Prefix-free pane/tab keybindings
├── herdr-core/      # Herdr desktop app sub-agent templates (stow --no-folding)
│   └── .config/herdr-core/
│       └── templates/  # scout, planner, worker, reviewer, adversarial-reviewer, visual-tester
├── pi/              # Pi coding agent configuration (personal)
│   └── .config/pi/agent/
│       ├── AGENTS.md        # Global system prompt additions
│       ├── settings.json    # Model whitelist, provider, thinking level, packages
│       ├── extensions/      # Auto-discovered TypeScript extensions
│       │   ├── herdr-agent-state.ts  # Herdr agent lifecycle status reporting
│       │   └── model-tiers.ts        # /a /c /co /cg /g /n /o tier commands + Ctrl+P cycling
│       ├── keybindings.json # Clears built-in Ctrl+P (owned by model-tiers)
│       ├── herdr-agents/
│       │   └── config.json  # Subagent pane layout + 8m hang-warning supervision
│       └── prompts/         # Slash-command prompt templates
│   (packages: npm:pi-herdr-agents — async subagents in Herdr panes)
│   (packages: npm:pi-herdr-roles  — scout/planner/worker/reviewer + /plan)
├── scripts/         # Utility scripts
│   ├── wt-clean.sh  # Clean up stale worktrunk worktrees
│   ├── pi-pihole-restore.sh # Restore Pi-hole configuration
│   └── install-lid-wakeup-fix.sh # Systemd service for lid wakeup fix
├── logseq/          # Logseq knowledge management
│   ├── .logseq/
│   │   ├── config/
│   │   │   ├── config.edn    # Global shortcuts and settings
│   │   │   └── plugins.edn   # Installed plugins list
│   │   ├── custom.css        # Global Logseq custom styling (fallback)
│   │   ├── settings/
│   │   │   ├── logseq-everforest-theme.json
│   │   │   └── logseq-journals-calendar.json
│   │   └── preferences.json  # UI preferences and themes
│   └── Notes/logseq/
│       └── custom.css        # Graph-level custom CSS (active — takes precedence)
├── shell/           # Shell configuration
│   ├── .bash_functions/
│   │   └── image-tools.bash  # Bash image utilities
│   ├── .zsh_functions/
│   │   └── image-tools.zsh
│   ├── .bashrc           # Enhanced bash config (Arch Linux/OMArchy)
│   ├── .bash_profile     # Bash profile (sources .bashrc)
│   ├── .config/zsh/      # Shared + OS-specific Zsh config layers
│   └── .zshrc            # Cross-platform Zsh entrypoint
├── ssh/             # SSH client configuration
│   └── .ssh/
│       └── config
├── vim/             # Vim configuration
│   └── .vimrc
├── vscode/          # VS Code configuration
│   └── Library/Application Support/Code/User/
│       ├── settings.json
│       └── keybindings.json
└── vscode-insiders/ # VS Code Insiders configuration
    └── Library/Application Support/Code - Insiders/User/
        ├── settings.json
        └── keybindings.json

Prerequisites

Install Stow

macOS (Homebrew):

brew install stow

Arch Linux:

sudo pacman -S stow

Installation

Fresh Machine Setup

  1. Install prerequisites:

    # Install Homebrew (if not already installed)
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
    # Install Stow
    brew install stow
  2. Clone the repository:

    git clone <your-repo-url> ~/dotfiles
    cd ~/dotfiles
    # Keep Pi's session-rewritten settings.json fields (model, changelog) out of Git
    git config filter.pi-settings.clean "scripts/git-clean-pi-settings.sh %f"
  3. Install packages from Brewfile:

    brew bundle install --file=homebrew/Brewfile

    On Linux, install the shell dependencies you want manually (zsh, fnm, zoxide, fastfetch, etc.) or with your distro package manager.

  4. Stow packages individually:

    stow git          # Git configuration
    stow shell        # Cross-platform Zsh, Bash, profile, functions
    stow vim          # Vim configuration
    stow config       # App configs including Ghostty, Neovim, Zed, and Hyprland
    stow ssh          # SSH client config
    stow aws          # AWS CLI config — template only; real values go in ~/.aws/config (see aws/.aws/config)
    stow vscode       # VS Code settings and keybindings
    stow vscode-insiders # VS Code Insiders settings
    stow logseq       # Logseq configuration
    stow homebrew     # Homebrew Brewfile
    stow herdr        # Herdr keybindings
    stow --no-folding herdr-core # Herdr desktop app sub-agent templates
    stow claude       # Claude Code settings and statusline
    stow pi           # Pi coding agent config, extensions, and prompts

    Important: After stowing shell, verify the zsh config directory is properly linked:

    ls -la ~/.config/zsh  # Should show: ~/.config/zsh -> ../dotfiles/shell/.config/zsh

    This symlink is critical for the modular zsh configuration to work. If it's missing, run:

    cd ~/dotfiles
    stow -R shell
  5. Use explicit package lists only. Do not stow every directory: scripts, documentation, and local migration remnants are not deployable packages.

Existing Machine (Update)

If you already have some configs and want to adopt them:

  1. Pull latest changes:

    cd ~/dotfiles
    git pull
  2. Stow with adopt flag to take over existing files:

    stow --adopt packagename  # For specific package

Usage

Zsh Layout

  • ~/.zshrc detects the OS and loads platform-specific config first so Homebrew / /usr/local/bin are on PATH before shared tool init
  • ~/.config/zsh/macos.zsh holds Homebrew, cmux, and macOS ssh-agent behavior
  • ~/.config/zsh/linux.zsh holds Linux clipboard and path behavior
  • ~/.config/zsh/common.zsh holds portable aliases, tool init (fnm, zoxide, wt), and function loading
  • ~/.config/zsh/local.zsh is optional and stays machine-specific

Raspberry Pi Pi-hole Rebuild

After flashing a fresh Bookworm card, enabling SSH, and installing Pi-hole, you can restore the saved Pi-hole config with:

./scripts/pi-pihole-restore.sh

The script expects the backup set at ~/Downloads/pi-pre-upgrade-backups/20260310-150325 by default and can target a different host or backup directory with --host and --backup-dir.

Cleaning Up Stale Worktrunk Worktrees

Use the wt-clean helper script to remove stale git worktrees created with worktrunk:

# Interactive mode (shows what will be removed, asks for confirmation)
wt-clean

# Dry run (see what would be removed without actually removing)
wt-clean --dry-run

# Remove without confirmation
wt-clean --force

# Verbose output
wt-clean -v

The script identifies and removes:

  • Prunable worktrees: Directories that were manually deleted with stale metadata
  • Integrated worktrees: Branches merged into main (safe to delete)
  • Empty worktrees: Same commit as main with clean working tree

Requirements: wt (worktrunk) and jq installed (both available via Homebrew).

The script lives in scripts/wt-clean.sh. To make it available on PATH, symlink it to ~/.local/bin (the convention used in this repo):

ln -sf ~/dotfiles/scripts/wt-clean.sh ~/.local/bin/wt-clean

LogSeq Asset Compression (scripts/compress-logseq-assets.sh)

Compresses PNG, JPEG, and HEIC images in a LogSeq assets/ directory to WebP format and updates all markdown link references in pages/ and journals/. Handles all four LogSeq link patterns (![alt](../assets/...), ![[filename]], file::, and file-path::).

Two modes:

  • --migrate: One-time full migration of all existing images. Creates a asset-compression git branch, handles HEIC files via sips, and requires a clean working tree.
  • --incremental: Only converts new images (those without an existing .webp sibling). Safe to re-run; idempotent.

Both modes accept --dry-run (default, no changes) or --execute (performs the conversion).

Requirements: cwebp (brew install webp), sips (built into macOS, needed for --migrate only).

Initial migration (run once):

# Preview
compress-logseq-assets --migrate --dry-run

# Execute (creates asset-compression branch, converts everything, updates links)
compress-logseq-assets --migrate --execute

Symlink to PATH:

ln -sf ~/dotfiles/scripts/compress-logseq-assets.sh ~/.local/bin/compress-logseq-assets

LaunchAgent jobs (macOS — compression, iCloud sync, and persistent ssh-agent):

The .plist files under scripts/ are templates containing __HOME__ placeholders — do not symlink them directly into ~/Library/LaunchAgents/. Install or reinstall all LaunchAgents with:

~/dotfiles/scripts/install-launchagents.sh

This substitutes __HOME__ with $HOME, writes the rendered plists into ~/Library/LaunchAgents/, and bootstraps them into gui/$(id -u):

  • com.fpigeon.compress-logseq-assets: Runs every Sunday at 03:00 (--incremental --execute), injects Homebrew PATH, and logs to ~/.local/share/logs/compress-logseq-assets.log. New images pasted into LogSeq during the week are compressed before the next iCloud sync picks them up.
  • com.fpigeon.sync-notes-to-icloud: Runs every 15 minutes and on load via sync-notes-to-icloud-export.sh. Writes detailed sync logs to ~/.local/share/logs/sync-notes-to-icloud.log and launchd output to ~/.local/share/logs/launchd-sync-notes-to-icloud.log.
  • com.fpigeonjr.ssh-agent: Keeps a persistent ssh-agent socket at ~/.ssh/ssh-agent.sock (used by macos.zsh for SSH auth and commit signing).

To trigger an immediate test run after installation:

launchctl kickstart -k "gui/$(id -u)/com.fpigeon.compress-logseq-assets"
launchctl kickstart -k "gui/$(id -u)/com.fpigeon.sync-notes-to-icloud"

Export-Style Sync Behavior

The sync script uses an export-style approach that minimizes iCloud Drive traversal issues:

  1. Staging: Creates a clean staging area at ~/.local/state/sync-notes-to-icloud-staging/
  2. Selective copy: Only copies journals/, pages/, assets/, logseq/, whiteboards/ and select top-level files (config files are optional — only included if they exist)
  3. Protected paths: The logseq/bak/ directory is protected from deletion (preserves Logseq's automatic backups)
  4. Verification: After sync, verifies key files (today's journal, conventions page) by size to ensure delivery
  5. Error handling: Treats rsync exit codes 23 (partial transfer) and 11 (EDEADLK - iCloud file locks) as success if verification passes

After both agents are loaded, remove the old cron entries with crontab -e or crontab -r after confirming the LaunchAgents are running.

Troubleshooting findings (2026-04-17):

  • The old cron-based sync was running on schedule, but failed against ~/Library/Mobile Documents/... with Operation not permitted.
  • The failure was not caused by Unix file permissions. Script execute bits, ownership, and log directory permissions were already correct.
  • The root cause was macOS privacy/TCC access for the non-interactive job context. Moving the sync from cron to a user LaunchAgent was the correct scheduler change for iCloud Drive access.
  • The minimum practical permission change for this setup was granting Full Disk Access to /bin/bash and rsync, because those are the executables the LaunchAgent runs during sync. After that change, the iCloud permission error stopped.
  • The built-in macOS /usr/bin/rsync was still unreliable for this workload and produced mmap: Resource deadlock avoided errors on files in ~/Notes.
  • Installing Homebrew rsync fixed the remaining sync failures. The sync script now prefers /opt/homebrew/bin/rsync automatically when available and logs which binary it used on each run.
  • A successful verification run completed at 2026-04-17 21:26:14, with the log showing Using rsync binary: /opt/homebrew/bin/rsync followed by Sync completed successfully.

Recommended macOS setup for sync-notes-to-icloud-export.sh:

  • Scheduler: user LaunchAgent, not cron
  • Permissions: Full Disk Access for /bin/bash and rsync
  • rsync: Homebrew rsync (brew install rsync), not the system /usr/bin/rsync
  • Verification:
    • launchctl print "gui/$(id -u)/com.fpigeon.sync-notes-to-icloud"
    • tail -n 20 ~/.local/share/logs/sync-notes-to-icloud.log

Recovery: If anything goes wrong, the Notes repo has a pre-asset-compression-YYYYMMDD git tag to restore from.

Adding New Configurations

  1. Create a new package directory:

    mkdir ~/dotfiles/newpackage
  2. Move your dotfiles to the package:

    mv ~/.someconfig ~/dotfiles/newpackage/
  3. Stow the new package:

    cd ~/dotfiles
    stow newpackage

Updating Configurations

Simply edit the files in your dotfiles directory. Changes are immediately reflected since they're symlinked.

Adding New Files to Existing Packages

  1. Add the file to the appropriate package directory
  2. Re-stow if necessary:
    stow -R packagename  # Restow to pick up new files

Maintenance

Backup Before Major Changes

# Create a backup branch before major updates
git checkout -b backup-$(date +%Y%m%d)
git checkout main

Keep Dependencies Updated

  • Update Oh My Zsh: omz update
  • Update Neovim plugins: :Lazy sync in nvim
  • Update Homebrew packages: brew upgrade
  • Regenerate Brewfile: brew bundle dump --force --file=homebrew/Brewfile

Sync Across Machines

# On machine A (after making changes)
git add .
git commit -m "Update configurations"
git push

# On machine B
git pull
stow -R git shell vim config  # Only the reviewed packages installed on this machine

Troubleshooting

Before First-Time Setup: Backup Existing Configs

Always backup existing configurations before stowing for the first time:

# Create backup directory
mkdir -p ~/config-backup/$(date +%Y%m%d)

# Backup common config files
cp ~/.gitconfig ~/config-backup/$(date +%Y%m%d)/ 2>/dev/null || true
cp ~/.zshrc ~/config-backup/$(date +%Y%m%d)/ 2>/dev/null || true
cp ~/.vimrc ~/config-backup/$(date +%Y%m%d)/ 2>/dev/null || true
cp -r ~/.config/nvim ~/config-backup/$(date +%Y%m%d)/ 2>/dev/null || true
cp -r ~/.config/zed ~/config-backup/$(date +%Y%m%d)/ 2>/dev/null || true
cp -r ~/.config/hypr ~/config-backup/$(date +%Y%m%d)/ 2>/dev/null || true
cp ~/Library/Application\ Support/Code/User/settings.json ~/config-backup/$(date +%Y%m%d)/vscode-settings.json 2>/dev/null || true
cp -r ~/.logseq/config ~/config-backup/$(date +%Y%m%d)/ 2>/dev/null || true
cp ~/.logseq/preferences.json ~/config-backup/$(date +%Y%m%d)/ 2>/dev/null || true

echo "Backup created in ~/config-backup/$(date +%Y%m%d)/"

How Stow Works (Directory Folding)

Stow uses directory folding — rather than symlinking individual files, it symlinks entire directories when it can. For example, after stow shell, ~/.config/zsh is a symlink pointing to ~/dotfiles/shell/.config/zsh. Files inside that directory appear as regular files under ~ but are the repo files.

# Confirm a directory is folded (look for -> in output)
ls -la ~/.config/zsh
# lrwxr-xr-x ... ~/.config/zsh -> ../dotfiles/shell/.config/zsh

# A file inside a folded dir shows as a regular file — this is correct
ls -la ~/.config/zsh/common.zsh
# -rw-r--r-- ... (not a symlink, but edits go directly into the repo)

Key implications:

  • Editing a file inside a folded directory edits the dotfiles repo file directly — changes are live immediately, no restow needed.
  • Never rm a file inside a folded stow path — it deletes the actual repo file, not a symlink.
  • If you need to add a new file to a package that's already stowed, just create it in the repo and run stow -R <package> to pick it up.
# Verify key directories are properly folded
ls -la ~/.config/zsh ~/.config/ghostty ~/.zsh_functions
# All should show as symlinks into ~/dotfiles/

Stow Conflicts

When stow reports "cannot stow over existing target", you have three options:

Method 1: Manual backup and removal (Recommended - Safest)

# Backup the conflicting file first
cp ~/.conflicting-file ~/.conflicting-file.backup

# Remove the conflicting file
rm ~/.conflicting-file

# Then stow normally
stow packagename

# If issues occur, restore from backup:
# cp ~/.conflicting-file.backup ~/.conflicting-file

Method 2: Using -R flag (Only for already-stowed packages)

# This only works if the package was previously stowed successfully
# -R (restow) removes existing symlinks, then recreates them
stow -R packagename

# Note: -R will FAIL if there are actual file conflicts
# It only removes symlinks it previously created

Method 3: Using --adopt flag (Advanced - Modifies your dotfiles repo)

# CAUTION: This modifies your dotfiles repo!
stow --adopt packagename

⚠️ Critical Notes about --adopt:

  • Takes existing files from your system and overwrites files in your dotfiles repo
  • Your carefully crafted configurations will be replaced with current system files
  • Always run git diff after using --adopt to see what changed
  • Only commit if you actually want to keep the system versions over your dotfiles versions
  • This is useful when setting up dotfiles on a machine with existing configs you prefer

Safe workflow with --adopt:

# 1. Create a backup branch first
git checkout -b backup-before-adopt-$(date +%Y%m%d)
git checkout main

# 2. Try adopt
stow --adopt packagename

# 3. MANDATORY: Review what changed
git diff

# 4. Decision point:
# Keep adopted changes: git add . && git commit -m "Adopt system configs"
# Revert adopted changes: git checkout -- .

Restoring from Backup

If something goes wrong after stowing:

# Unstow the problematic package
stow -D packagename

# Restore from backup
cp ~/config-backup/YYYYMMDD/.configfile ~/.configfile

# Fix issues, then try stowing again

Other Common Issues

Code Style Reference:

Language Style Formatter
Lua (Neovim) 2-space indent, 120 col width stylua --config ~/.config/nvim/stylua.toml .
Shell (Bash/Zsh) [[ ]] conditionals, command -v guards, snake_case locals shellcheck (if available)
JavaScript/TypeScript Prettier defaults npx prettier --write . + npx eslint .

Syntax-check and lint configs/scripts in one command:

./scripts/check.sh

Or run individual checks:

zsh -n ~/.zshrc          # Zsh syntax check
bash -n ~/.bashrc         # Bash syntax check
bash -n scripts/foo.sh   # Any script in scripts/

Neovim / GitHub Copilot keybindings (plugin: zbirenbaum/copilot.lua):

Mode Key Action
Normal <leader>ct Toggle auto-suggest
Normal <leader>cd Disable Copilot
Normal <leader>ce Enable Copilot
Normal <leader>cp Open suggestions panel
Insert Ctrl+j Accept suggestion
Insert Ctrl+l Accept next word
Insert Ctrl+e Dismiss suggestion

Copilot is disabled for: yaml, gitcommit, help filetypes. Run :Copilot auth if authentication is needed.

Ghostty config settings being silently ignored:

Ghostty stops parsing the config file at any line with trailing whitespace — all settings after that line are dropped with no error. Symptoms include settings appearing in the file but having no effect.

# Check for trailing whitespace
rg "\s+$" config/.config/ghostty/config

# Verify what Ghostty actually loaded
ghostty +show-config --default=false

copy-on-select = clipboard not working on macOS:

This is a known bug in Ghostty builds prior to 1.3.1. The clipboard value is the correct setting (copies selection to the system clipboard automatically), but may be silently ignored on affected builds. Workaround: use Cmd+C after selecting text, then Cmd+V to paste.

Broken Symlinks:

# Find broken symlinks
find ~ -maxdepth 1 -type l ! -exec test -e {} \; -print

# Remove broken symlinks
find ~ -maxdepth 1 -type l ! -exec test -e {} \; -delete

Verify Stow Status:

# Check what's currently stowed
ls -la ~ | grep dotfiles

# Check specific config directories
ls -la ~/.config/ | grep dotfiles

Complete Reset (Nuclear option):

# Unstow everything
cd ~/dotfiles
stow -D git shell vim config  # Explicit installed packages only

# Restore all from backup
cp -r ~/config-backup/YYYYMMDD/* ~/

# Start fresh with stowing

Security Notes

  • SSH keys and sensitive data are excluded via .gitignore
  • Only configuration files are tracked, not secrets
  • Review .env.local for sensitive environment variables

Package Overview

Package Contains Purpose
git .gitconfig, .gitignore_global Git settings and global ignores
shell .bashrc, .bash_profile, .zshrc, .config/zsh/, functions Shell configuration (bash for Arch/OMArchy, zsh for macOS; untracked .env.local / local.zsh supported)
vim .vimrc Traditional Vim settings
config .config/nvim/, .config/zed/, .config/hypr/, .config/waybar/, .config/ghostty/, .config/opencode/ Modern app configurations (Neovim includes GitHub Copilot; OpenCode config, agents, and plugins)
ssh .ssh/config SSH client settings (no keys)
aws .aws/config AWS CLI SSO profile template — stow then fill in real values, or skip stowing and create ~/.aws/config manually
vscode settings.json, keybindings.json VS Code configuration
vscode-insiders settings.json, keybindings.json VS Code Insiders configuration
logseq .logseq/config/, .logseq/custom.css, .logseq/settings/, .logseq/preferences.json, Notes/logseq/custom.css Logseq knowledge management settings, plugins, and graph-level CSS (graph CSS takes precedence over global)
homebrew Brewfile Homebrew package list for easy setup
herdr .config/herdr/config.toml Herdr keybindings for splits, pane close/focus/zoom, tabs, and sidebar
herdr-core .config/herdr-core/templates/ Herdr desktop app (hc) sub-agent role templates (stow --no-folding)
claude .claude/settings.json, .claude/statusline.sh Claude Code Bedrock/SSO config and status bar renderer
pi .config/pi/agent/ Pi coding agent settings, extensions, and prompt templates

Dependencies

  • Zsh plugins: zsh-syntax-highlighting
  • Neovim: LazyVim distribution
  • Tools: fnm, zoxide, fastfetch, podman
  • macOS specific: Uses Keychain for SSH keys

About

my dotfiles for my adventures in Linux

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages