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/aien-architecture-mv/blob/main/doctrine/ATLAS.md # aien-architecture-mv Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-architecture-mv / doctrine / ATLAS.md` 300 lines · 22919 bytes Raw Blame History Rendered 1 # DOCTRINE-001: ATLAS — The Irreducible Bootstrap Seed 2 3 4 > [!NOTE] 5 > **Historical Lineage & Provenance Note (not normative):** *Formerly designated Alpha (`alpha.bin`) during early lineage bootstrap drafting. Every prior architectural responsibility and contract of ALPHA transfers to ATLAS unchanged. Only `atlas.*` artifacts are canonical.* 6 7 8 ```text 9 Document ID: DOCTRINE-001 10 Milestone: Milestone 0 (DOCTRINE_V1) 11 Classification: Sovereign Machine Canonical Doctrine 12 Target Substrate: AArch64 Bare Metal (ARMv8.2-A / ARMv9-A) 13 Status: AUTHORITATIVE / CANONICAL 14 ``` 15 16 --- 17 18 ## 1. Executive Summary & Definition 19 20 **Atlas** is the irreducible bootstrap seed of the Sovereign Machine. 21 22 Atlas is not an operating system, not a kernel, not a runtime, not an agent, and not an intelligence. It is the minimal, immutable, deterministic physical origin point from which the machine establishes trustworthy execution. 23 24 The doctrine of Atlas rests upon five fundamental tenets: 25 1. **Small**: Atlas contains the minimum number of machine instructions necessary to validate the physical platform, measure the secondary boot stages, and transfer control to Physics. It carries zero extraneous logic. 26 2. **Fixed**: Atlas is immutable. Its bytes are burned into permanent read-only media or sealed into write-locked non-volatile firmware. Once finalized, it is never modified in-place. 27 3. **Auditable**: Every single byte, opcode, branch target, register mutation, and memory reference in Atlas is statically known, formally characterized, and human-verifiable. 28 4. **Deterministic**: Given identical platform inputs, Atlas follows the exact same execution path, cycle count bounds, and state transitions on every boot invocation without variance. 29 5. **Non-Intelligent**: Atlas possesses zero cognitive capacity. It contains no neural weights, no heuristic optimizers, no policy graphs, and no adaptive mechanisms. It is pure mechanical constraint. 30 31 ```text 32 ┌────────────────────────────────────────────────────────────────────────┐ 33 │ ATLAS │ 34 │ (Irreducible Bootstrap Seed) │ 35 │ │ 36 │ ┌───────────────┐ ┌────────────────┐ ┌──────────────────┐ │ 37 │ │ Platform Init │ ──> │ Integrity & │ ──> │ Transfer Control │ │ 38 │ │ (Bare Metal) │ │ Measurement │ │ to Physics │ │ 39 │ └───────────────┘ └────────────────┘ └──────────────────┘ │ 40 │ │ │ │ │ 41 │ ▼ ▼ ▼ │ 42 │ Strict MMU / SHA-256 / Monotonic │ 43 │ Registers Manifest Match Handoff (contract EL) │ 44 └─────────────────────────────────┬──────────────────────────────────────┘ 45 │ 46 ▼ 47 ┌────────────────────────────────────────────────────────────────────────┐ 48 │ PHYSICS │ 49 │ (Trusted Machine Authority) │ 50 └────────────────────────────────────────────────────────────────────────┘ 51 ``` 52 53 --- 54 55 ## 2. Canonical Executable Artifact 56 57 The sole executable artifact generated for Atlas is: 58 59 ```text 60 atlas.bin 61 ``` 62 63 In the Sovereign Machine architecture, the executable identity invariant is absolute: 64 65 $$\text{tested bytes} \equiv \text{evaluated bytes} \equiv \text{authorized bytes} \equiv \text{executed bytes}$$ 66 67 Source code is historical provenance; `atlas.bin` is the sole physical truth. To ensure that `atlas.bin` can be completely audited and verified across space and time, every build must produce a canonical bundle of seven supporting evidence files. 68 69 ### 2.1 The Supporting Evidence Bundle 70 71 | Evidence File | Format | Purpose and Invariants | 72 | :--- | :--- | :--- | 73 | `atlas.bin` | Raw Binary Image | The exact immutable byte stream executed by the processor at reset or early handoff. Contains raw machine opcodes; no dynamic headers. | 74 | `atlas.manifest` | Canonical TOML / JSON | Machine-readable declaration of entry point, load base, binary size, version, target tuple, authoring toolchain hash, and section boundaries. | 75 | `atlas.sha256` | Text / Checksum | Cryptographic SHA-256 digest of `atlas.bin`. Must match the hash stored in hardware Root of Trust / fused registers. | 76 | `atlas.decode` | Annotated Disassembly | Full linear instruction disassembly mapping every 4-byte word to its canonical AArch64 mnemonic, register operands, and immediate values. | 77 | `atlas.memory-map` | Symbolic Address Map | Explicit map of all physical memory regions: text, read-only data, reserved scratchpad stack, MMIO peripheral registers, and Physics staging buffers. | 78 | `atlas.control-flow` | Directed Graph / DOT | Exhaustive Control Flow Graph (CFG). Enumerates every basic block, conditional branch, static jump, and exception vector. Zero unresolved dynamic targets permitted. | 79 | `atlas.audit` | Formal Audit Ledger | Tabular line-by-line verification record proving that every byte is accounted for, every memory dereference is bounded, and every architectural side effect is safe. | 80 81 --- 82 83 ## 3. Atlas Responsibilities & Explicit Non-Responsibilities 84 85 Atlas's authority is strictly bounded by design. Any expansion of Atlas beyond its minimal role compromises the auditability of the bootstrap root. 86 87 ```text 88 ATLAS RESPONSIBILITY BOUNDARY 89 ┌────────────────────────────────────────────────────────────────┐ 90 │ INCLUDED (Atlas Responsibilities): │ 91 │ [✓] Architectural register hygiene & initialization │ 92 │ [✓] Identity-mapped minimal page tables (EL1/EL2) │ 93 │ [✓] Diagnostic console (polled MMIO UART) bringup │ 94 │ [✓] Verification & measurement of Physics image │ 95 │ [✓] Monotonic, irreversible handoff to Physics │ 96 │ [✓] Fail-closed panic / halt state on anomaly │ 97 ├────────────────────────────────────────────────────────────────┤ 98 │ EXCLUDED (Explicit Non-Responsibilities): │ 99 │ [✗] NO Filesystem (No ext4, FAT, ZFS, NVMe block layer) │ 100 │ [✗] NO Network (No TCP/IP, Ethernet, sockets, PCIe NICs) │ 101 │ [✗] NO Model (No neural networks, weights, KV cache, LLM) │ 102 │ [✗] NO General Runtime (No heap allocator, threads, libc) │ 103 │ [✗] NO Optimizer (No JIT, heuristics, runtime tuning) │ 104 │ [✗] NO Omega Compiler (No IR lowering, program synthesis) │ 105 │ [✗] NO Aien (No agents, no goals, no semantic reasoning) │ 106 └────────────────────────────────────────────────────────────────┘ 107 ``` 108 109 ### 3.1 Explicit Responsibilities 110 1. **Platform Hygiene**: Cleanse all processor state inherited from firmware/reset. Clear speculative flags, scrub general-purpose registers, set architectural control registers (`SCTLR_EL1`, `CPACR_EL1`, `TCR_EL1`) to safe, deterministic initial configurations. 111 2. **Deterministic Memory Substrate**: Configure minimal, static page tables covering only the Atlas text, read-only data, stack, diagnostic MMIO, and the Physics load window. 112 3. **Diagnostic Telemetry**: Initialize a physical diagnostic UART in polled, unbuffered mode to emit raw ASCII/hex error codes and milestones. 113 4. **Physics Measurement**: Read `physics.bin`, compute its cryptographic hash, verify it against the signed `physics.manifest`, and ensure its location adheres to the physical memory contract. 114 5. **Irreversible Handoff**: Prepare the CPU registers with the physical machine contract descriptor and jump into `physics.bin` entry point, irrevocably relinquishing execution. 115 6. **Deterministic Halting**: In the event of any bit discrepancy, signature failure, or unexpected exception, halt the CPU immediately in an unrecoverable fail-closed spin loop (`wfe`/`wfi`) after broadcasting a diagnostic fault code. 116 117 ### 3.2 Explicit Non-Responsibilities 118 - **No Filesystem**: Atlas does not parse partition tables (GPT/MBR), disk formats, file trees, or inode structures. `physics.bin` is retrieved from raw, pre-mapped physical memory or memory-mapped flash. 119 - **No Network**: Atlas contains no network interface card (NIC) drivers, no MAC layer, no ARP, no IP stack, and no remote boot protocol. 120 - **No Model**: Atlas contains zero parameters, neural layers, tokenizers, or inference logic. It has no concept of language or reasoning. 121 - **No General Runtime**: Atlas operates without a heap (`malloc`/`free` do not exist). It does not schedule tasks, handle preemption, support multithreading, or manage user processes. 122 - **No Optimizer**: Atlas does not evaluate execution efficiency, profile code paths, or synthesize instructions. 123 - **No Omega Compiler**: Atlas does not compile or translate Intermediate Representations (IR). 124 - **No Aien**: The cognitive layer of the Sovereign Machine (Aien) does not exist during Atlas's lifetime. Aien cannot influence its own bootstrap seed. 125 126 --- 127 128 ## 4. Machine Contract: AArch64 Bare Metal 129 130 Atlas executes directly on bare metal AArch64 hardware. It relies on a rigorous physical contract: 131 132 ```text 133 0x0000_0000 ┌──────────────────────────────────────────┐ 134 │ Boot ROM / Firmware Reserved │ 135 0x4000_0000 ├──────────────────────────────────────────┤ <── Atlas Load Base 136 │ Atlas Code & Read-Only Data (.text/.rodata)│ [64 KB max] 137 0x4001_0000 ├──────────────────────────────────────────┤ 138 │ Atlas Static Scratch & Stack │ [64 KB] 139 0x4002_0000 ├──────────────────────────────────────────┤ <── Physics Staging Buffer 140 │ Physics Canonical Binary (physics.bin) │ [Up to 16 MB] 141 0x4102_0000 ├──────────────────────────────────────────┤ 142 │ Available RAM / Dynamic Allocation Pool │ 143 │ (Managed exclusively by Physics) │ 144 0x0900_0000 ├──────────────────────────────────────────┤ <── MMIO Region 145 │ PL011 / Diagnostic UART Registers │ 146 └──────────────────────────────────────────┘ 147 ``` 148 149 ### 4.1 Architecture & Endianness 150 - **Target Architecture**: AArch64 (ARMv8.2-A or later). 151 - **Endianness**: Strictly Little-Endian. Atlas verifies that the `EE` (Exception Endianness) and `E0E` bits in `SCTLR_EL1` (and `SCTLR_EL2` if entering at EL2) are cleared to `0`. If big-endian execution is detected, the processor vectors immediately to the terminal halt state. 152 153 ### 4.2 Entry Address & Privilege Level 154 - **Entry Address**: Standardized at physical base address `0x4000_0000` (or `0x8000_0000` depending on platform board definitions, codified in `atlas.manifest`). 155 - **Entry Exception Level**: Declared by the machine contract (**EL2** or **EL1**). Atlas verifies `CurrentEL` against the contract and enters the fail-closed halt state on any mismatch. 156 - **Physics Handoff Level**: Declared by the machine contract. Control is transferred to Physics under `PHYSICS_ENTRY_ABI` at the contract-defined exception level with interrupts masked (`DAIF = 0xF`). Atlas performs no implicit EL2 -> EL1 transition. 157 - **Current QEMU Contract**: `CONTRACT-QEMU-VIRT-AARCH64-M2` specifies EL1 entry. Register names below are shown for an EL1 contract; an EL2 contract uses the corresponding `_EL2` registers. 158 159 ### 4.3 Architectural Register State 160 Upon entry into Atlas: 161 - General-Purpose Registers: `x0`-`x30` are assumed to contain untrusted data from the previous bootloader stage. 162 - Register Sanitation: Atlas immediately zeroes `x1` through `x30`. If `x0` carries a platform device tree or firmware descriptor pointer, it is validated against physical memory bounds; otherwise, `x0` is also zeroed. 163 - Stack Pointer: The stack pointer `SP_EL1` is explicitly pointed to the high end of the dedicated 64 KB static scratchpad area: 164 $$\text{SP\_EL1} = \text{0x4002\_0000}$$ 165 - System Registers Configuration: 166 - `SCTLR_EL1`: Configured with MMU disabled (`M=0`), Data Cache disabled (`C=0`), Instruction Cache disabled (`I=0`) during initial bootstrap, then Instruction Cache enabled (`I=1`) once validation begins. Strict alignment checking (`A=1`, `SA=1`) is permanently asserted. 167 - `CPACR_EL1`: Traps for FP/SIMD are disabled (`FPEN = 0b11`) to permit standard register hygiene, but FP instructions are forbidden within Atlas code. 168 - `DAIF`: Set to `0xF` (Debug, SError, IRQ, FIQ masked). No interrupts are unmasked during Atlas's lifecycle. 169 170 ### 4.4 Memory Map and Alignment Contract 171 - **Instruction Alignment**: Every instruction must be 32-bit (4-byte) aligned. 172 - **Memory Access Alignment**: Strict alignment enforcement. Unaligned loads/stores result in an Alignment Fault, triggering immediate shutdown. 173 - **Cache Line Alignment**: Entry points, exception vectors, and critical verification structures must be aligned to 64-byte cache line boundaries. 174 - **Page Size**: Minimal identity translation uses 4 KB or 64 KB granule pages with Level 1/Level 2 block descriptors to avoid deep table walks. 175 176 ### 4.5 Diagnostic Console Contract 177 - Polled MMIO UART (e.g., ARM PrimeCell PL011 or standard 16550) mapped into a dedicated 4 KB device memory page (`Device-nGnRE`). 178 - Zero interrupts. Atlas transmits bytes by polling the UART `FR` (Flag Register) until the Transmit FIFO is not full (`TXFF == 0`), writing the 8-bit ASCII character to `DR` (Data Register). 179 - Diagnostic format: 2-character hex status prefixes followed by newline (e.g., `00` = reset, `01` = registers scrubbed, `02` = physics measured, `EE` = fatal failure). 180 181 ### 4.6 Terminal Failure State (Fail-Closed) 182 If any check fails: 183 1. Write 2-byte failure code to UART. 184 2. Disable all caches and MMU. 185 3. Zero all general purpose registers `x0`-`x30`. 186 4. Enter an infinite, interrupt-masked terminal spin loop: 187 ```asm 188 msr daifset, #0xf 189 1: wfe 190 b 1b 191 ``` 192 5. No reboot loops, no silent recovery, no fallback execution paths. 193 194 --- 195 196 ## 5. Atlas Audit Specification 197 198 The Atlas Audit is the definitive proof of correctness and boundedness. Every single instruction in `atlas.bin` must be documented in `atlas.audit`. 199 200 ### 5.1 Audit Invariants 201 1. **Total Reachability**: Every byte in `atlas.bin` must belong to a reachable basic block starting from the entry point, or a formally defined static data table. Zero orphaned bytes. 202 2. **Bounded Control Flow**: All branches (`b`, `b.cond`, `bl`, `cbz`, `cbnz`, `tbz`, `tbnz`) must target statically provable offsets within the text segment of `atlas.bin`. Indirect register branches (`br`, `blr`) are **strictly prohibited**, except for the final single transfer to Physics: 203 $$\text{br } x0 \quad (\text{where } x0 \equiv \text{PHYSICS\_ENTRY\_POINT})$$ 204 3. **Bounded Memory Access**: Load and store instructions (`ldr`, `str`, `ldp`, `stp`) must access only: 205 - The predefined static stack frame (`[SP, #offset]`). 206 - The declared MMIO UART address space. 207 - The verified read-only memory window containing `physics.bin`. 208 4. **Zero Self-Modification**: No instruction may write to any memory range marked executable. The page tables strictly enforce `W^X` (Write XOR Execute). 209 210 ### 5.2 Line-by-Line Audit Ledger Schema 211 212 Each instruction in `atlas.audit` is recorded using the following standardized schema: 213 214 ```text 215 | Offset | Raw Bytes | Decoded Op | Inputs | Outputs | Branch Target | Memory Accessed | Privilege Required | 216 ``` 217 218 #### Canonical Audit Ledger Excerpt: 219 220 | Offset | Raw Bytes | Decoded Op | Inputs | Outputs | Branch Target | Memory Accessed | Privilege | 221 | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | 222 | `0x0000` | `0xD5384100` | `mrs x0, CurrentEL` | `CurrentEL` | `x0` | `None` | `None` | `EL1/EL2` | 223 | `0x0004` | `0xD3424000` | `lsr x0, x0, #2` | `x0` | `x0` | `None` | `None` | `EL1/EL2` | 224 | `0x0008` | `0x7100081F` | `cmp w0, #2` | `w0` | `NZCV` | `None` | `None` | `EL1/EL2` | 225 | `0x000C` | `0x540000A0` | `b.eq 0x0020` | `NZCV` | `PC` | `0x0020` (EL2 setup) | `None` | `EL1/EL2` | 226 | `0x0010` | `0x7100041F` | `cmp w0, #1` | `w0` | `NZCV` | `None` | `None` | `EL1/EL2` | 227 | `0x0014` | `0x54000100` | `b.eq 0x0034` | `NZCV` | `PC` | `0x0034` (EL1 setup) | `None` | `EL1/EL2` | 228 | `0x0018` | `0x14000030` | `b 0x00D8` | `None` | `PC` | `0x00D8` (Halt Panic) | `None` | `EL1/EL2` | 229 | `...` | `...` | `...` | `...` | `...` | `...` | `...` | `...` | 230 | `0x01F8` | `0x58000140` | `ldr x0, [PC, #40]` | `PC` | `x0` | `None` | `0x0220` (Phys Base)| `EL1` | 231 | `0x01FC` | `0xD61F0000` | `br x0` | `x0` | `PC` | `Physics Entry` | `None` | `EL1` | 232 233 Every byte must be accounted for in the complete `atlas.audit` ledger. Unexplained data or non-audited opcodes invalidate the machine release. 234 235 --- 236 237 ## 6. Verification Gates 238 239 Before an Atlas build is admitted as a Sovereign Machine release, it must clear four mandatory, sequential verification gates: 240 241 ```text 242 ┌──────────┐ 243 │ ATLAS-0 │ ──> ATLAS_BOOT_PASS (Executes from reset to handoff on silicon) 244 └────┬─────┘ 245 ▼ 246 ┌──────────┐ 247 │ ATLAS-1 │ ──> ATLAS_AUDIT_PASS (100% reachable byte & branch accounting) 248 └────┬─────┘ 249 ▼ 250 ┌──────────┐ 251 │ ATLAS-2 │ ──> ATLAS_CORRUPTION_REFUSAL_PASS (1-bit mutation halts machine) 252 └────┬─────┘ 253 ▼ 254 ┌──────────┐ 255 │ ATLAS-3 │ ──> ATLAS_REPRODUCIBILITY_PASS (Identical byte-for-byte build & trace) 256 └──────────┘ 257 ``` 258 259 ### 6.1 Gate ATLAS-0: `ATLAS_BOOT_PASS` 260 - **Criterion**: `atlas.bin` boots on bare-metal hardware (or validated hardware-accurate emulator) from initial reset or firmware handoff, cleanses the processor state, initializes memory, validates the Physics payload, and successfully transitions execution to Physics. 261 - **Evidence Required**: 262 - Raw UART console log capturing the expected sequence of diagnostic checkpoint tokens. 263 - Hardware trace showing successful execution of the final `br x0` instruction into `physics.bin`. 264 265 ### 6.2 Gate ATLAS-1: `ATLAS_AUDIT_PASS` 266 - **Criterion**: The build passes automated static audit analysis. 267 - Zero instructions outside declared memory bounds. 268 - Zero indirect jumps except the final Physics entry point. 269 - Zero unverified NOP padding or orphaned bytes. 270 - 100% compliance with `atlas.audit` line-by-line verification rules. 271 - **Evidence Required**: Signed `atlas.audit` and `atlas.control-flow` artifacts with zero unresolved edges and zero warnings from the audit validator tool. 272 273 ### 6.3 Gate ATLAS-2: `ATLAS_CORRUPTION_REFUSAL_PASS` (1-Byte Mutation Test) 274 - **Criterion**: The system must prove its refusal capability against corruption. A test harness systematically introduces single-bit and single-byte mutations: 275 1. Any 1-byte mutation in `atlas.bin` must fail static signature verification before execution. 276 2. Any 1-byte mutation in `physics.bin` must be detected by Atlas's SHA-256 measurement loop, causing immediate abort and transition to the terminal fail-closed halt state. 277 3. The corrupted payload must **never** be executed under any circumstance. 278 - **Evidence Required**: Automated test matrix report showing 1,000 randomized 1-bit and 1-byte corruption trials against `physics.bin`, with a 100% refusal and safe-halt rate. 279 280 ### 6.4 Gate ATLAS-3: `ATLAS_REPRODUCIBILITY_PASS` 281 - **Criterion**: Complete, bit-for-bit reproducibility of the binary artifact and its execution trace. 282 - The binary `atlas.bin` must be bit-for-bit reproducible across independent builds on distinct host systems using the certified toolchain container. 283 - The runtime execution trace (instruction retired count, memory read sequence, register transitions) must be identical between consecutive boots given the same platform inputs. 284 - **Evidence Required**: Identical SHA-256 digests across 3 independent clean-room builds, and cycle-accurate execution trace equality up to the Physics entry instruction. 285 286 --- 287 288 ## 7. Canonical Invariant Checklist 289 290 Before declaring Milestone 0 complete for Atlas, the following invariants must be verified: 291 292 - [ ] `atlas.bin` size is strictly within limits ($\le$ 64 KB). 293 - [ ] No heap memory allocator is present or linked. 294 - [ ] No file system driver or network stack is present. 295 - [ ] No floating-point or vector registers are used. 296 - [ ] Every branch target is direct and statically bounded. 297 - [ ] MMIO UART access is strictly synchronous and polled. 298 - [ ] Single-byte corruption results in immediate, fail-closed terminal halt. 299 - [ ] Handoff to Physics is monotonic and irreversible. 300 - [ ] All 7 supporting evidence files are generated and cryptographically bound.