Skip to content

Latest commit

 

History

History

README.md

Architecture

This directory contains system architecture documentation for the AI Gateway and related systems.

Overview

The architecture follows a layered approach combining:

  • SLMs (Small Language Models) for cost-effective routing, classification, and tool selection
  • LLMs for complex reasoning and final synthesis

Canonical Principle

Use SLMs to decide, filter, classify, compress, and prepare. Use LLMs to reason, reconcile, synthesize, and communicate.

Documentation Structure

docs/architecture/
├── README.md                    # This file
├── 01-system-context.md         # ADR: System Context
├── 02-container-architecture.md # ADR: Container Architecture
├── 03-deployment-trust-boundaries.md # ADR: Deployment & Trust Boundaries
├── 04-observability-telemetry.md    # ADR: Observability & Telemetry
├── 05-slm-llm-decision-flow.md   # ADR: SLM→LLM Decision Flow
├── 06-shared-contracts.md       # ADR: Shared Contracts
├── 07-repo-ownership-map.md      # ADR: Repository Ownership
├── systems/                     # Individual system documentation
│   ├── ai-gateway.md
│   ├── cognitive-mesh.md
│   ├── codeflow-engine.md
│   ├── agentkit-forge.md
│   ├── phoenix-rooivalk.md
│   └── mystira.md
└── reference/                   # Reference and planning docs
    ├── cross-system.md
    ├── c4-architecture.md
    ├── deployment-observability.md
    ├── contracts.md
    ├── operations-patterns.md
    ├── dashboards.md
    ├── slm-implementation-matrix.md
    ├── slm-management-plan.md
    ├── matrix-gateway.md
    ├── matrix-cognitive-mesh.md
    ├── matrix-codeflow.md
    ├── matrix-agentkit.md
    ├── matrix-rooivalk.md
    ├── matrix-mystira.md
    └── strategic/                # Strategic guidance
        ├── README.md
        ├── 01-why-slms-matter.md
        ├── 02-gateway-slm-use-cases.md
        ├── 03-cognitive-mesh-use-cases.md
        ├── 04-codeflow-use-cases.md
        ├── 05-agentkit-use-cases.md
        ├── 06-rooivalk-use-cases.md
        ├── 07-deployment-model.md
        └── 08-implementation-order.md

docs/architecture/ ├── README.md # This file ├── systems/ # Individual system documentation │ ├── ai-gateway.md │ ├── cognitive-mesh.md │ ├── codeflow-engine.md │ ├── agentkit-forge.md │ ├── phoenix-rooivalk.md │ └── mystira.md └── reference/ # Reference and planning docs ├── cross-system.md ├── c4-architecture.md ├── deployment-observability.md ├── contracts.md ├── operations-patterns.md ├── dashboards.md ├── slm-implementation-matrix.md ├── slm-management-plan.md ├── matrix-gateway.md ├── matrix-cognitive-mesh.md ├── matrix-codeflow.md ├── matrix-agentkit.md ├── matrix-rooivalk.md ├── matrix-mystira.md └── strategic/ # Strategic guidance ├── README.md ├── 01-why-slms-matter.md ├── 02-gateway-slm_use-cases.md ├── 03-cognitive-mesh-use-cases.md ├── 04-codeflow-use-cases.md ├── 05-agentkit-use-cases.md ├── 06-rooivalk-use-cases.md ├── 07-deployment-model.md └── 08-implementation-order.md


docs/architecture/
├── README.md # This file
├── systems/ # Individual system documentation
│ ├── ai-gateway.md
│ ├── cognitive-mesh.md
│ ├── codeflow-engine.md
│ ├── agentkit-forge.md
│ ├── phoenix-rooivalk.md
│ └── mystira.md
└── reference/ # Reference and planning docs
├── cross-system.md
├── slm-implementation-matrix.md
├── slm-management-plan.md
├── matrix-gateway.md
├── matrix-cognitive-mesh.md
├── matrix-codeflow.md
├── matrix-agentkit.md
├── matrix-rooivalk.md
├── matrix-mystira.md
└── strategic/ # Strategic guidance
├── README.md
├── 01-why-slms-matter.md
├── 02-gateway-slm-use-cases.md
├── 03-cognitive-mesh-use-cases.md
├── 04-codeflow-use-cases.md
├── 05-agentkit-use-cases.md
├── 06-rooivalk-use-cases.md
├── 07-deployment-model.md
└── 08-implementation-order.md

Systems

Reference

Strategic Guidance

Quick Reference

System SLM Role Key Document
AI Gateway routing, policy checks, cost prediction systems/ai-gateway.md
Cognitive Mesh agent routing, task decomposition systems/cognitive-mesh.md
PhoenixRooivalk operator summaries only systems/phoenix-rooivalk.md
CodeFlow Engine CI intelligence, log analysis systems/codeflow-engine.md
AgentKit Forge tool selection, context compression systems/agentkit-forge.md
Mystira story classification, moderation, age-fit systems/mystira.md

Implementation Order

  1. AI Gateway SLM router — Highest immediate cost-leverage
  2. CodeFlow Engine CI/PR classifier — Fastest operational value
  3. Cognitive Mesh decomposer/router — Strong leverage once taxonomy stabilizes
  4. AgentKit Forge tool selector — Useful once tool inventory is mature
  5. PhoenixRooivalk operator interpreter — Valuable, keep isolated from critical control
  6. Mystira story control layer — For child-safe story generation with SLM-based moderation

Tiered Model Strategy

Tier Use For Examples
Tier 0 deterministic/non-LLM regex, schemas, policies
Tier 1 SLM classification, decomposition, tool selection
Tier 2 LLM synthesis, complex reasoning

Diagram Tools

This documentation uses Mermaid for inline diagrams (rendered in VS Code, GitHub, etc.).

For high-quality published diagrams, consider:

  • Figma MCP - AI-powered Figma integration via VS Code extension
  • Mermaid Live Editor - Online Mermaid diagram editing
  • Draw.io - Traditional diagram editor

Using Figma MCP for Architecture Diagrams

The MCP Figma VS Code extension enables AI-assisted diagram creation:

  1. Install the extension in VS Code
  2. Configure MCP server for your AI assistant
  3. Use AI to generate and edit architecture diagrams in Figma

This is useful for creating polished, branded diagrams for presentations and documentation.