How communist-engineer/saaf-os works
Project type and purpose
• SAAF-OS (Self-Adaptive Agent Framework) is an open-source, Python-based AI agent platform.
• It implements a microkernel/event-driven architecture: a central message bus (LangGraph style) orchestrates “modules” (planners, memory, meta-reasoners, world models, audit/RSI engines, contradiction detectors, etc.).
• Key capabilities: dynamic DAG workflow mutation at runtime, tool discovery/integration, vector memory and KG overlay, peer-to-peer delegation via JSON-RPC/A2A.
File structure
• Top-level:
• bus/adapter.py & message_bus_spec.md → the central message bus/interface layer.
• base_agent.py → core agent process entrypoints.
• modules/… → plug-in modules grouped by functionality (contradiction, memory, planner, meta, world_model, rsi, uls).
• models/ → distilled planner ML model.
• losses/ → custom loss functions (e.g., contradiction_loss).
• simulation/ → scenario loader, backends, harness for offline testing.
• scripts/ → CLI entrypoints (run_demo, run_tests, stress_scenarios, view_memory).
• docs (.md files) → architectural design, specs (message bus, memory, planning, recursive self-improvement, polycentric governance, etc.).
• tests/ → unit tests validating each component and scenario.
• governance_rules.toml → governance constraints.
• class_ontology.jsonld, value_vector_schema.json → semantic/embedding specs.
Extract key architecture insights from README
• Uses LangGraph patterns: modules communicate via a directed message bus.
• Vector store (Chroma) + optional knowledge graph for memory.
• Google A2A protocol + JSON-RPC fallback for agent-to-agent.
• Python packaging conventions for extensibility (cookiecutter, setuptools).