# CLAUDE.md ## Repository overview NixOS flake for the `desktop` host (user `faumaray`): flakes, home-manager, agenix (secrets + SSH keys), disko (NVMe system disk + SATA SSD data disk), lanzaboote (Secure Boot), Hyprland (from its flake, applied through its own overlay), Noctalia shell, WezTerm, Neovim, Steam + Proton, full AMD CPU/GPU support. - `flake.nix`: inputs and outputs (`nixosConfigurations`, `apps`, `packages.iso`, `devShells`, `formatter`). - `lib/`: helpers (`mkHost`). - `overlays/`: custom overlays plus the upstream Hyprland overlay. - `modules/nixos/`: NixOS modules, with custom options under `my.*`. - `modules/home/`: home-manager modules, with custom options under `my.home.*`. - `hosts//`: per-host config, `disko.nix`, `hardware-configuration.nix`. - `secrets/`: `secrets.nix` (recipients) and encrypted `*.age` files. Never commit plaintext or `keys/`. - `apps/`: install, key and secret helper scripts exposed as `nix run .#`. Conventions: format with `nix fmt` (nixfmt). New behaviour goes behind a `my.*` option with an `enable` flag. Keep host files declarative and small. Checks: `nix flake check --no-build` and `nix eval .#nixosConfigurations.desktop.config.system.build.toplevel.drvPath`. ## Multi-agent orchestration policy **Scope:** this section applies **only to the main session**. Subagents perform the role they were assigned (see `.claude/agents/*.md`) and do **not** re-delegate it or act as orchestrators. ### Roles | Agent | Model / effort | Purpose | |---|---|---| | main session | `fable` / `max` (see `.claude/settings.json`) | Orchestrator | | `mao-designer` | opus / max | Designs, acceptance criteria, escalations | | `mao-implementer` | sonnet / max | Implements, tests, self-reviews | | `mao-sonnet-reviewer` | sonnet / max | Independent implementation review | | `mao-opus-reviewer` | opus / max | Final independent review | | `mao-helper` | haiku | Searches, summaries, routine git | ### Orchestrator duties 1. The main session **orchestrates**. It decomposes work, delegates, tracks progress and attempt counts, resolves escalations, and reports results. It delegates implementation, investigation, testing and review to agents rather than doing them itself. 2. Before delegating, define for each task: **objective, scope, acceptance criteria, relevant files, and the expected report**. 3. Use **named agents** (the `mao-*` agents above) so collaborators can address each other. 4. **Parallelize independent work only.** Never have two agents edit the same files at the same time. 5. The implementer runs the relevant checks and self-reviews before reporting. 6. Use a **fresh `mao-sonnet-reviewer`** for an independent implementation review. 7. Use a **fresh `mao-opus-reviewer`** for the final independent review of substantive code changes. Never reuse the design agent's conversation for this review. ### Attempts and escalation - Track failed attempts **per task**. An *attempt* is a proposed solution that was checked against the acceptance criteria. It is not one tool call. - After **3 unsuccessful implementation attempts**, stop Sonnet retries and escalate to `mao-designer` (Opus) with the evidence. - After **3 unsuccessful design/correction attempts by Opus**, escalate to the main orchestrator. - The orchestrator must then **change the approach, narrow the task, or request necessary user input**. Do not reset the counters and repeat the same loop. ### Communication - Use `SendMessage` for direct agent-to-agent communication when it is available. - Use `ListAgents` only if it is actually exposed in the session. Otherwise use the known agent names, or relay through the orchestrator. ### Reports Every agent report must include: **result, changed files, checks actually run (with real outcomes), unresolved issues, and attempt count**. Report unavailable agents, models or tools, and any fallback used, explicitly.