2026-09-04 Dotfiles Comprehensive Audit and TDD Fixes
What I set out to do
Review the dotfiles codebase for improvements and obsolete cruft, clean up confirmed directory leftovers, ground and verify findings, and apply targeted fixes using test-driven development (TDD) for code changes under the Mandatory Dotfiles Change Protocol.
What I actually did
-
Storage and Cruft Cleanup:
- Removed orphaned Sonarr backup
sonarr.backup.20260101(46 MB reclaimed). - Removed obsolete
superpowersdirectory containing ~94,000 JSONL session logs (765 MB reclaimed).
- Removed orphaned Sonarr backup
-
Documentation and Bootstrap Fixes:
- Resolved ADR filename collision by renumbering
0011-update-changelogs-resolution.mdto0027-update-changelogs-resolution.md. - Corrected manual bootstrap flake output targets in
README.mdto valid system doubleaarch64-darwin/x86_64-linux. Commitd2f5a24.
- Resolved ADR filename collision by renumbering
-
Build Tooling and Pre-Commit Scoping:
- Scoped
just checkandprekrecipes with--config .pre-commit-config.yamlto avoid walking into nested subprojects where Astral’styhook collided on missing rootpyproject.toml. - Fixed E501 line length in
claude_ops/db.py. Commit81b6430.
- Scoped
-
Git and Shell Declarations:
- Updated deprecated Git alias
stash savetostash pushinnix/home-manager/modules/git.nix. Commit6db6f2e. - Removed erroneous Ghostty bundle ID from
jankyborderslaunchd agent innix/home-manager/modules/shell.nix. Commitc8deca9.
- Updated deprecated Git alias
-
Gemini Upstream Skills Path:
- Corrected
upstreamSkillsDiringemini.nixto.gemini/antigravity-cli/skills, matching the upstream Home Manager module output and eliminating duplicate generated skill derivations inhome.file. Commit03d508e.
- Corrected
-
Neovim Claude Session Path (TDD):
- Extracted session path helper
user.claude_session_pathwith URL-style path encoding and branch resolver caching. - Wired cache invalidation on
FocusGainedandDirChangedinproject-session.luaso branch switches within the same working directory reflect accurately without stale session bindings. - Wrote headless test suite in
nvim/tests/claude_session_path_spec.luacovering encoding, path formatting, directory changes, and explicit cache invalidation. Commit22bcb88.
- Extracted session path helper
-
Neovim Autocmds Optimization (TDD):
- Wrote headless test suite in
nvim/tests/autocmds_spec.luaasserting no active 1000ms polling timers and verifying pure in-process Python project root detection. - Removed redundant 1-second
timer_startpolling loopchecktime_safefromconfig.autocmds, relying on existing event-driven autocmds (FocusGained,BufEnter,CursorHold,CursorHoldI,TermLeave,TermClose). - Replaced synchronous
git rev-parse --show-toplevelprocess execution insetup_test_tabwithvim.fs.rootandvim.uv.fs_stat, eliminating external subprocess spawning during startup. Commit5a5d18a.
- Wrote headless test suite in
-
Pre-commit Unscoped Execution:
- Reverted config scoping in
justfilesocheckandprekexecute across all files and discovered nested subprojects undernix/projects/. Commit1867ea7.
- Reverted config scoping in
-
Detached HEAD Handling in Claude Session Path (TDD):
- Updated
user.claude_session_pathand test suiteclaude_session_path_spec.luaso detached HEAD checkouts (during bisect, rebasing, or detached commits) do not collapse onto a sharedHEADsession string, falling back to clean directory sessions. Commit4340d8f.
- Updated
-
Test Tab Generalization & Neotest Safeguard (TDD):
- Updated
config.autocmdsand test suiteautocmds_spec.luato generalize project root detection to Rust, Go, and JS/TS projects (Cargo.toml,go.mod,package.json). - Replaced synchronous
fdsubprocess invocation with in-processvim.fs.find. - Guarded Neotest window commands (
Neotest summary,Neotest output-panel) inside an active Neotest check. Commit4a19e3b.
- Updated
-
Claude Polling Timer Lifecycle:
- Wired a
BufWipeout/TermClosebuffer-local autocmd inproject-session.luato terminate and close the Claude session polling timer immediately if the terminal buffer closes before 10 attempts elapse. Commit3af28e2.
- Wired a
-
Dependency-Only Project Pre-Commit Cleanup:
- Removed unused
tyandpytest-unithooks fromnix/projects/obsidian-mcp-proxy/.pre-commit-config.yamlbecause it contains no first-party Python source files. Commitfab3be0.
- Removed unused
-
Antigravity Skills Target Directory Alignment:
- Updated
targetSkillsDiringemini.nixto.gemini/config/skills, aligning with Antigravity’s machine-global customization discovery path. Commit44dccf9.
- Updated
-
Codex Auto-Review and Guardian Configuration:
- Configured
approvals_reviewer = "auto_review"andreview_model = "openrouter/z-ai/glm-5.3-flash"innix/home-manager/modules/coding-agents/codex/codex.nix. - Applied declarative configuration via
hm switchto update~/.codex/config.toml. - Verified pre-commit checks with
just checkand verified live execution withcodex doctorand test turn. Commitb9da28b.
- Configured
-
Antigravity Default Agent Mode:
- Configured
agentMode = "accept-edits"innix/home-manager/modules/coding-agents/gemini/gemini.nix. - Applied declarative configuration via
hm switchto update~/.gemini/antigravity-cli/settings.json. - Verified pre-commit checks with
just check. Commit8eab966.
- Configured
Verification
- Headless Neovim test suites (
autocmds_spec.lua,claude_session_owner_spec.lua,claude_session_path_spec.lua, andclaude_window_spec.lua) all pass cleanly. just checkruns across all files and nested projects with zero errors.- Flake checks for both root and Home Manager flakes pass all derivations and unit tests.
- Codex configuration verified via
hm switchandcodex doctor. - Antigravity settings verified via
hm switchand inspectedsettings.json.