Architecture

Architecture

JUMON is built on a microservices architecture using NATS as the messaging backbone.

Overview

  flowchart TD
    subgraph NATS["Server / NATS Messaging"]
    end

    Client[Client]
    JUMON[JUMON.md]
    Module[module service]
    Chat[chat service]
    Tool[tool service]
    Script[script service]
    Event[event service]
    
    %% Client connections
    Client -->|"executes"| JUMON
    Client -->|"connects to"| NATS
    
    %% JUMON.md to module
    JUMON -->|"processed by"| Module
    
    %% Service connections through NATS
    Module <-->|"via NATS"| NATS
    Chat <-->|"via NATS"| NATS
    Tool <-->|"via NATS"| NATS
    Script <-->|"via NATS"| NATS
    Event <-->|"via NATS"| NATS
    
    %% Direct service connections
    Module -->|"calls"| Script
    Event -->|"triggers"| Script
    Script -->|"utilizes"| Tool
    Script -->|"communicates with"| Chat
    
    classDef client fill:#607d8b,stroke:#455a64,color:white,stroke-width:2px,font-weight:bold
    classDef module fill:#34a853,stroke:#1e8e3e,color:white
    classDef chat fill:#ea4335,stroke:#c5221f,color:white
    classDef tool fill:#fbbc05,stroke:#f29900,color:white
    classDef script fill:#9c27b0,stroke:#7b1fa2,color:white
    classDef event fill:#4285f4,stroke:#174ea6,color:white
    classDef jumon fill:#ff9800,stroke:#e65100,color:white,stroke-width:2px
    classDef nats fill:#4285f4,stroke:#174ea6,color:white,stroke-width:2px,stroke-dasharray: 5 5
    
    class Client client
    class Module module
    class Chat chat
    class Tool tool
    class Script script
    class Event event
    class JUMON jumon
    class NATS nats

Client-Server Model

JUMON follows a client-server architecture:

  • JUMON Client: The command-line interface that users interact with
  • JUMON Server: A background service that manages the execution of modules, scripts, and tools

The client and server communicate via NATS, a lightweight messaging system that provides reliable request-response and publish-subscribe patterns.

When not connected to a server, JUMON automatically launches a temporary server instance to enable execution without dependencies.

What is NATS?

NATS is a simple, secure, and high-performance messaging system designed for modern distributed applications. It enables communication across cloud, on-premise, edge, and mobile environments. NATS supports real-time data streaming and resilient storage through JetStream, with official clients available in multiple programming languages. It’s widely used in production by major companies and is 100% open source.

NATS goes beyond simple messaging by providing a comprehensive suite of features essential for modern applications. It supports request-reply patterns for synchronous communication, persistent key-value stores for configuration and metadata, and object storage for handling large binary data. This all-in-one approach eliminates the need for multiple disparate systems, providing a unified platform for building distributed applications.

Core Services

JUMON is composed of several microservices, each responsible for a specific aspect of the system:

  1. Chat Service (chat): Manages communication with LLM providers

    • Supports multiple providers (OpenAI, Anthropic, Google)
    • Handles streaming responses
    • Manages tool calls and responses
  2. Tool Service (tool): Manages the execution of tools

    • Supports different tool types (WASM, NATS, script)
    • Handles tool resources
    • Validates tool inputs and outputs
  3. Script Service (script): Manages the execution of scripts

    • Parses script content
    • Manages script execution flow
    • Handles script inputs and outputs
  4. Module Service (module): Manages modules

    • Loads modules from local files or git repositories
    • Manages module imports
    • Orchestrates script execution within modules
  5. Event Service (event): Manages events

    • Handles event subscriptions
    • Routes events to appropriate handlers
    • Manages event persistence