HHLocal is a single Java 21 server process plus a Python 3.12 cognition sidecar. The server speaks the W16.2 hafen-client protocol, owns the SQLite world, and exposes a loopback-only inspector. Nothing in this guide requires a public network.
Boot profiles
The server accepts --profile playtest or --profile minimal. The environment fallback is HHLOCAL_BOOT_PROFILE. Programmatic test fixtures default to minimal.
- playtest requires the real versioned catalog, all ten RoB domains, the tuning overlay and the gildings data. A missing or malformed input fails fast instead of booting a half-world.
- minimal is the synthetic fixture profile used by unit tests and benchmarks.
On boot the server logs the loaded profile, the catalog SHA-256 digest and the entry counts, and passes the same live holder to the inspector. That makes the running world and the displayed world provably the same catalog.
Loopback GM inspector
The GM inspector binds to 127.0.0.1 only. The default port is 1873. It serves:
- GET /api/v1/health for a liveness gate;
- GET /api/v1/snapshot for a bounded state snapshot;
- panes for claims, economy, routine, settlements and related views.
The inspector is an observer. It does not call wdgmsg, does not inject clicks or keys, and the read-only /state endpoint beside it is used by the client gyms. A boot checkpoint failure logs a warning and does not block the listener.
Backups and VACUUM INTO
The live world is backed up with SQLite's atomic VACUUM INTO, never by copying a database file under load. The hourly job writes a coherent copy such as backups/world-YYYYMMDD-HH.sqlite, and the deployed stack pins backup_limit to 24 rather than Pelican's default of 0. The host snapshots those backups nightly to the backup server.
The same mechanism seals a Past Worlds archive: a VACUUM INTO copy, a manifest with SHA-256 digests, and read-only exports. If you copy a world by hand, use VACUUM INTO or include the WAL; a bare world.sqlite copy can miss a committed transaction.
PublishedCode and CodePin
Every code or codeentry archive from a non-jar source must match a pinned SHA-256 in haven.code.manifest. The check is fail-closed:
- the whole archive is hashed before it is trusted;
- only the built-in JarSource archives are trusted without a pin;
- filesystem, cache-tee and loopback HTTP sources all require a matching manifest entry;
- non-loopback HTTP is rejected unconditionally, and the host must be the literal 127.0.0.1 or ::1 (no DNS alias);
- a rejected archive is deleted from the resource cache so a caching wrapper cannot launder it into prscache.
The manifest format is one sha256 and resname per line, in sha256sum order, with UTF-8 BOM, leading star, leading ./ and backslashes normalised away. Comments and blank lines are ignored. An optional -Dhaven.auth-trustcert=<pem> adds a local TLS anchor for the synthetic auth server; it is not a general certificate bypass.
hhlocal_gym QA gates
The real-client gates are deliberately fail-closed. They are not screenshots that always pass.
- The hhlocal_gym MCP stdio server exposes exactly two tools, gym_start and gym_result. gym_start launches a detached Linux gym job on the VM 300 display :99 and returns immediately; gym_result polls it. Long runs never occupy a protocol call, and replies are capped by structural truncation.
- The Windows hardware-GL gym runs core_loop, craft_study_equip or build_claim with the real patched client against an isolated server and a temporary data directory.
- A run exits zero only when both a bounded /state delta and a passing visual verdict exist. --no-visual skips only the visual-model step, never the state delta. A missing delta or a failed visual check fails the receipt.
- The 0008 /state endpoint stays read-only. Every click and key is real OS input, so the gate cannot be satisfied by injecting a message through the IPC port.
- The Windows gym never launches, focuses or stops the operator's own client, and both child processes are killed in a finally block on every exit path.
Isolation rules
- Always pass an explicit --data-dir and --db to tests. Never point a test at the live %APPDATA% data directory.
- The playtest profile never silently upgrades a missing catalog; it fails.
- A quarantine or refused archive is reported, not ignored.
- Never commit .res, .rec, .jar, .sqlite or credentials.
Operator quick reference
- Java build and tests: D:\DevTools\gradle\bin\gradle.bat test (stop the daemon when finished)
- Python tests: python -m pytest tests/
- Exact wiki, .res and widget facts: python tools/hhlocal_lookup.py --wiki|--res|--widget
- Applied client patch gate: deploy/client/apply-patches.ps1 -Check and deploy/client/apply-ender-patches.ps1 -Check
- Server entry point: hhlocal.server.HhLocalServerMain