agentleFS
gustavoeenriquezgustavoeenriquez/MakerAi/CLAUDE.md

MakerAi

CLAUDE.md212 starsChanged 2 months agoMITView on GitHub

MakerAI is an AI orchestration framework for Delphi developers (v3.8). It provides components for integrating multiple LLM providers (OpenAI, Claude, Gemini, Ollama, Groq, DeepSeek, Kimi, GLM/Z.ai, Qwen/Alibaba, Grok, Mistral, Cohere, LM Studio, GenericLLM), RAG systems (vector and graph-based), MCP servers/clients, A2A agent interoperability, autonomous agents, observability, guardrails and native ChatTools into Delphi applications. Supports Delphi 10.4 Sydney through 13 Florence (limited: 10.4 Sydney; full support: 11 Alexandria+). v3.8 highlights (sep 2026): Jev (TypeSafe AI) para decisiones calibradas sin pasar por…

  • Reads credentials
  • Sends data out

The file

We split this CLAUDE.md into the rules it gives an agent

11 rules. About 0 are common, 5 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    No hay pipeline CI/CD configurado.

    line 35
  2. Distinctive:

    Add these folders to Delphi Library Path (Tools > Options > Language > Delphi > Library):

    line 49
  3. Very specific:

    Android screen capture: Not implemented (uMakerAi.Utils.ScreenCapture.pas)

    line 87
  4. Distinctive:

    Whisper streaming mode: Not yet implemented

    line 88
  5. Very specific:

    Chat State Machine: All chats follow states defined in TAiChatState (acsIdle -> acsConnecting -> acsWriting -> acsToolCalling -> …

    line 187
  6. Very specific:

    Create Source/Chat/uMakerAi.Chat.[ProviderName].pas inheriting from TAiChat

    line 298
  7. Very specific:

    Add the unit to MakerAI.dpk package

    line 310
  8. Distinctive:

    All packages require standard Delphi RTL, RESTComponents, LiveBindings, and Indy.

    line 314
  9. Distinctive:

    Delete existing BPL files from Delphi's BPL output directory

    line 389
  10. Distinctive:

    Verify all 16 library paths are added to Delphi Library Path (see Required Library Paths).

    line 394
  11. Very specific:

    Ensure the environment variable is set system-wide (not just in the current terminal).

    line 398

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

MakerAI is an AI orchestration framework for Delphi developers (v3.8). It provides components for integrating multiple LLM providers (OpenAI, Claude, Gemini, Ollama, Groq, DeepSeek, Kimi, GLM/Z.ai, Qwen/Alibaba, Grok, Mistral, Cohere, LM Studio, GenericLLM), RAG systems (vector and graph-based), MCP servers/clients, A2A agent interoperability, autonomous agents, observability, guardrails and native ChatTools into Delphi applications. Supports Delphi 10.4 Sydney through 13 Florence (limited: 10.4 Sydney; full support: 11 Alexandria+).

v3.8 highlights (sep 2026): Jev (TypeSafe AI) para decisiones calibradas sin pasar por un LLM (enrutar agentes, SmartDispatch, guardrails de tools y de entrada, evals, rerank RAG con filtro de inyecciones, etiquetado masivo, enrutador de modelos, medición de consumo); driver Qwen (Alibaba) completo; skills en formato SKILL.md (TAiSkills con use_skill bajo demanda para cualquier chat, TAiSkill/TLLMNode arreglados, parser y cliente PPM comunes); Computer Use en Linux. Cambios de comportamiento (6): TLS verificado en POSIX (rompe endpoints autofirmados sin InsecureSkipVerify), IAiMemoryStorage exige el namespace (issue #127, rompe storages propios), Gemini ya ejecuta funciones de usuario, Model vacío usa los parámetros del modelo por defecto TLLMNode.DriverName vacío por defecto y tool_choice forzado solo en la primera llamada (antes loop sin fin). Defaults revisados: Gemini gemini-3.8-flash, OpenAI gpt-6-sol, Claude sigue en claude-haiku-4-5. MAKERAI_BREAKING_CHANGE = True.

v3.7 highlights (sep 2026): refresco de Computer Use en los dos proveedores vivos — Claude estaba roto (computer_20251124 ya lo rechaza el API; ahora computer_toolset_20260801, sin parametros y con 17 herramientas nombradas) y OpenAI estrena el tool nativo computer con gpt-6-astra, que manda un lote de acciones por turno; ambos APIs convergieron en no declarar dimensiones y devolver coordenadas en pixeles del screenshot. Ademas: driver GLM (Zhipu/Z.ai), fixes de RAG sobre pgvector y de contabilidad de tokens/cache.

v3.6 highlights (ago 2026): MCP spec 2026-07-28 stateless dual-era (server/discover + _meta por request, con fallback automático al handshake legacy) y patrón MRTR (elicitation con reintento); observabilidad OpenTelemetry (TAiTelemetry, OTLP/HTTP con GenAI semconv, trazas distribuidas vía traceparent en _meta) instrumentando chat, tools, MCP, agentes y RAG; protocolo A2A 1.0 (TAiA2AServer/TAiA2AClient/TAiA2ARemoteAgentTool — primera implementación Delphi, con federación de grafos); TAiGuardrails (política de tool calls en el choke point de TAiFunctions) y TAiEvalRunner (evals con LLM-as-judge opcional); primera suite de regresión automatizada en Tests/RegressionSuite.

v3.5 highlights (ago 2026): canal tipado ModelConfig (ModelCaps/SessionCaps/Tool_Active/ThinkingLevel fuera de Params/RTTI, con pins por campo y migración de compatibilidad); suite de voz full-duplex (TAiGrokRealtimeChat speech-to-speech, TAiOpenAiRealtimeTranslate, gpt-transcribe); refresh completo de los 9 providers cloud probado runtime (Claude 5 adaptive, Gemini 3.5/3.6, Voxtral TTS, Kimi K3, DeepSeek V4, Cohere A+, Groq qwen3.6, xAI grok-4.3/4.5); generación de video nativa Grok; LastError poblado en todos los paths de error; driver MSSQL para RAG Vector.

v3.4 highlights: registro selectivo de drivers restaurado — TAiChatConnection ya no fuerza la carga de todos los providers. Cada driver se auto-registra solo cuando se importa explícitamente. Para cargar todos los drivers de una vez, agregar uMakerAi.Chat.Initializations al uses.

v3.3 highlights: nuevo sistema de orquestación TAiCapabilities (ModelCaps/SessionCaps) que unifica y simplifica la configuración de capacidades por modelo; soporte de modelos actualizado para todos los providers (Feb 2026).

Official Website: https://makerai.cimamaker.com

Language note: Code comments, variable names, and some documentation are in Spanish. When writing new code or comments, follow the existing style of the file being edited (Spanish if the file uses Spanish, English otherwise).

Git workflow: master is the main/release branch. dev is the active development branch. PRs target master.

Testing: Tests/RegressionSuite/ es la suite de regresión del framework (101 casos, in-process, sin API keys, ~5 s). Construida sobre TAiEvalRunner; cubre MCP dual-era + MRTR, agentes, A2A 1.0 + federación, guardrails, serialización de tool results y el propio runner de evals. Ejecutar antes de cada release:

msbuild Tests/RegressionSuite/MakerAiRegressionSuite.dproj /p:Config=Release /p:Platform=Win64
Tests/RegressionSuite/Win64/Release/MakerAiRegressionSuite.exe        # exit 0 = verde
Tests/RegressionSuite/Win64/Release/MakerAiRegressionSuite.exe --json report.json   # para CI

No hay pipeline CI/CD configurado. Los subsistemas visuales y los proveedores LLM reales se siguen verificando manualmente con los 19+ demos de Demos/.

Building and Installation

Package Compilation Order

Compile and install packages in this exact order:

  1. Source/Packages/MakerAI.dpk - Runtime core (~98 units)
  2. Source/Packages/MakerAi.RAG.Drivers.dpk - Database connectors (PostgreSQL)
  3. Source/Packages/MakerAi.UI.dpk - FMX visual components
  4. Source/Packages/MakerAiDsg.dpk - Design-time editors (requires VCL, DesignIDE)

Group project: Source/Packages/MakerAiGrp.groupproj

Required Library Paths

Add these folders to Delphi Library Path (Tools > Options > Language > Delphi > Library):

  • Source/Agents
  • Source/Chat
  • Source/ChatUI
  • Source/Core
  • Source/Design
  • Source/Embeddings
  • Source/MCPClient
  • Source/MCPServer
  • Source/Memory
  • Source/Packages
  • Source/RAG
  • Source/Realtime
  • Source/Resources
  • Source/Tools
  • Source/Utils
  • Source/WebSocket

Running Demos

Open Demos/DemosVersion31.groupproj in Delphi IDE to access all demo projects.

Testing MCP Servers

# Run demo server
AiMCPServerDemo.exe --protocol sse --port 8080

# Test via curl
curl -X POST http://localhost:8080/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"tools/list","id":1}'

Known Issues

  • MCP SSE Server is experimental (intermittent connectivity)
  • Linux compilation requires manual path adjustments
  • macOS support is incomplete (MAKERAI_SUPPORT_MACOS = False in version.inc)

Incomplete Features (code TODOs)

  • Android screen capture: Not implemented (uMakerAi.Utils.ScreenCapture.pas)
  • Whisper streaming mode: Not yet implemented
  • Async transcription: OpenAI async transcription mode pending
  • OpenAI Audio streaming events: speech.audio.delta and transcript.text.delta parsing not implemented
  • Mistral OCR annotations: Feature stub present but unimplemented
  • Claude Citations (RAG nativo): Implementación parcial disponible; soporte completo pendiente
  • Gemini Speech cost estimation: Token/cost tracking not yet implemented
  • Gemini Realtime STT: uMakerAi.Realtime.Gemini.pas — stub implementado, conexión y envío de audio pendientes

Architecture

Overview Diagram

┌─────────────────────────────────────────────────────────────┐
│  Application / Demos                                        │
└──────┬──────────────────┬──────────────────┬────────────────┘
       │                  │                  │
┌──────v──────┐  ┌────────v────────┐  ┌──────v──────────────┐
│  ChatUI     │  │  Agents         │  │  Design-Time (Dsg)  │
│  TChatList  │  │  TAIAgentManager│  │  Property editors   │
│  TChatInput │  │  TAIBlackboard  │  │  VCL + DesignIDE    │
└──────┬──────┘  └────────┬────────┘  └──────┬──────────────┘
       │                  │                  │
┌──────v──────────────────v──────────────────v────────────────┐
│  Chat Drivers                                               │
│  OpenAI│Claude│Gemini│Ollama│Groq│Mistral│DeepSeek│Kimi│...│
│  TAiChatConnection (universal connector via DriverName)     │
└──────────────────────────┬──────────────────────────────────┘
                           │
┌──────────────────────────v──────────────────────────────────┐
│  Core Layer                                                 │
│  TAiChat (abstract) │ TAiMediaFile │ TAiChatMessages        │
└──────┬───────────────────┬──────────────────┬───────────────┘
       │                   │                  │
┌──────v──────┐  ┌─────────v────────┐  ┌──────v──────────────┐
│  Tools      │  │  RAG             │  │  MCP                │
│  Functions  │  │  Vectors + Graph │  │  Client + Server    │
│  Shell      │  │  VQL + GQL       │  │  StdIO/HTTP/SSE     │
└─────────────┘  └──────────────────┘  └─────────────────────┘

Core Layers

Core (Source/Core/): Foundation classes

  • uMakerAi.Core.pas - Base types: TAiMediaFile, TAiFileCategory, TAiChatMediaSupport, TAiCapability, TAiCapabilities, chat states
  • uMakerAi.Chat.pas - Abstract TAiChat base class; incluye ModelCaps, SessionCaps, EnsureNewSystemConfig; orquestador interno RunNew (privado — no llamar directamente; usar AddMessageAndRun o Run)
  • uMakerAi.Chat.Messages.pas - Message handling (TAiChatMessage, TAiChatMessages)
  • uMakerAi.Embeddings.pas - Embedding generation

Chat Drivers (Source/Chat/): LLM-specific implementations

  • uMakerAi.Chat.AiConnection.pas - TAiChatConnection universal connector (switch providers via DriverName property)
  • Provider-specific drivers: TAiOpenChat, TAiClaudeChat, TAiGeminiChat, TAiOllamaChat, TAiGroqChat, TAiDeepSeekChat, TAiKimiChat, TAiGrokChat, TAiMistralChat, TCohereChat, TAiLMStudioChat, TAiGenericChat
  • uMakerAi.Chat.Initializations.pas - Driver registration and default model parameters via TAiChatFactory

Agents (Source/Agents/): Autonomous agent framework

  • uMakerAi.Agents.pas - Graph-based agent orchestration with TAIAgentManager, TAIAgentsNode, TAIAgentsLink
  • TAIBlackboard - Shared state between agent nodes
  • Link modes: lmFanout, lmConditional, lmManual, lmExpression

RAG (Source/RAG/): Retrieval-Augmented Generation

  • uMakerAi.RAG.Vectors.pas - Vector-based RAG with reranking
  • uMakerAi.RAG.Graph.Core.pas - Knowledge graph RAG engine
  • uMakerAi.RAG.Graph.GQL.pas - Graph query language
  • uMakerAi.RAG.Vectors.VQL.pas - Vector query language

MCP (Source/MCPClient/, Source/MCPServer/): Model Context Protocol

  • uMakerAi.MCPClient.Core.pas - MCP client for consuming external servers
  • Server implementations: StdIO, HTTP, SSE, Direct

Tools (Source/Tools/): Capabilities framework

  • uMakerAi.Tools.Functions.pas - Function calling system (TAiFunctions, TAiToolsFunction)
  • Provider tools: Whisper (STT), DALL-E, Sora (video), Veo (video via Gemini)
  • Agent tools: TAiShell, TAiTextEditorTool, TAiComputerUseTool
  • Tool interfaces: IAiPdfTool, IAiVisionTool, IAiSpeechTool, IAiWebSearchTool

WebSocket (Source/WebSocket/): Standalone RFC 6455 WebSocket client (used by Realtime module)

  • uMakerAi.WebSocket.Client.pas - TAiWSClient — pure-Pascal RFC 6455 + HTTP Upgrade + reader thread; uses ITlsTransport interface
  • uMakerAi.WebSocket.SChannel.pas - TSChannelTransport — TLS via secur32.dll (Windows native, zero extra DLLs; tested ✅)
  • uMakerAi.WebSocket.OpenSSL.pas - TOpenSSLTransport — TLS via dlopen(libssl.so) (Linux/macOS; compiles, not yet tested on real hardware)
  • uMakerAi.WebSocket.Android.pas - TAndroidSSLTransport — TLS via javax.net.ssl.SSLSocketFactory (JNI; compiles, not yet tested on real hardware)

Realtime (Source/Realtime/): Real-time audio streaming (STT via WebSocket)

  • uMakerAi.Realtime.pas - Abstract base TAiRealtimeBase + TAiRealtimeFactory; resampler PCM16, VAD modes, thread-safe events
  • uMakerAi.Realtime.AiConnection.pas - TAiRealtimeConnection universal connector (same pattern as TAiChatConnection)
  • uMakerAi.Realtime.OpenAI.pas - TAiOpenAiRealtimeSTT — WebSocket to wss://api.openai.com/v1/realtime, 24 kHz PCM16; full implementation
  • uMakerAi.Realtime.Gemini.pas - TAiGeminiRealtimeSTT — 16 kHz PCM16; stub, pendiente implementación
  • uMakerAi.Realtime.Grok.pas - TAiGrokRealtimeChat — xAI Grok Voice speech-to-speech, wss://api.x.ai/v1/realtime, protocolo compatible OpenAI Realtime, 24 kHz PCM16; implementado, pendiente prueba runtime
  • uMakerAi.Realtime.WebSocket.pas - compatibility shim; re-exports TAiRealtimeWSClient → TAiWSClient (Source/WebSocket/)

ChatUI (Source/ChatUI/): FMX visual components

  • TChatList - Chat container with markdown rendering
  • TChatInput - Text/voice/attachment input bar

Key Design Patterns

Universal Connector Pattern: TAiChatConnection abstracts provider differences. Set DriverName property to switch between providers without code changes.

Media File Abstraction: TAiMediaFile handles images, PDFs, audio across all providers. Use TAiFileCategory to identify file types.

Chat State Machine: All chats follow states defined in TAiChatState (acsIdle -> acsConnecting -> acsWriting -> acsToolCalling -> acsReasoning -> acsFinished/acsError). Additional states: acsWaitingForInput for interactive flows.

Driver Registration: Chat drivers register via uMakerAi.Chat.Initializations.pas using TAiChatFactory.Instance.RegisterUserParam(). Custom drivers inherit from TAiChat.

Model Capabilities Configuration (v3.3): Model capabilities are configured per-provider and per-model in uMakerAi.Chat.Initializations.pas usando el nuevo sistema unificado:

  • ModelCaps (TAiCapabilities) — capacidades nativas del modelo vía completions (e.g., [cap_Image, cap_Reasoning])
  • SessionCaps (TAiCapabilities) — capacidades deseadas en la sesión; Gap = SessionCaps − ModelCaps activa bridges automáticamente
  • ThinkingLevel — nivel de razonamiento (tlLow, tlMedium, tlHigh)
  • Tool_Active — habilita function calling

API eliminada (no usar en RegisterUserParam): NativeInputFiles, NativeOutputFiles, ChatMediaSupports, EnabledFeatures fueron eliminados de la API pública. Existen internamente en el engine (calculados automáticamente desde ModelCaps/SessionCaps vía SetModelCaps/EnsureNewSystemConfig), pero NO deben usarse directamente.

Agent Graph Execution Model

Agents use a directed graph with nodes (TAIAgentsNode) and links (TAIAgentsLink):

  • Link modes: lmFanout (parallel), lmConditional (if/else), lmManual, lmExpression (binding expressions)
  • Join modes: jmAny (first arrival wins), jmAll (wait for all inputs)
  • Execution status: esRunning, esCompleted, esError, esTimeout, esAborted
  • Nodes communicate via TAIBlackboard shared state dictionary

Key Files Reference

TaskPrimary File
Add new LLM providerSource/Chat/uMakerAi.Chat.*.pas (inherit from TAiChat)
Configure model capabilitiesSource/Chat/uMakerAi.Chat.Initializations.pas
Modify capability orchestrationSource/Core/uMakerAi.Chat.pas (RunNew privado, EnsureNewSystemConfig)
Add TAiCapability valueSource/Core/uMakerAi.Core.pas (TAiCapability enum)
Modify function callingSource/Tools/uMakerAi.Tools.Functions.pas
RAG vector operationsSource/RAG/uMakerAi.RAG.Vectors.pas
RAG graph operationsSource/RAG/uMakerAi.RAG.Graph.Core.pas
Agent orchestrationSource/Agents/uMakerAi.Agents.pas
MCP server creationSource/MCPServer/uMakerAi.MCPServer.Core.pas
Add Realtime STT providerSource/Realtime/uMakerAi.Realtime.pas (inherit TAiRealtimeBase)
Realtime universal connectorSource/Realtime/uMakerAi.Realtime.AiConnection.pas
Version/feature flagsSource/Core/uMakerAi.Version.inc

Naming Conventions

  • Unit prefix: uMakerAi. (e.g., uMakerAi.Chat.OpenAi.pas)
  • Class prefix: TAi or TAI (e.g., TAiChat, TAIAgentManager)
  • Interface prefix: IAi (e.g., IAiPdfTool, IAiVisionTool)
  • Driver naming: TAi[Provider]Chat (e.g., TAiOpenChat, TAiClaudeChat, TAiGeminiChat). Exception: TCohereChat does not follow this convention.

Delphi Version Compatibility

Compiler Version Reference

CompilerVersionDelphi VersionSupport Level
34.0Delphi 10.4 SydneyLimited (minimum supported)
35.0Delphi 11 AlexandriaFull support
36.0Delphi 12 AthensFull support (primary conditional split)
37.0Delphi 13 FlorenceFull support (latest tested)

Key Conditional Split: CompilerVersion 36

The codebase has 79 conditional compilation directives. The primary split is at CompilerVersion 36 (Delphi 12):

  • < 35: Uses uJSONHelper.pas for missing TJSONObject helper methods
  • >= 35: Uses native System.JSON helpers, TRESTClient.SynchronizeEvents := False
  • < 35: TMultipartFormData.AddStream without AShareOwnership parameter (Delphi 10.4 only)
  • >= 35: TMultipartFormData.AddStream with AShareOwnership: Boolean parameter (Delphi 11+)
  • >= 36: TThread.ForceQueue available (Delphi 12+); use TThread.Queue as fallback for D11
{$IF CompilerVersion >= 34}  // Delphi 10.4 Sydney+
  Client.SynchronizeEvents := False;
{$IFEND}

{$IF CompilerVersion < 35}
uses uJSONHelper;  // JSON helper for older Delphi versions
{$ENDIF}

Feature Flags (uMakerAi.Version.inc)

All MAKERAI_HAS_* feature flags are True by default (OpenAI, Whisper, Embeddings, Tool Calling, RAG Vector/Graph, MCP, Chat Connection, UI Components, Agents). Platform flags: Windows, Linux, Mobile are True; macOS is False (incomplete). MAKERAI_API_LEVEL = 38.

Thread Safety Notes

Critical Sections (TCriticalSection)

LockClassProtects
FLockTAiChatMessageMedia file list operations
FLockTAIBlackboardShared state dictionary
FJoinLockTAIAgentsLinkJoin counter for multi-input nodes
FActiveTasksLockTAIAgentManagerActive task count tracking
FOutputLockTAiMCPServerStdioStdout writes from multiple threads
FSessionsLockTAiMCPServerSSESSE session list
FCSTAiVoiceMonitorAudio capture state

Thread Queuing

  • TThread.Queue(nil, proc) -- used by all Chat drivers and UI components for non-blocking main-thread updates (40+ call sites)
  • TThread.Synchronize(nil, proc) -- used by Agents (node callbacks) and Gemini live streaming for blocking synchronization
  • TThreadedQueue<TJSONObject> -- async message buffering in MCP Client
  • TThreadedQueue<string> -- SSE outbox in MCP Server

Thread Pools

  • TAIAgentManager.FThreadPool: TThreadPool -- executes agent node callbacks on worker threads
  • Agent OnExecute handlers run on pool threads; use TThread.Synchronize to access UI

Gemini Live Streaming

TMonitor.Enter/Exit(FPendingScreenshots) protects a shared screenshot list during Gemini's real-time video streaming.

Adding a New LLM Provider

  1. Create Source/Chat/uMakerAi.Chat.[ProviderName].pas inheriting from TAiChat
  2. Implement required abstract methods for API communication
  3. Register the driver in uMakerAi.Chat.Initializations.pas:
    TAiChatFactory.Instance.RegisterUserParam('ProviderName', 'Max_Tokens',  '16000');
    TAiChatFactory.Instance.RegisterUserParam('ProviderName', 'Tool_Active', 'True');
    TAiChatFactory.Instance.RegisterUserParam('ProviderName', 'ModelCaps',   '[cap_Image]');
    TAiChatFactory.Instance.RegisterUserParam('ProviderName', 'SessionCaps', '[cap_Image]');
    // Modelo con reasoning:
    TAiChatFactory.Instance.RegisterUserParam('ProviderName', 'my-model', 'ModelCaps',    '[cap_Image, cap_Reasoning]');
    TAiChatFactory.Instance.RegisterUserParam('ProviderName', 'my-model', 'ThinkingLevel', 'tlMedium');
  4. Add the unit to MakerAI.dpk package

Dependencies

All packages require standard Delphi RTL, RESTComponents, LiveBindings, and Indy. Additional notable dependencies:

  • MakerAi.RAG.Drivers.dpk: FireDAC (PostgreSQL database access)
  • MakerAi.UI.dpk: FMX (FireMonkey visual framework)
  • MakerAiDsg.dpk: VCL + designide (design-time IDE integration only)

Package Dependency Chain

MakerAI.dpk (standalone - no internal deps)
   ^
   |--- MakerAi.RAG.Drivers.dpk (requires MakerAI + FireDAC)
   |--- MakerAi.UI.dpk (requires MakerAI + FMX)
   |--- MakerAiDsg.dpk (requires MakerAI + VCL + DesignIDE)

Environment Variables

API keys use the @VAR_NAME convention. When a key property starts with @, the framework resolves it via GetEnvironmentVariable() at runtime (handled in TAiChat.ApiKey getter and TParamsRegistry).

Convention: Each provider uses [PROVIDER]_API_KEY (e.g., OPENAI_API_KEY, CLAUDE_API_KEY, GEMINI_API_KEY, GROQ_API_KEY, DEEPSEEK_API_KEY, KIMI_API_KEY, GROK_API_KEY, MISTRAL_API_KEY, COHERE_API_KEY). OLLAMA_API_KEY is usually empty for local setups.

AiConnection.ApiKey := '@OPENAI_API_KEY';  // Resolved via GetEnvironmentVariable
AiConnection.ApiKey := 'sk-...';           // Literal key

Error Handling

Custom Exception Classes

ExceptionModuleWhen Raised
EVGQLParserErrorRAG/VQLInvalid VQL syntax (lexer/parser errors)
EVGQLTranslationErrorRAG/VQLVQL-to-SQL compilation failures
EMCPClientExceptionMCPClientMCP transport or protocol errors
EPythonArchitectureErrorUtilsPython architecture mismatch (x86 vs x64)

Error Patterns

  • Chat state machine: Errors transition to acsError state; handle via OnStateChange event
  • Agent graph: Invalid graph structure (missing nodes, circular deps) raises Exception during Validate()
  • API errors: HTTP errors from providers are caught in try/except and surfaced via OnError events
  • Most validation uses Exception.Create(msg) or Exception.CreateFmt(msg, [args]) -- catch with on E: Exception do

Component Selection Guide

TAiChat vs TAiChatConnection

ComponentUse WhenAvoid When
TAiChatConnectionProvider-agnostic code, switching providers at runtime via DriverNameYou need provider-specific API features
TAi[Provider]ChatDirect access to provider-specific features, fine-grained controlYou want portable/switchable code

RAG: Vector vs Graph

ApproachUse WhenAvoid When
TAiRAGVector (Vector RAG)Document Q&A, similarity search, semantic retrievalRelationship-heavy data, traversal queries
RAG Graph (uMakerAi.RAG.Graph.Core)Knowledge graphs, entity relationships, traversal queriesSimple document similarity search

MCP Server Transports

TransportUse WhenProtocol
StdIOIDE integration, Claude Desktop, local toolsstdin/stdout
HTTPREST API integration, request/response patternHTTP POST
SSEStreaming responses, real-time updates (experimental)Server-Sent Events
DirectIn-process usage, no IPC overheadDirect method calls

Troubleshooting

Package installation fails with BPL version conflict

  1. Close all Delphi instances
  2. Delete existing BPL files from Delphi's BPL output directory
  3. Recompile packages in the correct order (MakerAI -> RAG.Drivers -> UI -> Dsg)

"Unit not found" compilation errors

Verify all 16 library paths are added to Delphi Library Path (see Required Library Paths).

API key not resolving

Ensure the environment variable is set system-wide (not just in the current terminal). The @VAR_NAME syntax requires GetEnvironmentVariable() to find the value at runtime.

JSON parsing errors on older Delphi versions

Delphi < 11 (CompilerVersion < 35) requires uJSONHelper.pas in the uses clause. This is handled automatically via conditional compilation, but verify the unit is accessible in the library path.

MCP SSE Server intermittent connectivity

The SSE transport is experimental. For production use, prefer StdIO or HTTP transport.

External Documentation

Detailed documentation is available in Docs/Version 3/:

DocumentDescription
Manual Instalacion.docxInstallation guide
uMakerAi-ChatConnection.docxComplete TAiChatConnection guide with examples
uMakerAi.Chat.docxCore chat system reference
TAiChatClaude-Guia de Uso.docxClaude provider-specific guide
TAiChatGemini-Guia de Uso.docxGemini provider-specific guide
uMakerAi-RAG.docxRAG system documentation
uMakerAI-RAGGraph.docxGraph RAG documentation
uMakerAi.ToolFuncions.docxFunction calling / Tools documentation
TAiAgentes-FLUENT GRAPH BUILDER.docxAgent graph builder guide
uMakerAi-MCP.Server.EN.pdfMCP Server guide (English)
uMakerAi-MCP.Server.ES.pdfMCP Server guide (Spanish)
uMakerAi-Agents.ES.pdfAgents documentation (Spanish)
uMakerAi-RAG.ES.pdfRAG documentation (Spanish)
uMakerAi-AudioBridge.mdAudio bridge for real-time call translation: loopback/mic capture, playback to selectable device, VB-CABLE setup & distribution licensing (Spanish)
uMakerAi-Skills.md / .EN.mdSkills en formato SKILL.md: TAiSkills (bajo demanda con use_skill/read_skill_file), TAiSkill + TLLMNode, TAiPrompts.ApplySkill, registry PPM y seguridad

Navigation

This project uses a tiered CLAUDE.md system. Each Source/ subdirectory and each demo has its own CLAUDE.md with module-specific guidance. Read the relevant sub-CLAUDE.md before working on a specific module.

Source Modules

DirectoryDocumentation
Source/Top-level source overview
Source/Core/Foundation classes, TAiChat, TAiMediaFile
Source/Chat/LLM provider drivers
Source/Agents/Agent orchestration framework
Source/RAG/Retrieval-Augmented Generation
Source/MCPServer/MCP server implementations
Source/MCPClient/MCP client connector
Source/Tools/Function calling, Shell, ComputerUse
Source/ChatUI/FMX visual components
Source/Realtime/Real-time STT drivers (OpenAI WebSocket, Gemini stub)
Source/WebSocket/RFC 6455 WebSocket client + TLS transports (SChannel/OpenSSL)
Source/Utils/Voice monitor, diff updater
Source/Design/Design-time property editors
Source/Resources/Embedded resources

Demos & Docs

DirectoryDocumentation
Demos/Demo projects overview
Tests/RegressionSuite/Suite de regresión (MCP, agentes, A2A, guardrails, evals)
Docs/Documentation index

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.