# LLM Wiki — the documentation contract

How the narrative documentation in this repo is organized. The pattern is borrowed from the
`sources / wiki / index / log` model: a durable synthesized layer (`archive/knowledge/`) built on top
of immutable evidence (`knowledge/sources/`, incident records), with pure-listing indexes and an
append-only operations log.

This contract governs the **narrative layer only**. The machine-readable substrate — `inventory.yaml`,
`secrets/`, `scripts/`, `bin/` — is not part of the wiki and never
moves under it. See [the knowledge schema](../domains/knowledge/schema.md) for the split.

## Layers

- **Sources** are immutable raw material: incident records (`knowledge/sources/investigations/`), external reference
  docs (`knowledge/sources/references/`), and the live system itself (`pct config`, `docker inspect`).
  Read them; do not rewrite them into other sources.
- **Wiki** (`archive/knowledge/`) is the synthesized, authoritative current-state layer: one page per
  node (`containers/`, `vms/`, host narratives) and per cross-cutting system (`infrastructure/`). A
  reader understands the topic from the wiki page without reading the sources.
- **Index** (`index.md` / folder `README.md`) is a pure listing — every page in scope with a
  one-line summary, and nothing else. Anything the section wants to say up front goes into a page
  the index lists, not into the index.
- **Log** (`log.md`) is append-only, recording *doc-maintenance operations* (restructures, source
  ingests, lint sweeps) in single-line format: `## [YYYY-MM-DD] <op> | <summary>`.

## Two logs, kept distinct

- **`## Changelog`** on each node/topic page records *infrastructure* changes to that node. It is
  machine-parsed (`get_changelog`, the Oikos ledger) — keep the `### YYYY-MM-DD — title` shape.
- **`log.md`** per area records *documentation* operations only. It never duplicates the Oikos
  change ledger (`oikos/ledger.py`), which stays authoritative for infra changes with
  who/what/risk/approval/verification.

## Rules

- Wiki pages stay short and focused. A page past ~300 lines splits.
- Pages stay flat under `wiki/<section>/` until there are enough to warrant a sub-group.
- Every page follows [writing-style.md](writing-style.md).
- Plans and design docs always live in the repo `plans/` folder (`plans/YYYY-MM-DD-slug.md`),
  listed in `plans/index.md`, moved to `plans/done/` on completion — never a scratch path or a chat
  message. See [the operations schema](../domains/operations/schema.md).
