feat(v4): word accounts at call -- the word ID in the header, the kernel's records, the Stadium charged per tick (#189)

ENGINE step 4 Phase 2 (plan docs/v4.0.0/plans/2026-11-13-engine-step4-phase2-word-accounts.md). Rulings,
Captain Bob 2026-11-13: "ID field in the header"; "Per heartbeat tick"; the ACL "All of it in Phase 4".

- The word ID, at xt-4 before the flags (ENGINE.md 3b). The system's words are numbered as they are
  assembled, by a new directive, #id, (and #ids, the count), in the C assembler (text.c) and in the
  machine ROM's (capsules/v4/rom), which counts in the system's own (NEXT-ID). (HEADER) numbers later
  words; FORGET gives back the IDs it frees, always the newest; COLD resets to (BOOT-ID); (SEAL) records
  it. All 313 system headers carry the cell.
- The kernel's records (v4/mesh.h): (TELL-DEFINED) and (TELL-FORGOTTEN), requests -19/-20 on port 0,
  which the kernel puts in (WORD-DEFINED)/(WORD-FORGOTTEN) when it seals a node, and reads the system's
  own words once. A bit per address marks a word's xt (calls into the ROM or headerless code are not
  words); at call, the bit test and a count. v4_mesh_charge hands the owner the calls since.
- The Stadium: stadium_words_charge -- N calls as N of stadium_word_dispatch's dispatches, shared by calls
  when the reservoir is short; sk_v4.c charges every node's words at the tick beside its opcodes, and
  stadium_word_forget before an ID is used again.
- Tests first: test_text.c, test_host_dict.c, test_host_quit.c (numbering, FORGET, COLD),
  test_mesh_boot.c (44 checks), kernel/tests/test_stadium_words.c; qemu_session.py: Hera's words
  admitted after POST.
- amd64: Stadium words: promotions=141 after POST, CONSERVED; POST 539/539; word_count=377;
  dict_hash 0xa854ba15b437d288 (the new cell); the boot 142 s against Phase 1's 153 s.
- v4 test, test-32: all pass; v4-checks: 80 programs under the sanitizers, 0 failures; the hosted
  builds alike. docs/reference/v4-dictionary.tsv: the two new words; FABRIC-3 XLVIII.24.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
Claude
2026-11-13 19:12:44 +00:00
parent d64ad4a1c3
commit e8e7ec8b9f
44 changed files with 1060 additions and 349 deletions
+23
View File
@@ -6646,3 +6646,26 @@ and memorize frequently so we can pick up where we left off").
it `6 7 * .`, it answers 42; `11 KILL`; the Stadium CONSERVED after.
- **Next:** Phase 2, the word accounts at `call` -- the kernel's record per word, fed by the hook
(A1); then Phase 7, the loops on those records. And retiring v3 as a boot target (#156).
### 24. #189 Phase 2: the word accounts at `call` (2026-11-13)
- **Rulings** (plan `2026-11-13-engine-step4-phase2-word-accounts.md`): the word ID is "ID field in
the header"; words are charged "Per heartbeat tick", as the opcodes are; the ACL is "All of it in
Phase 4".
- **The ID** sits at xt−4, before the flags. The system's words are numbered as they are assembled,
by a new directive, `#id,`, in both assemblers: the C one, and the machine ROM's, which counts in
the system's own `(NEXT-ID)`, zero when the machine starts. `(HEADER)` numbers later words. FORGET
removes the newest entries, so it frees the highest IDs; it sets `(NEXT-ID)` back, and they are
used again, as v3 recycles its word IDs. COLD goes back to the system's count.
- **The records.** The node tells the kernel of each entry made and gone (`ENGINE.md` 3b): two system
words, `(TELL-DEFINED)` and `(TELL-FORGOTTEN)`, send requests −19 and −20 on port 0. The kernel
puts them in `(WORD-DEFINED)`/`(WORD-FORGOTTEN)` when it seals a node, and reads the system's own
words once. One bit per address marks a word's xt, since calls to the ROM and to headerless code
are not words. At `call`, the bit is tested and the record counts one. Once a tick, the calls since
are charged to the Stadium (`stadium_words_charge`: N dispatches at once, shared by calls when the
reservoir runs short). FORGET makes the Stadium forget the patron before its ID is used again.
- **Seen on amd64:** after POST, `Stadium words: promotions=141`, CONSERVED; POST 539/539;
`word_count=377` (the two telling words); `dict_hash` changed once, for the new cell. The boot took
142 s against Phase 1's 153 s: no measurable cost.
- **Next:** Phase 7, the loops on these records (decay, the rolling window, pipelining, inference,
L8).