Concepts
Cóncépts // Sýstém_Dóc
ᚠ ᛫ ᛟ ᛫ ᚱ ᛫ ᛒ ᛫ ᛟ ᛫ ᚲ
This document explains the core concepts and architecture of the ForbocAI SDK. Understanding these abstractions will help you design effective AI-powered NPCs for your games.
Architecture Overview
Cortex
The Cortex is the local-first inference engine. It runs quantized Small Language Models (SLMs) in your environment—no external API required.
Key Properties
- Zero Latency — No network round-trips; inference happens on-device
- Zero Cost — No API token fees; users provide their own compute
- Privacy-First — Prompts and responses never leave the device
- Offline-Capable — Works without internet after initial model download
Model Selection
The Cortex supports multiple quantized models. Smaller models are faster but less capable:
Agent
An Agent is an autonomous entity with a persona, state, and memory. Agents process inputs and produce structured outputs (dialogue + actions).
Agent Lifecycle
Agent State
An agent maintains internal state that influences its behavior:
Processing Flow
When agent.process() is called:
- Recall — Relevant memories are retrieved via semantic search
- Prompt — System prompt + persona + memories + context + input are assembled
- Generate — Cortex generates a structured response (dialogue + action)
- Validate — Bridge validates the action against application rules
- Update — Agent state is updated based on the interaction
- Store — The interaction is stored as a new memory
Memory (RAG Pipeline)
The Memory system provides persistent, semantic recall for agents. It uses Retrieval-Augmented Generation (RAG) to inject relevant past events into the agent’s context.
How It Works
- Observe — Events are converted to natural language descriptions
- Embed — Text is converted to vectors using a local embedding model
- Store — Vectors are persisted in IndexedDB
- Recall — Semantic search finds relevant memories before generation
Memory Types
Memory Decay (Optional)
Memories can be configured to decay over time or with distance:
Bridge (Neuro-Symbolic Validation)
The Bridge ensures AI-generated actions are valid within your application’s rules. It prevents hallucinations from breaking game state.
The Problem
LLMs can generate anything, including impossible actions:
The Solution
The Bridge validates actions before execution:
Validation Flow
Soul
A Soul is a portable snapshot of an agent’s complete being—its persona, memories, and state. Souls enable agents to persist across sessions or transfer between applications.
Soul Schema
Storage Options
Economy & Protocol (Solana)
The ForbocAI Protocol is built on Solana to enable a high-frequency, low-latency Asset Economy.
The $FAI Token
$FAI is the unified utility token for the entire ecosystem.
- Network: Solana (SPL Token)
- Contract:
7zwfQkkPv9aUF6VXA8CbZabJYpXCRJTYbQnjxjynpump - Utility:
- Minting Souls: Spending $FAI to “birth” new agent NFTs.
- Inference Credits: Spending $FAI to buy API credits for the Cloud Brain (Logic Engine).
- Marketplace: The base currency for trading high-value Agents.
Metaplex Core (The Asset Standard)
We use Metaplex Core instead of legacy standards (like ERC-721) because it is designed for Applications, not just Art.
- Low Cost: Minting and updating assets costs fractions of a penny.
- Dynamic Data: Core assets have efficient plugin systems that allow us to update the “Memory Hash” of an agent frequently without incurring high gas fees.
- Zero Copy: The asset handles are lightweight, enabling games to check ownership of thousands of agents instantly.
Ghost Agents
Ghost Agents are headless AI instances that autonomously test your application. They run at accelerated speed to validate content, find bugs, and collect metrics.
Capabilities
- Exploration — Traverse levels to measure coverage and find dead-ends
- Dialogue Testing — Exercise conversation trees to find broken paths
- Balance Metrics — Collect time-to-kill, death rates, resource curves
- Regression Detection — Compare runs across builds to catch regressions
Example Usage
Learn More
The ForbocAI SDK is built on functional programming principles. For a deeper understanding of the patterns used in this architecture:
