# De‑Rust Roadmap (Phase 21.9+) Purpose: reduce Rust surface (non‑plugin) while keeping correctness and reversibility. Make Hakorune (Hako) the primary host for parsing/building/executing; keep Rust for kernel/ABI/thin wrappers. ## Phases ### Phase 0 — Archive (low risk) - Target: Rust LLVM backend (src/backend/llvm) — deprecated in favor of Python llvmlite. - Action: move to `archive/rust-llvm-backend/` with a clear RESTORE.md. - Acceptance: `cargo build --release` (default features) remains green; quick smokes green. - Revert: `git mv archive/rust-llvm-backend/llvm src/backend/`. ### Phase 1 — Quick Wins (1–2 months) - hv1_inline → Hako parity (already functionally covered; keep as perf path). - MIR interpreter parity check; route Primary to Hako VM. - TLV codec → C shim (FFI) with thin Rust wrapper. - LLVM wrapper → Hako/C harness (Python stays primary until Hako IR is ready). ### Phase 2 — Core Thinning (2–4 months) - Plugin loader thin C wrapper (dlopen/dlsym), unify host ABI. - Basic boxes (Array/Map/File) small C core (handle‑based), keep Rust shim. - Resolver/Using: SSOT in Hako; runner uses shared policy. ### Phase 3 — Long‑haul (3–6 months) - Python llvmlite → Hako IR builder + C ABI. - Parser/MIR builder fully Hako‑first; Rust becomes fallback. - NyKernel minimal C runtime (BoxCall dispatcher + collections + file). ## Principles - Guard everything by env/features; defaults unchanged. - Keep changes reversible (small diffs, RESTORE docs, fallbacks). - Test gates: quick smokes + representative hv1/hakovm parity. ## Today (suggested) 1) Stage Phase‑0 move as a script (not auto‑run) + RESTORE.md. 2) Add phase docs (docs/private/roadmap/phases/phase-21.9/PLAN.md). 3) Keep CI/dev instructions intact (no build break when features=none).