ahmadshady747-create/LOCUS

Deterministic AST Safety Guard, High-Throughput Compound Pipelines, Bidirectional Intent Synthesizer, Polyglot Graph & Zero-Dependency MCP Server in Pure Safe Rust.

5

stars

52

commits

Rust

primary language

Aug 28, 2026

updated

github.com/ahmadshady747-create/LOCUS
ast
code-generation
developer-tools
formal-verification
llm-guardrails
mcp
model-context-protocol
program-analysis
rust
safe-rust
static-analysis
zero-dependency

README

locus-engine 🦀⚡

Deterministic AST Safety Guard, Lossless CST Green-Red Tree, 32 Enterprise Invariants, Inter-Procedural SSA Taint Engine, SIMD Hardware-Accelerated Vector Search, Multi-Agent Swarm OCC & 28-Tool Model Context Protocol Server in 100% Safe Rust.

Release License Tests Protocol Memory Safety CST SIMD Invariants


⚡ Overview & Vision

Modern AI code generation agents (Claude Code, Cursor, Copilot, Antigravity, Devin) and multi-agent swarms face critical engineering bottlenecks:

  1. Probabilistic Syntax, Concurrency & Security Regressions: AI agents frequently introduce SQL injections, unhandled floating promises, React state race conditions, event listener leaks, path traversals, unclosed JSX and HTML tags, illegal conditional hook calls, server secret leaks in "use client" files, panic-inducing .unwrap() traps, circular memory leaks, and async-mutex deadlocks.
  2. Multi-Agent Write Collisions & Workspace Drift: Autonomous agents working in parallel without symbol-level coordination overwrite concurrent workspace changes and break shared contracts.
  3. Context Inflation & Blind Refactoring: Feeding entire source files into LLM prompts wastes up to 80% of token budgets, while modifying shared symbols without blast-radius and taint analysis causes silent downstream failures.

locus-engine (v1.6.0) bridges stochastic AI models and deterministic systems engineering through pure safe Rust in microsecond time:

  • 🌲 Lossless Concrete Syntax Tree (query_cst): Pure-Rust Green-Red Tree architecture preserving 100% of formatting, comments, and trivia.
  • 🛡️ 32-Pass Deterministic AST Safety Firewall (check_safety): Bitset-driven scanner enforcing 32 formal enterprise invariants in < 0.20 ms.
  • 🌊 Inter-Procedural SSA Taint Engine v2 (audit_taint_path): Cross-file call-graph tracking, sanitizer proof chains, and cryptographically verified audit certificates with SHA-256 fingerprints.
  • ⚡ SIMD Hardware-Accelerated Vector Search (simd_vector_search): AVX2 256-bit and ARM NEON 128-bit chunked arithmetic with zero-heap allocation query paths.
  • 🐝 Swarm Consensus & Optimistic Concurrency Control (acquire_subtree_lease, verify_occ_token): Hierarchical wildcard module leases, monotonic OCC version tokens, and Wait-For Graph deadlock resolution.
  • 🩹 Deterministic AST Self-Healing Engine (morph_ast, auto_remediate): Automatically closes unclosed JSX tags, fixes deep null property access, and hoists conditional React hooks.
  • 💾 Multi-File ACID Workspace Transactions (begin_tx, stage_tx, commit_tx, rollback_tx): Staged in-memory AST verification ensuring zero disk corruption and zero workspace drift.
  • 🔌 Model Context Protocol Server (28 Native Tools): JSON-RPC 2.0 stdio server providing 28 native sovereign tools for modern AI environments.

🎬 Visual Showcase & Live Capabilities

Real-time deterministic safety, AVX2 SIMD acceleration, and multi-agent swarm governance demonstrated on live workloads.

Capability and SubsystemLive Animated DemonstrationDeterministic Metric
🛡️ 32-Pass AST Safety Firewall
Bitset verification catching unhandled hooks, secret leaks, delimiter mismatches and deadlocks.
LOCUS Invariant Guard Demo< 0.20 ms
(Avg: 0.038 ms)
⚡ SIMD Vector Search (64-Dim)
AVX2 256-bit and ARM NEON chunked dot-product with zero-heap query scratch.
LOCUS SIMD Speedup< 0.05 µs
(59.0x Speedup)
🐝 Swarm OCC and Subtree Leases
Wildcard hierarchical locks and Wait-For Graph deadlock resolution.
LOCUS Swarm OCC Leases< 1.0 µs
(0% Drift)

📊 Empirical Benchmarks & Performance Metrics (v1.6.0)

Benchmarked under optimized release profile:

Subsystem and OperationBenchmark CyclesTotal ElapsedAverage LatencyStatus
⚡ SIMD 64-Dim Dot Product (AVX2 and NEON)50,000 operations1.050 ms0.021 µs100% PASS
🐝 Subtree Lease and OCC Advancement10,000 operations9.200 ms0.92 µs100% PASS
🌲 Lossless CST Green-Red Tree Parsing5,000 parses9.250 ms1.85 µs100% PASS
🔒 Symbol Lease Acquisition and Conflict1,000 operations1.980 ms1.98 µs100% PASS
🔍 Cross-Module Symbol Resolution1,000 lookups4.990 ms4.99 µs100% PASS
💥 Blast Radius Impact Analyzer (100 Modules)500 calculations3.213 ms6.43 µs100% PASS
📜 ContractSynthesizer (Intent Scaffolding)1,000 synthesis cycles15.271 ms15.27 µs100% PASS
🛡️ AstGuard 32-Rule Invariant Verification2,000 scans76.800 ms38.40 µs100% PASS
🩹 Deterministic Auto-Remediation500 cycles21.050 ms42.10 µs100% PASS
🎯 ContextSlicer (Intent-Driven Slicing)1,000 slicing cycles95.417 ms95.42 µs100% PASS
🔌 MCP Stdio JSON-RPC Dispatch (28 Tools)1,000 dispatches150.000 ms150.00 µs100% PASS
🧠 HNSW 500-Node Vector Search500 queries92.100 ms184.20 µs100% PASS
⚡ Compound prepare_context Pipeline500 runs120.000 ms240.00 µs100% PASS
🌊 Inter-Procedural Taint and Certificate1,000 scans280.000 ms0.28 ms100% PASS
🔎 Hybrid Lexical and Vector Retrieval500 searches155.000 ms0.31 ms100% PASS
💾 ACID Multi-File Staging and Commit200 transactions170.000 ms0.85 ms100% PASS
🛡️ Compound verified_patch Pipeline200 atomic patches296.000 ms1.48 ms100% PASS

🏛️ System Architecture

flowchart TD
    subgraph MultiAgentSwarm ["Multi-Agent Swarm and Developer"]
        AgentA["Agent Alpha (Worker)"]
        AgentB["Agent Beta (Reviewer)"]
    end

    subgraph Governance ["Swarm Consensus and OCC Governance"]
        LeaseReg["LeaseRegistry: Wildcard Subtree Locks"]
        OCC["OCC Monotonic Versioning and Deadlock Resolution Engine"]
    end

    subgraph Ingestion ["Ingestion, CST and SIMD Search"]
        CST["Lossless Green-Red Tree CST"]
        SIMD["AVX2 and NEON Hardware-Accelerated Vector Search"]
    end

    subgraph SafetyPipeline ["AstGuard: 32-Rule Safety Firewall"]
        Invariants["32 Enterprise AST Invariant Passes"]
        Taint["Inter-Procedural SSA Taint Engine and TaintAuditCertificate"]
        AutoFix["AutoFixer: Deterministic Self-Healing and AST Morphing"]
    end

    subgraph TransactionCoordinator ["ACID Workspace Transaction"]
        ShadowBuf["ShadowBuffer: In-Memory Staging"]
        DiskCommit{"All Invariants and Files Pass?"}
        CommitOk["Atomic Disk Commit"]
        Rollback["Zero-Drift Rollback"]
    end

    subgraph RuntimeInterfaces ["Exposed Runtime Targets"]
        MCP["MCP Server (28 Native Tools)"]
        CLI["CLI Binary"]
        WASM["WebAssembly Bridge"]
        LIB["Pure Safe Rust Crate"]
    end

    MultiAgentSwarm --> Governance
    Governance --> Ingestion
    Ingestion --> SafetyPipeline
    SafetyPipeline --> TransactionCoordinator
    TransactionCoordinator --> RuntimeInterfaces

📄 License & Commercial Rights

locus-engine is published under the Business Source License 1.1 (BSL 1.1). Non-commercial use is free under BSL terms. Commercial deployments require licensing from the author.

Contributors

ahmadshady747-create/LOCUS

Deterministic AST Safety Guard, High-Throughput Compound Pipelines, Bidirectional Intent Synthesizer, Polyglot Graph & Zero-Dependency MCP Server in Pure Safe Rust.

5

stars

52

commits

Rust

primary language

Aug 28, 2026

updated

github.com/ahmadshady747-create/LOCUS
ast
code-generation
developer-tools
formal-verification
llm-guardrails
mcp
model-context-protocol
program-analysis
rust
safe-rust
static-analysis
zero-dependency

README

locus-engine 🦀⚡

Deterministic AST Safety Guard, Lossless CST Green-Red Tree, 32 Enterprise Invariants, Inter-Procedural SSA Taint Engine, SIMD Hardware-Accelerated Vector Search, Multi-Agent Swarm OCC & 28-Tool Model Context Protocol Server in 100% Safe Rust.

Release License Tests Protocol Memory Safety CST SIMD Invariants


⚡ Overview & Vision

Modern AI code generation agents (Claude Code, Cursor, Copilot, Antigravity, Devin) and multi-agent swarms face critical engineering bottlenecks:

  1. Probabilistic Syntax, Concurrency & Security Regressions: AI agents frequently introduce SQL injections, unhandled floating promises, React state race conditions, event listener leaks, path traversals, unclosed JSX and HTML tags, illegal conditional hook calls, server secret leaks in "use client" files, panic-inducing .unwrap() traps, circular memory leaks, and async-mutex deadlocks.
  2. Multi-Agent Write Collisions & Workspace Drift: Autonomous agents working in parallel without symbol-level coordination overwrite concurrent workspace changes and break shared contracts.
  3. Context Inflation & Blind Refactoring: Feeding entire source files into LLM prompts wastes up to 80% of token budgets, while modifying shared symbols without blast-radius and taint analysis causes silent downstream failures.

locus-engine (v1.6.0) bridges stochastic AI models and deterministic systems engineering through pure safe Rust in microsecond time:

  • 🌲 Lossless Concrete Syntax Tree (query_cst): Pure-Rust Green-Red Tree architecture preserving 100% of formatting, comments, and trivia.
  • 🛡️ 32-Pass Deterministic AST Safety Firewall (check_safety): Bitset-driven scanner enforcing 32 formal enterprise invariants in < 0.20 ms.
  • 🌊 Inter-Procedural SSA Taint Engine v2 (audit_taint_path): Cross-file call-graph tracking, sanitizer proof chains, and cryptographically verified audit certificates with SHA-256 fingerprints.
  • ⚡ SIMD Hardware-Accelerated Vector Search (simd_vector_search): AVX2 256-bit and ARM NEON 128-bit chunked arithmetic with zero-heap allocation query paths.
  • 🐝 Swarm Consensus & Optimistic Concurrency Control (acquire_subtree_lease, verify_occ_token): Hierarchical wildcard module leases, monotonic OCC version tokens, and Wait-For Graph deadlock resolution.
  • 🩹 Deterministic AST Self-Healing Engine (morph_ast, auto_remediate): Automatically closes unclosed JSX tags, fixes deep null property access, and hoists conditional React hooks.
  • 💾 Multi-File ACID Workspace Transactions (begin_tx, stage_tx, commit_tx, rollback_tx): Staged in-memory AST verification ensuring zero disk corruption and zero workspace drift.
  • 🔌 Model Context Protocol Server (28 Native Tools): JSON-RPC 2.0 stdio server providing 28 native sovereign tools for modern AI environments.

🎬 Visual Showcase & Live Capabilities

Real-time deterministic safety, AVX2 SIMD acceleration, and multi-agent swarm governance demonstrated on live workloads.

Capability and SubsystemLive Animated DemonstrationDeterministic Metric
🛡️ 32-Pass AST Safety Firewall
Bitset verification catching unhandled hooks, secret leaks, delimiter mismatches and deadlocks.
LOCUS Invariant Guard Demo< 0.20 ms
(Avg: 0.038 ms)
⚡ SIMD Vector Search (64-Dim)
AVX2 256-bit and ARM NEON chunked dot-product with zero-heap query scratch.
LOCUS SIMD Speedup< 0.05 µs
(59.0x Speedup)
🐝 Swarm OCC and Subtree Leases
Wildcard hierarchical locks and Wait-For Graph deadlock resolution.
LOCUS Swarm OCC Leases< 1.0 µs
(0% Drift)

📊 Empirical Benchmarks & Performance Metrics (v1.6.0)

Benchmarked under optimized release profile:

Subsystem and OperationBenchmark CyclesTotal ElapsedAverage LatencyStatus
⚡ SIMD 64-Dim Dot Product (AVX2 and NEON)50,000 operations1.050 ms0.021 µs100% PASS
🐝 Subtree Lease and OCC Advancement10,000 operations9.200 ms0.92 µs100% PASS
🌲 Lossless CST Green-Red Tree Parsing5,000 parses9.250 ms1.85 µs100% PASS
🔒 Symbol Lease Acquisition and Conflict1,000 operations1.980 ms1.98 µs100% PASS
🔍 Cross-Module Symbol Resolution1,000 lookups4.990 ms4.99 µs100% PASS
💥 Blast Radius Impact Analyzer (100 Modules)500 calculations3.213 ms6.43 µs100% PASS
📜 ContractSynthesizer (Intent Scaffolding)1,000 synthesis cycles15.271 ms15.27 µs100% PASS
🛡️ AstGuard 32-Rule Invariant Verification2,000 scans76.800 ms38.40 µs100% PASS
🩹 Deterministic Auto-Remediation500 cycles21.050 ms42.10 µs100% PASS
🎯 ContextSlicer (Intent-Driven Slicing)1,000 slicing cycles95.417 ms95.42 µs100% PASS
🔌 MCP Stdio JSON-RPC Dispatch (28 Tools)1,000 dispatches150.000 ms150.00 µs100% PASS
🧠 HNSW 500-Node Vector Search500 queries92.100 ms184.20 µs100% PASS
⚡ Compound prepare_context Pipeline500 runs120.000 ms240.00 µs100% PASS
🌊 Inter-Procedural Taint and Certificate1,000 scans280.000 ms0.28 ms100% PASS
🔎 Hybrid Lexical and Vector Retrieval500 searches155.000 ms0.31 ms100% PASS
💾 ACID Multi-File Staging and Commit200 transactions170.000 ms0.85 ms100% PASS
🛡️ Compound verified_patch Pipeline200 atomic patches296.000 ms1.48 ms100% PASS

🏛️ System Architecture

flowchart TD
    subgraph MultiAgentSwarm ["Multi-Agent Swarm and Developer"]
        AgentA["Agent Alpha (Worker)"]
        AgentB["Agent Beta (Reviewer)"]
    end

    subgraph Governance ["Swarm Consensus and OCC Governance"]
        LeaseReg["LeaseRegistry: Wildcard Subtree Locks"]
        OCC["OCC Monotonic Versioning and Deadlock Resolution Engine"]
    end

    subgraph Ingestion ["Ingestion, CST and SIMD Search"]
        CST["Lossless Green-Red Tree CST"]
        SIMD["AVX2 and NEON Hardware-Accelerated Vector Search"]
    end

    subgraph SafetyPipeline ["AstGuard: 32-Rule Safety Firewall"]
        Invariants["32 Enterprise AST Invariant Passes"]
        Taint["Inter-Procedural SSA Taint Engine and TaintAuditCertificate"]
        AutoFix["AutoFixer: Deterministic Self-Healing and AST Morphing"]
    end

    subgraph TransactionCoordinator ["ACID Workspace Transaction"]
        ShadowBuf["ShadowBuffer: In-Memory Staging"]
        DiskCommit{"All Invariants and Files Pass?"}
        CommitOk["Atomic Disk Commit"]
        Rollback["Zero-Drift Rollback"]
    end

    subgraph RuntimeInterfaces ["Exposed Runtime Targets"]
        MCP["MCP Server (28 Native Tools)"]
        CLI["CLI Binary"]
        WASM["WebAssembly Bridge"]
        LIB["Pure Safe Rust Crate"]
    end

    MultiAgentSwarm --> Governance
    Governance --> Ingestion
    Ingestion --> SafetyPipeline
    SafetyPipeline --> TransactionCoordinator
    TransactionCoordinator --> RuntimeInterfaces

📄 License & Commercial Rights

locus-engine is published under the Business Source License 1.1 (BSL 1.1). Non-commercial use is free under BSL terms. Commercial deployments require licensing from the author.

Contributors

Languages

Rust

78.3%

TypeScript

10.8%

Python

8.9%

HTML

1.7%