Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/patches/490f7c39b6e935f0 # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers ## GitHub aien-dev/omega-mv#276 (code only) closed derived `490f7c39b6e935f0` #276 Imported from GitHub aien-dev/omega-mv#276 (code only) GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed). Base `e5593ae488fcb9038557a4317a07faa7625649a3` · Head `8edf719e5199e586dad97b6fee5e9b554ceb0448` greptile-apps[bot] reviewed (COMMENTED) on 2026-10-05 00:55 UTC `aien-dev` has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan . ### Apply it ``` git checkout -b patch-490f7c39b6e935f0 e5593ae488fcb9038557a4317a07faa7625649a3 curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/490f7c39b6e935f0.patch | git am ``` Raw patch (mbox) · Diff ### Provenance This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record: ``` github-import 1 aien-dev/omega-mv 276 8edf719e5199e586dad97b6fee5e9b554ceb0448 ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":276,"url":"https://github.com/aien-dev/omega-mv/pull/276","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:37:05Z","metadata":"unavailable","state_derived":true} ``` ### Changes ``` diff --git a/.crumb b/.crumb index 719434c79..8caab4d7f 100644 --- a/.crumb +++ b/.crumb @@ -46,74 +46,74 @@ "children": [ { "digest": "fb7cc6e608fdbe68a9735a1313285782b9717ff12bde17343f8ce635de3644f6", - "last_commit": "190ff89", + "last_commit": "e5593ae", "name": "calibration", "purpose": "Directory calibration. Purpose not yet described by a human." }, { "digest": "1c478a7e59b6a030f35f00356f51098708307326e8bd7127d99573e98666b395", - "last_commit": "d12d012", + "last_commit": "e5593ae", "name": "docs", "purpose": "Directory docs. Purpose not yet described by a human." }, { "digest": "536f7b8db9a92a1f586bad4379d47544a30d1b8e83c2d799c18e66cf8660c9ae", - "last_commit": "30bb116", + "last_commit": "e5593ae", "name": "doctrine", "purpose": "Directory doctrine. Purpose not yet described by a human." }, { - "digest": "25dc918988768c936cdd41410a68c18df3c9acf7cd129812bc030c6a070cc67c", - "last_commit": "55d05d6", + "digest": "811fd855f6612b42add339ac1a962c1019fc98130431fc36c6a1558de144a677", + "last_commit": "cda7609", "name": "mk", "purpose": "Directory mk. Purpose not yet described by a human." }, { "digest": "69cbb8ef13ccce47ccc21f159e95f1eac58679319e2cc25937065f95c4eb9207", - "last_commit": "ae8c7c5", + "last_commit": "e5593ae", "name": "polyglot", "purpose": "Directory polyglot. Purpose not yet described by a human." }, { "digest": "8178197a3e956890d6194e5b4fcc0e0b5c4ec67b0749f0d257f2ed17c8ca7465", - "last_commit": "559f6e5", + "last_commit": "e5593ae", "name": "research", "purpose": "Directory research. Purpose not yet described by a human." }, { - "digest": "d5679d8778eb43619435d19dbd5ad0263b6f64d4e52e20787a0599836bcfc6b7", - "last_commit": "40d1ea3", + "digest": "032680dfce130753a0c00794f741e4b3fb920d39b32342db6a9862609ae0a392", + "last_commit": "cda7609", "name": "spec", "purpose": "Directory spec. Purpose not yet described by a human." }, { - "digest": "be4a15a5245076828c97b151dd4ed1cc891c7dc5f22aee9ffdd0d93fb430e720", - "last_commit": "d12d012", + "digest": "23594466e1a262dae0896b5b679603e24ec7b149cc0f29542ecb017175d54839", + "last_commit": "cda7609", "name": "src", "purpose": "Directory src. Purpose not yet described by a human." }, { - "digest": "58368f55fc201ea01917bd941190d00de8e40f4e5b161525d48d03eac877084e", - "last_commit": "d12d012", + "digest": "14a5005df7f8959b4d7cd589771f7aed8a731730fe3eaace565a6e9d215eb790", + "last_commit": "cda7609", "name": "tests", "purpose": "Directory tests. Purpose not yet described by a human." }, { - "digest": "1a6281ce3f92b5e68d0709eab039f9852df5e7132493e2e12f90f7ff495560d1", - "last_commit": "d12d012", + "digest": "930b5dff91263f123b3da0fb667cb12d2710aae636609e9561d961ef3c16d1a4", + "last_commit": "cda7609", "name": "tools", "purpose": "Directory tools. Purpose not yet described by a human." } ], - "children_root": "sha256:3dfdebd3b8a90fadcdc4cdf89c37d7939bfe585c8c3146736b41614ed8d4db47", - "compiled_at": "2026-10-04T19:57:41Z", + "children_root": "sha256:789ce8e6aab90408b91294e5a23f441c903841254257f551de4f82b26bac5edf", + "compiled_at": "2026-10-05T01:27:55Z", "compiler": "crumb-compile/1", - "digest": "sha256:ef305ccd639ab0ae01d1bd7d341ec115dc0e3abf98e84293a73fb0482b17d5fa", - "evidence_files": 1289, - "evidence_root": "sha256:748eb7ce0bd377815585505582eb76663350e35af3d876a488897ceea120ba3f", - "files": 3049, - "generated_at_commit": "d12d012a763f44ebb367431497eaf727256b25a8", - "source_tree": "sha256:89fe46eed931e5dda00562ec210c6f07446d0bdd5444742f372a3d16f17730a4" + "digest": "sha256:0baf05827d1fd3581213e977191930688cd951e06831f5a4afe78031610291ed", + "evidence_files": 1291, + "evidence_root": "sha256:db1b77b82b1820add74787f5b00eac795e2358b49b6b4a5db87cf95d1c56c380", + "files": 3057, + "generated_at_commit": "6b7816530f1e01786705531bae6b2e6d7497ad0a", + "source_tree": "sha256:442f8cbdf8df6beb1c1bd03dd191ebbef05ea98f2c4a0cac926c33cc3db57fcd" }, "owner_lane": "", "provenance": { diff --git a/.github/workflows/host-suites-2.yml b/.github/workflows/host-suites-2.yml index c7e145d76..06403a357 100644 --- a/.github/workflows/host-suites-2.yml +++ b/.github/workflows/host-suites-2.yml @@ -23,7 +23,7 @@ name: Host suites 2 # test-ma-digital-bottom 3.5 min # path : test-path 30 s; crumbline : test-crumbline 1 s # runtime : test-r15-instr test-r15-receipt test-r16-inventory -# test-r16-negative test-r16-surface test-r16-qualify-selftest +# test-r16-negative test-r16-surface test-r16-qualify-selftest test-allen # test-r16-negative-mutants 5 min (Spark: 4.3 min) # argus : test-argus-runtime test-machine-identity-argus # numeric2 : test-numeric-reduce-cpu test-divsqrt-host 6 s @@ -144,7 +144,7 @@ jobs: sel algebra "^src/(algebra|turing)/|^tests/algebra/|^src/(omega_canonical|omega_types|sha256)\.|^evidence/MIXED_ALGEBRA/" sel path "^src/path/|^tests/path/|^src/(omega_types|sha256)\." sel crumbline "$core|^src/crumbline/|^tests/crumbline/|^tools/crumbline_learner\.c$|^data/crumbline/|^tests/(test_omega_[a-z_]+\.c|vc_fixture\.h|genesis_variant/)|^docs/osc/VC-GENESIS-1\.md$" - sel runtime "$core|^src/(runtime|fabric)/|^tests/runtime/|^mk/fabric\.mk$|^tests/(r15_receipt_test\.sh|r16_[a-z_]+/)|^tools/(r15_|r16_|omegatool\.c)|^spec/r16-|^docs/r16-|^evidence/R15/|^(physics|aienos)\.lock$" + sel runtime "$core|^src/(runtime|fabric)/|^tests/runtime/|^mk/fabric\.mk$|^tests/(r15_receipt_test\.sh|r16_[a-z_]+/)|^tools/(r15_|r16_|omegatool\.c|allen\.c)|^spec/(r16-|allen\.md)|^docs/r16-|^evidence/(R15|ALLEN)/|^src/allen/|^tests/allen/|^mk/allen\.mk$|^(physics|aienos)\.lock$" sel argus "^src/runtime/|^tests/runtime/|^tests/bench_rx_argus\.c$|^mk/machine-identity\.mk$|^src/(sha256|omega_evidence)\.|^(physics|aienos|argus)\.lock$" sel numeric2 "^tests/(test_omega_reduce|test_omega_divsqrt_gb10)\.c$|^tests/numeric_oracle\.h$|^src/(omega_numeric|omega_blackwell_(encoder|codegen|matmul|qmd)|sha256)" sel tensor "^tools/m20_receipt(_mutations)?\.sh$|^tests/test_m20_receipt\.sh$|^tests/fixtures/m20_receipt/|^src/tensor/|^tests/test_omega_tensor(_store)?\.c$|^tools/tensor_mutations\.sh$|^mk/tensor\.mk$|^src/(omega_numeric|omega_blackwell_(encoder|codegen|matmul|qmd)|sha256)" @@ -334,6 +334,12 @@ jobs: - name: R16 qualify script self-test (dirty tree refused, NOT_RUN honest, failing check exits non-zero) if: ${{ !cancelled() }} run: make test-r16-qualify-selftest + - name: ALLEN v0 host gates (identity, restart, memory, model independence, no authority, negative control) + if: ${{ !cancelled() }} + env: + PHYSICS_DIR: ${{ github.workspace }}/physics-src + AIENOS_R7_DIR: ${{ github.workspace }}/aienos-src + run: make test-allen argus: needs: changes diff --git a/aienos.lock b/aienos.lock index 433ac3641..16510ba71 100644 --- a/aienos.lock +++ b/aienos.lock @@ -1 +1 @@ -d39dd5bc3deb1a24e26a5059477a1342c110c71b +71d5b326eea6a330f3cc1c4377fc4bc2d134d5aa diff --git a/evidence/ALLEN/18cfa250cee91ce5abe4cba21fa9fb70da4df36b9b593924b86538dcdfdfabef.json b/evidence/ALLEN/18cfa250cee91ce5abe4cba21fa9fb70da4df36b9b593924b86538dcdfdfabef.json new file mode 100644 index 000000000..032da4511 --- /dev/null +++ b/evidence/ALLEN/18cfa250cee91ce5abe4cba21fa9fb70da4df36b9b593924b86538dcdfdfabef.json @@ -0,0 +1,49 @@ +{ + "schema": "AIEN_ALLEN_V0_HOST_GATES_V0", + "program": "ALLEN v0 (ARCH-0035 PROPOSED, OS-0018 PROPOSED)", + "run_id": "20261005T012749Z-6b7816530f1e-host", + "outcome": "PASS", + "purpose": "re-qualification after aienos#259 merged: binds the ALLEN v0 host result to the merged AIENOS commit (supersedes nothing; the earlier receipt 83c62a41... bound to the PR head cd4b089 stays as recorded)", + "candidate_commit": "6b7816530f1e01786705531bae6b2e6d7497ad0a", + "candidate_bound": true, + "tree_dirty": false, + "aienos_commit": "71d5b326eea6a330f3cc1c4377fc4bc2d134d5aa", + "aienos_lock": "71d5b326eea6a330f3cc1c4377fc4bc2d134d5aa", + "aienos_merge": "https://github.com/aien-dev/aienos/pull/259 squash-merged as 71d5b326eea6a330f3cc1c4377fc4bc2d134d5aa", + "gates": { + "G1": "PASS", + "G2": "PASS", + "G3": "PASS", + "G4": "PASS", + "G5": "PASS", + "G6": "PASS", + "FORMAT": "PASS", + "REPLAY": "PASS", + "SUPERSEDE": "PASS", + "MISMATCH": "PASS" + }, + "subject_id": "47a2bdffce0ce6d0fc05d248cfb09eb7dc672b2a246e51adf73ae555f0656127", + "intent_id": "a12e4b24f3857e8d49ba3c01babe968de898579d86c2a6e8ddc8fe6bfdb49dbf", + "lineage": "e3f241da5ea18408653a70e3691653db216b5dcc51169b799827cf4f2699731b", + "negative_control": { + "journal_records_after_publish": 15, + "goals_without_allen": 0 + }, + "r16_loop_inventory": { + "omega_head": "6b7816530f1e01786705531bae6b2e6d7497ad0a", + "omega_sites": 256, + "new_sites_from_allen": 0, + "result": "FAIL", + "note": "FAIL is pre-existing and identical to main: 76 unclassified sites and 2 stale rows in the local survey checkouts of other repos; 0 sites in ALLEN files" + }, + "not_run": [ + "AIENOS-native provisioning", + "QEMU cold restart", + "hardware qualification", + "OS reboot", + "machine migration" + ], + "scope": "host processes and files on one machine; not hardware qualification, not an OS reboot, not a machine migration", + "test_binary_sha256": "8b05208a74691cb23f05dde76282967e60fde6e7eb667dabdaf9b09382e1e48d", + "host": "Linux 7.0.0-1019-nvidia aarch64" +} diff --git a/evidence/ALLEN/83c62a41f0252d4b00de78dcad280b78827821c1181e0b02a0690403b8b4f085.json b/evidence/ALLEN/83c62a41f0252d4b00de78dcad280b78827821c1181e0b02a0690403b8b4f085.json new file mode 100644 index 000000000..d3a42a29a --- /dev/null +++ b/evidence/ALLEN/83c62a41f0252d4b00de78dcad280b78827821c1181e0b02a0690403b8b4f085.json @@ -0,0 +1,48 @@ +{ + "schema": "AIEN_ALLEN_V0_HOST_GATES_V0", + "program": "ALLEN v0 (ARCH-0035 PROPOSED, OS-0018 PROPOSED)", + "run_id": "20261005T005513Z-cda7609d07b3-host", + "outcome": "PASS", + "candidate_commit": "cda7609d07b3871242f7f8c2e81ffec033d87735", + "candidate_bound": true, + "tree_dirty": false, + "aienos_commit": "cd4b0892768def4be6417075f0443e78745a6c28", + "aienos_lock": "cd4b0892768def4be6417075f0443e78745a6c28", + "aienos_pr": "https://github.com/aien-dev/aienos/pull/259", + "gates": { + "G1_identity_binding": "PASS", + "G2_restart_persistence_process": "PASS", + "G3_memory_binding": "PASS", + "G4_model_independence": "PASS", + "G5_no_authority_no_orchestrator": "PASS", + "G6_negative_control": "PASS", + "FORMAT_refusals": "PASS", + "REPLAY": "PASS", + "SUPERSEDE": "PASS", + "MISMATCH": "PASS" + }, + "aienos_gates_recorded_not_rerun": { + "test_continuity_subject": "PASS (150 checks) at aienos cd4b0892768def4be6417075f0443e78745a6c28", + "CK_CONTINUITY_SUBJECT_RESTART": "PASS (two processes, one sealed Store image)", + "CK_CONTINUITY_SUBJECT_MUTANTS": "PASS (4 mutants red; refused under CK_HARDWARE_STAGING)" + }, + "subject_id": "47a2bdffce0ce6d0fc05d248cfb09eb7dc672b2a246e51adf73ae555f0656127", + "intent_id": "a12e4b24f3857e8d49ba3c01babe968de898579d86c2a6e8ddc8fe6bfdb49dbf", + "lineage": "e3f241da5ea18408653a70e3691653db216b5dcc51169b799827cf4f2699731b", + "negative_control": { + "journal_records_after_publish": 15, + "goals_in_restarted_world_without_allen": 0, + "goals_after_publish_with_allen": 1, + "verdict": "the standing intent does NOT survive a restart through Cortex alone; ALLEN is load-bearing" + }, + "r16_loop_inventory": { + "omega_sites_main": 256, + "omega_sites_branch": 256, + "new_sites_from_allen": 0, + "note": "tools/r16_loop_inventory.sh on this host reports FAIL for pre-existing reasons identical on main (76 unclassified sites in the local survey checkouts, 2 stale rows); ALLEN adds no site" + }, + "not_run": ["QEMU cold restart", "hardware qualification", "OS reboot", "machine migration"], + "scope": "host processes and files on one machine; not hardware qualification, not an OS reboot, not a machine migration", + "test_binary_sha256": "8b05208a74691cb23f05dde76282967e60fde6e7eb667dabdaf9b09382e1e48d", + "host": "Linux 7.0.0-1019-nvidia aarch64" +} diff --git a/mk/.crumb b/mk/.crumb index 3f9d87990..26af8e290 100644 --- a/mk/.crumb +++ b/mk/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-04T18:54:28Z", + "compiled_at": "2026-10-05T00:54:08Z", "compiler": "crumb-compile/1", - "digest": "sha256:25dc918988768c936cdd41410a68c18df3c9acf7cd129812bc030c6a070cc67c", + "digest": "sha256:811fd855f6612b42add339ac1a962c1019fc98130431fc36c6a1558de144a677", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 52, - "generated_at_commit": "500a510f818ce4b973f4862c96e9361b9c450890", - "source_tree": "sha256:33ab9148ac46504fa4ff3e51dd4472de84552d8ab5f7e8b8535fb560b85c5058" + "files": 53, + "generated_at_commit": "e5593ae488fcb9038557a4317a07faa7625649a3", + "source_tree": "sha256:5d5b048918da3ea46322f20c9b4fc3d18d00e5b112e02df0813e30b179be83af" }, "owner_lane": "", "provenance": { diff --git a/mk/allen.mk b/mk/allen.mk new file mode 100644 index 000000000..44530fa07 --- /dev/null +++ b/mk/allen.mk @@ -0,0 +1,70 @@ +# ALLEN v0 (ARCH-0035 PROPOSED, OS-0018 PROPOSED): the durable subject inside +# the AIEN organism. Picked up by `-include mk/*.mk`. New files only: +# src/allen/allen_bind.{c,h}, tools/allen.c, tests/allen/run.sh, spec/allen.md. +# Nothing here touches src/runtime; rx_aien.o is the same object R11 links. +# +# The subject object codec is the AIENOS one (native/kernel/svc/ +# continuity_subject.c at aienos.lock), compiled here from $(AIENOS_R7_DIR): +# omega never redefines the format. The default extraction (Makefile, R7) only +# takes native/capability, so $(ALLEN_STAMP) extends it with the four trees +# the codec needs. +# +# mk/*.mk is read before the Makefile defines OUT_DIR-derived R7 variables +# (AIENOS_R7_DIR, AIENOS_LOCK, RX_AIEN_OBJ, AIENOS_CAP_LIB), so every +# prerequisite that depends on them is written $$(...) and expanded in the +# second phase (as polyglot.mk does). Recipes expand late anyway. +# +# test-allen: tests/allen/run.sh runs gates G1..G6 (identity, restart, +# memory, model independence, no authority / no loop, negative control) plus +# the refusals (unknown version, corruption, replay, supersession, subject +# mismatch, model mismatch tolerance) and writes nothing outside $(ALLEN_DIR). +.PHONY: test-allen allen +.SECONDEXPANSION: +ALLEN_DIR = $(OUT_DIR)/allen +ALLEN_TOOL = $(ALLEN_DIR)/allen +ALLEN_BIND_OBJ = $(ALLEN_DIR)/allen_bind.o +ALLEN_MAIN_OBJ = $(ALLEN_DIR)/allen.o +ALLEN_STAMP = $(ALLEN_DIR)/aienos-tree.stamp +ALLEN_AIENOS_SVC = $(AIENOS_R7_DIR)/native/kernel/svc +# kernel/core is -idirafter: it holds a sched.h that must not shadow . +ALLEN_AIENOS_INC = -I$(ALLEN_AIENOS_SVC) -idirafter $(AIENOS_R7_DIR)/native/kernel/core \ + -I$(AIENOS_R7_DIR)/native/argus -I$(AIENOS_R7_DIR)/native/store +# One sha256: omega's src/sha256.c (same ctx layout and names as native/argus). +ALLEN_AIENOS_SRCS = $(ALLEN_AIENOS_SVC)/continuity_subject.c $(ALLEN_AIENOS_SVC)/continuity_codec.c \ + $(AIENOS_R7_DIR)/native/store/store_v1.c +ALLEN_RX_SRCS = src/runtime/rx_caproot.c src/runtime/rx_world.c src/runtime/rx_coherent.c \ + src/runtime/rx_native_bind.c src/runtime/rx_cortex.c src/runtime/rx_cortex_record.c \ + src/sha256.c +ALLEN_HDRS = src/allen/allen_bind.h src/runtime/rx_aien.h src/runtime/rx_world.h \ + src/runtime/rx_cortex.h src/runtime/rx_cortex_record.h src/runtime/aienos_cap.h + +# The aienos trees the codec needs, at aienos.lock (same shape as the +# $(AIENOS_CAP_LIB) rule). The stamp records the lock it was made for. +$(ALLEN_STAMP): aienos.lock + @mkdir -p $(ALLEN_DIR) + @if [ "$(AIENOS_R7_DIR)" = "$(AIENOS_R7_DEFAULT)" ] && [ ! -f "$(ALLEN_AIENOS_SVC)/continuity_subject.h" ]; then \ + git -C $(AIENOS_LOCK_REPO) cat-file -e $(AIENOS_LOCK)^{commit} 2>/dev/null || { \ + echo "aienos.lock commit $(AIENOS_LOCK) is not in AIENOS_LOCK_REPO=$(AIENOS_LOCK_REPO)"; exit 1; }; \ + mkdir -p "$(AIENOS_R7_DIR)" && \ + git -C $(AIENOS_LOCK_REPO) archive $(AIENOS_LOCK) native/kernel/svc native/kernel/core native/argus native/store \ + | tar -x -C "$(AIENOS_R7_DIR)"; \ + fi + @test -f "$(ALLEN_AIENOS_SVC)/continuity_subject.h" || { \ + echo "AIENOS_R7_DIR=$(AIENOS_R7_DIR) has no native/kernel/svc/continuity_subject.h (aienos.lock too old?)"; exit 1; } + @echo "$(AIENOS_LOCK)" > $@ + +$(ALLEN_BIND_OBJ): src/allen/allen_bind.c $(ALLEN_HDRS) $(ALLEN_STAMP) + $(CC) $(CFLAGS) $(ALLEN_AIENOS_INC) -c -o $@ src/allen/allen_bind.c + +$(ALLEN_MAIN_OBJ): tools/allen.c $(ALLEN_HDRS) src/runtime/rx_omega.h $(ALLEN_STAMP) + $(CC) $(CFLAGS) $(ALLEN_AIENOS_INC) -c -o $@ tools/allen.c + +$(ALLEN_TOOL): $(ALLEN_MAIN_OBJ) $(ALLEN_BIND_OBJ) $$(RX_AIEN_OBJ) $(ALLEN_RX_SRCS) $$(ALLEN_AIENOS_SRCS) $$(AIENOS_CAP_LIB) $(ALLEN_STAMP) + $(CC) $(CFLAGS) $(ALLEN_AIENOS_INC) -pthread -o $@ $(ALLEN_MAIN_OBJ) $(ALLEN_BIND_OBJ) $(RX_AIEN_OBJ) \ + $(ALLEN_RX_SRCS) $(ALLEN_AIENOS_SRCS) $(AIENOS_CAP_LIB) -lm + +allen: $(ALLEN_TOOL) + +test-allen: $(ALLEN_TOOL) + ALLEN_TOOL=$(ALLEN_TOOL) ALLEN_BIND_OBJ=$(ALLEN_BIND_OBJ) ALLEN_MAIN_OBJ=$(ALLEN_MAIN_OBJ) \ + ALLEN_OUT=$(ALLEN_DIR)/run sh tests/allen/run.sh diff --git a/spec/.crumb b/spec/.crumb index d86a8cf6e..ceb5f9483 100644 --- a/spec/.crumb +++ b/spec/.crumb @@ -14,20 +14,20 @@ "children": [ { "digest": "851e0dc0f5a16f7b103752ff2da976003f56c2d2a53c1e82c3a770eadad83111", - "last_commit": "f3467db", + "last_commit": "e5593ae", "name": "searchtrace", "purpose": "Directory spec/searchtrace. Purpose not yet described by a human." } ], "children_root": "sha256:6834a3241647d3a098283d4eafedbdb1428dfa4d834f9ed5f22025b6d2303093", - "compiled_at": "2026-10-04T13:47:05Z", + "compiled_at": "2026-10-05T00:54:08Z", "compiler": "crumb-compile/1", - "digest": "sha256:d5679d8778eb43619435d19dbd5ad0263b6f64d4e52e20787a0599836bcfc6b7", + "digest": "sha256:032680dfce130753a0c00794f741e4b3fb920d39b32342db6a9862609ae0a392", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 54, - "generated_at_commit": "834ee93e4314a42c1127a2fcda8b29cf3b511245", - "source_tree": "sha256:5c41f2bc8a63fe9cb1047856381bd6aef3d3cdd38b71b6b1e399e604921395f6" + "files": 55, + "generated_at_commit": "e5593ae488fcb9038557a4317a07faa7625649a3", + "source_tree": "sha256:1913ef7188eeb53a669566710eaa2b2a136f7c30d565a0542250fd5110116273" }, "owner_lane": "", "provenance": { diff --git a/spec/allen.md b/spec/allen.md new file mode 100644 index 000000000..8506119c5 --- /dev/null +++ b/spec/allen.md @@ -0,0 +1,90 @@ +# ALLEN v0: the durable subject inside the organism (omega side) + +Status: SPECIFIED + IMPLEMENTED + TESTED (host). Architecture: ARCH-0035 +(aien-architecture, PROPOSED). Format: aienos ADR 0018 (PROPOSED), continuity +kind 24. Nothing here is QUALIFIED on hardware, and no OS reboot or machine +migration is claimed. + +## 1. What ALLEN is here + +AIEN is the organism (the resident World, its faculties, its Cortex) and the +cognitive faculty inside it (`src/runtime/rx_aien.*`, "AIEN PROPOSES"). ALLEN +is the durable subject the organism sustains: the same agent identity, the +same standing intents and the same memory lineage, resolved from the AIENOS +Store after any restart. ALLEN is state. It has no cognition, no authority and +no loop. + +Omega holds the three bindings and nothing else (`src/allen/allen_bind.{c,h}`): + +1. **identity**: the subject object carries the LogicalAgentId and the AgentRoot + id the Store already has. Omega recomputes the object's content id and + records the World's external subject number against that agent (the + binding record). No `AllenId` exists. +2. **memory**: the subject's Cortex lineage reference must equal the digest of + record 1 of the Cortex journal it is run with (ARCH-0022 journal), or + nothing is published. Fail closed. +3. **intent**: each ACTIVE standing intent of kind GOAL_LATENCY becomes the goal + mutation the resident AIEN faculty already reads (`rx_aien.h`: goal = + {seq, regime, target ns}; field 3 = the intent id's first 64 bits, so the + EXTERNAL crumb names the intent it came from). + +## 2. R16 (binding) + +ALLEN publishes typed state through `rx_world_publish_external` under the +World's external subject capability. The World's dependency machinery wakes +`aien.assess` because the goal object changed. ALLEN never calls a faculty, +never registers a reaction, never polls, never sleeps, has no thread, no +timer, no `max_turns`. Gate G5 checks the symbol tables of `allen_bind.o` and +`allen.o` and the source for loop words; the cross-repo loop inventory +(R16-G2, `make test-r16-inventory`) covers the committed tree. + +## 3. The host tool (`tools/allen.c`) + +Inspection and qualification only: not a chat, not an agent runtime, not a +planner, not a daemon, not a Visor, not an operator shell. Verbs: `make` +(test fixture writer; in production the object is committed by the AIENOS +kernel), `inspect`, `digest`, `lineage`, `seed-journal`, `publish` (the +R11 part-A rig: capability root, World, resident AIEN faculty; checks the +memory binding, publishes every ACTIVE intent, waits for quiescence, prints +what AIEN did), `probe` (the same rig started **without** ALLEN). + +The subject codec is compiled from the aienos tree at `aienos.lock` +(`mk/allen.mk`); omega never redefines the format. + +## 4. Gates (`tests/allen/run.sh`, `make test-allen`) + +| gate | claim | how | +|---|---|---| +| G1 identity binding | the subject id is content-addressed and bound to the LogicalAgentId; another agent gives another id | two makes with the same content give one id; agent B gives another; the binding line names agent A | +| G2 restart persistence | a second process restores the same subject id, intent id and goal, and AIEN assess wakes again | publish, exit, publish | +| G3 memory binding | a subject acts only with its own journal | another journal, an unbound subject and an empty journal are refused before any publish | +| G4 model independence | two model digests and no model at all give the same subject, intent and goal; the object bytes do not change and contain no model | `--model X`, `--model Y`, none | +| G5 no authority, no orchestrator | no thread/wait/timer/signal/reaction/mint symbols in `allen_bind.o`; none of thread/timer/signal/reaction/fork in `allen.o`; no loop words in source | `nm -u`, grep | +| G6 negative control | without ALLEN the restarted World holds 0 goals although the journal holds every record of the publish; with ALLEN the goal is back | publish, probe, publish. **If probe shows a goal, ALLEN is redundant and the gate FAILS ALLEN.** | +| FORMAT | unknown version, corrupted agent/intent, truncation, trailing bytes, unknown origin refused; nothing published | byte patches | +| REPLAY | the same bytes are the same subject every time | ids compared across runs | +| SUPERSEDE | two intents in one slot: the old one SUPERSEDED, only the new one published | `--intent 7,1000 --intent 7,2000` | +| MISMATCH | another agent's object binds as another subject | agent B | + +The aienos half (foreign root/agent refusal at the Store resolver, two-process +restart over one sealed Store image, mutants) runs in the aienos tree +(`make -C native/kernel test test-continuity-subject-restart continuity-subject-mutants`) +and is recorded, not re-run, here. + +## 5. Status table + +| | status | +|---|---| +| same subject identity across process restart | TESTED (host) | +| same standing intent across process restart | TESTED (host) | +| same Cortex binding across process restart | TESTED (host) | +| model replacement (X, Y, none) | TESTED (host) | +| OS reboot | NOT_RUN | +| machine migration | NOT_RUN (not claimed) | +| hardware qualification | NOT_RUN | +| multi-subject | FUTURE, NOT IMPLEMENTED (format does not preclude) | +| intents other than GOAL_LATENCY | FUTURE | +| production path (kernel commits the object; organism boot reads it) | PLANNED; v0 proves the contract on the host rig | + +INTERPLANE IMPACT: NONE (no wire change; ALLEN is Store state and World +publication, not a protocol). diff --git a/src/.crumb b/src/.crumb index 7610e4927..8dae5fc2c 100644 --- a/src/.crumb +++ b/src/.crumb @@ -62,122 +62,122 @@ "children": [ { "digest": "e999ad5d79b28e45cf3c87fca942087088f243bdfd0e55da7948eb5d6e619460", - "last_commit": "7350a61", + "last_commit": "e5593ae", "name": "algebra", "purpose": "Directory src/algebra. Purpose not yet described by a human." }, { "digest": "24b48531671e1ad40c520571c43aa6fa8dfe43ce7139a5724f31afa9f8411afd", - "last_commit": "834ee93", + "last_commit": "e5593ae", "name": "ans", "purpose": "ANS (Alignment Navigation System), Inertial Alignment v1: frozen reference atoms, drift filter o" }, { "digest": "5b110f4a6136ebd3d6703590962b7beed9f8cec034c2d12944b1590434e3c747", - "last_commit": "d48ab89", + "last_commit": "e5593ae", "name": "autodiff", "purpose": "M21 OMEGA_AUTODIFF: reverse-mode tape over M20 tensor CPU ops, caller-owned nodes and scratch, p" }, { "digest": "ec640bd4bee9e58c18ca807acae07111ce4e980306fbb6c34f18110eed830b3a", - "last_commit": "dce821c", + "last_commit": "e5593ae", "name": "compiler", "purpose": "Directory src/compiler. Purpose not yet described by a human." }, { "digest": "41faf68aa92b4f16b40243239e1866110a443ce284ff9f7ec3b125b289bcd845", - "last_commit": "3c82389", + "last_commit": "e5593ae", "name": "crumbline", "purpose": "Directory src/crumbline. Purpose not yet described by a human." }, { "digest": "945ae745a338467614bee287efb628f38f53ad83e4842c1a7fbf7d0b91a8da57", - "last_commit": "00f54b6", + "last_commit": "e5593ae", "name": "dual_experiment", "purpose": "DUAL applicability experiment library (ARCH-0031 offline evidence lane): deterministic discrete " }, { "digest": "62a0884e7f075eb3c92b22fc400234a06bd8c3020fc75e55a9b0c0f0f6a26d7e", - "last_commit": "1a147e4", + "last_commit": "e5593ae", "name": "estimation", "purpose": "Directory src/estimation. Purpose not yet described by a human." }, { "digest": "330c407ff51bfd684e062707c055f58f325f5af16fe9764889aec3a7ffeb31ac", - "last_commit": "3108fc2", + "last_commit": "e5593ae", "name": "fabric", "purpose": "Directory src/fabric. Purpose not yet described by a human." }, { "digest": "3bdcb211108a4fdc33550b2c54df3167dd15d4a5fe004eefbcef11b489d0e27a", - "last_commit": "71c6ff8", + "last_commit": "e5593ae", "name": "language", "purpose": "Directory src/language. Purpose not yet described by a human." }, { "digest": "8383106b5d1b3adbc44b8e837a5d1f5ff6699a6d54070068e36716b2a32390d5", - "last_commit": "d550b70", + "last_commit": "e5593ae", "name": "path", "purpose": "Directory src/path. Purpose not yet described by a human." }, { "digest": "6974fb2a6051d3a1b07153ced8cddc6a81d04a79d229b5c9a18e00f7d2c55d25", - "last_commit": "965edfb", + "last_commit": "e5593ae", "name": "physics0", "purpose": "PD-0 hidden-equation benchmark (Physics-0 Discovery Engine cut 1): world, oracle, scorer, ladder" }, { "digest": "c43b60db4a5183a3ca59c2e24a0978f463e8ac3aa7a2ed0c54947eb085c4eb9e", - "last_commit": "3ef4f69", + "last_commit": "e5593ae", "name": "polyglot", "purpose": "Directory src/polyglot. Purpose not yet described by a human." }, { "digest": "779e416daad95fc928a9217a06a2897d29930df83b61423d2496fb71f7c42355", - "last_commit": "3a3144d", + "last_commit": "e5593ae", "name": "runtime", "purpose": "Directory src/runtime. Purpose not yet described by a human." }, { "digest": "9f6d98a6d9b0020aa56df481a5ab3aa301533cb85173f96a851d1d779fca2d3a", - "last_commit": "5ae192a", + "last_commit": "e5593ae", "name": "searchtrace", "purpose": "Directory src/searchtrace. Purpose not yet described by a human." }, { "digest": "ae63793b7b13442e349e438229fccf6a859a5be55343cdd997e35f2966c1157c", - "last_commit": "f633e34", + "last_commit": "e5593ae", "name": "tensor", "purpose": "M20 OMEGA_TENSOR: immutable tensor semantic layer, views, generation-checked storage, CPU realiz" }, { "digest": "be7e624435df81eae403f51a381acf480e9fd2f2a04eb34e955547973645b95d", - "last_commit": "54826a3", + "last_commit": "e5593ae", "name": "train", "purpose": "Directory src/train. Purpose not yet described by a human." }, { "digest": "78c180a66607ebaf93e6ef6a6a56a3059ebf97db394d76af50c0e3f25d2be639", - "last_commit": "2564f57", + "last_commit": "e5593ae", "name": "turing", "purpose": "Directory src/turing. Purpose not yet described by a human." }, { "digest": "daf5e5e90c1ccb4c089220a6545844dbe4078a233f1777e8145b74f1bf5dd5fe", - "last_commit": "40d1ea3", + "last_commit": "e5593ae", "name": "visor", "purpose": "Directory src/visor. Purpose not yet described by a human." } ], "children_root": "sha256:607467f8ea6e425bf33f7a0df65a411055a569e302b8127ab84822a0b4559109", - "compiled_at": "2026-10-04T19:57:41Z", + "compiled_at": "2026-10-05T00:54:08Z", "compiler": "crumb-compile/1", - "digest": "sha256:be4a15a5245076828c97b151dd4ed1cc891c7dc5f22aee9ffdd0d93fb430e720", + "digest": "sha256:23594466e1a262dae0896b5b679603e24ec7b149cc0f29542ecb017175d54839", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 403, - "generated_at_commit": "d12d012a763f44ebb367431497eaf727256b25a8", - "source_tree": "sha256:be5556c8348e8b02f96d241a4e0b4ade91f9cc94793b60f45c526218554ef8e2" + "files": 405, + "generated_at_commit": "e5593ae488fcb9038557a4317a07faa7625649a3", + "source_tree": "sha256:ebfe126011f69a4c1b30ab51e8166aa74c5312fa1d719da7f99d46718e757709" }, "owner_lane": "", "provenance": { diff --git a/src/allen/allen_bind.c b/src/allen/allen_bind.c new file mode 100644 index 000000000..1d59123f3 --- /dev/null +++ b/src/allen/allen_bind.c @@ -0,0 +1,105 @@ +/* allen_bind.c -- see allen_bind.h. Pure functions over the subject object, + * a Cortex store and World references. No I/O except reading the object file. */ +#include "allen/allen_bind.h" + +#include +#include + +int allen_load(const char *path, struct cs_subject *s, uint8_t id[32], const char **why) +{ + static uint8_t buf[CC_MAX_OBJECT_BYTES + 1]; + FILE *f; + size_t n; + int rc; + if (!path || !s || !id) { + if (why) *why = "null argument"; + return -1; + } + f = fopen(path, "rb"); + if (!f) { + if (why) *why = "cannot open subject file"; + return -1; + } + n = fread(buf, 1, sizeof buf, f); + fclose(f); + if ((rc = cs_subject_decode(buf, n, s, why)) != CC_OK) return -1; + if (cs_subject_id(buf, n, id) != CC_OK) { + if (why) *why = "object id"; + return -1; + } + return 0; +} + +int allen_lineage(const CxStore *cx, uint8_t out[32]) +{ + const CxObject *o = cx ? cx_get(cx, 1) : NULL; + if (!o) { + memset(out, 0, 32); + return -1; + } + memcpy(out, o->digest, 32); + return 0; +} + +int allen_check_memory(const struct cs_subject *s, const CxStore *cx, const char **why) +{ + uint8_t ref[32]; + static const uint8_t zero[32] = {0}; + if (memcmp(s->cortex, zero, 32) == 0) { + if (why) *why = "subject has no Cortex lineage binding"; + return -1; + } + if (allen_lineage(cx, ref) != 0) { + if (why) *why = "Cortex journal holds no genesis record"; + return -1; + } + if (memcmp(ref, s->cortex, 32) != 0) { + if (why) *why = "Cortex lineage mismatch: this journal is not the subject's memory"; + return -1; + } + return 0; +} + +void allen_bind_identity(const RxWorld *w, const struct cs_subject *s, const uint8_t id[32], + AllenBinding *out) +{ + memset(out, 0, sizeof *out); + out->external_subject = w->external_subject; + memcpy(out->agent, s->agent, 32); + memcpy(out->subject_id, id, 32); + out->sequence = s->sequence; +} + +uint32_t allen_goal_mutations(const struct cs_intent *a, RxObjRef goal, uint64_t seq, + RxMutation out[4]) +{ + uint64_t id_lo = 0; + if (!a || a->state != CS_ACTIVE || a->kind != CS_INTENT_GOAL_LATENCY) return 0; + for (int i = 7; i >= 0; i--) id_lo = (id_lo << 8) | a->id[i]; + out[0] = (RxMutation){goal, 0, seq}; + out[1] = (RxMutation){goal, 1, a->payload[0]}; + out[2] = (RxMutation){goal, 2, a->payload[1]}; + out[3] = (RxMutation){goal, 3, id_lo}; + return 4; +} + +void allen_hex(const uint8_t *b, size_t n, char *out) +{ + static const char *h = "0123456789abcdef"; + for (size_t i = 0; i < n; i++) { + out[2 * i] = h[b[i] >> 4]; + out[2 * i + 1] = h[b[i] & 15]; + } + out[2 * n] = 0; +} + +int allen_unhex(const char *s, uint8_t *out, size_t n) +{ + if (!s || strlen(s) != 2 * n) return -1; + for (size_t i = 0; i < n; i++) { + unsigned v; + if (sscanf(s + 2 * i, "%2x", &v) != 1) return -1; + out[i] = (uint8_t)v; + } + return 0; +} diff --git a/src/allen/allen_bind.h b/src/allen/allen_bind.h new file mode 100644 index 000000000..38eedc0d8 --- /dev/null +++ b/src/allen/allen_bind.h @@ -0,0 +1,69 @@ +/* allen_bind.h -- ALLEN inside the resident organism: the three bindings. + * + * ARCH-0035 (PROPOSED). ALLEN is the durable subject the AIEN organism + * sustains. Its state is an AIENOS continuity object (kind 24, + * aienos native/kernel/svc/continuity_subject.h; OS-0018 PROPOSED). This + * module is the omega side of that contract and nothing more: + * + * 1. identity : the subject object is read and its id recomputed; the + * World's external subject number is recorded against the + * LogicalAgentId the object carries (the binding record); + * 2. memory : the subject's Cortex lineage reference must equal the + * digest of record 1 of the Cortex journal it is run with, + * or nothing is published (fail closed); + * 3. intent : each ACTIVE standing intent of kind GOAL_LATENCY is + * turned into the goal mutation the resident AIEN faculty + * already reads (rx_aien.h: goal = {seq, regime, target ns}); + * field 3 carries the intent id's first 64 bits so the + * EXTERNAL crumb names the intent it came from. + * + * ALLEN publishes state; it never calls a faculty. The World's dependency + * machinery wakes aien.assess because the goal object changed (ARCH-0016, + * R16). There is no loop, no wait, no thread, no clock, no capability mint + * and no scheduling symbol in this translation unit; tests/allen/run.sh + * checks its symbol table (ALLEN-G5). */ +#ifndef ALLEN_BIND_H +#define ALLEN_BIND_H + +#include +#include + +#include "continuity_subject.h" +#include "runtime/rx_cortex.h" +#include "runtime/rx_world.h" + +/* Read a subject object file, decode it (every OS-0018 rule) and recompute + * its logical ObjectId. 0, or -1 with *why set. */ +int allen_load(const char *path, struct cs_subject *s, uint8_t id[32], const char **why); + +/* Cortex lineage reference: the digest of journal record 1. 0 on success; + * -1 when the journal holds no record (unbound). */ +int allen_lineage(const CxStore *cx, uint8_t out[32]); + +/* Fail-closed memory binding: 0 when the subject's lineage reference equals + * the journal's; -1 (with *why) when the subject is unbound, the journal is + * empty, or they differ. */ +int allen_check_memory(const struct cs_subject *s, const CxStore *cx, const char **why); + +/* The identity binding record (v0, host table of one row). */ +typedef struct { + uint32_t external_subject; /* RxWorld.external_subject */ + uint8_t agent[32]; /* LogicalAgentId from the subject object */ + uint8_t subject_id[32]; /* ObjectId of the subject object */ + uint64_t sequence; /* subject chain sequence */ +} AllenBinding; +void allen_bind_identity(const RxWorld *w, const struct cs_subject *s, const uint8_t id[32], + AllenBinding *out); + +/* The goal mutation for one ACTIVE GOAL_LATENCY intent. `seq` is the goal + * object's next sequence number (the writer's monotone counter). Returns the + * number of mutations written into out (4), or 0 if the intent is not an + * active goal-latency intent. */ +uint32_t allen_goal_mutations(const struct cs_intent *a, RxObjRef goal, uint64_t seq, + RxMutation out[4]); + +/* Hex helpers for the tool and the gate script. */ +void allen_hex(const uint8_t *b, size_t n, char *out); +int allen_unhex(const char *s, uint8_t *out, size_t n); + +#endif diff --git a/tests/.crumb b/tests/.crumb index ab6260b53..696cde1fa 100644 --- a/tests/.crumb +++ b/tests/.crumb @@ -110,188 +110,188 @@ "children": [ { "digest": "e7498eca87fe5ca8dc27d92f2d99be0de3e4c804711f9d8cba5bb1e47ca95f74", - "last_commit": "28911be", + "last_commit": "e5593ae", "name": "algebra", "purpose": "Directory tests/algebra. Purpose not yet described by a human." }, { "digest": "d484ca176e9932b098df5664d01bdd679c78f5b89f4d15a77eb30f43d235f570", - "last_commit": "834ee93", + "last_commit": "e5593ae", "name": "ans", "purpose": "Tests 1-10 for ANS (docs/ans/INERTIAL_ALIGNMENT_SPEC_V1.md): freeze/digest, hostile reference mu" }, { "digest": "bd7114b42f99c7e51741abdf24329d20713c73a332bd5f349e04384fd0241e91", - "last_commit": "e722877", + "last_commit": "e5593ae", "name": "brownian", "purpose": "Directory tests/brownian. Purpose not yet described by a human." }, { "digest": "1cbe9561b87b394e200f67996ce1407c377025d07ad033b27cdd542625e277d4", - "last_commit": "30bb116", + "last_commit": "e5593ae", "name": "canonicalization", "purpose": "Directory tests/canonicalization. Purpose not yet described by a human." }, { "digest": "d93d50a07f61b032e5476e0066cad83c42d51427a0b206585e05fff56350e12e", - "last_commit": "dce821c", + "last_commit": "e5593ae", "name": "compiler", "purpose": "Directory tests/compiler. Purpose not yet described by a human." }, { "digest": "47683e6a56ca8e14ee526004b2a90dd08498507e8d4b0b42c3d85d22afb07d28", - "last_commit": "28b8793", + "last_commit": "e5593ae", "name": "constraints", "purpose": "Directory tests/constraints. Purpose not yet described by a human." }, { "digest": "95b2041562face1ba7baa6c57456bf07d77a0f44e093b989ec18f559064e22d9", - "last_commit": "49abb02", + "last_commit": "e5593ae", "name": "crumbline", "purpose": "Directory tests/crumbline. Purpose not yet described by a human." }, { "digest": "d57833fb3f63ef6475cf25e2e16319d818a0a407b825d5b4c5cbdd3cc0e06492", - "last_commit": "00f54b6", + "last_commit": "e5593ae", "name": "dual_experiment", "purpose": "Tests for the DUAL applicability experiment: determinism (same seed, byte-identical results dige" }, { "digest": "fb0a9296a93d065d5e016ad0a950fc6b9691f8ddca12ad0111cee2e35791cdb4", - "last_commit": "c819b37", + "last_commit": "e5593ae", "name": "effect", "purpose": "Directory tests/effect. Purpose not yet described by a human." }, { "digest": "bc2473da101ba5a74c32021a9d27ecb2007897f07a9689ba50ccc99b9030bf0c", - "last_commit": "1a147e4", + "last_commit": "e5593ae", "name": "estimation", "purpose": "Directory tests/estimation. Purpose not yet described by a human." }, { "digest": "de2bc4e310a257dbd21cc5c9624641b137b1b4487d8876cb52469aea2af5b904", - "last_commit": "3108fc2", + "last_commit": "e5593ae", "name": "fabric", "purpose": "Directory tests/fabric. Purpose not yet described by a human." }, { "digest": "90418926706f827aafd72938aee1dea89222cb5e465fba06a8df5a83253e0412", - "last_commit": "28b8793", + "last_commit": "e5593ae", "name": "identity", "purpose": "Directory tests/identity. Purpose not yet described by a human." }, { "digest": "c653c851c8934ce9ac4eabaa32a9df65d858c9ac7a556e76b265b1ee81494443", - "last_commit": "4f55f45", + "last_commit": "e5593ae", "name": "language", "purpose": "Directory tests/language. Purpose not yet described by a human." }, { "digest": "e485aa0a00f0a588e22d55caa704db8581a5da1b53080b311086e6edd38f6044", - "last_commit": "30bb116", + "last_commit": "e5593ae", "name": "malformed", "purpose": "Directory tests/malformed. Purpose not yet described by a human." }, { "digest": "adba9b5ea1c000db36078fca7d1bfef0b2769b73c8fb474024d9409bd48bdbc1", - "last_commit": "40d1ea3", + "last_commit": "e5593ae", "name": "numeric_native", "purpose": "Simulated M16 driver for numeric resource-lifecycle tests. No device execution or numeric parity" }, { "digest": "a4d320b3203650a28c43ea954957d8902d1cc25cbdc8aecd15628c01a92f68f8", - "last_commit": "d550b70", + "last_commit": "e5593ae", "name": "path", "purpose": "Directory tests/path. Purpose not yet described by a human." }, { "digest": "1fd5f914f326a1a51fc343ab633ac411e86bea22beee718b1460db066807f292", - "last_commit": "8a2e268", + "last_commit": "e5593ae", "name": "physics0", "purpose": "PD-0 gates: world self-test, oracle calibration, learner L0/L1/NULL, mutations, OSC differential" }, { "digest": "4619a90a957e77cd3d5680132ab4d1a5ef65f43419ddcc089743ca5b7a7719ee", - "last_commit": "8f8babe", + "last_commit": "e5593ae", "name": "polyglot", "purpose": "Directory tests/polyglot. Purpose not yet described by a human." }, { "digest": "16bea65aa50f0b3ab8b90cb286de048639fa8e635ff84e517e138c6f9f26a059", - "last_commit": "3c82389", + "last_commit": "e5593ae", "name": "program", "purpose": "Directory tests/program. Purpose not yet described by a human." }, { "digest": "ba0c09f67d12b5d7de906129bdbe2f6e0a228e1a34236ecc4b779c523cb2061e", - "last_commit": "6fdc4c3", + "last_commit": "e5593ae", "name": "r16_inventory", "purpose": "Directory tests/r16_inventory. Purpose not yet described by a human." }, { "digest": "ee440289b52f009835a35b384e086872b04cecb15665b9682a0d27a5dfee30c9", - "last_commit": "520c895", + "last_commit": "e5593ae", "name": "r16_negative", "purpose": "Directory tests/r16_negative. Purpose not yet described by a human." }, { "digest": "25cabf47d18353539db28146434d246a2f81bf9c323471566451aca56806f279", - "last_commit": "44d8c06", + "last_commit": "e5593ae", "name": "r16_surface", "purpose": "Directory tests/r16_surface. Purpose not yet described by a human." }, { "digest": "9106f2ea57e8f453322f0a988b61cfcbd06631573c9ff32a777903d27d7741e1", - "last_commit": "40d1ea3", + "last_commit": "e5593ae", "name": "realize", "purpose": "Directory tests/realize. Purpose not yet described by a human." }, { "digest": "381184e79b26920b256dd4a774fb11f17a92afa8ceda4813eada241bac4163a9", - "last_commit": "30bb116", + "last_commit": "e5593ae", "name": "relations", "purpose": "Directory tests/relations. Purpose not yet described by a human." }, { "digest": "f49db08f5e2f8ad20c9e10f7eaaa27e7f264b6bfc17e4d4fad16e60eb1495f1d", - "last_commit": "3a3144d", + "last_commit": "e5593ae", "name": "runtime", "purpose": "Directory tests/runtime. Purpose not yet described by a human." }, { "digest": "b1311025a3bfd8dd7b5e07b1adf1d7ece502a15200f7207f515334f7083b8315", - "last_commit": "5ae192a", + "last_commit": "e5593ae", "name": "searchtrace", "purpose": "Directory tests/searchtrace. Purpose not yet described by a human." }, { "digest": "3ecf636e2923038708cafa062895b8d8f2664dc1865cdff38575911eaa9f1b2d", - "last_commit": "54826a3", + "last_commit": "e5593ae", "name": "train", "purpose": "Directory tests/train. Purpose not yet described by a human." }, { "digest": "75d5e576c38a0497a55e9f5ee79550cb94f9b75008f3e4e126312802704b3f86", - "last_commit": "2564f57", + "last_commit": "e5593ae", "name": "turing", "purpose": "Directory tests/turing. Purpose not yet described by a human." }, { "digest": "3f19e3034ff999211cb13ab8995ca6c38d0d8e1f5bfbbbd621caaa08412d3f1f", - "last_commit": "fed4f07", + "last_commit": "e5593ae", "name": "visor", "purpose": "Directory tests/visor. Purpose not yet described by a human." } ], "children_root": "sha256:0a4e348cf355e1fa5924f9c76a460d1d49bc285687b134365ef0fb9dab4f0855", - "compiled_at": "2026-10-04T19:57:41Z", + "compiled_at": "2026-10-05T00:54:08Z", "compiler": "crumb-compile/1", - "digest": "sha256:58368f55fc201ea01917bd941190d00de8e40f4e5b161525d48d03eac877084e", + "digest": "sha256:14a5005df7f8959b4d7cd589771f7aed8a731730fe3eaace565a6e9d215eb790", "evidence_files": 11, "evidence_root": "sha256:d5c1bceb4d57ef0eb42797c58801b5926509711614c3e38bb7105b6efa3942f2", - "files": 790, - "generated_at_commit": "d12d012a763f44ebb367431497eaf727256b25a8", - "source_tree": "sha256:0b472eb701f9a089b91ad665fe93d050ae46cdca92672a0ed7d2a6a65c3d5bae" + "files": 791, + "generated_at_commit": "e5593ae488fcb9038557a4317a07faa7625649a3", + "source_tree": "sha256:d798ce914c2f79b84c086322a184e76652759744bd0632c46663ea7dd64df980" }, "owner_lane": "", "provenance": { diff --git a/tests/allen/run.sh b/tests/allen/run.sh new file mode 100755 index 000000000..5728d283c --- /dev/null +++ b/tests/allen/run.sh @@ -0,0 +1,229 @@ +#!/bin/sh +# ALLEN v0 host gates (spec/allen.md; ARCH-0035 PROPOSED, OS-0018 PROPOSED). +# Usage (from `make test-allen`): ALLEN_TOOL= ALLEN_BIND_OBJ= +# ALLEN_MAIN_OBJ= ALLEN_OUT= sh tests/allen/run.sh +# +# Every gate is a host test: processes, files, the resident World. None of +# this is hardware qualification, an OS reboot, or a machine migration; the +# receipt says so. The negative control (G6) is the falsifier: if a standing +# intent already survived a restart through the Cortex journal alone, ALLEN +# would be redundant and this script would FAIL it. +# +# Exit 0 = every gate PASS. Writes $ALLEN_OUT/receipt.json (host facts only; +# the evidence receipt under evidence/ALLEN/ is written from it by the +# qualifying run, with the commit bound). +set -u +T=${ALLEN_TOOL:?ALLEN_TOOL} +BIND=${ALLEN_BIND_OBJ:?ALLEN_BIND_OBJ} +MAIN=${ALLEN_MAIN_OBJ:?ALLEN_MAIN_OBJ} +OUT=${ALLEN_OUT:?ALLEN_OUT} +case $T in /*) ;; *) T=$(pwd)/$T ;; esac +rm -rf "$OUT" && mkdir -p "$OUT" || exit 2 +LOG=$OUT/log.txt +: > "$LOG" +FAILS=0 +GATES="" + +AGENT_A=a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 +AGENT_B=b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2 +ROOT_A=0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a +PROV=c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3 +MODEL_X=1111111111111111111111111111111111111111111111111111111111111111 +MODEL_Y=2222222222222222222222222222222222222222222222222222222222222222 + +say() { printf '%s\n' "$*" | tee -a "$LOG"; } +run() { # run NAME cmd... : stdout+stderr to $OUT/NAME.txt, rc in $RC + n=$1; shift + "$@" > "$OUT/$n.txt" 2>&1 + RC=$? + { echo "## $n (rc=$RC)"; cat "$OUT/$n.txt"; } >> "$LOG" + return 0 +} +field() { # field FILE KEY -> value after 'KEY ' on the first matching line + sed -n "s/^.*$2 \([^ ]*\).*$/\1/p" "$1" | head -n 1 +} +gate() { # gate ID ok(0/1) "what" + if [ "$2" -eq 0 ]; then say "ALLEN-$1 PASS: $3"; GATES="$GATES$1=PASS " + else say "ALLEN-$1 FAIL: $3"; FAILS=$((FAILS + 1)); GATES="$GATES$1=FAIL "; fi +} +patch_byte() { # patch_byte IN OUT OFFSET HEXBYTE + cp "$1" "$2" && printf "\\$(printf '%03o' "0x$4")" | dd of="$2" bs=1 seek="$3" conv=notrunc 2>/dev/null +} +sha() { sha256sum "$1" | cut -c1-64; } + +# ---- fixtures --------------------------------------------------------------- +run seed1 "$T" seed-journal "$OUT/j1.cx" 1 +run seed2 "$T" seed-journal "$OUT/j2.cx" 2 +L1=$(field "$OUT/seed1.txt" lineage); L2=$(field "$OUT/seed2.txt" lineage) +[ -n "$L1" ] && [ -n "$L2" ] && [ "$L1" != "$L2" ] || { say "fixture: two distinct journal lineages needed"; exit 2; } +run make1 "$T" make -o "$OUT/s1.bin" --agent $AGENT_A --root $ROOT_A --prov $PROV --intent 7,1000 --cortex "$OUT/j1.cx" +run make1b "$T" make -o "$OUT/s1b.bin" --agent $AGENT_A --root $ROOT_A --prov $PROV --intent 7,1000 --cortex "$OUT/j1.cx" +run make2 "$T" make -o "$OUT/s2.bin" --agent $AGENT_B --root $ROOT_A --prov $PROV --intent 7,1000 --cortex "$OUT/j1.cx" +run makeU "$T" make -o "$OUT/su.bin" --agent $AGENT_A --root $ROOT_A --prov $PROV --intent 7,1000 +run makeS "$T" make -o "$OUT/ss.bin" --agent $AGENT_A --root $ROOT_A --prov $PROV --intent 7,1000 --intent 7,2000 --cortex "$OUT/j1.cx" +S1=$(field "$OUT/make1.txt" subject); S1B=$(field "$OUT/make1b.txt" subject); S2=$(field "$OUT/make2.txt" subject) +I1=$(sed -n 's/^ALLEN intent \([0-9a-f]*\) .*/\1/p' "$OUT/make1.txt" | head -n 1) + +# ---- G1 identity binding ---------------------------------------------------- +# The subject object carries the LogicalAgentId; its id is content-addressed +# (same content, same id; another agent, another id); the rig binds the +# World's external subject number to that agent, not to a model or a process. +run g1 "$T" publish "$OUT/s1.bin" "$OUT/j1.cx" +ok=1 +[ "$RC" -eq 0 ] && [ -n "$S1" ] && [ "$S1" = "$S1B" ] && [ "$S1" != "$S2" ] && + [ "$(field "$OUT/g1.txt" 'ALLEN agent')" = "$AGENT_A" ] && + grep -q "^ALLEN binding external_subject [0-9]* agent $AGENT_A sequence 1$" "$OUT/g1.txt" && + [ "$(field "$OUT/g1.txt" 'ALLEN subject')" = "$S1" ] && ok=0 +gate G1 $ok "subject id content-addressed ($S1), bound to agent $AGENT_A; another agent gives another id" +# Foreign-agent and foreign-root refusal at the Store resolver is the aienos +# half of G1 (test_continuity_subject: t_resolve); recorded, not re-run here. + +# ---- G2 restart persistence (process level) --------------------------------- +# Publish, let the process exit, publish again from a fresh process: the same +# subject id, the same intent id and the same goal are restored, and the +# organism's AIEN faculty wakes again on its own (assess activations 1). +run g2 "$T" publish "$OUT/s1.bin" "$OUT/j1.cx" +ok=1 +[ "$RC" -eq 0 ] && [ "$(field "$OUT/g2.txt" 'ALLEN subject')" = "$S1" ] && + grep -q "^ALLEN publish intent $I1 -> EXTERNAL crumb [0-9]*$" "$OUT/g2.txt" && + grep -q "^ALLEN goal object seq 1 regime 7 target_ns 1000 " "$OUT/g2.txt" && + grep -q "^AIEN assess activations 1 in_episode_of_last_publish 1 assessment goal_seq 1 " "$OUT/g2.txt" && + grep -q "^ALLEN goal object seq 1 regime 7 target_ns 1000 " "$OUT/g1.txt" && ok=0 +gate G2 $ok "second process restores subject $S1, intent $I1, goal regime 7 / 1000 ns; AIEN assess woke once" +# Store-level restart (two processes over one sealed Store image) is the +# aienos gate CK_CONTINUITY_SUBJECT_RESTART; recorded, not re-run here. + +# ---- G3 memory binding ------------------------------------------------------ +# Fail closed: a subject only acts with the Cortex journal whose genesis record +# it names. Another journal, an unbound subject, and an empty journal are refused +# before anything is published. +run g3a "$T" publish "$OUT/s1.bin" "$OUT/j2.cx"; a=$RC +run g3b "$T" publish "$OUT/su.bin" "$OUT/j1.cx"; b=$RC +run g3c "$T" publish "$OUT/s1.bin" "$OUT/j3-empty.cx"; c=$RC +ok=1 +[ "$a" -eq 3 ] && grep -q "Cortex lineage mismatch" "$OUT/g3a.txt" && ! grep -q "EXTERNAL crumb" "$OUT/g3a.txt" && + [ "$b" -eq 3 ] && grep -q "no Cortex lineage binding" "$OUT/g3b.txt" && + [ "$c" -eq 3 ] && grep -q "holds no genesis record" "$OUT/g3c.txt" && + grep -q "^ALLEN memory BOUND lineage $L1 " "$OUT/g1.txt" && ok=0 +gate G3 $ok "bound journal accepted (lineage $L1); other journal, unbound subject, empty journal refused before publish" + +# ---- G4 model independence -------------------------------------------------- +# Two different model digests and no model at all: identical subject bytes, +# identical subject id, identical intent id, identical goal. The object has no +# model field (continuity_subject.h); the model is provenance printed by the +# host tool and stored nowhere. +h0=$(sha "$OUT/s1.bin") +run g4x "$T" publish "$OUT/s1.bin" "$OUT/j1.cx" --model $MODEL_X; x=$RC +run g4y "$T" publish "$OUT/s1.bin" "$OUT/j1.cx" --model $MODEL_Y; y=$RC +h1=$(sha "$OUT/s1.bin") +ok=1 +[ "$x" -eq 0 ] && [ "$y" -eq 0 ] && [ "$h0" = "$h1" ] && + [ "$(field "$OUT/g4x.txt" 'ALLEN subject')" = "$S1" ] && [ "$(field "$OUT/g4y.txt" 'ALLEN subject')" = "$S1" ] && + grep -q "^ALLEN publish intent $I1 " "$OUT/g4x.txt" && grep -q "^ALLEN publish intent $I1 " "$OUT/g4y.txt" && + grep -q "^ALLEN model $MODEL_X (provenance only" "$OUT/g4x.txt" && + grep -q "^ALLEN model none (no model required)" "$OUT/g2.txt" && + ! grep -q "$MODEL_X" "$OUT/s1.bin" && ok=0 +gate G4 $ok "models X, Y and none give the same subject, intent and goal; object bytes unchanged ($h0)" + +# ---- G5 no authority, no orchestrator (R16) --------------------------------- +# allen_bind.o: no thread, wait, clock, signal, reaction registration or +# capability mint symbols. allen.o (the rig) may build the World and mint for +# the AIEN faculty like R11's test does, but has no thread, timer, signal or +# reaction of its own: it publishes and observes. +need_absent_bind='pthread_create|^poll$|epoll|^select$|^sleep$|nanosleep|usleep|clock_|timer_|^signal$|sigaction|alarm|rx_world_add_reaction|rx_world_resume|aienos_cap_mint|rx_aien_|rx_world_publish' +need_absent_main='pthread_create|^poll$|epoll|^select$|^sleep$|nanosleep|usleep|clock_|timer_|^signal$|sigaction|alarm|rx_world_add_reaction|rx_world_resume|fork|execv|system' +ub=$(nm -u "$BIND" | awk '{print $2}' | grep -E "$need_absent_bind" || true) +um=$(nm -u "$MAIN" | awk '{print $2}' | grep -E "$need_absent_main" || true) +# Source: no loop in allen_bind.c except the fixed byte loops; no run_until/max_turns anywhere. +lp=$(grep -nE 'while|for *\(' src/allen/allen_bind.c | grep -vE 'i < n|i >= 0|2 \* i' || true) +mt=$(grep -nEi 'max_turns|max_steps|run_until|orchestrat|heartbeat|dispatch' src/allen/allen_bind.c src/allen/allen_bind.h tools/allen.c || true) +ok=1 +[ -z "$ub" ] && [ -z "$um" ] && [ -z "$lp" ] && [ -z "$mt" ] && ok=0 +[ -n "$ub$um$lp$mt" ] && say "G5 offenders: bind[$ub] main[$um] loops[$lp] words[$mt]" +gate G5 $ok "allen_bind.o and allen.o carry no thread/wait/timer/signal/reaction/mint symbols; no loop words in source" +# The cross-repo loop inventory (R16-G2, make test-r16-inventory) is run by +# the qualifying session on the committed tree; its result is in the receipt. + +# ---- G6 negative control (the falsifier) ------------------------------------ +# A fresh journal; publish once (the journal records the EXTERNAL crumb and +# the AIEN activations); start the rig again WITHOUT ALLEN: if the World holds +# a goal, the intent survived through memory alone and ALLEN is redundant -> +# FAIL ALLEN. Then publish again: ALLEN restores it. +run seed6 "$T" seed-journal "$OUT/j6.cx" 6 +run make6 "$T" make -o "$OUT/s6.bin" --agent $AGENT_A --root $ROOT_A --prov $PROV --intent 7,1000 --cortex "$OUT/j6.cx" +run g6a "$T" publish "$OUT/s6.bin" "$OUT/j6.cx"; a=$RC +run g6b "$T" probe "$OUT/j6.cx"; b=$RC +run g6c "$T" publish "$OUT/s6.bin" "$OUT/j6.cx"; c=$RC +rec_a=$(field "$OUT/g6a.txt" journal_records); rec_b=$(field "$OUT/g6b.txt" journal_records) +goals_b=$(field "$OUT/g6b.txt" goals_in_world) +ok=1 +[ "$a" -eq 0 ] && [ "$b" -eq 0 ] && [ "$c" -eq 0 ] && + [ "${rec_a:-0}" -gt 1 ] && [ "$rec_b" = "$rec_a" ] && [ "$goals_b" = "0" ] && + grep -q "^ALLEN probe journal_records [0-9]* goals_in_world 0 goal_seq 0 assessment_goal_seq 0$" "$OUT/g6b.txt" && + grep -q "^ALLEN goal object seq 1 regime 7 target_ns 1000 " "$OUT/g6c.txt" && + grep -q "^ALLEN published 1 goals_in_world 1 " "$OUT/g6c.txt" && ok=0 +if [ "$goals_b" != "0" ]; then say "NEGATIVE CONTROL BROKEN: intent survived without ALLEN (goals_in_world=$goals_b); ALLEN would be redundant"; fi +gate G6 $ok "without ALLEN the restarted World holds 0 goals although the journal holds $rec_b records; with ALLEN the goal is back" + +# ---- format refusals: unknown version, corruption, truncation, trailing ------ +patch_byte "$OUT/s1.bin" "$OUT/r-ver.bin" 8 01 # format_version u16 -> 1 +patch_byte "$OUT/s1.bin" "$OUT/r-agent.bin" 48 ff # agent byte -> intent id no longer derives +patch_byte "$OUT/s1.bin" "$OUT/r-intent.bin" 200 00 # intent id byte +head -c 150 "$OUT/s1.bin" > "$OUT/r-trunc.bin" +{ cat "$OUT/s1.bin"; printf 'x'; } > "$OUT/r-trail.bin" +patch_byte "$OUT/s1.bin" "$OUT/r-origin.bin" 184 09 # unknown origin +run rv "$T" inspect "$OUT/r-ver.bin"; v=$RC +run ra "$T" inspect "$OUT/r-agent.bin"; a=$RC +run ri "$T" inspect "$OUT/r-intent.bin"; i=$RC +run rt "$T" inspect "$OUT/r-trunc.bin"; t=$RC +run rl "$T" inspect "$OUT/r-trail.bin"; l=$RC +run ro "$T" inspect "$OUT/r-origin.bin"; o=$RC +run rp "$T" publish "$OUT/r-ver.bin" "$OUT/j1.cx"; p=$RC +ok=1 +[ "$v" -eq 3 ] && grep -q "unsupported continuity format version" "$OUT/rv.txt" && + [ "$a" -eq 3 ] && grep -q "intent id does not derive from its content" "$OUT/ra.txt" && + [ "$i" -eq 3 ] && grep -q "intent id does not derive from its content" "$OUT/ri.txt" && + [ "$t" -eq 3 ] && grep -q "truncated object\|body length mismatch" "$OUT/rt.txt" && + [ "$l" -eq 3 ] && grep -q "trailing bytes\|body length mismatch" "$OUT/rl.txt" && + [ "$o" -eq 3 ] && grep -q "unknown subject origin" "$OUT/ro.txt" && + [ "$p" -eq 3 ] && ! grep -q "EXTERNAL crumb" "$OUT/rp.txt" && ok=0 +gate FORMAT $ok "unknown version, corrupted agent/intent, truncation, trailing bytes, unknown origin: all refused, nothing published" + +# ---- replay: the same bytes are the same subject, never a second one -------- +# (The Store refuses a second genesis for one root: aienos t_sealed_store.) +ok=1 +[ "$(field "$OUT/g1.txt" 'ALLEN subject')" = "$(field "$OUT/g2.txt" 'ALLEN subject')" ] && + [ "$(field "$OUT/g1.txt" 'ALLEN subject')" = "$(field "$OUT/g4x.txt" 'ALLEN subject')" ] && + [ "$($T digest "$OUT/s1.bin")" = "$S1" ] && [ "$($T digest "$OUT/s1b.bin")" = "$S1" ] && ok=0 +gate REPLAY $ok "replaying the object yields the same subject id $S1 every time; no second subject appears" + +# ---- supersession: one ACTIVE intent per slot; the older one is SUPERSEDED -- +run sup "$T" publish "$OUT/ss.bin" "$OUT/j1.cx"; s=$RC +ok=1 +[ "$s" -eq 0 ] && [ "$(grep -c '^ALLEN intent ' "$OUT/sup.txt")" = "2" ] && + grep -q "^ALLEN intent [0-9a-f]* kind 1 state 3 since 1 regime 7 target_ns 1000$" "$OUT/sup.txt" && + grep -q "^ALLEN intent [0-9a-f]* kind 1 state 1 since 1 regime 7 target_ns 2000$" "$OUT/sup.txt" && + grep -q "^ALLEN published 1 goals_in_world 1 " "$OUT/sup.txt" && + grep -q "^ALLEN goal object seq 1 regime 7 target_ns 2000 " "$OUT/sup.txt" && ok=0 +gate SUPERSEDE $ok "two intents in one slot: the old one is SUPERSEDED, only the new one (2000 ns) is published" + +# ---- subject mismatch: another agent's object is another subject ------------ +run mm "$T" publish "$OUT/s2.bin" "$OUT/j1.cx"; m=$RC +ok=1 +[ "$m" -eq 0 ] && [ "$(field "$OUT/mm.txt" 'ALLEN subject')" = "$S2" ] && [ "$S2" != "$S1" ] && + grep -q "^ALLEN binding external_subject [0-9]* agent $AGENT_B " "$OUT/mm.txt" && ok=0 +gate MISMATCH $ok "agent B's object binds as subject $S2, never as $S1 (Store-level foreign-agent refusal: aienos t_resolve)" + +# ---- receipt (host facts; the evidence receipt binds the commit) ------------ +{ + printf '{\n "schema": "AIEN_ALLEN_HOST_GATES_V0",\n' + printf ' "outcome": "%s",\n' "$([ $FAILS -eq 0 ] && echo PASS || echo FAIL)" + printf ' "gates": "%s",\n' "$(echo $GATES)" + printf ' "subject_id": "%s",\n "intent_id": "%s",\n "lineage": "%s",\n' "$S1" "$I1" "$L1" + printf ' "negative_control": {"journal_records_after_publish": %s, "goals_without_allen": %s},\n' "${rec_b:-null}" "${goals_b:-null}" + printf ' "scope": "host processes and files on one machine; not hardware qualification, not an OS reboot, not a machine migration",\n' + printf ' "tool_sha256": "%s"\n}\n' "$(sha "$T")" +} > "$OUT/receipt.json" +if [ $FAILS -eq 0 ]; then say "test-allen: PASS (G1 identity, G2 restart, G3 memory, G4 model independence, G5 no authority, G6 negative control, format, replay, supersession, mismatch)"; exit 0; fi +say "test-allen: FAIL ($FAILS gate(s)); see $LOG" +exit 1 diff --git a/tools/.crumb b/tools/.crumb index 2b8e1d430..50ad382b8 100644 --- a/tools/.crumb +++ b/tools/.crumb @@ -26,44 +26,44 @@ "children": [ { "digest": "9cd3943087595dd868914a23a9fef7bebda3d78b773762c287ac4b7a6c2e2f40", - "last_commit": "05ed1a1", + "last_commit": "e5593ae", "name": "argus", "purpose": "Directory tools/argus. Purpose not yet described by a human." }, { "digest": "1ccbb2bd2ac34a90fdd96376bcca759d4a2c0262ac43aa41839c0cc6e48f0693", - "last_commit": "e722877", + "last_commit": "e5593ae", "name": "brownian", "purpose": "Directory tools/brownian. Purpose not yet described by a human." }, { "digest": "64fe22fe57fab7e61e65cb7652e73dbde613c260cb8677b05d8b98a067231e83", - "last_commit": "00f54b6", + "last_commit": "e5593ae", "name": "dual_experiment", "purpose": "Runner for the DUAL applicability experiment: runs the pre-registered campaign and writes result" }, { "digest": "a2a3e0f17b6cc6719fb15112608ce7e52c44233492cdd9b7a8e6a105127e569f", - "last_commit": "c8b09d0", + "last_commit": "e5593ae", "name": "estimation", "purpose": "Directory tools/estimation. Purpose not yet described by a human." }, { "digest": "98d1f4d802b90006977d73b14acb92971927f2cf5bdf05d8dc5653a1b10fcf1b", - "last_commit": "ae1dd00", + "last_commit": "e5593ae", "name": "turing_verify_indep", "purpose": "Directory tools/turing_verify_indep. Purpose not yet described by a human." } ], "children_root": "sha256:0920c282c31e3be9b4745fab718ceb60dbfe2ea90dda2108986f60fc2ac53e23", - "compiled_at": "2026-10-04T19:18:09Z", + "compiled_at": "2026-10-05T00:54:08Z", "compiler": "crumb-compile/1", - "digest": "sha256:1a6281ce3f92b5e68d0709eab039f9852df5e7132493e2e12f90f7ff495560d1", + "digest": "sha256:930b5dff91263f123b3da0fb667cb12d2710aae636609e9561d961ef3c16d1a4", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 120, - "generated_at_commit": "a274e0a2c8d39f3a9cb57cb9681a500b7d9f2252", - "source_tree": "sha256:cbcfb5f36ecaa585d40d30eed94d7992c3fdf9b069b1dc25a2d720970d184762" + "files": 121, + "generated_at_commit": "e5593ae488fcb9038557a4317a07faa7625649a3", + "source_tree": "sha256:2ed2276b76ebd993bf200aebd18992e40296ffc5d509f5c87b22aded7676d292" }, "owner_lane": "", "provenance": { diff --git a/tools/allen.c b/tools/allen.c new file mode 100644 index 000000000..b0a720728 --- /dev/null +++ b/tools/allen.c @@ -0,0 +1,452 @@ +/* allen.c -- thin host tool for ALLEN subject state (ARCH-0035 PROPOSED). + * + * Inspection and qualification only. Not a chat, not an agent runtime, not a + * planner, not a daemon, not a Visor, not an operator shell. Every verb runs + * to completion and exits; nothing here decides which faculty runs next. + * + * allen make -o FILE --agent HEX32 --root HEX32 --prov HEX32 + * [--intent REGIME,TARGET_NS]... [--cortex JOURNAL] + * Build a v0 subject object (test fixture: in production the object is + * committed into the AIENOS Store by continuity_subject.c; this verb + * writes the same bytes to a file for host qualification). + * allen inspect FILE Decode, print identity, chain, bindings, intents. + * allen digest FILE Print the subject id only. + * allen lineage JOURNAL Print the Cortex lineage reference of a journal. + * allen seed-journal JOURNAL [TAG] + * Create a Cortex journal with one fixture record (the organism's genesis + * record stand-in; TAG makes two fixtures distinct lineages). + * allen publish FILE JOURNAL [--model HEX32] + * The host rig: capability root, World, the resident AIEN faculty + * (part A of R11: AIEN alone). Checks the memory binding (fail closed), + * records the identity binding, publishes every ACTIVE standing intent + * through rx_world_publish_external, waits for quiescence and prints + * what AIEN did with it. The model digest is printed as provenance and + * stored nowhere. + * allen probe JOURNAL + * The same rig started without ALLEN: how many goals does the World + * hold, and how many records does the journal hold? (negative control) + * + * Exit: 0 ok; 2 usage; 3 refused (decode, binding, publish); 4 rig failure. */ +#include +#include +#include + +#include "allen/allen_bind.h" +#include "runtime/aienos_cap.h" +#include "runtime/rx_aien.h" +#include "runtime/rx_cortex.h" +#include "runtime/rx_cortex_record.h" +#include "runtime/rx_omega.h" +#include "runtime/rx_world.h" + +#define SUBJ_EXTERNAL 7u +#define ISSUER 1u +#define RES_DEMAND 0x7711000ull +#define RES_SELECTION 0x7711001ull +#define JOURNAL_SUBJECTS 512u +#define SESSION 0x414c4c454e2d3030ull /* "ALLEN-00" */ + +static int usage(void) +{ + fprintf(stderr, + "usage: allen make -o FILE --agent HEX --root HEX --prov HEX [--intent R,T]... [--cortex JOURNAL]\n" + " allen inspect FILE | digest FILE | lineage JOURNAL | seed-journal JOURNAL [TAG]\n" + " allen publish FILE JOURNAL [--model HEX] | probe JOURNAL\n"); + return 2; +} + +/* ---- rig: the body ALLEN state is published into ---- */ +typedef struct { + AienosCapAdmin *admin; + AienosCapView *view; + RxWorld w; + RxAienFaculty a; + RxAienCaps acaps; + RxObjRef demand, selection; + RxCapRef ext_goal; + int up; +} Rig; + +static RxCapRef mint(Rig *r, uint32_t subject, uint64_t resource, uint32_t rights) +{ + AienosCapRef office, out = {UINT32_MAX, 0}; + aienos_cap_office(r->admin, &office); + AienosCapMint m = {ISSUER, subject, resource, rights, 0, {UINT32_MAX, 0}, office}; + if (aienos_cap_mint(r->admin, &m, &out) != 0) out = (AienosCapRef){UINT32_MAX, 0}; + return (RxCapRef){out.cap_id, out.generation}; +} + +static int rig_start(Rig *r) +{ + const uint32_t RW = RX_RIGHT_READ | RX_RIGHT_WRITE; + uint64_t z[RX_MAX_FIELDS] = {0}; + RxAienConfig cfg; + RxAienInputs in; + memset(r, 0, sizeof *r); + if (aienos_cap_start(&r->admin, &r->view) != 0) return -1; + if (rx_world_init_native(&r->w, r->view, 4, 1u << 20) != RX_OK) { + aienos_cap_stop(r->admin, r->view); + return -1; + } + r->up = 1; + r->w.external_subject = SUBJ_EXTERNAL; + if (rx_world_create(&r->w, RX_OT_DEMAND, RX_PERSIST_RESIDENT, RES_DEMAND, z, &r->demand) != RX_OK || + rx_world_create(&r->w, RX_OT_SELECTION, RX_PERSIST_RESIDENT, RES_SELECTION, z, &r->selection) != RX_OK) + return -1; + rx_aien_default_config(&cfg); + in.demand = r->demand; + in.selection = r->selection; + if (rx_aien_create_objects(&r->a, &r->w, &cfg, &in) != RX_OK) return -1; + for (uint32_t i = 0; i < RX_AIEN_RES_COUNT; i++) + r->acaps.own[i] = mint(r, RX_AIEN_SUBJ, RX_AIEN_RES_BASE + i, + i == RX_AIEN_RES_PLACEMENT || i == RX_AIEN_RES_GOAL ? RX_RIGHT_READ : RW); + r->acaps.demand = mint(r, RX_AIEN_SUBJ, RES_DEMAND, RX_RIGHT_READ); + r->acaps.selection = mint(r, RX_AIEN_SUBJ, RES_SELECTION, RX_RIGHT_READ); + /* The outside world may write the goal; ALLEN's intents arrive that way. */ + r->ext_goal = mint(r, SUBJ_EXTERNAL, RX_AIEN_RES_BASE + RX_AIEN_RES_GOAL, RX_RIGHT_WRITE); + return rx_aien_register(&r->a, &r->acaps) == RX_OK ? 0 : -1; +} + +static void rig_stop(Rig *r) +{ + if (!r->up) return; + rx_world_wait_quiescent(&r->w, 20000); + rx_world_destroy(&r->w); + aienos_cap_stop(r->admin, r->view); + r->up = 0; +} + +static uint64_t fld(Rig *r, RxObjRef o, uint32_t i) +{ + RxObject x; + if (rx_world_read(&r->w, o, &x) != RX_OK) return UINT64_MAX; + return x.field[i]; +} + +static uint32_t goals_in_world(Rig *r) +{ + uint32_t n = 0; + for (uint32_t i = 0; i < RX_MAX_OBJECTS; i++) { + const RxObject *o = &r->w.objects[i]; + if (o->live && o->type == RX_OT_GOAL && o->field[0] != 0) n++; + } + return n; +} + +/* ---- verbs ---- */ +static void print_subject(const struct cs_subject *s, const uint8_t id[32]) +{ + char h[65]; + allen_hex(id, 32, h); + printf("ALLEN subject %s\n", h); + allen_hex(s->agent, 32, h); + printf("ALLEN agent %s\n", h); + allen_hex(s->root, 32, h); + printf("ALLEN root %s\n", h); + allen_hex(s->previous, 32, h); + printf("ALLEN chain sequence %llu previous %s\n", (unsigned long long)s->sequence, h); + allen_hex(s->cortex, 32, h); + printf("ALLEN cortex %s\n", h); + allen_hex(s->provenance, 32, h); + printf("ALLEN provenance %s origin %u\n", h, s->origin); + printf("ALLEN intents %u knowledge %u\n", s->n_intents, s->n_knowledge); + for (uint32_t i = 0; i < s->n_intents; i++) { + const struct cs_intent *a = &s->in[i]; + allen_hex(a->id, 32, h); + printf("ALLEN intent %s kind %u state %u since %llu regime %llu target_ns %llu\n", h, a->kind, + a->state, (unsigned long long)a->since, (unsigned long long)a->payload[0], + (unsigned long long)a->payload[1]); + } + for (uint32_t i = 0; i < s->n_knowledge; i++) { + allen_hex(s->kn[i].digest, 32, h); + printf("ALLEN knowledge %s record %llu since %llu\n", h, (unsigned long long)s->kn[i].record, + (unsigned long long)s->kn[i].since); + } +} + +static int v_make(int argc, char **argv) +{ + static struct cs_subject s; + static uint8_t buf[CC_MAX_OBJECT_BYTES]; + struct cr_view v; + uint8_t prov[32] = {0}, id[32]; + const char *out = NULL, *journal = NULL, *why = NULL; + size_t len = 0; + int have_agent = 0, have_root = 0; + memset(&v, 0, sizeof v); + for (int i = 2; i < argc; i++) { + if (!strcmp(argv[i], "-o") && i + 1 < argc) out = argv[++i]; + else if (!strcmp(argv[i], "--agent") && i + 1 < argc) have_agent = allen_unhex(argv[++i], v.root.agent_id, 32) == 0; + else if (!strcmp(argv[i], "--root") && i + 1 < argc) have_root = allen_unhex(argv[++i], v.root_id, 32) == 0; + else if (!strcmp(argv[i], "--prov") && i + 1 < argc) { if (allen_unhex(argv[++i], prov, 32)) return usage(); } + else if (!strcmp(argv[i], "--cortex") && i + 1 < argc) journal = argv[++i]; + else if (!strcmp(argv[i], "--intent") && i + 1 < argc) i++; /* second pass */ + else return usage(); + } + if (!out || !have_agent || !have_root) return usage(); + cs_subject_genesis(&s, &v, prov, CS_ORIGIN_OPERATOR); + for (int i = 2; i < argc; i++) { + if (!strcmp(argv[i], "--intent") && i + 1 < argc) { + uint64_t p[2]; + unsigned long long a, b; + if (sscanf(argv[++i], "%llu,%llu", &a, &b) != 2) return usage(); + p[0] = a; + p[1] = b; + if (cs_subject_intend(&s, CS_INTENT_GOAL_LATENCY, p, NULL, &why) != CC_OK) { + fprintf(stderr, "allen: intent refused: %s\n", why); + return 3; + } + } + } + if (journal) { + CxStore cx; + uint8_t ref[32]; + if (cx_open(&cx, journal, JOURNAL_SUBJECTS, CX_OPEN_READONLY) != CX_OK) { + fprintf(stderr, "allen: cannot open journal %s\n", journal); + return 3; + } + if (allen_lineage(&cx, ref) != 0) { + fprintf(stderr, "allen: journal has no genesis record; subject left unbound\n"); + } else { + cs_subject_bind_cortex(&s, ref); + } + cx_close(&cx); + } + if (cs_subject_encode(&s, buf, sizeof buf, &len, &why) != CC_OK) { + fprintf(stderr, "allen: encode refused: %s\n", why); + return 3; + } + { + FILE *f = fopen(out, "wb"); + if (!f || fwrite(buf, 1, len, f) != len) { + fprintf(stderr, "allen: cannot write %s\n", out); + return 4; + } + fclose(f); + } + cs_subject_id(buf, len, id); + print_subject(&s, id); + return 0; +} + +static int v_inspect(const char *path, int digest_only) +{ + static struct cs_subject s; + uint8_t id[32]; + const char *why = NULL; + char h[65]; + if (allen_load(path, &s, id, &why) != 0) { + fprintf(stderr, "allen: refused: %s\n", why ? why : "?"); + return 3; + } + if (digest_only) { + allen_hex(id, 32, h); + printf("%s\n", h); + return 0; + } + print_subject(&s, id); + return 0; +} + +static int v_lineage(const char *journal) +{ + CxStore cx; + uint8_t ref[32]; + char h[65]; + if (cx_open(&cx, journal, JOURNAL_SUBJECTS, CX_OPEN_READONLY) != CX_OK) { + fprintf(stderr, "allen: cannot open journal %s\n", journal); + return 3; + } + if (allen_lineage(&cx, ref) != 0) { + printf("ALLEN lineage unbound (journal has no record)\n"); + cx_close(&cx); + return 0; + } + allen_hex(ref, 32, h); + printf("ALLEN lineage %s records %llu\n", h, (unsigned long long)cx.n); + cx_close(&cx); + return 0; +} + +static int v_seed(const char *journal, uint64_t tag) +{ + CxStore cx; + CxHeader hd; + uint64_t payload[2] = {0x53454544ull, tag}; /* "SEED" + tag: fixture, not a claim */ + uint64_t id = 0; + uint8_t ref[32]; + char h[65]; + if (cx_open(&cx, journal, JOURNAL_SUBJECTS, CX_OPEN_SYNC) != CX_OK) { + fprintf(stderr, "allen: cannot create journal %s\n", journal); + return 3; + } + if (cx.n != 0) { + fprintf(stderr, "allen: journal already has %llu records\n", (unsigned long long)cx.n); + cx_close(&cx); + return 3; + } + memset(&hd, 0, sizeof hd); + hd.cls = CX_OBSERVATION; + hd.kind = CX_K_WORK_ACCEPTED; + hd.subject = 1; + hd.t = 1; + hd.generation = 1; + if (cx_append(&cx, &hd, payload, 2, &id) != CX_OK) { + fprintf(stderr, "allen: cannot append the genesis record\n"); + cx_close(&cx); + return 3; + } + allen_lineage(&cx, ref); + allen_hex(ref, 32, h); + printf("ALLEN seeded journal %s record %llu lineage %s\n", journal, (unsigned long long)id, h); + cx_close(&cx); + return 0; +} + +static int v_publish(int argc, char **argv) +{ + static struct cs_subject s; + static Rig r; + CxStore cx; + uint8_t id[32], model[32]; + int have_model = 0; + const char *why = NULL; + const char *path = argv[2], *journal = argv[3]; + char h[65]; + AllenBinding b; + uint64_t goal_seq = 0, published = 0; + int64_t last_cid = 0; + for (int i = 4; i < argc; i++) { + if (!strcmp(argv[i], "--model") && i + 1 < argc) have_model = allen_unhex(argv[++i], model, 32) == 0; + else return usage(); + } + if (allen_load(path, &s, id, &why) != 0) { + fprintf(stderr, "allen: refused: %s\n", why ? why : "?"); + return 3; + } + if (cx_open(&cx, journal, JOURNAL_SUBJECTS, CX_OPEN_SYNC) != CX_OK) { + fprintf(stderr, "allen: cannot open journal %s\n", journal); + return 3; + } + /* Memory binding first: a subject never acts on a journal that is not its own. */ + if (allen_check_memory(&s, &cx, &why) != 0) { + fprintf(stderr, "allen: refused: %s\n", why); + cx_close(&cx); + return 3; + } + if (rig_start(&r) != 0) { + fprintf(stderr, "allen: rig failed\n"); + rig_stop(&r); + cx_close(&cx); + return 4; + } + /* The organism's recorder: every crumb becomes a Cortex record (as the + * living system does). ALLEN does not write Cortex itself. */ + if (rx_cortex_attach(&r.w, &cx, SESSION) != RX_OK) { + fprintf(stderr, "allen: cortex attach failed\n"); + rig_stop(&r); + cx_close(&cx); + return 4; + } + allen_bind_identity(&r.w, &s, id, &b); + print_subject(&s, id); + allen_hex(b.agent, 32, h); + printf("ALLEN binding external_subject %u agent %s sequence %llu\n", b.external_subject, h, + (unsigned long long)b.sequence); + allen_hex(s.cortex, 32, h); + printf("ALLEN memory BOUND lineage %s journal %s\n", h, journal); + if (have_model) { + allen_hex(model, 32, h); + printf("ALLEN model %s (provenance only; not in the subject object)\n", h); + } else { + printf("ALLEN model none (no model required)\n"); + } + goal_seq = fld(&r, r.a.o.goal, 0); + for (uint32_t i = 0; i < s.n_intents; i++) { + RxMutation m[4]; + uint32_t n = allen_goal_mutations(&s.in[i], r.a.o.goal, ++goal_seq, m); + if (n == 0) { + goal_seq--; + continue; + } + last_cid = rx_world_publish_external(&r.w, r.ext_goal, m, n); + allen_hex(s.in[i].id, 32, h); + if (last_cid <= 0) { + printf("ALLEN publish intent %s REFUSED %lld\n", h, (long long)last_cid); + rx_cortex_detach(&r.w); + rig_stop(&r); + cx_close(&cx); + return 3; + } + printf("ALLEN publish intent %s -> EXTERNAL crumb %lld\n", h, (long long)last_cid); + published++; + } + rx_world_wait_quiescent(&r.w, 20000); + /* What AIEN did with it: readiness, not a call. */ + { + uint64_t assess_acts = 0, in_episode = 0; + for (uint64_t c = 1; c <= r.w.n_crumbs; c++) { + const RxCrumb *k = rx_world_crumb(&r.w, c); + if (!k || k->kind == RX_CRUMB_EXTERNAL || k->kind == RX_CRUMB_CREATE) continue; + if (k->reaction == r.a.r_assess && k->faculty == RX_FACULTY_AIEN) { + assess_acts++; + if ((int64_t)k->episode == last_cid) in_episode++; + } + } + printf("ALLEN goal object seq %llu regime %llu target_ns %llu intent_lo %016llx\n", + (unsigned long long)fld(&r, r.a.o.goal, 0), (unsigned long long)fld(&r, r.a.o.goal, 1), + (unsigned long long)fld(&r, r.a.o.goal, 2), (unsigned long long)fld(&r, r.a.o.goal, 3)); + printf("AIEN assess activations %llu in_episode_of_last_publish %llu assessment goal_seq %llu status %llu\n", + (unsigned long long)assess_acts, (unsigned long long)in_episode, + (unsigned long long)fld(&r, r.a.o.assessment, 0), (unsigned long long)fld(&r, r.a.o.assessment, 4)); + printf("ALLEN published %llu goals_in_world %u crumbs %llu journal_records %llu\n", + (unsigned long long)published, goals_in_world(&r), (unsigned long long)r.w.n_crumbs, + (unsigned long long)cx.n); + } + rx_cortex_detach(&r.w); + rig_stop(&r); + cx_close(&cx); + return 0; +} + +static int v_probe(const char *journal) +{ + static Rig r; + CxStore cx; + if (cx_open(&cx, journal, JOURNAL_SUBJECTS, CX_OPEN_READONLY) != CX_OK) { + fprintf(stderr, "allen: cannot open journal %s\n", journal); + return 3; + } + if (cx_verify_chain(&cx) != CX_OK) { + fprintf(stderr, "allen: journal chain does not verify\n"); + cx_close(&cx); + return 3; + } + if (rig_start(&r) != 0) { + fprintf(stderr, "allen: rig failed\n"); + rig_stop(&r); + cx_close(&cx); + return 4; + } + rx_world_wait_quiescent(&r.w, 20000); + printf("ALLEN probe journal_records %llu goals_in_world %u goal_seq %llu assessment_goal_seq %llu\n", + (unsigned long long)cx.n, goals_in_world(&r), (unsigned long long)fld(&r, r.a.o.goal, 0), + (unsigned long long)fld(&r, r.a.o.assessment, 0)); + rig_stop(&r); + cx_close(&cx); + return 0; +} + +int main(int argc, char **argv) +{ + if (argc < 2) return usage(); + if (!strcmp(argv[1], "make")) return v_make(argc, argv); + if (!strcmp(argv[1], "inspect") && argc == 3) return v_inspect(argv[2], 0); + if (!strcmp(argv[1], "digest") && argc == 3) return v_inspect(argv[2], 1); + if (!strcmp(argv[1], "lineage") && argc == 3) return v_lineage(argv[2]); + if (!strcmp(argv[1], "seed-journal") && (argc == 3 || argc == 4)) + return v_seed(argv[2], argc == 4 ? strtoull(argv[3], NULL, 10) : 0); + if (!strcmp(argv[1], "publish") && argc >= 4) return v_publish(argc, argv); + if (!strcmp(argv[1], "probe") && argc == 3) return v_probe(argv[2]); + return usage(); +} ```