The kernel router for FAF WASM engines. One interface, any kernel, same score.
Scores .faf files (IANA-registered AI-context format) via embedded WASM. Two kernels live today: Rust (faf-wasm-sdk, full Mk4 + FAFb roundtrip) and Zig Cascade (mk4-routed, sub-microsecond on validate/tier native; 2.7 KB WASM artifact). Score parity between kernels verified on the same .faf inputs.
npm install faf-wasm-coreimport { init } from "faf-wasm-core";
const kernel = await init("rust"); // full FafKernel surface
// or:
const kernel = await init("zig"); // Cascade — sub-μs delivery, score-only today
const result = kernel.score(yaml);
// result.score = 100
// result.tier = "🏆"
// (Rust kernel also returns populated / empty / ignored / slots breakdown.
// Zig kernel v0.2.0 returns the score + tier only — full slot breakdown
// is Rust-kernel territory today.)Every kernel implements FafKernel:
interface FafKernel {
score(yaml: string): ScoreResult;
scoreEnterprise(yaml: string): ScoreResult;
validate(yaml: string): boolean;
compile(yaml: string): Uint8Array;
decompile(bytes: Uint8Array): FafbInfo;
scoreBinary(bytes: Uint8Array): ScoreBinaryResult;
binaryInfo(bytes: Uint8Array): FafbInfo;
version(): string;
readonly engine: "rust" | "zig";
readonly engineVersion: string;
}Not every kernel supports every method:
| Method | Rust | Zig (Cascade v0.2.0) |
|---|---|---|
score |
Yes | Yes (mk4 21-base-slot, score + tier only) |
scoreEnterprise |
Yes | No |
validate (yaml) |
Yes | No (cascade validates FAFb bytes, not YAML — different surface) |
compile |
Yes | No |
decompile |
Yes | No |
scoreBinary |
Yes | No |
binaryInfo |
Yes | No |
Unsupported methods throw KernelCapabilityError with a clear "use the Rust kernel" message. Query at runtime via capabilities().
- 329 KB embedded Rust WASM (faf-wasm-sdk, Mk4 + FAFb roundtrip)
- 2.7 KB embedded Zig WASM (cascade.wasm v0.2.0, mk4-routed)
- Zero npm dependencies
- 44 tests passing — including 9 Zig-kernel tests + score-parity-vs-rust receipt
- bun-sticky — Bun CLI (embeds core)
- builder.faf.one — Browser scorer
FAF (Foundational AI-context Format) — IANA-registered (application/vnd.faf+yaml). Over 110k+ downloads; see faf.one/downloads for latest stats.
MIT