Skip to content

feat(claude): settings-repair override for aifx + direct claude#15

Merged
tyvsmith merged 1 commit into
mainfrom
feat/claude-aifx-overrides
Jun 27, 2026
Merged

feat(claude): settings-repair override for aifx + direct claude#15
tyvsmith merged 1 commit into
mainfrom
feat/claude-aifx-overrides

Conversation

@tyvsmith

Copy link
Copy Markdown
Owner

What

Routes both claude and aifx agent run claude through a settings-repair override so aifx's enforced ~/.claude/settings.json merge no longer clobbers personal tweaks.

Two PATH-shadowing scripts in ~/.local/share/overrides/bin (already first on PATH):

  • executable_claude — snapshots aifx's enforced settings.json as a baseline, replays tracked deltas (settings.user-changed.json) before launch, and re-derives them on exit (so shutdown writes like a /model save round-trip). Resolves the real claude on PATH by canonical path, excluding itself — works with the Homebrew cask on macOS and apt on devpod, no hardcoded prefix.
  • executable_aifx — forces --no-update on agent run claude (updates come from the package manager, since aifx enforces DISABLE_AUTOUPDATER=1), and owns ~/.local/bin/claude (aifx's first binary candidate) as an ephemeral symlink: created per run, removed on exit. install/update keep it absent so aifx resolves the real binary via its own candidate list; everything else passes through.

Scope

  • Gated to work profiles (.work) in .chezmoiignore.tmpl — applies on macos-work and devpod, skipped elsewhere.
  • The real claude binary comes from the existing claude-code@latest cask already in packages.yaml.

Verification (on this branch, rebased onto latest main)

  • Templates render; overrides managed on the work profile; chezmoi diff clean.
  • claude --version and aifx agent run claude --version both → 2.1.195 in bash and fish.
  • Recursion-safe via the ephemeral symlink; the symlink is absent after each run.

Note (not fixed here)

The repo's existing .chezmoiignore entries use source-style paths (e.g. dot_local/share/overrides/bin/executable_ydotool, dot_local/bin/executable_devpod-linuxbrew-fetch). chezmoi matches ignore patterns against target paths, so these are silently ineffective (e.g. .local/bin/devpod-linuxbrew-fetch is still chezmoi managed on macOS). My two entries are therefore written target-style so the work-only gating actually takes effect. Worth a follow-up to convert the rest.

🤖 Generated with Claude Code

…erride

aifx rewrites ~/.claude/settings.json from its enforced template on every
launch, clobbering personal tweaks. Add two PATH-shadowing overrides (in
~/.local/share/overrides/bin, which is first on PATH) so both `claude` and
`aifx agent run claude` flow through a wrapper that snapshots the enforced
baseline, replays tracked deltas, and re-derives them on exit.

- executable_claude: settings-repair proxy; resolves the real claude on PATH
  by canonical path excluding itself (works with the Homebrew cask on macOS
  and apt on devpod), so no hardcoded prefix.
- executable_aifx: forces --no-update on `agent run claude` (updates come from
  the package manager) and owns ~/.local/bin/claude (aifx's first binary
  candidate) as an ephemeral symlink, created per-run and removed on exit.
- .chezmoiignore: gate both on work profiles (.work). Entries are target-style
  because the repo's source-style ignore paths are matched against target
  paths and so are silently ineffective.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 27, 2026 01:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds work-profile-only PATH-shadowing overrides for claude and aifx to preserve user-intended ~/.claude/settings.json changes across aifx’s enforced settings merge, while keeping the “real” binaries discoverable.

Changes:

  • Introduces a claude wrapper that snapshots enforced settings, reapplies tracked user deltas on launch, and re-derives deltas on exit.
  • Introduces an aifx wrapper that (for agent run claude) forces --no-update and temporarily installs an ephemeral ~/.local/bin/claude symlink to keep the claude wrapper in the execution path.
  • Gates these overrides to work profiles via .chezmoiignore.tmpl.

Reviewed changes

Copilot reviewed 1 out of 3 changed files in this pull request and generated no comments.

File Description
dot_local/share/overrides/bin/executable_claude New claude wrapper to persist user settings deltas across enforced merges.
dot_local/share/overrides/bin/executable_aifx New aifx wrapper to route agent run claude through the claude override and force --no-update.
.chezmoiignore.tmpl Ignores the overrides outside work profiles (target-path style).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tyvsmith tyvsmith merged commit 3c009d0 into main Jun 27, 2026
2 checks passed
@tyvsmith tyvsmith deleted the feat/claude-aifx-overrides branch June 27, 2026 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants