Skip to content

Latest commit

Β 

History

156 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Conclave β€” Multi-Provider Context Unification Platform

Build Status Java Version Spring Boot React Version Inference Engine

Conclave is an enterprise-grade multi-agent collaboration workspace designed to unify conversation context across fragmented local Large Language Models (LLM) run via Ollama.

The platform serves as a systems engineering portfolio showcasing advanced Java/Spring Boot orchestration patterns, real-time WebSocket communication, thread-safe pessimistic locking, and reactive state management.


Related Writing


🎯 Project Overview & Motivation

The Problem

The generative AI landscape is highly siloed. Power users frequently "tab-hop" between different model interfaces to leverage their unique strengths (e.g., Llama 3 for coding, Mistral for creative writing, Gemma for structured logical tasks). This workflow introduces Context Fragmentation: users must manually copy-paste background information, goals, and previous outputs between tabs to maintain a coherent thread. This results in:

  1. Context Tax: High cognitive load and wasted time manually syncing state across multiple windows.
  2. Information Decay: Loss of details, nuances, and conversational history during copy-pasting.
  3. Token Inefficiency: Redundant transcript uploads that bloat local context windows and system memory.

The Solution: Context Unification

Conclave provides a unified "meeting room" where multiple models participate as distinct agents in a single, moderated thread. Rather than binding database schemas to one vendor, Conclave stores all turns in a provider-agnostic Canonical Schema (CanonicalMessage).

Outgoing history is dynamically mapped to the target vendor's API format at runtime, and incoming responses are normalized back. All models share the same "memory" and objective state automatically, eliminating manual copy-pasting.


πŸ“Έ Workspace Showcase

1. Interactive Application Flows

Here is the step-by-step visual workflow of the Conclave Console, from authentication to room configuration:

πŸ” Login & Authentication Portal πŸ› οΈ Room Configuration Wizard
Login Page Room Creation Wizard

2. Live E2E Multi-Agent Slogan Generation Run

Below is the actual visual verification of a completed E2E multi-agent execution run. It shows a user prompt triggering a sequential chain of local LLM responses from Llama 3 (Lead-Writer) and Mistral (Code-Critic) streaming in real-time over WebSockets:

Live E2E Multi-Agent Slogan Generation Run

3. Conclave Console Dashboard Mockup

Below is a mockup of the Conclave Console, showcasing the multi-agent room layout with color-coded message bubbles and the pause control desk:

Conclave Dashboard Mockup


πŸš€ High-Level Architecture

The following diagram maps the high-level system topology, protocol boundaries, and integration flows of Conclave. It details how the React client interacts with the Spring Boot service and local Ollama daemon:

graph TB
    subgraph "Client Panel (React 19)"
        UI[Console Client UI]
        Zustand[(Zustand State Store)]
    end

    subgraph "Transport Gateway"
        REST[REST API - Port 8080]
        WS[WebSocket STOMP Channel]
    end

    subgraph "Orchestration Core (Spring Boot)"
        Security[Stateless JWT Filter]
        Interceptor[STOMP Upgrade Interceptor]
        Orch[MessageOrchestratorImpl]
        Pipeline[PipelineManagerImpl]
        Janitor[WorkflowStateServiceImpl]
        Registry[ModelRegistryImpl]
    end

    subgraph "Infrastructure Tier"
        DB[(PostgreSQL 16 Database)]
        Ollama[Ollama Server - Port 11434]
    end

    %% Network flows
    UI -->|HTTPS Requests| REST
    UI -->|STOMP subscriptions| WS
    REST --> Security
    WS --> Interceptor

    Security --> Orch
    Interceptor --> Orch
    
    Orch -->|Dynamic Bean Resolution| Registry
    Orch -->|Acquire Lock| DB
    Orch -->|Context Compression| Janitor
    
    Registry -->|Local Inference| Ollama
    
    Orch -->|Push chunks chunk-by-chunk| WS
    WS -->|CONTENT_CHUNK| Zustand
    Zustand -->|Re-render UI Nodes| UI
Loading

πŸ› οΈ Key Features

  • Multi-Model Schema Translation: Out-of-the-box translation mapping canonical history records to Llama 3 special tokens, Mistral INST format, and Gemma control token structures.
  • Dynamic Registry Resolution: A custom @Service registry resolving Spring AI client beans dynamically at runtime based on assigned roles.
  • Real-time WebSocket Streaming: Standardized STOMP protocol channels pushing model "typing" states (TURN_STARTED), word-by-word streaming deltas (CONTENT_CHUNK), and completion usage metrics (TURN_COMPLETED) to clients.
  • Pause & Intervene (Pessimistic Locking): Database-level locks (SELECT FOR UPDATE) halting active sequential queues instantly when a pause is triggered, allowing users to inject manual corrections (isIntervention = true) before resuming the pipeline.
  • Context Janitor (Auto-Compression): Automatically triggers when message logs exceed 10. Invokes Llama 3 to compress history into a structured WorkflowState (draft and comments) and purges middle database rows, cutting token costs by up to 75%.

πŸ’» Technology Stack & Rationale

Layer Selected Tech Version Rationale
Backend Spring Boot 3.3.1 Solid baseline for Dependency Injection, security filters, and transaction scopes.
Concurrency Java (JDK) 21 Utilizes Virtual Threads (Project Loom) to handle slow blocking LLM calls at scale without exhausting thread pools.
AI Integration Spring AI 1.0.0-M1 Standardizes chat client interfaces across local models using Ollama.
Database PostgreSQL 16 Relational consistency. Enforces pessimistic write locks (SELECT FOR UPDATE) for pipeline safety.
Realtime Gateway WebSockets (STOMP) Spring Message Multiplexed subscription routing and custom headers for real-time events.
Frontend React 19 High-performance rendering loops during real-time streams.
State Store Zustand latest Decouples WebSocket stream callbacks from React re-render paths.
Styling Tailwind CSS latest High-density grid alignments, HSL color elevations (Level 0-3), and autofill overrides.

πŸ“‚ Repository Structure

Conclave/
β”œβ”€β”€ docker-compose.yml                      # Provisions PostgreSQL 16 local instance
β”œβ”€β”€ README.md                               # This file (Repository Landing Page)
β”œβ”€β”€ Docs/                                   # Architectural Specifications & Index
β”‚   β”œβ”€β”€ README.md                           # Documentation Index & Navigation Portal
β”‚   β”œβ”€β”€ PRD.md                              # Vision, requirements, and scope limits
β”‚   β”œβ”€β”€ System_Architecture.md              # Class diagrams, JPA mappings, execution flow
β”‚   β”œβ”€β”€ DB_Schema.md                        # ER diagrams, pessimistic locking, index designs
β”‚   β”œβ”€β”€ API_Specification.md                # Endpoint specs, WebSocket STOMP payload schemas
β”‚   β”œβ”€β”€ Security.md                         # JWT details, WebSocket auth interceptor flow
β”‚   β”œβ”€β”€ Error_Handling_Strategy.md          # Global Exception Handler and recovery flow
β”‚   β”œβ”€β”€ WebSocket_Architecture.md           # Message routing and fallback retry strategies
β”‚   β”œβ”€β”€ Testing_Strategy.md                 # Validation matrix across all project tiers
β”‚   β”œβ”€β”€ UI_Design.md                        # Front-end layout structures and color guides
β”‚   β”œβ”€β”€ Model_Adapter_Strategy.md           # Prompt token mapping strategies
β”‚   β”œβ”€β”€ Portfolio_And_Interview_Readiness_Defense.md  # System design highlights and FAQs
β”‚   β”œβ”€β”€ Release_Notes_v1.0.0.md             # Version 1.0.0 release log
β”‚   β”œβ”€β”€ Learning/                           # Onboarding Engineering Handbook
β”‚   β”‚   β”œβ”€β”€ README.md                       # Handbook Index / Table of Contents
β”‚   β”‚   └── 01_Developer_Environment_Setup.md ... 09_Tailwind_Customization_For_Tactical_UIs.md
β”‚   └── Roadmap/                            # Implementation Phases
β”‚       β”œβ”€β”€ README.md                       # Roadmap Index & Development Workflow
β”‚       └── Phase_01_Project_Setup.md ... Phase_12_Documentation_And_Repository_Audit.md
β”œβ”€β”€ backend/                                # Spring Boot Java Application
β”‚   β”œβ”€β”€ README.md                           # Backend Deep Dive & Service Specifications
β”‚   β”œβ”€β”€ pom.xml                             # Maven dependency configuration
β”‚   └── src/main/java/com/conclave/         # Java codebase
β”‚       β”œβ”€β”€ BackendApplication.java         # Main entrance class
β”‚       β”œβ”€β”€ config/                         # Configuration (Async, Security, WebSocket)
β”‚       β”œβ”€β”€ controller/                     # REST controllers (Auth, Room, Chat)
β”‚       β”œβ”€β”€ domain/                         # Canonical DTOs and JPA Entities
β”‚       β”œβ”€β”€ exception/                      # Exception handling structures
β”‚       β”œβ”€β”€ integration/                    # Adapters (Llama/Mistral/Gemma) & Registry
β”‚       β”œβ”€β”€ repository/                     # Spring Data JPA repositories
β”‚       β”œβ”€β”€ security/                       # Security filters and token providers
β”‚       β”œβ”€β”€ service/                        # Message orchestration and pipeline locks
β”‚       └── util/                           # Parsing and validation utilities
└── frontend/                               # React Single Page Client
    β”œβ”€β”€ README.md                           # Frontend Deep Dive & Component Structure
    β”œβ”€β”€ package.json                        # NPM script registry and dependencies
    β”œβ”€β”€ tailwind.config.js                  # Color palette configurations
    β”œβ”€β”€ vite.config.js                      # Dev-server configuration
    β”œβ”€β”€ index.html                          # Root HTML entrance
    β”œβ”€β”€ e2e/                                # Playwright browser integration tests
    └── src/                                # React source folder
        β”œβ”€β”€ App.css / index.css             # Style overrides and design tokens
        β”œβ”€β”€ components/                     # MessageBubble, ChatBar, Sidebar, etc.
        β”œβ”€β”€ services/                       # API and WebSocket client adapters
        β”œβ”€β”€ store/                          # Zustand store managers (auth, room, chat)
        β”œβ”€β”€ tests/                          # Vitest component unit tests
        └── views/                          # Page Views (Login, Register, Setup, Room)

🏁 Setup & Quickstart Guide

For a detailed step-by-step walkthrough, refer to Docs/Learning/01_Developer_Environment_Setup.md.

Step 1: Boot the Database

Provision the local PostgreSQL 16 container:

docker compose up -d

Step 2: Start the Spring Boot Backend

  1. Navigate to the backend folder:
    cd backend
  2. Copy the .env.example file in the root folder to backend/.env (or configure host variables).
  3. Start the application with the dev profile:
    ./mvnw spring-boot:run -Dspring-boot.run.profiles=dev
    The backend server starts on http://localhost:8080.

Step 3: Start the React Client

  1. Navigate to the frontend folder:
    cd ../frontend
  2. Install node modules and start the Vite local server:
    npm install
    npm run dev
    Open your browser to http://localhost:5173.

πŸ”Œ Local Inference Setup (Ollama)

To run local models:

  1. Install Ollama on your machine.
  2. Pull the required models:
    ollama pull llama3
    ollama pull mistral
    ollama pull gemma
  3. Verify Ollama is running locally on port 11434 (curl http://localhost:11434).

🧬 System Workflow & Pipeline Control

  1. User Message Submission: The user submits a prompt mentioning models (e.g. "@llama3 write a function, @mistral review it").
  2. Context Resolution: The backend receives the message, parses the mentions, and locks the room using a pessimistic database lock to enforce transaction isolation.
  3. Pipeline Sequential Loop: The backend iterates through the mentioned models sequentially.
  4. Adapter Translation: Before invoking the model via Ollama, the message history is translated into the model's native format.
  5. Streaming Output: Model responses are streamed back chunk-by-chunk via the WebSockets STOMP broker directly updating the React Zustand store.
  6. Compression (Janitor): If the history length exceeds 10 messages, the WorkflowStateServiceImpl runs a compression pass to keep token size low and purges older DB messages.
  7. Pause/Resume: The user can pause execution mid-pipeline, insert an intervention, and resume, updating the database state immediately.

πŸ§ͺ Testing

The repository includes test suites spanning the entire development lifecycle:

  • Backend Unit & Integration Tests: Run mvn test in the backend/ directory to run adapter schema validations, dynamic registry mappings, and concurrency lock thread tests.
  • Frontend Unit Tests: Run npm run test inside frontend/ to run component-level tests.
  • Playwright E2E Integration Tests: Run npm run test:e2e inside frontend/ to spin up a mock-driven user session, validating page navigation and room setup workflows.

For the full testing strategy, review Docs/Testing_Strategy.md.


πŸ“– Documentation Index

Use the table below to navigate to the core documentation modules:

Document Direct Link Purpose
Documentation Portal Docs/README.md Entry point to all specifications, diagrams, and audits.
Product Requirements Docs/PRD.md Vision, target audience, features list, and constraints.
System Architecture Docs/System_Architecture.md High-level system structure, database design, and sequence diagrams.
Database Schema Docs/DB_Schema.md Entity relationships, pessimistic lock descriptions, and indices.
Security Architecture Docs/Security.md Stateless JWT security, WebSocket handshake, and endpoint authority.
Engineering Handbook Docs/Learning/README.md 9-chapter onboarding curriculum covering specific backend/frontend implementations.
Implementation Roadmap Docs/Roadmap/README.md 12 atomic phases and milestones for building Conclave.

🚦 Future Roadmap

  • Vector RAG Integration (v2.0.0): Document uploads and automatic vector chunking to inject relevant context during LLM inference.
  • Billing Engine (v2.0.0): Support Stripe billing integrated with audited token usage logs.
  • Parallel Consensus (v3.0.0): Query multiple models simultaneously and generate a combined evaluation via a critic model.

🀝 Contributing

Contributions are welcome. Please ensure that:

  1. All Maven tests pass (mvn test).
  2. Frontend lint checks pass (npm run lint).
  3. You follow the Git branch name policy defined in Docs/Roadmap/README.md.

πŸ† Acknowledgements

  • Spring Boot & Spring AI teams for simplifying local model clients.
  • Ollama project for enabling lightweight local model inference.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Multi-agent AI consensus platform orchestrating local Ollama models with Spring Boot and React.

Resources

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages