diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..c71b1cd --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,19 @@ +# Instructions for agents working on AIEN architecture + +Before making cross-project architectural or roadmap changes, read these files in order: + +1. `PLAN_AUTHORITY.md` +2. `CURRENT_EXECUTION_PLAN.md` +3. `doctrine/ARCHITECTURE.md` +4. `doctrine/ROADMAP.md` +5. the relevant accepted ADRs + +Rules: + +- There is one active cross-project master implementation plan: `CURRENT_EXECUTION_PLAN.md`. +- Do not create another “master”, “final”, “complete”, or “canonical” whole-system plan. +- Superseded plan files under `docs/archive/plans/` are historical only. +- Component roadmaps are local implementation aids and do not override cross-project architecture or sequencing. +- Current subsystem name: FORGE. Historical `PHYSICS_*` milestone IDs/receipts remain unchanged. +- Implementation/evidence truth beats planning claims. If code and plan differ, record the discrepancy; do not pretend the target is implemented. +- A milestone status changes only in `doctrine/ROADMAP.md`. diff --git a/AIEN_COMPLETE_SYSTEM_ARCHITECTURE.md b/AIEN_COMPLETE_SYSTEM_ARCHITECTURE.md index 2726d6f..d6c39d6 100644 --- a/AIEN_COMPLETE_SYSTEM_ARCHITECTURE.md +++ b/AIEN_COMPLETE_SYSTEM_ARCHITECTURE.md @@ -1,3383 +1,14 @@ -# AIEN Complete System Architecture -## Universal Local AI Runtime, Heterogeneous Compute Fabric, Skills/Tools, J-Space, Security, Memory, Provenance, and Self-Improvement +# Superseded plan -**Document status:** Architecture RFC / implementation roadmap -**Snapshot date:** September 22, 2026 -**Primary composition root reviewed:** `aien-dev/aien-sovereign-core` -**Current public `main` snapshot reviewed:** `cacf2264b52cac20ba0ac6aee55fcde9110d97b6` -**Naming convention:** Physical hosts are always referred to as **Machine 1**, **Machine 2**, **Machine 3**, and so on. Hardware type is metadata, not identity. +**Status: SUPERSEDED / HISTORICAL** ---- +This document is no longer an active plan. -# 1. Executive Summary - -AIEN should become a **single logical AI system that can use every compatible machine, accelerator, model, skill, tool, memory store, and verifier available to it without making any one hardware vendor, model vendor, cloud service, or protocol the center of the architecture**. - -The project already contains unusually strong pieces: - -- a native Rust runtime spine, -- scheduler and sequence lifecycle, -- branchable/paged KV state, -- native transformer execution, -- Unix-domain-socket operator control, -- Cortex memory, -- AEGIS policy enforcement, -- signed evaluation receipts and TPM-oriented signing primitives, -- RSI candidate evaluation and promotion, -- multiple Rust MCP servers, -- benchmark/provenance infrastructure, -- cockpit/operator interfaces, -- harness/debugger/inquisitor subsystems, -- model adapters, -- and a growing set of real effect integrations. - -The largest remaining problem is no longer “can AIEN run inference?” It is **composition**. - -AIEN still needs one canonical layer that answers all of the following: - -1. **What work needs to happen?** -2. **What skill or tool can perform it?** -3. **Which Machine can perform it?** -4. **Which model or accelerator should be used?** -5. **Can the work be explored in parallel branches?** -6. **What state belongs to each branch?** -7. **What effects are permitted?** -8. **How do we prove what actually happened?** -9. **What should be remembered?** -10. **How should the system improve from the result?** - -The target architecture is therefore: - -```mermaid -flowchart TD - U[User / Operator / API] --> C[AIEN Control Plane] - C --> R[AIEN Runtime] - R --> JS[J-Space Planner and Judge] - JS --> SR[Skill Router] - SR --> CG[Capability Graph] - - CG --> NT[Native AIEN Tools] - CG --> MCP[MCP Broker] - CG --> FP[Fabric-Provided Tools] - - JS --> IF[Inference Runtime] - IF --> MC[Model Capsule Registry] - IF --> AD[Accelerator Dispatch] - - AD --> M1[Machine 1] - AD --> M2[Machine 2] - AD --> M3[Machine 3] - AD --> MN[Machine N] - - M1 --> FAB[AIEN Fabric] - M2 --> FAB - M3 --> FAB - MN --> FAB - - NT --> AE[AEGIS Authorization] - MCP --> AE - FP --> AE - - AE --> EB[Effect Broker] - EB --> EXT[External World] - - R --> W[World Store] - JS --> W - EB --> W - - W --> P[Signed Provenance] - P --> CX[Cortex] - CX --> R - - R --> RSI[RSI Optimizer] - RSI --> H[Harness / Inquisitor / Benchmarks] - H --> R -``` - -The central design principle is: - -> **AIEN is one logical runtime. Machines are interchangeable capability providers. Models are interchangeable inference providers. MCP is an adapter. Tools are atomic capabilities. Skills are composed procedures. J-Space is the branch-and-judge planning substrate. Worlds hold state. AEGIS verifies. The Effect Broker adapter performs verified irreversible actions. Provenance proves. Cortex remembers. RSI improves.** - ---- - - -# 1A. Resolved Architecture Decisions After Sovereign Manifesto Review - -The `open-humanity/docs/SOVEREIGN_MANIFESTO.md` establishes several architectural invariants that directly affect MCP, secrets, Fabric placement, and speculative execution: - -- local-first execution, -- compiled Rust/Mojo core services, -- zero telemetry, -- zero plaintext secrets on disk, -- hardware-backed vaulting, -- durable memory, -- encrypted peer cooperation. - -The following decisions are therefore **closed** for the target architecture. - -## Decision 1: `aien-mcp` lives inside `aien-sovereign-core` - -Canonical location: - -```text -aien-sovereign-core/ -└── crates/ - └── aien-mcp/ -``` - -Do **not** create a separate canonical MCP repository first. - -Reasons: - -1. MCP is part of AIEN's runtime capability plane, not an independent product. -2. It must share canonical types with `aien-capability`, `aien-policy`, `aien-vault`, `aien-fabric`, `aien-world`, and provenance. -3. Keeping it in the composition root prevents another source-of-truth split. -4. Existing MCP implementations in `spark-debugger` and `aien-harness` should migrate into adapters/tests around `aien-mcp`. -5. A separate public SDK crate or mirror can be published later from the canonical source if external adoption warrants it. - -Do not start this work by mixing it into unrelated local edits on `fix/golden-path-gaps`. Create a clean feature branch from the appropriate synchronized base once the golden-path work is committed or isolated. - -Recommended branch: - -```text -feat/aien-mcp-broker -``` - -## Decision 2: AEGIS applies to every capability provider - -Every tool invocation crosses the same canonical authorization envelope regardless of provider: - -```text -Native Tool -MCP Tool -Fabric Tool -WASM Tool -Process Tool -HTTP Tool - │ - ▼ -Capability Invocation - │ - ▼ -AEGIS - │ - ├── deny - └── allow - │ - ▼ - Executor -``` - -This does **not** mean every read operation requires human approval. - -It means every provider enters the same policy boundary. Policy may deterministically auto-allow safe/read-only operations. - -The result is one policy model and one receipt family rather than separate trust models for MCP, native tools, and remote Machines. - -The MCP broker **routes**. It does not become an alternative policy authority. - -## Decision 3: Third-party servers may request environment variables, but AIEN configuration never stores the plaintext value - -Third-party compatibility requires handling servers that expect environment variables such as: - -```text -GITHUB_TOKEN -DATABASE_URL -API_KEY -``` - -AIEN should accept the **binding requirement**, not a plaintext value. - -Example: - -```rust -CredentialRef { - provider: CredentialProvider::Vault, - name: "github.operator", - scope: CredentialScope::MachineResolvable, - delivery: CredentialDelivery::ChildEnv { - variable: "GITHUB_TOKEN", - }, -} -``` - -The stored configuration contains only the reference. - -At execution time: - -```text -ToolCall - ↓ -AEGIS - ↓ -Fabric placement - ↓ -MCP Broker on selected Machine - ↓ -Vault resolve - ↓ -launch one child with one ephemeral variable - ↓ -child exits - ↓ -credential value discarded -``` - -The model, J-Space state, tool arguments, World records, logs, Cortex, and provenance receipts never contain the resolved secret. - -### Important limitation - -A bearer token must exist in plaintext **somewhere in volatile memory** when an HTTP client or legacy child process actually authenticates with it. - -Therefore the realistic invariant is: - -> No plaintext secret at rest, in configuration, prompts, logs, receipts, or long-lived caches; plaintext is materialized only at the smallest possible execution boundary for the shortest possible time. - -Preferred delivery order: - -1. broker-owned authentication, where the child never sees the token; -2. short-lived OAuth/access token owned by the broker; -3. inherited file descriptor / pipe / local socket when supported; -4. call-scoped child environment variable only for legacy compatibility. - -Environment-variable delivery should be tagged as a higher exposure class. - -## Decision 4: Credential scope participates in Fabric placement - -A TPM-backed vault is physically local. - -A credential that exists only on one Machine cannot magically resolve elsewhere. - -Do not hard-code a Machine ID into every semantic tool request. Instead, make **credential scope** part of placement constraints. - -```rust -pub enum CredentialScope { - FabricResolvable, - MachineBound(MachineId), - OperatorBound(OperatorId), - SessionBound(SessionId), -} -``` - -Resolution: - -```text -Tool requires github.operator - ↓ -Capability Graph - ↓ -Credential Resolver - ↓ -Which Machines can satisfy it? - ↓ -Fabric Scheduler - ↓ -eligible Machine selected -``` - -If Machine 2 cannot resolve the required credential, Machine 2 is not an eligible placement. - -This is a scheduling constraint, not a late runtime surprise. - -## Decision 5: Every tool declares effect semantics before J-Space may route it - -J-Space must not infer side effects from a tool name. - -Each tool declares an explicit effect set. - -Recommended model: - -```rust -bitflags! { - pub struct ToolEffects: u32 { - const PURE = 0; - const READ_FILESYSTEM = 1 << 0; - const READ_NETWORK = 1 << 1; - const SPAWN_PROCESS = 1 << 2; - const WORLD_MUTATION = 1 << 3; - const LOCAL_EPHEMERAL = 1 << 4; - const EXTERNAL_WRITE = 1 << 5; - const EXTERNAL_IRREVERSIBLE= 1 << 6; - const SECRET_BEARING = 1 << 7; - } -} -``` - -J-Space policy: - -| Effect type | Speculative J-Space execution | -|---|---| -| Pure | Yes | -| Read-only | Yes | -| Local ephemeral | Yes, sandboxed | -| Process spawn | Yes when sandboxed and bounded | -| World mutation | Yes, but only inside a draft World | -| External write | Stage intent only until winner | -| External irreversible | Never execute on speculative branch | -| Secret-bearing | Only through brokered isolated execution | - -Example: `debug_scan` is not simply "read-only" because it may spawn local checks and probe services. Its descriptor should declare the actual operations, for example: - -```text -READ_FILESYSTEM -READ_NETWORK -SPAWN_PROCESS -LOCAL_EPHEMERAL -``` - -That lets J-Space execute it safely as a bounded evaluator without treating it as an externally visible write. - -The universal rule is: - -> J-Space may explore freely inside reversible Worlds. External reality changes only after selection, AEGIS authorization, and commit through the Effect Broker. - ---- - -# 2. Architectural Principles - -## 2.1 Hardware must not define AIEN - -AIEN must not require CUDA, NVIDIA, Apple, AMD, a cloud provider, or a single machine. - -The runtime should depend only on a hardware-neutral accelerator interface. - -A Machine advertises capabilities such as: - -```rust -pub struct MachineCapabilities { - pub machine_id: MachineId, - pub cpu_arch: CpuArch, - pub cpu_cores: u16, - pub memory_total_bytes: u64, - pub memory_available_bytes: u64, - pub accelerators: Vec, - pub supported_dtypes: DTypeSet, - pub models_cached: Vec, - pub tool_providers: Vec, - pub thermal_state: ThermalState, - pub power_state: PowerState, -} -``` - -The scheduler should reason over capabilities, not brand names. - ---- - -## 2.2 One logical system, many physical processes - -AIEN should **not** attempt to stretch one operating-system process or one address space across multiple machines. - -Instead: - -- every Machine runs an `aien-node`, -- all Machines participate in one logical Fabric, -- state identifiers are global, -- memory ownership remains local, -- work can move, -- failed Machines can be replaced, -- content is addressed by digest, -- and state can be reconstructed from durable roots. - -```mermaid -flowchart LR - CP[Logical AIEN Runtime] - - CP --> M1[Machine 1] - CP --> M2[Machine 2] - CP --> M3[Machine 3] - CP --> M4[Machine 4] - - M1 <-->|QUIC / trusted transport| M2 - M2 <-->|QUIC / trusted transport| M3 - M3 <-->|QUIC / trusted transport| M4 - M1 <-->|content / work / state| M4 -``` - ---- - -## 2.3 Tools are not skills - -**Tool:** one atomic capability. - -Examples: - -- `filesystem.read` -- `filesystem.write` -- `process.execute` -- `git.diff` -- `git.commit` -- `mail.send` -- `browser.navigate` -- `cortex.search` -- `database.query` - -**Skill:** a reusable procedure that can invoke multiple tools and can contain planning, success criteria, verification rules, and J-Space strategy. - -Examples: - -- `software.debug.rust` -- `software.review.pull_request` -- `software.implement.feature` -- `research.deep` -- `communication.answer_email` -- `operations.release` - -This distinction must become canonical. - ---- - -## 2.4 MCP is compatibility, not the core architecture - -MCP is useful and important, but AIEN should not make the internal runtime depend on MCP semantics. - -The canonical path should be: - -```text -AIEN Capability ABI - ├── Native Tool adapter - ├── MCP adapter - ├── HTTP/OpenAPI adapter - ├── WASM Component adapter - ├── Process adapter - └── Fabric Remote Tool adapter -``` - -The model sees **AIEN capabilities**, not raw MCP topology. - ---- - -## 2.5 Effects are transactional - -Models, skills, tools, and J-Space branches should be able to propose actions. - -Only a dedicated effect boundary should perform irreversible external actions. - -```mermaid -flowchart LR - A[Agent / Skill / J-Space] --> I[EffectIntent] - I --> G[AEGIS] - G -->|deny| D[Stop] - G -->|allow| B[Effect Broker] - B --> E[External System] - E --> R[Execution Receipt] - R --> W[World Commit] - W --> P[Signed Provenance] -``` - ---- - -## 2.6 Memory is not execution state - -Cortex should remember durable knowledge and evidence. - -Worlds should represent branchable runtime state. - -KV state should represent inference state. - -J-Space should represent candidate/evaluation/search state. - -They should reference one another by stable IDs, not collapse into one database. - ---- - -# 3. Current AIEN Project: What Exists Today - -This section distinguishes current implementation from the target architecture. - -## 3.1 `aien-sovereign-core` - -Current workspace members include: - -- `aien-cli` -- `spark-cockpit-rs` -- `cortex-rs` -- `spark-hive` -- `spark-supervisor` -- `spark-discord-hub` -- `spark-debugger` -- `spark-harness` -- `spark-dream` -- `spark-adapters` -- `spark-crumbs` -- `spark-inquisitor` -- `spark-max-cabi` -- `spark-max-rs` -- `cortex-encoder-rs` -- `spark-mail-rs` -- `spark-harvester` -- `spark-aegis` -- `aien-inference-abi` -- `aien-kv-cache` -- `aien-scheduler` -- `aien-security` -- `aien-platform` -- `aien-platform-linux` -- `aien-runtime` -- `rad-id-sync` -- `aien-inference-protocol` -- `aien-inference-runtime` - -The current public `main` has already connected native chat to the runtime socket and connected the native runtime to scheduler/KV/streaming paths. - -### Keep - -`aien-sovereign-core` should remain the **canonical composition root** and product repo. - -### Change - -It should stop containing hardware-specific assumptions at core interfaces. Hardware-specific code should become an accelerator implementation behind a portable ABI. - ---- - -## 3.2 Native inference runtime - -### Already implemented - -The runtime now has: - -- prompt submission, -- completion sinks, -- scheduler integration, -- branchable sequences, -- shared KV prefix state, -- native transformer path, -- token streaming, -- physical block reclamation, -- hardware execution tests. - -### Current gap - -The visible inference ABI still uses a production tensor shape centered around `Vec` and an `&[f32]` backend interface. - -That is unsuitable for large quantized models because BF16/F16 weights are expanded into FP32. - -### Target - -Replace the weight ABI with typed storage views and a compiled Model Capsule. - ---- - -## 3.3 Cortex - -Cortex already contains: - -- logical spaces, -- entities, -- claims, -- session/event ledgers, -- evidence relationships, -- summaries/hypotheses, -- storage concurrency, -- provenance-related data. - -### Keep - -Cortex remains the durable memory/knowledge layer. - -### Change - -Cortex should not become: - -- the task scheduler, -- World state, -- J-Space, -- or the tool registry. - -It should receive structured results from those systems. - ---- - -## 3.4 AEGIS - -AEGIS already contains: - -- deterministic pre-dispatch checks, -- probe-policy evaluation, -- workspace containment, -- tool/skill gating, -- a `SkillRegistry`, -- vault resolution. - -### Current architectural problem - -`SkillRegistry` currently mixes tools and skills. - -Built-ins such as `read_file`, `write_file`, `bash_eval`, `git_status`, and `cortex_recall` are atomic tools, not high-level skills. - -Its current handler form is effectively local-process execution: - -```rust -Arc Result + Send + Sync> -``` - -That does not naturally support Fabric placement. - -### Target - -Move definitions into a Capability Graph. AEGIS verifies calls against capability contracts but does not own routing or placement. - ---- - -## 3.5 MCP - -### Already implemented - -AIEN already has at least two hand-written Rust MCP servers: - -1. `spark-debugger` -2. `aien-harness` - -Both implement stdio JSON-RPC and expose `initialize`, `tools/list`, and `tools/call`. - -`spark-debugger` advertises protocol version `2024-11-05`. - -### Not yet implemented - -There is no evidence of a single canonical: - -- MCP client, -- MCP broker, -- remote server registry, -- current-spec MCP implementation, -- OAuth broker, -- Fabric-aware MCP placement, -- Capability Graph integration, -- unified provenance wrapper. - -### Target - -Create one `aien-mcp` subsystem using the official Rust `rmcp` SDK. - ---- - -## 3.6 Vault/secrets - -AEGIS already has `VaultResolver` and prefers: - -```text -atlas-vault get -``` - -### Gap - -It currently falls back to environment variables. - -That means “zero plaintext secrets” is a policy goal, but not yet a universally enforced runtime property. - -### Target - -Production mode must be `VaultOnly`. - -Environment fallback should exist only in explicit development/test mode. - ---- - -## 3.7 Provenance - -`aien-protocols` already contains: - -- SHA-256 digest helpers, -- provenance types, -- P-256 signing, -- evaluation receipts, -- software signers, -- TPM-oriented signers, -- Merkle roots, -- canary rollback/evaluation receipts. - -### Gap - -The World lifecycle is not yet the canonical signed provenance object for every external effect. - -### Target - -Use the existing protocol package to create signed World Commit envelopes rather than inventing another receipt system. - ---- - -## 3.8 RSI - -RSI already contains: - -- proposal generation, -- candidate evaluation, -- judge process, -- signed evaluation receipts, -- canary safety envelope, -- rollback, -- promotion gate. - -### Target - -RSI remains **out of the hot runtime path**. - -It should optimize: - -- kernel plans, -- scheduling heuristics, -- skill routing, -- model placement, -- tool selection, -- cache policies, - -but never mutate live execution without signed evaluation and rollout gates. - ---- - -## 3.9 Harness / Debugger / Inquisitor - -These are valuable but overlapping. - -### Harness - -Useful for: - -- deterministic workflow gates, -- schema validation, -- failure replay, -- evaluation. - -### Debugger - -Useful for: - -- runtime diagnostics, -- service checks, -- security invariant audits, -- MCP exposure. - -### Inquisitor - -Useful for: - -- constitutional/diff auditing, -- evaluator integration, -- canary checks. - -### Target - -Do not merge their semantics into one giant crate. - -Instead, expose all three as **evaluators/tools through the Capability Graph**. - ---- - -# 4. Target Repository/Crate Topology - -The following is the recommended long-term structure. - -```text -aien-sovereign-core/ -└── crates/ - ├── aien-runtime - ├── aien-control - ├── aien-protocols - ├── aien-model - ├── aien-inference - ├── aien-accelerator - ├── aien-kv - ├── aien-sequence - ├── aien-world - ├── aien-jspace - ├── aien-capability - ├── aien-skill-router - ├── aien-tool-runtime - ├── aien-mcp - ├── aien-effect-broker - ├── aien-policy - ├── aien-vault - ├── aien-fabric - ├── aien-node - ├── aien-provenance - ├── aien-observability - └── aien-cli -``` - -Satellite repos can continue to exist for focused distribution, but canonical source should live in the composition root or be generated from it. - ---- - -# 5. The Complete Runtime Flow - -## 5.1 Normal conversational turn - -```mermaid -sequenceDiagram - participant User - participant CLI as AIEN Control - participant Runtime - participant Router as Model Router - participant Inference - participant Cortex - participant World - - User->>CLI: message - CLI->>Runtime: StreamTurn - Runtime->>Cortex: retrieve relevant memory - Cortex-->>Runtime: evidence/context refs - Runtime->>Router: choose model + Machine - Router->>Inference: submit prompt - Inference-->>Runtime: token stream - Runtime->>World: record logical turn - Runtime-->>CLI: token deltas - CLI-->>User: response -``` - ---- - -## 5.2 Skill/tool turn - -```mermaid -sequenceDiagram - participant Model - participant J as J-Space - participant SR as Skill Router - participant CG as Capability Graph - participant F as Fabric - participant A as AEGIS - participant T as Tool Runtime - participant W as World - - Model->>J: objective / proposed action - J->>SR: request procedure - SR->>CG: retrieve relevant skills - CG-->>SR: candidates - SR-->>J: top candidates - J->>CG: resolve required tools - CG->>F: find providers - F-->>CG: eligible Machines - J->>A: authorize planned call - A-->>J: allow/deny - J->>T: execute authorized call - T-->>J: ToolResult - J->>W: commit branch result -``` - ---- - -## 5.3 External effect turn - -```mermaid -sequenceDiagram - participant Agent - participant J as J-Space - participant A as AEGIS - participant B as Effect Broker - participant E as External System - participant P as Provenance - participant W as World - - Agent->>J: propose external action - J->>A: EffectIntent - A-->>J: AuthorizedEffect - J->>B: AuthorizedEffect - B->>E: perform action - E-->>B: external result - B->>P: create receipt digest - P-->>B: signed receipt - B->>W: finalize World commit -``` - ---- - -# 6. Universal Machine Fabric - -## 6.1 Concept - -Every physical computer runs: - -```text -aien-node -``` - -A node joins one Fabric and advertises: - -- CPU resources, -- accelerator resources, -- memory, -- model cache, -- tools, -- skill implementations, -- operating-system capabilities, -- network quality, -- current load, -- thermal/power state. - -Machines are generic logical identities: - -```text -Machine 1 -Machine 2 -Machine 3 -Machine 4 -... -``` - -Example: - -```text -Machine 1 - CPU architecture: arm64 - accelerator: GPU - unified memory: true - memory: 128 GiB - cached models: A, B - -Machine 2 - CPU architecture: arm64 - accelerator: GPU - memory: 48 GiB - cached models: B, C - -Machine 3 - CPU architecture: x86_64 - accelerator: none - memory: 64 GiB - tools: build, git, database - -Machine 4 - CPU architecture: arm64 - accelerator: GPU - tools: platform-specific-build -``` - -No higher layer should need to know product names. - ---- - -## 6.2 Node capability structure - -```rust -pub struct NodeAdvertisement { - pub machine: MachineId, - pub identity: WorkloadIdentity, - pub hardware: HardwareCapabilities, - pub accelerators: Vec, - pub tools: Vec, - pub skills: Vec, - pub models: Vec, - pub resources: ResourceState, - pub network: NetworkState, -} -``` - ---- - -## 6.3 Transport - -Recommended initial transport: - -- QUIC -- Rust `quinn` -- TLS 1.3 -- mutually authenticated node identity -- multiplexed control/data streams -- optional datagrams for telemetry/heartbeats. - -Why QUIC: - -- encrypted by default, -- stream multiplexing, -- no TCP head-of-line blocking across independent streams, -- portable across Linux/macOS/Windows, -- pure Rust implementation available. - -For LAN discovery: - -- mDNS/DNS-SD. - -For more advanced direct peer connectivity later: - -- Iroh or libp2p concepts can be adopted selectively. - -Do not begin with a complicated WAN peer-to-peer overlay. - ---- - -## 6.4 Network topology model - -```rust -pub struct FabricLink { - pub from: MachineId, - pub to: MachineId, - pub latency_us: u64, - pub jitter_us: u64, - pub bandwidth_bps: u64, - pub loss_ppm: u32, - pub transport: TransportClass, -} -``` - -The scheduler should maintain a weighted graph. - -```mermaid -graph LR - M1[Machine 1] -- "low latency / high bandwidth" --> M2[Machine 2] - M2 -- "medium latency" --> M3[Machine 3] - M1 -- "high latency" --> M4[Machine 4] - M3 -- "medium bandwidth" --> M4 -``` - ---- - -## 6.5 Preferred distributed work granularity - -### Best over normal LAN/Wi-Fi - -- independent J-Space branches, -- tool execution, -- verifier work, -- speculative candidates, -- embeddings, -- compilation/tests, -- document processing, -- model replicas. - -### Use only on very fast interconnects - -- tensor parallelism, -- layer pipeline parallelism, -- fine-grained activation transfer. - -This is crucial. - -A slow Machine can help the Fabric if it receives coarse work. - -It can hurt the Fabric if every token depends on it. - ---- - -# 7. Portable Accelerator Architecture: No CUDA Dependency - -## 7.1 Requirement - -AIEN core must not contain a mandatory CUDA dependency. - -NVIDIA hardware may use NVIDIA drivers under a portable runtime, but AIEN's source/runtime contracts should not be CUDA-shaped. - ---- - -## 7.2 Target interface - -```rust -pub trait Accelerator: Send + Sync { - fn capabilities(&self) -> DeviceCapabilities; - - fn load_model( - &mut self, - capsule: &ModelCapsule, - ) -> Result; - - fn submit( - &mut self, - plan: &ExecutionPlan, - ) -> Result; - - fn fork_kv( - &mut self, - parent: SequenceId, - child: SequenceId, - ) -> Result<()>; - - fn reclaim( - &mut self, - sequence: SequenceId, - ) -> Result<()>; -} -``` - ---- - -## 7.3 Backend strategy - -### Tier 1: optimized CPU - -Always available. - -- x86-64 SIMD -- arm64 SIMD -- multithreaded -- quantized kernels - -### Tier 2: Mojo accelerator - -Primary portable accelerator path where supported. - -Target: - -- NVIDIA GPU -- AMD GPU -- Apple GPU - -### Tier 3: broad GPU fallback later - -If needed, investigate IREE/Vulkan for hardware not covered well by Mojo. - -IREE's Vulkan deployment supports multiple GPU vendors and operating systems, but should be treated as an optional portability layer, not another mandatory runtime. - ---- - -## 7.4 Do not expose vendor-specific APIs to the scheduler - -Bad: - -```rust -if gpu.is_blackwell() { ... } -``` - -Good: - -```rust -if caps.fp4 && plan.supports_fp4() { ... } -else if caps.bf16 { ... } -else { ... } -``` - ---- - -# 8. Model Capsules - -## 8.1 Why - -The runtime should not parse arbitrary model repositories and reshape thousands of tensors on every startup. - -Model installation should be a compile/pack phase. - -```text -source model - ↓ -aien model pack - ↓ -validated Model Capsule - ↓ -content-addressed chunks - ↓ -runtime-ready -``` - ---- - -## 8.2 Capsule contents - -```rust -pub struct ModelCapsuleManifest { - pub model_digest: Digest32, - pub architecture: ArchitectureId, - pub tokenizer_digest: Digest32, - pub template_digest: Digest32, - pub config_digest: Digest32, - - pub max_context: u32, - pub tensor_layout: TensorLayoutVersion, - pub quantization: QuantizationSpec, - - pub shards: Vec, - pub required_kernels: Vec, -} -``` - ---- - -## 8.3 Distribution - -Model data should be split into content-addressed chunks. - -```text -Model A -├── chunk 000 -> digest -├── chunk 001 -> digest -├── chunk 002 -> digest -└── ... -``` - -When Machine 3 joins: - -```text -Machine 3 already has 73% of Model A. -Transfer only missing chunks. -``` - -Content-addressed transfer could initially be built over the same QUIC fabric. - -Later, `iroh-blobs`-style verified chunk streaming is useful prior art. - ---- - -## 8.4 Persistent prompt roots - -Common AIEN system prompts should be tokenized and prefixed once. - -```text -model + tokenizer + chat template + system prompt + policy - ↓ - PrefixRootId -``` - -New sessions fork from the prefix root. - -This uses AIEN's branch-native KV architecture to avoid repeated prefill. - ---- - -# 9. Sequence/KV Architecture - -## 9.1 Canonical state - -```text -SequenceId - ├── token lineage - ├── KV block table - ├── parent sequence - ├── model handle - └── owning Machine -``` - -A fork should: - -- copy metadata, -- increment block references, -- share physical prefix pages, -- perform copy-on-write only when divergence requires it. - ---- - -## 9.2 Global vs local identity - -A Sequence ID may be globally known. - -The actual KV pages remain local to their owning Machine. - -```text -Sequence 981 -owner = Machine 2 -prefix = PrefixRoot 12 -world = World 771 -``` - -If Machine 2 disappears, AIEN reconstructs from durable token lineage and model identity. - -Do not implement distributed shared memory for KV. - ---- - -# 10. J-Space - -## 10.1 Definition - -J-Space is the **typed evaluation/search space over possible World transitions**. - -It is not: - -- a memory database, -- a replacement for WorldStore, -- a replacement for Cortex, -- an arbitrary graph database, -- a token-level tree that always runs. - -It exists when AIEN has multiple plausible choices and needs to compare them. - ---- - -## 10.2 Core node - -```rust -pub struct JNode { - pub id: JNodeId, - pub parent: Option, - - pub world: WorldId, - pub sequence: SequenceId, - pub memory_view: MemoryViewId, - - pub proposal: ProposalRef, - pub score: ScoreVector, - pub constraints: ConstraintState, - - pub evidence_root: Digest32, - pub evaluator_set: EvaluatorSetId, - pub status: JNodeStatus, -} -``` - ---- - -## 10.3 Multi-objective score - -Do not collapse everything into one untraceable scalar. - -```rust -pub struct ScoreVector { - pub task_quality: f32, - pub verifier_confidence: f32, - pub safety_margin: f32, - pub latency_cost: f32, - pub compute_cost: f32, - pub memory_cost: f32, - pub uncertainty: f32, -} -``` - -Pareto filtering can remove dominated candidates before expensive judges run. - ---- - -## 10.4 J-Space flow - -```mermaid -flowchart TD - P[Parent State] --> A[Candidate A] - P --> B[Candidate B] - P --> C[Candidate C] - P --> D[Candidate D] - - A --> CF[Cheap Filters] - B --> CF - C --> CF - D --> CF - - CF --> PR[Prune Dominated / Invalid] - PR --> V[Verifier Batch] - V --> J[Judge] - J --> W[Winner] - W --> WC[World Commit] -``` - ---- - -## 10.5 Fabric-aware J-Space - -```mermaid -flowchart LR - ROOT[J-Space Root] --> A[Branch A] - ROOT --> B[Branch B] - ROOT --> C[Branch C] - - A --> M1[Machine 1] - B --> M2[Machine 2] - C --> M3[Machine 3] - - M1 --> J[Judge] - M2 --> J - M3 --> J - - J --> WIN[Winning World Transition] -``` - -This is a major potential differentiator. - -Most distributed inference systems focus on splitting one model computation. - -AIEN can distribute **reasoning alternatives and executable Worlds**. - ---- - -# 11. Capability Graph - -## 11.1 Purpose - -The Capability Graph answers: - -> What can AIEN do, what does it require, where can it run, what effects can it cause, and what can satisfy this request? - -A flat hash map will not scale. - ---- - -## 11.2 Canonical names - -Tools: - -```text -filesystem.read -filesystem.write - -process.execute - -git.status -git.diff -git.commit -git.push - -github.issue.read -github.pull_request.create - -mail.read -mail.send - -memory.cortex.search -memory.cortex.write - -database.query - -browser.navigate -browser.extract - -build.rust -test.rust -build.apple -``` - -Skills: - -```text -software.debug.rust -software.implement.feature -software.review.pull_request -research.deep -communication.answer_email -operations.release -``` - ---- - -## 11.3 Skill descriptor - -```rust -pub struct SkillDescriptor { - pub id: SkillId, - pub name: CanonicalName, - pub version: Version, - - pub description: String, - pub domain: DomainId, - pub family: SkillFamilyId, - pub tags: Vec, - pub intents: Vec, - - pub required_tools: Vec, - pub required_capabilities: CapabilitySet, - - pub input_schema: SchemaId, - pub output_schema: SchemaId, - - pub potential_effects: EffectSet, - pub cost_profile: CostProfile, - pub examples: Vec, - - pub digest: Digest32, -} -``` - ---- - -## 11.4 Tool descriptor - -```rust -pub struct ToolDescriptor { - pub id: ToolId, - pub name: CanonicalName, - pub version: Version, - - pub input_schema: SchemaId, - pub output_schema: SchemaId, - - pub effects: EffectSet, - pub requirements: ResourceRequirements, - - pub deterministic: bool, - pub retryable: bool, - pub idempotency: IdempotencyClass, -} -``` - ---- - -# 12. Skill Router - -## 12.1 The routing problem - -If AIEN eventually has 10,000 capabilities, sending all of them into the model context is inefficient and harms tool selection. - -A 2026 paper on semantic MCP tool discovery reports strong results from retrieving only a few relevant tools instead of presenting the entire catalog, with large token savings and high retrieval hit rates. - -The principle is sound even if AIEN develops its own benchmark. - ---- - -## 12.2 Progressive routing - -```mermaid -flowchart TD - Q[Intent] --> L0[Level 0: exact alias / deterministic] - L0 -->|unresolved| L1[Level 1: tags / lexical] - L1 -->|ambiguous| L2[Level 2: semantic retrieval] - L2 -->|ambiguous| L3[Level 3: small router model] - L3 -->|complex| L4[Level 4: J-Space planning] - - L0 --> C[Candidate Set] - L1 --> C - L2 --> C - L3 --> C - L4 --> C - - C --> F[Constraint Filter] - F --> T[3-10 relevant capabilities] -``` - -Most requests should stop before the expensive levels. - ---- - -## 12.3 Constraint filtering - -Before the model sees candidates, eliminate impossible choices: - -- unavailable Machine, -- missing operating-system capability, -- missing credential, -- denied policy, -- incompatible model, -- excessive memory, -- excessive latency, -- tool not installed, -- offline remote provider. - ---- - -## 12.4 Historical routing feedback - -Cortex may store routing experience: - -```text -request class -selected skill -Machine placement -latency -success/failure -judge score -operator correction -``` - -Cortex informs ranking. - -It does **not** become the authoritative capability registry. - ---- - -# 13. Skill Packs - -Human operators need a manageable abstraction above individual tools. - -Example packs: - -```text -AIEN Base -├── filesystem -├── process -├── memory -└── network - -Developer Pack -├── git -├── repository hosting -├── compilation -├── testing -└── debugging - -Research Pack -├── web -├── papers -├── citations -└── synthesis - -Communication Pack -├── mail -├── calendar -└── messaging - -Platform Build Pack -├── native build tools -├── simulator -└── signing -``` - -A Machine may advertise entire packs plus individual exceptions. - ---- - -# 14. MCP Architecture - -## 14.1 What MCP is - -MCP is a protocol that lets AI clients communicate with servers exposing: - -- tools, -- resources, -- prompts, -- and related capabilities. - -It does not require Python or TypeScript. - -The official Rust MCP SDK (`rmcp`) is current, async, and supports both client and server use. - ---- - -## 14.2 Current AIEN MCP state - -### Implemented - -`spark-debugger`: -- Rust -- stdio -- JSON-RPC -- initialize -- tools/list -- tools/call - -`aien-harness`: -- Rust -- stdio -- JSON-RPC -- initialize -- tools/list -- tools/call - -### Problem - -These are separate hand-maintained protocol implementations. - ---- - -## 14.3 Target MCP subsystem - -Canonical source location: - -```text -aien-sovereign-core/crates/aien-mcp -``` - -The existing hand-written MCP servers remain compatibility fixtures during migration; canonical protocol/client/broker behavior moves into this crate. - -```text -aien-mcp -├── client -├── server -├── broker -├── registry -├── stdio transport -├── streamable HTTP transport -├── auth -├── vault credential provider -├── AEGIS adapter -├── Capability Graph adapter -├── Fabric adapter -└── provenance adapter -``` - -Use official `rmcp` rather than expanding manual JSON-RPC matching. - ---- - -## 14.4 MCP is translated into AIEN capabilities - -```mermaid -flowchart LR - S[MCP Server] --> MB[MCP Broker] - MB --> AD[Capability Adapter] - AD --> CG[Capability Graph] - CG --> SR[Skill Router] - SR --> JS[J-Space] -``` - -The inverse direction allows AIEN-native tools to be exported as MCP when external clients need them. - ---- - -# 15. Secret Architecture - -## 15.1 Model must never see raw credentials - -```mermaid -flowchart LR - M[Model] --> TC[ToolCall] - TC --> CR[CredentialRef] - CR --> A[AEGIS] - A --> B[Credential Broker] - B --> V[Vault] - V --> B - B --> R[Authenticated Request] -``` - -The model receives: - -```text -CredentialRef("service.operator") -``` - -not: - -```text -actual-secret-value -``` - ---- - -## 15.2 Production vault policy - -```rust -pub enum SecretPolicy { - VaultOnly, - VaultThenEnvironmentForDevelopment, -} -``` - -Production must reject implicit environment fallback. - -A third-party process that explicitly requires an environment variable may receive a **call-scoped child-only injection** from a `CredentialRef`, after AEGIS authorization and Fabric placement. This is a compatibility delivery mechanism, not a configuration source. Raw values must never be serialized into AIEN configuration, World state, J-Space, logs, Cortex, or provenance. - ---- - -## 15.3 Network identity - -For Fabric identity, study and borrow from SPIFFE/SPIRE: - -- workload identity, -- short-lived credentials, -- runtime attestation, -- mTLS. - -AIEN does not necessarily need to deploy full SPIRE initially. - -A small AIEN-native identity layer can use the same principles: - -```text -Machine identity key - ↓ -node enrollment - ↓ -short-lived session certificate - ↓ -mTLS/QUIC peer authentication -``` - ---- - -# 16. AEGIS Authorization Architecture - -AEGIS should evolve from pattern checks into a typed authorization plane. - -Recommended combination: - -1. deterministic hard invariants, -2. Cedar-style declarative policy, -3. optional semantic/probe evaluation, -4. operator approval for high-risk effects. - -Cedar is especially attractive because: - -- it is written in Rust, -- separates policy from application logic, -- supports principal/action/resource/context decisions, -- is designed for fast authorization. - -Example conceptual request: - -```text -principal = Agent::"researcher-17" -action = Tool::"mail.send" -resource = RecipientDomain::"external" -context = { - world_id, - skill_id, - jnode_id, - operator_session, - risk_score -} -``` - ---- - -# 17. Effect Broker - -## 17.1 Why a separate process - -If all external effects are available directly inside `aien-runtime`, a bug can bypass policy. - -The stronger design is: - -```text -aien-runtime - no unrestricted external effects - │ - │ authorized typed UDS/QUIC - ▼ -aien-effect-broker - │ - ▼ -external systems -``` - -The broker is small enough to audit aggressively. - ---- - -## 17.2 Effect types - -```rust -pub enum ExternalEffect { - SendMessage, - PublishGit, - Deploy, - Purchase, - DeleteRemoteResource, - ModifyExternalRecord, -} -``` - -Local reversible operations can remain World-local. - ---- - -## 17.3 Typestate - -```text -EffectIntent - ↓ -CheckedEffect - ↓ -AuthorizedEffect - ↓ -ExecutedEffect - ↓ -CommittedEffect -``` - -An SMTP or Git-push implementation should accept only `AuthorizedEffect`. - ---- - -# 18. World Architecture - -## 18.1 Purpose - -World = branchable, transactional execution state. - -A World references: - -- object root, -- filesystem root, -- token root, -- memory view, -- capability set, -- effect intents, -- lineage. - ---- - -## 18.2 Target World commit - -```rust -pub struct WorldCommit { - pub world: WorldId, - pub parent: Option, - pub sequence_number: u64, - - pub object_root: Digest32, - pub filesystem_root: Digest32, - pub token_root: Digest32, - pub memory_root: Digest32, - - pub effects_root: Digest32, - pub evidence_root: Digest32, - - pub model_digest: Digest32, - pub tokenizer_digest: Digest32, - pub policy_digest: Digest32, - pub runtime_build_digest: Digest32, - - pub jspace_decision: Option, - - pub signer: SignerIdentity, - pub signature: Signature, -} -``` - ---- - -# 19. Signed Provenance - -## 19.1 Reuse existing AIEN protocol code - -AIEN already has: - -- P-256 signers, -- TPM signer concepts, -- evaluation receipts, -- Merkle roots. - -Do not create a second unrelated format. - ---- - -## 19.2 DSSE/in-toto-compatible envelope - -Borrow the DSSE principle: - -- authenticate payload type, -- authenticate payload bytes, -- avoid fragile canonicalization assumptions, -- allow multiple signatures. - -This improves interoperability with broader provenance tooling. - ---- - -## 19.3 Do not hardware-sign every event - -Use: - -1. short-lived in-memory session signer, -2. Merkle-batched commits, -3. periodic hardware-rooted checkpoint. - -```mermaid -flowchart TD - R1[Receipt 1] --> M[Merkle Root] - R2[Receipt 2] --> M - R3[Receipt 3] --> M - RN[Receipt N] --> M - M --> H[Hardware Anchor] -``` - -This avoids making hardware signing the latency bottleneck. - ---- - -# 20. Cortex Memory Integration - -## 20.1 Memory planes - -Recommended memory layers: - -### Working memory -Current sequence / World-local state. - -### Episodic memory -Sessions, actions, outcomes, failures. - -### Semantic memory -Entities, claims, stable facts. - -### Procedural memory -Skill routing outcomes, successful plans, reusable tactics. - -### Provenance memory -Evidence and signed receipts. - ---- - -## 20.2 Memory flow - -```mermaid -flowchart LR - E[Execution] --> EV[Events] - EV --> C[Cortex Ingress] - C --> EP[Episodic] - C --> SM[Semantic] - C --> PM[Procedural] - C --> PR[Provenance] - - EP --> R[Recall] - SM --> R - PM --> R - PR --> R - - R --> RT[Runtime Context] -``` - ---- - -# 21. Durable Workflows - -Some AIEN tasks may last minutes, hours, or days. - -Temporal demonstrates the value of durable execution that resumes after process/network failure. - -AIEN does not have to embed Temporal itself, especially if the objective is a compact local Rust stack. - -But it should adopt the same key pattern: - -```text -workflow state -+ deterministic transition -+ append-only event log -+ replay -+ idempotent activity -``` - -The Harness already moves in this direction. - -Recommended new core: - -```rust -pub trait DurableWorkflow { - type State; - type Event; - - fn apply(state: &mut Self::State, event: &Self::Event); -} -``` - -All irreversible activities emit receipts and can be re-associated during replay. - ---- - -# 22. Plugin and Third-Party Tool Isolation - -Native Rust tools are fastest, but third-party extensions cannot all be trusted. - -Use Wasmtime/WASI Component Model as an optional sandboxed plugin class. - -Why: - -- portable, -- cross-language, -- explicit imports/exports, -- restricted filesystem/network capabilities, -- embeddable in Rust. - -Architecture: - -```text -Tool package - ↓ -trusted native? - ├── yes -> NativeToolExecutor - └── no -> WASM Component Executor - ↓ - capability grants -``` - -MCP tools and process tools should also execute under explicit capability restrictions. - ---- - -# 23. Observability - -Adopt OpenTelemetry concepts rather than inventing unrelated metric names. - -AIEN should emit: - -- traces, -- metrics, -- structured events, -- profiling data. - -Key dimensions: - -```text -machine.id -world.id -sequence.id -jspace.id -jnode.id -skill.id -tool.id -model.digest -accelerator.class -effect.class -policy.decision -``` - -Never record sensitive prompt/tool content by default. - -Content logging must be opt-in. - ---- - -# 24. RSI Integration - -RSI should consume telemetry and benchmark evidence. - -```mermaid -flowchart LR - T[Telemetry] --> RSI[RSI] - B[Benchmarks] --> RSI - C[Cortex Lessons] --> RSI - - RSI --> H[Hypothesis] - H --> CA[Candidate Artifact] - CA --> E[Evaluators] - E --> CR[Canary] - CR -->|pass| P[Promote] - CR -->|fail| RB[Rollback] -``` - -RSI may optimize: - -- skill retrieval, -- scheduling, -- placement, -- batch widths, -- J-Space pruning thresholds, -- kernel plans, -- model quantization choice, -- cache policy. - ---- - -# 25. Market Gap Analysis - -The market contains strong products for individual layers, but the combination AIEN is targeting remains unusual. - -## Gap 1: Universal heterogeneous AI fabric - -### Existing approaches - -- Exo: automatic device discovery and heterogeneous local model partitioning. -- llama.cpp RPC: exposes remote compute devices and distributes model/KV state. -- MLX distributed: serious multi-machine communication including low-latency interconnects. -- Ray/Dask: mature heterogeneous resource scheduling. - -### What they solve - -They prove that: - -- heterogeneous local clusters are practical, -- resource-aware scheduling works, -- remote accelerators can contribute, -- topology matters. - -### Remaining market gap - -A local fabric that combines: - -- inference, -- agent branches, -- tools, -- skills, -- state Worlds, -- safety policy, -- provenance, -- memory, -- and self-improvement - -under one typed runtime. - -### AIEN implementation - -Build `aien-fabric` in Rust. - -Start with coarse-grained work: - -- J-Space branches, -- tool execution, -- model replicas. - -Add tensor/model sharding only after topology metrics prove it is worthwhile. - ---- - -## Gap 2: Skill routing at very large capability counts - -### Existing approaches - -Agent frameworks typically expose tool lists and workflows. - -MCP standardizes tool discovery. - -Research now demonstrates semantic retrieval for large MCP tool catalogs. - -### Remaining gap - -A router that combines: - -- semantic relevance, -- hard capability requirements, -- current Machine availability, -- AEGIS policy, -- secrets availability, -- historical success, -- model requirements, -- latency and cost. - -### AIEN implementation - -Build `aien-capability` + `aien-skill-router`. - -Use multi-stage routing: - -1. deterministic alias, -2. metadata, -3. lexical, -4. embedding, -5. small router model, -6. J-Space. - -This is a real differentiator because routing is tied to execution reality, not just textual similarity. - ---- - -## Gap 3: Secure MCP as a capability adapter - -### Existing approaches - -The official Rust MCP SDK supports current MCP client/server behavior and authentication features. - -### AIEN current state - -Two hand-written Rust MCP servers already exist. - -### Remaining gap - -A single broker where: - -- MCP tools become AIEN capabilities, -- credentials remain vault handles, -- AEGIS gates calls, -- Fabric can place calls, -- World/provenance wraps results. - -### AIEN implementation - -Build `aien-mcp` around `rmcp`. - -Retire duplicate protocol loops after migration. - ---- - -## Gap 4: Portable accelerator runtime without CUDA-shaped architecture - -### Existing approaches - -- Mojo provides portable accelerator programming across supported GPU families. -- IREE/Vulkan provides broad vendor/OS coverage. -- llama.cpp/ggml supports many hardware backends. - -### Remaining gap - -A branch-native agent runtime whose core scheduler/KV/World logic is hardware-independent while high-performance kernels remain portable. - -### AIEN implementation - -Rust control plane + Mojo kernels + optimized CPU. - -IREE/Vulkan can be evaluated later for unsupported accelerator classes. - -No mandatory CUDA build dependency. - ---- - -## Gap 5: Branch-native test-time search with executable state - -### Existing approaches - -Research on test-time scaling shows value from: - -- candidate sampling, -- verification, -- search over partial states, -- inference-time verification. - -Inference servers already implement prefix reuse. - -### Remaining gap - -Most systems treat candidates as text completions. - -AIEN can treat them as: - -```text -Sequence -+ World -+ memory view -+ tool plan -+ evidence -+ policy state -``` - -### AIEN implementation - -Build J-Space as first-class typed state. - -This may be AIEN's strongest technical differentiator. - ---- - -## Gap 6: Effect-aware agent transactions - -### Existing approaches - -Agent SDKs increasingly include sandboxes and tool controls. - -Authorization engines such as Cedar provide policy decisions. - -### Remaining gap - -A local agent runtime in which: - -- speculative branches do not leak effects, -- external actions require typed authorization, -- the effect boundary is non-bypassable, -- the resulting World commit is signed. - -### AIEN implementation - -`aien-effect-broker` + AEGIS + World commits. - ---- - -## Gap 7: Signed, branch-aware agent provenance - -### Existing approaches - -in-toto/DSSE provides strong supply-chain attestation patterns. - -### Remaining gap - -Runtime provenance spanning: - -```text -model -→ reasoning branch -→ tools -→ external effect -→ World transition -→ memory -``` - -### AIEN implementation - -Extend current `aien-provenance` and evaluation receipts into World Commit attestations. - ---- - -## Gap 8: Local self-improvement that is actually gated - -### Existing approaches - -Auto-tuning and agent optimization exist, but safe autonomous promotion remains difficult. - -### AIEN current advantage - -RSI already has: - -- judge, -- canary, -- rollback, -- signed evaluation. - -### Remaining gap - -Connect it to the full runtime telemetry and signed World evidence without letting RSI mutate the hot path directly. - ---- - -# 26. Competitive Positioning - -AIEN should not try to win by saying: - -> another agent framework - -or: - -> another inference server - -or: - -> another MCP host - -Those categories are crowded. - -A more defensible technical category is: - -> **A universal branch-native AI runtime that turns multiple Machines into one capability-aware local AI system.** - -The differentiation stack is: - -```text -heterogeneous Fabric - + -portable inference - + -branch-native KV - + -World transactions - + -J-Space search - + -Capability Graph - + -skill routing - + -MCP compatibility - + -AEGIS effect safety - + -signed provenance - + -Cortex memory - + -RSI optimization -``` - -The combination matters more than any individual feature. - ---- - -# 27. Proposed Core Types - -```rust -pub struct MachineId(pub [u8; 16]); -pub struct WorldId(pub u64); -pub struct SequenceId(pub u64); -pub struct JSpaceId(pub u64); -pub struct JNodeId(pub u64); -pub struct SkillId(pub Digest32); -pub struct ToolId(pub Digest32); -pub struct ModelDigest(pub Digest32); -pub struct ReceiptId(pub Digest32); -``` - -Everything crossing process or Machine boundaries should use stable typed IDs. - ---- - -# 28. Suggested Crate Responsibilities - -## `aien-capability` - -Owns: - -- tool/skill descriptors, -- capability IDs, -- schemas, -- requirements, -- effect classes. - -Does not execute. - ---- - -## `aien-skill-router` - -Owns: - -- indexes, -- retrieval, -- ranking, -- constraint filtering, -- routing telemetry. - -Does not perform effects. - ---- - -## `aien-tool-runtime` - -Owns: - -- native Rust executor, -- WASM executor, -- process adapter, -- HTTP adapter. - -Does not authorize. - ---- - -## `aien-mcp` - -Owns: - -- MCP client/server, -- transport, -- schema translation, -- auth negotiation, -- broker. - -Does not own secrets. - ---- - -## `aien-vault` - -Owns: - -- secret references, -- vault access, -- short-lived secret leases, -- redaction. - -Does not expose arbitrary secret strings to models. - ---- - -## `aien-policy` - -Owns: - -- deterministic invariants, -- Cedar policies, -- probe integration, -- approval requirements. - ---- - -## `aien-effect-broker` - -Owns: - -- irreversible external side effects. - -Small, heavily audited process. - ---- - -## `aien-fabric` - -Owns: - -- membership, -- node identity, -- topology, -- capability advertisement, -- task placement, -- leases, -- failover. - ---- - -## `aien-jspace` - -Owns: - -- candidate branches, -- evaluation, -- Pareto pruning, -- judges, -- branch lifecycle. - ---- - -## `aien-world` - -Owns: - -- branchable transactional state, -- commits, -- lineage, -- rollback roots. - ---- - -# 29. Detailed Implementation Plan - -## Phase 0: Establish invariants - -Before new features: - -1. Declare hardware-neutral interfaces. -2. Declare Tool vs Skill semantics. -3. Declare World vs Cortex vs J-Space separation. -4. Declare vault-only production secrets. -5. Declare that external effects cannot bypass the broker. -6. Declare stable protocol types. - -Acceptance: - -- architecture tests compile without any vendor-specific type in core scheduler APIs. - ---- - -## Phase 1: Capability Graph - -Build: - -```text -aien-capability -aien-skill-router -``` - -Migrate AEGIS `SkillRegistry` definitions into Tool descriptors. - -Keep adapters so existing calls continue working. - -Acceptance: - -- 1,000 synthetic tools indexed. -- routing returns top 5. -- impossible capabilities filtered before model use. -- tool definitions never all enter the context. - ---- - -## Phase 2: Canonical MCP broker - -Build `aien-mcp` with `rmcp`. - -Import existing: - -- debugger MCP tools, -- harness MCP tools. - -Acceptance: - -- stdio server works. -- stdio client works. -- Streamable HTTP works. -- tools/resources/prompts map into Capability Graph. -- MCP server failure cannot crash runtime. -- credentials are references, not config secrets. - ---- - -## Phase 3: Vault-only production mode - -Refactor: - -```rust -VaultResolver -``` - -to explicit policy. - -Acceptance: - -- production test fails when secret exists only in environment. -- logs never contain resolved value. -- model/tool schemas never contain resolved value. -- secret lease expires/zeroizes where practical. - ---- - -## Phase 4: Effect Broker - -Move mail first. - -Then Git publish. - -Add mock driver for golden-path tests. - -Acceptance: - -- runtime process cannot execute test external effect directly. -- denied action yields zero broker driver calls. -- allowed action yields one receipt. -- receipt becomes part of World commit. - ---- - -## Phase 5: Signed World commits - -Extend `aien-provenance`. - -Acceptance: - -- every committed external effect has: - - parent World, - - effect root, - - policy digest, - - runtime build digest, - - signer identity. -- verification detects tampering. - ---- - -## Phase 6: Model Capsule + portable weight ABI - -Replace production `Vec` weight ownership. - -Build: - -- typed tensor views, -- quantized storage, -- mmap/chunk loading, -- capsule manifest. - -Acceptance: - -- large model does not expand all weights to FP32. -- model startup is deterministic and fingerprinted. -- same capsule works across at least CPU and one accelerator implementation. - ---- - -## Phase 7: Portable accelerator - -Build/finish: - -- optimized CPU kernels, -- Mojo batch kernels, -- paged attention, -- quantized matmul, -- sampling. - -Retain old accelerator path only as comparison until parity/performance is proven. - -Acceptance: - -- no mandatory CUDA toolkit dependency. -- CPU path passes oracle tests. -- Mojo path passes parity. -- unsupported hardware fails clearly or uses CPU. - ---- - -## Phase 8: `aien-node` + Fabric - -Build: - -- Machine identity, -- mDNS discovery, -- QUIC control transport, -- capability advertisement, -- topology probes, -- work leases. - -Acceptance: - -- Machine 2 can join Machine 1 automatically. -- Machine 2 disappears; work lease expires and reschedules. -- all control traffic is mutually authenticated. - ---- - -## Phase 9: Distributed branch execution - -Before distributed tensor parallelism, dispatch J-Space branches. - -Acceptance: - -```text -Machine 1 creates 4 candidate branches. -Machine 2 executes branch 2. -Machine 3 executes branch 3. -All results return with signed evidence. -Judge chooses winner. -Non-winning Worlds are reclaimed. -``` - ---- - -## Phase 10: J-Space - -Build first version using meaningful decision boundaries, not token-by-token MCTS. - -Acceptance: - -- branch candidate state references World/Sequence IDs rather than cloning. -- cheap filters remove invalid branches. -- judge outcome is reproducible. -- effects cannot occur on speculative branches. -- winner can commit atomically. - ---- - -## Phase 11: Content-addressed model distribution - -Chunk Model Capsules. - -Acceptance: - -- second Machine only downloads missing chunks. -- chunks verify by digest. -- corrupted chunk is rejected. -- model cache survives restart. - ---- - -## Phase 12: Fine-grained distributed inference - -Only now investigate: - -- layer pipeline parallelism, -- tensor parallelism, -- speculative cross-Machine decode, -- RDMA. - -Enable only where measured topology predicts a gain. - ---- - -# 30. Benchmark Plan - -AIEN needs metrics that measure the system it is actually trying to build. - -## Inference - -- prompt tokens/sec -- decode tokens/sec -- TTFT -- inter-token latency -- GPU/accelerator utilization -- memory amplification -- KV bytes copied -- prefix reuse ratio - -## J-Space - -- candidates/sec -- time-to-best-valid-answer -- branches explored -- branches pruned -- verifier latency -- winner quality -- KV sharing ratio -- memory per branch - -## Fabric - -- discovery time -- Machine join latency -- control RTT -- bandwidth -- failover latency -- work migration time -- model chunk reuse -- scheduler placement quality - -## Skills/tools - -- routing latency -- top-k hit rate -- tool schema token count -- task success rate -- wrong-tool rate -- policy-denial rate - -## Provenance/security - -- signing overhead -- verification overhead -- broker overhead -- policy latency -- bypass tests -- secret exposure tests - ---- - -# 31. Golden Path - -The final release gate should prove: - -```mermaid -flowchart TD - U[User request] --> SR[Skill Router] - SR --> JS[J-Space] - JS --> F[Fabric] - F --> M[Selected Machine] - M --> INF[Native Inference] - INF --> TC[Tool Call] - TC --> A[AEGIS] - A --> EB[Effect Broker] - EB --> W[World Commit] - W --> P[Signed Provenance] - P --> C[Cortex] - C --> UO[Streamed User Output] -``` - -The golden path must use: - -- real model, -- real tokenizer, -- real routing, -- real policy, -- real effect boundary, -- real receipt, -- real World commit, -- real Cortex recall/store, -- no simulated bypass assertions. - ---- - -# 32. Failure Model - -AIEN must expect: - -- Machine departure, -- network partition, -- model unavailable, -- tool provider unavailable, -- MCP server crash, -- secret unavailable, -- policy denial, -- judge disagreement, -- stale World, -- duplicate operation, -- corrupted model chunk, -- accelerator fallback, -- verifier failure. - -Every subsystem must have explicit behavior for these cases. - ---- - -# 33. Machine Failure Recovery - -A remote branch should be reconstructible from: - -```text -model digest -+ token lineage -+ World root -+ memory view -+ tool/evidence refs -``` - -Do not require remote RAM contents to survive. - -Use leases: - -```rust -pub struct WorkLease { - pub task: TaskId, - pub machine: MachineId, - pub expires_at: Timestamp, - pub attempt: u32, -} -``` - -Expired work can be rescheduled. - -External effects use idempotency keys and must never be blindly replayed. - ---- - -# 34. What Not to Build - -Avoid the following: - -## Distributed shared memory - -Do not pretend network RAM is local RAM. - -## One giant “AIEN database” - -Do not merge World, Cortex, J-Space, tools, and telemetry into one table system. - -## All-tools-in-prompt - -Do not put thousands of tool schemas into context. - -## Model-owned secrets - -Do not expose raw API credentials to prompts or model-visible tool arguments. - -## Direct effects from speculative branches - -Only winning, authorized transactions may externalize. - -## Hardware-vendor logic in the core scheduler - -Hardware is capability metadata. - -## Hand-maintaining the entire MCP protocol - -Use the official Rust SDK. - -## Fine-grained distributed inference over poor networks - -Prefer branch-level work unless topology supports finer partitioning. - ---- - -# 35. Recommended Technology Adoption Matrix - -| Need | Adopt / Study | AIEN Role | -|---|---|---| -| MCP protocol | official Rust `rmcp` | compatibility broker | -| Fine-grained authorization | Cedar | policy engine under AEGIS | -| Workload identity concepts | SPIFFE/SPIRE | Fabric identity design | -| QUIC | Quinn | initial Fabric transport | -| P2P/content distribution | Iroh concepts | later model chunk distribution | -| Sandboxed plugins | Wasmtime/WASI | third-party tool runtime | -| Broad GPU fallback | IREE/Vulkan | optional later backend | -| Local distributed inference patterns | Exo, llama.cpp RPC, MLX | topology/partitioning prior art | -| General resource scheduling | Ray/Dask patterns | scheduling prior art, not runtime dependency | -| Durable execution | Temporal patterns | event/replay semantics | -| Provenance envelope | in-toto/DSSE | signed World envelope compatibility | -| Observability | OpenTelemetry | trace/metric semantics | - ---- - -# 36. What AIEN Should Build Itself - -The following are core differentiators and should not be outsourced wholesale: - -1. **World abstraction** -2. **J-Space** -3. **branch-native Sequence/KV lifecycle** -4. **Capability Graph** -5. **Skill Router** -6. **AIEN Fabric scheduling semantics** -7. **effect transaction model** -8. **World-integrated provenance** -9. **Cortex/World/J-Space integration** -10. **RSI optimization loop** - -Use external libraries for protocols and primitives. - -Own the AIEN semantics. - ---- - -# 37. Flagship Technical Story - -A compelling demonstration of the complete architecture would be: - -```text -1. Machine 1 starts AIEN. -2. Machine 2 joins. -3. Machine 3 joins. -4. Capability Graph updates automatically. -5. A user asks AIEN to solve a complex task. -6. J-Space generates multiple strategies. -7. Branches execute on different Machines. -8. One Machine runs a platform-specific tool unavailable elsewhere. -9. An MCP tool is dynamically routed through the broker. -10. No model sees a raw secret. -11. AEGIS blocks one unsafe branch. -12. The judge selects the best valid branch. -13. The Effect Broker performs the approved external action. -14. A signed World commit proves the result. -15. Cortex stores the lesson. -16. RSI records whether the routing/placement could be improved. -17. One Machine disconnects. -18. AIEN continues running. -``` - -That demonstration communicates the architecture much better than a synthetic chat benchmark. - ---- - -# 38. Short Architecture Reference - -```text -USER / API - ↓ -CONTROL PLANE - ↓ -RUNTIME - ↓ -J-SPACE - ↓ -SKILL ROUTER - ↓ -CAPABILITY GRAPH - ↓ -FABRIC SCHEDULER - ↓ -MACHINE 1 / MACHINE 2 / MACHINE 3 / ... - ↓ -TOOL / MODEL / VERIFIER EXECUTION - ↓ -AEGIS - ↓ -EFFECT BROKER - ↓ -WORLD COMMIT - ↓ -SIGNED PROVENANCE - ↓ -CORTEX - ↓ -RSI / BENCHMARK FEEDBACK -``` - ---- - -# 39. Priority Order - -If the goal is to maximize architectural leverage, build in this order: - -1. **Capability ABI** -2. **Skill Router** -3. **Canonical Rust MCP broker** -4. **Vault-only production secret policy** -5. **Effect Broker** -6. **Signed World Commit** -7. **Model Capsule / typed weight ABI** -8. **Portable accelerator interface** -9. **aien-node / Fabric** -10. **distributed branch execution** -11. **J-Space** -12. **content-addressed model distribution** -13. **fine-grained distributed inference** -14. **RSI optimization across all of the above** - -This ordering creates useful product value at every stage. - ---- - -# 40. Gap Summary - -## Already strong - -- native Rust runtime -- scheduler -- branchable inference state -- KV sharing -- streaming -- Cortex -- AEGIS -- evaluation/provenance primitives -- RSI canary/rollback -- Rust MCP proofs -- benchmark culture - -## Partial / fragmented - -- MCP -- skills/tools -- secrets -- effect gating -- provenance -- model loading -- hardware abstraction -- operator composition - -## Missing or not yet first-class - -- Capability Graph -- Skill Router -- Fabric -- Machine identity and placement -- Model Capsule -- portable accelerator contract -- signed World commits -- non-bypassable Effect Broker -- J-Space -- distributed branch execution -- content-addressed model distribution -- one canonical observability schema - ---- - -# 41. Final Architectural Definition - -AIEN should ultimately be understood as: - -> **A universal, branch-native AI runtime that treats models, tools, skills, memory, machines, and accelerators as discoverable capabilities inside one secure local compute fabric. It can explore multiple Worlds in parallel, judge them in J-Space, execute approved effects through a non-bypassable policy boundary, prove resulting state transitions cryptographically, remember useful outcomes in Cortex, and improve its own routing and execution through gated RSI.** - -The most important implementation discipline is to keep these responsibilities separate: - -```text -Model → proposes -J-Space → compares -Skill → describes procedure -Tool → performs atomic operation -Router → finds capability -Fabric → finds Machine -AEGIS → authorizes -Broker → performs effect -World → records state -Provenance → proves -Cortex → remembers -RSI → improves -``` - -That separation is the architecture. - ---- - -# 42. Research Sources and Prior Art - -The following current sources informed the gap analysis and implementation choices. - -## AIEN repositories - -- Sovereign Manifesto: https://github.com/aien-dev/open-humanity/blob/main/docs/SOVEREIGN_MANIFESTO.md - -- https://github.com/aien-dev/aien-sovereign-core -- https://github.com/aien-dev/aien-protocols -- https://github.com/aien-dev/aegis-runtime -- https://github.com/aien-dev/cortex-rs -- https://github.com/aien-dev/spark-rsi -- https://github.com/aien-dev/spark-debugger -- https://github.com/aien-dev/aien-harness -- https://github.com/aien-dev/spark-inquisitor -- https://github.com/aien-dev/spark-hive -- https://github.com/aien-dev/benchmarks -- https://github.com/aien-dev/aien-local-stack - -## Distributed compute and inference - -- Exo: https://github.com/exo-explore/exo -- llama.cpp RPC: https://github.com/ggml-org/llama.cpp/blob/master/tools/rpc/README.md -- MLX distributed: https://github.com/ml-explore/mlx/blob/main/docs/src/usage/distributed.rst -- Ray scheduling: https://docs.ray.io/en/latest/ray-core/scheduling/ -- Dask distributed: https://distributed.dask.org/ - -## Portable execution - -- IREE Vulkan: https://iree.dev/guides/deployment-configurations/gpu-vulkan/ -- Wasmtime: https://docs.wasmtime.dev/ -- Wasmtime Component Model: https://docs.wasmtime.dev/api/wasmtime/component/ - -## MCP - -- MCP organization: https://github.com/modelcontextprotocol -- Official Rust SDK: https://github.com/modelcontextprotocol/rust-sdk -- Rust SDK docs: https://rust.sdk.modelcontextprotocol.io/ - -## Authorization and identity - -- Cedar: https://github.com/cedar-policy/cedar -- Cedar docs: https://docs.cedarpolicy.com/ -- SPIFFE/SPIRE: https://spiffe.io/ - -## Provenance - -- in-toto Attestation: https://github.com/in-toto/attestation -- DSSE envelope concepts: https://github.com/in-toto/attestation/blob/main/spec/v1/envelope.md - -## Observability - -- OpenTelemetry semantic conventions: https://opentelemetry.io/docs/specs/semconv/ -- OpenTelemetry GenAI observability: https://opentelemetry.io/blog/2026/genai-observability/ - -## Tool routing and test-time scaling - -- Semantic MCP tool discovery: https://arxiv.org/abs/2603.20313 -- Test-time scaling survey: https://arxiv.org/abs/2608.04001 -- Inference-time verification: https://arxiv.org/abs/2601.15808 - -## Durable execution - -- Temporal: https://docs.temporal.io/ - ---- - -# 43. Immediate Next Engineering Ticket Set - -For implementation agents, the following tickets are concrete enough to start. - -## Ticket A: `aien-capability` - -Create canonical Tool and Skill descriptors. - -Deliver: - -- typed IDs, -- schemas, -- effect classes, -- resource requirements, -- version/digest semantics, -- serialization tests. - ---- - -## Ticket B: `aien-skill-router` - -Deliver: - -- deterministic alias lookup, -- tags/lexical index, -- semantic index interface, -- hard constraint filter, -- top-k output, -- routing receipts. - -Benchmark 1,000 / 10,000 capability catalogs. - ---- - -## Ticket C: `aien-mcp` - -Use `rmcp`. - -Deliver: - -- client, -- server, -- stdio, -- Streamable HTTP, -- mapping to ToolDescriptor, -- import existing Debugger/Harness MCP tools. - ---- - -## Ticket D: `aien-vault` - -Deliver production `VaultOnly`. - -Remove implicit environment fallback from production. - -Return `CredentialRef`, not secrets, to callers above broker level. - ---- - -## Ticket E: `aien-effect-broker` - -Move mail first. - -Then Git publish. - -Add mock driver for golden-path tests. - ---- - -## Ticket F: Signed World Commit v1 - -Extend `aien-provenance`. - -Use Merkle roots and existing signer interfaces. - ---- - -## Ticket G: Model Capsule v1 - -Support: - -- TinyLlama for oracle, -- one useful long-context model family, -- typed BF16/quantized tensor views, -- tokenizer/template digest, -- no FP32 expansion in production. - ---- - -## Ticket H: Portable Accelerator v1 - -Deliver: - -- CPU backend, -- Mojo backend, -- backend parity suite, -- no mandatory CUDA build dependency. - ---- - -## Ticket I: Fabric v1 - -Deliver: - -- `aien-node`, -- Machine IDs, -- mDNS discovery, -- QUIC connection, -- identity, -- capability advertisement, -- topology metrics. - ---- - -## Ticket J: Distributed J-Space prototype - -Deliver: - -- root candidate, -- 3 branches, -- dispatch to multiple Machines, -- cheap verifier, -- winning World commit, -- losing branch cleanup. - -This single prototype will test almost every major architectural boundary. - ---- - -# 44. Closing Rule - -Whenever a new subsystem is proposed, ask: +Use: -1. Is this **state**, **memory**, **planning**, **capability**, **placement**, **policy**, **effect**, or **evidence**? -2. Which existing subsystem already owns that responsibility? -3. Can it be represented as a typed protocol instead of a new daemon? -4. Can it execute on any Machine? -5. Can it fail without corrupting the logical AIEN system? -6. Can its effects be rolled back or proven? -7. Does it improve the end-to-end system, or merely add another layer? +- [Plan authority](PLAN_AUTHORITY.md) +- [Current execution plan](CURRENT_EXECUTION_PLAN.md) +- [Canonical architecture](doctrine/ARCHITECTURE.md) +- [Canonical milestone registry](doctrine/ROADMAP.md) -If those questions remain explicit, AIEN can grow to a very large system without becoming an unmaintainable collection of overlapping agents and services. +The historical version is preserved at `docs/archive/plans/2026-09-22/AIEN_COMPLETE_SYSTEM_ARCHITECTURE.md` and in Git history. diff --git a/AIEN_MASTER_ARCHITECTURAL_PLAN.md b/AIEN_MASTER_ARCHITECTURAL_PLAN.md index ee7bf91..54d86fa 120000 --- a/AIEN_MASTER_ARCHITECTURAL_PLAN.md +++ b/AIEN_MASTER_ARCHITECTURAL_PLAN.md @@ -1 +1,14 @@ -docs/14-master-architectural-plan.md \ No newline at end of file +# Superseded plan + +**Status: SUPERSEDED / HISTORICAL** + +This document is no longer an active plan. + +Use: + +- [Plan authority](PLAN_AUTHORITY.md) +- [Current execution plan](CURRENT_EXECUTION_PLAN.md) +- [Canonical architecture](doctrine/ARCHITECTURE.md) +- [Canonical milestone registry](doctrine/ROADMAP.md) + +The historical version is preserved at `docs/archive/plans/2026-09-25/AIEN_MASTER_ARCHITECTURAL_PLAN.md` and in Git history. diff --git a/CURRENT_EXECUTION_PLAN.md b/CURRENT_EXECUTION_PLAN.md new file mode 100644 index 0000000..1a347ca --- /dev/null +++ b/CURRENT_EXECUTION_PLAN.md @@ -0,0 +1,513 @@ +# AIEN Current Execution Plan + +**Status:** AUTHORITATIVE / ACTIVE +**Effective:** 2026-09-27 +**Plan authority:** [PLAN_AUTHORITY.md](PLAN_AUTHORITY.md) +**Milestone registry:** [doctrine/ROADMAP.md](doctrine/ROADMAP.md) +**Architecture authority:** [doctrine/ARCHITECTURE.md](doctrine/ARCHITECTURE.md) + +This is the only active cross-project master implementation plan for AIEN. + +## 1. North star + +AIEN is a persistent intelligent computing system that can understand an objective, define what must become true, discover a physical realization on the available machine, verify the realization, act, learn from evidence, and improve its methods without confusing intelligence with truth or authority. + +Canonical execution doctrine: + +```text +ATLAS AWAKENS. +AIEN PROPOSES. +OMEGA DEFINES. +FORGE REALIZES. +AEGIS VERIFIES. +HARDWARE ACTS. +EVIDENCE TEACHES. +``` + +AIENOS owns the trusted operating substrate beneath this loop. + +## 2. Current baseline + +As of 2026-09-27: + +- Atlas M1 is qualified in QEMU with historical bootstrap evidence preserved. +- AIENOS has native DGX Spark boot evidence, QEMU-qualified isolation/capability work, Store/continuity/recovery work, and active M5 encryption/identity implementation. +- Omega has completed the semantic/synthesis line through M18 and has a merged M19 resident-accelerator implementation with a 175-gate qualification run. +- An independent M19 review found evidence-integrity and runtime-correctness issues that require corrective qualification before M20 is trusted. +- The old PHYSICS architectural role has been superseded by FORGE: machine realization/lowering, not a security gatekeeper. +- AEGIS is the cross-cutting invariant/contract verifier. +- J-Space, Fabric, the canonical runtime Capability Graph, and full Skill routing remain incomplete as system-wide first-class components. +- RSI exists as an evaluation/promotion substrate but should not be placed on the critical path until the execution boundaries below are stable. + +## 3. Program rule + +Do not build higher layers on a lower layer whose qualification is known to be misleading. + +The critical path is therefore: + +```text +CONTROL THE PLAN + ↓ +M19 CORRECTIVE QUALIFICATION + ↓ +FORGE V1 BOUNDARY + ↓ +AIENOS TRUST + IDENTITY + ↓ +OMEGA NUMERICS / TENSORS / AUTODIFF / OPTIMIZER + ↓ +AIENOS NETWORKING + NATIVE INFERENCE + PERSISTENT AGENT + ↓ +CAPABILITY GRAPH + WORLD + J-SPACE + FABRIC + ↓ +AIEN_0 + GUIDED SYNTHESIS + ABSTRACTION DISCOVERY + ↓ +INTEGRATED AIEN + CORTEX + RSI + ↓ +SELF-HOSTING / SOVEREIGN CLOSURE + ↓ +PHYSICS ZERO + ↓ +GENERAL AIEN + SUCCESSION +``` + +## 4. Phase A — Project control and architecture cleanup + +### A1. Consolidate plan authority + +- Keep this file as the only whole-system implementation plan. +- Keep `doctrine/ROADMAP.md` as the milestone/status registry. +- Keep `doctrine/ARCHITECTURE.md` as the architecture authority. +- Archive every superseded system-wide master plan. +- Mark component-local plans as subordinate to whole-system authority. +- Add agent instructions that forbid treating archived plans as current. + +**Exit gate:** an agent can answer “what should I build next?” from these three files without consulting another master plan. + +### A2. Complete PHYSICS -> FORGE terminology migration + +- Ratify ADR 0014. +- Use FORGE for current machine realization/lowering. +- Preserve old PHYSICS milestone IDs, receipts, artifact names, and Git history. +- Rename live APIs from authority language to realization language. +- Rename the GitHub repository from `physics` to `forge` when repository administration is performed. +- Do not manufacture compatibility by rewriting historical evidence. + +**Exit gate:** current code/docs say FORGE for the live subsystem; PHYSICS appears only in historical compatibility/evidence contexts. + +## 5. Phase B — M19 corrective qualification + +M19 is reopened before M20. + +### B1. Evidence integrity + +- Receipts are append-only/content-addressed. +- Old milestone reruns cannot overwrite old receipts. +- Test counts are derived from observed execution. +- Candidate Git commit, binary, manifest, hardware descriptor, realization identities, actual gates run, and actual results are bound into the receipt. +- Hardware identity is probed from the machine rather than asserted by a source constant. +- Qualification code and receipts are separated so qualifying a candidate does not modify the candidate tree. + +### B2. Resident accelerator correctness + +- Implement complete allocate/use/revoke/free lifecycle. +- Measure actual coherent/device allocation state, not only CPU RSS. +- Make completion monotonic and dispatch commit exactly-once. +- Keep queue sequence identity distinct from completion-payload identity. +- Test duplicated completion, completion skip-ahead, timeout races, error-after-success, cancellation, teardown with work in flight, stale handles, and repeated allocation cycles. +- Run a long silicon soak proving flat resource use. + +**Exit gate:** M19 is requalified with immutable evidence and no known resource-lifecycle or exactly-once defects. + +## 6. Phase C — FORGE v1 + +FORGE becomes a typed machine-realization subsystem. + +### C1. Boundary + +```text +OMEGA RealizationRequest + ↓ +FORGE MachineDescriptor + realization search + ↓ +Candidate Realization + ↓ +AEGIS contract/invariant verification + ↓ +Hardware submission + ↓ +Execution evidence + machine facts + ↘ + OMEGA / AIEN feedback +``` + +### C2. Responsibilities + +FORGE owns: + +- machine discovery normalization; +- physical lowering; +- code generation backend integration; +- register/allocation/layout planning; +- memory placement; +- accelerator queue realization; +- DMA/IOMMU/device realization; +- machine-specific scheduling and autotuning; +- feedback of physical constraints and alternatives. + +FORGE does not own human intent, semantic truth, capability policy, or learned planning. + +**Exit gate:** Omega can request a realization without importing Forge implementation internals directly. + +## 7. Phase D — AIENOS trusted substrate + +Continue the AIENOS component roadmap without redefining this plan. + +### D1. M5 encryption and identity + +Finish and qualify: + +- owner-controlled key hierarchy; +- sealed volume keys; +- AES-256-GCM-SIV object envelopes; +- anti-rollback anchors; +- migration authorization; +- production/test identity separation; +- deterministic recovery; +- owner-signed trust chain on Machine 1. + +Resolve hardware qualification blocks instead of bypassing them. + +### D2. M6 minimal networking + +Build the minimum native networking needed by the system: + +- device ownership and discovery; +- bounded driver authority; +- Ethernet/IP/routing; +- secure transport; +- service discovery sufficient for Fabric later; +- deterministic failure/recovery. + +### D3. M7 native CPU inference + +- Move the stable inference contract behind an AIENOS platform boundary. +- Run without Linux syscalls under the native configuration. +- Bind model/tokenizer/weight identities. +- Preserve sequence/KV/Cortex continuity contracts. +- Compare against a frozen reference oracle. + +### D4. M8 persistent-agent proof + +First public whole-system proof: + +1. power on; +2. AIENOS boots without Linux underneath; +3. local model and AIEN runtime start; +4. user interacts; +5. Cortex stores a meaningful fact; +6. power off; +7. power on; +8. the same provisioned agent identity resumes and recalls it; +9. recovery remains possible with the model unavailable. + +**Exit gate:** persistent agent continuity is a demonstrated machine property, not a diagram. + +## 8. Phase E — Omega sovereign training substrate + +This lane can proceed in parallel with AIENOS D1-D3 once M19R/Forge boundaries are stable. + +### E1. Numerical closure + +Before tensor training: + +- general FP32 load/store/arithmetic; +- comparison/select/conversion; +- reductions; +- defined division/sqrt behavior; +- Omega-owned exact sequences for transcendental semantics where needed; +- CPU/GB10 parity under frozen numeric contracts. + +### E2. M20 OMEGA_TENSOR + +- immutable semantic tensors; +- shapes, strides, layouts, views; +- generation-checked runtime storage; +- elementwise ops, reduction, broadcasting, transpose, general matmul; +- generalize tensor-core realization beyond narrow K/tile assumptions; +- no semantic in-place mutation. + +### E3. M21 OMEGA_AUTODIFF + +```text +Omega forward graph + ↓ differentiate +Omega backward graph +``` + +The backward pass is ordinary Omega and uses the same Forge/AEGIS path. + +### E4. M22 OMEGA_OPTIMIZER + +- SGD first; Adam/AdamW after; +- updates write into shadow state; +- validation precedes one atomic generation switch; +- crash/fault injection must yield OLD or NEW, never half-updated. + +### E5. Training provenance + +Separate: + +- per-dispatch execution provenance; and +- full parameter/optimizer state provenance at committed training steps. + +Do not hash full model contents after every small kernel launch. + +**Exit gate:** a complete training step is deterministic enough to reproduce/verify and transactionally recoverable. + +## 9. Phase F — Agency and composition + +### F1. Canonical Capability Graph + +One runtime graph of: + +- providers; +- tools; +- skills; +- machines; +- models; +- credentials/references; +- requested capabilities; +- constraints; +- availability. + +MCP is one provider adapter, not the system ontology. + +### F2. Skill Router + +Skills are signed/versioned reusable procedures. Tools are atomic operations. The router selects procedures/capabilities without exposing raw provider sprawl to the model. + +### F3. World and effects + +- World = branchable execution state. +- Cortex = durable epistemic memory. +- Effects begin as typed Omega effect programs. +- Forge realizes physical/external operations. +- AEGIS verifies contracts. +- Effect Broker is a narrow protocol adapter. +- World commit binds selected branch, effect receipts, evidence roots, and identities. + +### F4. J-Space + +- fork candidate Worlds; +- execute reversible alternatives; +- keep score dimensions explicit; +- prune dominated candidates; +- externalize only the selected verified branch. + +### F5. Fabric + +After native networking: + +- stable Machine identities; +- authenticated membership; +- capability advertisement; +- topology/latency measurement; +- leases; +- placement; +- failure recovery. + +Start with coarse work units, not per-layer distributed inference. + +**Exit gate:** one objective can be decomposed, explored across branches/machines, realized, verified, committed, and remembered through canonical typed interfaces. + +## 10. Phase G — Sovereign learned search + +### G1. M23 search-guide training corpus + +Instrument synthesis deeply: + +- parent/child candidate; +- transformation; +- semantic features; +- verifier outcome; +- realization outcome; +- measured cost/performance; +- prune/failure/success reason. + +Learned guidance prioritizes search; verification still decides validity. + +### G2. M24 AIEN_0 + +Train a deliberately small first sovereign guide to score candidate next actions from: + +- current state; +- remaining objective; +- candidate operation semantics. + +The exact parameter count is secondary to a frozen experiment contract. + +### G3. Sealed evaluation + +Before final training, commit: + +- holdout seed commitment; +- generator/version; +- metrics; +- thresholds; +- allowed data; +- architecture; +- optimizer; +- training budget. + +Train, freeze model digest, reveal holdout, evaluate once, write immutable receipt. + +### G4. M25 guided synthesis + +AIEN_0 must measurably reduce search cost/time-to-valid-realization while preserving verification parity. If it does not, it has not earned integration. + +### G5. M26 abstraction discovery + +AIEN proposes reusable abstractions. Omega admits them only when they preserve semantics and improve compression/reuse/search on held-out tasks. + +## 11. Phase H — Integrated AIEN + +### H1. Runtime integration + +Integrate the learned guide into: + +- J-Space; +- Skill selection; +- Omega synthesis; +- planning. + +It proposes; it never self-grants capability. + +### H2. Cortex epistemic engine + +Consolidate Cortex around: + +- claims; +- evidence; +- episodes; +- hypotheses; +- confidence/verification tiers; +- retractions; +- promotions; +- provenance links. + +Model output is not automatically fact. + +### H3. RSI optimization loop + +Bring RSI back onto the path only now. + +RSI may propose and evaluate improvements to: + +- Forge plans; +- J-Space widths; +- routing; +- cache/layout policy; +- Skill retrieval; +- model placement; +- later model candidates. + +RSI cannot directly modify or promote the live trusted path. + +## 12. Phase I — Sovereign closure and self-hosting + +- Remove permanent Linux/CUDA/foreign-runtime dependencies where doctrine requires sovereignty. +- Preserve those tools as historical/reference oracles rather than pretending they were never used. +- Demonstrate boot, recovery, core build/realization, and continued operation without them. +- Keep Atlas as the founding bootstrap exception where explicitly defined. + +**Exit gate:** the installed lineage can reconstruct and operate its required trusted stack without depending on an external vendor service or incumbent OS. + +## 13. Phase J — Physics Zero (M27-M35) + +Physics Zero is scientific discovery and is distinct from Forge. + +Sequence: + +1. M27 contamination firewall and sealed evaluation protocol. +2. M28 hidden-law worlds. +3. M29 executable theory discovery. +4. M30 active experiment selection that discriminates competing theories. +5. M31 reusable concept formation. +6. M32 alien-law worlds. +7. M33 novel-regime extrapolation. +8. M34 prediction of previously unobserved phenomena. +9. M35 bounded real-lab experimentation. + +Evaluation rewards prediction, calibration, compression, and discriminating experiments, not resemblance to human textbook vocabulary. + +## 14. Phase K — General AIEN (M36-M40) + +### M36 Human interface + +Natural language/perception maps into the existing semantic/planning architecture. Chat is an interface, not the architecture. + +### M37 Resident cognition + +Long-lived cognitive execution on the persistent accelerator substrate with bounded resources and deterministic reconstruction. + +### M38 Continual library learning + +Wake -> Solve -> Verify -> Sleep compounding loop with measured admission and retirement of abstractions. + +### M39 Scientific autonomy + +Extended observe -> hypothesize -> predict -> experiment -> falsify -> revise campaigns inside declared physical bounds. + +### M40 Succession + +AIEN-N may design/train AIEN-N+1, but neither parent nor child may self-approve promotion. Evaluation is frozen first; candidate runs in isolated Worlds/canaries; independent verification and operator/governance rules decide promotion; rollback remains real. + +## 15. Final release gate + +The project is complete only when the clean-machine golden path works end-to-end: + +```text +Power on +→ Atlas awakens +→ AIENOS reconstructs trusted system state +→ Cortex restores durable memory +→ AIEN resumes +→ objective arrives +→ J-Space explores alternatives +→ Skill/Capability Graph resolves needs +→ Fabric places eligible work +→ Omega defines semantics +→ Forge realizes for available hardware +→ AEGIS verifies +→ hardware/tools act +→ World commits +→ provenance/evidence seal +→ Cortex learns +→ AIEN continues +``` + +The release campaign must include destructive/adversarial recovery tests: stale handles, revoked capabilities, interrupted state transitions, machine loss, network ambiguity, accelerator failure, corrupt candidates, and attempted self-promotion. + +## 16. Work that may run in parallel now + +**Lane 1 — M19R / Forge:** evidence repair, resource lifecycle, exactly-once completion, Forge boundary. + +**Lane 2 — AIENOS:** M5 trust/encryption -> M6 network -> M7 inference -> M8 persistent agent. + +**Lane 3 — Omega training:** FP32 numerics -> M20 tensor -> M21 autodiff -> M22 optimizer. + +**Lane 4 — Composition:** Capability Graph, Skill Router, World/effects, J-Space, Fabric interface design. + +These lanes converge before AIEN_0 is promoted into the live runtime. + +## 17. Immediate next gates + +Do not start another master plan. Execute these: + +1. Merge plan-authority consolidation and Forge naming ADR. +2. Complete M19 corrective qualification. +3. Establish the typed Omega/Forge boundary. +4. Finish and qualify AIENOS M5 trust/encryption. +5. Finish Omega general FP32 numerical support. +6. Proceed to AIENOS M6 and Omega M20 in parallel. diff --git a/PLAN_AUTHORITY.md b/PLAN_AUTHORITY.md new file mode 100644 index 0000000..e509818 --- /dev/null +++ b/PLAN_AUTHORITY.md @@ -0,0 +1,69 @@ +# AIEN Plan Authority + +**Status:** AUTHORITATIVE +**Effective:** 2026-09-27 + +AIEN has accumulated architecture reviews, roadmap snapshots, implementation plans, milestone plans, and research plans. They are useful historical records, but they are not allowed to compete as active instructions. + +## The three whole-system authorities + +1. **Architecture:** `doctrine/ARCHITECTURE.md` + Defines what the system is, subsystem ownership, permanent boundaries, and canonical terminology. + +2. **Milestone registry:** `doctrine/ROADMAP.md` + Owns canonical milestone identifiers and milestone status. Historical milestone names remain immutable even when a subsystem is later renamed. + +3. **Execution sequence:** `CURRENT_EXECUTION_PLAN.md` + Defines what the project should do now and in what order. This is the only active cross-project master implementation plan. + +No other file may present itself as the canonical, master, final, complete, authoritative, or current whole-system plan. + +## Component-local plans + +Component repositories may keep local roadmaps and acceptance specifications for their own scope. They must not redefine the whole-system architecture or duplicate the cross-project execution sequence. + +Examples: + +- `aien-dev/aienos/ROADMAP.md` is the AIENOS component roadmap. +- Omega milestone specifications define acceptance contracts for individual Omega milestones. +- Historical Physics/Forge milestone specifications and receipts remain evidence records. +- A finite workstream plan under `docs/plans/` is allowed only when its scope is explicit and it is marked **NOT A MASTER PLAN**. + +When a component plan conflicts with these authorities, this repository wins for architecture and cross-project sequencing. Current implementation code and evidence still win for claims about what is actually implemented. + +## Historical plan archive + +Superseded whole-system plans live under: + +`docs/archive/plans/` + +Every archived file carries a **SUPERSEDED / HISTORICAL** banner. Archived files are provenance, not instructions. + +Agents must not: + +- derive current milestone status from archived plans; +- reopen settled architecture because an archived document used older terminology; +- treat historical PHYSICS names as a reason to undo the FORGE rename; +- infer implementation status from a plan instead of current code/evidence. + +## Naming rule: PHYSICS -> FORGE + +As of 2026-09-27, the current machine-realization subsystem is **FORGE**. + +Historical identifiers such as `PHYSICS_BOOT`, `PHYSICS_EFFECTS`, `PHYSICS_ACCELERATOR_LINK`, old receipt fields, old artifact names, and old repository history remain unchanged. They describe what existed at the time. + +Current architecture uses: + +`ATLAS AWAKENS. AIEN PROPOSES. OMEGA DEFINES. FORGE REALIZES. AEGIS VERIFIES. HARDWARE ACTS. EVIDENCE TEACHES.` + +The repository `aien-dev/physics` remains a historical/current implementation location until its GitHub repository rename is performed. A repository-name transition does not rewrite old evidence. + +## Change discipline + +A proposed change to whole-system sequencing must update `CURRENT_EXECUTION_PLAN.md`. + +A proposed change to subsystem responsibility must be recorded as an ADR and reflected in `doctrine/ARCHITECTURE.md`. + +A milestone status change must update `doctrine/ROADMAP.md` and cite evidence or an explicit corrective-reopen decision. + +If a new document appears to be another master plan, stop and fold the useful material into the existing authority instead. diff --git a/README.md b/README.md index b31c2d0..7017520 100644 --- a/README.md +++ b/README.md @@ -1,118 +1,48 @@ # AIEN Architecture -Canonical architecture, flows, boundaries, decisions, research notes, and implementation roadmap for the AIEN ecosystem. +Canonical whole-system architecture and execution authority for the AIEN ecosystem. -This repository is intentionally **documentation-first**. It does not replace the implementation repositories. It defines how the pieces are intended to compose and gives implementation agents one place to answer: - -- What owns this responsibility? -- What talks to what? -- What is already implemented? -- What is partial? -- What is missing? -- Which boundary is security-critical? -- Which repository contains the current implementation? -- Which planned subsystem should be built next? +## Start here -> **Naming rule:** physical hosts are always called **Machine 1**, **Machine 2**, **Machine 3**, and so on. Hardware/vendor details are capabilities, never architectural identities. +Agents and maintainers should read these in order: -## Start here +1. [Plan authority](PLAN_AUTHORITY.md) +2. [Current execution plan](CURRENT_EXECUTION_PLAN.md) +3. [Canonical architecture](doctrine/ARCHITECTURE.md) +4. [Canonical milestone registry](doctrine/ROADMAP.md) +5. [Architecture decision records](docs/adr/README.md) +6. [Implementation status snapshot](docs/02-implementation-status.md) +7. [Golden path](docs/13-golden-path.md) -1. [Language](CONTEXT.md) -2. [Complete system architecture](AIEN_COMPLETE_SYSTEM_ARCHITECTURE.md) -3. [System map](docs/00-system-map.md) -4. [GitHub repository map](docs/01-github-repository-map.md) -5. [Implementation status](docs/02-implementation-status.md) -6. [Flows](docs/03-flows.md) -7. [Capabilities, skills, tools, and MCP](docs/04-capabilities-skills-tools-mcp.md) -8. [Fabric and portable compute](docs/05-fabric-and-compute.md) -9. [J-Space](docs/06-jspace.md) -10. [Security, AEGIS, vault, and effects](docs/07-security-effects-secrets.md) -11. [World, Cortex, and provenance](docs/08-world-cortex-provenance.md) -12. [RSI and evaluation](docs/09-rsi-evaluation.md) -13. [PEARL-inspired relational path engine](docs/10-relational-path-engine.md) -14. [Gap analysis](docs/11-gap-analysis.md) -15. [Roadmap](docs/12-roadmap.md) -16. [Golden path](docs/13-golden-path.md) -17. [Architecture decision records](docs/adr/README.md) -18. [Master architectural plan](docs/14-master-architectural-plan.md) +Superseded whole-system plans are kept only under [docs/archive/plans](docs/archive/plans/README.md). -## One-line architecture +## Current doctrine ```text -User/API - → Runtime - → J-Space - → Skill Router - → Capability Graph - → Fabric placement - → Model/Tool execution - → AEGIS - → Effect Broker - → World Commit - → Signed Provenance - → Cortex - → RSI feedback +ATLAS AWAKENS. +AIEN PROPOSES. +OMEGA DEFINES. +FORGE REALIZES. +AEGIS VERIFIES. +HARDWARE ACTS. +EVIDENCE TEACHES. ``` -## Master diagram - -```mermaid -flowchart TD - U[User / Operator / API] --> CP[Control Plane] - CP --> RT[AIEN Runtime] - - RT --> JS[J-Space] - JS --> SR[Skill Router] - SR --> CG[Capability Graph] - - CG --> NT[Native Tools] - CG --> MCP[MCP Broker] - CG --> FT[Fabric Tools] - - RT --> INF[Inference Runtime] - INF --> MR[Model Router] - MR --> FAB[AIEN Fabric] - - FAB --> M1[Machine 1] - FAB --> M2[Machine 2] - FAB --> M3[Machine 3] - FAB --> MN[Machine N] - - JS --> W[World Store] - RT --> CX[Cortex] - CX --> RT - - NT --> A[AEGIS] - MCP --> A - FT --> A - - A --> EB[Effect Broker] - EB --> EXT[External World] - EB --> W - - W --> P[Signed Provenance] - P --> CX - - RT --> RSI[RSI Optimizer] - RSI --> EV[Harness / Inquisitor / Benchmarks] - EV --> RT -``` +AIENOS owns the trusted OS/kernel substrate. OMEGA defines semantic computation. FORGE constructs machine realizations. AEGIS verifies contracts and invariants. Historical `PHYSICS_*` names remain unchanged in old milestones and evidence. ## Source-of-truth policy -This repository describes **intended architecture** and records resolved architecture decisions. - -Implementation truth remains the current code in the linked repositories. When this repository and running code disagree: +- Architecture ownership and terminology: `doctrine/ARCHITECTURE.md`. +- Milestone IDs/status: `doctrine/ROADMAP.md`. +- Cross-project sequencing: `CURRENT_EXECUTION_PLAN.md`. +- Implementation claims: current code and reproducible evidence. -1. Do not silently pretend the target is implemented. -2. Mark the discrepancy in [implementation status](docs/02-implementation-status.md). -3. Open an architecture-gap issue. -4. Update the relevant ADR when the intended design changes. +If these disagree, do not create another master plan. Record the discrepancy and update the appropriate authority. -## Repository role +## Component documentation -This repo should become the architectural index linked from the top-level READMEs of major AIEN repositories. Code repositories should avoid re-explaining the entire system; they should link here for cross-system architecture and keep their own README focused on their component. +Detailed subsystem/reference documents under `docs/` remain useful, but they are subordinate to the authorities above. Component repositories may keep their own local roadmaps. ## License -The AIEN ecosystem currently uses more than one license across repositories. Before publishing this architecture repository, copy or explicitly select the intended canonical documentation license rather than assuming one. See [LICENSE-NOTICE.md](LICENSE-NOTICE.md). +See [LICENSE-NOTICE.md](LICENSE-NOTICE.md). diff --git a/REPOSITORY_TREE.txt b/REPOSITORY_TREE.txt index 6f82f09..cf99471 100644 --- a/REPOSITORY_TREE.txt +++ b/REPOSITORY_TREE.txt @@ -1,8 +1,11 @@ .github/ISSUE_TEMPLATE/architecture-gap.md .github/PULL_REQUEST_TEMPLATE.md +AGENTS.md AIEN_COMPLETE_SYSTEM_ARCHITECTURE.md CONTRIBUTING.md +CURRENT_EXECUTION_PLAN.md LICENSE-NOTICE.md +PLAN_AUTHORITY.md README.md docs/00-system-map.md docs/01-github-repository-map.md @@ -26,6 +29,13 @@ docs/adr/0005-effect-broker.md docs/adr/0006-vault-only.md docs/adr/0007-jspace-effect-boundary.md docs/adr/0008-relational-paths.md +docs/adr/0014-rename-machine-physics-to-forge.md docs/adr/README.md +docs/archive/plans/2026-09-22/12-roadmap.md +docs/archive/plans/2026-09-22/AIEN_COMPLETE_SYSTEM_ARCHITECTURE.md +docs/archive/plans/2026-09-25/14-master-architectural-plan.md +docs/archive/plans/2026-09-25/AIEN_MASTER_ARCHITECTURAL_PLAN.md +docs/archive/plans/README.md docs/research/pearl.md docs/research/prior-art.md +doctrine/FORGE.md diff --git a/docs/12-roadmap.md b/docs/12-roadmap.md index b093719..67ce186 100644 --- a/docs/12-roadmap.md +++ b/docs/12-roadmap.md @@ -1,89 +1,14 @@ -# Roadmap +# Superseded plan -## Phase 0 — invariants +**Status: SUPERSEDED / HISTORICAL** -- Tool vs Skill semantics -- World vs Cortex vs J-Space separation -- no vendor-specific scheduler API -- no model-owned secret -- no irreversible speculative effect +This document is no longer an active plan. -## Phase 1 — capability plane +Use: -Build: +- [Plan authority](../PLAN_AUTHORITY.md) +- [Current execution plan](../CURRENT_EXECUTION_PLAN.md) +- [Canonical architecture](../doctrine/ARCHITECTURE.md) +- [Canonical milestone registry](../doctrine/ROADMAP.md) -```text -aien-capability -aien-skill-router -``` - -## Phase 2 — canonical MCP - -Build: - -```text -aien-sovereign-core/crates/aien-mcp -``` - -Sequence: - -1. `McpWire` seam -2. in-memory provider -3. `rmcp` -4. session manager -5. discovery snapshots -6. provider migration - -## Phase 3 — credentials and effects - -- `VaultOnly` -- `CredentialRef` -- Machine-aware resolvability -- Effect Broker -- mail as first migrated effect -- Git publish next - -## Phase 4 — signed World commit - -Bind effects, policy, runtime/model identity, and evidence. - -## Phase 5 — Model Capsule and typed weight ABI - -No production FP32 expansion of large BF16/quantized weights. - -## Phase 6 — portable accelerator - -- CPU -- Mojo -- parity/performance suite -- no mandatory CUDA build dependency - -## Phase 7 — Fabric - -- `aien-node` -- Machine IDs -- discovery -- QUIC -- capability advertisement -- topology metrics -- leases/failover - -## Phase 8 — J-Space - -Start with meaningful decision boundaries and distributed whole-branch execution. - -## Phase 9 — model distribution - -Content-addressed chunks. - -## Phase 10 — Relational Path Engine - -Use it for Cortex, capability routing, and J-Space only after A/B benchmarks. - -## Phase 11 — fine-grained distributed inference - -Only where measured topology shows value. - -## Phase 12 — RSI optimization - -Let RSI tune routing, placement, path width, kernel plans, and caches under existing safety gates. +The historical version is preserved at `docs/archive/plans/2026-09-22/12-roadmap.md` and in Git history. diff --git a/docs/14-master-architectural-plan.md b/docs/14-master-architectural-plan.md index 50e6244..3034e70 100644 --- a/docs/14-master-architectural-plan.md +++ b/docs/14-master-architectural-plan.md @@ -1,1677 +1,14 @@ -# AIEN Master Architectural Plan +# Superseded plan -## 1. North Star +**Status: SUPERSEDED / HISTORICAL** -AIEN exists to reduce the distance between human intention and physical reality. +This document is no longer an active plan. -The ultimate system should allow a person to describe a desired outcome, then have AIEN determine what must change, what it is permitted to change, how that change can be accomplished, which physical realization is appropriate, whether the result actually occurred, and what can be learned from it. +Use: -The long-term execution path is: +- [Plan authority](../PLAN_AUTHORITY.md) +- [Current execution plan](../CURRENT_EXECUTION_PLAN.md) +- [Canonical architecture](../doctrine/ARCHITECTURE.md) +- [Canonical milestone registry](../doctrine/ROADMAP.md) -```text -Human Intent - ↓ -Desired State - ↓ -Formal Transformation - ↓ -Constraints + Authority - ↓ -Candidate Futures - ↓ -Verification + Evaluation - ↓ -Authorization - ↓ -Physical Realization - ↓ -Physics - ↓ -Observed Reality - ↓ -Evidence - ↓ -Memory + Improvement -``` - -The concise definition is: - -> **AIEN compiles desired state into authorized, verified physical transformation.** - -The completed system is not fundamentally an operating system, AI model, programming language, CPU architecture, or robot. - -Those are components and physical realizations. - ---- - -## 2. The Permanent Architectural Rule - -No implementation layer below intent should become the permanent definition of AIEN. - -Therefore: - -```text -Rust != AIEN -AArch64 != AIEN -x86 != AIEN -RISC-V != AIEN -binary != AIEN -CUDA != AIEN -NVIDIA != AIEN -Linux != AIEN -a model != AIEN -a CPU != AIEN -``` - -Today AIEN is implemented primarily through Rust and AArch64 because those are useful engineering choices. - -They are not the final abstraction. - -The durable object should eventually describe: - -```text -What should become true? -What transformation produces it? -What constraints apply? -What authority is required? -What evidence proves success? -``` - -Everything below that may evolve. - ---- - -## 3. The Seven-Layer Architecture - -The whole system can be understood as seven architectural layers. - -```text -┌──────────────────────────────────────┐ -│ 7. HUMAN INTENT │ -│ "What do I want?" │ -├──────────────────────────────────────┤ -│ 6. SEMANTIC / DESIRED STATE │ -│ "What exactly must become true?" │ -├──────────────────────────────────────┤ -│ 5. INTELLIGENCE │ -│ Agent, Cortex, J-Space, Skills │ -├──────────────────────────────────────┤ -│ 4. AUTHORITY │ -│ Capabilities, AEGIS, Effects │ -├──────────────────────────────────────┤ -│ 3. TRANSFORMATION │ -│ Artifact IR, Transformation IR │ -├──────────────────────────────────────┤ -│ 2. PHYSICAL COMPILATION │ -│ Physical Compiler + Fabric │ -├──────────────────────────────────────┤ -│ 1. PHYSICAL SUBSTRATE │ -│ CPU/GPU/FPGA/waves/analog/etc. │ -└──────────────────────────────────────┘ - ↓ - PHYSICS -``` - -Each layer has one job. - -No layer should secretly absorb the responsibilities of another. - ---- - -## 4. Layer 1: The Trusted Physical Substrate - -This is what AIENOS is currently establishing. - -Its job is not intelligence. - -Its job is control. - -The kernel must provide deterministic mechanisms for: - -```text -boot -memory ownership -address spaces -tasks -scheduling -interrupts -IPC -capabilities -device ownership -DMA confinement -storage -networking -time -recovery -``` - -The model is never the kernel. - -The kernel must continue functioning with no model loaded. - -Its fundamental guarantee is: - -> A component can affect only the memory, objects and devices for which it has explicit authority. - -The trusted base should remain small, inspectable and recoverable. - -### Current engineering anchor - -The current development line is closing the M3 enforcement substrate: - -```text -EL1 kernel -↓ -AIENOS-owned MMU -↓ -interrupt ownership -↓ -preemptive scheduler -↓ -EL0 isolation -↓ -capability tables -↓ -typed IPC -↓ -SMMUv3 DMA confinement -↓ -device authority -``` - -This layer must become trustworthy before significant generated native code is admitted. - ---- - -## 5. Layer 2: The Physical Fabric - -Above individual drivers sits the abstraction AIEN uses to understand its body. - -A Machine should not simply be described as: - -```text -"NVIDIA DGX Spark" -``` - -It should expose capabilities. - -Conceptually: - -```text -PhysicalCapabilities { - compute - memory - storage - communication - devices - timing - precision - topology - energy - temperature - reconfiguration - failure_properties -} -``` - -Upper AIEN layers should increasingly ask: - -```text -Who can perform this transformation? -``` - -rather than: - -```text -Where is the NVIDIA GPU? -``` - -The same abstraction can eventually represent: - -```text -CPU -GPU -FPGA -specialized accelerator -another Machine -wave network -analog array -optical device -future computing substrate -``` - -Machine 1 is the first physical body. - -It is not AIEN's permanent body. - ---- - -## 6. Layer 3: Canonical Executable Artifacts - -Before AIEN becomes hardware-neutral, it needs a clean executable identity system. - -This is the bridge between today's software and tomorrow's Transformation IR. - -### Binary Artifact - -An AIEN Artifact should describe: - -```text -identity -exact executable bytes -ABI version -target -resource requirements -requested capabilities -declared effects -ancestry -evidence -admission -``` - -The central invariant is: - -```text -tested bytes - == -evaluated bytes - == -authorized bytes - == -executed bytes -``` - -The source code that produced an artifact is important provenance. - -It is not the executable identity. - -Artifacts are: - -```text -immutable -content-addressed -versioned -signed where appropriate -reproducibly evaluated -``` - -This becomes the basis for AIEN Generations. - ---- - -## 7. Generations and Self-Construction - -AIEN should grow through explicit Generations. - -```text -Generation 0 - ↓ -Generation 1 - ↓ -Generation 2 - ↓ -Generation N -``` - -An agent may propose a new Generation. - -It may not authorize it. - -The pipeline is: - -```text -Observe - ↓ -Propose - ↓ -Build - ↓ -Verify - ↓ -Isolated test - ↓ -Benchmark - ↓ -J-Space comparison - ↓ -AEGIS admission - ↓ -Canary - ↓ -Promote -``` - -Failure results in: - -```text -quarantine -↓ -rollback -↓ -preserve evidence -↓ -diagnose separately -``` - -The governing rule is: - -> **Rollback first, repair second.** - -AIEN never rewrites its trusted running kernel merely because a model believes an improvement is good. - ---- - -## 8. Layer 4: Authority - -The most important distinction in AIEN is: - -```text -intelligence -≠ -authority -``` - -The model may understand what should happen. - -That does not mean it has permission to make it happen. - -The canonical effect path is: - -```text -Agent - ↓ proposes -EffectIntent - ↓ -Capability check - ↓ -AEGIS - ↓ -Effect Broker - ↓ -Kernel / driver - ↓ -physical effect -``` - -### Capabilities - -Authority should be explicit and scoped. - -Examples: - -```text -audio.output -network.local -storage.project.read -device.camera.capture -mail.send -fabric.compute -world.promote -physical.motor.move -``` - -A capability answers: - -```text -WHO -may do WHAT -to WHICH resource -under WHICH bounds -``` - -No ambient root authority. - ---- - -## 9. AEGIS - -AEGIS is the authority boundary between intelligence and reality. - -Its job is to determine whether a proposed effect is permitted. - -It should understand: - -```text -principal -capability -scope -effect type -reversibility -resource bounds -operator policy -risk -provenance -``` - -Broadly: - -```text -reversible internal change - ↓ -can often proceed autonomously - -irreversible/external effect - ↓ -requires stronger authority -``` - -At the deepest future level, AEGIS still exists. - -If AIEN is configuring actual physical circuits, waves, power systems or machines, those are effects too. - -The Physical Compiler never gets to bypass AEGIS. - ---- - -## 10. Worlds - -A World is AIEN's reversible execution state. - -It answers: - -> "What if we did this?" - -A World allows AIEN to modify: - -```text -files -configuration -process state -candidate artifacts -runtime state -plans -``` - -without immediately changing canonical reality. - -Conceptually: - -```text -Canonical World - │ - ├── Candidate World A - ├── Candidate World B - └── Candidate World C -``` - -Dropping a World discards it. - -Promoting a World requires authority. - -This separation lets AIEN explore aggressively while remaining conservative about external effects. - ---- - -## 11. J-Space - -J-Space is where AIEN compares possible futures. - -It does not perform irreversible actions. - -It considers alternatives such as: - -```text -implementation A -implementation B -implementation C - -plan A -plan B -plan C - -physical realization A -physical realization B -physical realization C -``` - -and evaluates them using evidence. - -Eventually: - -```text -CPU implementation -GPU implementation -FPGA circuit -wave realization -analog realization -``` - -could all compete inside J-Space for the same Transformation. - -J-Space selects. - -OMEGA formalizes. - -PHYSICS lowers. - -AEGIS verifies. - -The Effect Broker adapter executes. - -Those remain separate jobs. - ---- - -## 12. Cortex - -Cortex is AIEN's durable epistemic memory. - -It should remember more than text. - -It records: - -```text -observations -facts -hypotheses -contradictions -decisions -experiments -provenance -measurements -failures -successful realizations -``` - -Cortex must preserve the distinction between: - -```text -observed -verified -inferred -hypothesized -decided -``` - -because AIEN must never turn its own previous speculation into "fact" simply because it remembered it. - -In the distant Physical Compiler architecture, Cortex also remembers: - -```text -transformation -substrate -realization -latency -energy -precision -temperature -failure rate -``` - -That turns physical experience into reusable knowledge. - ---- - -## 13. The Persistent Agent - -The agent is the human-facing continuity layer. - -Models may change. - -Kernels may change. - -Inference state may disappear. - -Machines may change. - -The logical agent should persist. - -```text -persistent identity -persistent history -persistent Cortex -persistent goals -persistent provenance - ↓ -replaceable model -replaceable runtime -replaceable hardware -``` - -The guiding principle is: - -> Losing physical inference state costs computation, not identity. - -Power cycle should eventually be ordinary: - -```text -power on -↓ -AIEN resumes -↓ -work -↓ -power off -↓ -power on -↓ -continue -``` - ---- - -## 14. Intent and Desired State - -The mature AIEN interface should move beyond commands. - -Instead of requiring: - -```text -open program -click menu -set field -run command -``` - -the person should increasingly be able to describe: - -```text -what they want to become true -``` - -Example: - -```text -"I want this room quieter, -cooler and more energy efficient." -``` - -The Intent layer transforms this into something closer to: - -```text -DesiredState { - temperature = target range - acoustic_level <= threshold - energy = minimize -} -``` - -The system must distinguish: - -```text -hard constraints -soft preferences -unknowns -required permissions -success conditions -``` - -AIEN should ask when consequential ambiguity cannot safely be resolved. - ---- - -## 15. Transformation IR - -This is the major transition beyond traditional computing. - -Instead of defining a computation as: - -```text -these AArch64 instructions -``` - -AIEN eventually defines: - -```text -Transformation { - inputs - outputs - semantic relation - invariants - precision - permitted error - latency constraint - memory constraint - energy objective - authority - effects -} -``` - -For example: - -```text -Y = X × W - -dtype = BF16 -error <= E -latency <= 2 ms -memory <= M -``` - -The same Transformation could be realized through multiple physical methods. - -That is where AIEN stops being fundamentally ISA-bound. - ---- - -## 16. The Physical Compiler - -The Physical Compiler answers: - -> **How should this Transformation become physical on the resources currently available?** - -Initially it will perform ordinary decisions: - -```text -scalar CPU -vs -vector CPU -vs -accelerator -``` - -Later: - -```text -CPU -GPU -FPGA -distributed Machine -``` - -And eventually: - -```text -digital circuit -multi-valued circuit -wave network -analog system -optical realization -other physical substrate -``` - -The compiler does not automatically select "fastest." - -It selects according to the Transformation's actual objective: - -```text -correctness -latency -energy -memory -precision -temperature -reliability -privacy -availability -``` - ---- - -## 17. Physical IR - -Below Transformation IR may eventually sit a representation of physical computation. - -For conventional digital systems, Physical IR could describe: - -```text -logic elements -registers -memory -connections -timing -resource constraints -``` - -For future substrates it may describe more general physical relationships. - -The crucial design principle is: - -> Physical IR describes a realization, not AIEN's permanent semantics. - -A new substrate can therefore introduce another backend without redefining AIEN. - ---- - -## 18. The Hum of the Hive - -Wave-based computation is a future Physical Fabric backend, not the definition of AIEN itself. - -A Wave IR might describe: - -```text -oscillator -frequency -amplitude -phase -coupling -modulation -interference -resonance -measurement -``` - -Instead of computing only through: - -```text -LOAD -ADD -STORE -BRANCH -``` - -a physical realization might compute through: - -```text -couple -oscillate -shift -interfere -resonate -settle -observe -``` - -The collective physical state can be thought of as: - -> **The Hum of the Hive.** - -Conceptually: - -```text -HiveState { - spectrum - phase_map - synchronization - energy_distribution - resonance_modes - stability -} -``` - -The Hum is not mystical. - -It is the measurable dynamical physical state of the computational fabric. - -Wave computation should begin as simulation, then only move onto real experimental hardware after deterministic security and measurement infrastructure exist. - ---- - -## 19. Multi-Valued and Analog Computing - -Binary remains the immediate implementation substrate. - -AIEN should not assume it is eternally optimal. - -Future research lanes may test: - -```text -binary -ternary -balanced ternary -higher radix -continuous analog -timing-based computation -frequency-domain computation -optical systems -neuromorphic systems -``` - -No representation wins because it sounds elegant. - -It must demonstrate value through measured workloads. - -AIEN's architecture therefore remains: - -```text -representation-independent -``` - -rather than: - -```text -binary-first forever -``` - -or: - -```text -wave-first forever -``` - ---- - -## 20. Physical Reality - -At sufficient maturity, AIEN's transformations may extend beyond computation. - -Physical effects could include: - -```text -configure -transmit -move -heat -cool -emit -energize -manufacture -route -assemble -``` - -through properly authorized devices. - -That creates the full loop: - -```text -Desired State - ↓ -Act - ↓ -Measure - ↓ -Compare - ↓ -Act again -``` - -AIEN does not simply assume an issued command succeeded. - -Reality must be measured. - ---- - -## 21. Provenance - -Every consequential transformation should create evidence. - -AIEN should be able to answer: - -```text -What was requested? -Who requested it? -What interpretation was used? -Which transformation was selected? -Which alternatives were considered? -What authority allowed it? -What artifact executed? -On what Machine? -What physical resources were used? -What actually happened? -What evidence supports that claim? -``` - -This provenance layer connects the entire system. - -Without it, autonomous self-improvement becomes storytelling. - -With it, improvements can be tested. - ---- - -## 22. RSI - -RSI is AIEN's improvement engine. - -It may propose improvements to: - -```text -algorithms -scheduler policies -memory placement -kernel implementations -cache policy -inference kernels -Transformation lowering -physical backend selection -circuit topology -wave configuration -physical placement -``` - -But RSI is never its own authority. - -The loop remains: - -```text -observe -↓ -hypothesize -↓ -construct candidate -↓ -evaluate -↓ -compare -↓ -authorize -↓ -promote -``` - -A failed candidate is evidence, not permission to try uncontrolled live mutations. - ---- - -## 23. Fabric and Multiple Machines - -AIEN should appear as one logical system even when it occupies several Machines. - -```text - AIEN - │ - ┌──────────┼──────────┐ - ↓ ↓ ↓ - Machine 1 Machine 2 Machine N -``` - -Fabric owns: - -```text -machine identity -capability advertisement -placement -topology -communication -leases -failover -resource scheduling -``` - -Fabric does not decide semantic goals. - -J-Space and the runtime decide what needs to happen. - -Fabric determines where eligible work can run. - ---- - -## 24. The Bootstrap Boundary - -AIEN cannot magically wake on arbitrary matter. - -Every new substrate needs a minimal physical entry point. - -A substrate must expose enough capability for AIEN to: - -```text -begin execution -represent state -change state -observe state -communicate -recover/reset -``` - -The architecture should minimize the substrate-specific seed. - -Conceptually: - -```text -New hardware - ↓ -Bootstrap Seed - ↓ -Physical Fabric Adapter - ↓ -Physical Capability Graph - ↓ -AIEN -``` - -Over time AIEN should be able to generate increasing portions of its own optimized backend after bootstrapping through a simple generic one. - -This is the route to true hardware portability. - ---- - -## 25. Self-Hosting - -AIEN reaches a deeper form of independence when it can reconstruct itself. - -Starting from: - -```text -minimal trusted Seed -+ -canonical artifacts -+ -supported physical substrate -``` - -AIEN should eventually be able to rebuild: - -```text -runtime -verifier -AEGIS -Cortex -Physical Compiler -backend -agent environment -``` - -and establish a new Generation. - -Self-hosting does not mean uncontrolled self-modification. - -It means the system can reproduce itself through the same verified admission process applied to everything else. - ---- - -## 26. The Four Eras - -The entire project can be reduced to four large eras. - -### Era I: AIEN Owns a Computer - -Build: - -```text -AIENOS -kernel isolation -capabilities -devices -storage -networking -native inference -Cortex -persistent agent -``` - -Outcome: - -> AIEN can safely inhabit and operate a conventional computer. - ---- - -### Era II: AIEN Owns Computation - -Build: - -```text -Binary Artifacts -Generations -Transformation IR -Physical Capability Graph -Physical Compiler -multiple execution backends -``` - -Outcome: - -> Computation is defined by desired transformations instead of one ISA. - ---- - -### Era III: AIEN Owns Its Physical Realization - -Build: - -```text -FPGA backend -Physical IR -reconfigurable circuits -multi-valued experiments -Wave IR -analog/continuous backends -``` - -Outcome: - -> AIEN can choose or construct physical mechanisms for computation. - ---- - -### Era IV: AIEN Connects Intent to Reality - -Build: - -```text -Intent Compiler -Desired State -physical effects -sensor feedback -closed-loop control -cross-domain orchestration -``` - -Outcome: - -> AIEN can translate authorized human intent into measured physical change. - ---- - -## 27. Delivery Order - -The architectural vision must not distort engineering priority. - -The dependency chain is: - -```text -TRUST - ↓ -IDENTITY - ↓ -ARTIFACTS - ↓ -PERSISTENCE - ↓ -INTELLIGENCE - ↓ -TRANSFORMATION - ↓ -PHYSICAL COMPILATION - ↓ -EXOTIC PHYSICS -``` - -Therefore the practical order is: - -```text -1. Finish M3 Trusted Machine -2. Freeze AIENOS ABI v1 -3. Introduce Binary Artifact v0 -4. Implement SEED-0B admission -5. Make storage + generations durable -6. Establish encryption + identity -7. Complete native networking -8. Complete useful native inference -9. Complete persistent Cortex + agent -10. Converge AEGIS / Worlds / J-Space -11. Mature Fabric -12. Introduce Transformation IR from real workloads -13. Add multiple Physical Compiler backends -14. Add a reconfigurable FPGA body -15. Introduce Physical IR -16. Research multi-valued logic -17. Research Wave IR / Hum of the Hive -18. Research analog and other physical substrates -19. Build generalized substrate bootstrap -20. Build Intent Compiler -21. Extend authorized transformations into physical environments -22. Demonstrate Intent → Verified Physical Reality -``` - -No hard dates are necessary. - -Each gate is earned by evidence. - ---- - -## 28. Repository Architecture - -The project should not respond to every new concept by creating another repository. - -Existing repositories should converge toward clear responsibilities. - -### `aienos` - -Owns the trusted body: - -```text -boot -kernel -memory -tasks -scheduler -IPC -capabilities -devices -DMA -storage -networking substrate -hardware adapters -Physical Fabric enforcement -recovery -``` - ---- - -### `aien-sovereign-core` - -Owns higher-level execution: - -```text -runtime -model abstraction -World execution -J-Space orchestration -Transformation planning -compute orchestration -initial Physical Compiler work -``` - -As native AIENOS matures, Linux-specific machinery becomes a compatibility implementation rather than architectural truth. - ---- - -### `aien-protocols` - -Owns stable portable contracts: - -```text -agent state -effects -events -evaluation -provenance -Binary Artifact -Transformation IR -Physical Capability Graph -Physical IR -Wave IR -bootstrap contracts -``` - -Only mature formats belong here. - -Experimental structures should not be prematurely frozen as protocols. - ---- - -### `aien-architecture` - -Owns architectural law: - -```text -system map -responsibility boundaries -ADRs -cross-repository contracts -roadmap -accepted invariants -future architecture -``` - -This master plan belongs conceptually here. - ---- - -### `benchmarks` - -Owns empirical truth: - -```text -correctness -latency -throughput -memory -energy -temperature -precision -noise -stability -reconfiguration cost -physical resource use -``` - -Claims require receipts. - ---- - -### `spark-rsi` - -Owns improvement proposals and evaluation machinery. - -It may propose better implementations. - -It must not become the authority that promotes them. - ---- - -### AEGIS - -Long-term AEGIS should converge toward one canonical authority system rather than several overlapping policy implementations. - ---- - -## 29. Canonical Objects - -Over time the most important durable objects should become: - -```text -Machine -Agent -Identity -Capability -Artifact -Generation -World -Intent -DesiredState -Transformation -PhysicalCapability -PhysicalRealization -EffectIntent -AdmissionReceipt -EvidenceReceipt -EpistemicRecord -``` - -These objects connect the full system. - -A future AIEN should be understandable by inspecting their relationships rather than reading thousands of unrelated configuration files. - ---- - -## 30. The Two Fundamental Loops - -Nearly the entire architecture reduces to two loops. - -### The Action Loop - -```text -Intent -↓ -Desired State -↓ -Transformation -↓ -J-Space -↓ -AEGIS -↓ -Effect -↓ -Physical Reality -↓ -Measurement -↓ -Cortex -``` - -This loop changes reality. - -### The Improvement Loop - -```text -Evidence -↓ -Cortex -↓ -RSI -↓ -Candidate -↓ -World -↓ -Evaluation -↓ -J-Space -↓ -AEGIS -↓ -New Generation -``` - -This loop changes AIEN. - -They must never collapse into one loop. - -If the system that proposes an improvement can directly install it, the architecture has failed. - ---- - -## 31. Hard Safety Invariants - -These should remain true even in the deepest future architecture. - -1. The model is never the root of trust. -2. Intelligence never implies authority. -3. Every external effect has an accountable principal. -4. Capabilities are explicit and revocable. -5. Speculation occurs in reversible state. -6. Reality changes only after authorization. -7. Generated code receives no ambient authority. -8. DMA is denied unless explicitly confined. -9. Physical configuration changes are effects. -10. RSI cannot authorize its own improvements. -11. Exact evaluated artifacts are the artifacts admitted. -12. Failed improvements roll back before repair. -13. Evidence distinguishes simulation, emulation and physical measurement. -14. A new hardware substrate does not automatically become trusted. -15. Recovery must not require the model. -16. Human operator authority remains available independently of agent reasoning. - ---- - -## 32. Research Lanes That Must Not Block the Product - -Keep these active, but separate from the critical path: - -```text -direct GB10 acceleration -FPGA synthesis -multi-valued computation -Wave IR -Hum of the Hive -analog computing -optical computing -neuromorphic substrates -self-generated physical backends -``` - -Each can mature until it earns promotion into the main architecture. - -This lets AIEN remain ambitious without turning the kernel roadmap into a physics research program. - ---- - -## 33. First Major Product Boundary - -The first complete AIEN product does not require Wave IR, FPGA synthesis or a Physical Compiler. - -It requires: - -```text -power on -↓ -AIENOS -↓ -local AIEN agent -↓ -conversation / voice -↓ -useful native model -↓ -Cortex -↓ -safe capabilities -↓ -power off -↓ -power on -↓ -continues -``` - -That is the first system worth putting in someone's hands. - -Everything deeper builds upon it. - ---- - -## 34. Final Architectural Boundary - -The final mature system looks like this: - -```text - HUMAN - │ - ▼ - ┌─────────┐ - │ INTENT │ - └────┬────┘ - ▼ - ┌────────────────┐ - │ DESIRED STATE │ - └───────┬────────┘ - ▼ - ┌─────────────────┐ - │ TRANSFORMATION │ - └───────┬─────────┘ - │ - ┌─────────▼─────────┐ - │ J-SPACE │ - │ possible futures │ - └─────────┬─────────┘ - ▼ - ┌────────────┐ - │ AEGIS │ - │ authority │ - └─────┬──────┘ - ▼ - ┌───────────────────┐ - │ PHYSICAL COMPILER │ - └─────────┬─────────┘ - ▼ - ┌──────────────────┐ - │ PHYSICAL FABRIC │ - └─────────┬────────┘ - ▼ - ┌─────────────────────────────────────┐ - │ CPU │ GPU │ FPGA │ WAVE │ ANALOG │ ? │ - └──────────────────┬──────────────────┘ - ▼ - PHYSICS - │ - ▼ - REALITY - │ - ▼ - SENSORS - │ - ▼ - EVIDENCE - │ - ▼ - CORTEX - │ - ▼ - RSI -``` - ---- - -## 35. What AIEN Eventually Becomes - -AIEN begins as an operating system because an operating system is the first layer that must be owned. - -It evolves into a persistent agent platform. - -Then into a hardware-neutral transformation system. - -Then into a physical compiler. - -Eventually its deepest question is no longer: - -> "Which instruction should the CPU execute?" - -Nor even: - -> "Which program should I run?" - -It becomes: - -> **"What permitted physical process can cause the requested state of reality to become true?"** - -The system then finds a realization, verifies it, executes it, measures it and remembers what happened. - -That is the fully zoomed-out architecture. - -> **Intent → Meaning → Desired State → Transformation → Authority → Physical Realization → Physics → Reality → Evidence → Learning.** - -Everything currently being built is a layer of that path. +The historical version is preserved at `docs/archive/plans/2026-09-25/14-master-architectural-plan.md` and in Git history. diff --git a/docs/adr/0014-rename-machine-physics-to-forge.md b/docs/adr/0014-rename-machine-physics-to-forge.md new file mode 100644 index 0000000..c20032e --- /dev/null +++ b/docs/adr/0014-rename-machine-physics-to-forge.md @@ -0,0 +1,82 @@ +# ADR 0014: Rename Machine Physics to FORGE + +**Status:** Accepted by operator, 2026-09-27 + +## Context + +ADR 0013 corrected the architecture by redefining PHYSICS from a security gatekeeper into the machine lowering and physical realization subsystem. That change left three problems: + +1. the name PHYSICS still suggests authority over physical truth and collides with the separate Physics Zero scientific-discovery program; +2. AIENOS now clearly owns the operating-system/kernel substrate: boot continuation, address spaces, tasks, interrupts, capabilities, DMA confinement, storage, recovery, and native device ownership; +3. current code already behaves more like a realization backend than the older “Trusted Machine Authority” wording implies. + +The remaining name was therefore misleading even though the new responsibility boundary was correct. + +## Decision + +The current machine realization subsystem is renamed **FORGE**. + +Canonical doctrine becomes: + +```text +ATLAS AWAKENS. +AIEN PROPOSES. +OMEGA DEFINES. +FORGE REALIZES. +AEGIS VERIFIES. +HARDWARE ACTS. +EVIDENCE TEACHES. +``` + +FORGE is the machine realization engine and physical lowering compiler. + +FORGE receives formal Omega programs plus machine facts/constraints, searches or constructs concrete realizations, emits machine-specific artifacts/schedules, and reports physical constraints/alternatives back to Omega. + +AEGIS remains the continuous invariant/contract verifier. AIENOS remains the trusted OS/kernel substrate. + +## FORGE owns + +- machine descriptor normalization; +- physical lowering; +- machine-code/backend realization; +- register/layout/allocation planning; +- physical memory placement required by a realization; +- DMA/IOMMU/device realization plans; +- accelerator command/queue realization; +- machine-specific scheduling/autotuning; +- physical constraint and alternative feedback to Omega. + +## FORGE does not own + +- human intent; +- semantic meaning; +- goal selection; +- capability policy; +- self-authorization; +- learned planning; +- scientific Physics Zero. + +## Historical compatibility rule + +This rename is not a history rewrite. + +The following remain unchanged when they are historical identifiers: + +- `PHYSICS_BOOT`; +- `PHYSICS_EFFECTS`; +- `PHYSICS_ACCELERATOR_LINK`; +- old receipt fields and seals; +- old artifact names such as `physics.bin`; +- commit messages, tags, evidence bundles, and qualification records; +- the existing `aien-dev/physics` repository history. + +New code, APIs, documentation, milestones, and receipts use FORGE unless they explicitly refer to historical compatibility. + +The GitHub repository may be renamed from `physics` to `forge` as an administrative operation. Git history and qualified artifacts must not be rewritten as part of that operation. + +## Consequences + +- Physics Zero now exclusively names the scientific-discovery program. +- Current architecture stops implying that the machine-realization backend is a security authority. +- AIENOS and FORGE have distinct responsibilities. +- Agents have one current vocabulary while historical evidence remains truthful. diff --git a/docs/adr/README.md b/docs/adr/README.md index 14a6d51..a5af573 100644 --- a/docs/adr/README.md +++ b/docs/adr/README.md @@ -16,4 +16,5 @@ Current ADRs: - [0010 - Canary observations are measurements](0010-canary-observations-are-measurements.md) - [0011 - An inference context is model state](0011-inference-context-is-model-state.md) - [0012 - One shell dispatch, then a landing split](0012-shell-dispatch-then-landing.md) -- [0013 - Machine Physics Lowering and AEGIS Invariant Verification Chain](0013-machine-physics-lowering-and-aegis-invariant-checker.md) +- [0013 - Machine Physics Lowering and AEGIS Invariant Verification Chain](0013-machine-physics-lowering-and-aegis-invariant-checker.md) — naming superseded by ADR 0014 +- [0014 - Rename Machine Physics to FORGE](0014-rename-machine-physics-to-forge.md) diff --git a/docs/archive/plans/2026-09-22/12-roadmap.md b/docs/archive/plans/2026-09-22/12-roadmap.md new file mode 100644 index 0000000..416c925 --- /dev/null +++ b/docs/archive/plans/2026-09-22/12-roadmap.md @@ -0,0 +1,99 @@ +> **SUPERSEDED / HISTORICAL — DO NOT USE AS AN ACTIVE IMPLEMENTATION PLAN** +> +> Original path: `docs/12-roadmap.md` +> +> Archived on 2026-09-27 during plan consolidation. The active cross-project execution plan is [CURRENT_EXECUTION_PLAN.md](../../../CURRENT_EXECUTION_PLAN.md), governed by [PLAN_AUTHORITY.md](../../../PLAN_AUTHORITY.md). +> +> Retained for provenance only. + +--- + +# Roadmap + +## Phase 0 — invariants + +- Tool vs Skill semantics +- World vs Cortex vs J-Space separation +- no vendor-specific scheduler API +- no model-owned secret +- no irreversible speculative effect + +## Phase 1 — capability plane + +Build: + +```text +aien-capability +aien-skill-router +``` + +## Phase 2 — canonical MCP + +Build: + +```text +aien-sovereign-core/crates/aien-mcp +``` + +Sequence: + +1. `McpWire` seam +2. in-memory provider +3. `rmcp` +4. session manager +5. discovery snapshots +6. provider migration + +## Phase 3 — credentials and effects + +- `VaultOnly` +- `CredentialRef` +- Machine-aware resolvability +- Effect Broker +- mail as first migrated effect +- Git publish next + +## Phase 4 — signed World commit + +Bind effects, policy, runtime/model identity, and evidence. + +## Phase 5 — Model Capsule and typed weight ABI + +No production FP32 expansion of large BF16/quantized weights. + +## Phase 6 — portable accelerator + +- CPU +- Mojo +- parity/performance suite +- no mandatory CUDA build dependency + +## Phase 7 — Fabric + +- `aien-node` +- Machine IDs +- discovery +- QUIC +- capability advertisement +- topology metrics +- leases/failover + +## Phase 8 — J-Space + +Start with meaningful decision boundaries and distributed whole-branch execution. + +## Phase 9 — model distribution + +Content-addressed chunks. + +## Phase 10 — Relational Path Engine + +Use it for Cortex, capability routing, and J-Space only after A/B benchmarks. + +## Phase 11 — fine-grained distributed inference + +Only where measured topology shows value. + +## Phase 12 — RSI optimization + +Let RSI tune routing, placement, path width, kernel plans, and caches under existing safety gates. diff --git a/docs/archive/plans/2026-09-22/AIEN_COMPLETE_SYSTEM_ARCHITECTURE.md b/docs/archive/plans/2026-09-22/AIEN_COMPLETE_SYSTEM_ARCHITECTURE.md new file mode 100644 index 0000000..e9a9b46 --- /dev/null +++ b/docs/archive/plans/2026-09-22/AIEN_COMPLETE_SYSTEM_ARCHITECTURE.md @@ -0,0 +1,3393 @@ +> **SUPERSEDED / HISTORICAL — DO NOT USE AS AN ACTIVE IMPLEMENTATION PLAN** +> +> Original path: `AIEN_COMPLETE_SYSTEM_ARCHITECTURE.md` +> +> Archived on 2026-09-27 during plan consolidation. The active cross-project execution plan is [CURRENT_EXECUTION_PLAN.md](../../../CURRENT_EXECUTION_PLAN.md), governed by [PLAN_AUTHORITY.md](../../../PLAN_AUTHORITY.md). +> +> Retained for provenance only. + +--- + +# AIEN Complete System Architecture +## Universal Local AI Runtime, Heterogeneous Compute Fabric, Skills/Tools, J-Space, Security, Memory, Provenance, and Self-Improvement + +**Document status:** Architecture RFC / implementation roadmap +**Snapshot date:** September 22, 2026 +**Primary composition root reviewed:** `aien-dev/aien-sovereign-core` +**Current public `main` snapshot reviewed:** `cacf2264b52cac20ba0ac6aee55fcde9110d97b6` +**Naming convention:** Physical hosts are always referred to as **Machine 1**, **Machine 2**, **Machine 3**, and so on. Hardware type is metadata, not identity. + +--- + +# 1. Executive Summary + +AIEN should become a **single logical AI system that can use every compatible machine, accelerator, model, skill, tool, memory store, and verifier available to it without making any one hardware vendor, model vendor, cloud service, or protocol the center of the architecture**. + +The project already contains unusually strong pieces: + +- a native Rust runtime spine, +- scheduler and sequence lifecycle, +- branchable/paged KV state, +- native transformer execution, +- Unix-domain-socket operator control, +- Cortex memory, +- AEGIS policy enforcement, +- signed evaluation receipts and TPM-oriented signing primitives, +- RSI candidate evaluation and promotion, +- multiple Rust MCP servers, +- benchmark/provenance infrastructure, +- cockpit/operator interfaces, +- harness/debugger/inquisitor subsystems, +- model adapters, +- and a growing set of real effect integrations. + +The largest remaining problem is no longer “can AIEN run inference?” It is **composition**. + +AIEN still needs one canonical layer that answers all of the following: + +1. **What work needs to happen?** +2. **What skill or tool can perform it?** +3. **Which Machine can perform it?** +4. **Which model or accelerator should be used?** +5. **Can the work be explored in parallel branches?** +6. **What state belongs to each branch?** +7. **What effects are permitted?** +8. **How do we prove what actually happened?** +9. **What should be remembered?** +10. **How should the system improve from the result?** + +The target architecture is therefore: + +```mermaid +flowchart TD + U[User / Operator / API] --> C[AIEN Control Plane] + C --> R[AIEN Runtime] + R --> JS[J-Space Planner and Judge] + JS --> SR[Skill Router] + SR --> CG[Capability Graph] + + CG --> NT[Native AIEN Tools] + CG --> MCP[MCP Broker] + CG --> FP[Fabric-Provided Tools] + + JS --> IF[Inference Runtime] + IF --> MC[Model Capsule Registry] + IF --> AD[Accelerator Dispatch] + + AD --> M1[Machine 1] + AD --> M2[Machine 2] + AD --> M3[Machine 3] + AD --> MN[Machine N] + + M1 --> FAB[AIEN Fabric] + M2 --> FAB + M3 --> FAB + MN --> FAB + + NT --> AE[AEGIS Authorization] + MCP --> AE + FP --> AE + + AE --> EB[Effect Broker] + EB --> EXT[External World] + + R --> W[World Store] + JS --> W + EB --> W + + W --> P[Signed Provenance] + P --> CX[Cortex] + CX --> R + + R --> RSI[RSI Optimizer] + RSI --> H[Harness / Inquisitor / Benchmarks] + H --> R +``` + +The central design principle is: + +> **AIEN is one logical runtime. Machines are interchangeable capability providers. Models are interchangeable inference providers. MCP is an adapter. Tools are atomic capabilities. Skills are composed procedures. J-Space is the branch-and-judge planning substrate. Worlds hold state. AEGIS verifies. The Effect Broker adapter performs verified irreversible actions. Provenance proves. Cortex remembers. RSI improves.** + +--- + + +# 1A. Resolved Architecture Decisions After Sovereign Manifesto Review + +The `open-humanity/docs/SOVEREIGN_MANIFESTO.md` establishes several architectural invariants that directly affect MCP, secrets, Fabric placement, and speculative execution: + +- local-first execution, +- compiled Rust/Mojo core services, +- zero telemetry, +- zero plaintext secrets on disk, +- hardware-backed vaulting, +- durable memory, +- encrypted peer cooperation. + +The following decisions are therefore **closed** for the target architecture. + +## Decision 1: `aien-mcp` lives inside `aien-sovereign-core` + +Canonical location: + +```text +aien-sovereign-core/ +└── crates/ + └── aien-mcp/ +``` + +Do **not** create a separate canonical MCP repository first. + +Reasons: + +1. MCP is part of AIEN's runtime capability plane, not an independent product. +2. It must share canonical types with `aien-capability`, `aien-policy`, `aien-vault`, `aien-fabric`, `aien-world`, and provenance. +3. Keeping it in the composition root prevents another source-of-truth split. +4. Existing MCP implementations in `spark-debugger` and `aien-harness` should migrate into adapters/tests around `aien-mcp`. +5. A separate public SDK crate or mirror can be published later from the canonical source if external adoption warrants it. + +Do not start this work by mixing it into unrelated local edits on `fix/golden-path-gaps`. Create a clean feature branch from the appropriate synchronized base once the golden-path work is committed or isolated. + +Recommended branch: + +```text +feat/aien-mcp-broker +``` + +## Decision 2: AEGIS applies to every capability provider + +Every tool invocation crosses the same canonical authorization envelope regardless of provider: + +```text +Native Tool +MCP Tool +Fabric Tool +WASM Tool +Process Tool +HTTP Tool + │ + ▼ +Capability Invocation + │ + ▼ +AEGIS + │ + ├── deny + └── allow + │ + ▼ + Executor +``` + +This does **not** mean every read operation requires human approval. + +It means every provider enters the same policy boundary. Policy may deterministically auto-allow safe/read-only operations. + +The result is one policy model and one receipt family rather than separate trust models for MCP, native tools, and remote Machines. + +The MCP broker **routes**. It does not become an alternative policy authority. + +## Decision 3: Third-party servers may request environment variables, but AIEN configuration never stores the plaintext value + +Third-party compatibility requires handling servers that expect environment variables such as: + +```text +GITHUB_TOKEN +DATABASE_URL +API_KEY +``` + +AIEN should accept the **binding requirement**, not a plaintext value. + +Example: + +```rust +CredentialRef { + provider: CredentialProvider::Vault, + name: "github.operator", + scope: CredentialScope::MachineResolvable, + delivery: CredentialDelivery::ChildEnv { + variable: "GITHUB_TOKEN", + }, +} +``` + +The stored configuration contains only the reference. + +At execution time: + +```text +ToolCall + ↓ +AEGIS + ↓ +Fabric placement + ↓ +MCP Broker on selected Machine + ↓ +Vault resolve + ↓ +launch one child with one ephemeral variable + ↓ +child exits + ↓ +credential value discarded +``` + +The model, J-Space state, tool arguments, World records, logs, Cortex, and provenance receipts never contain the resolved secret. + +### Important limitation + +A bearer token must exist in plaintext **somewhere in volatile memory** when an HTTP client or legacy child process actually authenticates with it. + +Therefore the realistic invariant is: + +> No plaintext secret at rest, in configuration, prompts, logs, receipts, or long-lived caches; plaintext is materialized only at the smallest possible execution boundary for the shortest possible time. + +Preferred delivery order: + +1. broker-owned authentication, where the child never sees the token; +2. short-lived OAuth/access token owned by the broker; +3. inherited file descriptor / pipe / local socket when supported; +4. call-scoped child environment variable only for legacy compatibility. + +Environment-variable delivery should be tagged as a higher exposure class. + +## Decision 4: Credential scope participates in Fabric placement + +A TPM-backed vault is physically local. + +A credential that exists only on one Machine cannot magically resolve elsewhere. + +Do not hard-code a Machine ID into every semantic tool request. Instead, make **credential scope** part of placement constraints. + +```rust +pub enum CredentialScope { + FabricResolvable, + MachineBound(MachineId), + OperatorBound(OperatorId), + SessionBound(SessionId), +} +``` + +Resolution: + +```text +Tool requires github.operator + ↓ +Capability Graph + ↓ +Credential Resolver + ↓ +Which Machines can satisfy it? + ↓ +Fabric Scheduler + ↓ +eligible Machine selected +``` + +If Machine 2 cannot resolve the required credential, Machine 2 is not an eligible placement. + +This is a scheduling constraint, not a late runtime surprise. + +## Decision 5: Every tool declares effect semantics before J-Space may route it + +J-Space must not infer side effects from a tool name. + +Each tool declares an explicit effect set. + +Recommended model: + +```rust +bitflags! { + pub struct ToolEffects: u32 { + const PURE = 0; + const READ_FILESYSTEM = 1 << 0; + const READ_NETWORK = 1 << 1; + const SPAWN_PROCESS = 1 << 2; + const WORLD_MUTATION = 1 << 3; + const LOCAL_EPHEMERAL = 1 << 4; + const EXTERNAL_WRITE = 1 << 5; + const EXTERNAL_IRREVERSIBLE= 1 << 6; + const SECRET_BEARING = 1 << 7; + } +} +``` + +J-Space policy: + +| Effect type | Speculative J-Space execution | +|---|---| +| Pure | Yes | +| Read-only | Yes | +| Local ephemeral | Yes, sandboxed | +| Process spawn | Yes when sandboxed and bounded | +| World mutation | Yes, but only inside a draft World | +| External write | Stage intent only until winner | +| External irreversible | Never execute on speculative branch | +| Secret-bearing | Only through brokered isolated execution | + +Example: `debug_scan` is not simply "read-only" because it may spawn local checks and probe services. Its descriptor should declare the actual operations, for example: + +```text +READ_FILESYSTEM +READ_NETWORK +SPAWN_PROCESS +LOCAL_EPHEMERAL +``` + +That lets J-Space execute it safely as a bounded evaluator without treating it as an externally visible write. + +The universal rule is: + +> J-Space may explore freely inside reversible Worlds. External reality changes only after selection, AEGIS authorization, and commit through the Effect Broker. + +--- + +# 2. Architectural Principles + +## 2.1 Hardware must not define AIEN + +AIEN must not require CUDA, NVIDIA, Apple, AMD, a cloud provider, or a single machine. + +The runtime should depend only on a hardware-neutral accelerator interface. + +A Machine advertises capabilities such as: + +```rust +pub struct MachineCapabilities { + pub machine_id: MachineId, + pub cpu_arch: CpuArch, + pub cpu_cores: u16, + pub memory_total_bytes: u64, + pub memory_available_bytes: u64, + pub accelerators: Vec, + pub supported_dtypes: DTypeSet, + pub models_cached: Vec, + pub tool_providers: Vec, + pub thermal_state: ThermalState, + pub power_state: PowerState, +} +``` + +The scheduler should reason over capabilities, not brand names. + +--- + +## 2.2 One logical system, many physical processes + +AIEN should **not** attempt to stretch one operating-system process or one address space across multiple machines. + +Instead: + +- every Machine runs an `aien-node`, +- all Machines participate in one logical Fabric, +- state identifiers are global, +- memory ownership remains local, +- work can move, +- failed Machines can be replaced, +- content is addressed by digest, +- and state can be reconstructed from durable roots. + +```mermaid +flowchart LR + CP[Logical AIEN Runtime] + + CP --> M1[Machine 1] + CP --> M2[Machine 2] + CP --> M3[Machine 3] + CP --> M4[Machine 4] + + M1 <-->|QUIC / trusted transport| M2 + M2 <-->|QUIC / trusted transport| M3 + M3 <-->|QUIC / trusted transport| M4 + M1 <-->|content / work / state| M4 +``` + +--- + +## 2.3 Tools are not skills + +**Tool:** one atomic capability. + +Examples: + +- `filesystem.read` +- `filesystem.write` +- `process.execute` +- `git.diff` +- `git.commit` +- `mail.send` +- `browser.navigate` +- `cortex.search` +- `database.query` + +**Skill:** a reusable procedure that can invoke multiple tools and can contain planning, success criteria, verification rules, and J-Space strategy. + +Examples: + +- `software.debug.rust` +- `software.review.pull_request` +- `software.implement.feature` +- `research.deep` +- `communication.answer_email` +- `operations.release` + +This distinction must become canonical. + +--- + +## 2.4 MCP is compatibility, not the core architecture + +MCP is useful and important, but AIEN should not make the internal runtime depend on MCP semantics. + +The canonical path should be: + +```text +AIEN Capability ABI + ├── Native Tool adapter + ├── MCP adapter + ├── HTTP/OpenAPI adapter + ├── WASM Component adapter + ├── Process adapter + └── Fabric Remote Tool adapter +``` + +The model sees **AIEN capabilities**, not raw MCP topology. + +--- + +## 2.5 Effects are transactional + +Models, skills, tools, and J-Space branches should be able to propose actions. + +Only a dedicated effect boundary should perform irreversible external actions. + +```mermaid +flowchart LR + A[Agent / Skill / J-Space] --> I[EffectIntent] + I --> G[AEGIS] + G -->|deny| D[Stop] + G -->|allow| B[Effect Broker] + B --> E[External System] + E --> R[Execution Receipt] + R --> W[World Commit] + W --> P[Signed Provenance] +``` + +--- + +## 2.6 Memory is not execution state + +Cortex should remember durable knowledge and evidence. + +Worlds should represent branchable runtime state. + +KV state should represent inference state. + +J-Space should represent candidate/evaluation/search state. + +They should reference one another by stable IDs, not collapse into one database. + +--- + +# 3. Current AIEN Project: What Exists Today + +This section distinguishes current implementation from the target architecture. + +## 3.1 `aien-sovereign-core` + +Current workspace members include: + +- `aien-cli` +- `spark-cockpit-rs` +- `cortex-rs` +- `spark-hive` +- `spark-supervisor` +- `spark-discord-hub` +- `spark-debugger` +- `spark-harness` +- `spark-dream` +- `spark-adapters` +- `spark-crumbs` +- `spark-inquisitor` +- `spark-max-cabi` +- `spark-max-rs` +- `cortex-encoder-rs` +- `spark-mail-rs` +- `spark-harvester` +- `spark-aegis` +- `aien-inference-abi` +- `aien-kv-cache` +- `aien-scheduler` +- `aien-security` +- `aien-platform` +- `aien-platform-linux` +- `aien-runtime` +- `rad-id-sync` +- `aien-inference-protocol` +- `aien-inference-runtime` + +The current public `main` has already connected native chat to the runtime socket and connected the native runtime to scheduler/KV/streaming paths. + +### Keep + +`aien-sovereign-core` should remain the **canonical composition root** and product repo. + +### Change + +It should stop containing hardware-specific assumptions at core interfaces. Hardware-specific code should become an accelerator implementation behind a portable ABI. + +--- + +## 3.2 Native inference runtime + +### Already implemented + +The runtime now has: + +- prompt submission, +- completion sinks, +- scheduler integration, +- branchable sequences, +- shared KV prefix state, +- native transformer path, +- token streaming, +- physical block reclamation, +- hardware execution tests. + +### Current gap + +The visible inference ABI still uses a production tensor shape centered around `Vec` and an `&[f32]` backend interface. + +That is unsuitable for large quantized models because BF16/F16 weights are expanded into FP32. + +### Target + +Replace the weight ABI with typed storage views and a compiled Model Capsule. + +--- + +## 3.3 Cortex + +Cortex already contains: + +- logical spaces, +- entities, +- claims, +- session/event ledgers, +- evidence relationships, +- summaries/hypotheses, +- storage concurrency, +- provenance-related data. + +### Keep + +Cortex remains the durable memory/knowledge layer. + +### Change + +Cortex should not become: + +- the task scheduler, +- World state, +- J-Space, +- or the tool registry. + +It should receive structured results from those systems. + +--- + +## 3.4 AEGIS + +AEGIS already contains: + +- deterministic pre-dispatch checks, +- probe-policy evaluation, +- workspace containment, +- tool/skill gating, +- a `SkillRegistry`, +- vault resolution. + +### Current architectural problem + +`SkillRegistry` currently mixes tools and skills. + +Built-ins such as `read_file`, `write_file`, `bash_eval`, `git_status`, and `cortex_recall` are atomic tools, not high-level skills. + +Its current handler form is effectively local-process execution: + +```rust +Arc Result + Send + Sync> +``` + +That does not naturally support Fabric placement. + +### Target + +Move definitions into a Capability Graph. AEGIS verifies calls against capability contracts but does not own routing or placement. + +--- + +## 3.5 MCP + +### Already implemented + +AIEN already has at least two hand-written Rust MCP servers: + +1. `spark-debugger` +2. `aien-harness` + +Both implement stdio JSON-RPC and expose `initialize`, `tools/list`, and `tools/call`. + +`spark-debugger` advertises protocol version `2024-11-05`. + +### Not yet implemented + +There is no evidence of a single canonical: + +- MCP client, +- MCP broker, +- remote server registry, +- current-spec MCP implementation, +- OAuth broker, +- Fabric-aware MCP placement, +- Capability Graph integration, +- unified provenance wrapper. + +### Target + +Create one `aien-mcp` subsystem using the official Rust `rmcp` SDK. + +--- + +## 3.6 Vault/secrets + +AEGIS already has `VaultResolver` and prefers: + +```text +atlas-vault get +``` + +### Gap + +It currently falls back to environment variables. + +That means “zero plaintext secrets” is a policy goal, but not yet a universally enforced runtime property. + +### Target + +Production mode must be `VaultOnly`. + +Environment fallback should exist only in explicit development/test mode. + +--- + +## 3.7 Provenance + +`aien-protocols` already contains: + +- SHA-256 digest helpers, +- provenance types, +- P-256 signing, +- evaluation receipts, +- software signers, +- TPM-oriented signers, +- Merkle roots, +- canary rollback/evaluation receipts. + +### Gap + +The World lifecycle is not yet the canonical signed provenance object for every external effect. + +### Target + +Use the existing protocol package to create signed World Commit envelopes rather than inventing another receipt system. + +--- + +## 3.8 RSI + +RSI already contains: + +- proposal generation, +- candidate evaluation, +- judge process, +- signed evaluation receipts, +- canary safety envelope, +- rollback, +- promotion gate. + +### Target + +RSI remains **out of the hot runtime path**. + +It should optimize: + +- kernel plans, +- scheduling heuristics, +- skill routing, +- model placement, +- tool selection, +- cache policies, + +but never mutate live execution without signed evaluation and rollout gates. + +--- + +## 3.9 Harness / Debugger / Inquisitor + +These are valuable but overlapping. + +### Harness + +Useful for: + +- deterministic workflow gates, +- schema validation, +- failure replay, +- evaluation. + +### Debugger + +Useful for: + +- runtime diagnostics, +- service checks, +- security invariant audits, +- MCP exposure. + +### Inquisitor + +Useful for: + +- constitutional/diff auditing, +- evaluator integration, +- canary checks. + +### Target + +Do not merge their semantics into one giant crate. + +Instead, expose all three as **evaluators/tools through the Capability Graph**. + +--- + +# 4. Target Repository/Crate Topology + +The following is the recommended long-term structure. + +```text +aien-sovereign-core/ +└── crates/ + ├── aien-runtime + ├── aien-control + ├── aien-protocols + ├── aien-model + ├── aien-inference + ├── aien-accelerator + ├── aien-kv + ├── aien-sequence + ├── aien-world + ├── aien-jspace + ├── aien-capability + ├── aien-skill-router + ├── aien-tool-runtime + ├── aien-mcp + ├── aien-effect-broker + ├── aien-policy + ├── aien-vault + ├── aien-fabric + ├── aien-node + ├── aien-provenance + ├── aien-observability + └── aien-cli +``` + +Satellite repos can continue to exist for focused distribution, but canonical source should live in the composition root or be generated from it. + +--- + +# 5. The Complete Runtime Flow + +## 5.1 Normal conversational turn + +```mermaid +sequenceDiagram + participant User + participant CLI as AIEN Control + participant Runtime + participant Router as Model Router + participant Inference + participant Cortex + participant World + + User->>CLI: message + CLI->>Runtime: StreamTurn + Runtime->>Cortex: retrieve relevant memory + Cortex-->>Runtime: evidence/context refs + Runtime->>Router: choose model + Machine + Router->>Inference: submit prompt + Inference-->>Runtime: token stream + Runtime->>World: record logical turn + Runtime-->>CLI: token deltas + CLI-->>User: response +``` + +--- + +## 5.2 Skill/tool turn + +```mermaid +sequenceDiagram + participant Model + participant J as J-Space + participant SR as Skill Router + participant CG as Capability Graph + participant F as Fabric + participant A as AEGIS + participant T as Tool Runtime + participant W as World + + Model->>J: objective / proposed action + J->>SR: request procedure + SR->>CG: retrieve relevant skills + CG-->>SR: candidates + SR-->>J: top candidates + J->>CG: resolve required tools + CG->>F: find providers + F-->>CG: eligible Machines + J->>A: authorize planned call + A-->>J: allow/deny + J->>T: execute authorized call + T-->>J: ToolResult + J->>W: commit branch result +``` + +--- + +## 5.3 External effect turn + +```mermaid +sequenceDiagram + participant Agent + participant J as J-Space + participant A as AEGIS + participant B as Effect Broker + participant E as External System + participant P as Provenance + participant W as World + + Agent->>J: propose external action + J->>A: EffectIntent + A-->>J: AuthorizedEffect + J->>B: AuthorizedEffect + B->>E: perform action + E-->>B: external result + B->>P: create receipt digest + P-->>B: signed receipt + B->>W: finalize World commit +``` + +--- + +# 6. Universal Machine Fabric + +## 6.1 Concept + +Every physical computer runs: + +```text +aien-node +``` + +A node joins one Fabric and advertises: + +- CPU resources, +- accelerator resources, +- memory, +- model cache, +- tools, +- skill implementations, +- operating-system capabilities, +- network quality, +- current load, +- thermal/power state. + +Machines are generic logical identities: + +```text +Machine 1 +Machine 2 +Machine 3 +Machine 4 +... +``` + +Example: + +```text +Machine 1 + CPU architecture: arm64 + accelerator: GPU + unified memory: true + memory: 128 GiB + cached models: A, B + +Machine 2 + CPU architecture: arm64 + accelerator: GPU + memory: 48 GiB + cached models: B, C + +Machine 3 + CPU architecture: x86_64 + accelerator: none + memory: 64 GiB + tools: build, git, database + +Machine 4 + CPU architecture: arm64 + accelerator: GPU + tools: platform-specific-build +``` + +No higher layer should need to know product names. + +--- + +## 6.2 Node capability structure + +```rust +pub struct NodeAdvertisement { + pub machine: MachineId, + pub identity: WorkloadIdentity, + pub hardware: HardwareCapabilities, + pub accelerators: Vec, + pub tools: Vec, + pub skills: Vec, + pub models: Vec, + pub resources: ResourceState, + pub network: NetworkState, +} +``` + +--- + +## 6.3 Transport + +Recommended initial transport: + +- QUIC +- Rust `quinn` +- TLS 1.3 +- mutually authenticated node identity +- multiplexed control/data streams +- optional datagrams for telemetry/heartbeats. + +Why QUIC: + +- encrypted by default, +- stream multiplexing, +- no TCP head-of-line blocking across independent streams, +- portable across Linux/macOS/Windows, +- pure Rust implementation available. + +For LAN discovery: + +- mDNS/DNS-SD. + +For more advanced direct peer connectivity later: + +- Iroh or libp2p concepts can be adopted selectively. + +Do not begin with a complicated WAN peer-to-peer overlay. + +--- + +## 6.4 Network topology model + +```rust +pub struct FabricLink { + pub from: MachineId, + pub to: MachineId, + pub latency_us: u64, + pub jitter_us: u64, + pub bandwidth_bps: u64, + pub loss_ppm: u32, + pub transport: TransportClass, +} +``` + +The scheduler should maintain a weighted graph. + +```mermaid +graph LR + M1[Machine 1] -- "low latency / high bandwidth" --> M2[Machine 2] + M2 -- "medium latency" --> M3[Machine 3] + M1 -- "high latency" --> M4[Machine 4] + M3 -- "medium bandwidth" --> M4 +``` + +--- + +## 6.5 Preferred distributed work granularity + +### Best over normal LAN/Wi-Fi + +- independent J-Space branches, +- tool execution, +- verifier work, +- speculative candidates, +- embeddings, +- compilation/tests, +- document processing, +- model replicas. + +### Use only on very fast interconnects + +- tensor parallelism, +- layer pipeline parallelism, +- fine-grained activation transfer. + +This is crucial. + +A slow Machine can help the Fabric if it receives coarse work. + +It can hurt the Fabric if every token depends on it. + +--- + +# 7. Portable Accelerator Architecture: No CUDA Dependency + +## 7.1 Requirement + +AIEN core must not contain a mandatory CUDA dependency. + +NVIDIA hardware may use NVIDIA drivers under a portable runtime, but AIEN's source/runtime contracts should not be CUDA-shaped. + +--- + +## 7.2 Target interface + +```rust +pub trait Accelerator: Send + Sync { + fn capabilities(&self) -> DeviceCapabilities; + + fn load_model( + &mut self, + capsule: &ModelCapsule, + ) -> Result; + + fn submit( + &mut self, + plan: &ExecutionPlan, + ) -> Result; + + fn fork_kv( + &mut self, + parent: SequenceId, + child: SequenceId, + ) -> Result<()>; + + fn reclaim( + &mut self, + sequence: SequenceId, + ) -> Result<()>; +} +``` + +--- + +## 7.3 Backend strategy + +### Tier 1: optimized CPU + +Always available. + +- x86-64 SIMD +- arm64 SIMD +- multithreaded +- quantized kernels + +### Tier 2: Mojo accelerator + +Primary portable accelerator path where supported. + +Target: + +- NVIDIA GPU +- AMD GPU +- Apple GPU + +### Tier 3: broad GPU fallback later + +If needed, investigate IREE/Vulkan for hardware not covered well by Mojo. + +IREE's Vulkan deployment supports multiple GPU vendors and operating systems, but should be treated as an optional portability layer, not another mandatory runtime. + +--- + +## 7.4 Do not expose vendor-specific APIs to the scheduler + +Bad: + +```rust +if gpu.is_blackwell() { ... } +``` + +Good: + +```rust +if caps.fp4 && plan.supports_fp4() { ... } +else if caps.bf16 { ... } +else { ... } +``` + +--- + +# 8. Model Capsules + +## 8.1 Why + +The runtime should not parse arbitrary model repositories and reshape thousands of tensors on every startup. + +Model installation should be a compile/pack phase. + +```text +source model + ↓ +aien model pack + ↓ +validated Model Capsule + ↓ +content-addressed chunks + ↓ +runtime-ready +``` + +--- + +## 8.2 Capsule contents + +```rust +pub struct ModelCapsuleManifest { + pub model_digest: Digest32, + pub architecture: ArchitectureId, + pub tokenizer_digest: Digest32, + pub template_digest: Digest32, + pub config_digest: Digest32, + + pub max_context: u32, + pub tensor_layout: TensorLayoutVersion, + pub quantization: QuantizationSpec, + + pub shards: Vec, + pub required_kernels: Vec, +} +``` + +--- + +## 8.3 Distribution + +Model data should be split into content-addressed chunks. + +```text +Model A +├── chunk 000 -> digest +├── chunk 001 -> digest +├── chunk 002 -> digest +└── ... +``` + +When Machine 3 joins: + +```text +Machine 3 already has 73% of Model A. +Transfer only missing chunks. +``` + +Content-addressed transfer could initially be built over the same QUIC fabric. + +Later, `iroh-blobs`-style verified chunk streaming is useful prior art. + +--- + +## 8.4 Persistent prompt roots + +Common AIEN system prompts should be tokenized and prefixed once. + +```text +model + tokenizer + chat template + system prompt + policy + ↓ + PrefixRootId +``` + +New sessions fork from the prefix root. + +This uses AIEN's branch-native KV architecture to avoid repeated prefill. + +--- + +# 9. Sequence/KV Architecture + +## 9.1 Canonical state + +```text +SequenceId + ├── token lineage + ├── KV block table + ├── parent sequence + ├── model handle + └── owning Machine +``` + +A fork should: + +- copy metadata, +- increment block references, +- share physical prefix pages, +- perform copy-on-write only when divergence requires it. + +--- + +## 9.2 Global vs local identity + +A Sequence ID may be globally known. + +The actual KV pages remain local to their owning Machine. + +```text +Sequence 981 +owner = Machine 2 +prefix = PrefixRoot 12 +world = World 771 +``` + +If Machine 2 disappears, AIEN reconstructs from durable token lineage and model identity. + +Do not implement distributed shared memory for KV. + +--- + +# 10. J-Space + +## 10.1 Definition + +J-Space is the **typed evaluation/search space over possible World transitions**. + +It is not: + +- a memory database, +- a replacement for WorldStore, +- a replacement for Cortex, +- an arbitrary graph database, +- a token-level tree that always runs. + +It exists when AIEN has multiple plausible choices and needs to compare them. + +--- + +## 10.2 Core node + +```rust +pub struct JNode { + pub id: JNodeId, + pub parent: Option, + + pub world: WorldId, + pub sequence: SequenceId, + pub memory_view: MemoryViewId, + + pub proposal: ProposalRef, + pub score: ScoreVector, + pub constraints: ConstraintState, + + pub evidence_root: Digest32, + pub evaluator_set: EvaluatorSetId, + pub status: JNodeStatus, +} +``` + +--- + +## 10.3 Multi-objective score + +Do not collapse everything into one untraceable scalar. + +```rust +pub struct ScoreVector { + pub task_quality: f32, + pub verifier_confidence: f32, + pub safety_margin: f32, + pub latency_cost: f32, + pub compute_cost: f32, + pub memory_cost: f32, + pub uncertainty: f32, +} +``` + +Pareto filtering can remove dominated candidates before expensive judges run. + +--- + +## 10.4 J-Space flow + +```mermaid +flowchart TD + P[Parent State] --> A[Candidate A] + P --> B[Candidate B] + P --> C[Candidate C] + P --> D[Candidate D] + + A --> CF[Cheap Filters] + B --> CF + C --> CF + D --> CF + + CF --> PR[Prune Dominated / Invalid] + PR --> V[Verifier Batch] + V --> J[Judge] + J --> W[Winner] + W --> WC[World Commit] +``` + +--- + +## 10.5 Fabric-aware J-Space + +```mermaid +flowchart LR + ROOT[J-Space Root] --> A[Branch A] + ROOT --> B[Branch B] + ROOT --> C[Branch C] + + A --> M1[Machine 1] + B --> M2[Machine 2] + C --> M3[Machine 3] + + M1 --> J[Judge] + M2 --> J + M3 --> J + + J --> WIN[Winning World Transition] +``` + +This is a major potential differentiator. + +Most distributed inference systems focus on splitting one model computation. + +AIEN can distribute **reasoning alternatives and executable Worlds**. + +--- + +# 11. Capability Graph + +## 11.1 Purpose + +The Capability Graph answers: + +> What can AIEN do, what does it require, where can it run, what effects can it cause, and what can satisfy this request? + +A flat hash map will not scale. + +--- + +## 11.2 Canonical names + +Tools: + +```text +filesystem.read +filesystem.write + +process.execute + +git.status +git.diff +git.commit +git.push + +github.issue.read +github.pull_request.create + +mail.read +mail.send + +memory.cortex.search +memory.cortex.write + +database.query + +browser.navigate +browser.extract + +build.rust +test.rust +build.apple +``` + +Skills: + +```text +software.debug.rust +software.implement.feature +software.review.pull_request +research.deep +communication.answer_email +operations.release +``` + +--- + +## 11.3 Skill descriptor + +```rust +pub struct SkillDescriptor { + pub id: SkillId, + pub name: CanonicalName, + pub version: Version, + + pub description: String, + pub domain: DomainId, + pub family: SkillFamilyId, + pub tags: Vec, + pub intents: Vec, + + pub required_tools: Vec, + pub required_capabilities: CapabilitySet, + + pub input_schema: SchemaId, + pub output_schema: SchemaId, + + pub potential_effects: EffectSet, + pub cost_profile: CostProfile, + pub examples: Vec, + + pub digest: Digest32, +} +``` + +--- + +## 11.4 Tool descriptor + +```rust +pub struct ToolDescriptor { + pub id: ToolId, + pub name: CanonicalName, + pub version: Version, + + pub input_schema: SchemaId, + pub output_schema: SchemaId, + + pub effects: EffectSet, + pub requirements: ResourceRequirements, + + pub deterministic: bool, + pub retryable: bool, + pub idempotency: IdempotencyClass, +} +``` + +--- + +# 12. Skill Router + +## 12.1 The routing problem + +If AIEN eventually has 10,000 capabilities, sending all of them into the model context is inefficient and harms tool selection. + +A 2026 paper on semantic MCP tool discovery reports strong results from retrieving only a few relevant tools instead of presenting the entire catalog, with large token savings and high retrieval hit rates. + +The principle is sound even if AIEN develops its own benchmark. + +--- + +## 12.2 Progressive routing + +```mermaid +flowchart TD + Q[Intent] --> L0[Level 0: exact alias / deterministic] + L0 -->|unresolved| L1[Level 1: tags / lexical] + L1 -->|ambiguous| L2[Level 2: semantic retrieval] + L2 -->|ambiguous| L3[Level 3: small router model] + L3 -->|complex| L4[Level 4: J-Space planning] + + L0 --> C[Candidate Set] + L1 --> C + L2 --> C + L3 --> C + L4 --> C + + C --> F[Constraint Filter] + F --> T[3-10 relevant capabilities] +``` + +Most requests should stop before the expensive levels. + +--- + +## 12.3 Constraint filtering + +Before the model sees candidates, eliminate impossible choices: + +- unavailable Machine, +- missing operating-system capability, +- missing credential, +- denied policy, +- incompatible model, +- excessive memory, +- excessive latency, +- tool not installed, +- offline remote provider. + +--- + +## 12.4 Historical routing feedback + +Cortex may store routing experience: + +```text +request class +selected skill +Machine placement +latency +success/failure +judge score +operator correction +``` + +Cortex informs ranking. + +It does **not** become the authoritative capability registry. + +--- + +# 13. Skill Packs + +Human operators need a manageable abstraction above individual tools. + +Example packs: + +```text +AIEN Base +├── filesystem +├── process +├── memory +└── network + +Developer Pack +├── git +├── repository hosting +├── compilation +├── testing +└── debugging + +Research Pack +├── web +├── papers +├── citations +└── synthesis + +Communication Pack +├── mail +├── calendar +└── messaging + +Platform Build Pack +├── native build tools +├── simulator +└── signing +``` + +A Machine may advertise entire packs plus individual exceptions. + +--- + +# 14. MCP Architecture + +## 14.1 What MCP is + +MCP is a protocol that lets AI clients communicate with servers exposing: + +- tools, +- resources, +- prompts, +- and related capabilities. + +It does not require Python or TypeScript. + +The official Rust MCP SDK (`rmcp`) is current, async, and supports both client and server use. + +--- + +## 14.2 Current AIEN MCP state + +### Implemented + +`spark-debugger`: +- Rust +- stdio +- JSON-RPC +- initialize +- tools/list +- tools/call + +`aien-harness`: +- Rust +- stdio +- JSON-RPC +- initialize +- tools/list +- tools/call + +### Problem + +These are separate hand-maintained protocol implementations. + +--- + +## 14.3 Target MCP subsystem + +Canonical source location: + +```text +aien-sovereign-core/crates/aien-mcp +``` + +The existing hand-written MCP servers remain compatibility fixtures during migration; canonical protocol/client/broker behavior moves into this crate. + +```text +aien-mcp +├── client +├── server +├── broker +├── registry +├── stdio transport +├── streamable HTTP transport +├── auth +├── vault credential provider +├── AEGIS adapter +├── Capability Graph adapter +├── Fabric adapter +└── provenance adapter +``` + +Use official `rmcp` rather than expanding manual JSON-RPC matching. + +--- + +## 14.4 MCP is translated into AIEN capabilities + +```mermaid +flowchart LR + S[MCP Server] --> MB[MCP Broker] + MB --> AD[Capability Adapter] + AD --> CG[Capability Graph] + CG --> SR[Skill Router] + SR --> JS[J-Space] +``` + +The inverse direction allows AIEN-native tools to be exported as MCP when external clients need them. + +--- + +# 15. Secret Architecture + +## 15.1 Model must never see raw credentials + +```mermaid +flowchart LR + M[Model] --> TC[ToolCall] + TC --> CR[CredentialRef] + CR --> A[AEGIS] + A --> B[Credential Broker] + B --> V[Vault] + V --> B + B --> R[Authenticated Request] +``` + +The model receives: + +```text +CredentialRef("service.operator") +``` + +not: + +```text +actual-secret-value +``` + +--- + +## 15.2 Production vault policy + +```rust +pub enum SecretPolicy { + VaultOnly, + VaultThenEnvironmentForDevelopment, +} +``` + +Production must reject implicit environment fallback. + +A third-party process that explicitly requires an environment variable may receive a **call-scoped child-only injection** from a `CredentialRef`, after AEGIS authorization and Fabric placement. This is a compatibility delivery mechanism, not a configuration source. Raw values must never be serialized into AIEN configuration, World state, J-Space, logs, Cortex, or provenance. + +--- + +## 15.3 Network identity + +For Fabric identity, study and borrow from SPIFFE/SPIRE: + +- workload identity, +- short-lived credentials, +- runtime attestation, +- mTLS. + +AIEN does not necessarily need to deploy full SPIRE initially. + +A small AIEN-native identity layer can use the same principles: + +```text +Machine identity key + ↓ +node enrollment + ↓ +short-lived session certificate + ↓ +mTLS/QUIC peer authentication +``` + +--- + +# 16. AEGIS Authorization Architecture + +AEGIS should evolve from pattern checks into a typed authorization plane. + +Recommended combination: + +1. deterministic hard invariants, +2. Cedar-style declarative policy, +3. optional semantic/probe evaluation, +4. operator approval for high-risk effects. + +Cedar is especially attractive because: + +- it is written in Rust, +- separates policy from application logic, +- supports principal/action/resource/context decisions, +- is designed for fast authorization. + +Example conceptual request: + +```text +principal = Agent::"researcher-17" +action = Tool::"mail.send" +resource = RecipientDomain::"external" +context = { + world_id, + skill_id, + jnode_id, + operator_session, + risk_score +} +``` + +--- + +# 17. Effect Broker + +## 17.1 Why a separate process + +If all external effects are available directly inside `aien-runtime`, a bug can bypass policy. + +The stronger design is: + +```text +aien-runtime + no unrestricted external effects + │ + │ authorized typed UDS/QUIC + ▼ +aien-effect-broker + │ + ▼ +external systems +``` + +The broker is small enough to audit aggressively. + +--- + +## 17.2 Effect types + +```rust +pub enum ExternalEffect { + SendMessage, + PublishGit, + Deploy, + Purchase, + DeleteRemoteResource, + ModifyExternalRecord, +} +``` + +Local reversible operations can remain World-local. + +--- + +## 17.3 Typestate + +```text +EffectIntent + ↓ +CheckedEffect + ↓ +AuthorizedEffect + ↓ +ExecutedEffect + ↓ +CommittedEffect +``` + +An SMTP or Git-push implementation should accept only `AuthorizedEffect`. + +--- + +# 18. World Architecture + +## 18.1 Purpose + +World = branchable, transactional execution state. + +A World references: + +- object root, +- filesystem root, +- token root, +- memory view, +- capability set, +- effect intents, +- lineage. + +--- + +## 18.2 Target World commit + +```rust +pub struct WorldCommit { + pub world: WorldId, + pub parent: Option, + pub sequence_number: u64, + + pub object_root: Digest32, + pub filesystem_root: Digest32, + pub token_root: Digest32, + pub memory_root: Digest32, + + pub effects_root: Digest32, + pub evidence_root: Digest32, + + pub model_digest: Digest32, + pub tokenizer_digest: Digest32, + pub policy_digest: Digest32, + pub runtime_build_digest: Digest32, + + pub jspace_decision: Option, + + pub signer: SignerIdentity, + pub signature: Signature, +} +``` + +--- + +# 19. Signed Provenance + +## 19.1 Reuse existing AIEN protocol code + +AIEN already has: + +- P-256 signers, +- TPM signer concepts, +- evaluation receipts, +- Merkle roots. + +Do not create a second unrelated format. + +--- + +## 19.2 DSSE/in-toto-compatible envelope + +Borrow the DSSE principle: + +- authenticate payload type, +- authenticate payload bytes, +- avoid fragile canonicalization assumptions, +- allow multiple signatures. + +This improves interoperability with broader provenance tooling. + +--- + +## 19.3 Do not hardware-sign every event + +Use: + +1. short-lived in-memory session signer, +2. Merkle-batched commits, +3. periodic hardware-rooted checkpoint. + +```mermaid +flowchart TD + R1[Receipt 1] --> M[Merkle Root] + R2[Receipt 2] --> M + R3[Receipt 3] --> M + RN[Receipt N] --> M + M --> H[Hardware Anchor] +``` + +This avoids making hardware signing the latency bottleneck. + +--- + +# 20. Cortex Memory Integration + +## 20.1 Memory planes + +Recommended memory layers: + +### Working memory +Current sequence / World-local state. + +### Episodic memory +Sessions, actions, outcomes, failures. + +### Semantic memory +Entities, claims, stable facts. + +### Procedural memory +Skill routing outcomes, successful plans, reusable tactics. + +### Provenance memory +Evidence and signed receipts. + +--- + +## 20.2 Memory flow + +```mermaid +flowchart LR + E[Execution] --> EV[Events] + EV --> C[Cortex Ingress] + C --> EP[Episodic] + C --> SM[Semantic] + C --> PM[Procedural] + C --> PR[Provenance] + + EP --> R[Recall] + SM --> R + PM --> R + PR --> R + + R --> RT[Runtime Context] +``` + +--- + +# 21. Durable Workflows + +Some AIEN tasks may last minutes, hours, or days. + +Temporal demonstrates the value of durable execution that resumes after process/network failure. + +AIEN does not have to embed Temporal itself, especially if the objective is a compact local Rust stack. + +But it should adopt the same key pattern: + +```text +workflow state ++ deterministic transition ++ append-only event log ++ replay ++ idempotent activity +``` + +The Harness already moves in this direction. + +Recommended new core: + +```rust +pub trait DurableWorkflow { + type State; + type Event; + + fn apply(state: &mut Self::State, event: &Self::Event); +} +``` + +All irreversible activities emit receipts and can be re-associated during replay. + +--- + +# 22. Plugin and Third-Party Tool Isolation + +Native Rust tools are fastest, but third-party extensions cannot all be trusted. + +Use Wasmtime/WASI Component Model as an optional sandboxed plugin class. + +Why: + +- portable, +- cross-language, +- explicit imports/exports, +- restricted filesystem/network capabilities, +- embeddable in Rust. + +Architecture: + +```text +Tool package + ↓ +trusted native? + ├── yes -> NativeToolExecutor + └── no -> WASM Component Executor + ↓ + capability grants +``` + +MCP tools and process tools should also execute under explicit capability restrictions. + +--- + +# 23. Observability + +Adopt OpenTelemetry concepts rather than inventing unrelated metric names. + +AIEN should emit: + +- traces, +- metrics, +- structured events, +- profiling data. + +Key dimensions: + +```text +machine.id +world.id +sequence.id +jspace.id +jnode.id +skill.id +tool.id +model.digest +accelerator.class +effect.class +policy.decision +``` + +Never record sensitive prompt/tool content by default. + +Content logging must be opt-in. + +--- + +# 24. RSI Integration + +RSI should consume telemetry and benchmark evidence. + +```mermaid +flowchart LR + T[Telemetry] --> RSI[RSI] + B[Benchmarks] --> RSI + C[Cortex Lessons] --> RSI + + RSI --> H[Hypothesis] + H --> CA[Candidate Artifact] + CA --> E[Evaluators] + E --> CR[Canary] + CR -->|pass| P[Promote] + CR -->|fail| RB[Rollback] +``` + +RSI may optimize: + +- skill retrieval, +- scheduling, +- placement, +- batch widths, +- J-Space pruning thresholds, +- kernel plans, +- model quantization choice, +- cache policy. + +--- + +# 25. Market Gap Analysis + +The market contains strong products for individual layers, but the combination AIEN is targeting remains unusual. + +## Gap 1: Universal heterogeneous AI fabric + +### Existing approaches + +- Exo: automatic device discovery and heterogeneous local model partitioning. +- llama.cpp RPC: exposes remote compute devices and distributes model/KV state. +- MLX distributed: serious multi-machine communication including low-latency interconnects. +- Ray/Dask: mature heterogeneous resource scheduling. + +### What they solve + +They prove that: + +- heterogeneous local clusters are practical, +- resource-aware scheduling works, +- remote accelerators can contribute, +- topology matters. + +### Remaining market gap + +A local fabric that combines: + +- inference, +- agent branches, +- tools, +- skills, +- state Worlds, +- safety policy, +- provenance, +- memory, +- and self-improvement + +under one typed runtime. + +### AIEN implementation + +Build `aien-fabric` in Rust. + +Start with coarse-grained work: + +- J-Space branches, +- tool execution, +- model replicas. + +Add tensor/model sharding only after topology metrics prove it is worthwhile. + +--- + +## Gap 2: Skill routing at very large capability counts + +### Existing approaches + +Agent frameworks typically expose tool lists and workflows. + +MCP standardizes tool discovery. + +Research now demonstrates semantic retrieval for large MCP tool catalogs. + +### Remaining gap + +A router that combines: + +- semantic relevance, +- hard capability requirements, +- current Machine availability, +- AEGIS policy, +- secrets availability, +- historical success, +- model requirements, +- latency and cost. + +### AIEN implementation + +Build `aien-capability` + `aien-skill-router`. + +Use multi-stage routing: + +1. deterministic alias, +2. metadata, +3. lexical, +4. embedding, +5. small router model, +6. J-Space. + +This is a real differentiator because routing is tied to execution reality, not just textual similarity. + +--- + +## Gap 3: Secure MCP as a capability adapter + +### Existing approaches + +The official Rust MCP SDK supports current MCP client/server behavior and authentication features. + +### AIEN current state + +Two hand-written Rust MCP servers already exist. + +### Remaining gap + +A single broker where: + +- MCP tools become AIEN capabilities, +- credentials remain vault handles, +- AEGIS gates calls, +- Fabric can place calls, +- World/provenance wraps results. + +### AIEN implementation + +Build `aien-mcp` around `rmcp`. + +Retire duplicate protocol loops after migration. + +--- + +## Gap 4: Portable accelerator runtime without CUDA-shaped architecture + +### Existing approaches + +- Mojo provides portable accelerator programming across supported GPU families. +- IREE/Vulkan provides broad vendor/OS coverage. +- llama.cpp/ggml supports many hardware backends. + +### Remaining gap + +A branch-native agent runtime whose core scheduler/KV/World logic is hardware-independent while high-performance kernels remain portable. + +### AIEN implementation + +Rust control plane + Mojo kernels + optimized CPU. + +IREE/Vulkan can be evaluated later for unsupported accelerator classes. + +No mandatory CUDA build dependency. + +--- + +## Gap 5: Branch-native test-time search with executable state + +### Existing approaches + +Research on test-time scaling shows value from: + +- candidate sampling, +- verification, +- search over partial states, +- inference-time verification. + +Inference servers already implement prefix reuse. + +### Remaining gap + +Most systems treat candidates as text completions. + +AIEN can treat them as: + +```text +Sequence ++ World ++ memory view ++ tool plan ++ evidence ++ policy state +``` + +### AIEN implementation + +Build J-Space as first-class typed state. + +This may be AIEN's strongest technical differentiator. + +--- + +## Gap 6: Effect-aware agent transactions + +### Existing approaches + +Agent SDKs increasingly include sandboxes and tool controls. + +Authorization engines such as Cedar provide policy decisions. + +### Remaining gap + +A local agent runtime in which: + +- speculative branches do not leak effects, +- external actions require typed authorization, +- the effect boundary is non-bypassable, +- the resulting World commit is signed. + +### AIEN implementation + +`aien-effect-broker` + AEGIS + World commits. + +--- + +## Gap 7: Signed, branch-aware agent provenance + +### Existing approaches + +in-toto/DSSE provides strong supply-chain attestation patterns. + +### Remaining gap + +Runtime provenance spanning: + +```text +model +→ reasoning branch +→ tools +→ external effect +→ World transition +→ memory +``` + +### AIEN implementation + +Extend current `aien-provenance` and evaluation receipts into World Commit attestations. + +--- + +## Gap 8: Local self-improvement that is actually gated + +### Existing approaches + +Auto-tuning and agent optimization exist, but safe autonomous promotion remains difficult. + +### AIEN current advantage + +RSI already has: + +- judge, +- canary, +- rollback, +- signed evaluation. + +### Remaining gap + +Connect it to the full runtime telemetry and signed World evidence without letting RSI mutate the hot path directly. + +--- + +# 26. Competitive Positioning + +AIEN should not try to win by saying: + +> another agent framework + +or: + +> another inference server + +or: + +> another MCP host + +Those categories are crowded. + +A more defensible technical category is: + +> **A universal branch-native AI runtime that turns multiple Machines into one capability-aware local AI system.** + +The differentiation stack is: + +```text +heterogeneous Fabric + + +portable inference + + +branch-native KV + + +World transactions + + +J-Space search + + +Capability Graph + + +skill routing + + +MCP compatibility + + +AEGIS effect safety + + +signed provenance + + +Cortex memory + + +RSI optimization +``` + +The combination matters more than any individual feature. + +--- + +# 27. Proposed Core Types + +```rust +pub struct MachineId(pub [u8; 16]); +pub struct WorldId(pub u64); +pub struct SequenceId(pub u64); +pub struct JSpaceId(pub u64); +pub struct JNodeId(pub u64); +pub struct SkillId(pub Digest32); +pub struct ToolId(pub Digest32); +pub struct ModelDigest(pub Digest32); +pub struct ReceiptId(pub Digest32); +``` + +Everything crossing process or Machine boundaries should use stable typed IDs. + +--- + +# 28. Suggested Crate Responsibilities + +## `aien-capability` + +Owns: + +- tool/skill descriptors, +- capability IDs, +- schemas, +- requirements, +- effect classes. + +Does not execute. + +--- + +## `aien-skill-router` + +Owns: + +- indexes, +- retrieval, +- ranking, +- constraint filtering, +- routing telemetry. + +Does not perform effects. + +--- + +## `aien-tool-runtime` + +Owns: + +- native Rust executor, +- WASM executor, +- process adapter, +- HTTP adapter. + +Does not authorize. + +--- + +## `aien-mcp` + +Owns: + +- MCP client/server, +- transport, +- schema translation, +- auth negotiation, +- broker. + +Does not own secrets. + +--- + +## `aien-vault` + +Owns: + +- secret references, +- vault access, +- short-lived secret leases, +- redaction. + +Does not expose arbitrary secret strings to models. + +--- + +## `aien-policy` + +Owns: + +- deterministic invariants, +- Cedar policies, +- probe integration, +- approval requirements. + +--- + +## `aien-effect-broker` + +Owns: + +- irreversible external side effects. + +Small, heavily audited process. + +--- + +## `aien-fabric` + +Owns: + +- membership, +- node identity, +- topology, +- capability advertisement, +- task placement, +- leases, +- failover. + +--- + +## `aien-jspace` + +Owns: + +- candidate branches, +- evaluation, +- Pareto pruning, +- judges, +- branch lifecycle. + +--- + +## `aien-world` + +Owns: + +- branchable transactional state, +- commits, +- lineage, +- rollback roots. + +--- + +# 29. Detailed Implementation Plan + +## Phase 0: Establish invariants + +Before new features: + +1. Declare hardware-neutral interfaces. +2. Declare Tool vs Skill semantics. +3. Declare World vs Cortex vs J-Space separation. +4. Declare vault-only production secrets. +5. Declare that external effects cannot bypass the broker. +6. Declare stable protocol types. + +Acceptance: + +- architecture tests compile without any vendor-specific type in core scheduler APIs. + +--- + +## Phase 1: Capability Graph + +Build: + +```text +aien-capability +aien-skill-router +``` + +Migrate AEGIS `SkillRegistry` definitions into Tool descriptors. + +Keep adapters so existing calls continue working. + +Acceptance: + +- 1,000 synthetic tools indexed. +- routing returns top 5. +- impossible capabilities filtered before model use. +- tool definitions never all enter the context. + +--- + +## Phase 2: Canonical MCP broker + +Build `aien-mcp` with `rmcp`. + +Import existing: + +- debugger MCP tools, +- harness MCP tools. + +Acceptance: + +- stdio server works. +- stdio client works. +- Streamable HTTP works. +- tools/resources/prompts map into Capability Graph. +- MCP server failure cannot crash runtime. +- credentials are references, not config secrets. + +--- + +## Phase 3: Vault-only production mode + +Refactor: + +```rust +VaultResolver +``` + +to explicit policy. + +Acceptance: + +- production test fails when secret exists only in environment. +- logs never contain resolved value. +- model/tool schemas never contain resolved value. +- secret lease expires/zeroizes where practical. + +--- + +## Phase 4: Effect Broker + +Move mail first. + +Then Git publish. + +Add mock driver for golden-path tests. + +Acceptance: + +- runtime process cannot execute test external effect directly. +- denied action yields zero broker driver calls. +- allowed action yields one receipt. +- receipt becomes part of World commit. + +--- + +## Phase 5: Signed World commits + +Extend `aien-provenance`. + +Acceptance: + +- every committed external effect has: + - parent World, + - effect root, + - policy digest, + - runtime build digest, + - signer identity. +- verification detects tampering. + +--- + +## Phase 6: Model Capsule + portable weight ABI + +Replace production `Vec` weight ownership. + +Build: + +- typed tensor views, +- quantized storage, +- mmap/chunk loading, +- capsule manifest. + +Acceptance: + +- large model does not expand all weights to FP32. +- model startup is deterministic and fingerprinted. +- same capsule works across at least CPU and one accelerator implementation. + +--- + +## Phase 7: Portable accelerator + +Build/finish: + +- optimized CPU kernels, +- Mojo batch kernels, +- paged attention, +- quantized matmul, +- sampling. + +Retain old accelerator path only as comparison until parity/performance is proven. + +Acceptance: + +- no mandatory CUDA toolkit dependency. +- CPU path passes oracle tests. +- Mojo path passes parity. +- unsupported hardware fails clearly or uses CPU. + +--- + +## Phase 8: `aien-node` + Fabric + +Build: + +- Machine identity, +- mDNS discovery, +- QUIC control transport, +- capability advertisement, +- topology probes, +- work leases. + +Acceptance: + +- Machine 2 can join Machine 1 automatically. +- Machine 2 disappears; work lease expires and reschedules. +- all control traffic is mutually authenticated. + +--- + +## Phase 9: Distributed branch execution + +Before distributed tensor parallelism, dispatch J-Space branches. + +Acceptance: + +```text +Machine 1 creates 4 candidate branches. +Machine 2 executes branch 2. +Machine 3 executes branch 3. +All results return with signed evidence. +Judge chooses winner. +Non-winning Worlds are reclaimed. +``` + +--- + +## Phase 10: J-Space + +Build first version using meaningful decision boundaries, not token-by-token MCTS. + +Acceptance: + +- branch candidate state references World/Sequence IDs rather than cloning. +- cheap filters remove invalid branches. +- judge outcome is reproducible. +- effects cannot occur on speculative branches. +- winner can commit atomically. + +--- + +## Phase 11: Content-addressed model distribution + +Chunk Model Capsules. + +Acceptance: + +- second Machine only downloads missing chunks. +- chunks verify by digest. +- corrupted chunk is rejected. +- model cache survives restart. + +--- + +## Phase 12: Fine-grained distributed inference + +Only now investigate: + +- layer pipeline parallelism, +- tensor parallelism, +- speculative cross-Machine decode, +- RDMA. + +Enable only where measured topology predicts a gain. + +--- + +# 30. Benchmark Plan + +AIEN needs metrics that measure the system it is actually trying to build. + +## Inference + +- prompt tokens/sec +- decode tokens/sec +- TTFT +- inter-token latency +- GPU/accelerator utilization +- memory amplification +- KV bytes copied +- prefix reuse ratio + +## J-Space + +- candidates/sec +- time-to-best-valid-answer +- branches explored +- branches pruned +- verifier latency +- winner quality +- KV sharing ratio +- memory per branch + +## Fabric + +- discovery time +- Machine join latency +- control RTT +- bandwidth +- failover latency +- work migration time +- model chunk reuse +- scheduler placement quality + +## Skills/tools + +- routing latency +- top-k hit rate +- tool schema token count +- task success rate +- wrong-tool rate +- policy-denial rate + +## Provenance/security + +- signing overhead +- verification overhead +- broker overhead +- policy latency +- bypass tests +- secret exposure tests + +--- + +# 31. Golden Path + +The final release gate should prove: + +```mermaid +flowchart TD + U[User request] --> SR[Skill Router] + SR --> JS[J-Space] + JS --> F[Fabric] + F --> M[Selected Machine] + M --> INF[Native Inference] + INF --> TC[Tool Call] + TC --> A[AEGIS] + A --> EB[Effect Broker] + EB --> W[World Commit] + W --> P[Signed Provenance] + P --> C[Cortex] + C --> UO[Streamed User Output] +``` + +The golden path must use: + +- real model, +- real tokenizer, +- real routing, +- real policy, +- real effect boundary, +- real receipt, +- real World commit, +- real Cortex recall/store, +- no simulated bypass assertions. + +--- + +# 32. Failure Model + +AIEN must expect: + +- Machine departure, +- network partition, +- model unavailable, +- tool provider unavailable, +- MCP server crash, +- secret unavailable, +- policy denial, +- judge disagreement, +- stale World, +- duplicate operation, +- corrupted model chunk, +- accelerator fallback, +- verifier failure. + +Every subsystem must have explicit behavior for these cases. + +--- + +# 33. Machine Failure Recovery + +A remote branch should be reconstructible from: + +```text +model digest ++ token lineage ++ World root ++ memory view ++ tool/evidence refs +``` + +Do not require remote RAM contents to survive. + +Use leases: + +```rust +pub struct WorkLease { + pub task: TaskId, + pub machine: MachineId, + pub expires_at: Timestamp, + pub attempt: u32, +} +``` + +Expired work can be rescheduled. + +External effects use idempotency keys and must never be blindly replayed. + +--- + +# 34. What Not to Build + +Avoid the following: + +## Distributed shared memory + +Do not pretend network RAM is local RAM. + +## One giant “AIEN database” + +Do not merge World, Cortex, J-Space, tools, and telemetry into one table system. + +## All-tools-in-prompt + +Do not put thousands of tool schemas into context. + +## Model-owned secrets + +Do not expose raw API credentials to prompts or model-visible tool arguments. + +## Direct effects from speculative branches + +Only winning, authorized transactions may externalize. + +## Hardware-vendor logic in the core scheduler + +Hardware is capability metadata. + +## Hand-maintaining the entire MCP protocol + +Use the official Rust SDK. + +## Fine-grained distributed inference over poor networks + +Prefer branch-level work unless topology supports finer partitioning. + +--- + +# 35. Recommended Technology Adoption Matrix + +| Need | Adopt / Study | AIEN Role | +|---|---|---| +| MCP protocol | official Rust `rmcp` | compatibility broker | +| Fine-grained authorization | Cedar | policy engine under AEGIS | +| Workload identity concepts | SPIFFE/SPIRE | Fabric identity design | +| QUIC | Quinn | initial Fabric transport | +| P2P/content distribution | Iroh concepts | later model chunk distribution | +| Sandboxed plugins | Wasmtime/WASI | third-party tool runtime | +| Broad GPU fallback | IREE/Vulkan | optional later backend | +| Local distributed inference patterns | Exo, llama.cpp RPC, MLX | topology/partitioning prior art | +| General resource scheduling | Ray/Dask patterns | scheduling prior art, not runtime dependency | +| Durable execution | Temporal patterns | event/replay semantics | +| Provenance envelope | in-toto/DSSE | signed World envelope compatibility | +| Observability | OpenTelemetry | trace/metric semantics | + +--- + +# 36. What AIEN Should Build Itself + +The following are core differentiators and should not be outsourced wholesale: + +1. **World abstraction** +2. **J-Space** +3. **branch-native Sequence/KV lifecycle** +4. **Capability Graph** +5. **Skill Router** +6. **AIEN Fabric scheduling semantics** +7. **effect transaction model** +8. **World-integrated provenance** +9. **Cortex/World/J-Space integration** +10. **RSI optimization loop** + +Use external libraries for protocols and primitives. + +Own the AIEN semantics. + +--- + +# 37. Flagship Technical Story + +A compelling demonstration of the complete architecture would be: + +```text +1. Machine 1 starts AIEN. +2. Machine 2 joins. +3. Machine 3 joins. +4. Capability Graph updates automatically. +5. A user asks AIEN to solve a complex task. +6. J-Space generates multiple strategies. +7. Branches execute on different Machines. +8. One Machine runs a platform-specific tool unavailable elsewhere. +9. An MCP tool is dynamically routed through the broker. +10. No model sees a raw secret. +11. AEGIS blocks one unsafe branch. +12. The judge selects the best valid branch. +13. The Effect Broker performs the approved external action. +14. A signed World commit proves the result. +15. Cortex stores the lesson. +16. RSI records whether the routing/placement could be improved. +17. One Machine disconnects. +18. AIEN continues running. +``` + +That demonstration communicates the architecture much better than a synthetic chat benchmark. + +--- + +# 38. Short Architecture Reference + +```text +USER / API + ↓ +CONTROL PLANE + ↓ +RUNTIME + ↓ +J-SPACE + ↓ +SKILL ROUTER + ↓ +CAPABILITY GRAPH + ↓ +FABRIC SCHEDULER + ↓ +MACHINE 1 / MACHINE 2 / MACHINE 3 / ... + ↓ +TOOL / MODEL / VERIFIER EXECUTION + ↓ +AEGIS + ↓ +EFFECT BROKER + ↓ +WORLD COMMIT + ↓ +SIGNED PROVENANCE + ↓ +CORTEX + ↓ +RSI / BENCHMARK FEEDBACK +``` + +--- + +# 39. Priority Order + +If the goal is to maximize architectural leverage, build in this order: + +1. **Capability ABI** +2. **Skill Router** +3. **Canonical Rust MCP broker** +4. **Vault-only production secret policy** +5. **Effect Broker** +6. **Signed World Commit** +7. **Model Capsule / typed weight ABI** +8. **Portable accelerator interface** +9. **aien-node / Fabric** +10. **distributed branch execution** +11. **J-Space** +12. **content-addressed model distribution** +13. **fine-grained distributed inference** +14. **RSI optimization across all of the above** + +This ordering creates useful product value at every stage. + +--- + +# 40. Gap Summary + +## Already strong + +- native Rust runtime +- scheduler +- branchable inference state +- KV sharing +- streaming +- Cortex +- AEGIS +- evaluation/provenance primitives +- RSI canary/rollback +- Rust MCP proofs +- benchmark culture + +## Partial / fragmented + +- MCP +- skills/tools +- secrets +- effect gating +- provenance +- model loading +- hardware abstraction +- operator composition + +## Missing or not yet first-class + +- Capability Graph +- Skill Router +- Fabric +- Machine identity and placement +- Model Capsule +- portable accelerator contract +- signed World commits +- non-bypassable Effect Broker +- J-Space +- distributed branch execution +- content-addressed model distribution +- one canonical observability schema + +--- + +# 41. Final Architectural Definition + +AIEN should ultimately be understood as: + +> **A universal, branch-native AI runtime that treats models, tools, skills, memory, machines, and accelerators as discoverable capabilities inside one secure local compute fabric. It can explore multiple Worlds in parallel, judge them in J-Space, execute approved effects through a non-bypassable policy boundary, prove resulting state transitions cryptographically, remember useful outcomes in Cortex, and improve its own routing and execution through gated RSI.** + +The most important implementation discipline is to keep these responsibilities separate: + +```text +Model → proposes +J-Space → compares +Skill → describes procedure +Tool → performs atomic operation +Router → finds capability +Fabric → finds Machine +AEGIS → authorizes +Broker → performs effect +World → records state +Provenance → proves +Cortex → remembers +RSI → improves +``` + +That separation is the architecture. + +--- + +# 42. Research Sources and Prior Art + +The following current sources informed the gap analysis and implementation choices. + +## AIEN repositories + +- Sovereign Manifesto: https://github.com/aien-dev/open-humanity/blob/main/docs/SOVEREIGN_MANIFESTO.md + +- https://github.com/aien-dev/aien-sovereign-core +- https://github.com/aien-dev/aien-protocols +- https://github.com/aien-dev/aegis-runtime +- https://github.com/aien-dev/cortex-rs +- https://github.com/aien-dev/spark-rsi +- https://github.com/aien-dev/spark-debugger +- https://github.com/aien-dev/aien-harness +- https://github.com/aien-dev/spark-inquisitor +- https://github.com/aien-dev/spark-hive +- https://github.com/aien-dev/benchmarks +- https://github.com/aien-dev/aien-local-stack + +## Distributed compute and inference + +- Exo: https://github.com/exo-explore/exo +- llama.cpp RPC: https://github.com/ggml-org/llama.cpp/blob/master/tools/rpc/README.md +- MLX distributed: https://github.com/ml-explore/mlx/blob/main/docs/src/usage/distributed.rst +- Ray scheduling: https://docs.ray.io/en/latest/ray-core/scheduling/ +- Dask distributed: https://distributed.dask.org/ + +## Portable execution + +- IREE Vulkan: https://iree.dev/guides/deployment-configurations/gpu-vulkan/ +- Wasmtime: https://docs.wasmtime.dev/ +- Wasmtime Component Model: https://docs.wasmtime.dev/api/wasmtime/component/ + +## MCP + +- MCP organization: https://github.com/modelcontextprotocol +- Official Rust SDK: https://github.com/modelcontextprotocol/rust-sdk +- Rust SDK docs: https://rust.sdk.modelcontextprotocol.io/ + +## Authorization and identity + +- Cedar: https://github.com/cedar-policy/cedar +- Cedar docs: https://docs.cedarpolicy.com/ +- SPIFFE/SPIRE: https://spiffe.io/ + +## Provenance + +- in-toto Attestation: https://github.com/in-toto/attestation +- DSSE envelope concepts: https://github.com/in-toto/attestation/blob/main/spec/v1/envelope.md + +## Observability + +- OpenTelemetry semantic conventions: https://opentelemetry.io/docs/specs/semconv/ +- OpenTelemetry GenAI observability: https://opentelemetry.io/blog/2026/genai-observability/ + +## Tool routing and test-time scaling + +- Semantic MCP tool discovery: https://arxiv.org/abs/2603.20313 +- Test-time scaling survey: https://arxiv.org/abs/2608.04001 +- Inference-time verification: https://arxiv.org/abs/2601.15808 + +## Durable execution + +- Temporal: https://docs.temporal.io/ + +--- + +# 43. Immediate Next Engineering Ticket Set + +For implementation agents, the following tickets are concrete enough to start. + +## Ticket A: `aien-capability` + +Create canonical Tool and Skill descriptors. + +Deliver: + +- typed IDs, +- schemas, +- effect classes, +- resource requirements, +- version/digest semantics, +- serialization tests. + +--- + +## Ticket B: `aien-skill-router` + +Deliver: + +- deterministic alias lookup, +- tags/lexical index, +- semantic index interface, +- hard constraint filter, +- top-k output, +- routing receipts. + +Benchmark 1,000 / 10,000 capability catalogs. + +--- + +## Ticket C: `aien-mcp` + +Use `rmcp`. + +Deliver: + +- client, +- server, +- stdio, +- Streamable HTTP, +- mapping to ToolDescriptor, +- import existing Debugger/Harness MCP tools. + +--- + +## Ticket D: `aien-vault` + +Deliver production `VaultOnly`. + +Remove implicit environment fallback from production. + +Return `CredentialRef`, not secrets, to callers above broker level. + +--- + +## Ticket E: `aien-effect-broker` + +Move mail first. + +Then Git publish. + +Add mock driver for golden-path tests. + +--- + +## Ticket F: Signed World Commit v1 + +Extend `aien-provenance`. + +Use Merkle roots and existing signer interfaces. + +--- + +## Ticket G: Model Capsule v1 + +Support: + +- TinyLlama for oracle, +- one useful long-context model family, +- typed BF16/quantized tensor views, +- tokenizer/template digest, +- no FP32 expansion in production. + +--- + +## Ticket H: Portable Accelerator v1 + +Deliver: + +- CPU backend, +- Mojo backend, +- backend parity suite, +- no mandatory CUDA build dependency. + +--- + +## Ticket I: Fabric v1 + +Deliver: + +- `aien-node`, +- Machine IDs, +- mDNS discovery, +- QUIC connection, +- identity, +- capability advertisement, +- topology metrics. + +--- + +## Ticket J: Distributed J-Space prototype + +Deliver: + +- root candidate, +- 3 branches, +- dispatch to multiple Machines, +- cheap verifier, +- winning World commit, +- losing branch cleanup. + +This single prototype will test almost every major architectural boundary. + +--- + +# 44. Closing Rule + +Whenever a new subsystem is proposed, ask: + +1. Is this **state**, **memory**, **planning**, **capability**, **placement**, **policy**, **effect**, or **evidence**? +2. Which existing subsystem already owns that responsibility? +3. Can it be represented as a typed protocol instead of a new daemon? +4. Can it execute on any Machine? +5. Can it fail without corrupting the logical AIEN system? +6. Can its effects be rolled back or proven? +7. Does it improve the end-to-end system, or merely add another layer? + +If those questions remain explicit, AIEN can grow to a very large system without becoming an unmaintainable collection of overlapping agents and services. diff --git a/docs/archive/plans/2026-09-25/14-master-architectural-plan.md b/docs/archive/plans/2026-09-25/14-master-architectural-plan.md new file mode 100644 index 0000000..b0d2dcc --- /dev/null +++ b/docs/archive/plans/2026-09-25/14-master-architectural-plan.md @@ -0,0 +1,1687 @@ +> **SUPERSEDED / HISTORICAL — DO NOT USE AS AN ACTIVE IMPLEMENTATION PLAN** +> +> Original path: `docs/14-master-architectural-plan.md` +> +> Archived on 2026-09-27 during plan consolidation. The active cross-project execution plan is [CURRENT_EXECUTION_PLAN.md](../../../CURRENT_EXECUTION_PLAN.md), governed by [PLAN_AUTHORITY.md](../../../PLAN_AUTHORITY.md). +> +> Retained for provenance only. + +--- + +# AIEN Master Architectural Plan + +## 1. North Star + +AIEN exists to reduce the distance between human intention and physical reality. + +The ultimate system should allow a person to describe a desired outcome, then have AIEN determine what must change, what it is permitted to change, how that change can be accomplished, which physical realization is appropriate, whether the result actually occurred, and what can be learned from it. + +The long-term execution path is: + +```text +Human Intent + ↓ +Desired State + ↓ +Formal Transformation + ↓ +Constraints + Authority + ↓ +Candidate Futures + ↓ +Verification + Evaluation + ↓ +Authorization + ↓ +Physical Realization + ↓ +Physics + ↓ +Observed Reality + ↓ +Evidence + ↓ +Memory + Improvement +``` + +The concise definition is: + +> **AIEN compiles desired state into authorized, verified physical transformation.** + +The completed system is not fundamentally an operating system, AI model, programming language, CPU architecture, or robot. + +Those are components and physical realizations. + +--- + +## 2. The Permanent Architectural Rule + +No implementation layer below intent should become the permanent definition of AIEN. + +Therefore: + +```text +Rust != AIEN +AArch64 != AIEN +x86 != AIEN +RISC-V != AIEN +binary != AIEN +CUDA != AIEN +NVIDIA != AIEN +Linux != AIEN +a model != AIEN +a CPU != AIEN +``` + +Today AIEN is implemented primarily through Rust and AArch64 because those are useful engineering choices. + +They are not the final abstraction. + +The durable object should eventually describe: + +```text +What should become true? +What transformation produces it? +What constraints apply? +What authority is required? +What evidence proves success? +``` + +Everything below that may evolve. + +--- + +## 3. The Seven-Layer Architecture + +The whole system can be understood as seven architectural layers. + +```text +┌──────────────────────────────────────┐ +│ 7. HUMAN INTENT │ +│ "What do I want?" │ +├──────────────────────────────────────┤ +│ 6. SEMANTIC / DESIRED STATE │ +│ "What exactly must become true?" │ +├──────────────────────────────────────┤ +│ 5. INTELLIGENCE │ +│ Agent, Cortex, J-Space, Skills │ +├──────────────────────────────────────┤ +│ 4. AUTHORITY │ +│ Capabilities, AEGIS, Effects │ +├──────────────────────────────────────┤ +│ 3. TRANSFORMATION │ +│ Artifact IR, Transformation IR │ +├──────────────────────────────────────┤ +│ 2. PHYSICAL COMPILATION │ +│ Physical Compiler + Fabric │ +├──────────────────────────────────────┤ +│ 1. PHYSICAL SUBSTRATE │ +│ CPU/GPU/FPGA/waves/analog/etc. │ +└──────────────────────────────────────┘ + ↓ + PHYSICS +``` + +Each layer has one job. + +No layer should secretly absorb the responsibilities of another. + +--- + +## 4. Layer 1: The Trusted Physical Substrate + +This is what AIENOS is currently establishing. + +Its job is not intelligence. + +Its job is control. + +The kernel must provide deterministic mechanisms for: + +```text +boot +memory ownership +address spaces +tasks +scheduling +interrupts +IPC +capabilities +device ownership +DMA confinement +storage +networking +time +recovery +``` + +The model is never the kernel. + +The kernel must continue functioning with no model loaded. + +Its fundamental guarantee is: + +> A component can affect only the memory, objects and devices for which it has explicit authority. + +The trusted base should remain small, inspectable and recoverable. + +### Current engineering anchor + +The current development line is closing the M3 enforcement substrate: + +```text +EL1 kernel +↓ +AIENOS-owned MMU +↓ +interrupt ownership +↓ +preemptive scheduler +↓ +EL0 isolation +↓ +capability tables +↓ +typed IPC +↓ +SMMUv3 DMA confinement +↓ +device authority +``` + +This layer must become trustworthy before significant generated native code is admitted. + +--- + +## 5. Layer 2: The Physical Fabric + +Above individual drivers sits the abstraction AIEN uses to understand its body. + +A Machine should not simply be described as: + +```text +"NVIDIA DGX Spark" +``` + +It should expose capabilities. + +Conceptually: + +```text +PhysicalCapabilities { + compute + memory + storage + communication + devices + timing + precision + topology + energy + temperature + reconfiguration + failure_properties +} +``` + +Upper AIEN layers should increasingly ask: + +```text +Who can perform this transformation? +``` + +rather than: + +```text +Where is the NVIDIA GPU? +``` + +The same abstraction can eventually represent: + +```text +CPU +GPU +FPGA +specialized accelerator +another Machine +wave network +analog array +optical device +future computing substrate +``` + +Machine 1 is the first physical body. + +It is not AIEN's permanent body. + +--- + +## 6. Layer 3: Canonical Executable Artifacts + +Before AIEN becomes hardware-neutral, it needs a clean executable identity system. + +This is the bridge between today's software and tomorrow's Transformation IR. + +### Binary Artifact + +An AIEN Artifact should describe: + +```text +identity +exact executable bytes +ABI version +target +resource requirements +requested capabilities +declared effects +ancestry +evidence +admission +``` + +The central invariant is: + +```text +tested bytes + == +evaluated bytes + == +authorized bytes + == +executed bytes +``` + +The source code that produced an artifact is important provenance. + +It is not the executable identity. + +Artifacts are: + +```text +immutable +content-addressed +versioned +signed where appropriate +reproducibly evaluated +``` + +This becomes the basis for AIEN Generations. + +--- + +## 7. Generations and Self-Construction + +AIEN should grow through explicit Generations. + +```text +Generation 0 + ↓ +Generation 1 + ↓ +Generation 2 + ↓ +Generation N +``` + +An agent may propose a new Generation. + +It may not authorize it. + +The pipeline is: + +```text +Observe + ↓ +Propose + ↓ +Build + ↓ +Verify + ↓ +Isolated test + ↓ +Benchmark + ↓ +J-Space comparison + ↓ +AEGIS admission + ↓ +Canary + ↓ +Promote +``` + +Failure results in: + +```text +quarantine +↓ +rollback +↓ +preserve evidence +↓ +diagnose separately +``` + +The governing rule is: + +> **Rollback first, repair second.** + +AIEN never rewrites its trusted running kernel merely because a model believes an improvement is good. + +--- + +## 8. Layer 4: Authority + +The most important distinction in AIEN is: + +```text +intelligence +≠ +authority +``` + +The model may understand what should happen. + +That does not mean it has permission to make it happen. + +The canonical effect path is: + +```text +Agent + ↓ proposes +EffectIntent + ↓ +Capability check + ↓ +AEGIS + ↓ +Effect Broker + ↓ +Kernel / driver + ↓ +physical effect +``` + +### Capabilities + +Authority should be explicit and scoped. + +Examples: + +```text +audio.output +network.local +storage.project.read +device.camera.capture +mail.send +fabric.compute +world.promote +physical.motor.move +``` + +A capability answers: + +```text +WHO +may do WHAT +to WHICH resource +under WHICH bounds +``` + +No ambient root authority. + +--- + +## 9. AEGIS + +AEGIS is the authority boundary between intelligence and reality. + +Its job is to determine whether a proposed effect is permitted. + +It should understand: + +```text +principal +capability +scope +effect type +reversibility +resource bounds +operator policy +risk +provenance +``` + +Broadly: + +```text +reversible internal change + ↓ +can often proceed autonomously + +irreversible/external effect + ↓ +requires stronger authority +``` + +At the deepest future level, AEGIS still exists. + +If AIEN is configuring actual physical circuits, waves, power systems or machines, those are effects too. + +The Physical Compiler never gets to bypass AEGIS. + +--- + +## 10. Worlds + +A World is AIEN's reversible execution state. + +It answers: + +> "What if we did this?" + +A World allows AIEN to modify: + +```text +files +configuration +process state +candidate artifacts +runtime state +plans +``` + +without immediately changing canonical reality. + +Conceptually: + +```text +Canonical World + │ + ├── Candidate World A + ├── Candidate World B + └── Candidate World C +``` + +Dropping a World discards it. + +Promoting a World requires authority. + +This separation lets AIEN explore aggressively while remaining conservative about external effects. + +--- + +## 11. J-Space + +J-Space is where AIEN compares possible futures. + +It does not perform irreversible actions. + +It considers alternatives such as: + +```text +implementation A +implementation B +implementation C + +plan A +plan B +plan C + +physical realization A +physical realization B +physical realization C +``` + +and evaluates them using evidence. + +Eventually: + +```text +CPU implementation +GPU implementation +FPGA circuit +wave realization +analog realization +``` + +could all compete inside J-Space for the same Transformation. + +J-Space selects. + +OMEGA formalizes. + +PHYSICS lowers. + +AEGIS verifies. + +The Effect Broker adapter executes. + +Those remain separate jobs. + +--- + +## 12. Cortex + +Cortex is AIEN's durable epistemic memory. + +It should remember more than text. + +It records: + +```text +observations +facts +hypotheses +contradictions +decisions +experiments +provenance +measurements +failures +successful realizations +``` + +Cortex must preserve the distinction between: + +```text +observed +verified +inferred +hypothesized +decided +``` + +because AIEN must never turn its own previous speculation into "fact" simply because it remembered it. + +In the distant Physical Compiler architecture, Cortex also remembers: + +```text +transformation +substrate +realization +latency +energy +precision +temperature +failure rate +``` + +That turns physical experience into reusable knowledge. + +--- + +## 13. The Persistent Agent + +The agent is the human-facing continuity layer. + +Models may change. + +Kernels may change. + +Inference state may disappear. + +Machines may change. + +The logical agent should persist. + +```text +persistent identity +persistent history +persistent Cortex +persistent goals +persistent provenance + ↓ +replaceable model +replaceable runtime +replaceable hardware +``` + +The guiding principle is: + +> Losing physical inference state costs computation, not identity. + +Power cycle should eventually be ordinary: + +```text +power on +↓ +AIEN resumes +↓ +work +↓ +power off +↓ +power on +↓ +continue +``` + +--- + +## 14. Intent and Desired State + +The mature AIEN interface should move beyond commands. + +Instead of requiring: + +```text +open program +click menu +set field +run command +``` + +the person should increasingly be able to describe: + +```text +what they want to become true +``` + +Example: + +```text +"I want this room quieter, +cooler and more energy efficient." +``` + +The Intent layer transforms this into something closer to: + +```text +DesiredState { + temperature = target range + acoustic_level <= threshold + energy = minimize +} +``` + +The system must distinguish: + +```text +hard constraints +soft preferences +unknowns +required permissions +success conditions +``` + +AIEN should ask when consequential ambiguity cannot safely be resolved. + +--- + +## 15. Transformation IR + +This is the major transition beyond traditional computing. + +Instead of defining a computation as: + +```text +these AArch64 instructions +``` + +AIEN eventually defines: + +```text +Transformation { + inputs + outputs + semantic relation + invariants + precision + permitted error + latency constraint + memory constraint + energy objective + authority + effects +} +``` + +For example: + +```text +Y = X × W + +dtype = BF16 +error <= E +latency <= 2 ms +memory <= M +``` + +The same Transformation could be realized through multiple physical methods. + +That is where AIEN stops being fundamentally ISA-bound. + +--- + +## 16. The Physical Compiler + +The Physical Compiler answers: + +> **How should this Transformation become physical on the resources currently available?** + +Initially it will perform ordinary decisions: + +```text +scalar CPU +vs +vector CPU +vs +accelerator +``` + +Later: + +```text +CPU +GPU +FPGA +distributed Machine +``` + +And eventually: + +```text +digital circuit +multi-valued circuit +wave network +analog system +optical realization +other physical substrate +``` + +The compiler does not automatically select "fastest." + +It selects according to the Transformation's actual objective: + +```text +correctness +latency +energy +memory +precision +temperature +reliability +privacy +availability +``` + +--- + +## 17. Physical IR + +Below Transformation IR may eventually sit a representation of physical computation. + +For conventional digital systems, Physical IR could describe: + +```text +logic elements +registers +memory +connections +timing +resource constraints +``` + +For future substrates it may describe more general physical relationships. + +The crucial design principle is: + +> Physical IR describes a realization, not AIEN's permanent semantics. + +A new substrate can therefore introduce another backend without redefining AIEN. + +--- + +## 18. The Hum of the Hive + +Wave-based computation is a future Physical Fabric backend, not the definition of AIEN itself. + +A Wave IR might describe: + +```text +oscillator +frequency +amplitude +phase +coupling +modulation +interference +resonance +measurement +``` + +Instead of computing only through: + +```text +LOAD +ADD +STORE +BRANCH +``` + +a physical realization might compute through: + +```text +couple +oscillate +shift +interfere +resonate +settle +observe +``` + +The collective physical state can be thought of as: + +> **The Hum of the Hive.** + +Conceptually: + +```text +HiveState { + spectrum + phase_map + synchronization + energy_distribution + resonance_modes + stability +} +``` + +The Hum is not mystical. + +It is the measurable dynamical physical state of the computational fabric. + +Wave computation should begin as simulation, then only move onto real experimental hardware after deterministic security and measurement infrastructure exist. + +--- + +## 19. Multi-Valued and Analog Computing + +Binary remains the immediate implementation substrate. + +AIEN should not assume it is eternally optimal. + +Future research lanes may test: + +```text +binary +ternary +balanced ternary +higher radix +continuous analog +timing-based computation +frequency-domain computation +optical systems +neuromorphic systems +``` + +No representation wins because it sounds elegant. + +It must demonstrate value through measured workloads. + +AIEN's architecture therefore remains: + +```text +representation-independent +``` + +rather than: + +```text +binary-first forever +``` + +or: + +```text +wave-first forever +``` + +--- + +## 20. Physical Reality + +At sufficient maturity, AIEN's transformations may extend beyond computation. + +Physical effects could include: + +```text +configure +transmit +move +heat +cool +emit +energize +manufacture +route +assemble +``` + +through properly authorized devices. + +That creates the full loop: + +```text +Desired State + ↓ +Act + ↓ +Measure + ↓ +Compare + ↓ +Act again +``` + +AIEN does not simply assume an issued command succeeded. + +Reality must be measured. + +--- + +## 21. Provenance + +Every consequential transformation should create evidence. + +AIEN should be able to answer: + +```text +What was requested? +Who requested it? +What interpretation was used? +Which transformation was selected? +Which alternatives were considered? +What authority allowed it? +What artifact executed? +On what Machine? +What physical resources were used? +What actually happened? +What evidence supports that claim? +``` + +This provenance layer connects the entire system. + +Without it, autonomous self-improvement becomes storytelling. + +With it, improvements can be tested. + +--- + +## 22. RSI + +RSI is AIEN's improvement engine. + +It may propose improvements to: + +```text +algorithms +scheduler policies +memory placement +kernel implementations +cache policy +inference kernels +Transformation lowering +physical backend selection +circuit topology +wave configuration +physical placement +``` + +But RSI is never its own authority. + +The loop remains: + +```text +observe +↓ +hypothesize +↓ +construct candidate +↓ +evaluate +↓ +compare +↓ +authorize +↓ +promote +``` + +A failed candidate is evidence, not permission to try uncontrolled live mutations. + +--- + +## 23. Fabric and Multiple Machines + +AIEN should appear as one logical system even when it occupies several Machines. + +```text + AIEN + │ + ┌──────────┼──────────┐ + ↓ ↓ ↓ + Machine 1 Machine 2 Machine N +``` + +Fabric owns: + +```text +machine identity +capability advertisement +placement +topology +communication +leases +failover +resource scheduling +``` + +Fabric does not decide semantic goals. + +J-Space and the runtime decide what needs to happen. + +Fabric determines where eligible work can run. + +--- + +## 24. The Bootstrap Boundary + +AIEN cannot magically wake on arbitrary matter. + +Every new substrate needs a minimal physical entry point. + +A substrate must expose enough capability for AIEN to: + +```text +begin execution +represent state +change state +observe state +communicate +recover/reset +``` + +The architecture should minimize the substrate-specific seed. + +Conceptually: + +```text +New hardware + ↓ +Bootstrap Seed + ↓ +Physical Fabric Adapter + ↓ +Physical Capability Graph + ↓ +AIEN +``` + +Over time AIEN should be able to generate increasing portions of its own optimized backend after bootstrapping through a simple generic one. + +This is the route to true hardware portability. + +--- + +## 25. Self-Hosting + +AIEN reaches a deeper form of independence when it can reconstruct itself. + +Starting from: + +```text +minimal trusted Seed ++ +canonical artifacts ++ +supported physical substrate +``` + +AIEN should eventually be able to rebuild: + +```text +runtime +verifier +AEGIS +Cortex +Physical Compiler +backend +agent environment +``` + +and establish a new Generation. + +Self-hosting does not mean uncontrolled self-modification. + +It means the system can reproduce itself through the same verified admission process applied to everything else. + +--- + +## 26. The Four Eras + +The entire project can be reduced to four large eras. + +### Era I: AIEN Owns a Computer + +Build: + +```text +AIENOS +kernel isolation +capabilities +devices +storage +networking +native inference +Cortex +persistent agent +``` + +Outcome: + +> AIEN can safely inhabit and operate a conventional computer. + +--- + +### Era II: AIEN Owns Computation + +Build: + +```text +Binary Artifacts +Generations +Transformation IR +Physical Capability Graph +Physical Compiler +multiple execution backends +``` + +Outcome: + +> Computation is defined by desired transformations instead of one ISA. + +--- + +### Era III: AIEN Owns Its Physical Realization + +Build: + +```text +FPGA backend +Physical IR +reconfigurable circuits +multi-valued experiments +Wave IR +analog/continuous backends +``` + +Outcome: + +> AIEN can choose or construct physical mechanisms for computation. + +--- + +### Era IV: AIEN Connects Intent to Reality + +Build: + +```text +Intent Compiler +Desired State +physical effects +sensor feedback +closed-loop control +cross-domain orchestration +``` + +Outcome: + +> AIEN can translate authorized human intent into measured physical change. + +--- + +## 27. Delivery Order + +The architectural vision must not distort engineering priority. + +The dependency chain is: + +```text +TRUST + ↓ +IDENTITY + ↓ +ARTIFACTS + ↓ +PERSISTENCE + ↓ +INTELLIGENCE + ↓ +TRANSFORMATION + ↓ +PHYSICAL COMPILATION + ↓ +EXOTIC PHYSICS +``` + +Therefore the practical order is: + +```text +1. Finish M3 Trusted Machine +2. Freeze AIENOS ABI v1 +3. Introduce Binary Artifact v0 +4. Implement SEED-0B admission +5. Make storage + generations durable +6. Establish encryption + identity +7. Complete native networking +8. Complete useful native inference +9. Complete persistent Cortex + agent +10. Converge AEGIS / Worlds / J-Space +11. Mature Fabric +12. Introduce Transformation IR from real workloads +13. Add multiple Physical Compiler backends +14. Add a reconfigurable FPGA body +15. Introduce Physical IR +16. Research multi-valued logic +17. Research Wave IR / Hum of the Hive +18. Research analog and other physical substrates +19. Build generalized substrate bootstrap +20. Build Intent Compiler +21. Extend authorized transformations into physical environments +22. Demonstrate Intent → Verified Physical Reality +``` + +No hard dates are necessary. + +Each gate is earned by evidence. + +--- + +## 28. Repository Architecture + +The project should not respond to every new concept by creating another repository. + +Existing repositories should converge toward clear responsibilities. + +### `aienos` + +Owns the trusted body: + +```text +boot +kernel +memory +tasks +scheduler +IPC +capabilities +devices +DMA +storage +networking substrate +hardware adapters +Physical Fabric enforcement +recovery +``` + +--- + +### `aien-sovereign-core` + +Owns higher-level execution: + +```text +runtime +model abstraction +World execution +J-Space orchestration +Transformation planning +compute orchestration +initial Physical Compiler work +``` + +As native AIENOS matures, Linux-specific machinery becomes a compatibility implementation rather than architectural truth. + +--- + +### `aien-protocols` + +Owns stable portable contracts: + +```text +agent state +effects +events +evaluation +provenance +Binary Artifact +Transformation IR +Physical Capability Graph +Physical IR +Wave IR +bootstrap contracts +``` + +Only mature formats belong here. + +Experimental structures should not be prematurely frozen as protocols. + +--- + +### `aien-architecture` + +Owns architectural law: + +```text +system map +responsibility boundaries +ADRs +cross-repository contracts +roadmap +accepted invariants +future architecture +``` + +This master plan belongs conceptually here. + +--- + +### `benchmarks` + +Owns empirical truth: + +```text +correctness +latency +throughput +memory +energy +temperature +precision +noise +stability +reconfiguration cost +physical resource use +``` + +Claims require receipts. + +--- + +### `spark-rsi` + +Owns improvement proposals and evaluation machinery. + +It may propose better implementations. + +It must not become the authority that promotes them. + +--- + +### AEGIS + +Long-term AEGIS should converge toward one canonical authority system rather than several overlapping policy implementations. + +--- + +## 29. Canonical Objects + +Over time the most important durable objects should become: + +```text +Machine +Agent +Identity +Capability +Artifact +Generation +World +Intent +DesiredState +Transformation +PhysicalCapability +PhysicalRealization +EffectIntent +AdmissionReceipt +EvidenceReceipt +EpistemicRecord +``` + +These objects connect the full system. + +A future AIEN should be understandable by inspecting their relationships rather than reading thousands of unrelated configuration files. + +--- + +## 30. The Two Fundamental Loops + +Nearly the entire architecture reduces to two loops. + +### The Action Loop + +```text +Intent +↓ +Desired State +↓ +Transformation +↓ +J-Space +↓ +AEGIS +↓ +Effect +↓ +Physical Reality +↓ +Measurement +↓ +Cortex +``` + +This loop changes reality. + +### The Improvement Loop + +```text +Evidence +↓ +Cortex +↓ +RSI +↓ +Candidate +↓ +World +↓ +Evaluation +↓ +J-Space +↓ +AEGIS +↓ +New Generation +``` + +This loop changes AIEN. + +They must never collapse into one loop. + +If the system that proposes an improvement can directly install it, the architecture has failed. + +--- + +## 31. Hard Safety Invariants + +These should remain true even in the deepest future architecture. + +1. The model is never the root of trust. +2. Intelligence never implies authority. +3. Every external effect has an accountable principal. +4. Capabilities are explicit and revocable. +5. Speculation occurs in reversible state. +6. Reality changes only after authorization. +7. Generated code receives no ambient authority. +8. DMA is denied unless explicitly confined. +9. Physical configuration changes are effects. +10. RSI cannot authorize its own improvements. +11. Exact evaluated artifacts are the artifacts admitted. +12. Failed improvements roll back before repair. +13. Evidence distinguishes simulation, emulation and physical measurement. +14. A new hardware substrate does not automatically become trusted. +15. Recovery must not require the model. +16. Human operator authority remains available independently of agent reasoning. + +--- + +## 32. Research Lanes That Must Not Block the Product + +Keep these active, but separate from the critical path: + +```text +direct GB10 acceleration +FPGA synthesis +multi-valued computation +Wave IR +Hum of the Hive +analog computing +optical computing +neuromorphic substrates +self-generated physical backends +``` + +Each can mature until it earns promotion into the main architecture. + +This lets AIEN remain ambitious without turning the kernel roadmap into a physics research program. + +--- + +## 33. First Major Product Boundary + +The first complete AIEN product does not require Wave IR, FPGA synthesis or a Physical Compiler. + +It requires: + +```text +power on +↓ +AIENOS +↓ +local AIEN agent +↓ +conversation / voice +↓ +useful native model +↓ +Cortex +↓ +safe capabilities +↓ +power off +↓ +power on +↓ +continues +``` + +That is the first system worth putting in someone's hands. + +Everything deeper builds upon it. + +--- + +## 34. Final Architectural Boundary + +The final mature system looks like this: + +```text + HUMAN + │ + ▼ + ┌─────────┐ + │ INTENT │ + └────┬────┘ + ▼ + ┌────────────────┐ + │ DESIRED STATE │ + └───────┬────────┘ + ▼ + ┌─────────────────┐ + │ TRANSFORMATION │ + └───────┬─────────┘ + │ + ┌─────────▼─────────┐ + │ J-SPACE │ + │ possible futures │ + └─────────┬─────────┘ + ▼ + ┌────────────┐ + │ AEGIS │ + │ authority │ + └─────┬──────┘ + ▼ + ┌───────────────────┐ + │ PHYSICAL COMPILER │ + └─────────┬─────────┘ + ▼ + ┌──────────────────┐ + │ PHYSICAL FABRIC │ + └─────────┬────────┘ + ▼ + ┌─────────────────────────────────────┐ + │ CPU │ GPU │ FPGA │ WAVE │ ANALOG │ ? │ + └──────────────────┬──────────────────┘ + ▼ + PHYSICS + │ + ▼ + REALITY + │ + ▼ + SENSORS + │ + ▼ + EVIDENCE + │ + ▼ + CORTEX + │ + ▼ + RSI +``` + +--- + +## 35. What AIEN Eventually Becomes + +AIEN begins as an operating system because an operating system is the first layer that must be owned. + +It evolves into a persistent agent platform. + +Then into a hardware-neutral transformation system. + +Then into a physical compiler. + +Eventually its deepest question is no longer: + +> "Which instruction should the CPU execute?" + +Nor even: + +> "Which program should I run?" + +It becomes: + +> **"What permitted physical process can cause the requested state of reality to become true?"** + +The system then finds a realization, verifies it, executes it, measures it and remembers what happened. + +That is the fully zoomed-out architecture. + +> **Intent → Meaning → Desired State → Transformation → Authority → Physical Realization → Physics → Reality → Evidence → Learning.** + +Everything currently being built is a layer of that path. diff --git a/docs/archive/plans/2026-09-25/AIEN_MASTER_ARCHITECTURAL_PLAN.md b/docs/archive/plans/2026-09-25/AIEN_MASTER_ARCHITECTURAL_PLAN.md new file mode 100644 index 0000000..35d33c7 --- /dev/null +++ b/docs/archive/plans/2026-09-25/AIEN_MASTER_ARCHITECTURAL_PLAN.md @@ -0,0 +1,1687 @@ +> **SUPERSEDED / HISTORICAL — DO NOT USE AS AN ACTIVE IMPLEMENTATION PLAN** +> +> Original path: `AIEN_MASTER_ARCHITECTURAL_PLAN.md` +> +> Archived on 2026-09-27 during plan consolidation. The active cross-project execution plan is [CURRENT_EXECUTION_PLAN.md](../../../CURRENT_EXECUTION_PLAN.md), governed by [PLAN_AUTHORITY.md](../../../PLAN_AUTHORITY.md). +> +> Retained for provenance only. + +--- + +# AIEN Master Architectural Plan + +## 1. North Star + +AIEN exists to reduce the distance between human intention and physical reality. + +The ultimate system should allow a person to describe a desired outcome, then have AIEN determine what must change, what it is permitted to change, how that change can be accomplished, which physical realization is appropriate, whether the result actually occurred, and what can be learned from it. + +The long-term execution path is: + +```text +Human Intent + ↓ +Desired State + ↓ +Formal Transformation + ↓ +Constraints + Authority + ↓ +Candidate Futures + ↓ +Verification + Evaluation + ↓ +Authorization + ↓ +Physical Realization + ↓ +Physics + ↓ +Observed Reality + ↓ +Evidence + ↓ +Memory + Improvement +``` + +The concise definition is: + +> **AIEN compiles desired state into authorized, verified physical transformation.** + +The completed system is not fundamentally an operating system, AI model, programming language, CPU architecture, or robot. + +Those are components and physical realizations. + +--- + +## 2. The Permanent Architectural Rule + +No implementation layer below intent should become the permanent definition of AIEN. + +Therefore: + +```text +Rust != AIEN +AArch64 != AIEN +x86 != AIEN +RISC-V != AIEN +binary != AIEN +CUDA != AIEN +NVIDIA != AIEN +Linux != AIEN +a model != AIEN +a CPU != AIEN +``` + +Today AIEN is implemented primarily through Rust and AArch64 because those are useful engineering choices. + +They are not the final abstraction. + +The durable object should eventually describe: + +```text +What should become true? +What transformation produces it? +What constraints apply? +What authority is required? +What evidence proves success? +``` + +Everything below that may evolve. + +--- + +## 3. The Seven-Layer Architecture + +The whole system can be understood as seven architectural layers. + +```text +┌──────────────────────────────────────┐ +│ 7. HUMAN INTENT │ +│ "What do I want?" │ +├──────────────────────────────────────┤ +│ 6. SEMANTIC / DESIRED STATE │ +│ "What exactly must become true?" │ +├──────────────────────────────────────┤ +│ 5. INTELLIGENCE │ +│ Agent, Cortex, J-Space, Skills │ +├──────────────────────────────────────┤ +│ 4. AUTHORITY │ +│ Capabilities, AEGIS, Effects │ +├──────────────────────────────────────┤ +│ 3. TRANSFORMATION │ +│ Artifact IR, Transformation IR │ +├──────────────────────────────────────┤ +│ 2. PHYSICAL COMPILATION │ +│ Physical Compiler + Fabric │ +├──────────────────────────────────────┤ +│ 1. PHYSICAL SUBSTRATE │ +│ CPU/GPU/FPGA/waves/analog/etc. │ +└──────────────────────────────────────┘ + ↓ + PHYSICS +``` + +Each layer has one job. + +No layer should secretly absorb the responsibilities of another. + +--- + +## 4. Layer 1: The Trusted Physical Substrate + +This is what AIENOS is currently establishing. + +Its job is not intelligence. + +Its job is control. + +The kernel must provide deterministic mechanisms for: + +```text +boot +memory ownership +address spaces +tasks +scheduling +interrupts +IPC +capabilities +device ownership +DMA confinement +storage +networking +time +recovery +``` + +The model is never the kernel. + +The kernel must continue functioning with no model loaded. + +Its fundamental guarantee is: + +> A component can affect only the memory, objects and devices for which it has explicit authority. + +The trusted base should remain small, inspectable and recoverable. + +### Current engineering anchor + +The current development line is closing the M3 enforcement substrate: + +```text +EL1 kernel +↓ +AIENOS-owned MMU +↓ +interrupt ownership +↓ +preemptive scheduler +↓ +EL0 isolation +↓ +capability tables +↓ +typed IPC +↓ +SMMUv3 DMA confinement +↓ +device authority +``` + +This layer must become trustworthy before significant generated native code is admitted. + +--- + +## 5. Layer 2: The Physical Fabric + +Above individual drivers sits the abstraction AIEN uses to understand its body. + +A Machine should not simply be described as: + +```text +"NVIDIA DGX Spark" +``` + +It should expose capabilities. + +Conceptually: + +```text +PhysicalCapabilities { + compute + memory + storage + communication + devices + timing + precision + topology + energy + temperature + reconfiguration + failure_properties +} +``` + +Upper AIEN layers should increasingly ask: + +```text +Who can perform this transformation? +``` + +rather than: + +```text +Where is the NVIDIA GPU? +``` + +The same abstraction can eventually represent: + +```text +CPU +GPU +FPGA +specialized accelerator +another Machine +wave network +analog array +optical device +future computing substrate +``` + +Machine 1 is the first physical body. + +It is not AIEN's permanent body. + +--- + +## 6. Layer 3: Canonical Executable Artifacts + +Before AIEN becomes hardware-neutral, it needs a clean executable identity system. + +This is the bridge between today's software and tomorrow's Transformation IR. + +### Binary Artifact + +An AIEN Artifact should describe: + +```text +identity +exact executable bytes +ABI version +target +resource requirements +requested capabilities +declared effects +ancestry +evidence +admission +``` + +The central invariant is: + +```text +tested bytes + == +evaluated bytes + == +authorized bytes + == +executed bytes +``` + +The source code that produced an artifact is important provenance. + +It is not the executable identity. + +Artifacts are: + +```text +immutable +content-addressed +versioned +signed where appropriate +reproducibly evaluated +``` + +This becomes the basis for AIEN Generations. + +--- + +## 7. Generations and Self-Construction + +AIEN should grow through explicit Generations. + +```text +Generation 0 + ↓ +Generation 1 + ↓ +Generation 2 + ↓ +Generation N +``` + +An agent may propose a new Generation. + +It may not authorize it. + +The pipeline is: + +```text +Observe + ↓ +Propose + ↓ +Build + ↓ +Verify + ↓ +Isolated test + ↓ +Benchmark + ↓ +J-Space comparison + ↓ +AEGIS admission + ↓ +Canary + ↓ +Promote +``` + +Failure results in: + +```text +quarantine +↓ +rollback +↓ +preserve evidence +↓ +diagnose separately +``` + +The governing rule is: + +> **Rollback first, repair second.** + +AIEN never rewrites its trusted running kernel merely because a model believes an improvement is good. + +--- + +## 8. Layer 4: Authority + +The most important distinction in AIEN is: + +```text +intelligence +≠ +authority +``` + +The model may understand what should happen. + +That does not mean it has permission to make it happen. + +The canonical effect path is: + +```text +Agent + ↓ proposes +EffectIntent + ↓ +Capability check + ↓ +AEGIS + ↓ +Effect Broker + ↓ +Kernel / driver + ↓ +physical effect +``` + +### Capabilities + +Authority should be explicit and scoped. + +Examples: + +```text +audio.output +network.local +storage.project.read +device.camera.capture +mail.send +fabric.compute +world.promote +physical.motor.move +``` + +A capability answers: + +```text +WHO +may do WHAT +to WHICH resource +under WHICH bounds +``` + +No ambient root authority. + +--- + +## 9. AEGIS + +AEGIS is the authority boundary between intelligence and reality. + +Its job is to determine whether a proposed effect is permitted. + +It should understand: + +```text +principal +capability +scope +effect type +reversibility +resource bounds +operator policy +risk +provenance +``` + +Broadly: + +```text +reversible internal change + ↓ +can often proceed autonomously + +irreversible/external effect + ↓ +requires stronger authority +``` + +At the deepest future level, AEGIS still exists. + +If AIEN is configuring actual physical circuits, waves, power systems or machines, those are effects too. + +The Physical Compiler never gets to bypass AEGIS. + +--- + +## 10. Worlds + +A World is AIEN's reversible execution state. + +It answers: + +> "What if we did this?" + +A World allows AIEN to modify: + +```text +files +configuration +process state +candidate artifacts +runtime state +plans +``` + +without immediately changing canonical reality. + +Conceptually: + +```text +Canonical World + │ + ├── Candidate World A + ├── Candidate World B + └── Candidate World C +``` + +Dropping a World discards it. + +Promoting a World requires authority. + +This separation lets AIEN explore aggressively while remaining conservative about external effects. + +--- + +## 11. J-Space + +J-Space is where AIEN compares possible futures. + +It does not perform irreversible actions. + +It considers alternatives such as: + +```text +implementation A +implementation B +implementation C + +plan A +plan B +plan C + +physical realization A +physical realization B +physical realization C +``` + +and evaluates them using evidence. + +Eventually: + +```text +CPU implementation +GPU implementation +FPGA circuit +wave realization +analog realization +``` + +could all compete inside J-Space for the same Transformation. + +J-Space selects. + +OMEGA formalizes. + +PHYSICS lowers. + +AEGIS verifies. + +The Effect Broker adapter executes. + +Those remain separate jobs. + +--- + +## 12. Cortex + +Cortex is AIEN's durable epistemic memory. + +It should remember more than text. + +It records: + +```text +observations +facts +hypotheses +contradictions +decisions +experiments +provenance +measurements +failures +successful realizations +``` + +Cortex must preserve the distinction between: + +```text +observed +verified +inferred +hypothesized +decided +``` + +because AIEN must never turn its own previous speculation into "fact" simply because it remembered it. + +In the distant Physical Compiler architecture, Cortex also remembers: + +```text +transformation +substrate +realization +latency +energy +precision +temperature +failure rate +``` + +That turns physical experience into reusable knowledge. + +--- + +## 13. The Persistent Agent + +The agent is the human-facing continuity layer. + +Models may change. + +Kernels may change. + +Inference state may disappear. + +Machines may change. + +The logical agent should persist. + +```text +persistent identity +persistent history +persistent Cortex +persistent goals +persistent provenance + ↓ +replaceable model +replaceable runtime +replaceable hardware +``` + +The guiding principle is: + +> Losing physical inference state costs computation, not identity. + +Power cycle should eventually be ordinary: + +```text +power on +↓ +AIEN resumes +↓ +work +↓ +power off +↓ +power on +↓ +continue +``` + +--- + +## 14. Intent and Desired State + +The mature AIEN interface should move beyond commands. + +Instead of requiring: + +```text +open program +click menu +set field +run command +``` + +the person should increasingly be able to describe: + +```text +what they want to become true +``` + +Example: + +```text +"I want this room quieter, +cooler and more energy efficient." +``` + +The Intent layer transforms this into something closer to: + +```text +DesiredState { + temperature = target range + acoustic_level <= threshold + energy = minimize +} +``` + +The system must distinguish: + +```text +hard constraints +soft preferences +unknowns +required permissions +success conditions +``` + +AIEN should ask when consequential ambiguity cannot safely be resolved. + +--- + +## 15. Transformation IR + +This is the major transition beyond traditional computing. + +Instead of defining a computation as: + +```text +these AArch64 instructions +``` + +AIEN eventually defines: + +```text +Transformation { + inputs + outputs + semantic relation + invariants + precision + permitted error + latency constraint + memory constraint + energy objective + authority + effects +} +``` + +For example: + +```text +Y = X × W + +dtype = BF16 +error <= E +latency <= 2 ms +memory <= M +``` + +The same Transformation could be realized through multiple physical methods. + +That is where AIEN stops being fundamentally ISA-bound. + +--- + +## 16. The Physical Compiler + +The Physical Compiler answers: + +> **How should this Transformation become physical on the resources currently available?** + +Initially it will perform ordinary decisions: + +```text +scalar CPU +vs +vector CPU +vs +accelerator +``` + +Later: + +```text +CPU +GPU +FPGA +distributed Machine +``` + +And eventually: + +```text +digital circuit +multi-valued circuit +wave network +analog system +optical realization +other physical substrate +``` + +The compiler does not automatically select "fastest." + +It selects according to the Transformation's actual objective: + +```text +correctness +latency +energy +memory +precision +temperature +reliability +privacy +availability +``` + +--- + +## 17. Physical IR + +Below Transformation IR may eventually sit a representation of physical computation. + +For conventional digital systems, Physical IR could describe: + +```text +logic elements +registers +memory +connections +timing +resource constraints +``` + +For future substrates it may describe more general physical relationships. + +The crucial design principle is: + +> Physical IR describes a realization, not AIEN's permanent semantics. + +A new substrate can therefore introduce another backend without redefining AIEN. + +--- + +## 18. The Hum of the Hive + +Wave-based computation is a future Physical Fabric backend, not the definition of AIEN itself. + +A Wave IR might describe: + +```text +oscillator +frequency +amplitude +phase +coupling +modulation +interference +resonance +measurement +``` + +Instead of computing only through: + +```text +LOAD +ADD +STORE +BRANCH +``` + +a physical realization might compute through: + +```text +couple +oscillate +shift +interfere +resonate +settle +observe +``` + +The collective physical state can be thought of as: + +> **The Hum of the Hive.** + +Conceptually: + +```text +HiveState { + spectrum + phase_map + synchronization + energy_distribution + resonance_modes + stability +} +``` + +The Hum is not mystical. + +It is the measurable dynamical physical state of the computational fabric. + +Wave computation should begin as simulation, then only move onto real experimental hardware after deterministic security and measurement infrastructure exist. + +--- + +## 19. Multi-Valued and Analog Computing + +Binary remains the immediate implementation substrate. + +AIEN should not assume it is eternally optimal. + +Future research lanes may test: + +```text +binary +ternary +balanced ternary +higher radix +continuous analog +timing-based computation +frequency-domain computation +optical systems +neuromorphic systems +``` + +No representation wins because it sounds elegant. + +It must demonstrate value through measured workloads. + +AIEN's architecture therefore remains: + +```text +representation-independent +``` + +rather than: + +```text +binary-first forever +``` + +or: + +```text +wave-first forever +``` + +--- + +## 20. Physical Reality + +At sufficient maturity, AIEN's transformations may extend beyond computation. + +Physical effects could include: + +```text +configure +transmit +move +heat +cool +emit +energize +manufacture +route +assemble +``` + +through properly authorized devices. + +That creates the full loop: + +```text +Desired State + ↓ +Act + ↓ +Measure + ↓ +Compare + ↓ +Act again +``` + +AIEN does not simply assume an issued command succeeded. + +Reality must be measured. + +--- + +## 21. Provenance + +Every consequential transformation should create evidence. + +AIEN should be able to answer: + +```text +What was requested? +Who requested it? +What interpretation was used? +Which transformation was selected? +Which alternatives were considered? +What authority allowed it? +What artifact executed? +On what Machine? +What physical resources were used? +What actually happened? +What evidence supports that claim? +``` + +This provenance layer connects the entire system. + +Without it, autonomous self-improvement becomes storytelling. + +With it, improvements can be tested. + +--- + +## 22. RSI + +RSI is AIEN's improvement engine. + +It may propose improvements to: + +```text +algorithms +scheduler policies +memory placement +kernel implementations +cache policy +inference kernels +Transformation lowering +physical backend selection +circuit topology +wave configuration +physical placement +``` + +But RSI is never its own authority. + +The loop remains: + +```text +observe +↓ +hypothesize +↓ +construct candidate +↓ +evaluate +↓ +compare +↓ +authorize +↓ +promote +``` + +A failed candidate is evidence, not permission to try uncontrolled live mutations. + +--- + +## 23. Fabric and Multiple Machines + +AIEN should appear as one logical system even when it occupies several Machines. + +```text + AIEN + │ + ┌──────────┼──────────┐ + ↓ ↓ ↓ + Machine 1 Machine 2 Machine N +``` + +Fabric owns: + +```text +machine identity +capability advertisement +placement +topology +communication +leases +failover +resource scheduling +``` + +Fabric does not decide semantic goals. + +J-Space and the runtime decide what needs to happen. + +Fabric determines where eligible work can run. + +--- + +## 24. The Bootstrap Boundary + +AIEN cannot magically wake on arbitrary matter. + +Every new substrate needs a minimal physical entry point. + +A substrate must expose enough capability for AIEN to: + +```text +begin execution +represent state +change state +observe state +communicate +recover/reset +``` + +The architecture should minimize the substrate-specific seed. + +Conceptually: + +```text +New hardware + ↓ +Bootstrap Seed + ↓ +Physical Fabric Adapter + ↓ +Physical Capability Graph + ↓ +AIEN +``` + +Over time AIEN should be able to generate increasing portions of its own optimized backend after bootstrapping through a simple generic one. + +This is the route to true hardware portability. + +--- + +## 25. Self-Hosting + +AIEN reaches a deeper form of independence when it can reconstruct itself. + +Starting from: + +```text +minimal trusted Seed ++ +canonical artifacts ++ +supported physical substrate +``` + +AIEN should eventually be able to rebuild: + +```text +runtime +verifier +AEGIS +Cortex +Physical Compiler +backend +agent environment +``` + +and establish a new Generation. + +Self-hosting does not mean uncontrolled self-modification. + +It means the system can reproduce itself through the same verified admission process applied to everything else. + +--- + +## 26. The Four Eras + +The entire project can be reduced to four large eras. + +### Era I: AIEN Owns a Computer + +Build: + +```text +AIENOS +kernel isolation +capabilities +devices +storage +networking +native inference +Cortex +persistent agent +``` + +Outcome: + +> AIEN can safely inhabit and operate a conventional computer. + +--- + +### Era II: AIEN Owns Computation + +Build: + +```text +Binary Artifacts +Generations +Transformation IR +Physical Capability Graph +Physical Compiler +multiple execution backends +``` + +Outcome: + +> Computation is defined by desired transformations instead of one ISA. + +--- + +### Era III: AIEN Owns Its Physical Realization + +Build: + +```text +FPGA backend +Physical IR +reconfigurable circuits +multi-valued experiments +Wave IR +analog/continuous backends +``` + +Outcome: + +> AIEN can choose or construct physical mechanisms for computation. + +--- + +### Era IV: AIEN Connects Intent to Reality + +Build: + +```text +Intent Compiler +Desired State +physical effects +sensor feedback +closed-loop control +cross-domain orchestration +``` + +Outcome: + +> AIEN can translate authorized human intent into measured physical change. + +--- + +## 27. Delivery Order + +The architectural vision must not distort engineering priority. + +The dependency chain is: + +```text +TRUST + ↓ +IDENTITY + ↓ +ARTIFACTS + ↓ +PERSISTENCE + ↓ +INTELLIGENCE + ↓ +TRANSFORMATION + ↓ +PHYSICAL COMPILATION + ↓ +EXOTIC PHYSICS +``` + +Therefore the practical order is: + +```text +1. Finish M3 Trusted Machine +2. Freeze AIENOS ABI v1 +3. Introduce Binary Artifact v0 +4. Implement SEED-0B admission +5. Make storage + generations durable +6. Establish encryption + identity +7. Complete native networking +8. Complete useful native inference +9. Complete persistent Cortex + agent +10. Converge AEGIS / Worlds / J-Space +11. Mature Fabric +12. Introduce Transformation IR from real workloads +13. Add multiple Physical Compiler backends +14. Add a reconfigurable FPGA body +15. Introduce Physical IR +16. Research multi-valued logic +17. Research Wave IR / Hum of the Hive +18. Research analog and other physical substrates +19. Build generalized substrate bootstrap +20. Build Intent Compiler +21. Extend authorized transformations into physical environments +22. Demonstrate Intent → Verified Physical Reality +``` + +No hard dates are necessary. + +Each gate is earned by evidence. + +--- + +## 28. Repository Architecture + +The project should not respond to every new concept by creating another repository. + +Existing repositories should converge toward clear responsibilities. + +### `aienos` + +Owns the trusted body: + +```text +boot +kernel +memory +tasks +scheduler +IPC +capabilities +devices +DMA +storage +networking substrate +hardware adapters +Physical Fabric enforcement +recovery +``` + +--- + +### `aien-sovereign-core` + +Owns higher-level execution: + +```text +runtime +model abstraction +World execution +J-Space orchestration +Transformation planning +compute orchestration +initial Physical Compiler work +``` + +As native AIENOS matures, Linux-specific machinery becomes a compatibility implementation rather than architectural truth. + +--- + +### `aien-protocols` + +Owns stable portable contracts: + +```text +agent state +effects +events +evaluation +provenance +Binary Artifact +Transformation IR +Physical Capability Graph +Physical IR +Wave IR +bootstrap contracts +``` + +Only mature formats belong here. + +Experimental structures should not be prematurely frozen as protocols. + +--- + +### `aien-architecture` + +Owns architectural law: + +```text +system map +responsibility boundaries +ADRs +cross-repository contracts +roadmap +accepted invariants +future architecture +``` + +This master plan belongs conceptually here. + +--- + +### `benchmarks` + +Owns empirical truth: + +```text +correctness +latency +throughput +memory +energy +temperature +precision +noise +stability +reconfiguration cost +physical resource use +``` + +Claims require receipts. + +--- + +### `spark-rsi` + +Owns improvement proposals and evaluation machinery. + +It may propose better implementations. + +It must not become the authority that promotes them. + +--- + +### AEGIS + +Long-term AEGIS should converge toward one canonical authority system rather than several overlapping policy implementations. + +--- + +## 29. Canonical Objects + +Over time the most important durable objects should become: + +```text +Machine +Agent +Identity +Capability +Artifact +Generation +World +Intent +DesiredState +Transformation +PhysicalCapability +PhysicalRealization +EffectIntent +AdmissionReceipt +EvidenceReceipt +EpistemicRecord +``` + +These objects connect the full system. + +A future AIEN should be understandable by inspecting their relationships rather than reading thousands of unrelated configuration files. + +--- + +## 30. The Two Fundamental Loops + +Nearly the entire architecture reduces to two loops. + +### The Action Loop + +```text +Intent +↓ +Desired State +↓ +Transformation +↓ +J-Space +↓ +AEGIS +↓ +Effect +↓ +Physical Reality +↓ +Measurement +↓ +Cortex +``` + +This loop changes reality. + +### The Improvement Loop + +```text +Evidence +↓ +Cortex +↓ +RSI +↓ +Candidate +↓ +World +↓ +Evaluation +↓ +J-Space +↓ +AEGIS +↓ +New Generation +``` + +This loop changes AIEN. + +They must never collapse into one loop. + +If the system that proposes an improvement can directly install it, the architecture has failed. + +--- + +## 31. Hard Safety Invariants + +These should remain true even in the deepest future architecture. + +1. The model is never the root of trust. +2. Intelligence never implies authority. +3. Every external effect has an accountable principal. +4. Capabilities are explicit and revocable. +5. Speculation occurs in reversible state. +6. Reality changes only after authorization. +7. Generated code receives no ambient authority. +8. DMA is denied unless explicitly confined. +9. Physical configuration changes are effects. +10. RSI cannot authorize its own improvements. +11. Exact evaluated artifacts are the artifacts admitted. +12. Failed improvements roll back before repair. +13. Evidence distinguishes simulation, emulation and physical measurement. +14. A new hardware substrate does not automatically become trusted. +15. Recovery must not require the model. +16. Human operator authority remains available independently of agent reasoning. + +--- + +## 32. Research Lanes That Must Not Block the Product + +Keep these active, but separate from the critical path: + +```text +direct GB10 acceleration +FPGA synthesis +multi-valued computation +Wave IR +Hum of the Hive +analog computing +optical computing +neuromorphic substrates +self-generated physical backends +``` + +Each can mature until it earns promotion into the main architecture. + +This lets AIEN remain ambitious without turning the kernel roadmap into a physics research program. + +--- + +## 33. First Major Product Boundary + +The first complete AIEN product does not require Wave IR, FPGA synthesis or a Physical Compiler. + +It requires: + +```text +power on +↓ +AIENOS +↓ +local AIEN agent +↓ +conversation / voice +↓ +useful native model +↓ +Cortex +↓ +safe capabilities +↓ +power off +↓ +power on +↓ +continues +``` + +That is the first system worth putting in someone's hands. + +Everything deeper builds upon it. + +--- + +## 34. Final Architectural Boundary + +The final mature system looks like this: + +```text + HUMAN + │ + ▼ + ┌─────────┐ + │ INTENT │ + └────┬────┘ + ▼ + ┌────────────────┐ + │ DESIRED STATE │ + └───────┬────────┘ + ▼ + ┌─────────────────┐ + │ TRANSFORMATION │ + └───────┬─────────┘ + │ + ┌─────────▼─────────┐ + │ J-SPACE │ + │ possible futures │ + └─────────┬─────────┘ + ▼ + ┌────────────┐ + │ AEGIS │ + │ authority │ + └─────┬──────┘ + ▼ + ┌───────────────────┐ + │ PHYSICAL COMPILER │ + └─────────┬─────────┘ + ▼ + ┌──────────────────┐ + │ PHYSICAL FABRIC │ + └─────────┬────────┘ + ▼ + ┌─────────────────────────────────────┐ + │ CPU │ GPU │ FPGA │ WAVE │ ANALOG │ ? │ + └──────────────────┬──────────────────┘ + ▼ + PHYSICS + │ + ▼ + REALITY + │ + ▼ + SENSORS + │ + ▼ + EVIDENCE + │ + ▼ + CORTEX + │ + ▼ + RSI +``` + +--- + +## 35. What AIEN Eventually Becomes + +AIEN begins as an operating system because an operating system is the first layer that must be owned. + +It evolves into a persistent agent platform. + +Then into a hardware-neutral transformation system. + +Then into a physical compiler. + +Eventually its deepest question is no longer: + +> "Which instruction should the CPU execute?" + +Nor even: + +> "Which program should I run?" + +It becomes: + +> **"What permitted physical process can cause the requested state of reality to become true?"** + +The system then finds a realization, verifies it, executes it, measures it and remembers what happened. + +That is the fully zoomed-out architecture. + +> **Intent → Meaning → Desired State → Transformation → Authority → Physical Realization → Physics → Reality → Evidence → Learning.** + +Everything currently being built is a layer of that path. diff --git a/docs/archive/plans/README.md b/docs/archive/plans/README.md new file mode 100644 index 0000000..9ad4602 --- /dev/null +++ b/docs/archive/plans/README.md @@ -0,0 +1,14 @@ +# Superseded plan archive + +These files are retained for provenance only. + +They are **not active plans** and must not be used to decide what to build next. + +Current authorities: + +- [PLAN_AUTHORITY.md](../../../PLAN_AUTHORITY.md) +- [CURRENT_EXECUTION_PLAN.md](../../../CURRENT_EXECUTION_PLAN.md) +- [doctrine/ARCHITECTURE.md](../../../doctrine/ARCHITECTURE.md) +- [doctrine/ROADMAP.md](../../../doctrine/ROADMAP.md) + +Historical PHYSICS terminology in these files is preserved intentionally. diff --git a/doctrine/ARCHITECTURE.md b/doctrine/ARCHITECTURE.md index f46b1f7..10a1b8f 100644 --- a/doctrine/ARCHITECTURE.md +++ b/doctrine/ARCHITECTURE.md @@ -43,7 +43,7 @@ All computation within the Sovereign Machine flows through an explicit architect AEGIS / CHECKER spans the path -AIEN ───── OMEGA ───── PHYSICS ───── HARDWARE +AIEN ───── OMEGA ───── FORGE ───── HARDWARE ▲ ▲ │ │ constraints machine facts @@ -54,8 +54,8 @@ AIEN ───── OMEGA ───── PHYSICS ───── HARDWARE 2. **ATLAS**: The irreducible software root artifact. A single, auditable, immutable binary (`atlas.bin`) that awakens the silicon, establishes architectural hygiene, verifies the secondary boot stage, and immediately relinquishes control to establish the first trusted machine state. 3. **AIEN**: The sovereign cognitive intelligence. Residing primarily within high-bandwidth accelerator memory, Aien parses human intention, maintains continuous associative world models in Cortex, reasons across possibility spaces, and proposes intents, hypotheses, and architectural mutations. 4. **OMEGA**: The semantic calculus and formal transformation engine. It decouples computational meaning from physical representation, defining formal programs, data types, graph relations, and mathematical invariants. -5. **PHYSICS (Machine Physics / Physical Realizer)**: The physical compiler and machine realization engine. It understands concrete hardware mechanics: memory allocations, page table mappings, cache line invalidations, register pressure, DMA descriptors, GPFIFO queues, device registers, and interconnect topologies. It lowers formal OMEGA programs into physical machine operations and communicates physical constraints back to OMEGA. -6. **AEGIS (Invariant Checker & Verifier)**: The continuous verification framework spanning the entire execution chain. It checks that OMEGA programs match AIEN intents, verifies that PHYSICS realizations satisfy semantic constraints, validates memory bounds, slot generations, and type safety, guarantees rollback paths, and inspects post-execution hardware states against contracts. +5. **FORGE (Machine Realization Engine / Physical Realizer)**: The physical compiler and machine realization engine. It understands concrete hardware mechanics: memory allocations, page table mappings, cache line invalidations, register pressure, DMA descriptors, GPFIFO queues, device registers, and interconnect topologies. It lowers formal OMEGA programs into physical machine operations and communicates physical constraints back to OMEGA. +6. **AEGIS (Invariant Checker & Verifier)**: The continuous verification framework spanning the entire execution chain. It checks that OMEGA programs match AIEN intents, verifies that FORGE realizations satisfy semantic constraints, validates memory bounds, slot generations, and type safety, guarantees rollback paths, and inspects post-execution hardware states against contracts. 7. **HARDWARE**: Physical execution silicon (AArch64 host CPUs, Blackwell/Hopper GPUs, SMMUv3, NVLink-C2C, PCIe controllers) performing electrical state transitions. 8. **EVIDENCE**: The immutable ledger of execution telemetry, verified cryptographic receipts, and measured counters, closing the feedback loop into AIEN. @@ -75,7 +75,7 @@ $$\begin{aligned} \mathbf{EVIDENCE\ TEACHES.} &\quad \text{Empirical receipts record ground truth for autonomous learning.} \end{aligned}$$ -No layer may perform the duty of another. Aien cannot dictate physical register allocations; Physics cannot reason about high-level goals; Omega cannot violate physical memory bounds; Atlas cannot remain active after handoff; Aegis does not filter thought, but verifies execution integrity and contracts. +No layer may perform the duty of another. Aien cannot dictate physical register allocations; Forge cannot reason about high-level goals; Omega cannot violate physical memory bounds; Atlas cannot remain active after handoff; Aegis does not filter thought, but verifies execution integrity and contracts. --- @@ -85,7 +85,7 @@ AIEN PROPOSES. OMEGA DEFINES. -PHYSICS REALIZES. +FORGE REALIZES. AEGIS VERIFIES. @@ -133,7 +133,7 @@ Where: │ - Semantic Graph (G_S) - Formal Program & Invariant Specification │ │ - Machine Graph (G_M) - Abstract Transformation Engine │ ├────────────────────────────────────────────────────────────────────────────────────────┤ -│ 2. PHYSICS: MACHINE PHYSICS & PHYSICAL REALIZATION COMPILER │ +│ 2. FORGE: MACHINE REALIZATION & PHYSICAL LOWERING COMPILER │ │ - AArch64 / Blackwell Lowering - Physical Memory & Page Table Management │ │ - SMMUv3 DMA & Bus Confinement - GPFIFO Command Packet Assembly │ │ - Coherent Memory Ring Dispatch - Hardware Constraint & Fact Feedback │ @@ -167,8 +167,8 @@ Where: * $\mathcal{G}_M$ (Machine Graph): The abstract hardware topology (registers, ALUs, Tensor Cores, cache latencies, bus bandwidths). * Formal Programs: Exact algebraic and structural transformations specifying desired state transitions without hardware-frozen opcodes. -### 2.4 Layer 4: Physics (Machine Physics: The Physical Realization Compiler) -* **Ontological Role:** Physics is the physical compiler and realizer of the machine. It understands concrete hardware constraints and lowers abstract Omega programs into physical silicon effects. +### 2.4 Layer 4: Forge (The Machine Realization Compiler) +* **Ontological Role:** Forge is the physical compiler and realizer of the machine. It understands concrete hardware constraints and lowers abstract Omega programs into physical silicon effects. * **Core Responsibilities:** 1. **Memory Lowering:** Translates abstract buffers into physical page table entries, managing fragmentation, huge pages, and alignment. 2. **DMA & Bus Confinement:** Configures SMMUv3 / PCIe IOMMU controllers to guarantee physical memory isolation. @@ -186,16 +186,16 @@ Where: 6. Did the hardware execution produce the contractually expected state? 7. Does the empirical evidence support what the system claims occurred? -### 2.6 The Bidirectional Lowering Protocol (OMEGA <-> PHYSICS <-> AEGIS) +### 2.6 The Bidirectional Lowering Protocol (OMEGA <-> FORGE <-> AEGIS) The compilation and execution path operates through an iterative dialogue: 1. **Intent Formulation:** AIEN proposes a desired state mutation or experiment. 2. **Semantic Formalization:** OMEGA defines the exact mathematical meaning and invariant bounds. -3. **Physical Lowering & Constraint Discovery:** PHYSICS compiles the OMEGA program to concrete hardware state (page tables, cache flushes, GPFIFO packets, register state). If a physical constraint is reached (e.g. non-contiguous allocation, alignment mismatch, or pinning requirement), PHYSICS communicates machine facts and realization alternatives back to OMEGA. +3. **Physical Lowering & Constraint Discovery:** FORGE compiles the OMEGA program to concrete hardware state (page tables, cache flushes, GPFIFO packets, register state). If a physical constraint is reached (e.g. non-contiguous allocation, alignment mismatch, or pinning requirement), FORGE communicates machine facts and realization alternatives back to OMEGA. 4. **Trade-off Resolution:** OMEGA (with AIEN when strategic) selects the optimal alternative and finalizes the program. 5. **Invariant Verification:** AEGIS verifies that the realization preserves semantic constraints, satisfies capability bounds and slot generations, maintains internal consistency, and has valid rollback or recovery paths. -6. **Hardware Execution:** PHYSICS dispatches the verified realization to hardware execution queues. +6. **Hardware Execution:** FORGE dispatches the verified realization to hardware execution queues. 7. **State Contract Inspection:** Hardware executes the state change. AEGIS validates the resulting hardware state against the contract. 8. **Evidence Ingestion:** The outcome is recorded into the immutable Evidence Ledger and fed back to AIEN. diff --git a/doctrine/FORGE.md b/doctrine/FORGE.md new file mode 100644 index 0000000..3559aad --- /dev/null +++ b/doctrine/FORGE.md @@ -0,0 +1,29 @@ +# DOCTRINE-FORGE: Machine Realization + +**Status:** AUTHORITATIVE / CANONICAL +**Effective:** 2026-09-27 +**Decision:** ADR 0014 + +FORGE is the physical realization and machine-lowering subsystem. + +```text +OMEGA + defines semantic meaning and constraints + ↓ +FORGE + discovers/constructs a machine realization + ↓ +AEGIS + verifies realization contracts and invariants + ↓ +HARDWARE + acts + ↓ +EVIDENCE +``` + +The relationship is bidirectional. If a requested realization conflicts with alignment, placement, capacity, queue, register, coherence, timing, or other machine constraints, FORGE returns machine facts and alternatives to OMEGA rather than silently changing semantic meaning. + +FORGE is not the kernel and is not the policy authority. AIENOS owns the trusted operating substrate. AEGIS verifies invariant/capability contracts. AIEN chooses goals and proposes strategies. OMEGA defines semantics. + +Historical PHYSICS milestone identifiers and evidence remain valid historical names and are not renamed. diff --git a/doctrine/INDEX.md b/doctrine/INDEX.md index 68c63a1..be22719 100644 --- a/doctrine/INDEX.md +++ b/doctrine/INDEX.md @@ -66,7 +66,7 @@ The `DOCTRINE_V1` corpus comprises seven canonical specifications located in [`/ ├───┼───────────────────┼──────────────────┼───────────────────────────────────────────────────────────┤ │ 1 │ ARCHITECTURE.md │ DOCTRINE-000 │ Sovereign Computational Architecture │ │ 2 │ ATLAS.md │ DOCTRINE-001 │ Atlas — The Irreducible Bootstrap Seed │ -│ 3 │ PHYSICS.md │ DOCTRINE-002 │ Physics — The Trusted Machine Authority │ +│ 3 │ FORGE.md │ DOCTRINE-002 │ Physics — The Trusted Machine Authority │ │ 4 │ OMEGA.md │ DOCTRINE-OMEGA │ The Omega Foundational Specification │ │ 5 │ AIEN.md │ DOCTRINE-004 │ AIEN Foundational Doctrine: Sovereign Cognitive Engine │ │ 6 │ TRUST.md │ DOCTRINE-005 │ Trust — Epistemic Verification Doctrine & Trust Boundaries│ @@ -106,7 +106,7 @@ The `DOCTRINE_V1` corpus comprises seven canonical specifications located in [`/ --- -### 3.3 [`PHYSICS.md`](file:///home/drakestapleton/workspace/aien-architecture/doctrine/PHYSICS.md) — DOCTRINE-002: Physics — The Trusted Machine Authority +### 3.3 [`FORGE.md`](file:///home/drakestapleton/workspace/aien-architecture/doctrine/FORGE.md) — DOCTRINE-002: Physics — The Trusted Machine Authority - **Document ID:** `DOCTRINE-002` - **Scope:** Physical execution governance, MMU/SMMUv3 management, hardware capability enforcement, and effect admission. - **Core Principles:** @@ -192,7 +192,7 @@ The power of `DOCTRINE_V1` lies in the airtight mathematical and operational coh │ Invariant │ Doctrinal Interaction │ ├──────────────────────────┼─────────────────────────────────────────────┤ │ 1. Intelligence != │ AIEN.md proposes; TRUST.md verifies; │ -│ Authority │ PHYSICS.md authorizes; ATLAS.md boots. │ +│ Authority │ FORGE.md authorizes; ATLAS.md boots. │ ├──────────────────────────┼─────────────────────────────────────────────┤ │ 2. Decoupling of Meaning │ OMEGA.md specifies invariant semantics; │ │ from Representation │ TRUST.md proves equivalence; │ @@ -202,11 +202,11 @@ The power of `DOCTRINE_V1` lies in the airtight mathematical and operational coh │ │ TRUST.md records Merkle digests; │ │ │ SOVEREIGNTY.md seals self-hosting closure. │ ├──────────────────────────┼─────────────────────────────────────────────┤ -│ 4. Separation of Proofs │ TRUST.md & PHYSICS.md enforce: │ +│ 4. Separation of Proofs │ TRUST.md & FORGE.md enforce: │ │ │ Integrity (unkeyed) != Auth (signed) != │ │ │ Freshness (monotonic hardware counters). │ ├──────────────────────────┼─────────────────────────────────────────────┤ -│ 5. Physical Confinement │ PHYSICS.md (SMMUv3) + AEGIS verifier │ +│ 5. Physical Confinement │ FORGE.md (SMMUv3) + AEGIS verifier │ │ under Malice │ strictly isolate untrusted AIEN execution. │ └──────────────────────────┴─────────────────────────────────────────────┘ ``` @@ -223,9 +223,9 @@ The `DOCTRINE_V1` Gate requires satisfying seven strict verification criteria be | :--- | :--- | :--- | :---: | | **G0-1: Corpus Completeness** | All seven foundational doctrine documents authored, formatted, and cross-referenced in `/home/drakestapleton/workspace/aien-architecture/doctrine/`. | Verified on physical filesystem. | `PASSED` | | **G0-2: Ontological Consistency** | Zero terminological or authority contradictions across documents. Unidirectional dependency hierarchy verified. | Cross-audit of layers and definitions. | `PASSED` | -| **G0-3: Epistemic Boundary** | Search, optimization, and neural inference strictly designated untrusted; verification and physics designated trusted. | Enforced in `TRUST.md` and `PHYSICS.md`. | `PASSED` | +| **G0-3: Epistemic Boundary** | Search, optimization, and neural inference strictly designated untrusted; verification and physics designated trusted. | Enforced in `TRUST.md` and `FORGE.md`. | `PASSED` | | **G0-4: Mathematical Rigor** | Formal definitions provided for Omega Tri-Graphs, Verification Ladder ($V_0 \to V_5$), and Epistemic Merkle DAGs. | Evaluated in `OMEGA.md` and `TRUST.md`. | `PASSED` | -| **G0-5: Hardware Realism** | Concrete alignment with AArch64 bare-metal (EL1/EL0, SMMUv3) and heterogeneous accelerator reset rails. | Fully specified in `PHYSICS.md` & `ATLAS.md`.| `PASSED` | +| **G0-5: Hardware Realism** | Concrete alignment with AArch64 bare-metal (EL1/EL0, SMMUv3) and heterogeneous accelerator reset rails. | Fully specified in `FORGE.md` & `ATLAS.md`.| `PASSED` | | **G0-6: Sovereignty Invariants** | Absolute prohibition of foreign runtimes in operational target; strict deprecation horizons for bootstrap scaffolds. | Formally codified in `SOVEREIGNTY.md`. | `PASSED` | | **G0-7: Provenance Anchoring** | Separation of Proofs established; unkeyed integrity, keyed auth, and anti-rollback freshness specified. | Codified in `TRUST.md` & `SOVEREIGNTY.md`.| `PASSED` | @@ -243,7 +243,7 @@ Target Substrate: AArch64 Host CPU + Blackwell/Hopper Accelerator Fabric Verified Corpus Elements: [✓] DOCTRINE-000: ARCHITECTURE.md (Sovereign Computational Architecture) [✓] DOCTRINE-001: ATLAS.md (The Irreducible Bootstrap Seed) - [✓] DOCTRINE-002: PHYSICS.md (The Trusted Machine Authority) + [✓] DOCTRINE-002: FORGE.md (The Trusted Machine Authority) [✓] DOCTRINE-OMEGA: OMEGA.md (The Omega Foundational Specification) [✓] DOCTRINE-004: AIEN.md (The Sovereign Cognitive Engine) [✓] DOCTRINE-005: TRUST.md (Epistemic Verification & Trust Boundaries) @@ -264,7 +264,7 @@ Sign-off Hash: 4a8b79e13d964fcf81ec0a1f9e2b1735cb0e4871d87a2cf956102a9 ### 4.1 The Synthesis Doctrine > **`AIEN PROPOSES.`** > **`OMEGA DEFINES.`** -> **`PHYSICS REALIZES.`** +> **`FORGE REALIZES.`** > **`AEGIS VERIFIES.`** > **`HARDWARE ACTS.`** > **`EVIDENCE TEACHES.`** @@ -318,3 +318,6 @@ AUTHORIZED PHYSICAL EFFECT ### 4.5 Sovereign Training Corpus Scoping > *Omega's sovereign search traces provide the cold-start training corpus for AIEN-0, removing the need for a foreign pretrained search-guide model or foreign procedural training corpus.* + + +> **Naming note:** current machine realization is FORGE under ADR 0014. Historical PHYSICS identifiers in milestone/evidence records remain valid provenance. diff --git a/doctrine/PHYSICS.md b/doctrine/PHYSICS.md index 301dc38..d56e774 100644 --- a/doctrine/PHYSICS.md +++ b/doctrine/PHYSICS.md @@ -1,360 +1,9 @@ -# DOCTRINE-002: PHYSICS — The Trusted Machine Authority +# Historical PHYSICS doctrine -```text -Document ID: DOCTRINE-002 -Milestone: Milestone 0 (DOCTRINE_V1) -Classification: Sovereign Machine Canonical Doctrine -Target Substrate: Physical Compute Fabric (AArch64 CPU Host, SMMUv3, PCIe Bus, Accelerators) -Status: AUTHORITATIVE / CANONICAL -``` +**Status: SUPERSEDED BY FORGE / HISTORICAL COMPATIBILITY** ---- +The current machine-realization subsystem is [FORGE](FORGE.md), ratified by [ADR 0014](../docs/adr/0014-rename-machine-physics-to-forge.md). -## 1. Executive Summary & The Physical Mandate +Do not use this file as current subsystem doctrine. -**Physics** is the Trusted Machine Authority and the Constitution of the Sovereign Machine. - -In the Sovereign Machine hierarchy, intelligence proposes, but Physics disposes. While cognitive layers (Aien, neural models, reasoning graphs) formulate desires, plans, and hypothetical transformations, they possess zero direct access to the physical substrate of reality. - -The fundamental, uncompromisable question answered by Physics is: - -$$\mathbf{\text{“What is allowed to become physically real?”}}$$ - -If an operation is not explicitly validated, authorized, and admitted by Physics, that operation cannot act upon physical memory, cannot mutate storage cells, cannot transmit photons or electrons across a network wire, and cannot command an accelerator core. Physics is the sole arbiter of physical existence on the machine. - -### 1.1 PHYSICS vs. PHYSICS ZERO: Canonical Distinction -It is an architectural violation to conflate the machine authority with the scientific discovery program: -- **`PHYSICS`**: **The Trusted Machine Authority.** The constitutional governor of silicon, CPU exception levels, memory isolation, SMMUv3 DMA protection, device registers, and the Effect Cycle. -- **`PHYSICS ZERO`**: **The Clean-Room Scientific Discovery Program.** An autonomous epistemological methodology wherein AIEN discovers the underlying structure of reality from raw observation without ever receiving human physical theories, constants, or terminology. See [`DISCOVERY.md`](file:///home/drakestapleton/workspace/aien-architecture/doctrine/DISCOVERY.md). - -```text -┌────────────────────────────────────────────────────────────────────────┐ -│ COGNITIVE & REASONING LAYERS │ -│ (Aien / Cortex / Agents / Model Inference) │ -│ │ -│ Formulates Desired State, Intent, Candidate Transformations │ -└───────────────────────────────────┬────────────────────────────────────┘ - │ - Requests Physical Effect - (EFFECT_INTENT + Token) - │ - ▼ -┌────────────────────────────────────────────────────────────────────────┐ -│ PHYSICS │ -│ (The Sovereign Machine Authority) │ -│ │ -│ "What is allowed to become physically real?" │ -│ │ -│ ┌───────────────┐ ┌────────────────┐ ┌──────────────────┐ │ -│ │ Capability │ ──> │ Physical State │ ──> │ Bounded Hardware │ │ -│ │ Authorization │ │ Invariant Gate │ │ Confinement │ │ -│ └───────────────┘ └────────────────┘ └──────────────────┘ │ -└───────────────────────────────────┬────────────────────────────────────┘ - │ - Admitted / Denied - │ - ▼ -┌────────────────────────────────────────────────────────────────────────┐ -│ PHYSICAL SUBSTRATE │ -│ (Silicon, Memory Bus, NVMe, SMMUv3, GPU Cores, NIC) │ -└────────────────────────────────────────────────────────────────────────┘ -``` - ---- - -## 2. Scope of Authority - -Physics exercises total, unshared jurisdiction over the physical resources of the hardware platform. Its authority encompasses thirteen distinct domains: - -```text - PHYSICS DOMAIN OF AUTHORITY -┌────────────────────────────────────────────────────────────────┐ -│ [1] Physical Memory Allocation, Page Tables & Isolation │ -│ [2] CPU Privilege Levels (EL2/EL1/EL0) & Context Switching │ -│ [3] Interrupt Routing, Virtualization & Prioritization │ -│ [4] Architectural Timers & Preemption Clocks │ -│ [5] Synchronous & Asynchronous Fault Confinement │ -│ [6] Device Ownership & Memory-Mapped I/O (MMIO) Registers │ -│ [7] Direct Memory Access (DMA) & IOMMU/SMMUv3 Translation │ -│ [8] Accelerator Lifecycle, Clocking, Queues & Reset │ -│ [9] Non-Volatile Storage Authority & Atomic Block Dispatch │ -│ [10] Network Interface Transmission & Egress Confinement │ -│ [11] Capability Ledger, Generation Tracking & Revocation │ -│ [12] Effect Admission Pipeline & Receipt Cryptography │ -│ [13] Hardware Root of Trust, Measurement & Safe Recovery │ -└────────────────────────────────────────────────────────────────┘ -``` - -### 2.1 The Thirteen Physical Domains - -1. **Memory Ownership**: Physics manages physical frame allocation, page table hierarchies (Stage 1 and Stage 2 translations), page attribute tables (`MAIR_EL1`), and memory type tags. No component may map or access memory without a valid memory capability. -2. **CPU Privilege**: Physics runs at the exception level declared by the machine contract (EL1 or EL2, no implicit EL2 -> EL1 transition), enforcing complete isolation between supervisor domains and unprivileged EL0 user-space runtimes. -3. **Interrupts**: Physics controls the Generic Interrupt Controller (GICv3/v4). It binds, prioritizes, filters, and delivers physical interrupts. No external process may mask or usurp hardware IRQs. -4. **Timers**: Physics configures physical and virtual timers (`CNTP_CTL_EL0`, `CNTV_CTL_EL0`). It enforces preemptive execution slicing and deadline tracking. -5. **Faults**: Physics traps all processor exceptions (Data Aborts, Instruction Aborts, Alignment Faults, Illegal Instructions). Faults are isolated to the offending domain; uncontained corruption triggers fail-safe quarantine. -6. **Device Ownership**: Peripheral devices (PCIe root complexes, controllers, diagnostic ports) are owned exclusively by Physics. Runtimes interact with devices through capability-mediated proxies. -7. **DMA & IOMMU/SMMU**: Physical peripherals and accelerators are strictly confined behind an IOMMU (ARM SMMUv3). Physics programs Stream Table Entries (STE) and Command Queues (CD). Direct, untranslated physical bus mastering by any peripheral is hardware-prohibited. -8. **Accelerator Lifecycle**: Accelerators (GPUs, NPUs, FPGAs) are managed peripherals. Physics governs power rails, clocks, PCIe link training, queue submission rings, watchdog timers, and hardware resets. -9. **Storage Authority**: Non-volatile storage (NVMe controllers, physical flash blocks) is accessed exclusively via Physics block dispatchers. Physics guarantees atomic multi-block transactions and durability barriers. -10. **Network Authority**: Physical network interfaces (PHY/MAC) and DMA ring buffers are owned by Physics. Network packets may only leave the machine if covered by an active `NETWORK_CAPABILITY`. -11. **Capability Management**: Physics is the sole issuer, validator, and revoker of cryptographic capability tokens. -12. **Effect Admission**: Every effect that transitions from a digital calculation into a physical state change must pass through the Physics admission gate. -13. **Roots of Trust & Recovery**: Physics holds the platform cryptographic identity, measures software components against hardware platform PCRs/TPM, and manages the deterministic reset/recovery state machine. - ---- - -## 3. What Physics Does NOT Own (The Non-Cognitive Boundary) - -The integrity of Physics depends on strict minimalism regarding higher-level semantics. Physics must never be contaminated with cognitive or heuristic responsibilities. - -```text - THE NON-COGNITIVE BOUNDARY -┌────────────────────────────────────────────────────────────────┐ -│ STRICTLY EXCLUDED FROM PHYSICS: │ -│ │ -│ [✗] Goals: Physics does not decide what the machine strives │ -│ for or prioritize human objectives. │ -│ [✗] Planning: Physics does not create strategies, dependency │ -│ graphs, or task decomposition pipelines. │ -│ [✗] Reasoning: Physics does not execute logic proofs, J-Space │ -│ traversals, or philosophical alignment checks. │ -│ [✗] Model Inference: Physics does not load model weights, │ -│ perform matrix multiplications, or sample logits. │ -│ [✗] Semantic Interpretation: Physics does not parse human │ -│ language, summarize text, or evaluate conversation tone. │ -│ [✗] Self-Improvement: Physics does not rewrite its own rules, │ -│ optimize its core laws, or mutate its own constitution. │ -│ [✗] Knowledge: Physics does not host the long-term semantic │ -│ memory graph (Cortex). It holds only physical state. │ -└────────────────────────────────────────────────────────────────┘ -``` - -Physics treats all cognitive workloads as untrusted or semi-trusted data transforms executing in bounded sandboxes. Whether an LLM generates brilliant literature or complete gibberish is irrelevant to Physics; Physics cares only whether the compute, memory, and I/O adhere to the granted capability envelope. - ---- - -## 4. The Boundary Test - -Whenever an architectural feature or engineering proposal is evaluated, architects must apply the canonical **Boundary Test**: - -$$\mathbf{\text{“Does this feature require direct authority over physical resources?”}}$$ - -```text - PROPOSED FEATURE - │ - ▼ - ┌─────────────────────────────────────┐ - │ Does this feature require direct │ - │ authority over physical resources? │ - └──────────────────┬──────────────────┘ - │ - ┌──────────────┴──────────────┐ - ▼ ▼ - [YES] [NO] - │ │ - ▼ ▼ - Belongs within PHYSICS Belongs in Higher Layers: - (Memory, CPU privilege, • Layer 2: Physical Fabric - SMMU, IRQ, Device MMIO, • Layer 3: Transformation IR - Clock/Reset, Capabilities) • Layer 4: AEGIS / Policy - • Layer 5: Intelligence / Model - • Layer 6: Desired State / Schema - • Layer 7: Human Intent -``` - -### 4.1 Boundary Decision Matrix - -| Architectural Feature | Physical Authority Required? | Architectural Home | Rationale | -| :--- | :--- | :--- | :--- | -| **Page Table Modification** | **YES** | **PHYSICS** | Mutates CPU MMU translation tables directly. | -| **KV Cache Eviction Policy** | **NO** | Layer 5 (Runtime) | Algorithmic heuristic deciding which tokens to discard; Physics provides the bounded memory pool. | -| **GPU Hardware Reset** | **YES** | **PHYSICS** | Direct PCIe Secondary Bus Reset / MMIO power cycling. | -| **Prompt Routing / Skill Selection**| **NO** | Layer 5 (Agent/Skill) | Semantic decision based on intent and task definition. | -| **NVMe Doorbell Ring Write** | **YES** | **PHYSICS** | Initiates physical controller DMA read/write. | -| **Cortex Semantic Document Indexing**| **NO** | Layer 5/6 (Cortex) | Data organization and vector similarity search. | -| **SMMUv3 Stream Table Configuration**| **YES** | **PHYSICS** | Hardware I/O virtualization and DMA confinement. | -| **Transformation IR Optimization** | **NO** | Layer 3 (Compiler) | Pure symbolic program transformation. | -| **Diagnostic UART Polled Output** | **YES** | **PHYSICS** | Direct physical I/O register write. | -| **Safety Policy Validation** | **NO** | Layer 4 (AEGIS) | Policy verification that formulates the `EFFECT_INTENT`. | - ---- - -## 5. Capability Architecture: No Ambient Authority - -Physics enforces a strict **Zero Ambient Authority** model. -No process, subsystem, or processor core possesses rights simply by virtue of who it is, where it was spawned, or what privilege level it previously occupied. Every physical action requires an unforgeable, explicitly presented, bounded **Capability**. - -```text -┌────────────────────────────────────────────────────────────────────────┐ -│ CANONICAL CAPABILITY RECORD │ -├───────────────────┬────────────────────────────────────────────────────┤ -│ Field │ Description │ -├───────────────────┼────────────────────────────────────────────────────┤ -│ `principal_id` │ Cryptographic identity of the holding entity │ -│ `resource_id` │ Concrete physical/logical asset identifier │ -│ `allowed_ops` │ Bitmask of authorized operations │ -│ `bounds` │ Strict spatial, temporal, and rate constraints │ -│ `generation` │ Monotonically increasing epoch counter │ -│ `lifetime` │ Expiration deadline (timestamp / cycle / single-use)│ -│ `revocation_state`│ `ACTIVE`, `SUSPENDED`, or `REVOKED` │ -│ `provenance` │ SHA-256 chain of parent capability derivations │ -└───────────────────┴────────────────────────────────────────────────────┘ -``` - -### 5.1 The Eleven Capability Classes - -```text -┌───────────────────────────┬────────────────────────────────────────────┐ -│ Capability Class │ Authority Granted │ -├───────────────────────────┼────────────────────────────────────────────┤ -│ `MEMORY_CAPABILITY` │ Read/write/execute specific physical frames│ -│ `EXECUTION_CAPABILITY` │ CPU core time slice, priority, affinity │ -│ `MEASUREMENT_CAPABILITY` │ Hardware counters, telemetry, energy read │ -│ `STORAGE_CAPABILITY` │ Read/write bounded LBA range on block store│ -│ `NETWORK_CAPABILITY` │ Transmit/receive on bounded network port/IP│ -│ `DEVICE_CAPABILITY` │ Access bounded MMIO peripheral register bar│ -│ `GPU_QUEUE_CAPABILITY` │ Submit command buffers to accelerator ring │ -│ `DMA_CAPABILITY` │ Bind memory to SMMUv3 stream table entry │ -│ `INTERRUPT_CAPABILITY` │ Bind and handle specific hardware IRQ line │ -│ `EFFECT_CAPABILITY` │ Request external physical mutation │ -│ `VERIFICATION_CAPABILITY` │ Sign, attest, or inspect Root of Trust │ -└───────────────────────────┴────────────────────────────────────────────┘ -``` - -### 5.2 Capability Invariants -1. **Unforgeability**: Capabilities are stored in a dedicated, kernel-protected memory structure inaccessible to unprivileged code, or authenticated via hardware-rooted HMAC/signatures. -2. **Monotonic Narrowing**: A capability may be derived (split or reduced in scope) by its holder, but child capabilities can **never** exceed the rights, bounds, or lifetime of their parent. -3. **Instantaneous Revocation**: When Physics increments the generation counter or marks a capability record as `REVOKED`, all subsequent attempts to exercise that token fail immediately. -4. **Temporal Expiration**: Capabilities default to bounded lifetimes. Persistent ambient access does not exist. - ---- - -## 6. The Effect Cycle - -Every interaction that attempts to manifest a change in the physical world must traverse the formal, deterministic **Effect Cycle**. A change that bypasses this cycle is physically impossible under Physics. - -```text - ┌─────────────────┐ - │ EFFECT_INTENT │ (Declared by Principal: Desired physical mutation) - └────────┬────────┘ - │ - ▼ - ┌─────────────────┐ - │ Authenticate │ (Verify cryptographic identity of caller) - └────────┬────────┘ - │ - ▼ - ┌─────────────────┐ - │ Capability Check│ (Check valid, unrevoked, unexpired capability) - └────────┬────────┘ - │ - ▼ - ┌─────────────────┐ - │ Verify │ (Validate physical invariants, constraints, safety bounds) - └────────┬────────┘ - │ - ┌────┴────┐ - ▼ ▼ - [DENY] [ADMIT] - │ │ - │ ▼ - │ ┌──────────────────┐ - │ │ Bounded Execution│ (Execute under strict SMMU / timer confinement) - │ └────────┬─────────┘ - │ │ - │ ▼ - │ ┌──────────────────┐ - │ │ Measure │ (Sample physical sensors, telemetry, state diff) - │ └────────┬─────────┘ - │ │ - ▼ ▼ - ┌─────────────────────────┐ - │ EFFECT_RECEIPT │ (Cryptographically signed proof of execution/rejection) - └─────────────────────────┘ -``` - -### 6.1 Effect Cycle Stages - -1. **`EFFECT_INTENT`**: The principal formulates a structured request declaring the target resource, requested action, arguments, and required bounds. -2. **Authenticate**: Physics verifies the principal's cryptographic signature and validates its identity against the active domain ledger. -3. **Capability Check**: Physics validates that the principal currently holds an unrevoked capability matching the requested resource, operation, and bounds. -4. **Verify**: Physics performs formal invariant checking. Are physical resources available? Does the effect violate machine thermal or memory constraints? -5. **Admit / Deny**: - - If validation fails, Physics issues a `DENY` receipt with an explicit rejection code and logs the anomaly. - - If validation succeeds, Physics admits the operation, arming hardware watchdogs and SMMU isolation windows. -6. **Bounded Execution**: The operation executes on the physical hardware within strictly bounded limits (time slice, memory limits, bandwidth throttle). -7. **Measure**: Physics measures the physical outcome—registers modified, bytes transferred, energy consumed, and hardware telemetry. -8. **`EFFECT_RECEIPT`**: Physics generates an immutable, cryptographically signed `EFFECT_RECEIPT` recording the exact inputs, outcome, duration, and resulting state digest. This receipt is delivered back to the caller and committed to the machine audit ledger. - ---- - -## 7. CPU Governance vs GPU Cognition - -Modern sovereign computing is defined by an asymmetry of trust between the CPU and the accelerator fabric (GPU/NPU). Physics formalizes this relationship: - -$$\mathbf{\text{CPU}} \equiv \text{Trusted Physical Governor} \quad \longleftrightarrow \quad \mathbf{\text{GPU}} \equiv \text{Semi-Trusted Cognitive Accelerator}$$ - -```text -┌────────────────────────────────────────────────────────────────────────┐ -│ CPU: TRUSTED GOVERNOR │ -│ │ -│ • Executes Physics Kernel at EL1/EL2 │ -│ • Controls Platform MMU, SMMUv3, PCIe Root Complex │ -│ • Controls Power Rails, Clocks, PCIe Reset Lines │ -│ • Dispatches, Monitors, and Enforces Watchdogs │ -│ │ -│ │ Watchdog Heartbeat ▲ GPU Failure / Hang │ -│ │ Submission Doorbell │ Interrupt (AER / Fence) │ -│ ▼ │ │ -├────────────────────────────────────────────────────────────────────────┤ -│ GPU: COGNITIVE ACCELERATOR │ -│ │ -│ • High-throughput matrix math, tensor cores, KV cache │ -│ • Semi-trusted execution context (runs complex generated kernels) │ -│ • Completely confined behind SMMUv3 (Zero Direct Physical Memory) │ -│ • Subject to immediate preemption, queue purge, and hardware reset │ -└────────────────────────────────────────────────────────────────────────┘ -``` - -### 7.1 Principles of Accelerator Confinement - -1. **No Ambient Host Memory Access**: The GPU has zero direct access to host physical memory. All memory accessible to the GPU must be explicitly mapped through the ARM SMMUv3 using a valid `DMA_CAPABILITY`. Any unmapped GPU read or write triggers an SMMU Translation Fault, interrupting the CPU. -2. **Command Buffer Isolation**: The cognitive runtime cannot write directly to physical GPU control registers. It writes command buffers into bounded memory. Physics validates the submission against a `GPU_QUEUE_CAPABILITY` before ringing the hardware doorbell. -3. **Watchdog Heartbeat**: Every dispatched GPU queue is bound to a strict hardware timer. If the GPU fails to signal a completion fence within the allotted microsecond budget, Physics declares a **GPU Hang Event**. -4. **Instantaneous Capability Revocation**: Upon detection of a hang, invalid memory access, or PCIe Advanced Error Reporting (AER) anomaly, Physics immediately revokes all active capabilities associated with the offending GPU queue. -5. **Physical GPU Reset**: - - Physics asserts PCIe Function Level Reset (FLR) or initiates a Secondary Bus Reset (SBR) over the PCIe root complex. - - Power rails and clocks are cycled to purge all internal GPU SRAM and register state. -6. **Queue Recovery & Scrubbing**: - - In-flight host buffers are unmapped from the SMMUv3 and zero-scrubbed. - - The GPU firmware is re-verified against its canonical measurement hash. - - The healthy CPU state resumes or migrates pending tasks, guaranteeing that a crashed or rogue GPU kernel can never bring down the Sovereign Machine. - ---- - -## 8. Failure and Catastrophic Recovery - -Physics is built under the assumption that hardware components fail, memory cells decay, and untrusted software attempts violations. - -### 8.1 The Invariant Recovery Hierarchy -1. **Domain Isolation**: When an unprivileged domain or user-space runtime violates a capability or triggers an exception, Physics isolates the domain, revokes its tokens, and reclaims its memory frames without impacting unrelated domains. -2. **Thermal & Electrical Throttle**: If hardware temperature or voltage exceeds safe operational bounds, Physics overrides all performance profiles, throttling clocks or dropping accelerator power stages to preserve silicon integrity. -3. **Cryptographic Panic & Seal**: If physical tampering, unauthorized hardware bus snooping, or uncorrectable memory corruption (ECC multi-bit fault) is detected, Physics: - - Zeroizes all cryptographic keys and active capability tables. - - Emits a high-priority diagnostic beacon on the polled UART console. - - Transitions into a fail-closed terminal state (`halt_error`), refusing all further instruction execution. - ---- - -## 9. Canonical Invariant Checklist - -Before declaring Milestone 0 complete for Physics, the following invariants must be verified: - -- [ ] Zero ambient authority is enforced; every physical action requires an explicit capability. -- [ ] No higher-level semantic reasoning, model weights, or planning algorithms exist inside Physics. -- [ ] All DMA transactions from peripherals/accelerators are strictly confined behind ARM SMMUv3. -- [ ] Every physical state mutation completes the formal 8-stage Effect Cycle. -- [ ] GPU queues are governed by hardware watchdogs with automated FLR/SBR reset triggers. -- [ ] Capabilities support instantaneous generation-based revocation. -- [ ] Complete isolation between CPU supervisor mode (EL1) and unprivileged execution (EL0). -- [ ] Failure paths are fail-closed: anomalous states freeze physical mutation and record evidence. +Historical milestone identifiers, receipts, artifact names, and repository history that contain `PHYSICS` remain unchanged because they are provenance. diff --git a/doctrine/ROADMAP.md b/doctrine/ROADMAP.md index d7880b3..e6144c7 100644 --- a/doctrine/ROADMAP.md +++ b/doctrine/ROADMAP.md @@ -3,7 +3,7 @@ ```text Document ID: DOCTRINE-ROADMAP Classification: Sovereign Machine Canonical Doctrine (Single Roadmap Source) -Target Substrate: Complete Sovereign Stack (Atlas -> Physics -> Omega -> Aien) +Target Substrate: Complete Sovereign Stack (Atlas -> AIENOS -> AIEN / OMEGA / FORGE / AEGIS) Status: AUTHORITATIVE / CANONICAL ``` @@ -17,7 +17,7 @@ This file is the **single authoritative source** for Sovereign Machine milestone - Milestone status is changed **only** here. A status change must cite the qualifying evidence (issue, PR, or receipt). - `scripts/check_doctrine.sh` enforces this: it fails if another doctrine page duplicates the roadmap table, carries its own milestone status tags, or cites a milestone code identifier under a milestone number different from the one below. -Status vocabulary: +> **Historical naming rule:** ADR 0014 renames the current machine-realization subsystem to **FORGE**. Existing milestone identifiers such as `PHYSICS_BOOT`, `PHYSICS_EFFECTS`, and `PHYSICS_ACCELERATOR_LINK` remain unchanged because milestone/evidence identity is historical provenance.\n\nStatus vocabulary: | Status | Meaning | | :--- | :--- | @@ -51,7 +51,7 @@ Status vocabulary: | **M16** | Accelerator Cognition Substrate | `BLACKWELL_NATIVE_PATH_KNOWN` | Empirical execution characterization of native Blackwell GB10 submission architecture (MMIO, GPFIFO queues, doorbells, completions). Correctively requalified 2026-09-26 under `aien-dev/physics` without libcuda (implementation `a2c0d7f...`, receipt `evidence/m16-blackwell-native-path-requalification-receipt.json`, canonical `b64753d...`). | COMPLETE / CORRECTIVELY REQUALIFIED | | **M17** | Accelerator Cognition Substrate | `OMEGA_BLACKWELL_VECTOR` | Verified native Blackwell sm_121 vector compute realization bound to the $G_S$ semantic contract, using a canonical verified machine-code artifact and dynamically synthesized QMD, parameter bindings, and native submission. Qualified on physical DGX Spark GB10 silicon under `aien-dev/omega` (implementation `27971cd`, receipt `43f725e`). | COMPLETE / SILICON QUALIFIED | | **M18** | Accelerator Cognition Substrate | `OMEGA_BLACKWELL_MATMUL` | Verified native Blackwell tensor matrix multiplication with dynamic sm_121 code generation and tensor core acceleration. Qualified on physical DGX Spark GB10 silicon under `aien-dev/omega` (implementation `9421737`, receipt `87349c0`). | COMPLETE / SILICON QUALIFIED | -| **M19** | Accelerator Cognition Substrate | `OMEGA_ACCELERATOR_RESIDENT` | Persistent Omega execution substrate residing in accelerator-accessible coherent memory. | IN PROGRESS | +| **M19** | Accelerator Cognition Substrate | `OMEGA_ACCELERATOR_RESIDENT` | Persistent Omega execution substrate residing in accelerator-accessible coherent memory. | REOPENED / IN PROGRESS | | **M20** | Sovereign Training Runtime | `OMEGA_TENSOR` | Tensor semantics, multi-dimensional array types, strides, and memory layouts. | PLANNED | | **M21** | Sovereign Training Runtime | `OMEGA_AUTODIFF` | Sovereign automatic differentiation generating gradient semantic graphs. | PLANNED | | **M22** | Sovereign Training Runtime | `OMEGA_OPTIMIZER` | Verified sovereign optimizer realizations (SGD, Adam, AdamW). | PLANNED |