Architecture โ€ข May 2026

The Great Registry Refactoring ๐Ÿ›ก๏ธ

Over time, software naturally accrues technical debt. In KnotenCore, the registry.rs file had grown into a 1,600-line monolith responsible for everything from WGPU mesh generation to AABB collision detection. Sprints 184 and 185 set out to change that. Welcome to The Great Registry Refactoring.

๐Ÿ”ช Splitting the Monolith

The central FFI (Foreign Function Interface) registry was surgically split into four focused, single-responsibility modules:

๐Ÿงน FFI Consolidation

Alongside structural modularity came a brutal API cleanup. Redundant FFI functions like registry_read_file and registry_write_file were entirely eliminated. All file I/O operations are now routed through the highly secured fs module using file_read and file_write, which enforce strict path validation and CLI permission checks (--allow-read, --allow-write). The global geometry cache (SENT_MESHES) was successfully removed from the kernel entirely and isolated inside scene.rs.

๐Ÿ”’ A Hardened Sandbox

The refactoring didn't just organize the code; it fundamentally secured it. Texture loading (registry_load_texture) now leverages our unified ffi_safety::validate_fs_path framework before touching the disk. Every OS interaction from a `.nod` script is mathematically bounded and securely routed, cementing KnotenCore's position as a zero-trust, deterministic AI runtime.