feat(claude): settings-repair override for aifx + direct claude#15
Merged
Conversation
…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>
There was a problem hiding this comment.
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
claudewrapper that snapshots enforced settings, reapplies tracked user deltas on launch, and re-derives deltas on exit. - Introduces an
aifxwrapper that (foragent run claude) forces--no-updateand temporarily installs an ephemeral~/.local/bin/claudesymlink to keep theclaudewrapper 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Routes both
claudeandaifx agent run claudethrough a settings-repair override so aifx's enforced~/.claude/settings.jsonmerge no longer clobbers personal tweaks.Two PATH-shadowing scripts in
~/.local/share/overrides/bin(already first on PATH):executable_claude— snapshots aifx's enforcedsettings.jsonas a baseline, replays tracked deltas (settings.user-changed.json) before launch, and re-derives them on exit (so shutdown writes like a/modelsave round-trip). Resolves the realclaudeon PATH by canonical path, excluding itself — works with the Homebrew cask on macOS and apt on devpod, no hardcoded prefix.executable_aifx— forces--no-updateonagent run claude(updates come from the package manager, since aifx enforcesDISABLE_AUTOUPDATER=1), and owns~/.local/bin/claude(aifx's first binary candidate) as an ephemeral symlink: created per run, removed on exit.install/updatekeep it absent so aifx resolves the real binary via its own candidate list; everything else passes through.Scope
.work) in.chezmoiignore.tmpl— applies onmacos-workanddevpod, skipped elsewhere.claudebinary comes from the existingclaude-code@latestcask already inpackages.yaml.Verification (on this branch, rebased onto latest
main)chezmoi diffclean.claude --versionandaifx agent run claude --versionboth →2.1.195in bash and fish.Note (not fixed here)
The repo's existing
.chezmoiignoreentries 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-fetchis stillchezmoi managedon 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