Long-horizon, pose-keyed memory for the Phase 176 world models (176.5.2.1).
Stores the latent descriptor of each visited region keyed by the camera pose it was seen from, and retrieves it into the dynamics-model context so a Genie-3-style world reproduces the original scene when the camera returns to a previously-visited pose.
pose.ts—CameraPose(position + orientation quaternion) with a weighted pose metric combining Euclidean translation and geodesic orientation error, plus slerp.SpatialMemory— a uniform spatial-hash grid over position for O(1)-ish candidate gathering, ranked by the full pose metric; kNN + radius retrieval, overwrite-by-id, removal, and serialisation.MemoryBank— turns a nearest-pose query into a softmax-over-distance blended context vector the dynamics cross-attends to, and exposes a directpersistenceScore(cosine to the originally-stored latent) for the Genie-3 "go back to the start" requirement.
Pure TypeScript, no runtime dependencies.
text
npx vitest run --root libs/nous/wm-memory