# Spec conformance — kido-alloc × kido-sched integration (2026-10-14)

Against the Gate order (fence fulfilled; integrate, properly sequenced), the module
interfaces (`kido-alloc.h`, `kido-sched.h`, `kido-mem.h` region list), the allocator's
deliberated integration plan (P7), and this task's integration deliberation.

## MET

1. **Init ordering, one place.** `kido_sched_init` initializes kido-alloc from
   kido-mem's region list (hosted: the static arena as a synthetic region) before any
   task exists. `kido-sched.h` documents the effective order: alloc init → sched
   init → task creation. Matches the deliberated P1.
2. **Carving replaced, interface stable.** `kido_sched_create` signature and semantics
   unchanged; the watermark carve is now `kido_alloc(16 KiB, 16)`. Stacks are
   16-aligned payloads (tested). kido-resonate — drafted against the fenced tree —
   compiles and passes 59/59 unchanged against the integrated tree (public interface
   only, no allocator symbols).
3. **DONE-slot reuse preserved through allocator accounting.** Recycle keeps the
   provably-idle stack; the churn test pins `allocated_bytes` and `allocs` flat
   across create→DONE→recycle cycles — the anti-leak fix, now accounted.
4. **Exhaustion is loud and leaves no half-created task.** Allocator `NO_MEMORY`
   propagates from `kido_sched_create` with the slot left EMPTY (stack allocated
   before the TCB is filled). Post-exhaustion creation works — system consistent.
5. **kido-alloc untouched.** The approved allocator's `.h`/`.c` are unmodified; the
   scheduler is a pure client. Reservation stays 0,0 with sched D2 (image bounds)
   documented in both headers.
6. **Boot integration green.** `kido_boot()` → 0 on hosted, running the full
   early→probe→adapt→breath→main sequence through the allocator-backed scheduler.
7. **Zero warnings.** Hosted `-std=c11 -Wall -Wextra -Werror` clean on all three TUs.

## PARTIAL

- None.

## DEFERRED (declared, loud)

- D1 (sched): dedicated `KIDO_ERR_NO_TASKS` header code — still queued for N8toriousAi.
- D2 (sched): reserve passes 0,0 until the linker script exposes image symbols.
- D1 (this integration): no destroy API — `kido_free` has no steady-state scheduler
  caller. The free path is proven by the integration self-test directly; teardown
  frees when a destroy API is specified.

## Honest limits

- The ARM64 cross-compile and QEMU re-proof could not run in this session: the
  cross-toolchain and QEMU were lost when the VM was replaced (system-level tools
  are ephemeral), and the package lists are currently locked by a system update.
  The ARM64 delta in this change is portable C against declared interfaces
  (`kido_alloc_init`, `kido_alloc`, `kido_mem_regions`); the ARM64 asm blocks
  (context craft, trampoline, `.S`) are untouched and were verified with the real
  toolchain by the QEMU-proof builder. The bare-metal branch's arch-guard
  `#error`s correctly refuse host compilation (verified: they fire as designed).
