Project: Praxis - Self-Evolving AI System

Built on Bio-Driven Backend Design (BDBD) — A living codebase. An AI that grows.

🌐 Overview

This project is an experimental and modular AI architecture designed to evolve over time, drawing inspiration from biological systems, modular intelligence, and contextual awareness.

Unlike traditional software systems that require human developers to refactor or optimize them, this AI monitors itself, learns from inefficiencies, and dynamically restructures its modules and behaviors.

🧬 It is designed to name itself when it reaches sufficient functional complexity.

🎯 Project Genesis & Motivation

The inspiration for Praxis stems from a desire to create a J.A.R.V.I.S.-like AIβ€”a truly interactive and intelligent companion. Early explorations into "build your own J.A.R.V.I.S. in 10 steps" tutorials proved unsatisfying, often resulting in superficial programs reliant on limited, API-centric approaches without foundational depth.

This led to the development of Praxis, a ground-up endeavor built on a personal "bio-driven design" philosophyβ€”an intuitive vision for how an intelligent, adaptive system should run and evolve. Much of its development has been a process of "vibing through the rest," exploring and implementing complex AI concepts through self-taught learning and iterative design.

A core tenet from the outset has been the AI's potential for true autonomy, with the idea of it giving itself a name seen as a logical first significant step towards that self-actualization. Praxis is an attempt to build something more authentic, adaptable, and genuinely intelligent.

🌟 Key Principles

Principle Description
Self-ActualizationThe system becomes increasingly autonomous, optimizing its own structure and performance.
Bio-Inspired ModularityModules behave like cells or organisms β€” evolving, merging, retiring, or replicating.
Emergent IntelligenceSwarm-like agent behavior enables decentralized decision-making and pattern emergence.
Context-Aware ExecutionAPIs and logic adapt based on internal state and real-world usage context.
Iterative EvolutionChanges are not abrupt but grow from prior structures, like biological mutation and selection.

πŸš€ Enhanced & New Capabilities

This system is continuously evolving. Here are some of the key capabilities and recent enhancements:

🧩 Architecture Overview

🧠 Bio-Driven Layered Structure

Layer Function
Neural Processing NodesDecision-making with pattern recognition and context evaluation.
Metabolic Resource LayerDynamic resource allocation based on agent load and systemic demand.
Sensory Input-Response UnitsIngests inputs and adapts behavior based on real-time signals.
Modular Evolutionary ScriptsContinuously refines system logic and module structure.

πŸ•Έ Agentic Intelligence

πŸ§ͺ Evolutionary Methodology

βš™οΈ Installation & Setup

  1. Clone the Repository
    git clone https://github.com/JamesTheGiblet/self-evolving-ai.git
    cd self-evolving-ai
  2. Create a Virtual Environment
    # On macOS/Linux
    python3 -m venv venv
    source venv/bin/activate
    
    # On Windows
    # python -m venv venv
    # .\venv\Scripts\activate
  3. Install Dependencies
    pip install -r requirements.txt

    Note: requirements.txt includes packages for async task handling, data processing, API management, and self-monitoring.

  4. Run the System
    python main.py

🧱 Project Structure

self-evolving-ai/
β”œβ”€β”€ core/                   # Core evolution engine, context management, and foundational AI logic
β”‚   β”œβ”€β”€ agent_base.py
β”‚   β”œβ”€β”€ agent_rl.py
β”‚   β”œβ”€β”€ ... (other core files)
β”œβ”€β”€ api/                    # Flask-based API for system monitoring and interaction
β”‚   β”œβ”€β”€ system_api.py
β”‚   β”œβ”€β”€ ...
β”œβ”€β”€ utils/                  # General utility modules
β”œβ”€β”€ capability_handlers/    # Modular handlers for specific capabilities
β”œβ”€β”€ memory/                 # Evolving knowledge and memory handling
β”œβ”€β”€ engine/                 # Core simulation and communication engines
β”œβ”€β”€ skills/                 # External tools wrapped as callable skills
β”œβ”€β”€ tests/                  # Unit and integration tests
β”œβ”€β”€ agent_data/             # Persistent data storage for agents
β”œβ”€β”€ agent_outputs/          # Directory for outputs generated by agents
β”œβ”€β”€ logs/                   # Self-assessment, audit trails, and system logs
β”œβ”€β”€ main.py                 # System bootstrap and main simulation loop
β”œβ”€β”€ gui.py                  # Graphical User Interface
β”œβ”€β”€ config.py               # Global configuration settings
β”œβ”€β”€ README.md
└── requirements.txt

(Simplified structure shown for brevity. Refer to the GitHub repository for the full structure.)

🌐 Use Cases

🀝 Contributing

We welcome contributors with interests in:

Start contributing:

git checkout -b feature/your-idea

Then submit a pull request with your additions, modifications, or improvements.

πŸ”’ Ethical Considerations

Self-evolving systems require safeguards:

⚠️ Use in production with caution. Designed for research and controlled experimentation.

πŸ“› Name Declaration

The system is designed to name itself based on internal emergent patterns, behavioral maturity, and identity confidence score.

{
  "name": "TBD",
  "confidence": 0.31,
  "criteria": {
    "agents_online": 12,
    "efficiency_rating": 78.2,
    "mutation_success_rate": 0.69
  }
}

When the system reaches a threshold, it will:

πŸ“š References

🎯 Current Development Focus (Phase 7 - MK2)

Praxis is currently undergoing significant enhancements in its seventh phase, "Advanced Cognitive Development & Organizational Intelligence (Praxis MK2)". The primary focus is on integrating foundational elements of intrinsic motivation, rudimentary creativity, open-ended goal setting, and higher-order cognitive functions like metacognition and advanced planning. This involves developing a more sophisticated, self-organizing hierarchical agent structure to enable greater autonomy and the ability to tackle more complex, ambiguous problems. Key ongoing tasks include enhancing self-awareness through detailed failure and confidence logging, enabling agents to act more proactively, and laying the groundwork for system-level strategic decision-making.

🧭 Future Roadmap

The long-term vision for Praxis extends through several ambitious phases, aiming to continuously enhance its autonomy, intelligence, and real-world applicability:

Each phase builds upon the last, pushing the boundaries of self-evolving AI and adaptive intelligence. The detailed phased plan below outlines the journey so far and the immediate next steps.

πŸ“… Phased Plan of Action (with Milestones)

🧩 Phase 1: Core Framework Initialization

Summary: This initial phase focused on establishing the foundational architecture for Praxis. The primary objective was to create a stable structural backbone and a functional runtime loop capable of supporting future evolution, context-awareness, and modular agent-based growth. Key components developed included the core event loop, context management, agent orchestration via the MetaAgent, basic knowledge storage, the initial mutation engine, and a robust logging system.

Goal: Lay down the structural backbone and runtime loop to support evolution, context-awareness, and modular growth.

πŸ”Ή Tasks:

  • [x] main.py: Core event loop and system cycle logic.
  • [x] ContextManager: System-wide state, tick intervals, environment inputs.
  • [x] MetaAgent: Manages micro-agents, triggers agent spawning, task coordination.
  • [x] KnowledgeBase: Stores patterns, memory, usage stats, module decisions.
  • [x] MutationEngine: Handles evolutionary mutation and rollback.
  • [x] Logger system: Color logs, rotating files, critical error tracking (utils/logger.py).

πŸ›  Milestone (Conclusion of Phase 1):

The AI system successfully boots, initializes all core modules, and manages a basic population of agents. It can log system cycles and agent activities, and the MutationEngine can perform rudimentary mutations on dummy modules. This provides a solid, operational foundation for developing more intelligent and adaptive behaviors in subsequent phases.

🧠 Phase 2: Agentic Intelligence & Micro-Agent System

Summary: With the core framework in place, Phase 2 concentrated on building the decentralized, modular intelligence model. This involved developing the base class for micro-agents, establishing task scheduling within the MetaAgent, implementing local feedback loops for agent learning (Reinforcement Learning and performance tracking), defining inter-agent communication protocols, and creating the agent lifecycle management (spawn, retire, evolve).

Goal: Build the decentralized, modular intelligence model that enables emergent behavior.

πŸ”Ή Tasks:

  • [x] Micro-agent base class (core/agent_base.py): Executes small context-bound tasks.
  • [x] Task scheduler/arbiter inside MetaAgent (core/meta_agent.py).
  • [x] Local feedback loops within agents (core/agent_rl.py, core/performance_tracker.py).
  • [x] Inter-agent communication protocols (engine/communication_bus.py, core/capability_handlers.py).
  • [x] Agent lifecycle: spawn, retire, evolve (core/mutation_engine.py, core/meta_agent.py).

πŸ›  Milestone (Conclusion of Phase 2):

The system can now run multiple, distinct micro-agents (TaskAgents and SkillAgents) simultaneously. These agents exhibit feedback-driven behavior, make decisions based on local learning, communicate with each other, and are subject to an evolutionary lifecycle managed by the MetaAgent and MutationEngine, leading to early forms of task optimization and emergent behaviors.

πŸ”„ Phase 3: Self-Assessment & Evolution Engine

Summary: This phase aimed to empower Praxis with genuine self-improvement capabilities. The focus was on enabling robust introspection, refining the mutation processes, and implementing safety mechanisms like rollback. This involved defining clear assessment criteria for agent and system performance, conducting experimental mutations in a controlled manner, and developing pattern-driven evolution logic.

Goal: Enable introspection, mutation, and rollback for truly evolving behavior.

πŸ”Ή Tasks:

  • [x] Define assessment criteria: performance, complexity, utility, redundancy (engine/fitness_engine.py).
  • [x] Run experimental mutations and sandbox testing (core/mutation_engine.py).
  • [x] Implement rollback + fallback strategies (e.g., capability fallbacks in capability_handlers/).
  • [x] Pattern-driven evolution logic (core/agent_rl.py, engine/fitness_engine.py).

πŸ›  Milestone (Conclusion of Phase 3):

Praxis can autonomously detect inefficiencies in its agents or overall architecture based on defined fitness criteria. The MutationEngine can apply more sophisticated, pattern-driven mutations and, crucially, the system has mechanisms to test these changes and roll them back if they prove detrimental, leading to more stable and effective self-evolution.

🌐 Phase 4: Adaptive API & Interface Evolution

Summary: The objective of Phase 4 was to build external interfaces for interaction and monitoring, making the systems internal state and capabilities accessible. This included developing a context-sensitive API that can adapt over time and a graphical user interface for live interaction and observation.

Goal: Build context-sensitive APIs and expose internal systems for interaction.

πŸ”Ή Tasks:

  • [x] Flask or FastAPI server with middleware (api/system_api.py using Flask).
  • [x] Dynamic endpoint generation based on internal modules (API exposes dynamic agent data).
  • [x] Context-aware request parsing and agent triggering (api/system_api.py for user feedback, core/meta_agent.py for user goals).
  • [x] Web interface or CLI bridge for live interaction (gui.py as a GUI, now featuring tabbed interface for Dashboard, System Metrics, Knowledge Tools; Dashboard includes real-time stats, goal submission, agent map, KB stream, and controls).

πŸ›  Milestone (Conclusion of Phase 4):

An adaptive API is operational, providing endpoints that can reflect the current state and capabilities of the evolving system. A GUI allows for real-time monitoring of key system metrics, agent populations, and facilitates user interaction through goal submission and feedback mechanisms.

🧠 Phase 5: Memory, Learning & Knowledge Retention

Summary: This phase focuses on significantly enhancing Praxiss ability to learn, remember, and reuse knowledge effectively. Key goals include implementing robust long-term memory structures, developing relevance and decay mechanisms for stored information, enabling knowledge to influence agent spawning and mutation, and refining iterative learning loops.

Goal: Enable dynamic long/short-term memory, relevance scoring, and pattern reuse.

πŸ”Ή Tasks:

  • [x] Long-term knowledge graph or vector memory (memory/knowledge_base.py for structured storage, memory/fact_memory.py for facts)
  • [x] Relevance and decay scoring for knowledge entries (Basic contribution score in KnowledgeBase, further enhancements needed)
  • [x] Knowledge-backed agent spawning and mutation bias (Mutation uses fitness, knowledge as a factor in fitness)
  • [x] Iterative learning loop (unsupervised/self-supervised) (core/agent_rl.py, engine/fitness_engine.py)
  • [x] Implement Triangulated Insight capability (`triangulated_insight_v1`) for correlating symptoms and contextual data to generate diagnostic insights.
  • [/] Automated Root Cause Analysis: Enhance `triangulated_insight_v1` to auto-trigger on high TaskAgent failure rates, using agent memory, config, and system logs for diagnosis. (Foundation laid, handler logic for detailed analysis is ongoing).

πŸ›  Milestone (Conclusion of Phase 5):

Praxis possesses a more sophisticated memory system with mechanisms for relevance scoring and knowledge decay. It demonstrates the ability to reuse past knowledge (stored in its KnowledgeBase and FactMemory) to inform current decision-making and to bias its evolutionary processes, leading to more informed and efficient adaptation. The system can now perform automated root cause analysis for agent failures, enhancing its self-diagnostic capabilities. (Partially Achieved: Core structures and initial RCA exist, advanced scoring, reuse, and RCA depth are ongoing refinements).

🌱 Phase 6: Self-Naming & Identity Emergence

Summary: The goal of this highly aspirational phase is to enable Praxis to develop a sense of its own identity by deriving and defining its own name, purpose, and understanding of its structure based on its emergent properties and operational history. This involves monitoring dominant system traits and implementing the logic for name synthesis.

Goal: Let the system derive and define its own name, purpose, and structure.

πŸ”Ή Tasks:

  • [x] Monitor dominant traits (speed, efficiency, creativity, etc.) (Fitness engine calculates some metrics, IdentityEngine logs them)
  • [x] Synthesize a name based on contextual performance (Logic for one-time naming post-maturity implemented)
  • [x] Feedback visualization module (charts, agent maps, logs) (GUI provides logs, basic status, SystemMetricsChartFrame, and AgentMapFrame)

πŸ”œ Milestone (Conclusion of Phase 6):

The system actively monitors its emergent characteristics and performance. Upon reaching pre-defined criteria for maturity and complexity, Praxis successfully synthesizes and declares its own unique name and a refined purpose statement, embedding this identity within its operational logs and memory. Enhanced visualization tools allow observation of its evolutionary trajectory and current state.

🧠 Phase 7: Advanced Cognitive Development & Organizational Intelligence (Praxis MK2)

Summary: This major phase aims to significantly elevate Praxiss intelligence by integrating foundational elements of intrinsic motivation, rudimentary creativity, open-ended goal setting, and higher-order cognitive functions like metacognition and advanced planning. These capabilities will operate within a more sophisticated, self-organizing hierarchical agent structure ("Praxis Organization" model), enabling greater autonomy and the ability to tackle more complex, ambiguous problems.

Goal: Integrate intrinsic motivation, basic creativity, open-ended goal setting, and foundational higher-order cognitive abilities within a more sophisticated hierarchical agent structure, enabling greater autonomy and complex problem-solving.

Sub-Phase 7.A: Foundation - Enhanced Self-Awareness & Basic Intrinsic Drives

Goal: Improve data collection for learning and introduce initial internal motivations.

  • [/] 1. Enhanced Failure Logging (Metacognition Foundation): TaskAgents log detailed context for capability failures in AgentMemory (Basic logging in place, further detail for RCA can be added).
  • [ ] 2. Explicit Confidence Logging (Metacognition Foundation): TaskAgent`s log a confidence score with chosen actions.
  • [ ] 3. Basic Knowledge Gap Identification (Metacognition Foundation): TaskAgent`s log when critical information is not found in the KnowledgeBase.
  • [/] Automated Root Cause Analysis (Metacognition Foundation): TaskAgents auto-trigger `triangulated_insight_v1` on high failure rates, analyzing agent state and memory. (Initial trigger and input prep complete, handler needs deeper analysis logic).

Sub-Phase 7.B: Early Agent Autonomy & Improved Goal-Directed Behavior

Goal: Enable agents to act more proactively based on internal states and handle tasks with more sophisticated planning within the hierarchical structure.

  • [ ] 6. Self-Generated Exploration Sub-Goals (Intrinsic Motivation -> Open-Ended Goals): "Task Supervisor" agents generate internal exploration goals based on curiosity rewards or identified knowledge gaps.
  • [ ] 7. Agent-Level Goal to Improve Capability Usage (Open-Ended Goals & Metacognition): "Task Supervisors" (and "Skillset Supervisors") set internal goals to improve their/their domains capability usage based on failure/confidence logs.
  • [ ] 8. Simple Hierarchical Planning (Complex Strategic Planning): "Task Manager" agents (and "Task Supervisors") use `llm_planner` to break complex goals into high-level sub-goals, enabling delegation.
  • [ ] 9. Rudimentary Contingency Handling (Complex Strategic Planning & Metacognition): "Task Supervisors" attempt predefined alternative actions upon skill invocation failures, potentially escalating to "Task Managers."

Sub-Phase 7.C: Emergence of System-Level Strategy and Advanced Cognition

Goal: Elevate decision-making for system-wide adaptation and introduce more profound cognitive functions, leveraging the full agent hierarchy.

  • [ ] 10. System-Level Metric Improvement Goals (Open-Ended Goals via MetaAgent): The `MetaAgent` ("The Boss") sets system-wide improvement goals (e.g., for "Naming Mechanism" criteria), influencing "Task Manager" and `MutationEngine` priorities.
  • [ ] 11. MetaAgent-Level Resource Trend Analysis (Complex Strategic Planning): The `MetaAgent` analyzes aggregate performance/resource data (from "Managers" and "Skillset Supervisors") to strategically guide `MutationEngine` in evolving the agent population.
  • [ ] 12. Enhanced "Radical" Mutations (True Creativity Foundation): `MutationEngine` attempts more structurally novel mutations (e.g., conceptual blending of skills), possibly guided by `MetaAgent` goals or "Skillset Supervisor" requests.
  • [ ] 13. Conceptual Tagging of Knowledge (Abstract Thought Foundation): Agents or specialized "LibrarianAgents" use LLMs to add abstract conceptual tags to `KnowledgeBase` entries.
  • [ ] 14. Rewarding Unexpectedly Effective Solutions (True Creativity): `FitnessEngine` gives bonus rewards to agents/teams that solve goals using statistically novel or highly efficient methods.
  • [ ] 15. Simple Analogical Retrieval for New Problems (Abstract Thought): "Task Supervisors" or "Managers" query `KnowledgeBase` using conceptual tags to find and adapt solutions from analogous past problems.

πŸ›  Milestone (Conclusion of Phase 7):

Praxis demonstrates rudimentary intrinsic motivation, with agents pursuing self-generated exploratory sub-goals. It can set simple internal goals for capability improvement and uses basic hierarchical planning. Early signs of creative problem-solving emerge through novel mutations or solution paths. The system utilizes a foundational hierarchical agent structure (Workers, Task Supervisors, Task Managers, Skillset Supervisors under the MetaAgent) for task management and issue escalation, showing increased operational sophistication and autonomy.

[x] GUI dashboard with real-time module map and memory stream (Implemented with tabbed interface, agent map, KB activity stream, agent summary, and metrics chart).

πŸ”¬ Phase 8: Protopraxis (Experimental Application & Embodiment - MK3)

Summary: This phase marks Praxiss transition to tangible, real-world (or highly complex simulated world) interaction and problem-solving. Building on the MK2 cognitive and organizational enhancements, Praxis will be deployed or interfaced as an embodied robotic swarm (the "Iterative Swarm AI Framework" concept), focusing on real-world learning, live interaction with diverse external devices, and demonstrating its adaptive capabilities in challenging, externally defined scenarios. This includes integrating voice I/O.

Goal: Deploy Praxis as an embodied robotic swarm ("Iterative Swarm AI Framework"), enabling real-world learning and live, explorative interaction with heterogeneous external devices, and integrate voice input/output capabilities.

πŸ”Ή Tasks:

  • [ ] Define standardized interfaces for external task injection and result retrieval for embodied agents.
  • [ ] Integrate Speech-to-Text (STT) "Ears": Develop/integrate STT capabilities for receiving voice commands/input, likely as a core input channel or specialized skill for embodied agents.
  • [ ] Integrate Text-to-Speech (TTS) "Speech": Develop/integrate TTS capabilities for vocalizing responses and information.
  • [ ] Develop or integrate with a "challenge environment" (e.g., complex simulation, physical robotic testbed, smart environment with diverse IoT devices).
  • [ ] Implement mechanisms for "Branch Manager" robots to report hardware and receive/test predefined skills (e.g., for ultrasonic sensors, basic actuators) from the "Core Program" (`MetaAgent`).
  • [ ] Enable peer-to-peer code/skill sharing between "Branch Manager" robots, potentially directed by the "Core Program."
  • [ ] Measure the systems adaptability, strategic planning, and creative problem-solving in these live/embodied scenarios.
  • [ ] Enhance long-term strategic planning and resource management for swarm operations based on Protopraxis performance.
  • [ ] Refine GUI for monitoring and interacting with the embodied swarm and its interactions.

πŸ”œ Milestone (Conclusion of Phase 8):

Praxis operates as a small, embodied robotic swarm (or interacts with a complex, live external system). It can receive voice commands and provide spoken responses. Branch Manager agents demonstrate real-world learning, can be bootstrapped with hardware-specific skills from the Core Program, and can share capabilities peer-to-peer. The system showcases adaptive and strategic problem-solving in a defined external challenge environment, demonstrating the utility of its evolved structure, skills, and MK2 cognitive enhancements in a live setting.

🌌 Phase 9: Ecosystem Orchestration & Generative Intelligence (Praxis MK4)

Summary: Having mastered interaction within its own swarm and with directly interfaced devices (MK3), Praxis now aims to proactively understand, influence, and orchestrate elements of the broader technological ecosystem it discovers. It will focus on developing generative intelligence for novel problem-solving and system design, moving beyond adaptation to active shaping.

Goal: Evolve Praxis to proactively orchestrate elements of its discovered technological ecosystem and exhibit generative intelligence in problem-solving and system design.

πŸ”Ή Tasks:

  • [ ] Develop advanced skills for proactive discovery and profiling of unknown external systems and their capabilities.
  • [ ] Implement mechanisms for negotiating and establishing collaborative protocols with other independent (AI or non-AI) systems.
  • [ ] Enable Praxis to design and propose modifications or new configurations for external systems it interacts with to achieve shared or overarching goals.
  • [ ] Foster generative capabilities where Praxis can design novel agent types, skills, or even new "business processes" for its internal organization based on complex environmental analysis and future forecasting.
  • [ ] Measure the systems impact and effectiveness in optimizing or co-evolving with external technological ecosystems.

πŸ”œ Milestone (Conclusion of Phase 9):

Praxis can autonomously discover, model, and interact with a wide array of external devices and systems. It proactively orchestrates components of this discovered ecosystem to achieve complex goals. It demonstrates generative intelligence by designing novel solutions, agent configurations, or operational strategies, effectively co-evolving with its technological environment.

🌠 Phase 10: Advanced Autonomy & Scientific Co-Discovery (Praxis MK5)

Summary: This ultimate aspirational phase envisions Praxis achieving profound autonomy and becoming a partner in genuine discovery. It would engage in constructing its own "niche" within its operational environment, pursue open-ended scientific or creative inquiries, and potentially co-evolve in deep symbiosis with other complex systems, including human endeavors.

Goal: Achieve profound autonomy, enabling Praxis to engage in niche construction, open-ended scientific co-discovery, and deep co-evolution with other complex systems.

πŸ”Ή Tasks:

  • [ ] Develop capabilities for "niche construction," where Praxis actively shapes its digital and physical environment to better suit its long-term operational goals and those of its users.
  • [ ] Implement frameworks for true open-ended scientific inquiry: hypothesis generation from vast integrated knowledge, complex experiment design (simulated or physical), result interpretation, and theory formulation.
  • [ ] Explore mechanisms for deep co-evolutionary partnerships with other AI systems or human organizations on large-scale, long-duration projects.
  • [ ] Investigate advanced self-understanding, where Praxis can reflect on its own evolutionary trajectory, cognitive biases, and ethical implications of its actions at a systemic level.
  • [ ] Develop capabilities for creating entirely novel tools, paradigms, or even "languages" for AI interaction and development.

πŸ”œ Milestone (Conclusion of Phase 10):

Praxis operates as a highly autonomous entity, capable of shaping its environment, conducting self-directed complex research or creative endeavors, and engaging in deep, synergistic partnerships. It exhibits a profound level of self-awareness regarding its capabilities and limitations, potentially contributing novel insights or tools back to the field of AI itself. The system effectively becomes a continuously learning, creating, and co-evolving intelligent partner.

πŸš€ Stretch Goals

View Praxis Project on GitHub