# next — fed-sx Milestone 1 kernel Single-instance, single-actor fed-sx server built as Erlang-on-SX modules. See `plans/fed-sx-design.md` for the architecture and `plans/fed-sx-milestone-1.md` for the build plan. ## Layout ``` next/ ├── kernel/ Erlang-on-SX kernel modules (.erl, hot-loaded via code:load_binary/3) ├── genesis/ SX source files for the genesis bootstrap bundle (DefineActivity, ...) ├── tests/ Bash test scripts driving sx_server.exe via the epoch protocol └── data/ Runtime state — gitignored ├── log/ per-actor JSONL outboxes ├── objects/ CID-addressed artifacts on disk ├── snapshots/ projection snapshots ├── indexes/ derived projection index files └── keys/ actor signing keys + bearer tokens ``` ## Substrate The kernel is Erlang-on-SX. Each `.erl` source file is hot-loaded at boot via `code:load_binary(Mod, Filename, SourceString)` (Erlang Phase 7 BIF). The underlying SX runtime provides the host primitives the kernel calls into: `crypto:*`, `cid:*`, `file:*`, `code:*`, and (Step 8) `http:listen/2`. Tests drive the kernel via the epoch protocol: ```bash printf '(epoch 1)\n(load "lib/erlang/runtime.sx")\n(epoch 2)\n\n' \ | hosts/ocaml/_build/default/bin/sx_server.exe ```