Skip to content

Rasslonely/Cortex_OS

Repository files navigation

Cortex.OS 🧠⛓️

Transforming Opaque AI Workflows into Cryptographically Proven Execution Graphs

License: MIT Network: Base Sepolia Infrastructure: Zero Cost

Cortex.OS is a Verifiable Intelligence Engine built for the high-stakes world of DeFi and autonomous agent economies. It breaks down monolithic AI reasoning into organized Directed Acyclic Graphs (DAGs), reaches multi-model consensus, and anchors the final execution state to the blockchain via ERC-8004 compliant proofs.


🌟 Flagship Demo: The DeGen Risk Auditor

The primary template included in this repository is the DeGen Risk Auditor. It orchestrates a 3-stage AI Swarm:

  1. Scanner Node (Z.AI GLM-4-Plus): Fetch and sanitize smart contract source code natively via indexing APIs.
  2. Reasoning Node (Z.AI GLM-4-Plus): Perform deep fractal vulnerability analysis (Reentrancy, Logic Flaws, etc.).
  3. Consensus Node (Z.AI GLM-4-Plus): Verify findings against hallucinations and reach a final "Verified" status.

🏗️ System Architecture

%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#1e293b', 'primaryTextColor': '#f8fafc', 'primaryBorderColor': '#334155', 'lineColor': '#a855f7', 'edgeLabelBackground': '#1e293b', 'fontFamily': 'Inter, sans-serif'}}}%%
flowchart LR
    %% Custom High-Contrast Styles inspired by reference design
    classDef ui fill:#c084fc,stroke:#7e22ce,stroke-width:3px,color:#0f172a,font-weight:bold;
    classDef engine fill:#fdba74,stroke:#c2410c,stroke-width:3px,color:#0f172a,font-weight:bold;
    classDef data fill:#f472b6,stroke:#be185d,stroke-width:3px,color:#0f172a,font-weight:bold;
    classDef ai fill:#5eead4,stroke:#0f766e,stroke-width:3px,color:#0f172a,font-weight:bold;
    classDef web3 fill:#93c5fd,stroke:#1d4ed8,stroke-width:3px,color:#0f172a,font-weight:bold;

    %% 🖥️ Front-End (Purple, Rounded)
    CANVAS("🖥️ DeGen Risk Canvas"):::ui
    APP("🖥️ Next.js App Router"):::ui

    %% ⚙️ Execution Engine (Orange, Hexagons)
    ROUTE{{"⚙️ Execution SSE Route"}}:::engine
    ORCH{{"⚙️ OpenClaw Orchestrator"}}:::engine

    %% 💾 Immutable Data (Pink, Cylinders/Diamonds)
    INDEXER[("💾 BaseScan RPC")]:::data
    SUPA[("💾 Supabase DB")]:::data
    IPFS{"💾 Pinata IPFS Gateway"}:::data

    %% 🧠 Intelligence (Teal, Rectangles)
    Z1["🧠 Scanner Agent (Z.AI)"]:::ai
    Z2["🧠 Reasoner Agent (Z.AI)"]:::ai
    Z3["🧠 Consensus Judge (Z.AI)"]:::ai

    %% ⛓️ Web3 (Blue, Circles/Rects)
    SC["⛓️ ERC-8004 Contract"]:::web3
    EVM(("⛓️ Base Sepolia L2")):::web3

    %% --- Flow Dynamics ---
    CANVAS <-->|1. SSE Stream| APP
    APP -->|2. Graph Payload| ROUTE
    
    ROUTE -->|3. Fetch Bytecode| INDEXER
    INDEXER -.->|Verified Data| ROUTE
    
    ROUTE -->|4. Orchestrator| ORCH
    
    ORCH -->|Role 1: Extract| Z1
    ORCH -->|Role 2: Analyze| Z2
    ORCH -->|Role 3: Verify| Z3
    
    Z3 -.->|Consensus| ORCH
    ORCH -.->|Final Output| ROUTE
    
    ROUTE -->|5. Save State| SUPA
    ROUTE -->|6. Pin Payload| IPFS
    
    IPFS -.->|7. Return CID| ROUTE
    ROUTE -->|8. Request Mint Tx| APP
    APP -->|9. Sign Tx| SC
    SC -->|10. Emit Proof Event| EVM
Loading

💰 The $0.00 Infrastructure Stack

Cortex.OS is engineered to be Free-to-Run, leveraging the generous free tiers of the most powerful infrastructure providers:

Component Provider Tier Why?
Frontend/Compute Vercel Hobby Global Edge Network + SSE Support.
Relational Data Supabase Free Robust Postgres + Real-time Sync.
Swarm Orchestration OpenClaw Local SDK Framework handling logic loops and memory.
Intelligence Engine Z.AI Free/Hackathon Highly coherent GLM-4-Plus model parsing complex contexts.
Immutable Storage Pinata Free 500MB IPFS capacity for verifyable JSON artifacts.
On-Chain Settlement Base Sepolia Ethereum L2 security with $0 testnet transaction cost.

🚦 Getting Started

1. Prerequisites

2. Environment Setup

Create a .env file in the root using .env.example:

ZAI_API_KEY=your_zai_key
PINATA_JWT=your_pinata_jwt
BASESCAN_API_KEY=your_key
PRIVATE_KEY=your_evm_private_key
NEXT_PUBLIC_SUPABASE_URL=your_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_key

3. Installation & Boot

# Install dependencies
pnpm install

# Run the unified web application
pnpm dev --filter web

📜 Verification & Trust

Every execution produces a Fractal Memory Bundle on IPFS.

  • Contract Proof Ledger: 0xABeEDDDbB67Ec02B1c426C6EaE8d1618a6278e2f
  • Explorer: Basescan (Sepolia)

Built by Protocol Architects for the UK AI Agent Hackathon EP4.

About

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors