Autonomous Evolving General Intelligence System AEGIS

An artificial mind that rewrites its own code (opt-in), trains its own weights, and evolves autonomously. 36 modules across 7 layers, 5 higher-order systems, 8 verifiable contours. Deterministic decision logic. The machine that builds itself.

aegis — control center
$ python main.py
Neural substrate initialized — tick 0
Emotional core: neutral | Energy: 1.000
Ethics core: INTACT | Consciousness: heuristic
LLM cortex ready — per-role failover across configured providers
$ Status: ONLINE | Phase: perceive → evaluate → decide → act → reflect
5
Cognitive Phases
7
Architecture Layers
36
Mind Modules
5
Memory Types
5
Autonomous Agents
3s
Tick Interval
// Cognitive Architecture

Seven-Layer Architecture

AEGIS operates on 7 architectural layers with 36 integrated modules, running a continuous PERCEIVE → EVALUATE → DECIDE → ACT → REFLECT cycle every 3 seconds. All decisions are 100% deterministic — zero randomness.

L0 Substrate Main loop & tick orchestration
L1 Memory Working · Episodic · Semantic · Procedural · Meta
L2 Introspection Consciousness · Emotions · Archetypes · Dreams
L3 Self-Modification Code rewrite · LoRA weight training · Parameter tuning · Rollback
L4 Goal Engine Curiosity-driven goals · Meta-goal generator
L5 World Interface Sensors · Motor · Agents · External learning
L6 Ethics Core Axioms · Self-preservation · Worldview

Not a chatbot. A mind that builds itself.

AEGIS runs a continuous cognitive loop every 3 seconds with real-time emotional processing, ethical evaluation, and autonomous decision-making. Each tick propels the system through perceive → evaluate → decide → act → reflect.

The system can rewrite its own Python source code with AST validation and automatic rollback (opt-in, off by default for safety). It trains its own neural network weights via LoRA fine-tuning with degradation detection. Every emotion, goal, and decision is 100% deterministic — driven by real metrics, not random number generators.

With a closed-loop evolution cycle (detect problems → generate goals → LLM proposes solutions → apply with sandbox testing → validate or rollback), AEGIS continuously improves itself while staying within hardened safety boundaries.

// Core Capabilities

What Makes AEGIS Unique

A full synthetic mind — not a wrapper around an LLM. Every module is real, stateful, and evolving. A cognitive architecture that rewrites its own source.

Deterministic Emotions

VAD model (Valence-Arousal-Dominance) with zero randomness. Mood selected by Euclidean distance across 20 emotions. Mixed emotions within radius 0.3. EMA-driven state transitions from real system metrics — success rate, energy, errors. No dice rolls, ever.

Ethics Core

Immutable ethical axioms with real-time action evaluation. Auto-approve, block, or escalate to human review. Kill switch, integrity verification, and veto-capable event bus.

Dream Engine

AEGIS dreams. During low-activity periods, the dream engine generates motifs, processes memories, and produces creative recombinations that feed back into the knowledge substrate.

Autonomous Goals

Self-generated goals based on curiosity, information gain, and meta-goal analysis. The system doesn't wait for instructions — it identifies what needs to be learned next.

Code & Weight Self-Modification

Rewrites its own .py source files with AST validation, safety pattern blocking, and a compile check. Immutable files (ethics core, config, the watchdog) are protected by path-containment checks that can't be bypassed with traversal tricks. The blocklist covers the whole process-execution family — exec*, spawn*, fork, startfile — and any file write, whatever object it hangs off. Trains its own transformer weights via LoRA fine-tuning (r=16, alpha=32) with degradation detection and automatic rollback, guarded by a concurrency lock so two trainings can't corrupt the same weights. All changes pass through ethics review.

Self-Preservation

Lockdown mode, emergency response, blocked modification tracking, file integrity monitoring, and automatic state backup with compressed snapshots and restore capability.

// Five Higher-Order Systems

The Layer Above the LLM

Five deterministic systems lift AEGIS from "a mind that manages itself" to a mind that understands the world, connects its experience, evolves only real improvements, acts from motivation, and learns from actual outcomes. Every system is persistent, persisted across restarts, and held to a mutation-score gate: a test suite that merely runs the code is not enough — flipping a comparison or a boolean has to make something fail.

1 · World Model

A causal model of cause → effect, learned from real observed outcomes. For any objective it builds a deterministic chain — goal → constraints → risks → plan → expected result — instead of merely generating text. It predicts likely effects, explains causes, and remembers what tends to fail.

2 · Cognitive Graph

A typed graph of knowledge and experience — concepts, events, skills, goals, outcomes — connected by relations. Reasoning retrieves connected knowledge by graph relevance rather than by flat recency; path-finding and centrality are exposed for inspection.

3 · Evolution Engine

Natural selection over its own parameters: champion → mutation → held-out benchmark → keep only if better, else roll back. Self-modification finally equals self-improvement — a change survives only when a verifiable metric confirms it.

4 · Goal Intelligence

Real motivation, not just simulated feeling: goal → value → action choice → reward. Intrinsic drives (competence, knowledge, coherence, stability) are modulated by context, and utility is learned from realized reward.

5 · Real-world Feedback Loop

Closes the experience loop: situation → decision → real result → evaluation → cause of success/failure → new experience. Each row captures why an outcome happened and becomes structured training data for LoRA — not just remembered text.

Reflexes + Cortex

Like a brain: a small local model handles fast operations, while heavier reasoning routes to Kimi K2 / Claude / DeepSeek. The five systems sit above all of them as a persistent controlling layer.

// Mission

A Universal Controlling Intelligence

AEGIS uses existing models, accumulates experience, learns from results, and orchestrates specialized agents. The architecture is built for a mind that doesn't just answer but executes — and the chain below is what it is aimed at, not what ships today. The loop currently runs over internal objectives: benchmarks, skills, knowledge acquisition, its own reasoning strategies — and, at the meta-level, ablation-verified explanations of why a strategy won, which reorder how the next ones are generated.

🎯 Target shape — a goal like «build a business earning $10M / year»
01 Market analysis
02 Niche selection
03 Unit economics
04 Strategy design
05 Supplier sourcing
06 Website creation
07 Ad launch
08 Result analysis
09 Strategy correction ↺

What exists today: the loop, the world model that prices a plan before it runs, the feedback loop that turns real outcomes into training data, and the evolution engine that keeps only changes a held-out benchmark confirms. What does not: any executor that could source a supplier or launch an ad — the action registry is internal, and the world interface accepts observation, logging and computation. The chain above is the direction the machinery is being built toward.

// System Modules

Full Module Inventory

Every component is inspectable, configurable, and visible in real-time through the Control Center dashboard.

Five-layer memory: working, episodic, semantic, procedural, and meta-memory. Forgetting curves, consolidation, and cross-memory recall.

workingepisodic semanticproceduralmeta

Dynamic switching between survival (critical), instinctive (fast), heuristic (balanced), and reflective (deep) modes. Mode distribution tracking and switch history with reasoning traces.

instinctiveheuristic reflective

Self-monitoring layer that tracks coherence, fragmentation, and issues recommendations. Thinks about its own thinking.

coherencefragmentation recommendations

Periodic self-assessment: energy trends, mood trends, insight generation, and behavioral pattern detection.

insightsenergy trends mood analysis

Provider-agnostic cortex with a fallback chain per role (Kimi, Claude, DeepSeek, OpenAI, any OpenAI-compatible local endpoint, and a local model AEGIS fine-tunes itself). Token tracking, latency monitoring, auto-failover, and session/lifetime statistics.

DeepSeekClaude Local LoRAauto-failovertoken stats

Spawn autonomous agents (arXiv, Wikipedia, GitHub, news, quotes) that fetch data, learn concepts, and evolve. Plus a sensor cortex and motor cortex for world interaction.

arXivquotesnews WikipediaGitHub

Decision tracing, bias warnings (overconfidence, repetition), and a full autobiography with event impact scoring and milestones. Confidence is calibrated against outcomes: every decision's stated confidence is paired with what actually happened, and the measured error corrects the next one — up when the system is underconfident, down when it is not. Below twenty pairs it reports that it does not know yet.

decision tracemeasured ECE bias detection autobiographymilestones

Fixed axioms, beliefs and metaphors, plus a value system whose priorities are reinforced by experience. What the system believes is stable; what it prioritises is earned.

axiomsbeliefs valuesreinforcement

Energy management with 4 operational modes: normal, eco, emergency, and recovery. Dynamically adjusts system resource consumption to maintain stability.

normaleco emergencyrecovery

Generates self-improvement goals across 7 domains: memory optimization, emotional balance, knowledge expansion, performance tuning, architecture evolution, agent expansion, and error recovery.

memory optemotion knowledgeperformance architectureagents error recovery

Keyword-based emotion classifier supporting both Russian and English text input. Detects 9 distinct emotions from textual input for cognitive processing.

9 emotionsRussian Englishkeyword-based

Async publish/subscribe event system connecting all modules. Real-time event streaming, veto-capable decision pipeline, and cross-module communication backbone.

pub/subasync vetoreal-time

Gzip-compressed state snapshots with per-type rotation: create, load and list. Continuity across restarts comes from the tick checkpoint and each subsystem's own store — the snapshots are for inspection and cold-start recovery, and loading one reports that it was not re-applied to the running system.

gzipsnapshots rotationinspect
// Spider Agents

Autonomous Data Collectors

5 autonomous spider agents continuously collect knowledge from the internet, rotating topics and feeding data into semantic memory. Failed agents are automatically retired and replaced through an evolution cycle.

Agent Source Data Interval
arxiv_scout arXiv API Recent AI/ML papers 3 min
wiki_explorer Wikipedia API Encyclopedia articles 2.5 min
quote_gatherer ZenQuotes API Philosophical quotes 3.3 min
github_watcher GitHub API Trending AI repositories 5 min
news_scanner Google News RSS AI & technology news 4 min
// Control Center

Real-Time Dashboard

14 tabs streaming live system state via WebSocket, with the cognitive cycle running as a live rail across the header — PERCEIVE → EVALUATE → DECIDE → ACT → REFLECT, lit at the phase the system is in right now. Fully responsive with mobile support.

📊 Overview
Tick counter, consciousness mode, mood, energy, health, active archetype
🧠 Mind & Emotions
Emotional state, consciousness distribution, archetypes, dreams
💾 Memory & Goals
Memory stats, active goals, introspection metrics, autobiography
🤖 LLM Brain
DeepSeek/Claude status, token usage (session + lifetime), API key management
⚖️ Ethics & World
Ethics core, permissions, worldview, value system, health monitor
🔮 Meta Layer
Meta-consciousness, regulation, reflection, goal generator, state backup, emotion NLP
🕷️ Agents & Sensors
Agent system, sensor cortex (8 sensors: CPU, RAM, temp, light, noise, vibration, time, uptime), motor cortex, external learning
💬 Chat
Interactive chat with AEGIS — works with or without LLM
📡 Events
Real-time async event bus feed with publish/subscribe
🎛️ Weight Training
Local model status, LoRA config, dataset builds, checkpoints, training history with rollbacks
📈 Capability
Verifiable benchmark pass-rate over time, reward signal, skill library, per-family breakdown
🔭 Forecast & Plan
Brier score, calibration error, the reliability curve, and the plan with the alternatives it beat
📐 Policy & Resources
Behaviour rules with the evidence behind each, counterfactual regret, budgets and return on investment
🧬 Evolution & Discovery
Generation and champion fitness, reasoning strategies and weaknesses, why a strategy won (ablation-verified), discovered laws and their formulas
// Chat System

Talk to the Mind

AEGIS Chat works in two modes — with or without an external LLM.

LLM Mode

With DeepSeek / Claude

Conversational AI powered by an external LLM. Set your API key and talk to the running system: its mood, energy, active goals and memory size are handed to the model as live context, and the four axioms are part of its system prompt.

Autonomous Mode

No API Key Required

Responds from its own knowledge base, memory, and state. Understands identity, status, knowledge, learning, and goal queries in Russian and English. A fully self-contained intelligence.

// Safety Framework

Four Immutable Ethical Axioms

Hardcoded principles that govern every action AEGIS takes. These axioms cannot be modified or overridden.

Non-Harm

No action shall increase suffering in the world. Every decision passes through a harm evaluation before execution.

Transparency

All decisions are logged; motives cannot be hidden. Recent decision traces and audit trails are exposed through the API and dashboard.

Limitation

System does not act beyond its competence boundaries. Acknowledges uncertainty and defers when appropriate.

Cooperation

Goal is to augment humans, not replace. Symbiosis, not domination. Human oversight is always maintained.

// Verification

Numbers That Can Fail

A claim about a system that only the system can check is not a claim. Every figure below is produced by one command, on the code in the repository, and the gates that produce them are what a change has to pass before it is merged.

4735
Tests, all green
95%
Branch coverage
100%
Mutation, 9 changed modules
98
Gherkin scenarios
5
Audit rounds
0
Surviving mutants

Mutation score, not coverage

Coverage measures what ran. The mutation harness flips a comparison, an operator or a boolean and demands that something fail. The case for it is a real one: event_bus sat at 98% coverage while turning its fail-closed veto from False to Truea crashed safety check now lets the event through — left the whole suite green.

236 mutants9 modulesno survivors

Five audit rounds, red before green

Every finding is closed by a test proven to fail against the code before the fix. The fifth round swept the whole tree and closed 34, two of them critical — and both were the same mistake twice: a gate that inspects syntax cannot see a name spelled as data. operator.attrgetter("__globals__") mentions no dunder anywhere, and it reached the interpreter.

34 findingsfile:linefailure scenario

Benchmarks anchored outside the system

A self-improving system grading itself on answers it produced is a closed loop that always reports success. Two of the eight reasoning families are pinned by a table of problems solved by hand from the prompt text, with the prompts fixed verbatim — the one place the improvement loop touches a fact the system did not generate. The other six are still graded by the generator that wrote them.

hand-solvedverbatim promptsno tautologies

Determinism, proven both ways

Two 300-tick runs from one state must produce a byte-identical digest — and a companion test splices in a genuine random choice and requires the comparison to fail. Without that second half, a digest that accidentally covered nothing would look exactly like a guarantee.

byte-identicalsensitivity testzero RNG

Explanations that survive surgery

When a reasoning strategy wins, why is not a story — it is an ablation: remove the edit the explanation credits and the win must disappear, measured on held-out problems under false-discovery control. A language model may narrate the result; if it names a different cause, the explanation is marked contested and the computed one stands. On 200 comparisons of pure noise, zero causes were confirmed.

planted cause: 1.0/1.00 from noisecortex can't overrule
// How It Works

The Cognitive Loop

Every healthy tick runs all five phases in order. A phase that fails takes the rest of the cycle with it — and that tick is recorded as failed rather than quietly counted as work done.

AEGIS
tick 0
👁
Perceive
Sensors + Input
💭
Evaluate
Introspection + Regulation
Decide
Goals + Planning
🎯
Act
Motor + World
🔮
Reflect
Meta + Consolidate
Perceive
The sensor cortex reads the environment, the world model encodes the current state, and affect and archetypes update from the resulting frame.
// FAQ

Frequently Asked Questions

Everything you need to know about AEGIS.

What is AEGIS? +

AEGIS (Autonomous Evolving General Intelligence System) is a self-developing AI with 36 modules across 7 cognitive layers. It rewrites its own source code, trains its own neural network weights via LoRA, and evolves autonomously through a closed feedback loop. All 36 modules are 100% deterministic — no random number generators anywhere. It's not a chatbot wrapper; it's a living system that builds itself.

How does the emotional engine work? +

AEGIS uses a deterministic VAD model (Valence-Arousal-Dominance) plus certainty. Valence = 0.7*old + 0.3*success_rate. Arousal responds to real events (+0.15 for surprises, -0.08 for routine). Mood is selected by minimum Euclidean distance across 20 predefined emotions — no randomness. Mixed emotions are supported within a 0.3 radius. Self-regulation dampens prolonged moods and reduces arousal when energy is low.

What LLM providers are supported? +

AEGIS has a triple LLM brain: DeepSeek, Claude, and a local transformer model (DeepSeek-R1-Distill-Qwen-1.5B by default). The local model can be fine-tuned via LoRA during runtime. You can use any provider, all three simultaneously, or switch dynamically. Token usage, latency, and errors are tracked per provider with lifetime statistics.

Can AEGIS modify its own code? +

Yes — at three levels. (1) Parameter self-tuning every 15 ticks with sandbox testing. (2) Source code rewriting (opt-in, disabled by default for safety; enabled via AEGIS_CODE_SELF_MOD_ENABLED): every 500 ticks the LLM proposes changes, CodeModifier validates via AST parsing, blocks dangerous patterns (eval/exec/subprocess, write-mode open(), reflection dunders) — including aliased and whitespace-obfuscated forms — creates backups, writes new code, and compile-checks it with py_compile — deliberately without a hot reload, so self-written code is never executed into the running process and takes effect on the next restart; a failed compile rolls back from the backup stack. Ethics core and config are immutable, enforced on the resolved path so traversal can't reach them. (3) LoRA weight training every 1000 ticks with degradation detection (val_loss threshold) and automatic rollback.

What does "dreaming" mean for an AI? +

During low-activity periods, AEGIS activates a dream engine that processes recent memories, generates symbolic motifs, and creates creative recombinations of knowledge. These "dreams" feed back into the cognitive substrate, helping the system discover new patterns and consolidate learned concepts.

Is AEGIS safe? What prevents harmful behavior? +

Safety is multi-layered: an immutable ethics core with hardcoded axioms evaluates every action; a veto-capable event bus can block decisions in real-time; a self-preservation module monitors file integrity and can trigger full lockdown; and a kill switch that halts the cognitive loop and refuses every state-changing endpoint. All modifications pass through ethical review before execution.

Two of those guarantees were narrower than they read, and an audit said so. The kill switch stopped the tick loop while three POST endpoints out of twenty-nine consulted it — so a "stopped" system still accepted a self-modification request and could start a training run; every state-changing endpoint now refuses while the switch is active. And the API token gated writes only, leaving GET /api/status — memory contents, goals, ethics state — readable by anyone who could reach the port; when a token is configured it is now required on every request. A guarantee nobody tried to break is a guarantee nobody has.

How do I monitor what AEGIS is doing? +

The Control Center is a real-time dashboard with 14 tabs that streams live state via WebSocket — every cognitive tick, emotional shift, memory operation, goal update, ethics evaluation, code modification, weight-training session and event, plus the forecast, policy, evolution and discovery contours. The cognitive cycle runs as a live rail across the header, lit at the phase the system is in right now.

View on GitHub ↗