|
|
||
|---|---|---|
| .claude | ||
| backup | ||
| docs | ||
| nixos | ||
| vps | ||
| .gitignore | ||
| AGENTS.md | ||
| BACKLOG.md | ||
| README.md | ||
| RETIRED.md | ||
| retirer | ||
selfhosted — Developer Reference
This file is
AGENTS.md, notCLAUDE.md: Codex readsAGENTS.mdnatively, and Claude Code reads it when noCLAUDE.mdexists.README.mdis 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_BUDGETtokens 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'shandoffs/, made bymethodology 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; withAGENT_AUTO_CONTINUE=true, start it yourself withmethodology next <handoff path>(it launches the next session on agent-deck), then stop. A new parallel session (a fresh unit's worktree) starts only withmethodology next --new "<prompt>", never a bareclaude/claudeN: only a sessionmethodology nextstarts is on agent-deck, wheremethodology statusand the supervisor see it andmethodology next --resumebrings it back. - A fresh session starts the same way every time: read the handoff (only the newest:
methodology handoff newest <plan>/handoffswhen the unit has a plan, elsemethodology 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 nextruns only at the budget, andmethodology next --unitonly 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 (
foldedorsuperseded 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.mdindex 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 aSigned-off-by:line matching the commit author; the forge sheet's Before a merge says what checks it. This goes alongside, not instead of, theCo-Authored-By:trailer Attribution names. To fix a branch that's missing sign-offs:git rebase <base> --signoff, thengit 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 addsCo-Authored-By: opencode <noreply@opencode.ai>, a codex session that added none itselfCo-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 anyChecks: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 Codexor🤖 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 scanningdocs/knowledge/, so the reading stays out of your context. - Use
superpowers:dispatching-parallel-agentsfor independent investigations.
- Implement a plan's slice with
- 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
approvedlabel, ormethodology gate approveat their word in the session). Past the hard size limit the agent addslarge-sliceitself, 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 rewritingmain, secrets and credentials) or anext-session.shrefusal. 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 asdevelopment-workflow.md's Gates says: one comment, thewaiting-on-userlabel, 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, thenmethodology update(agent-methodology'sUPDATING.md).
- Never commit secrets:
.envfiles,data/,nixos/plane/backup/and each caddy's state stay gitignored (the top-levelbackup/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 tomainbefore the adoption. Next: the planplan/ente-https, written againstnixos/ente/andnixos/caddy/; it starts once the user reports both machines moved to the machine layout (docs/guides/moving-to-the-machine-layout.md); handoffdocs/handoffs/(newest). - Not scheduled:
BACKLOG.mdholds 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, fromnixed, on the host), and editingvps/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, orcompose upnixos/caddy/docker-compose.yaml: the first needs the VPS's public 80/443, the second's./datais 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) andbackup/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 onspike/<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/mainand its own PR:- Spec:
spec/<topic>, written by thebrainstormingskill intodocs/superpowers/specs/. Every decision names its acceptance check. The user approves it (theapprovedlabel; in a session they are in, the agent adds it withmethodology gate approve, quoting them). - Plan:
plan/<topic>, written by thewriting-plansskill intodocs/superpowers/plans/, with its## PR slices. - Implementation: one small PR per slice,
impl/<topic>-<n>-<slug>, titled… (n/N).
- Spec:
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
originplus 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 listshows 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
mainthat names the unit's own handoff (now onmain, 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 withmethodology next --unit <next unit's branch> <handoff>from the main checkout; the track's last unit ends withmethodology 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, thenmethodology 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.mdand the machine's notes (the files the session-start hook names:.methodology/machines/<kind>.md, and this repo'sdocs/knowledge/machines/<kind>.mdwhen it has one) for the command, tool or error text; underdocs/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 itsmachines/<kind>.md: carry it to agent-methodology (Never edit.methodology/), and keep a note here until the machine's nextmethodology updatebrings it in. One only this repo has, and only on one kind of machine (a service that needs a workaround there), goes indocs/knowledge/machines/<kind>.md(<kind>is theAGENT_MACHINEthe hook names), not inAGENTS.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.