How coasys/ad4m works
Main Components of the System
• Core AD4M Logic: This includes the “core” folder (core/) which implements the fundamental types, GraphQL schema, and client libraries (e.g., Ad4mClient). It is the semantic and data modeling layer.
• Executors: There are several executor implementations:
• rust-executor/ (Rust-based, handling agent orchestration, GraphQL server, and interfacing with Holochain, Deno, Prolog, and AI components).
• executor/ (JavaScript executor implementing agent state management, languages, perspectives, and expression logic).
• Language Adapters: The bootstrap-languages/ directory and related “languages” packages implement the pluggable protocols (Languages) that allow data to be stored and retrieved using different underlying protocols (IPFS, Solid, HTTP, etc.).
• Command Line & Client Tools:
• cli/ – Offers CLI tools for initializing the AD4M node, interacting with policies, perspectives, and more.
• / – A helper library for connecting external apps with AD4M executors.
• UI Frontend Components:
• dapp/ – A DApp server that may serve blockchain integrations.
• ui/ – A Tauri-based system tray application (the AD4M Launcher) used for managing nodes.
• Supporting & Testing Infrastructure:
• docs/, tests/, test-runner/ – These provide documentation, integration tests, and automated test frameworks.
• Additional Modules: There are also “hooks”, “patches”, and CI/CD configurations (in .circleci, .github) that keep the development and deployment pipeline in check.
Relationships and Interaction Flow
• The Core Component (core/) provides the basic types and APIs (GraphQL, client libraries) that are consumed by the executors.
• The Executors (both rust-executor/ and executor/) implement the “local-first sovereign node.” They interact with:
• The bootstrap languages to abstract communication protocols.
• External services like Holochain (for DHT and p2p networking) and AI capabilities (via Kalosm/Candle).
• Local storage/persistence services (using components like rust-client/ and local storage libraries).
• The CLI and Connect libraries let users and external applications interact with the running AD4M node. They trigger actions like creating perspectives, posting expressions, and executing semantic queries.
• The UI (dapp/ and ui/) serves as the user interface, providing a graphical means of invoking the node’s capabilities.
• The overall data flow is largely decentralized: Agents create expressions (signed data items) that are processed by the executors and spread across the network using pluggable Languages. Perspectives then interpret these expressions to build a semantic view, while Social DNA enables collaborative meaning making.
Architectural Patterns & Design Principles
• Agent-Centric, Distributed Architecture: Every user runs a “node” that encapsulates identity, data storage, and protocol handling.
• Self-Recursive Bootstrap: The core concepts (Agents, Languages, Perspectives) are themselves implemented as languages, making the system extensible and evolvable.
• Decoupling & Loose Coupling: The project cleanly separates the UI, API (GraphQL), and execution environments (Rust/JS executors), with clear boundaries for testing and CI/CD.
• Pluggability & Protocol Abstraction: The “bootstrap-languages” and language adapter modules indicate a design where new protocols can be added or swapped without overhauling the core system.