No description
Find a file
2026-11-11 02:39:44 +00:00
.claude Update the methodology to 5e0362d9b2e8d33600a82d46b83062d57e0a9f0b 2026-11-11 02:39:44 +00:00
backup Architecture and disaster-recovery doc (#11) 2026-11-05 12:51:35 +00:00
docs docs/README: the guides come through the .methodology link, not a submodule 2026-11-06 09:27:51 +00:00
nixos repo-layout: lay the repo out by machine (2/2) (#6) 2026-11-05 10:26:54 +00:00
vps rclone: link the unit from the clone instead of copying it 2026-11-05 12:46:30 +00:00
.gitignore Migrate the methodology off the submodule (2693046e218247897d4f9030830033c5ce9b9dc3) 2026-11-06 09:24:14 +00:00
AGENTS.md Update the methodology to c6a7dc101998165038119ae8eb7c84fdd50c27de 2026-11-09 10:44:12 +00:00
BACKLOG.md Architecture and disaster-recovery doc (#11) 2026-11-05 12:51:35 +00:00
README.md Adopt agent-methodology (#1) 2026-10-28 22:33:57 +00:00
RETIRED.md retirer: retire a stack in one command (#10) 2026-11-05 12:25:57 +00:00
retirer retirer: retire a stack in one command (#10) 2026-11-05 12:25:57 +00:00

selfhosted — Developer Reference

This file is AGENTS.md, not CLAUDE.md: Codex reads AGENTS.md natively, and Claude Code reads it when no CLAUDE.md exists. README.md is a symlink to it: this is the single entry point for people and agents.

This file is the entry point, not the whole manual. It holds only what every session needs: the working conventions, current work, the shape of the workflow and how to run things. Everything else lives in the files below; read one only when your task matches its Read when column. AGENTS.md and these files are one instruction set: each rule lives in exactly one of them, so update the file that owns it, never a copy.

Read on demand

File Read when
.methodology/shared/guides/sessions-and-context.md the context-budget hook fires, you start a session from a handoff, you start an investigation or audit, or you hand work to a subagent: the budget, the start routine, mid-unit handoffs, investigation scope
.methodology/shared/guides/unattended-sessions.md you start, watch or end an unattended session, attach to one, or act on an inbox item
.methodology/shared/guides/development-workflow.md you start a change, spike or spec, or claim, open, review, advance or merge any PR: modes, stages, handoffs, deferred items, claiming, local or CI review, merge and cleanup, slicing, agent automation
.methodology/shared/guides/forge-forgejo.md you run a step on the forge (claim, ready, comment, label, merge, issues) or check what must pass before a merge: the command for each
.methodology/shared/guides/spec-and-plan-layout.md you write, extend or split a spec or plan, add a clarification, hand a slice to a subagent, or work from a spec or plan that is a directory
.methodology/shared/guides/tooling-gotchas.md a command or tool fails (gh, fj, git, Claude Code, the runners, agent-action's CI reviewers): known failures in every repo, and the command that works; then this machine's notes, the .methodology/machines/<kind>.md the session-start hook names (methodology: machine <kind>, …), and this repo's own for it, docs/knowledge/machines/<kind>.md, when it has one
docs/README.md you look for a spec, plan, investigation or reference: the index of everything under docs/
docs/knowledge/README.md you start non-trivial work in an area, or a command or tool fails: as-you-go gotchas and workarounds (see Project knowledge)
BACKLOG.md you start a unit, triage, or look for known unscheduled problems
File Read when
docs/guides/network-and-caddy.md you touch vps/caddy/, nixos/caddy/, vps/headscale/, a stack's compose file or a DNS record, or test a service in this microVM: the tailnet, headscale's DNS, which caddy runs where, the test recipe
docs/guides/architecture-and-recovery.md you touch backups, rclone, the StorageBox or backup/, or a disk, key or machine is lost: the machines, disks, remotes, where each key lives, the /mnt/data restore
nixos/plane/README.md, nixos/ente/README.md you work on Plane or Ente

Keep each session small

Context is the scarce resource: every request re-reads the whole conversation, and quality drops as it grows. So a session does one bounded piece of work and hands off:

  • Budget: AGENT_CONTEXT_BUDGET tokens of context per session (150k in .claude/settings.json). Past it, the context-budget hook tells you so; the status line (.methodology/shared/claude/statusline.sh) shows it all along. Finish the current step, write the handoff (a new file in the plan's handoffs/, made by methodology handoff new <dir> <slug>, a knowledge note or the investigation's output), commit, and end the session, even in the middle of a unit. The next session starts fresh from the handoff; with AGENT_AUTO_CONTINUE=true, start it yourself with methodology next <handoff path> (it launches the next session on agent-deck), then stop. A new parallel session (a fresh unit's worktree) starts only with methodology next --new "<prompt>", never a bare claude/claudeN: only a session methodology next starts is on agent-deck, where methodology status and the supervisor see it and methodology next --resume brings it back.
  • A fresh session starts the same way every time: read the handoff (only the newest: methodology handoff newest <plan>/handoffs when the unit has a plan, else methodology handoff newest docs/handoffs, if there is one), git status, git log --oneline -5, methodology worktree --prune (ended units' worktrees, a merged or closed PR's too, never under a live session; on Forgejo with the merges it left open closed first, and the main checkout up to its upstream), BACKLOG.md's Next (due on any track, or waiting on the user), then work. A user saying continue (continue with the handoff) means this routine, in this session: methodology next runs only at the budget, and methodology next --unit only at a unit's end.
  • Other sessions are the supervisor's, not yours. Don't watch or poll other sessions with methodology status (one check that a session you just started came up is fine), and rescue one only when the user asks or the supervisor can't reach it: the supervisor's timer (supervise.sh) reports unattended ones to the inbox, and a person acts on them and on their own. A handoff never asks the next session to watch one (sessions-and-context.md, Other sessions are not a session's work).
  • Investigations and audits are scoped. Each one answers a written question into a file. Wide reading goes to subagents, which return short summaries; a repo-wide audit is a fan-out of scoped subagent tasks plus one synthesis session.

Details and the reasons: .methodology/shared/guides/sessions-and-context.md.

Write for progressive disclosure

The same rule applies to what you write. An agent should be able to read a short index and then open only the part its task needs. Keep this file short: a rule that only some tasks need goes into the file for those tasks, with a row in Read on demand if it starts a new guide. Don't load a whole spec, plan or docs/ directory "for context": read its index or the section your unit names.

  • Parts hold the current design; history lives apart. A change rewrites the spec section or plan task it amends; the reason goes in the spec's clarifications with a status (folded or superseded by …), and progress and provenance go in the plan's slices table and handoffs. Never two live texts for one decision.
  • A change updates every doc it makes stale, in the same commit. When you remove, rename or reverse something (a path, section, command, flag, label, rule or behaviour), grep the repo for it and rewrite each current-design text that still says the old thing: AGENTS.md, guides, knowledge notes, BACKLOG.md, spec sections, open plan tasks. History (handoffs, clarifications, investigations, evidence, merged slices) stays as written. A doc the diff left stale is a review finding.
  • Large specs and plans are directories: a README.md index plus one file per section or slice, past ~400 lines for a spec and always for a plan with more than one slice.
  • Whatever grows by appending is built to grow: a one-line-per-item index, detail apart, a pruning rule.

History apart, large documents, growth, the clarification template and the layout: .methodology/shared/guides/spec-and-plan-layout.md.

Working Conventions

  • Commit after each edit. After completing an edit to the codebase (one coherent change, not each file write), make a git commit scoped to that change, with a clear, descriptive message.
  • Sign-off: kept. Sign off every commit (DCO): always commit with git commit -s, with a Signed-off-by: line matching the commit author; the forge sheet's Before a merge says what checks it. This goes alongside, not instead of, the Co-Authored-By: trailer Attribution names. To fix a branch that's missing sign-offs: git rebase <base> --signoff, then git push --force-with-lease.
  • Attribution: an agent's commit and forge text name its tool. End the commit message with one Co-Authored-By: trailer unless the harness already appends one (Claude Code does; Codex does when its git attribution feature is on): an opencode session adds Co-Authored-By: opencode <noreply@opencode.ai>, a codex session that added none itself Co-authored-by: Codex <noreply@openai.com>. Alongside, not instead of, any sign-off. A PR body, PR comment, review or reply the agent posts ends with one line naming its tool, after any Checks: line: the footer the harness gives for PR bodies (Claude Code: 🤖 Generated with [Claude Code](https://claude.com/claude-code)), on comments too, and once, not again where the harness already added it; with none, 🤖 Generated with Codex or 🤖 Generated with opencode. The agent posts as the user, and without it the comment reads as theirs. A script's own report (the supervisor's) is not the agent's, and carries none.
  • Spawn subagents freely. Agents working in this repo have standing permission to spawn subagents without asking. This overrides any harness default to spawn only on request. Follow the superpowers skills' recommended path:
    • Implement a plan's slice with superpowers:subagent-driven-development: a fresh implementer subagent per task, the per-task reviews, and a whole-branch final review on the most capable model before the PR opens.
    • Use read-only search agents (Explore, general-purpose) for broad searches and for scanning docs/knowledge/, so the reading stays out of your context.
    • Use superpowers:dispatching-parallel-agents for independent investigations.
  • Don't stop for approval inside the workflow. The loop runs unattended: no in-chat check-ins between tasks, slices or review rounds. The one approval a full-mode track waits for is its spec, the stage the user attends: they write it with the agent and approve it (its PR's approved label, or methodology gate approve at their word in the session). Past the hard size limit the agent adds large-slice itself, with its why-one-unit (development-workflow.md, Slicing implementation). Otherwise stop only at a gate the approved spec names, a clarification that changes the spec's intent, the floor (a step reverting the repo can't undo: spending money, heavy resource requests (those Setup lists among them), destroying VMs, infrastructure or data, publishing or sending, force-pushing or rewriting main, secrets and credentials) or a next-session.sh refusal. That list is closed (development-workflow.md, Gates, says what is not a gate), even where a plan or handoff says to ask: decide the rest and record the ruling. Never wait by asking in chat: a gate waits on its PR as development-workflow.md's Gates says: one comment, the waiting-on-user label, and a watcher that wakes the session when the user answers.
  • Never edit .methodology/. It is a link to the machine's read-only install of agent-methodology. Edits there are refused (the files are read-only) and would reach every repo on the machine. Deviate from a shared rule in Overrides; carry an improvement to agent-methodology as its own change, then methodology update (agent-methodology's UPDATING.md).
  • Never commit secrets: .env files, data/, nixos/plane/backup/ and each caddy's state stay gitignored (the top-level backup/ is tracked scripts); check what's staged before committing.
  • Commit messages say why, not just what: this repo's history is the record of how the self-hosted setup got to its current state.

Overrides

Where this repo deviates from a shared guide, one line each: "In this repo, X instead of <guide>, Section, because Z." This file wins over the guides in .methodology/shared/guides/.

None.

Current work

One line per active track: where it stands, the next unit, and where its handoff is. This section only points to things. Who is working on what is shown by the open PRs, not here (Claiming a unit in the workflow guide). Each unit's PR updates its track's line; the last slice removes it.

  • Ente over https (docs/superpowers/specs/2026-10-28-ente-https-design.md): spec approved by the user (2026-10-28), committed to main before the adoption. Next: the plan plan/ente-https, written against nixos/ente/ and nixos/caddy/; it starts once the user reports both machines moved to the machine layout (docs/guides/moving-to-the-machine-layout.md); handoff docs/handoffs/ (newest).
  • Not scheduled: BACKLOG.md holds every deferred item without a slice; its Next, the ones due soon or waiting on the user.

Project in brief

Docker compose stacks and Caddy configs for the user's self-hosted services, on a headscale tailnet, laid out by machine: the tree is the source of truth for what runs where. vps/ and nixos/ each hold one directory per stack that machine runs, the machine's caddy (<machine>/caddy/) and its host-level units; list a machine's directory to see what runs on it. A stack that moves to another machine moves with git mv, in the same commit as its Caddy block and DNS record; a stack that stops running is deleted and gets a row in RETIRED.md, both by ./retirer <stack>, which also says what the user runs on the machine. backup/ holds the stale backup scripts. Details: docs/guides/network-and-caddy.md.

Where you are running. If you are reading this, you are inside agentvm-repos (192.168.122.51 on virbr0), a microVM on a physical NixOS host, defined in the separate nixed repo (microvms/projects.nix, project repos). /workspace is a virtiofs mount of the host's ~/repos; this checkout is one directory in it. Confirm with ip addr / hostname if in doubt. The microVM has no tailscale client: tailnet nodes reach it through the host's approved subnet route for 192.168.122.0/24, so a container here bound to 0.0.0.0 is at 192.168.122.51:<port> for any node with --accept-routes.

Machine Caddy Tailnet address Deployed by
The VPS (public IP; also headscale) vps/caddy/ 100.64.0.2 the user
The physical NixOS host (rootless podman) nixos/caddy/; nixos/ is the default for new stacks 100.64.0.5 the user
This microVM (docker) none: it hosts no stacks (RETIRED.md) 192.168.122.51 —

The traps every session needs:

  • Agents don't deploy to the host or the VPS. Nothing here can run nixos-rebuild (only the user, from nixed, on the host), and editing vps/headscale/config/ (config.yaml, acl.hujson) does nothing until the user redeploys headscale on the VPS. Agents edit and test here; the user deploys.
  • Never run vps/caddy/ here, or compose up nixos/caddy/docker-compose.yaml: the first needs the VPS's public 80/443, the second's ./data is the host caddy's live state. Test with a temporary caddy instead (docs/guides/network-and-caddy.md, Caddy conventions, "Testing a nixos service").
  • Bring down only what you started. ethaae's containers run here long-term, and another session may be testing its own stack (the same bullet of the guide).
  • backup/setup.sh (backup/restore) and backup/sync.sh (the laptop's rclone sync) are stale (backup/README.md), due for a rewrite: don't treat them as current operational guidance or extend them without flagging that first.

Development workflow

Pick the lightest mode that fits, and move up when the work turns out bigger:

  • Direct: you can describe the diff in one sentence (typo, one-line doc fix, config tweak). Commit to main.
  • Change: a few files, clear approach, no contract others rely on. One PR change/<slug>, plan in its body.
  • Spike: you don't yet know what works. A written question and budget in docs/investigations/<topic>.md, throwaway code on spike/<topic> (never merged); the output is the finding and a recommendation.
  • Full: more than one slice, a contract or schema change, or costly rework. Three sequential stages, each its own branch cut from origin/main and its own PR:
    1. Spec: spec/<topic>, written by the brainstorming skill into docs/superpowers/specs/. Every decision names its acceptance check. The user approves it (the approved label; in a session they are in, the agent adds it with methodology gate approve, quoting them).
    2. Plan: plan/<topic>, written by the writing-plans skill into docs/superpowers/plans/, with its ## PR slices.
    3. Implementation: one small PR per slice, impl/<topic>-<n>-<slug>, titled … (n/N).

The rules that bite most often:

  • Look for what exists before you build it: before a spec or change that adds logic someone maintains, search open, on more than one harness, with the needs in the user's terms, and ask the reverse (take the best tool whole: what breaks, what layer is left); a close one gets a trial first. Agent-methodology built ~4,000 lines of session tooling before searching, months after tools that do much of it existed (development-workflow.md, Choosing a mode).
  • Claim before you work: the unit's branch pushed to origin plus a draft PR, worked on in its own worktree, .claude/worktrees/<branch, / as -> of the main checkout (methodology worktree <branch> makes it and claims it; git worktree list shows them all). One PR open at a time per track, and dependent work waits until that PR has merged.
  • One review round, by the reviewer in Reviewers: local reviewer subagents, or a CI reviewer and, if it's out, the fallbacks there, in order; a mechanical PR (a pointer, copied or regenerated files) has none. Address every finding, then merge it yourself (Merge) once every check the forge sheet lists under Before a merge passes (and, for a spec, once the user has added approved). Clean up the worktree and branch afterwards.
  • Hand off, then chain: every unit ends with a handoff for the next one, riding in its own PR, and updates its track's line in Current work. Don't start the next unit in the same session: once the PR merged and cleanup is done, write a second, short handoff on main that names the unit's own handoff (now on main, and the next session reads only this one) and adds what only the merge settled (its commit, the review round); commit, push and start it with methodology next --unit <next unit's branch> <handoff> from the main checkout; the track's last unit ends with methodology next --end. Hand off earlier when the context budget says so. Told to stop ("stop here", "finish this, then stop", "pause"), finish the step, commit and push, write a handoff (methodology handoff new, where the budget's goes), commit and push it, then methodology next --end: never the handoff form, which chains on.
  • Deferred items land somewhere durable: rewritten into a planned slice's task text, a new slice, the next spec's Inputs for, or BACKLOG.md. A handoff, PR body or review reply only points.

Before you start a change, spike or spec, or claim, open, review or advance any PR, read .methodology/shared/guides/development-workflow.md.

Reviewers

Who runs each PR's review round (development-workflow.md, Review and merge):

  • local: reviewer subagents in the working session (Local review there); no CI reviewer.

Project knowledge

As you work, capture anything you learn that isn't already visible from the code or git log: a workaround, a constraint that isn't obvious from reading the file, why an approach was rejected, a gotcha that cost real time. Keep an index at docs/knowledge/README.md, one line per entry pointing to docs/knowledge/<topic>.md (not the docs/knowledge/machines/<kind>.md files below, which the hook names). Skim the index before non-trivial work in an area; open a linked file only when it's relevant. Write notes alongside the change they relate to; no separate PR is needed. Don't record what the code or history already shows.

  • When something fails, look before you debug: grep docs/knowledge/, .methodology/shared/guides/tooling-gotchas.md and the machine's notes (the files the session-start hook names: .methodology/machines/<kind>.md, and this repo's docs/knowledge/machines/<kind>.md when it has one) for the command, tool or error text; under docs/knowledge/machines/, only this machine's file applies. The next session should go straight to the fix someone already found. A failed Bash command does part of it for you: the failed-command hook adds the notes and guide sections that share the error's wording (index lines and note bodies) to your context. Read what it adds before you debug; when it adds nothing, grep all the same.
  • When you find a workaround, write it down before moving on. If a command, tool or approach failed and took more than one retry to get past, record the symptom (the exact error), the fix, and the command that works. Put the command and the exact error text in the index line and the note, so a grep and the hook find it. A gotcha in a tool every repo uses, rather than in this project, belongs in tooling-gotchas.md; one only this kind of machine has, in its machines/<kind>.md: carry it to agent-methodology (Never edit .methodology/), and keep a note here until the machine's next methodology update brings it in. One only this repo has, and only on one kind of machine (a service that needs a workaround there), goes in docs/knowledge/machines/<kind>.md (<kind> is the AGENT_MACHINE the hook names), not in AGENTS.md, which every machine reads.
  • Lessons in a handoff become notes. A gotcha written only into a handoff or a PR body gets lost; write the note and link it from the handoff.

Setup

Nothing to install. The check command validates each machine's Caddyfile, and checks that every reverse_proxy upstream in <machine>/caddy/config/Caddyfile is a service or container_name defined under the same <machine>/, or is listed in <machine>/caddy/external-upstreams (one name per line); it reads only single-upstream reverse_proxy http://<name>:<port> lines, the form every line uses today. It prints what fails and exits non-zero. docker compose config needs each stack's secrets, so it isn't part of it; test a stack as docs/guides/network-and-caddy.md says.

rc=0
for m in vps nixos; do
  docker run --rm -v "$PWD/$m/caddy/config:/config:ro" docker.io/library/caddy:2.10.2 \
    caddy validate --adapter caddyfile --config /config/Caddyfile >/dev/null 2>&1 || { echo "invalid: $m/caddy"; rc=1; }
  c=$m/caddy/config/Caddyfile
  awk -v c="$c" '
    FILENAME ~ /external-upstreams$/ { if (NF) def[$1] = 1; next }
    FILENAME == c { if ($1 == "reverse_proxy" && sub(/^http:\/\//, "", $2)) { sub(/:.*/, "", $2); use[$2] = 1 }; next }
    /^[^ #]/ { svc = ($1 == "services:"); ind = -1; next }
    svc && /^ +[A-Za-z0-9._-]+:/ { i = match($0, /[^ ]/) - 1; if (ind < 0) ind = i; if (i == ind) { k = $1; sub(/:.*/, "", k); def[k] = 1 } }
    $1 == "container_name:" { v = $2; gsub(/["\047]/, "", v); def[v] = 1 }
    END { for (u in use) if (!(u in def)) { print "undefined upstream " u " in " c; bad = 1 }; exit bad }
  ' $(git ls-files -co --exclude-standard "$m/*/docker-compose.yaml" "$m/*/config/docker-compose.override.yml" \
      "$m/caddy/external-upstreams") "$c" || rc=1
done
[ "$rc" = 0 ]

After a merge: a change under vps/ or nixos/ waits for the user to deploy it; say so in the PR body and the handoff. No heavy resource requests.