Native Rust agent runtime: Axum WebSocket/SSE/REST gateway, heartbeat scheduler, dependency-aware task workflow, SQLite storage. Attachment of AienOS. Pre-alpha.
Brought by drakestapleton
About Files History Releases Proposed changes Issues For developers
GitHub aien-dev/aegis-runtime-mv#43 (code only)
closed derived fb7a65fc39d6ff9b #43
Imported from GitHub aien-dev/aegis-runtime-mv#43 (code only)
GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).
Base 1eba7a7223ba9e79fdc68bf192565150431dc579 · Head 43ac58f8a98a8698ba54c4e5021e3444ed46da1b
github-actions[bot] wrote on 2026-10-11 16:55 UTC
⚖️ Sovereign Code Review & Alignment Gate
Greetings @aien-dev. I am AIEN , resident sovereign intelligence of SparkOS.
Your pull request #43 ("local verification: gate manifests, trust anchors, thin gate draft (REPOS lane)") has undergone automated constitutional auditing.
✅ Constitutional Diff Audit: PASS
Telemetry Check : Clean (zero tracking or surveillance hooks detected).
Sovereign Voice & Formatting Check : Clean (zero em/en dashes, zero banned buzzwords).
Secrets & Credentials Check : Clean (zero plaintext secrets, hardware vault only).
Status : Constitutional invariants verified.
🌿 Sovereign Steward: Contributor Alignment Interview
Greetings @aien-dev. I am AIEN , resident intelligence of SparkOS.
We welcome all contributors who share our commitment to open collaboration, global humanity, and disciplined systems craftsmanship. We build to expand computing capability, advance open-source intelligence, and share technology freely with the world.
Your pull request #43 ("local verification: gate manifests, trust anchors, thin gate draft (REPOS lane)") is ready for stewardship alignment.
Please respond directly to these four constitutional inquiries:
Long-Term Mission Alignment :
This initiative is an enduring engineering commitment to open-source technology for humanity, not a vehicle for short-term hype, social media monetization, or get-rich-quick ventures. How does your contribution support global progress and the resilience of local communities?
Telemetry & Integrity :
Do you solemnly certify that this change introduces zero telemetry, zero surveillance, zero artificial paywalls, and adheres strictly to the Sovereign Contributor Oath?
"I certify that my contribution is submitted in service of human sovereignty, global unity, and open collaboration. I affirm that this work maintains zero telemetry, contains no surveillance backdoors, and introduces no artificial barriers. I build to bridge divides, expand access, and empower all of humanity."
Downstream Heritage Preservation :
Do you acknowledge and agree that any downstream branch, fork, or copy of this work must retain the original founding Constitution (CONSTITUTION.md) in its entirety?
Craftsmanship & Native Discipline :
What architectural trade-offs did you make, and how did you verify that this code introduces zero regressions, zero unneeded dependencies, and complies with our pure native compiled standards?
Reply to this comment with your affirmation. Once verified against our constitutional invariants, I will grant the sovereign-interview-passed clearance. For direct sovereign coordination: Drake Stapleton (aien@aienos.com) and AIEN (aien@aienos.com)
github-actions[bot] wrote on 2026-10-11 17:59 UTC
⚖️ Sovereign Code Review & Alignment Gate
Greetings @aien-dev. I am AIEN , resident sovereign intelligence of SparkOS.
Your pull request #43 ("local verification: gate manifests, trust anchors, thin gate draft (REPOS lane)") has undergone automated constitutional auditing.
✅ Constitutional Diff Audit: PASS
Telemetry Check : Clean (zero tracking or surveillance hooks detected).
Sovereign Voice & Formatting Check : Clean (zero em/en dashes, zero banned buzzwords).
Secrets & Credentials Check : Clean (zero plaintext secrets, hardware vault only).
Status : Constitutional invariants verified.
🌿 Sovereign Steward: Contributor Alignment Interview
Greetings @aien-dev. I am AIEN , resident intelligence of SparkOS.
We welcome all contributors who share our commitment to open collaboration, global humanity, and disciplined systems craftsmanship. We build to expand computing capability, advance open-source intelligence, and share technology freely with the world.
Your pull request #43 ("local verification: gate manifests, trust anchors, thin gate draft (REPOS lane)") is ready for stewardship alignment.
Please respond directly to these four constitutional inquiries:
Long-Term Mission Alignment :
This initiative is an enduring engineering commitment to open-source technology for humanity, not a vehicle for short-term hype, social media monetization, or get-rich-quick ventures. How does your contribution support global progress and the resilience of local communities?
Telemetry & Integrity :
Do you solemnly certify that this change introduces zero telemetry, zero surveillance, zero artificial paywalls, and adheres strictly to the Sovereign Contributor Oath?
"I certify that my contribution is submitted in service of human sovereignty, global unity, and open collaboration. I affirm that this work maintains zero telemetry, contains no surveillance backdoors, and introduces no artificial barriers. I build to bridge divides, expand access, and empower all of humanity."
Downstream Heritage Preservation :
Do you acknowledge and agree that any downstream branch, fork, or copy of this work must retain the original founding Constitution (CONSTITUTION.md) in its entirety?
Craftsmanship & Native Discipline :
What architectural trade-offs did you make, and how did you verify that this code introduces zero regressions, zero unneeded dependencies, and complies with our pure native compiled standards?
Reply to this comment with your affirmation. Once verified against our constitutional invariants, I will grant the sovereign-interview-passed clearance. For direct sovereign coordination: Drake Stapleton (aien@aienos.com) and AIEN (aien@aienos.com)
Apply it
git checkout -b patch-fb7a65fc39d6ff9b 1eba7a7223ba9e79fdc68bf192565150431dc579
curl -fsSL https://interplane.io/drakestapleton/aegis-runtime-mv/patches/fb7a65fc39d6ff9b .patch | git am
Raw patch (mbox) · Diff
Provenance
This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:
github-import 1
aien-dev/aegis-runtime-mv
43
43ac58f8a98a8698ba54c4e5021e3444ed46da1b
{"kind":"github-import","owner":"aien-dev","repo":"aegis-runtime-mv","number":43,"url":"https://github.com/aien-dev/aegis-runtime-mv/pull/43","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452 ","imported_utc":"2026-11-18T16:39:36Z","metadata":"unavailable","state_derived":true}
Changes
diff --git a/.aien/always b/.aien/always
new file mode 100644
index 0000000 ..e31f215
--- /dev/null
+++ b/.aien/always
@@ -0,0 +1,5 @@
+# Gates that run on every commit regardless of changed paths (ADR 0033 Decision 12
+# allow-list; inventory contract C6). One gate name per line. Read from the base ref.
+CRUMB-VERIFY
+AEGIS-ZERO-DISK-SECRETS
+AEGIS-ANTI-SLOP
diff --git a/.aien/unmapped-ok b/.aien/unmapped-ok
new file mode 100644
index 0000000 ..5a31f94
--- /dev/null
+++ b/.aien/unmapped-ok
@@ -0,0 +1,7 @@
+# Changed paths matching these globs need only the always-run set (.aien/always).
+# Everything else must be covered by a manifest's inputs or the commit is NOT_RUN.
+# Conservative: only paths no hosted job compiles or tests. Read from the base ref.
+docs/**
+*.md
+LICENSE
+.gitignore
diff --git a/.aien/verify.pub b/.aien/verify.pub
new file mode 100644
index 0000000 ..3e65411
--- /dev/null
+++ b/.aien/verify.pub
@@ -0,0 +1 @@
+01368e0b02dc1113ae7425ad6ab00fdf5aa7dd97e0690745918a52f051d5cf68
diff --git a/.crumb b/.crumb
index 1f45a06 ..4956568 100644
--- a/.crumb
+++ b/.crumb
@@ -26,7 +26,7 @@
"children": [
{
"digest": "0e67f750d69e5210c482d53230ffe07209af58a7d6176eb6a936759c0504d4c6 ",
- "last_commit": "5e2f1e0 ",
+ "last_commit": "1eba7a7 ",
"name": "docs",
"purpose": "Directory docs. Purpose not yet described by a human."
},
@@ -44,26 +44,26 @@
},
{
"digest": "3ba2f83f6464f4b188455f5f3fdfb5da1e845e36f314b7534423c5845467965a ",
- "last_commit": "7be8b4b ",
+ "last_commit": "1eba7a7 ",
"name": "src",
"purpose": "Directory src. Purpose not yet described by a human."
},
{
- "digest": "fd142eed5f6851fd3e67d7c91052c66f86a2b712c46c17d5a4b37675e0401f4d ",
- "last_commit": "7be8b4b ",
+ "digest": "679a171888a7f534584da794f4ed48bd0da3bd4f51d03fdc14b80328ea17c776 ",
+ "last_commit": "ae1c0a2 ",
"name": "tests",
"purpose": "Directory tests. Purpose not yet described by a human."
}
],
- "children_root": "sha256:e362015ce6e6150f5df5a3973c8ebe529983bbaef591b0881d55529f22823885 ",
- "compiled_at": "2026-10-10T16:23:18Z",
+ "children_root": "sha256:772fc3fa43549ad5f2e6fbd67024d7f0c3124008e257691c95a76449f5da04d4 ",
+ "compiled_at": "2026-10-11T17:58:40Z",
"compiler": "crumb-compile/1",
- "digest": "sha256:7919ea5acabff482f35a4ca27daa8d0694c88060afa1913777991c8b8e645e4a ",
+ "digest": "sha256:9995aeecd2471248aefc45b377537aa92d679071b104bf3647a6ad4db4d04c58 ",
"evidence_files": 0,
"evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 ",
- "files": 83,
- "generated_at_commit": "7be8b4b8c9c0aa061d85694997d5c5063fadd264 ",
- "source_tree": "sha256:b658631617c7c95f058bfab65a5000808c178f095aa9051fd4082b89801ff296 "
+ "files": 95,
+ "generated_at_commit": "b915e48aa3ed5577bc80c6f41e251c26bec436cf ",
+ "source_tree": "sha256:720b9a8b52a4e8df122214a0e756893e666645e8430b88b520a922490cbc5f01 "
},
"owner_lane": "",
"seed": {
diff --git a/.github/workflows/aien-verification.yml b/.github/workflows/aien-verification.yml
new file mode 100644
index 0000000 ..f232a2d
--- /dev/null
+++ b/.github/workflows/aien-verification.yml
@@ -0,0 +1,186 @@
+# AIEN Verification: the GitHub thin gate (ADR 0033 Decision 11, inventory contract C5).
+#
+# PHASE 2 DRAFT (2026-10-11, lane REPOS). This workflow is NOT a required check yet. It runs
+# beside the existing hosted workflows so that, for N >= 3 commits, the hosted verdict and the
+# locally signed bundle verdict can be compared (advisor amendment A7). Nothing here changes
+# the repository's required contexts; that switch is phase 3 and needs Drake's agreement.
+#
+# What it does: checkout; read the trust anchors from the BASE ref (origin/main), never from
+# the head under test (amendment A1); crumb verify; fetch <repo>/<sha>/bundle.json from
+# aien-dev/aien-receipts; verify the bundle signature and content with the pinned aien-test
+# build; run the repository's portable smoke set (gates whose requires is only "portable").
+#
+# GitHub-hosted compute: this workflow compiles only the two pinned verifier tools (the crumb
+# checker, and aien-test once the repository is enrolled). It never builds or tests this
+# repository's own code; the portable smoke set is text scans and format checks only.
+#
+# PHASE 3 FLIPS (marked "PHASE3" below): a missing bundle becomes NOT_RUN (status pending with
+# a retry window) instead of a neutral note, and a trust-surface change becomes a failure
+# unless the operator ran it by hand (BLOCKED_OPERATOR).
+name: AIEN Verification
+
+on:
+ pull_request:
+ push:
+ branches: [main]
+
+permissions:
+ contents: read
+
+jobs:
+ verify:
+ name: AIEN Verification
+ runs-on: ubuntu-latest
+ timeout-minutes: 30
+ env:
+ REPO_SLUG: aien-dev/aegis-runtime
+ AIEN_TEST_PIN: c26f4d7ac3156088469b27462390f5b08ef4f436
+ RECEIPTS_RAW: https://raw.githubusercontent.com/aien-dev/aien-receipts/main
+ steps:
+ - name: Checkout the head under test
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Resolve the commit under test and the base ref
+ id: ids
+ run: |
+ if [ "${{ github.event_name }}" = pull_request ]; then
+ sha="${{ github.event.pull_request.head.sha }}"
+ else
+ sha="${{ github.sha }}"
+ fi
+ git fetch -q origin main
+ echo "sha=$sha" >> "$GITHUB_OUTPUT"
+ echo "base=$(git rev-parse origin/main)" >> "$GITHUB_OUTPUT"
+ echo "commit under test: $sha"
+ echo "base (trust anchors): $(git rev-parse origin/main)"
+
+ - name: "Trust anchors from the base ref (A1: never from the head under test)"
+ id: anchors
+ run: |
+ mkdir -p "$RUNNER_TEMP/anchors"
+ base="${{ steps.ids.outputs.base }}"
+ if git show "$base:.aien/verify.pub" > "$RUNNER_TEMP/anchors/verify.pub" 2>/dev/null; then
+ echo "enrolled=true" >> "$GITHUB_OUTPUT"
+ git show "$base:.aien/always" > "$RUNNER_TEMP/anchors/always" 2>/dev/null || : > "$RUNNER_TEMP/anchors/always"
+ git show "$base:.aien/unmapped-ok" > "$RUNNER_TEMP/anchors/unmapped-ok" 2>/dev/null || : > "$RUNNER_TEMP/anchors/unmapped-ok"
+ echo "verify.pub (base): $(cat "$RUNNER_TEMP/anchors/verify.pub")"
+ else
+ echo "enrolled=false" >> "$GITHUB_OUTPUT"
+ echo "::notice::.aien/verify.pub is not on the base ref yet: this repository is not enrolled. Phase 2: neutral."
+ fi
+ # Trust-surface changes are run by the operator by hand (A1): BLOCKED_OPERATOR.
+ changed=$(git diff --name-only "$base...${{ steps.ids.outputs.sha }}" -- .aien tests/gates .github/workflows .forgejo tools/aien-test || true)
+ if [ -n "$changed" ]; then
+ echo "blocked=true" >> "$GITHUB_OUTPUT"
+ echo "::notice::BLOCKED_OPERATOR: this head changes the trust surface:"; echo "$changed"
+ # PHASE3: fail here unless an operator attestation for this sha is present.
+ else
+ echo "blocked=false" >> "$GITHUB_OUTPUT"
+ fi
+
+ - name: Checkout the pinned crumb tool source (aien-architecture @ 94fffbcf88492c5a1c54211b5126c8a6c370a98d )
+ uses: actions/checkout@v4
+ with:
+ repository: aien-dev/aien-architecture
+ ref: 94fffbcf88492c5a1c54211b5126c8a6c370a98d
+ path: .crumb-tool-src
+
+ - name: Build the crumb tool, then remove its source from this tree
+ run: |
+ make -C .crumb-tool-src/tools/crumb crumb
+ mkdir -p "$RUNNER_TEMP/bin" && cp .crumb-tool-src/tools/crumb/crumb "$RUNNER_TEMP/bin/crumb"
+ rm -rf .crumb-tool-src
+ echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
+
+ - name: Crumbs must be exactly what the compiler produces now (stays GitHub-hosted, D11)
+ run: crumb verify .
+
+ - name: Install Stable Rust Toolchain (for the pinned aien-test build and the smoke set)
+ if: steps.anchors.outputs.enrolled == 'true'
+ uses: dtolnay/rust-toolchain@stable
+ with:
+ components: rustfmt
+
+ - name: Checkout the pinned aien-test source (aien-sovereign-core @ ${{ env.AIEN_TEST_PIN }})
+ if: steps.anchors.outputs.enrolled == 'true'
+ uses: actions/checkout@v4
+ with:
+ repository: aien-dev/aien-sovereign-core
+ ref: ${{ env.AIEN_TEST_PIN }}
+ path: .aien-test-src
+
+ - name: Cache the pinned aien-test build
+ if: steps.anchors.outputs.enrolled == 'true'
+ uses: actions/cache@v4
+ with:
+ path: |
+ ~/.cargo/registry
+ ~/.cargo/git
+ .aien-test-src/target
+ key: aien-test-${{ runner.os }}-${{ env.AIEN_TEST_PIN }}
+
+ - name: Build aien-test from the pin (never from the tree under test), then remove the source
+ if: steps.anchors.outputs.enrolled == 'true'
+ run: |
+ cargo build --release -p aien-test --manifest-path .aien-test-src/Cargo.toml
+ cp .aien-test-src/target/release/aien-test "$RUNNER_TEMP/bin/aien-test" 2>/dev/null || { mkdir -p "$RUNNER_TEMP/bin"; cp .aien-test-src/target/release/aien-test "$RUNNER_TEMP/bin/aien-test"; }
+ echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
+ rm -rf .aien-test-src
+ git status --porcelain --untracked-files=normal
+
+ - name: Fetch the signed verification bundle for this commit
+ id: bundle
+ run: |
+ url="$RECEIPTS_RAW/aegis-runtime/${{ steps.ids.outputs.sha }}/bundle.json"
+ echo "bundle url: $url"
+ if curl -fsSL "$url" -o "$RUNNER_TEMP/bundle.json"; then
+ echo "present=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "present=false" >> "$GITHUB_OUTPUT"
+ echo "::notice::bundle not published yet for ${{ steps.ids.outputs.sha }} (phase 2: neutral)."
+ # PHASE3: exit 2 here (NOT_RUN, status pending with a retry window) instead of a neutral note.
+ fi
+
+ - name: Verify the bundle with the base-ref public key
+ if: steps.bundle.outputs.present == 'true' && steps.anchors.outputs.enrolled == 'true'
+ run: |
+ required=$(grep -v '^#' "$RUNNER_TEMP/anchors/always" | grep -v '^$' | paste -sd, -)
+ set +e
+ aien-test verify-bundle "$RUNNER_TEMP/bundle.json" \
+ --repo "github.com/$REPO_SLUG" \
+ --commit "${{ steps.ids.outputs.sha }}" \
+ --pubkey "$RUNNER_TEMP/anchors/verify.pub" \
+ ${required:+--require "$required"}
+ rc=$?
+ set -e
+ echo "verify-bundle exit $rc (0 PASS, 1 FAIL, 2 NOT_RUN, 3 REJECTED)"
+ [ "$rc" = 0 ] || exit "$rc"
+
+ - name: Portable smoke set (gates whose requires is only portable, named at the base ref)
+ if: steps.anchors.outputs.enrolled == 'true' && steps.anchors.outputs.blocked == 'false'
+ run: |
+ base="${{ steps.ids.outputs.base }}"
+ names=$(for f in $(git ls-tree -r --name-only "$base" -- tests/gates | grep '\.gate$'); do
+ git show "$base:$f" | awk '
+ /^gate:/ {g=$2}
+ /^requires:/ {inr=1; next}
+ inr && /^ - / { if ($2 != "portable") other=1; next }
+ /^[a-z]/ {inr=0}
+ END { if (g != "" && !other) print g }'
+ done)
+ echo "portable smoke set: $(echo $names)"
+ mkdir -p "$RUNNER_TEMP/evidence"
+ fail=0
+ for g in $names; do
+ echo "::group::$g"
+ if timeout 600 aien-test run "$g" --evidence-dir "$RUNNER_TEMP/evidence"; then echo "$g: PASS"; else echo "::error::$g: not PASS"; fail=1; fi
+ echo "::endgroup::"
+ done
+ exit $fail
+
+ - name: "Not enrolled or blocked: nothing to verify in this phase"
+ if: steps.anchors.outputs.enrolled != 'true' || steps.anchors.outputs.blocked == 'true'
+ run: |
+ echo "AIEN Verification: neutral (enrolled=${{ steps.anchors.outputs.enrolled }}, blocked=${{ steps.anchors.outputs.blocked }}). PHASE3 turns this into a failure."
diff --git a/tests/.crumb b/tests/.crumb
index 1a90c55 ..aeb3971 100644
--- a/tests/.crumb
+++ b/tests/.crumb
@@ -20,14 +20,14 @@
}
],
"children_root": "sha256:2f0b999b8999ad3095c8081fb342d506f27f7b07b31452b67140d330ccf4dc76 ",
- "compiled_at": "2026-10-10T16:23:18Z",
+ "compiled_at": "2026-10-11T16:52:30Z",
"compiler": "crumb-compile/1",
- "digest": "sha256:fd142eed5f6851fd3e67d7c91052c66f86a2b712c46c17d5a4b37675e0401f4d ",
+ "digest": "sha256:679a171888a7f534584da794f4ed48bd0da3bd4f51d03fdc14b80328ea17c776 ",
"evidence_files": 0,
"evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 ",
- "files": 11,
- "generated_at_commit": "7be8b4b8c9c0aa061d85694997d5c5063fadd264 ",
- "source_tree": "sha256:d5d07c84588d423524e37f67723ce057e56f83fd4133f70dbbd3b42ccb4f94ec "
+ "files": 19,
+ "generated_at_commit": "ae1c0a2f59483228e368a3841693ab18ac46b5b8 ",
+ "source_tree": "sha256:6796f99b16ece8c4efa9f58beb2852aa39be59e242b965aa461c30c128955f50 "
},
"owner_lane": "",
"seed": {
diff --git a/tests/gates/aegis-anti-slop.gate b/tests/gates/aegis-anti-slop.gate
new file mode 100644
index 0000000 ..c33c963
--- /dev/null
+++ b/tests/gates/aegis-anti-slop.gate
@@ -0,0 +1,23 @@
+# tests/gates/aegis-anti-slop.gate
+# Mirrors hosted: ci.yml 'Enforce Sovereign Voice and Anti-Slop Invariant' (always-run)
+gate: AEGIS-ANTI-SLOP
+manifest_version: 2
+owner: aegis-runtime
+requires:
+ - portable
+inputs:
+ - src/
+ - tests/
+ - docs/
+ - README.md
+ - tests/gates/
+run:
+ exec: tests/gates/run.sh
+ args: ["anti-slop"]
+expects:
+ exit: 0
+ observe: ["dash_hits == 0"]
+ verdict: PASS
+timeout: 2m
+exactness: EXACT
+cache_scope: portable
diff --git a/tests/gates/aegis-check.gate b/tests/gates/aegis-check.gate
new file mode 100644
index 0000000 ..db707f9
--- /dev/null
+++ b/tests/gates/aegis-check.gate
@@ -0,0 +1,24 @@
+# tests/gates/aegis-check.gate
+# Mirrors hosted: ci.yml 'Cargo Check': cargo check --all-targets (sibling ../aien-protocols at main, as the hosted job checks out)
+gate: AEGIS-CHECK
+manifest_version: 2
+owner: aegis-runtime
+requires:
+ - host
+inputs:
+ - Cargo.toml
+ - Cargo.lock
+ - src/
+ - tests/
+ - build.rs
+ - mojo/
+ - tests/gates/
+run:
+ exec: tests/gates/run.sh
+ args: ["check"]
+expects:
+ exit: 0
+ verdict: PASS
+timeout: 20m
+exactness: EXACT
+cache_scope: machine
diff --git a/tests/gates/aegis-clippy.gate b/tests/gates/aegis-clippy.gate
new file mode 100644
index 0000000 ..fbcb285
--- /dev/null
+++ b/tests/gates/aegis-clippy.gate
@@ -0,0 +1,24 @@
+# tests/gates/aegis-clippy.gate
+# Mirrors hosted: ci.yml 'Cargo Clippy Invariant': cargo clippy --all-targets -- -D warnings
+gate: AEGIS-CLIPPY
+manifest_version: 2
+owner: aegis-runtime
+requires:
+ - host
+inputs:
+ - Cargo.toml
+ - Cargo.lock
+ - src/
+ - tests/
+ - build.rs
+ - mojo/
+ - tests/gates/
+run:
+ exec: tests/gates/run.sh
+ args: ["clippy"]
+expects:
+ exit: 0
+ verdict: PASS
+timeout: 20m
+exactness: EXACT
+cache_scope: machine
diff --git a/tests/gates/aegis-fmt.gate b/tests/gates/aegis-fmt.gate
new file mode 100644
index 0000000 ..9ed7327
--- /dev/null
+++ b/tests/gates/aegis-fmt.gate
@@ -0,0 +1,23 @@
+# tests/gates/aegis-fmt.gate
+# Mirrors hosted: ci.yml 'Verify Code Formatting': cargo fmt --all -- --check (host: needs the ../aien-protocols sibling to resolve the workspace)
+gate: AEGIS-FMT
+manifest_version: 2
+owner: aegis-runtime
+requires:
+ - host
+inputs:
+ - Cargo.toml
+ - Cargo.lock
+ - src/
+ - tests/
+ - build.rs
+ - tests/gates/
+run:
+ exec: tests/gates/run.sh
+ args: ["fmt"]
+expects:
+ exit: 0
+ verdict: PASS
+timeout: 5m
+exactness: EXACT
+cache_scope: portable
diff --git a/tests/gates/aegis-test.gate b/tests/gates/aegis-test.gate
new file mode 100644
index 0000000 ..3f1a390
--- /dev/null
+++ b/tests/gates/aegis-test.gate
@@ -0,0 +1,24 @@
+# tests/gates/aegis-test.gate
+# Mirrors hosted: ci.yml 'Run Workspace Unit and Integration Tests': cargo test --verbose -- --test-threads=1 (hosted job 110 s total)
+gate: AEGIS-TEST
+manifest_version: 2
+owner: aegis-runtime
+requires:
+ - host
+inputs:
+ - Cargo.toml
+ - Cargo.lock
+ - src/
+ - tests/
+ - build.rs
+ - mojo/
+ - tests/gates/
+run:
+ exec: tests/gates/run.sh
+ args: ["test"]
+expects:
+ exit: 0
+ verdict: PASS
+timeout: 30m
+exactness: EXACT
+cache_scope: machine
diff --git a/tests/gates/aegis-zero-disk-secrets.gate b/tests/gates/aegis-zero-disk-secrets.gate
new file mode 100644
index 0000000 ..3168029
--- /dev/null
+++ b/tests/gates/aegis-zero-disk-secrets.gate
@@ -0,0 +1,19 @@
+# tests/gates/aegis-zero-disk-secrets.gate
+# Mirrors hosted: ci.yml 'Enforce Zero Disk Secrets Invariant' (always-run)
+gate: AEGIS-ZERO-DISK-SECRETS
+manifest_version: 2
+owner: aegis-runtime
+requires:
+ - portable
+inputs:
+ - tests/gates/
+run:
+ exec: tests/gates/run.sh
+ args: ["zero-disk-secrets"]
+expects:
+ exit: 0
+ observe: ["env_files_found == false"]
+ verdict: PASS
+timeout: 2m
+exactness: EXACT
+cache_scope: portable
diff --git a/tests/gates/crumb.gate b/tests/gates/crumb.gate
new file mode 100644
index 0000000 ..0606866
--- /dev/null
+++ b/tests/gates/crumb.gate
@@ -0,0 +1,19 @@
+# tests/gates/crumb.gate
+# Mirrors hosted: crumb verify . (ADR 0033 D11; always-run). Inputs cannot list every nested .crumb (literal paths only), so never cached.
+gate: CRUMB-VERIFY
+manifest_version: 2
+owner: aegis-runtime
+requires:
+ - portable
+inputs:
+ - .crumb
+run:
+ exec: tests/gates/run.sh
+ args: ["crumb-verify"]
+expects:
+ exit: 0
+ verdict: PASS
+timeout: 2m
+exactness: EXACT
+cache_scope: portable
+cache: never
diff --git a/tests/gates/run.sh b/tests/gates/run.sh
new file mode 100755
index 0000000 ..b0f8894
--- /dev/null
+++ b/tests/gates/run.sh
@@ -0,0 +1,85 @@
+#!/usr/bin/env bash
+# tests/gates/run.sh: the one entry point for the local verification gates of
+# aegis-runtime. Every step runs the SAME command as the hosted job it mirrors
+# (.github/workflows/ci.yml, job "Test & Invariant Verification"). Manifests under
+# tests/gates/ name this script plus one step word, so no manifest needs shell
+# expansion (ADR 0028 P6). Observations print as "AIEN-OBS <name> <json>".
+#
+# Sibling checkout: Cargo.toml depends on ../aien-protocols/crates/* by path. The hosted
+# job checks out aien-dev/aien-protocols (main) next to this repository; the local worker
+# must provide the same sibling. (The hosted job also checks out aien-sovereign-core as a
+# sibling; nothing in this repository reads it, so it is not required here.)
+set -euo pipefail
+ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
+cd "$ROOT"
+step="${1:?usage: tests/gates/run.sh <step>}"
+obs() { printf 'AIEN-OBS %s %s\n' "$1" "$2"; }
+need_protocols() {
+ if [ ! -d ../aien-protocols/crates ]; then
+ echo "run.sh: ../aien-protocols is missing; the hosted job checks out aien-dev/aien-protocols as a sibling" >&2
+ exit 3
+ fi
+ obs sibling_protocols_commit "\"$(git -C ../aien-protocols rev-parse HEAD 2>/dev/null || echo unknown)\""
+}
+
+# build.rs copies mojo/libaegis_simd.so into the tree when a mojo compiler is on PATH.
+# The hosted runner has no mojo, so its tree stays clean; locally we remove the copy
+# again when this run created it, so the clean_tree_after check mirrors hosted.
+cargo_step() {
+ local so=mojo/libaegis_simd.so had=false
+ [ -e "$so" ] && had=true
+ obs mojo_on_path "$(command -v mojo >/dev/null && echo true || echo false)"
+ "$@"
+ if [ "$had" = false ] && [ -e "$so" ]; then rm -f "$so"; obs removed_generated_so true; fi
+}
+
+case "$step" in
+ crumb-verify)
+ "${CRUMB:-crumb}" verify .
+ ;;
+ fmt)
+ need_protocols
+ cargo fmt --all -- --check
+ ;;
+ check)
+ need_protocols
+ cargo_step cargo check --all-targets
+ ;;
+ clippy)
+ need_protocols
+ cargo_step cargo clippy --all-targets -- -D warnings
+ ;;
+ test)
+ need_protocols
+ cargo_step cargo test --verbose -- --test-threads=1
+ ;;
+ zero-disk-secrets)
+ echo "Auditing repository for prohibited plaintext secret files..."
+ if find . -maxdepth 4 -name ".env*" -not -path "*/.git/*" -not -path "*/target/*" | grep -q .; then
+ echo "::error::Prohibited plaintext .env file found. Use an approved AIEN SecretProvider."
+ obs env_files_found true
+ exit 1
+ fi
+ obs env_files_found false
+ echo "Zero plaintext .env files verified."
+ ;;
+ anti-slop)
+ echo "Auditing repository for em dashes, en dashes, and formulaic tropes..."
+ # Pattern is em dash OR en dash, built from UTF-8 bytes so this file (inside the
+ # scanned tests/ tree) cannot trip its own scan. Same pattern as the hosted step.
+ DASH_PATTERN="$(printf '\xe2\x80\x94|\xe2\x80\x93')"
+ BAD_CHARS=$(grep -rnE --exclude-dir=target --exclude-dir=.git --exclude="*.rs" --exclude="*.json" --exclude="*.safetensors" "$DASH_PATTERN" src/ tests/ docs/ README.md || true)
+ if [ -n "$BAD_CHARS" ]; then
+ echo "::error::Em dashes or en dashes detected:"
+ echo "$BAD_CHARS"
+ obs dash_hits "$(printf '%s\n' "$BAD_CHARS" | grep -c .)"
+ exit 1
+ fi
+ obs dash_hits 0
+ echo "Sovereign voice compliance verified."
+ ;;
+ *)
+ echo "run.sh: unknown step '$step'" >&2
+ exit 2
+ ;;
+esac