-
Research-first proposal (Workflow). Run a design/research ultracode workflow
that produces an honest proposal in docs/proposals/Mn-*.md (+ a literature survey
in docs/research/) BEFORE any code. The verdict may RESHAPE or DEFER the naive
plan. Mark the tracking task in_progress.
-
Lock scope from the proposal. State the id, the EXACT DoD marker string, the
mechanism, the framekernel unsafe placement (which goes in tb-hal, which is a
pure tb-encode leaf), arch notes, deps, risks, and the anti-hollow WITNESS line
the run scripts will require.
-
Generate via ultracode (Workflow). Author the milestone with a
generate -> 3-lens adversarial review -> finalize workflow. CRITICAL:
- Do NOT use
isolation: 'worktree'. Worktree isolation DOES NOT WORK in this
@cogitave checkout. The real pattern is a single strong implementation agent that
writes files to disk, builds (CARGO_INCREMENTAL=0, dual-arch), boots, and returns
a COMPACT MANIFEST (file list + integration anchors + marker/witness lines) —
NEVER inline file bodies (the 64K output-cap lesson).
- Tell agents to compile-check with Git-Bash
cargo kbuild (NOT raw rustc on
Windows paths — that hangs).
- Review lenses: (a) correctness/soundness of the new mechanism, (b) framekernel +
cumulative regression + both-arch/both-boot-path, (c) Rust/nightly build +
trait/ABI correctness + the verified-leaf totality/overflow story.
- Ground every agent with the framekernel rule, the verified-leaf pattern, the exact
files (
kernel/src/main.rs, crates/tb-hal/, crates/tb-encode/), and the
current state (read the files).
-
Add the tb-encode verified leaf (when it ships value-computation). Add a pure
leaf in crates/tb-encode/src/<leaf>.rs (existing leaves — 24: vmx, paging,
ipc_frame, route, memscore, stage2, smmuv3, el2_trap, blkfmt, kancell, prov, exp,
explore, bakeoff, opframe, exittel, tpsched, opframe_rx, khash, inferwire, sha256,
lmsig, attest, provhead). Add #[kani::proof]
harnesses in proofs.rs, each:
- TRACTABLE — and MEASURED locally before pushing. Run
cargo kani -p tb-encode --harness <name> (WSL) on EVERY new/changed harness; the full gate is
bash scripts/verify-encode.sh (it must report "N successfully verified, 0 failures"
in a few minutes). The #49 symbolic-array state-explosion is the documented trap,
and the slow harness is rarely the obvious one — MEASURE, do not guess. Worst
offenders: a symbolic hash/FNV over more than ~2-3 bytes, OR a digest computed MORE
THAN ONCE (e.g. for a determinism check). Fixes: shrink the symbolic input to ~2
bytes (totality is structural over the loop), compute the digest ONCE, assert
determinism over a CONCRETE input, and concretely-unroll any "for every byte" loop
instead of using a symbolic index. (Real example: M22 hash_total ran prov_hash
over 6 symbolic bytes TWICE → >220s, timing the 35-min lane out; N=6→2 + single
digest → 3s, and the whole gate then verifies in ~6 min locally.) SECOND
structural offender (M30 lesson): a SEQUENTIAL BYTE-PUSH TRACE through a
stateful accumulator — ~68 push-call inlines × the per-harness unwind bound
on the inner scan/shift loops is a formula floor (>>120s) that survives
concrete data, kissat, chunked loops, and hot-path slimming; prove the
index/capacity/rejection-class discipline at a tiny const-generic cap and
DELEGATE the full trace to host tests + Miri + the live boot lanes, NAMED
in the gate docs (the M30 accum_resync precedent).
- carrying a NEGATIVE CONTROL (an identity/constant/commutative variant the
harness must REJECT).
- MUTATION-TESTED when it gates. Every gate-level harness (one whose green
light admits a security/acceptance verdict) must be proven non-vacuous by
MUTATION: delete/neutralize the gated reject branch and the harness MUST go RED
(
VERIFICATION FAILED). Tautology is the sneaky form of vacuity — a harness
that re-derives its expectation from the same predicate the code uses passes
forever, even over a broken gate. (M28: deleting each reject branch in turn →
VERIFICATION FAILED ×3.)
- Extract the decision core when Kani cannot drive the wrapper. If the
wrapper's buffers/arrays blow the proof up (the
#49 trap again), do NOT
imitate the wrapper with a weakened predicate harness — extract the verdict as
a PURE buffer-free/hash-free function the wrapper delegates to VERBATIM, and
prove THAT fully symbolically; the wrapper's buffer/MAC plumbing is then
host-tested (run under the Miri CI lane) + boot self-tested. (M28:
opframe_rx::verify_decoded(frame, expected_nonce, live_head, mac_ok) is the
proven core — each reject arm iff its condition, plus the Accept-iff-all-conjuncts
theorem over a fully-symbolic live head — and decode_and_verify delegates its
verdict to it verbatim; all 7 verdict arms of the wrapper are host-tested.)
- Bump
scripts/kani-shards.sh in LOCKSTEP — the #101 ONE-TOUCH procedure:
add the new harness name to exactly ONE shard list (pick the lighter shard;
annotate the measured local time if >~20s) AND bump EXPECTED_HARNESSES_TOTAL
(currently 96), plus the kani.yml "currently 96" comment. The fail-closed
completeness guard (shards_assert_complete, run in every verify-encode.sh
mode) makes a vacuous/deleted/renamed/shard-unassigned harness fail the gate.
The kani lane has 3 jobs: prove-caps (tb-caps-core, M11 rights-subset,
12 harnesses, marker M11: caps-subset PROVEN) and the #101 cost-balanced
shard pair prove-encode-a/prove-encode-b (tb-encode, 46+50 of the 96
harnesses, markers V1-shard-a: kani-encoders OK/V1-shard-b: kani-encoders OK,
30-min hard timeouts; local SHARD=all keeps the single 96-harness pass and
V1: kani-encoders OK). Never --workspace
(drags tb-hal asm into CBMC).
-
Build — the real arbiter (CARGO_INCREMENTAL=0). export CARGO_INCREMENTAL=0
then cargo kbuild BOTH arches. This is THE CI discriminator: dtolnay/rust-toolchain
injects it in CI; it changes .bss symbol ordering vs local incremental builds and
has exposed layout-sensitive bugs (the aL2.5 boot-stack saga). The run scripts do NOT
export it — it must be set on the cargo kbuild invocation (per-invocation discipline).
Fix every error (build-std crate list, features, missing docs in tb-hal which denys
them). Zero warnings from our code.
-
Boot + assert + regress (anti-hollow-pass). Run scripts/run-x86_64.sh and
scripts/run-aarch64.sh; confirm the new marker AND all prior markers (cumulative
regression — on aarch64 that is M4, L2.0..L2.6 in order, M27, then M19..M26, M28, M29).
- Update
MARKER= to the new tail in run-x86_64.sh, run-aarch64.sh,
run-vmm-x86_64.sh (tb-vmm stops at M19 because M20/M22 take the graceful-skip
path with no disk/ledger).
- Add the anti-hollow-pass GUARD. A skip/dormant variant (e.g.
Mn: x OK (no disk, skipped), (heuristic floor, gate-not-met)) CONTAINS the Mn: x OK
substring the lane greps → a silently-unexercised feature would pass GREEN hollow.
The guard MUST reject the illegitimate skip variant AND positively require the real
round-trip WITNESS line (M20: persist: gen=.. records=.. replayed=..; M21:
kan: monotone=1 ovf-safe=1 q-err=.. bound=.. active=0; M22: prov: head=.. tamper-caught=1 inclusion=1; M28: opcmd: challenge=.. accepted=1 stale-rejected=1 wronghead-rejected=1 single-cred-rejected=1 badmac-rejected=1 kan_active=0 mac=KEYED-NONCRYPTO oracle=SIMULATED-ENROLLED-KEY). Then
negative-test that the guard FIRES (force the skip path and confirm the lane
goes red).
- HONESTY TOKENS in the witness — never overclaim. Where a capability is
partial, the machine-emitted witness must SAY so, and the run scripts must
require the token AND reject overclaim words. M28's tokens, exactly:
mac=KEYED-NONCRYPTO — the MAC is a nested keyed-FNV envelope, genuinely keyed
by two 256-bit creds but NOT cryptographic (FNV is not collision/preimage
resistant); oracle=SIMULATED-ENROLLED-KEY — a compiled-in test key, NOT a
human/enrolment; kan_active=0 — an Accept is necessary-NOT-sufficient
(KAN_ACTIVE is const false; M24's statistical bar still gates). State scope
honestly too: M28's verifier is pure + stateless — per-EPOCH staleness rejection,
NOT one-shot per-challenge nonce consumption (rotate-on-accept in the stateful
seam is a named successor, not a claim).
-
Benchmark the boot. ITER=8 bash scripts/bench-boot.sh x86_64 and aarch64.
If the milestone changed boot characteristics (image size, new boot-path init work,
the durable round-trip), update docs/BENCHMARKS.md — the "we are faster" claim
stays honest + sourced. The bench lane (bench.yml, tb-vmm vs Firecracker Axis-A)
is non-blocking.
-
Verify the tree INDEPENDENTLY on a branch. Do NOT trust the agent's manifest:
build + boot (CARGO_INCREMENTAL=0, dual-arch) + the leaf tests + clippy +
verify-encode.sh harness-count yourself, and confirm the PRIOR chain unregressed.
The build+CI is the arbiter. On HIGH-OVERCLAIM-RISK milestones (security gates,
"proven"/"authorized" claims), additionally run a pre-merge ADVERSARIAL
VERIFICATION workflow: independent skeptic agents, one per claim, + a
merge-verdict synthesis. It pays for itself — M28's four skeptics (mac-honesty /
gate-bypass / necessary-not-sufficient / harness-vacuity) confirmed the core sound
AND found two honesty defects (vacuous gate harnesses; a one-shot replay
overclaim), both FIXED before merge (the verify_decoded extraction + the
replay-scope doc honesty).
-
Align ALL relevant docs (never skip — ENGLISH ONLY).
docs/proposals/Mn-*.md (+ docs/research/) — the proposal that drove the work.
docs/ROADMAP-V2.md §6 status table → mark done; advance the chain framing past
M28 + L2.6; refine any downstream milestone the work changed.
docs/MILESTONES.md — extend the marker sequence + summary table.
docs/ARCHITECTURE.md — update the as-built map.
docs/BENCHMARKS.md — boot numbers (Step 7).
BUILD.md — if build flags/toolchain changed.
- The spec docs (
KERNEL-FOUNDATION / MEMORY / AGENTS / SELF-IMPROVEMENT /
SOVEREIGNTY) — if the milestone realises part of their spec.
- The auto-memory file — bump the "what's done / what's next" line.
- Zero Turkish (proper nouns like Gödel/TÜV are fine).
-
Land via the PR LOOP — never push to main. Branch + open a PR (Conventional
Commits, feat(<area>): Mn — <title>). Watch the real CI: the ~10 lanes —
ci (both-arch QEMU-TCG cumulative boot; the aarch64 boot runs INSIDE a
debian:trixie-slim qemu-10 container because SMMUv3 stage-2/L2.6 needs qemu≥9),
vmm-boot (tb-vmm/KVM, M4), l2-nested-vmx (x86 VMX probe, informational),
microvm-kvm (QEMU-microvm+KVM hard gate on M18: evolve OK + the --release
boot-ready bench), kani (prove-caps + prove-encode-a/-b), miri (Tier-0 UB gate,
T0: miri OK), clippy (forbid-unsafe leaf lint, S0: clippy OK), bench
(non-blocking). Merge ONLY after 2 CONSECUTIVE green real-CI runs on BOTH arches,
then gh pr merge --merge --delete-branch. (Commit messages: avoid backticks inside
git commit -m "..." — bash command-substitutes them; use a message file with
git commit -F.)
-
Close the loop. Mark the tracking task completed. Report the increment
(what shipped, the markers/witnesses, CI status, boot numbers). Continue to the
next milestone (autonomous progress through the chain).