Repository navigation
Agents: homeSpec.agents.claude.autoMode for auto mode rules - #57
Merged
Merged
Conversation
Auto mode reads autoMode.{environment,allow,soft_deny,hard_deny} from
user settings, which home-manager owns read-only. claude.settings is
merged with recursiveUpdate, which replaces lists, so typed list options
let several modules add rules. Every non-empty list starts with
"$defaults" so claude's built-in rules stay in force.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
andrewthomaslee
enabled auto-merge (squash)
November 29, 2026 14:18
andrewthomaslee
added a commit
to external-systems/home
that referenced
this pull request
Nov 29, 2026
## What - `users/netsa/claude-auto-mode.nix` (new): the org's auto mode rules through `homeSpec.agents.claude.autoMode`, imported by netsa's profile. - Environment (14): the org and its repos, private repos (`secrets`, `gitops`), primary use, org CLIs (incl. `uv`, `hcloud`), Hetzner Robot, Hetzner Cloud and Cloudflare, trusted domains (`external.systems`, `clan.lol`), secrets handling, protected `main`, the worktree routine, deploy targets, host containment, protected IaC. - Allow (1): pushing feature branches and `gh pr create/edit`. - Soft block (6): deploys, `clan vars generate` on main, push or merge to main, skipping hooks, disk wipes, Hetzner and Cloudflare changes. - Hard block (1): printing or writing a secret's value. - `users/netsa/default.nix`: imports it. - `flake.lock`: `modules` bumped to include external-systems/modules#57. - `documentation/docs/machines/index.md`: the netsa row mentions the rules. ## Why `/auto-mode-setup` cannot write `~/.claude/settings.json` (read-only, home-manager). The draft it produced was refined with the owner and moved into Nix. Every list keeps claude's built-in rules (`$defaults`) first. ## Checks - `fmt`: 0 changed. - `check`: all checks passed; `clan vars check` passed for every machine. One existing warning (`stdenv.isDarwin` deprecated), unrelated. - Rendered `settings.json` for netsa on kamrui-h1: `autoMode` has environment, allow, soft_deny and hard_deny, each led by `$defaults`. ## Merge order external-systems/modules#57 (merged), then this PR. Deploy afterwards (owner): `clan machines update kamrui-h1` (and other machines with netsa). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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
flake-parts/homeModules/agents/agents.nix: newhomeSpec.agents.claude.autoModewithenvironment,allow,softDeny,hardDeny(string lists) andincludeDefaults(default true). Rendered into~/.claude/settings.jsonasautoMode.{environment,allow,soft_deny,hard_deny}. Only non-empty lists are written, each led by"$defaults".tests/fixtures/nixos.nix: alice sets two rules.tests/flake-module.nix:agents-wiringasserts the rendering, the$defaultslead and that empty lists are left out.Why
/auto-mode-setupwrites to user settings, which home-manager owns read-only. The rules have to come from Nix.claude.settingsis merged withrecursiveUpdate, which replaces lists. Typed list options let several modules add rules."$defaults"keeps the built-in rules, and autoMode is read from user, flag and policy settings only (not a project's.claude/).Checks
fmt: 0 changed.check: all checks passed (x86_64-linux), incl.agents-wiring. One existing warning (stdenv.isDarwindeprecated), unrelated.Merge order
modulesand set the rules for netsa.🤖 Generated with Claude Code