The Problem

Every night, my lab takes a snapshot of every host’s configuration. It scans the snapshot for secrets and commits it to a git repo on my self-hosted Forgejo. If anyone asked whether my homelab is documented, I would say yes. It is all in git, with history.

That answer is technically true and practically useless.

I counted the files in the repo: about 645. Exactly 7 were Markdown. The rest were unit files, timer definitions, proxy configs, scripts and container configs. Picture a stranger who opens the repo, or me a year from now, at 2 a.m., with something down. They would see a directory listing and a wall of raw text. Nothing says what a file is for, what runs where, or what changed yesterday.

A pile of snapshots answers one question: “what was the exact content of this file on this date?” It does not answer “what do I have?”, “what runs on a schedule?” or “what changed this week?” Those are the questions I ask.

The Idea

I did not want to hand-write documentation. Hand-written docs drift the moment you change something. Then they are worse than nothing, because you trust them. The repo is already the source of truth, and it already updates itself. So the idea was to render the repo into a wiki, automatically, on every commit.

I picked Hold My Docs as the reader. It is an open-source, Git-backed Markdown wiki that ships as a single Go binary. That suits a lab where I would rather not run one more database and a queue. But my repo had only 7 Markdown files, so a Markdown wiki would have shown almost nothing. So I wrote the missing piece: a small generator in standard-library Python. It reads the repo and writes Markdown pages.

What Gets Generated

  • A lab overview landing page: what the fleet is and where to start.
  • A guest inventory, built from the Proxmox container and VM configs. It lists every guest, its resources and its purpose.
  • A reverse-proxy map: which hostname goes to which service.
  • A schedule page: every systemd timer and every cron job, in one table. This page finally showed me how much runs while I sleep.
  • A change log of the last 150 commits. It groups them, so a day reads like a story.
  • One page per host, and one page per captured file.
  • A file page starts with the file’s own header comment. Then it shows when the file last changed, then the code itself.
  • One page per tool I have written, plus the docs I already had.

Two rules keep this sane:

  1. Each run wipes and rewrites the generated sections. Nobody edits them by hand, so nothing in them can go stale without notice.
  2. The generator seeds a hand-written notes/ section once and never touches it again. My own explanations, decisions and warnings live there. The generator may not overwrite a human.

The file pages depend on one habit. At the top of every script and config, I put a comment that says what it is and why it exists. Before the wiki, that was a nice extra. Now it is the first thing I see when I open the page, so I write better headers.

How the Pipeline Works

I use two repos on purpose. The source repo holds only snapshots, exactly what the hosts looked like. The wiki repo holds only generated pages and notes. If the generator has a bug, the worst outcome is an ugly wiki. It can never corrupt the record.

A timer runs every minute and does this:

fetch source repo
if source HEAD unchanged AND generator unchanged:
    exit            # most runs end here, in milliseconds
regenerate pages into the wiki repo
commit as a bot user
push
fast-forward the wiki server's own checkout

A few details matter more than they look:

  • The “did anything change” check covers the generator too. If I improve a page layout, every page renders again. No host config has to change.
  • The bot has the narrowest access it can. It can read the source repo and write only to the wiki repo. It cannot touch the snapshots.
  • Login is SSO-only, with a single admin and no local passwords.
  • Only the LAN and my private mesh can reach the wiki. It sits behind the same SSO gate as everything else internal.
  • It wears the same Triforce theme as the rest of my lab. I call it the Sheikah Codex.

This is a minimal version of the same idea, if you want to copy it:

#!/usr/bin/env bash
# wiki-sync: render <source-repo> into <wiki-repo> when something changed
set -euo pipefail

git -C "$SRC" fetch --quiet origin
head="$(git -C "$SRC" rev-parse origin/main)"
gen="$(sha256sum "$GENERATOR" | cut -d' ' -f1)"
stamp="$head-$gen"

[ "$(cat "$STATE_FILE" 2>/dev/null)" = "$stamp" ] && exit 0

git -C "$SRC" merge --ff-only origin/main
python3 "$GENERATOR" --source "$SRC" --out "$WIKI"

git -C "$WIKI" add -A
git -C "$WIKI" diff --cached --quiet || {
  git -C "$WIKI" commit -m "wiki: regenerate from $head"
  git -C "$WIKI" push origin main
}
echo "$stamp" > "$STATE_FILE"

What Broke (and What It Taught Me)

The wiki never showed new commits on its own. I had set the wiki to bidirectional sync. People can then edit pages in the browser, and the wiki pushes those edits back. In that mode, it pulled from git only while a browser was open or just before a save.

My pipeline pushed commits, and nothing appeared until someone looked at the page. So I stopped waiting for it. After each push, my sync job fast-forwards the wiki server’s own checkout directly. The server rescans the disk every few seconds, so pages appear almost at once.

The inventory page exposed a hole in my backups. This one justified the whole project. I went to build the guest inventory from the Proxmox configs, and there was nothing to build it from.

The snapshot had never captured the guest configs. The config directory is a symlink. The archive step stored the link itself, not the files behind it. For as long as the snapshots existed, I had committed a pointer to a place that does not exist in the repo.

The fix was small: archive the contents of the directory, not the directory. With tar, that is the trailing /. trick:

# stores the symlink, not what it points to:
tar -C /etc -cf snap.tar <linked-dir>

# follows the link and stores the contents:
tar -C /etc -cf snap.tar <linked-dir>/.

The lesson is not about tar. Documentation that renders your backups will expose the holes in them. A render is the first time anything reads the data in a useful way. A backup that nobody reads is a hope. A backup that feeds a page you look at every week is a test.

At first, the wiki rejected my SSO login. The wiki reads identity claims (email, and whether it is verified) from the ID token only. By default, my identity provider puts those claims in the userinfo response. The login looked fine, and then the wiki refused it.

The fix was a per-client claims policy. It tells the provider to put those claims in the ID token for this one client. That is nothing exotic. But the error said “rejected” and nothing more, with no hint about which claim was missing.

“Farosh Explains”

Generated pages tell you what is there. They do not tell you why it’s shaped that way. And I was not going to write an essay for 645 files.

So my AI node, Farosh (a 6 GB GPU with a small local model), writes a plain-English explanation section. It writes one for every tool, every host file, every host, every change-log day and the fleet as a whole. I learned some rules the hard way:

  • Cache by a hash of the input. Farosh explains only new or changed items again. A page that has not changed costs nothing.
  • Label it honestly. Every explanation has a note that AI wrote it and that it can be wrong.
  • The page also flags an explanation that Farosh wrote for an older version of the file.
  • Constrain the prompt. Never guess which host something runs on. A small model will happily invent one.
  • Also no generic “watch out for…” filler. It made every page sound equally cautious, and so it meant nothing.

It is a reading aid, not an authority. The file header and the code are always right there, above and below it.

The Part Where I Cooked a GPU

The first batches ran nonstop. It worked, and the GPU sat at 86-88 degrees C at about 97% utilization. For a job whose deadline is “eventually,” that is silly.

I switched to a drip:

every 10 minutes:
    do at most 4 explanations
    pause 45 s between them
    before EVERY request, check live telemetry:
        stop if GPU >= 70 C
        stop if CPU >= 80 C
        stop if telemetry is missing or older than 5 minutes

The last rule matters most. If my monitoring is down, the job assumes the worst and stops. The job treats missing data as “unsafe”, not “fine”.

Peak temperature dropped to 65 degrees C, with about 4% average utilization and around 24 items an hour. The backlog took all night, not minutes. That is perfectly fine, because nobody was waiting.

Why This Matters

I built this for the engineering fun of it, and then it changed how I operate. Four things stand out.

Onboarding your future self. I am the only admin here, and I forget my own decisions faster than I would like. Six months from now, the person who knows nothing about my lab is me. With the overview, the guest inventory and the per-file headers, I can learn the environment again in an afternoon. I do not need archaeology.

Incident response at 2 a.m. When something is down, I do not want to grep a repo. I want three answers in under a minute: what is this thing, what depends on it, and what changed recently? The proxy map tells me where a name goes. The schedule page tells me if a timer fired at the wrong moment. The change log tells me what I touched yesterday, and I am usually the cause.

Seeing drift and change. The wiki rebuilds from every commit, so the change log is a daily, readable diary of the lab. Odd entries stand out: a file that changed when I did not touch it, a timer I forgot, a guest nobody remembers creating. A read of the day’s changes is a five-minute habit. It finds problems before they page me.

Trusting what’s running. Hand-written docs describe what I meant to build. Generated docs describe what the hosts really contain. When the two disagree, the generated page is right, and the disagreement is worth knowing about.

Takeaways

  • A repo of raw config snapshots is a record, not documentation. Pages make it something you can read.
  • Wipe and regenerate the generated parts every run. Never hand-edit them, and they never go stale.
  • Seed a hand-written notes section once and protect it from the generator.
  • Use two repos: one for pure snapshots, one for generated output.
  • Give the bot write access to the second repo only.
  • Trigger rebuilds when the source or the generator changes.
  • Check your sync mode. If the wiki only pulls while a browser is open, fast-forward its checkout yourself.
  • A rendered view of your backups will expose their holes. Because of a symlink, mine never captured the Proxmox guest configs.
  • If you add AI explanations, cache by input hash, label them as fallible and forbid guesses.
  • Drip the AI work with a thermal gate that fails closed.
  • Judge the project by how it feels at 2 a.m. Can you answer “what is this, what depends on it, what changed?” in a minute? Then it works.