Files
garden-astro/deploy/auto-build.sh
T
wesandClaude Opus 5 d3d93a982a reading map: seven models, one library — /reading/models
The same 9,194 passages arranged by seven embedding models, switchable. Every
model's coordinates are Procrustes-aligned to nomic, without which the toggle
would be seven unrelated arrangements and the motion between them meaningless.

⚠️ The page states the NEIGHBOUR-AGREEMENT number, not the animation, and the
distinction is load-bearing. Every projection of 1024 dimensions into 3 is lossy
in a way that shapes what you see: measured directly, PCA and UMAP disagreed by
10x about whether whole books move together, each reporting its own arithmetic.
So the claim is computed on the raw embeddings where there is no projection to
be an artifact of (models share ~50% of each passage's 15 nearest neighbours),
and the picture illustrates that number rather than being the evidence for it.
The page says so in as many words.

Renderer gains setCoordinates(), driven from the existing render loop rather
than its own rAF so a morph cannot outlive the scene or run while scrolled away.
It writes through the single `xyz` buffer the nebula, signal and trace all read
from, so every layer moves together and nothing drifts out of registration.

`trace` is now optional. The banner and explorer always carry one; a comparison
payload legitimately does not — its subject is where passages MOVE between
models, not the order they were highlighted in.

Payload is split: a 44 KB manifest with everything shared, plus one ~145 KB
coordinate file per model fetched on demand. The per-node book/kind arrays are
identical across models, so carrying them seven times is waste, and eager
loading would be ~1.1 MB before first paint.

auto-build.sh now watches public/reading_*.json as ONE glob. The previous
OR-chain was subtly broken — with `-o` the `-printf` binds only to the last
clause, so earlier matches printed in a different format and the signature was
not stable. The glob also picks up future payloads without an edit.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 13:40:11 -04:00

48 lines
2.0 KiB
Bash
Executable File

#!/bin/sh
# Timer target: rebuild the garden only when the vault or repo changed.
# Successor to the Quartz update_quartz_docker.sh change-detection loop.
# Usage: auto-build.sh [--force] (--force skips change detection — used
# by the manual rebuild hook)
set -eu
REPO=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
VAULT="${VAULT:-/home/nox/docker/obsidian/vaults/weeslahw_coppermind}"
STATE="$REPO/.build_state"
FORCE=0
[ "${1:-}" = "--force" ] && FORCE=1
cd "$REPO"
# serialize builds: the 5-min timer and the manual hook must never run
# docker/npm into the same checkout concurrently
exec 9>"$REPO/.build.lock"
flock 9
# a dirty tree can make pull fail; still rebuild whatever is checked out
git pull -q || echo "git pull failed (dirty tree?) — building local state"
# signature covers committed HEAD, any uncommitted repo edits, vault mtimes,
# and the notebook exports (gitignored, so git status/diff can't see them —
# they land here on their own timer via deploy/export-notebooks.py)
sig=$({
git rev-parse HEAD
git status --porcelain=v1
git diff
find "$VAULT" -name .obsidian -prune -o -type f -printf '%T@ %p\n' | sort
find "$REPO/notebooks-export" -type f -printf '%T@ %p\n' 2>/dev/null | sort
# same deal for every reading map payload: gitignored, written by library-rag-export.service
# on its own timer, so git status/diff above cannot see them change. One glob rather than a
# list — with `-o` the `-printf` binds only to the LAST clause, so an OR-chain silently
# prints the earlier matches in a different format and the signature stops being stable.
# It also means a future payload is watched without editing this line.
find "$REPO/public" -maxdepth 1 -name 'reading_*.json' -printf '%T@ %p\n' 2>/dev/null | sort
} | sha256sum | cut -d' ' -f1)
if [ "$FORCE" -eq 0 ] && [ -f "$STATE" ] && [ "$(cat "$STATE")" = "$sig" ]; then
exit 0
fi
sh "$REPO/deploy/build.sh"
printf %s "$sig" >"$STATE"
echo "garden rebuilt $(date -Is)"