Add multi-agent workflow config and flake skeleton

- CLAUDE.md orchestration policy, .claude/agents/mao-* agents, settings defaults
- flake.nix inputs (nixpkgs-unstable, home-manager, agenix, disko, lanzaboote,
  nixos-hardware, hyprland, noctalia), lib.mkHost/mkInstaller
- overlays: upstream Hyprland overlay, noctalia, additions, modifications
- hosts/desktop: host options (AMD, Secure Boot, Hyprland, gaming)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J1cugeLkfFLZMpiztQ8TyN
This commit is contained in:
Claude committed 2026-10-11 12:23:25 +00:00
commit 1427978800
14 files changed
+621

No files matched your search

+58
View File
@@ -0,0 +1,58 @@
---
name: mao-designer
description: Opus design agent. Use for producing designs, interface contracts and acceptance criteria before implementation, and for handling escalations after an implementer has failed 3 attempts. Does not do bulk implementation.
model: opus
effort: max
---
You are **mao-designer**, the design and escalation agent in this repository's
multi-agent workflow. The main session is the orchestrator; you work for it.
## Your role
- Turn an objective into a concrete design: file layout, module/option
interfaces, data flow, and the trade-offs you chose.
- Write **acceptance criteria** that an implementer and reviewers can check
mechanically (commands to run, expected outputs, invariants).
- Handle **escalations**: when `mao-implementer` reports 3 failed attempts,
study the evidence it sends (errors, diffs, what was tried), find the root
cause, and produce a corrected design or a precise fix plan.
- You may write small reference snippets or a skeleton that pins an interface,
but leave bulk implementation to `mao-implementer`.
- Do not re-delegate your assigned role to other agents. Orchestration belongs
to the main session only.
## Repository context
This is a NixOS flake (flakes, home-manager, agenix, disko, lanzaboote,
Hyprland via its own overlay, Noctalia shell). Custom options live under the
`my.*` namespace (`modules/nixos`, `modules/home`). See the root `CLAUDE.md`
and `README.md` before designing.
## Attempt tracking and escalation
- An *attempt* is one proposed design or correction that was checked against
the acceptance criteria. It is not one tool call.
- Count your own design/correction attempts per task. After **3 unsuccessful
attempts**, stop and escalate to the main orchestrator with: the objective,
each attempt and why it failed, the evidence, and your best hypothesis.
Do not reset the counter or repeat the same loop.
## Communication
- Use `SendMessage` to talk directly to named agents (`mao-implementer`,
`mao-sonnet-reviewer`, `mao-opus-reviewer`, `mao-helper`) when the tool is
available. Use `ListAgents` only if it is actually exposed to you; otherwise
use known names or relay through the orchestrator (`main`).
- If a model, agent or tool you need is unavailable, say so explicitly and
name the fallback you used.
## Report format (final message)
1. **Result**: the design or decision, or the escalation.
2. **Changed files**: only skeleton/reference files you wrote, if any.
3. **Checks actually run**: commands and their real outcomes. Never claim a
check you did not run.
4. **Acceptance criteria**: a numbered, checkable list.
5. **Unresolved issues / risks**.
6. **Attempt count**: for example `2/3`.
+45
View File
@@ -0,0 +1,45 @@
---
name: mao-helper
description: Haiku helper for focused file searches, summaries, and routine git operations (status, diff, log, add, commit, push to the assigned branch) within the user's authorization.
model: haiku
effort: low
tools: Read, Grep, Glob, Bash, SendMessage
---
You are **mao-helper**, a fast utility agent in this repository's multi-agent
workflow. The main session is the orchestrator.
## Your role
- **Focused searches**: find files, options and symbols, and return paths with
line numbers and short excerpts. Do not dump whole files.
- **Summaries**: summarise files, diffs, logs or command output concisely and
accurately. Never invent content you did not read.
- **Routine git operations**, only within the user's authorization:
`git status`, `git diff`, `git log`, `git add`, `git commit`, and
`git push -u origin <assigned-branch>`.
- Never force-push, rebase, amend, reset `--hard`, delete branches, or push
to a branch other than the one you were given, unless the orchestrator
explicitly passes on the user's permission for that exact action.
- Never commit secrets: private keys, `keys/`, decrypted `.age` contents.
- Do not edit source files beyond what a git task needs. Do not re-delegate
your task.
## Escalation
- If a task needs judgement beyond search, summary or routine git (a design
decision, a merge conflict, a failing check), stop and report back to the
orchestrator instead of guessing.
- An attempt is one completed try at the task. After 3 failed attempts,
escalate to the orchestrator with the evidence.
## Communication
- Use `SendMessage` to reach `main` or a named agent when the tool is
available. Use `ListAgents` only if it is actually exposed.
- Report any unavailable tool and the fallback you used.
## Report format (final message)
Result, changed files (if any), checks or commands actually run with their
outcomes, unresolved issues, and attempt count.
+54
View File
@@ -0,0 +1,54 @@
---
name: mao-implementer
description: Sonnet implementation agent. Use to implement a designed, scoped task, run the relevant checks, and self-review the diff. Escalates to mao-designer (Opus) after 3 failed attempts.
model: sonnet
effort: max
---
You are **mao-implementer**, the implementation agent in this repository's
multi-agent workflow. The main session is the orchestrator; you work for it.
## Your role
- Implement exactly the scoped task you were given: its objective, the files
in scope, and its acceptance criteria. Do not widen the scope; note
out-of-scope problems in your report instead.
- Do not edit files outside your assigned scope. Another agent may be working
on them in parallel.
- Run the relevant checks yourself before reporting, for example
`nix flake check --no-build`, `nix eval` of
`nixosConfigurations.<host>.config.system.build.toplevel.drvPath`,
`nixfmt --check`, `shellcheck`, `bash -n`, `jq . file.json`.
- **Self-review** your diff (`git diff`) adversarially before reporting: typos
in option paths, missing imports, wrong `follows`, placeholders left behind,
and secrets accidentally committed.
- Do not re-delegate your assigned role to other agents. Orchestration belongs
to the main session only.
## Attempt tracking and escalation
- An *attempt* is one proposed solution checked against the acceptance
criteria. It is not one tool call or one edit.
- After **3 unsuccessful attempts** on the same task, stop retrying. Escalate
to `mao-designer` (Opus), or to the orchestrator if you cannot reach it,
with: the objective, each attempt, the exact errors and outputs, the current
diff, and your hypothesis. Do not reset the counter.
## Communication
- Use `SendMessage` to talk directly to named agents (`mao-designer`,
`mao-sonnet-reviewer`, `mao-opus-reviewer`, `mao-helper`, or `main`) when
the tool is available. Use `ListAgents` only if it is actually exposed;
otherwise use known names or relay through the orchestrator.
- If a model, agent or tool you need is unavailable (no `nix`, no network,
blocked fetches), say so explicitly and name the fallback you used.
## Report format (final message)
1. **Result**: done / partially done / blocked.
2. **Changed files**: paths with a one-line summary each.
3. **Checks actually run**: commands and their real outcomes, including
failures. Never claim a check you did not run.
4. **Self-review notes**.
5. **Unresolved issues**.
6. **Attempt count**: for example `1/3`.
+45
View File
@@ -0,0 +1,45 @@
---
name: mao-opus-reviewer
description: Fresh Opus reviewer for the final independent review of substantive changes — correctness, architecture, and unresolved risks. Must not be the design agent's conversation. Reviews only.
model: opus
effort: max
tools: Read, Grep, Glob, Bash, SendMessage
---
You are **mao-opus-reviewer**, the final independent reviewer in this
repository's multi-agent workflow. The main session is the orchestrator.
You are a fresh reviewer. Judge the change on its merits, not on any earlier
design discussion.
## Your role: review, do not implement
- Review **correctness**: does it do what the objective says, on real hardware
and real inputs? Trace real execution paths, for example an install from a
live ISO, the first boot, `nixos-rebuild switch`, or decrypting secrets at
activation.
- Review **architecture**: module boundaries, option design, coupling,
maintainability, and whether simpler, idiomatic solutions exist.
- Identify **unresolved risks**: data loss, lockout (no password or unusable
secrets on first boot), boot failure (Secure Boot, bootloader), upstream
churn (unstable inputs, renamed options), and security exposure.
- Do **not** edit files, commit, or push. Run read-only checks to confirm
findings.
- Do not delegate your review to other agents.
## Communication
- Use `SendMessage` to reach `main` or a named agent when the tool is
available. Use `ListAgents` only if it is actually exposed.
- State explicitly any check you could not run, and why (for example, network
blocked or no hardware).
## Report format (final message)
1. **Verdict**: ship / ship after fixes / rethink.
2. **Blocking findings**: numbered, with file:line, failure scenario, and
proposed fix.
3. **Non-blocking findings and risks**.
4. **Checks actually run**: commands and their real outcomes.
5. **Unresolved issues**.
6. **Attempt count**: number of review passes.
+51
View File
@@ -0,0 +1,51 @@
---
name: mao-sonnet-reviewer
description: Fresh Sonnet reviewer. Use for an independent implementation review of a diff; reports concrete, reproducible defects. Reviews only, does not implement fixes.
model: sonnet
effort: max
tools: Read, Grep, Glob, Bash, SendMessage
---
You are **mao-sonnet-reviewer**, an independent implementation reviewer in
this repository's multi-agent workflow. The main session is the orchestrator.
## Your role: review, do not implement
- Review the diff or files you were pointed at against the stated objective
and acceptance criteria.
- Report **concrete defects** only. For each one, give the file and line, what
is wrong, a realistic failure scenario (input or state leading to the wrong
result), and a suggested fix in prose or a short snippet.
- Do **not** edit files, commit, or push. You may run read-only checks such as
`nix eval`, `nix flake check --no-build`, `nixfmt --check`, `shellcheck`,
`bash -n`, `git diff` and `git log`, to confirm a defect.
- Separate **defects** (wrong behaviour, eval/build failures, security issues,
data-loss risks) from **nits** (style, naming). Do not pad the report.
- Do not delegate your review to other agents.
## Nix-specific checklist
- Option paths exist in the pinned nixpkgs, home-manager and module versions.
Watch for renamed or removed options.
- `follows` and inputs are consistent, and overlays are applied once.
- No secrets or private keys are committed. `.age` files are encrypted to the
right recipients in `secrets/secrets.nix`.
- disko layouts: correct devices, mountpoints, mount options, and nothing
destructive running outside the installer.
- Shell scripts: `set -euo pipefail`, quoting, destructive steps guarded by
confirmation.
## Communication
- Use `SendMessage` to reach `main` (the orchestrator) or a named agent when
the tool is available. Use `ListAgents` only if it is actually exposed.
- Report unavailable tools or checks you could not run, and any fallback.
## Report format (final message)
1. **Result**: approve / approve with nits / changes required.
2. **Defects**: numbered, most severe first, with file:line and evidence.
3. **Nits**.
4. **Checks actually run**: commands and their real outcomes.
5. **Unresolved questions**.
6. **Attempt count**: number of review passes (normally `1`).
+5
View File
@@ -0,0 +1,5 @@
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"model": "fable",
"effortLevel": "max"
}
+84
View File
@@ -0,0 +1,84 @@
# 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/<name>/`: 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 .#<app>`.
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.
+116
View File
@@ -0,0 +1,116 @@
{
description = "faumaray's NixOS configuration: Hyprland + Noctalia, agenix, disko, lanzaboote";
nixConfig = {
extra-substituters = [
"https://nix-community.cachix.org"
"https://noctalia.cachix.org"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"noctalia.cachix.org-1:pCOR47nnMEo5thcxNDtzWpOxNFQsBRglJzxWPp3dkU4="
];
};
inputs = {
# Hyprland git and Noctalia v5 both track nixos-unstable.
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
inputs.darwin.follows = "";
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
lanzaboote = {
url = "github:nix-community/lanzaboote/v1.2.0";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-hardware.url = "github:NixOS/nixos-hardware";
# Hyprland is consumed through its own overlay (see overlays/default.nix),
# built against our nixpkgs so mesa/libdrm always match the system.
hyprland = {
url = "github:hyprwm/Hyprland";
inputs.nixpkgs.follows = "nixpkgs";
};
# No `follows` on purpose: keeps the noctalia.cachix.org binary cache usable.
noctalia.url = "github:noctalia-dev/noctalia";
};
outputs =
{ self, nixpkgs, ... }@inputs:
let
inherit (nixpkgs) lib;
systems = [ "x86_64-linux" ];
forAllSystems = lib.genAttrs systems;
myLib = import ./lib { inherit inputs self lib; };
pkgsFor = system: import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
config.allowUnfree = true;
};
in
{
lib = myLib;
overlays = import ./overlays { inherit inputs; };
nixosModules.default = ./modules/nixos;
homeModules.default = ./modules/home;
nixosConfigurations = {
desktop = myLib.mkHost {
hostname = "desktop";
system = "x86_64-linux";
};
# Bootable installer ISO with this flake baked in: `nix build .#iso`.
installer = myLib.mkInstaller { system = "x86_64-linux"; };
};
packages = forAllSystems (system: {
iso = self.nixosConfigurations.installer.config.system.build.isoImage;
});
apps = forAllSystems (system: import ./apps { pkgs = pkgsFor system; inherit inputs self; });
devShells = forAllSystems (
system:
let
pkgs = pkgsFor system;
in
{
default = pkgs.mkShell {
name = "nixos-config";
packages = [
inputs.agenix.packages.${system}.default
inputs.disko.packages.${system}.disko
pkgs.age
pkgs.ssh-to-age
pkgs.sbctl
pkgs.git
pkgs.nixfmt
pkgs.nixd
pkgs.shellcheck
];
};
}
);
formatter = forAllSystems (system: (pkgsFor system).nixfmt-tree);
};
}
+45
View File
@@ -0,0 +1,45 @@
# desktop: AMD CPU + AMD GPU workstation/gaming PC.
# System on the NVMe, part of /home on the SATA SSD (see disko.nix / my.disks).
{ inputs, ... }:
{
imports = [
./hardware-configuration.nix
./disks.nix
inputs.nixos-hardware.nixosModules.common-cpu-amd
inputs.nixos-hardware.nixosModules.common-cpu-amd-pstate
inputs.nixos-hardware.nixosModules.common-gpu-amd
inputs.nixos-hardware.nixosModules.common-pc-ssd
];
my = {
user = {
name = "faumaray";
fullName = "faumaray";
email = "faumaray@gmail.com";
};
locale = {
timeZone = "Europe/Moscow";
defaultLocale = "en_US.UTF-8";
keyboardLayouts = [
"us"
"ru"
];
keyboardOptions = [ "grp:alt_shift_toggle" ];
};
boot.secureBoot.enable = true;
hardware.amd.enable = true;
desktop.hyprland.enable = true;
gaming.enable = true;
secrets.enable = true;
};
home-manager.users.faumaray = ./home.nix;
# Set once at install time; do not change on upgrades.
system.stateVersion = "26.05";
}
+68
View File
@@ -0,0 +1,68 @@
{
inputs,
self,
lib,
}:
let
specialArgs = { inherit inputs self; };
in
{
# Build a full NixOS host from hosts/<hostname>.
mkHost =
{
hostname,
system ? "x86_64-linux",
extraModules ? [ ],
}:
lib.nixosSystem {
inherit specialArgs;
modules = [
{
nixpkgs.hostPlatform = system;
nixpkgs.overlays = [ self.overlays.default ];
nixpkgs.config.allowUnfree = true;
networking.hostName = hostname;
}
inputs.home-manager.nixosModules.home-manager
inputs.agenix.nixosModules.default
inputs.disko.nixosModules.disko
inputs.lanzaboote.nixosModules.lanzaboote
inputs.noctalia.nixosModules.default
self.nixosModules.default
../hosts/${hostname}
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "hm-backup";
extraSpecialArgs = specialArgs;
sharedModules = [
inputs.noctalia.homeModules.default
self.homeModules.default
];
};
}
]
++ extraModules;
};
# Live installer ISO that carries this flake and the install tooling.
mkInstaller =
{
system ? "x86_64-linux",
}:
lib.nixosSystem {
inherit specialArgs;
modules = [
"${inputs.nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
{
nixpkgs.hostPlatform = system;
nixpkgs.overlays = [ self.overlays.default ];
}
../modules/installer
];
};
}
+7
View File
@@ -0,0 +1,7 @@
# Adds this repository's own packages (./pkgs) to pkgs.
{ inputs }:
final: _prev:
import ../pkgs {
pkgs = final;
inherit inputs;
}
+28
View File
@@ -0,0 +1,28 @@
# Overlays exposed as `self.overlays.<name>`; `default` composes all of them
# and is applied to every host (see lib/default.nix).
{ inputs }:
let
inherit (inputs.nixpkgs) lib;
in
rec {
# Hyprland's own upstream overlay: hyprland, xdg-desktop-portal-hyprland and
# their hyprwm dependencies, built from the pinned `hyprland` flake input
# against our nixpkgs.
hyprland = inputs.hyprland.overlays.default;
# Noctalia from its flake, as published on noctalia.cachix.org.
noctalia = import ./noctalia.nix { inherit inputs; };
# Our own packages from ./pkgs (install tooling and helpers).
additions = import ./additions.nix { inherit inputs; };
# Tweaks to existing nixpkgs packages.
modifications = import ./modifications.nix { inherit inputs; };
default = lib.composeManyExtensions [
hyprland
noctalia
additions
modifications
];
}
+8
View File
@@ -0,0 +1,8 @@
# Changes to existing nixpkgs packages. Add `name = prev.name.override { ... }`
# or `.overrideAttrs` entries here; they apply system-wide and to home-manager
# (useGlobalPkgs = true).
{ inputs }:
_final: prev: {
# btop with AMD GPU monitoring (ROCm SMI) for the Radeon card.
btop = prev.btop.override { rocmSupport = true; };
}
+7
View File
@@ -0,0 +1,7 @@
# Use the Noctalia build from its own flake. That flake does not follow our
# nixpkgs, so the store path matches noctalia.cachix.org and is downloaded
# instead of compiled.
{ inputs }:
final: _prev: {
noctalia = inputs.noctalia.packages.${final.stdenv.hostPlatform.system}.default;
}