Files
LithosAnanke/docs/v4.0.0/plans/2026-11-18-v4-init.md
T
Claude b13d452e66 v4 init.4th, steps 1 and 2: the ACL policy loaded after POST, then the search order
Captain Bob ruled "ACL at boot", loaded "From init.4th", the include
"Compose[d] in FORTH".
- capsules/v4/init.4th, at block 3980: S" v4:ACL.4th" CAPSULE-INCLUDE,
  then STARSHIPOS.
- capsules/v4/ACL.4th is the policy, git mv'ed from v4/capsule/ACL.fth
  and reflowed into chained 64x16 blocks, its text unchanged.
- CAPSULE-INCLUDE in centre.4th places a capsule and LOADs its lowest
  block. It is composed from CAPSULE-OPEN and CAPSULE-LINE, with no new
  C word.
- The mesh loads v4:init.4th after POST and COLD, its one fixed step
  there.

Test first in test_mesh_boot: the parity line, DOE without naming
STARSHIPOS, and ACL-BOOT pinned. The before-run failed.

After: 113 checks pass and POST is 990/990. All 52 tests, test-32 and
ASan/UBSan pass. The dictionary has 405 words. One amd64 session passes
18/18 with "ACL: active".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
2026-11-19 11:57:42 +00:00

125 lines
6.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# v4's `init.4th` -- design, for ruling
Written 2026-11-18. Captain Bob ruled: "Write v4's init.4th". That was after the audit of Phase 7
Tasks 5–7 found that v4 has no `init.4th`.
**Nothing here is built.** Each point in section 5 is put to Captain Bob one at a time.
## 1. What the record asks
- **MACHINE.md §3, step 5:** "`init.4th`, the system's init (section 7, item 6). From here the boot
is `init.4th` only. No boot policy is written in C."
- **MACHINE.md §1.1:** "the system's init, `init.4th`, brings it up:
- it turns on security;
- it starts the system a module at a time and a node at a time;
- whoever is logged in gets a prompt: Zuse, `rajames`, `00` to `09`, or whoever it is."
- **MACHINE.md §5:** "Everything after POST is `init.4th`'s."
- **Ruled 2026-11-18:** `init.4th` sets the search order, starting in STARSHIPOS, then FORTH. `COLD`
stays as FORTH-79's, with one vocabulary.
## 2. What the boot does now (`v4/system/mesh.c`, `kernel/src/v4/sk_v4.c`)
1. The ROM assembles the nucleus on Hera.
2. The kernel words are made.
3. The capsules are loaded:
- `forth79.4th`;
- the kernel's list in C (`sk_v4.c:165`): `starshipos.4th`, `centre.4th`, `hera.4th`,
`physics.4th`.
4. Seal, then POST (990 cases), then `COLD`.
5. The kernel's C code runs:
- the identity gate: no identity drive means headless, and Zuse's drive gives a console
(`sk_v4_identity.c`);
- the prompt, `[zuse@Hera] ok>`.
**Security is never turned on in the kernel's boot.** The policy, `v4/capsule/ACL.fth` (v3's
`ACL.4th` as FORTH source), is loaded only by a host test (`test_host_quit.c:1637`). It is not in
the kernel's capsule directory, which is built from `capsules/` only.
## 3. The design
**`capsules/v4/init.4th`**, a capsule like the others:
- It is in the kernel's directory, and `mkcapsule` checks, hashes and signs it.
- Its blocks are 8300 up, following physics.4th's 8200 range. The range is open for ruling.
**The loader runs it last.** It is loaded by name after `COLD`, on Hera, through the same loader as
the system capsules. It is the only boot policy, so the loader's one fixed step after POST is "load
`v4:init.4th`". The list before POST stays the loader's (MACHINE.md §5).
**What it does, in order, each step its own task, test first:**
1. **The search order:** `STARSHIPOS` first, then FORTH (ruled).
2. **Security on:**
- it loads the ACL policy, `ACL.fth` brought into `capsules/v4/` as a capsule;
- `ACL-BOOT` runs;
- `BIRTH` is pinned as the parent plan's Phase 4 asks (`CAPSULE-BIRTH` has no v4 counterpart:
to be ruled).
3. **The system a module and a node at a time:** births through Hera (`centre.4th`'s `BIRTH`).
Which nodes, and in what order, is for ruling. Today the kernel births none at boot.
4. **The prompt for whoever is logged in.** Today the identity gate and the prompt are the kernel's
C code. Moving them into `init.4th` is the largest step, and comes last.
## 4. How each step is verified (named before it is built)
- `test_mesh_boot.c` checks each step on the host, seen to fail first:
- for step 1, `S" ok" DOE` works at the prompt without naming `STARSHIPOS`;
- for step 2, a strict word refuses as `test_host_quit.c`'s ACL cases do.
- POST stays at 990/990 on all three ISAs. POST runs before `init.4th`, so it is unchanged.
- The protocol runs on a clean tree. `dict_hash` changes with each step's words, and the new value is
recorded each time.
## 5. For ruling, one at a time
1. Start with step 1 only (the search order), built and accepted, then step 2?
2. `init.4th`'s blocks: 8300 up?
3. `ACL.fth` into `capsules/v4/` as a capsule loaded by `init.4th`, or does `init.4th` carry the policy
itself?
4. `CAPSULE-BIRTH`: v4 has no such word. Is it pinned once it exists, or dropped?
5. Which nodes `init.4th` births at boot, and in what order.
6. Step 4: when the identity gate and the prompt move from C into `init.4th`.
## 6. Rulings so far (2026-11-18)
1. **Step 1 first** (the search order), each step accepted before the next.
2. **Held.** Asked where `init.4th`'s blocks go, Captain Bob answered: "It shouldn't matter. Capsules
should not occupy fixed ranges." Then: "Capsules are ephemeral. We need to talk later." This runs
against the tree as it is:
- every capsule's `Block NNNN` headers;
- `mkcapsule`'s check of them;
- the ranges in `BLOCK_MAP.md` and `experiments/bare_metal/README.md`.
It may also change what `init.4th` is: a capsule, or not. **Nothing of this design is built until
that conversation.**
## 7. Steps 1 and 2 built (2026-11-19)
**Ruled:** "ACL at boot", first of the new work after `v4.0.0-alpha.5`. The policy loads "From
init.4th", so `init.4th` comes off hold. The include is to be "Compose[d] in FORTH". Capsules are
ephemeral and placed by block (`2026-11-18-capsule-blocks.md`), which settles the hold.
**What is built:**
- **`capsules/v4/init.4th`**, at block 3980, so it lands at RAM 1932. It runs
`S" v4:ACL.4th" CAPSULE-INCLUDE` (security on), then `STARSHIPOS` (the search order). The order is
last-first because `ACL.4th` ends in `FORTH DEFINITIONS`.
- **`capsules/v4/ACL.4th`**: the policy, `git mv`ed from `v4/capsule/ACL.fth`. It is reflowed into
four 64×16 blocks chained with `-->` (3984–3987, landing at 1936), and its text is unchanged.
- **`CAPSULE-INCLUDE ( baddr u -- )`** in `centre.4th`, composed from `CAPSULE-OPEN` and
`CAPSULE-LINE`: the capsule is placed, and its lowest block is `LOAD`ed. It has a dictionary entry.
- **The mesh loads `v4:init.4th` after POST and `COLD`,** after the `PARITY:V4_SYSTEM` line, so that
line's `dict_hash` stays the sealed system's. This is the loader's one fixed step there.
- **`test_host_quit`** types `ACL.4th` as it types any capsule, skipping its `Block` and `-->` lines.
**Test first** (`logs/20261119-init-acl/`):
- `test_mesh_boot`: `init.4th`'s parity line; `DOE` found without naming `STARSHIPOS`; `ACL-BOOT`
and `ACL-RECHECK` pinned. The before-run failed.
- One false pass was found and corrected on the way. The two checks had first been placed after the
test's own `COLD`, where the search-order check passed only because the line before it named
`STARSHIPOS`. They now run straight after the boot.
**Results:**
- 113 checks pass, with POST 990/990.
- All 52 tests at 64 bits, test-32 and ASan/UBSan pass.
- The dictionary gate passes with 405 words.
- One amd64 kernel session passes 18/18, with "ACL: active" at boot.
**Still open, one at a time:** `BIRTH` pinned; the countdown "at call"; `CAPSULE-BIRTH`; births by
`init.4th`; the identity gate and the prompt moving from C into `init.4th`.