garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

J. van Veen · 2026-07-27T23:52:47+02:00

docs: add a contributor guide and point the entry points at it

Retiring the ADRs took the read order with it, and nothing replaced it as
the answer to "I just cloned this, now what?". README stopped at the crate
table; CLAUDE.md is written for agents and is long enough that a human
skims it; docs/README.md offered a numbered path into a process that no
longer exists.

docs/guides/development.md is that missing middle: the dev loop, the code
map with the phase ordering in main.rs, conventions, env config, the web
build and CI. It leads with Git LFS because that failure is silent — an
un-smudged clone builds clean and panics at runtime, since four assets are
include_bytes!-ed at compile time. Same shape as the other two traps it
records: `cargo check` skips cfg(test) code, and `--lib` fails on viberfox
because it has no lib target, so both give a green signal that means
nothing about the suite.

The four entry points now agree on where a fact goes — one diff to the
commit body, all future work to a note, falsifiable by code to a comment
next to it — and all name adr/ and abstract/ as a frozen archive.

README's Troubleshooting section is dropped rather than moved: the Wayland
flicker and post-bump `cargo clean` entries duplicate CLAUDE.md's Known
issues, which is the one list to keep.
AGENTS.md                  |  11 ++--
 CLAUDE.md                  |  20 ++------
 README.md                  |  15 ++++--
 docs/README.md             |  24 ++++-----
 docs/guides/development.md | 123 +++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 154 insertions(+), 39 deletions(-)

diff --git a/AGENTS.md b/AGENTS.md
index 357d379f..b7edf247 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -4,14 +4,13 @@
 
 ## Architecture docs
 
-Intent and decisions live under `docs/`:
+Intent and standing constraints live under `docs/`:
 
-- `docs/abstract/` — **why**: vision (`G-*`), principles (`P-*`), roadmap (P0–P2), ADR resolution (R0–R3), capability map, glossary
-- `docs/adr/` — **what we chose**: one file per decision; [`docs/adr/index.md`](docs/adr/index.md) lists them all
+- [`docs/guides/development.md`](docs/guides/development.md) — contributor guide: dev loop, tests, code map, conventions
+- [`docs/notes/`](docs/notes/) — **standing facts**: measurements (with method), rejected options (with the reason they lost), external-world constraints, directions abandoned without a diff. One file per topic, retrieved by `triggers:`, edited in place
+- `docs/adr/`, `docs/abstract/` — **frozen archive** of the numbered decision log, retired 2026-07-26 ([why](docs/notes/retired/adr-system.md)). Read for history; **never add to them, and don't re-propose numbered ADRs**
 
-Before large or cross-cutting work, read in order: [`vision.md`](docs/abstract/vision.md) → [`principles.md`](docs/abstract/principles.md) → [`roadmap.md`](docs/abstract/roadmap.md) → [`adr-resolution.md`](docs/abstract/adr-resolution.md) → [`docs/adr/index.md`](docs/adr/index.md). Full ADR discipline (when one is required, definition of done): [`docs/abstract/README.md`](docs/abstract/README.md).
-
-**Create or supersede an ADR** for wire-protocol, authority, persistence-schema, security-boundary, major-dependency, or sim/client process-boundary changes; skip it for bug fixes and refactors inside an existing ADR's scope. Copy [`docs/adr/template.md`](docs/adr/template.md) and add a row to [`docs/adr/index.md`](docs/adr/index.md) in the same change set.
+**Where a fact goes:** explains one diff → the commit body (required for `feat`/`fix`/`perf` and any 5+-file commit — see [`.claude/skills/commit`](.claude/skills/commit/SKILL.md)); constrains all future work → a note; falsified by a code change → a comment next to the code.
 
 ## Build scope
 
diff --git a/CLAUDE.md b/CLAUDE.md
index c5e79526..37302eba 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -189,23 +189,13 @@ This is a **Cargo workspace** with four crates:
 
 **Wire format (ADR-008–009):** TCP length-delimited frames, little-endian `u32` length; frame body = `protocol_version` (u8) + `message_kind` (u8) + `request_id` (u64) + postcard payload.
 
-## Architecture docs (abstract → ADR → code)
+## Documentation (notes + commit bodies)
 
-Architecture documentation lives under `docs/`:
+- `docs/guides/development.md` — contributor guide: dev loop, tests, code map, conventions, config, CI
+- `docs/notes/` — **standing facts** the code and `git log` don't hold: measurements (with date and method), rejected options (with the reason they lost), external-world constraints, directions abandoned without a diff. One file per topic with `triggers:` front-matter; edited in place when a fact stops being true. `docs/notes/README.md` has the format
+- `docs/adr/`, `docs/abstract/` — **frozen archive** of the numbered ADR log and its abstract layer, retired 2026-07-26 (`docs/notes/retired/adr-system.md` says why). Read for history; **do not add to them or re-propose the form**
 
-- `docs/abstract/` — **why**: vision (`G-*` goals), principles (`P-*`), roadmap tiers (P0–P2), ADR resolution depth (R0–R3), capability map
-- `docs/adr/` — **what we chose**: one file per decision; `index.md` lists all ADRs
-
-**Before large or cross-cutting changes**, read in this order:
-1. `docs/abstract/vision.md` — goals G-01…G-09
-2. `docs/abstract/principles.md` — principles P-01…P-07
-3. `docs/abstract/roadmap.md` — P0/P1/P2 priorities
-4. `docs/abstract/adr-resolution.md` — R0–R3 depth guide
-5. `docs/adr/index.md` — existing decisions
-
-**Create or supersede an ADR** for: wire protocol changes, storage schema, security boundaries, major new dependencies, sim/client process boundary changes. Skip for bug fixes or refactors within an existing ADR's scope.
-
-New ADR checklist: copy `docs/adr/template.md`, set `Aligns with: G-*, P-*`, add a row to `docs/adr/index.md` in the same commit. Match depth to R0–R3 (not every change needs a full R2 ADR).
+**Where a fact goes:** explains this diff → the commit body, required for `feat`/`fix`/`perf` and any 5+-file commit (`.claude/skills/commit`); constrains all future work → a note; a code change would falsify it → a comment next to the code.
 
 ## Known issues / workarounds
 
diff --git a/README.md b/README.md
index fa00eaee..fe1795ff 100644
--- a/README.md
+++ b/README.md
@@ -76,12 +76,19 @@ Binary assets — models, textures, fonts, icons, audio, the `docs/img` screensh
 | `viberfox` | Bevy 0.19 game client (rendering, ECS systems, UI) |
 | `big_space` | Vendored fork of `big_space` 0.10, ported to Bevy 0.19 for planet-scale floating-origin transforms |
 
-Design docs and the reasoning behind major decisions live under [`docs/`](docs/) — read them before large or cross-cutting changes.
+## Development
 
-## Troubleshooting
+New here? [`docs/guides/development.md`](docs/guides/development.md) is the contributor
+guide — the dev loop, tests, a map of the code, conventions, config and CI.
 
-- **Wayland flicker (GLES):** force Vulkan — `WGPU_BACKEND=vulkan cargo run -p viberfox`.
-- **Build errors after a toolchain/dep bump:** `cargo clean` and rebuild.
+```bash
+cargo test -p viberfox --bin viberfox   # the client suite (no lib target: --lib fails)
+```
+
+Standing constraints and measurements live in [`docs/notes/`](docs/notes/); the traps
+worth knowing before a first non-trivial change are in [`CLAUDE.md`](CLAUDE.md)'s
+*Known issues*. `docs/adr/` and `docs/abstract/` are a frozen archive of the earlier
+decision log.
 
 ## Credits
 
diff --git a/docs/README.md b/docs/README.md
index 5ce21b0b..0f871a9e 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1,29 +1,25 @@
 # Documentation
 
-User docs, product intent, planning, and architecture decisions for Viberfox live
-under **`docs/`**:
-
 | Path | Contents |
 |------|----------|
+| **[guides/development.md](guides/development.md)** | **Contributor guide** — dev loop, tests, code map, conventions, config, CI |
 | **[manual.md](manual.md)** | User manual — controls, getting around, authoring objects, developer panel |
-| **[abstract/](abstract/)** | Vision (`G-*`), principles (`P-*`), roadmap, **ADR resolution** guide, capability map, glossary, discipline |
-| **[adr/](adr/)** | Architecture Decision Records (numbered files + `index.md`, `template.md`) |
+| **[notes/](notes/)** | Standing facts about the codebase: measurements, rejected options, external constraints |
 | **[guides/](guides/)** | Operational how-tos (self-hosting services, deployment) |
-| **[img/](img/)** | Screenshots used by the docs and the top-level README (`shots.toml` drives `cargo shots`) |
+| **[img/](img/)** | Screenshots for the docs and the top-level README (`shots.toml` drives `cargo shots`) |
+| [adr/](adr/), [abstract/](abstract/) | **Frozen archive** — the numbered decision log and its abstract layer, retired 2026-07-26 ([why](notes/retired/adr-system.md)) |
 
 ## Guides
 
+- [Development](guides/development.md) — start here as a new contributor
 - [Self-hosted geo services (Overpass + Nominatim)](guides/server.md) — run local Overpass/Nominatim instances seeded with the Netherlands extract and point the client at them via `VIBE_OVERPASS_URL` / `VIBE_NOMINATIM_URL`
 
-## Read order
+## Where a fact belongs
 
-1. [abstract/vision.md](abstract/vision.md)
-2. [abstract/principles.md](abstract/principles.md)
-3. [abstract/roadmap.md](abstract/roadmap.md) — **priorities and sequencing**
-4. [abstract/adr-resolution.md](abstract/adr-resolution.md) — **how deep to document** a concept
-5. [abstract/capability-map.md](abstract/capability-map.md)
-6. [adr/index.md](adr/index.md)
+- Explains **one diff** → the commit body (required for `feat`/`fix`/`perf` and any 5+-file commit).
+- Constrains **all future work** → a topic note in [notes/](notes/), edited in place.
+- Falsified by a code change → a comment next to the thing.
 
-Discipline (when an ADR is required, DoD): [abstract/README.md](abstract/README.md).
+Nothing new goes in `adr/` or `abstract/`.
 
 **AI assistants:** [AGENTS.md](../AGENTS.md) in the repo root.
diff --git a/docs/guides/development.md b/docs/guides/development.md
new file mode 100644
index 00000000..81daf04b
--- /dev/null
+++ b/docs/guides/development.md
@@ -0,0 +1,123 @@
+# Development
+
+Onboarding for new contributors. Prerequisites, first run and the crate layout are
+in the [README](../../README.md); this is what comes after it.
+
+## Before anything else: Git LFS
+
+`git lfs install` **before** cloning. Binary assets are in LFS, and four of them
+(brand font, app icon, star catalog, tile fixtures) are `include_bytes!`-ed at
+compile time — without the smudge filter `cargo build` embeds 130-byte pointer
+files and succeeds, then panics at runtime. Same reason every CI job sets
+`lfs: true`.
+
+## The loop
+
+| Task | Command |
+|------|---------|
+| Type-check what you touched | `cargo check -p vibe_core \| vibe_sim \| viberfox` |
+| Play it | `cargo run -p viberfox` |
+| Playable framerate in debug | `cargo run -p viberfox --profile dev-bevy` |
+| Fast incremental links (local only) | `cargo run -p viberfox --features fast-dev` |
+| Client tests | `cargo test -p viberfox --bin viberfox` |
+| Server tests | `cargo test -p vibe_sim` |
+| Floating-origin tests | `cargo test -p big_space --lib` |
+| Regenerate README images | `cargo shots` |
+
+Two traps: `viberfox` has **no lib target**, so `--lib` fails and `--bin viberfox`
+is required; and `cargo check` does **not** compile `cfg(test)` code, so a green
+check says nothing about the suite. Run the tests when touching egui, geometry or
+tile parsing.
+
+`#[ignore]`-d tests are diagnostics, not tests — they dump a PNG, print a tile's
+layers, time a cell, or solve a real route against the network. Run one by name:
+`cargo test -p viberfox --bin viberfox dump_png -- --ignored --nocapture`.
+
+Verify a visual change **headless** rather than by flying the camera there:
+`cargo shots --only globe` for a README preset, or `--shot` for an arbitrary
+viewpoint, sweep or CSV of the ramp scalars. Full flag list in
+[`CLAUDE.md`](../../CLAUDE.md#scripted-screenshots---shot).
+
+## Where things live
+
+| Path | Contents |
+|------|----------|
+| `crates/vibe_core/` | Wire protocol (`protocol.rs`), tile/coordinate math (`world.rs`, `geo.rs`) |
+| `crates/vibe_sim/` | Authoritative server: `net.rs` (tick loop), `state.rs` (world), `db.rs`, `auth.rs`, `config.rs` |
+| `crates/viberfox/` | Bevy client — everything below |
+| `crates/big_space/` | Vendored floating-origin fork; re-sync `bevy_compat.rs` on every Bevy bump |
+
+Inside the client, `components.rs` / `resources.rs` hold the ECS types and
+`systems/` is one file per concern, registered in ordered phases in `main.rs`:
+
+| Group | Files |
+|-------|-------|
+| Map streaming | `map_stream`, `tile_loader`, `vector_tiles`, `map_geometry`, `osm_buildings`, `lod22`, `road_texture`, `vegetation`, `water` |
+| Planet & sky | `globe`, `globe_ocean`, `globe_weather`, `weather` |
+| Avatar & camera | `avatar`, `free_camera`, `collision`, `picking`, `gizmo` |
+| Networking | `network`, `chat`, `../login.rs`, `../solo.rs` |
+| Navigation | `geo_nav`, `routing`, `navigation`, `driver`, `transit_live`, `transit_vehicles` |
+| UI | `egui_manager`, `theme`, `ui`, `hud`, `splash`, `data_layers`, `bookmarks`, `place_pins`, `ai_assistant`, `debug` |
+| Headless | `shot_harness`, `shot_presets` |
+| Platform | `platform/` — `http`, `storage`, `location`, `work`, `workers` (native vs wasm behind one API) |
+
+**System order is load-bearing**, not cosmetic — e.g. `place_pins` must run after
+every panel system to cull itself against the leftover map area. Add new systems to
+the phase they belong to, not the end.
+
+## Conventions
+
+- **Commits** — Conventional Commits (`type(scope): subject`). A body is required
+  for `feat` / `fix` / `perf` and any 5+-file commit; it is where measurements,
+  rejected options and silent-failure findings are kept. See
+  [`.claude/skills/commit`](../../.claude/skills/commit/SKILL.md).
+- **Standing facts go in [`docs/notes/`](../notes/)**, one file per topic, edited in
+  place. Rule of thumb: explains one diff → commit body; constrains future work →
+  note. `docs/adr/` and `docs/abstract/` are a **frozen archive** — read them for
+  history, don't add to them.
+- **UI colour, spacing and type come from `systems::theme`.** A fresh
+  `Color32::from_rgb` in a panel is how the chrome drifted last time.
+- **Dependency versions live in the root `Cargo.toml`** `[workspace.dependencies]`.
+- **Protocol changes append a `PROTOCOL_HISTORY` row**; `PROTOCOL_VERSION` is
+  derived from it — never write the number anywhere else.
+
+## Configuration
+
+Client env vars (also read from `.env`):
+
+| Variable | Effect |
+|----------|--------|
+| `VIBE_TILE_URL` / `VIBE_TILE_FORMAT` | Basemap template; `vector\|raster` override for the source kind. Routing needs a vector source |
+| `VIBE_OVERPASS_URL` / `VIBE_NOMINATIM_URL` | Point at your own geo services ([server guide](server.md)) |
+| `VIBE_CACHE_DIR` | Tile/asset cache root (defaults to the workspace root) |
+| `VIBE_USER` / `VIBE_PASSWORD` | Handshake credentials; `--login` and a login file take precedence |
+| `VIBERFOX_PLACE` | Start at `lat,lng,alt,pitch,yaw` — the value the HUD's ⧉ button copies |
+| `VIBERFOX_NO_ATMOSPHERE\|_HAZE\|_ENVMAP\|_OCEAN\|_CLOUDS\|_RAIN\|_SHADOWS` | Bisect a render problem by removing one layer |
+| `ANTHROPIC_KEY` | AI assistant panel — copy `.env.example` to `.env` |
+
+The server takes `vibe.toml` → `VIBE_*` env → CLI flags, in that order.
+
+## Web build
+
+`crates/viberfox/serve-threads.sh` builds and serves the wasm client with real
+threads (shared memory + `-Z build-std` + COOP/COEP headers — the script's header
+comment explains what breaks if one of the three is missing). Performance
+background: [`docs/notes/wasm-performance.md`](../notes/wasm-performance.md).
+
+## CI
+
+[`.forgejo/workflows/ci.yml`](../../.forgejo/workflows/ci.yml) runs on every push:
+`cargo check --workspace --all-targets` in a fast lane, plus the client and
+`big_space` test suites. Both jobs use the prebuilt `viberfox-ci` image and check
+out with `lfs: true` — add that to any new job.
+
+## When something is weird
+
+`CLAUDE.md`'s [**Known issues / workarounds**](../../CLAUDE.md#known-issues--workarounds)
+is the accumulated list of traps in this codebase (egui layering, atmosphere in
+space, GPU device loss under mesh churn, avatar heights, routing graph noding). It
+is worth skimming once end to end before your first non-trivial change — most of
+the entries were expensive to find and cheap to read.
+
+Then: [`docs/notes/`](../notes/) for standing constraints and measurements, and
+[`docs/manual.md`](../manual.md) for what the app does from a user's seat.