diff --git a/README.md b/README.md index 07fe694..01a5d34 100644 --- a/README.md +++ b/README.md @@ -1,80 +1,92 @@ # aegis-runtime -aegis-runtime is an agent runtime written in native Rust: a local gateway (WebSocket, server-sent events and REST on port 18096), a heartbeat loop that claims and runs queued tasks, a dependency-aware task workflow, and SQLite storage. It sends model calls to a local OpenAI-compatible model server when started with `--inference http`; the default `--inference embedded` backend is a mock that loads no model and ignores `--model-path` and `--tokenizer-path`. +aegis-runtime is an agent runtime written in Rust. It builds one program, `aegis`. That program runs a local gateway (WebSocket, server-sent events and REST on port 18096), a heartbeat loop that claims and runs queued tasks, a dependency-aware task workflow, and SQLite storage. With `--inference http` it sends model calls to a local OpenAI-compatible model server. The default, `--inference embedded`, is a mock: it loads no model and ignores `--model-path` and `--tokenizer-path`. -An attachment of [Aienix](https://github.com/aien-dev/aienix), the core tree of AIEN. It lives in its own repository and plugs into the core at a boundary. +## Where it fits in AIEN -**Status (2026-10-18): pre-alpha, version 0.2.0, not part of the WHOLE-SYSTEM-E2E v1 release** (Drake, 2026-10-10). The production runtime in [aien-sovereign-core](https://github.com/aien-dev/aien-sovereign-core) carries the mandatory capability checks, the approval desk, effect authorization and fail-closed behaviour, and WHOLE-SYSTEM-E2E measures them there. The last merged changes (2026-10-15 and 2026-10-16) removed Modular MAX and Mojo and moved testing to AIEN's Spark pipeline ([docs/PIPELINE.md](docs/PIPELINE.md)). Open pull requests propose more workflow work for delegated tasks (G1 to G6); none of it is on `main`. +aegis-runtime is an attachment of [Aienix](https://github.com/aien-dev/aienix), the core tree of AIEN. It lives in its own repository and plugs into the core at a boundary. -## Copyright +- [aien-dev/aien-protocols-mv](https://github.com/aien-dev/aien-protocols-mv): the shared protocol crates. This repository needs a checkout of it to build (see Build). +- [aien-dev/aien-sovereign-core-mv](https://github.com/aien-dev/aien-sovereign-core-mv): the production runtime. It also holds the Spark test tools (`tools/aien-test`, `tools/aien-local-ci`). +- [aien-dev/aien-receipts](https://github.com/aien-dev/aien-receipts): where the Spark publishes signed test results for this repository. -Copyright (c) 2026 Drake Stapleton and AIEN Contributors. Authored by Drake Stapleton in collaboration with AIEN. +## Status (2026-10-19) + +- **Pre-alpha, version 0.2.0** (`Cargo.toml`). +- **Not part of the WHOLE-SYSTEM-E2E v1 release** (Drake, 2026-10-10). The production runtime in aien-sovereign-core carries the mandatory capability checks, the approval desk, effect authorization and fail-closed behaviour, and WHOLE-SYSTEM-E2E measures them there. +- **No published release of 0.2.0.** The GitHub release `v0.1.0` (2026-09-20) is from before the rename from OpenClaw. `v0.2.0` is an unpublished draft from 2026-09-19. +- **Recent changes on `main`:** Modular MAX and Mojo removed (#49, 2026-10-15). The Spark became the test judge (#51, 2026-10-16). rustls updated to 0.23.46 for four security advisories (#66, 2026-10-18). The hosted test workflows were removed, so the Spark is now the only place tests run (#69, 2026-10-18). +- **Merged on 2026-10-19:** docs/PIPELINE.md describes phase 3 as finished (#71), and the `.crumb` files stopped storing generated data; the crumb tool computes it on demand (#70). +- **Open, not on `main`:** the delegated task workflow work G1 to G6 (pull requests #60 to #65, tracked in issue #53). ## Architecture ``` +-----------------------------+ | atlas-vault client | - | (No Secrets on Disk) | + | (no secrets on disk) | +--------------+--------------+ | +---------------------------+ +--------------v--------------+ +-----------------------------+ -| Axum Control Plane | | Heartbeat Engine | | Local model seat (optional)| -| - Port 18096 | <-> | - Autonomous Tick [2] | <-> | - Port 18006 | -| - WebSockets & SSE | | - State Machine | | - GB10 Local Weights | -| - REST API | | - Task Evaluation | | - TTFT per model [1] | +| Axum control plane | | Heartbeat engine | | Local model seat (optional)| +| - port 18096 | <-> | - tick loop [1] | <-> | - port 18006 | +| - WebSocket and SSE | | - claims queued tasks | | - any OpenAI-compatible | +| - REST API | | - runs and records them | | server | +---------------------------+ +--------------+--------------+ +-----------------------------+ | +--------------v--------------+ - | Rust Vector Math | - | - Vector Cosine & Entropy | - | - SQLite WAL Persistence | + | Rust vector math | + | SQLite (WAL mode) | +-----------------------------+ ``` -[1] Measured TTFT depends on the model. For example, Nemotron 3.5 Lightning 30B measured 426.91 ms (`data/benchmarks_20260919.json` in [aien-dev/benchmarks](https://github.com/aien-dev/benchmarks)). That repository has withdrawn the figure: it predates its evidence standard and has not been regenerated. - -[2] The tick interval is 30 seconds for `aegis heartbeat` and 60 seconds for `aegis serve` unless `--heartbeat-secs` is set. +[1] The tick interval is 30 seconds for `aegis heartbeat` and 60 seconds for `aegis serve` unless `--heartbeat-secs` is set (`aegis --help`). -## Core Subsystems +## Core subsystems -1. **Axum Control Plane**: - Full duplex WebSockets (`/ws`, `/api/v1/ws`), Server-Sent Events (`/api/v1/events`, `/events`), and REST APIs on port 18096: `/api/v1/chat`, `/api/v1/agent/run`, `/api/v1/heartbeat/tick`, `/api/v1/tasks`, `/api/v1/skills`, `/api/v1/shell`, `/api/v1/discord/relay`, plus OpenAI-style `/v1/chat/completions` and `/v1/models`, and `/v1/probe`. +1. **Axum control plane** (`src/gateway.rs`). + WebSockets (`/ws`, `/api/v1/ws`), server-sent events (`/api/v1/events`, `/events`), and REST on port 18096: `/health`, `/api/v1/health`, `/api/v1/chat`, `/api/v1/agent/run`, `/api/v1/heartbeat/tick`, `/api/v1/tasks`, `/api/v1/skills`, `/api/v1/skills/execute`, `/api/v1/shell`, `/api/v1/discord/relay`, plus OpenAI-style `/v1/chat/completions` and `/v1/models`, and `/v1/probe`. -2. **Heartbeat Engine**: - Autonomous polling loop (30 seconds under `aegis heartbeat`, 60 seconds by default under `aegis serve`) that claims pending tasks, runs them, and emits a pulse receipt. +2. **Heartbeat engine** (`src/heartbeat.rs`). + A polling loop that claims each pending task before running it, runs it, and emits a pulse receipt. -3. **Local Model Seat Inference** (optional): - With `--inference http`, requests go to the OpenAI-style endpoint given by `--model-url` (default `http://127.0.0.1:18006/v1/chat/completions`) using the model name `atlas-lightning-omni`. Without it, the mock backend answers. The mock (`MockInferenceClient` from aien-protocols) returns a mock answer and loads no model. +3. **Local model seat inference** (optional, `src/inference.rs`). + With `--inference http`, requests go to the OpenAI-style endpoint given by `--model-url` (default `http://127.0.0.1:18006/v1/chat/completions`) with the model name `atlas-lightning-omni`. Without it, the mock backend (`MockInferenceClient` from aien-protocols) answers. `aegis status` then reports the backend as `mock-protocol-model`; the words "NativeTransformer" in that output name the mock, not a real model. Port 18006 was the old Modular MAX serving endpoint. A queued `model_health` heartbeat task (or one still queued under its old name `max_health`) checks the model seat through the configured backend, or polls `http://127.0.0.1:18006/v1/models` directly when no backend is set, and reports whether anything answers on port 18006. The project does not use MAX or CUDA on its production path (decision of 2026-10-02); the production runtime in aien-sovereign-core runs its GPU path through AIEN's own Omega kernels. -4. **Vector Math**: - Vector cosine similarity, Shannon entropy, linear projection, and temperature scaling in plain Rust (`src/vector_math.rs`). +4. **Vector math** (`src/vector_math.rs`). + Cosine similarity, Shannon entropy, linear projection and temperature scaling in plain Rust. -5. **Secret resolution**: - No plaintext secret files. `VaultResolver` asks `atlas-vault`, then keeps the value in memory. It is a client of that provider, not a TPM. The process environment is read only when `AIEN_DEV_SECRET_FALLBACK=1`. Output is redacted with `[REDACTED_BY_ATLAS_VAULT]`. +5. **Secret resolution** (`src/vault.rs`). + No plaintext secret files. `VaultResolver` asks `atlas-vault`, then keeps the value in memory. It is a client of that provider, not a TPM (a hardware security chip). The process environment is read only when `AIEN_DEV_SECRET_FALLBACK=1`. Output is redacted with `[REDACTED_BY_ATLAS_VAULT]`. -6. **SQLite Persistence**: - Embedded SQLite store running in Write-Ahead-Logging (WAL) mode for transactional task and message durability. +6. **SQLite persistence** (`src/persistence/`). + An embedded SQLite store in write-ahead-logging (WAL) mode, so task and message writes survive a crash. -7. **Task workflow and failure handling**: +7. **Task workflow and failure handling.** A dependency-aware task workflow ([docs/WORKFLOW-DAG.md](docs/WORKFLOW-DAG.md)) and structured agent failure records with effect-safe retry rules ([docs/FAILURE-PROVENANCE.md](docs/FAILURE-PROVENANCE.md)). -## Build and Execution +## Build ### Prerequisites -- A stable Rust toolchain (`cargo`); the crate uses edition 2021 -- A checkout of [aien-dev/aien-protocols](https://github.com/aien-dev/aien-protocols) next to this one at `../aien-protocols` (six path dependencies in `Cargo.toml`) -- Optional: an OpenAI-compatible model server on port 18006 (the local model seat), only for `--inference http` -- Linux aarch64 (Grace Blackwell GB10) or x86_64 -### Compilation +- A stable Rust toolchain (`cargo`). The crate uses edition 2021. +- A checkout of [aien-dev/aien-protocols-mv](https://github.com/aien-dev/aien-protocols-mv) next to this one, in a folder named `aien-protocols`. `Cargo.toml` has six path dependencies on `../aien-protocols/crates/`. +- Optional: an OpenAI-compatible model server on port 18006 (the local model seat), only for `--inference http`. +- Linux. The Spark test runs are on aarch64 (Grace Blackwell GB10). The release workflow (`.github/workflows/release.yml`) builds Linux x86_64. + +### Get the code and compile + ```bash +git clone https://github.com/aien-dev/aegis-runtime-mv aegis-runtime +git clone https://github.com/aien-dev/aien-protocols-mv aien-protocols +cd aegis-runtime cargo build --release ``` -### Running the Gateway +### Run the gateway + ```bash # Operator token: at least 32 printable characters, kept out of the repo. export AEGIS_OPERATOR_TOKEN="$(head -c 32 /dev/urandom | od -An -tx1 | tr -d ' \n')" @@ -87,28 +99,41 @@ Security defaults: - Skills and shell commands run only from an allowlist: the registered skill names, and for shell exactly `git status`, `git diff`, `git log -1 --oneline`, `ls`. - Probe gating runs on every skill and shell call. `AIEN_PROBE_ENFORCE` takes a number above 0.5 and up to 1.0 and can only raise the threshold; any other value keeps the default of 0.5, so it cannot turn gating off. -### CLI Commands +### CLI commands + +`aegis --help` lists `serve`, `tick`, `heartbeat`, `ask`, `agent`, `simd` and `status`. Examples, run from the build folder: + ```bash -# Execute a single autonomous tick -aegis tick +# Run a single heartbeat tick +./target/release/aegis tick # Run the heartbeat loop on its own (30 second default) -aegis heartbeat +./target/release/aegis heartbeat # Send one prompt to the inference backend (add --inference http to reach the local model seat) -aegis ask "Analyze system health and pending tasks" +./target/release/aegis ask "Analyze system health and pending tasks" # Run an agent task with multi-turn tool calling (default 8 turns) -aegis agent "Summarize the repository status" --max-turns 8 +./target/release/aegis agent "Summarize the repository status" --max-turns 8 -# Check engine status -aegis status +# Show runtime status +./target/release/aegis status # Print a small vector math evaluation -aegis simd --steps 10 +./target/release/aegis simd --steps 10 ``` -## Mathematical verification +Commands that use storage write `aegis.sqlite` in the current folder unless `--db-path` is set. + +## Test + +The full test suite, as the Spark runs it: + +```bash +cargo test -- --test-threads=1 +``` + +On 2026-10-19 this passed 158 tests on the Spark at commit `08ea496` (55 library tests plus 103 in `tests/*.rs`). The vector math functions are checked against an analytical reference and the committed vectors in `tests/fixtures/simd_math_vectors.json`: @@ -116,6 +141,26 @@ The vector math functions are checked against an analytical reference and the co cargo test --lib vector_math::tests::test_analytical_parity ``` +### Gates and where the evidence lives + +Every test that decides a merge runs on the DGX Spark, not on GitHub ([docs/PIPELINE.md](docs/PIPELINE.md)). The gates are the files in `tests/gates/`. Each one calls `tests/gates/run.sh` with one step word, so you can run any of them by hand: + +```bash +tests/gates/run.sh fmt +tests/gates/run.sh check +tests/gates/run.sh clippy +tests/gates/run.sh test +tests/gates/run.sh zero-disk-secrets +tests/gates/run.sh anti-slop +tests/gates/run.sh crumb-verify +``` + +The last one needs the `crumb` tool on your `PATH` (or set `CRUMB`). `.aien/always` lists the gates that run on every commit: `CRUMB-VERIFY`, `AEGIS-ZERO-DISK-SECRETS` and `AEGIS-ANTI-SLOP`. + +The Spark signs each result and publishes it to [aien-dev/aien-receipts](https://github.com/aien-dev/aien-receipts/tree/main/aegis-runtime), one folder per tested commit. The only required GitHub check, `AIEN Verification`, verifies that signed result. + ## License +Copyright (c) 2026 Drake Stapleton and AIEN Contributors. Authored by Drake Stapleton in collaboration with AIEN. + Licensed under the GNU Affero General Public License v3.0 or later (AGPL-3.0-or-later). See [LICENSE](LICENSE). Project values live in the nonbinding [COVENANT.md](COVENANT.md), which grants and restricts no legal rights.