127 lines
6.6 KiB
Markdown
127 lines
6.6 KiB
Markdown
# CLAUDE.md
|
|
|
|
## Repository overview
|
|
|
|
NixOS flake for the `desktop` host (user `faumaray`) in the dendritic layout:
|
|
every `.nix` file under `modules/` is a flake-parts module, imported by
|
|
import-tree. Features ("aspects") are `flake.modules.nixos.<name>` and
|
|
`flake.modules.homeManager.<name>`; a host imports the aspects it wants.
|
|
Stack: flake-parts, home-manager (NixOS module), agenix, disko, lanzaboote
|
|
(Secure Boot), Hyprland (own flake and overlay) + Noctalia with an SDDM
|
|
greeter (no autologin), Stylix theming (opt-out: `autoEnable = true`), WezTerm,
|
|
Neovim (configuration from the private `nvim` input), Obsidian with a
|
|
declarative vault, Steam + Proton, proxy-suite with an AmneziaWG split tunnel
|
|
and a manual full-tunnel profile, Docker and a Gitea runner, Claude Code with MCP
|
|
servers, dev shells (Rust via fenix, C/C++, Vulkan) with `dev`, full AMD support.
|
|
|
|
The canonical remote is Gitea (https://git.faumaray.com/faumaray/NixOsConfig);
|
|
GitHub is a secondary remote. Pull requests and issues are handled through the
|
|
Gitea MCP tools.
|
|
|
|
- `flake.nix`: inputs and `nixConfig`; `outputs` is flake-parts over import-tree
|
|
of `modules/`.
|
|
- `modules/flake/`: glue: systems, `meta` (shared data), host construction
|
|
(`configurations.nixos`), overlays, packages, apps, dev shell, dev shells
|
|
(`shells.<name>` → `devShells`), formatter, checks.
|
|
- `modules/users/`: `meta.owner`, the user identity every aspect reads.
|
|
- `modules/core/`: the `core` aspect every host imports (nix, nixpkgs, boot,
|
|
locale, networking, users, home-manager, facts for install-system; agenix
|
|
joins it from `modules/security/secrets.nix`).
|
|
- `modules/<area>/`: aspects (`boot`, `hardware`, `security`, `network`, `dev`,
|
|
`desktop`, `theme`, `cli`, `ai`, `gaming`); one file can define the NixOS and
|
|
the home-manager half of a feature. The exception is `modules/dev/shells/`:
|
|
plain `perSystem.shells.<name>` definitions, not aspects (mechanism in
|
|
`modules/flake/shells.nix`).
|
|
- `modules/hosts/<name>/`: a host: aspect lists and host-only values
|
|
(`modules/hosts/desktop/host.nix`, plus `hardware.nix` and `disks.nix`).
|
|
- `modules/installer/`: the installer ISO.
|
|
- `hosts/<name>/`: files install-system writes (`hardware-configuration.nix`,
|
|
`disk-ids.json`); not modules.
|
|
- `pkgs/`: install, key and secret helpers (`nix run .#<app>`; the apps are
|
|
declared in `modules/flake/apps.nix`) and `dev`, the dev shell helper
|
|
(`pkgs/dev-shell`).
|
|
- `patches/`: patches to flake inputs, applied with `applyPatches`
|
|
(`patches/proxy-suite/`, used by `modules/network/proxy-suite.nix`); drop one
|
|
when upstream has the fix.
|
|
- `secrets/`: `secrets.nix` (recipients) and encrypted `*.age` files, all
|
|
optional (login password, SSH keys, `secrets/gitea-runner-token.age`,
|
|
`secrets/tg-ws-proxy-secret.age`, `secrets/amneziawg-ai.age`). Never commit
|
|
plaintext or `keys/`. A plaintext copy such as the gitignored `/WG.conf` must
|
|
not stay in the repository: refer to the flake as `.#...`, never with `path:`
|
|
or `builtins.getFlake`, which would copy it into the Nix store.
|
|
|
|
Conventions: format with `nix fmt` (nixfmt). New behaviour is a new aspect,
|
|
not an `enable` option: importing an aspect enables it. Shared values come from
|
|
`config.meta`, bound in a `let` before any NixOS/home-manager module;
|
|
home-manager halves read the system through `osConfig`. Theming goes through
|
|
`modules/theme/stylix.nix`: Stylix themes every program it supports, and a
|
|
target is switched off there by name. Keep host files small.
|
|
Checks: `nix eval .#nixosConfigurations.desktop.config.system.build.toplevel.drvPath`
|
|
first, then `nix flake check --no-build`. The check is read-only and fails with
|
|
`…-proxy-suite-flake-patched.drv is not valid` when the store lacks the patched
|
|
proxy-suite tree (fresh clone or machine, `nix flake update` of nixpkgs or
|
|
proxy-suite, an edited patch, a garbage collection); the eval builds it, so rerun.
|
|
Evaluating the host fetches the private `nvim` input over SSH (with the key of
|
|
the user running nix) unless it is already in the store.
|
|
|
|
## 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 / xhigh | 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.
|