SkillAgentSearch skills...

CppKAI

KAI is a distributed computing model written in modern C++. Using custom language translators and an executor, KAI provides full reflection, persistence and cross-process communications without having to modify existing source code. KAI Comes with an automated, generational tricolor garbage collector, and Console- and Window-based interfaces.

Install / Use

/learn @cschladetsch/CppKAI
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

KAI - Distributed Object Model for C++ Image

Build status CodeFactor License

KAI is a network distributed Object Model for C++ with full runtime reflection, persistence, and incremental garbage collection. No macros are needed to expose fields or methods to the scripting runtime, including external code from other libraries.

Objects and compute can be distributed across Nodes in a Domain.

Environment Conventions

Docs and scripts may refer to $KAI_ROOT as the repository root. Set it once per shell:

export KAI_ROOT=/path/to/KAI

System Architecture Overview

The KAI system provides a multi-layered architecture that enables distributed object programming with multiple language frontends:

graph TB
    subgraph "Application Layer"
        USER[User Applications]
        SCRIPTS[Scripts & Automation]
        TOOLS[Developer Tools]
    end
    
    subgraph "Language Layer"
        RHO[Rho Language<br/>Infix Syntax<br/>Python-like]
        PI[Pi Language<br/>Stack-based<br/>Forth-like]
        TAU[Tau Language<br/>Interface Definition<br/>Code Generation]
    end
    
    subgraph "Console & Networking"
        CONSOLE[Interactive Console<br/>Multi-language REPL]
        P2P[Peer-to-Peer<br/>Console Networking]
        NETCMD[Network Commands<br/>Remote Execution]
    end
    
    subgraph "Execution Engine"
        EXECUTOR[Stack-based Executor<br/>Virtual Machine]
        COMPILER[Multi-language<br/>Compiler/Translator]
        CONTINUATION[Continuation Support<br/>Advanced Control Flow]
    end
    
    subgraph "Core Object Model"
        REGISTRY[Type Registry<br/>Object Factory<br/>Reflection System]
        OBJECTS[Distributed Objects<br/>Network Transparency]
        GC[Incremental GC<br/>Tri-color Algorithm]
    end
    
    subgraph "Platform & Runtime"
        MEMORY[Memory Management<br/>Smart Pointers]
        SERIALIZE[Serialization<br/>Network Protocol]
        PLATFORM[Cross-platform<br/>Windows/Linux/macOS]
    end
    
    subgraph "External Dependencies"
        BOOST[Boost Libraries]
        ENET[ENet Networking]
        GTEST[Google Test]
        CMAKE[CMake Build]
    end
    
    %% Application connections
    USER --> RHO
    USER --> PI  
    USER --> TAU
    SCRIPTS --> CONSOLE
    TOOLS --> CONSOLE
    
    %% Language layer connections
    RHO --> COMPILER
    PI --> EXECUTOR
    TAU --> COMPILER
    
    %% Console connections
    CONSOLE --> EXECUTOR
    CONSOLE --> P2P
    P2P --> NETCMD
    NETCMD --> EXECUTOR
    
    %% Execution engine connections
    COMPILER --> EXECUTOR
    EXECUTOR --> CONTINUATION
    EXECUTOR --> REGISTRY
    
    %% Core object model connections
    REGISTRY --> OBJECTS
    REGISTRY --> GC
    OBJECTS --> SERIALIZE
    
    %% Platform connections
    EXECUTOR --> MEMORY
    OBJECTS --> MEMORY
    SERIALIZE --> PLATFORM
    
    %% External dependencies
    PLATFORM --> BOOST
    P2P --> ENET
    PLATFORM --> GTEST
    PLATFORM --> CMAKE
    
    %% Styling
    style USER fill:#e1f5fe
    style RHO fill:#c8e6c9
    style PI fill:#ffecb3
    style TAU fill:#f3e5f5
    style CONSOLE fill:#fff3e0
    style EXECUTOR fill:#e8f5e8
    style REGISTRY fill:#fce4ec
    style OBJECTS fill:#e0f2f1
    style GC fill:#f1f8e9

Key System Components

  • Multi-Language Frontend: Rho (infix), Pi (stack-based), and Tau (IDL) languages with seamless interoperability
  • Interactive Console: Real-time REPL with peer-to-peer networking capabilities
  • Distributed Object Model: Network-transparent objects with type safety across node boundaries
  • Stack-based Execution: High-performance virtual machine with continuation support
  • Incremental Garbage Collection: Smooth memory management without performance spikes
  • Code Generation: Tau IDL generates proxy/agent pairs for network communication
  • Cross-platform Support: Unified development experience across major operating systems

Demo Views

Pi is a postfix language.

Console

Arch

Window illustrates how Rho is transpiled to Pi. I should make an animated gif of this. But here's a screenshot in the interim. By the way, just using the *Pi tab is effectively like using the Console but has a debugger:

Window

Documentation & Architecture

Main Documentation Hub

Documentation Guide - Start here for organized navigation of all documentation | Doc/ README

System Architecture

Architecture Resources - Comprehensive system architecture documentation and diagrams

Development Guides

Component Documentation

Testing & Examples

External Dependencies

  • External Libraries: Ext/ - Third-party dependencies and libraries
  • Build System: CMake - Build configuration and macros

Quick Start Examples

  • Build from the repository root with ./b
  • Run the current full suite with ./run_all_tests.sh
  • Enable networking features with ./b --network
  • Run ./Scripts/run_rho_demo.sh for a comprehensive demo of Rho language features
  • Run ./Scripts/calc_test.sh for a demonstration of network calculation
  • Run ./demo_console_communication.sh for interactive console-to-console networking demo
  • Example scripts in Test/Language/*/Scripts directories

Key Features

  • Zero-Macro Reflection: Expose C++ types and methods to scripting without macros or source modifications
  • Distributed Computing: Share both data and computation across networked nodes
  • Console Networking: Real-time console-to-console communication with command sharing
  • Multiple Languages: Use Pi (stack-based), Rho (infix), or Tau (IDL) as needed
  • Type Safety: Full type checking across network boundaries
  • Incremental GC: Smooth, constant-time garbage collection with no spikes
  • Cross-Platform: Works on Windows, Linux, macOS, and Unity3D
  • Network Transparency: Access remote objects as if they were local
  • Dynamic Load Balancing: Automatically distribute workload across network nodes

Core Components

  • Registry: Type-safe object factory for creating, managing, and reflecting C++ objects
  • Domain: A collection of registries across network nodes
  • Executor: Stack-based virtual machine for executing code
  • Memory Management: Incremental tri-color garbage collector

Languages

  • Pi: Stack-based RPN language inspired by Forth
  • Rho: Python-like infix language that compiles to Pi (fully functional with all tests passing)
  • Tau: Interface Definition Language (IDL) for network components

Console Networking

KAI consoles can communicate with each other over the network in real-time:

# Console 1 (Server)
./console
pi> /network start 14600
pi> 2 3 +
View on GitHub
GitHub Stars21
CategoryDevelopment
Updated6h ago
Forks4

Languages

C++

Security Score

95/100

Audited on Apr 3, 2026

No findings