interplane.Get Omega
Read in your language

aien-sovereign-core-mv

AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.

Brought by drakestapleton

branch main Branches Tags History

aien-sovereign-core-mv / scripts / agent-preflight.sh

96 lines · 3930 bytes Raw Blame History
1#!/usr/bin/env bash
2# SPDX-License-Identifier: Apache-2.0
3# Copyright 2026 Drake Stapleton (AIEN / aien-dev)
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17set -eo pipefail
18
19echo "============================================================"
20echo " AIEN Sovereign Agent Preflight Verification Harness "
21echo "============================================================"
22
23FAILED=0
24
25# Step 1: Branch Guard (Zero direct commits to main)
26echo -n "[1/5] Verifying Branch Isolation... "
27if bash "$(dirname "$0")/preflight-branch-guard.sh"; then :; else FAILED=1; fi
28
29# Step 2: Zero Disk Secrets Audit
30echo -n "[2/5] Auditing Zero Disk Secrets... "
31SECRET_FILES=$(find . -maxdepth 3 -name ".env*" -o -name "*.key" -o -name "*secret*" -o -name "*.pem" 2>/dev/null | grep -v ".git" | grep -v "target" || true)
32if [ -n "$SECRET_FILES" ]; then
33 echo "FAILED"
34 echo "Error: Stray plaintext secret files detected on disk:"
35 echo "$SECRET_FILES"
36 FAILED=1
37else
38 echo "PASSED (Zero disk secrets detected)"
39fi
40
41# Step 3: Unslop and Sovereign Voice Audit on the branch (committed + working changes)
42echo -n "[3/5] Verifying Unslop & Anti-Slop Discipline... "
43# Diff against the merge base with main so committed branch work is audited,
44# not only uncommitted edits. Falls back to HEAD when no main ref exists.
45DIFF_BASE=$(git merge-base HEAD origin/main 2>/dev/null || git merge-base HEAD main 2>/dev/null || echo HEAD)
46DASH_VIOLATIONS=$(git diff "$DIFF_BASE" --':(exclude)*.lock' ':(exclude)*.svg' ':(exclude)*.bin' 2>/dev/null | grep -E '^\+[^+]' | grep -E '(—|–)' | grep -v "replace" | grep -v "contains" | grep -v "ZERO EM DASHES" | grep -v "forbidden" | grep -v "assert\!" || true)
47if [ -n "$DASH_VIOLATIONS" ]; then
48 echo "FAILED"
49 echo "Error: Prohibited em dash or en dash characters introduced in git diff:"
50 echo "$DASH_VIOLATIONS"
51 FAILED=1
52else
53 echo "PASSED (Zero em/en dashes in diff)"
54fi
55
56# Step 4: Test Suite Verification
57# Runs one stamped job per crate through the shared aien-proof board: crates
58# whose code and local dependencies are unchanged replay their stamp, identical
59# runs from other agents are joined, and real runs pass the CPU, memory, and GPU
60# gates. Set AIEN_PROOF_OFF=1 to fall back to a plain workspace test.
61echo "[4/5] Running Workspace Test Suite..."
62if [ "${AIEN_PROOF_OFF:-0}" = "1" ]; then
63 TEST_CMD=(cargo test --workspace)
64elif command -v aien-proof >/dev/null 2>&1; then
65 TEST_CMD=(aien-proof crates)
66else
67 TEST_CMD=(cargo run -q -p aien-proof -- crates)
68fi
69if "${TEST_CMD[@]}"; then
70 echo "PASSED (100% test pass)"
71else
72 echo "FAILED (Test suite failed)"
73 FAILED=1
74fi
75
76# Step 5: Vulnerability & Advisory Audit
77echo -n "[5/5] Checking RustSec Vulnerability Advisories... "
78if ! cargo audit --version >/dev/null 2>&1; then
79 echo "SKIPPED (cargo-audit not installed)"
80elif cargo audit; then
81 echo "PASSED (No vulnerabilities; review any warnings above)"
82else
83 echo "FAILED (Vulnerabilities reported above)"
84 FAILED=1
85fi
86
87echo "============================================================"
88if [ "$FAILED" -eq 0 ]; then
89 echo " ✓ PREFLIGHT VERIFICATION COMPLETE: Ready for PR Creation"
90 echo "============================================================"
91 exit 0
92else
93 echo " ✗ PREFLIGHT FAILED: Resolve defects before opening PR"
94 echo "============================================================"
95 exit 1
96fi