Skip to content

SILVIA Core – ApiBrain Reference ​

Version: 3.1

Namespace: CognitiveCode.Silvia.Api


All 102 public methods in SilviaApiBrain have comprehensive XML documentation for IDE Support. This includes:

  • Complete class-level overview and architectural documentation
  • All inference methods (GetResponse, NextResponse, etc.)
  • All security methods with explicit security validation notes
  • All jump/bypass methods with security architecture clarifications
  • All Markov chain and dynamic generation methods
  • All pattern matching and wildcard methods
  • All context management methods
  • All script compilation and export methods
  • All category and PAGER tag methods
  • All brain loading, saving, and stream operations

Critical Security Documentation: All behavior jump methods (SetJump, SetJumpToGroup, SetJumpToSubgroup, SetBypassResponse) are explicitly documented to clarify that they request jumps subject to security validation - they do not bypass security architecture. Behaviors exceeding user security clearance will not execute regardless of jump attempts.


Table of Contents ​

  1. Overview
  2. Architecture
  3. Core Inference Methods
  4. Response Stack & Diagnostics
  5. Behavior Control & Navigation
  6. Dynamic Output Generation
  7. Knowledge Management
  8. Compiler & Script Management
  9. Context & Conversational State
  10. Security & Access Control
  11. Optimization & Performance
  12. PAGER Tag Management
  13. Advanced Features
  14. Platform-Specific Integrations
  15. Best Practices

Overview ​

ApiBrain is the inference engine at the heart of SILVIA's Behavior Stack. It provides deterministic AI reasoning through a hybrid pattern-matching system that combines:

  • Conceptual Pattern Matching: Multi-layered semantic understanding
  • Dynamic Output Generation: Markov-based language construction
  • Behavioral Intelligence: Hierarchical knowledge organization
  • Security-Aware Inference: Multi-level access control
  • Real-time Compilation: Hot-reloadable C# scripting

What Makes SILVIA Different ​

Unlike black-box neural networks, SILVIA's inference is:

  • Auditable: Every response traces to specific behaviors
  • Deterministic: Same input + state = same output
  • Explainable: Response weights show matching confidence
  • Real-time Modifiable: Update knowledge without retraining
  • Security-First: Built-in role-based access control

Modern Use Cases ​

Enterprise Knowledge Systems ​

csharp
// Multi-tenant customer service with role-based responses
var customerCore = SilviaCoreManager.CreateCore("customer_001", "support_brain.sil", true);
customerCore.ApiBrain().SetUserSecurityLevel(1); // Standard customer

var adminCore = SilviaCoreManager.CreateCore("admin_001", "support_brain.sil", true);
adminCore.ApiBrain().SetUserSecurityLevel(5); // Admin access to privileged responses

Industrial IoT Command & Control ​

csharp
// Voice-controlled manufacturing with safety constraints
core.ApiBrain().SetAbsorberThreshold(0.6f); // Require high confidence for commands
core.ApiBrain().SetUserSecurityLevel(2); // Operator level

string response = core.ApiBrain().GetResponse("activate line three", null);
// Only matches if absorber is 60%+ confident AND user has security level >= behavior's level

Hybrid AI Systems ​

csharp
// Combine neural NLU with deterministic reasoning
string userIntent = neuralModel.PredictIntent(rawInput);
string entities = neuralModel.ExtractEntities(rawInput);

// SILVIA handles deterministic business logic
core.SetVariable("$detected_intent", userIntent);
core.SetVariable("$entities", entities);
string response = core.ApiBrain().GetResponse(userIntent, "logs/hybrid.txt");

Architecture ​

Inference Pipeline ​

User Input
    ↓
[Concept Tokenization] ──→ Linguistic atoms + punctuation
    ↓
[Stopword Filtering] ──→ Extract salient concepts
    ↓
[Absorber Matching] ──→ Pattern matching against knowledge base
    ↓
[Security Check] ──→ Verify user authorization
    ↓
[Exuder Selection] ──→ Choose response from matched behavior
    ↓
[Dynamic Generation] ──→ Markov-based construction (if flagged)
    ↓
[Script Execution] ──→ Pre/Post behavior scripts
    ↓
Response Output

Knowledge Hierarchy ​

Brain File (.sil)
├── Behaviors (Groups/Names)
│   ├── Absorbers (Input patterns)
│   ├── Exuders (Output templates)
│   ├── Pre-Behavior Scripts
│   └── Post-Exuder Scripts
├── Concept Dictionary (Atoms)
├── Markov Chains (Dynamic generation)
├── Context Stack (Conversation history)
├── Variables (State management)
└── PAGER Tag Presets (Animation/UI)

Core Inference Methods ​

GetResponse ​

Primary inference method – processes user input and returns AI response.

csharp
public string GetResponse(string input, string io_log, bool nested = false)

Parameters:

  • input – User utterance to process
  • io_log – Optional file path for conversation logging (append mode)
  • nested – If true, uses nested response stack (for recursive inference)

Returns: string – AI-generated response text

Example:

csharp
// Basic usage
string response = core.ApiBrain().GetResponse("What's the weather like?", null);
core.ApiApp().SetTextOutput(response);

// With logging
string response = core.ApiBrain().GetResponse(
    "Schedule meeting for tomorrow",
    "logs/assistant_2025_10.txt"
);

// Nested inference (for sub-dialogues)
string mainResponse = core.ApiBrain().GetResponse("Tell me about AI", null, false);
string clarification = core.ApiBrain().GetResponse("Which aspect?", null, true);

Behavior:

  1. Tokenizes input into concepts
  2. Searches behaviors for matching absorbers
  3. Ranks matches by weight (0.0 to 1.0+)
  4. Applies security filtering
  5. Executes pre-behavior scripts
  6. Selects exuder (random from weighted pool)
  7. Performs dynamic generation if flagged
  8. Executes post-exuder scripts (via ExecutePostEvents)
  9. Returns response text

Notes:

  • Post-events are not auto-executed; call ExecutePostEvents() explicitly
  • Nested responses maintain separate stack from primary responses
  • Input is normalized (lowercase, trimmed) before processing

ExecutePostEvents ​

Executes post-exuder scripts from the last GetResponse call.

csharp
public bool ExecutePostEvents()

Returns: bool – Success/failure of script execution

Example:

csharp
string response = core.ApiBrain().GetResponse("book a flight to Denver", null);
core.ApiApp().SetTextOutput(response);

// Execute any post-exuder scripts (e.g., database updates, API calls)
if (!core.ApiBrain().ExecutePostEvents()) {
    Console.WriteLine("Warning: Post-event script failed");
}

When to Use:

  • Database operations after response generation
  • External API calls triggered by user input
  • State updates that shouldn't block response delivery
  • Multi-step workflows (chaining behaviors)

IsBusy ​

Checks if the brain is currently processing a request.

csharp
public bool IsBusy()

Returns: bool – True if inference is in progress

Example:

csharp
// Thread-safe request handling
if (!core.ApiBrain().IsBusy()) {
    var task = Task.Run(() => {
        string response = core.ApiBrain().GetResponse(userInput, null);
        // Handle response
    });
}

Response Stack & Diagnostics ​

After GetResponse, SILVIA maintains a ranked stack of matching behaviors.

GetResponseBehaviorID ​

Gets the behavior ID from the response stack.

csharp
public int GetResponseBehaviorID(int index)

Parameters:

  • index – Stack position (0 = best match)

Returns: int – Behavior ID, or -1 if invalid index

Example:

csharp
string response = core.ApiBrain().GetResponse("Hello there", null);

int bestBehaviorId = core.ApiBrain().GetResponseBehaviorID(0);
int secondBestId = core.ApiBrain().GetResponseBehaviorID(1);

Console.WriteLine($"Matched Behavior: {bestBehaviorId}");

GetResponseAbsorberID ​

Gets the absorber ID from the response stack.

csharp
public int GetResponseAbsorberID(int index)

Returns: int – Absorber ID within the behavior, or -1 if invalid


GetResponseWeight ​

Gets the match weight (confidence score) from the response stack.

csharp
public double GetResponseWeight(int index)

Returns: double – Match weight (0.0 to 1.0+, higher = better match)

Example:

csharp
string response = core.ApiBrain().GetResponse("turn on the lights", null);

for (int i = 0; i < 5; i++) {
    int behaviorId = core.ApiBrain().GetResponseBehaviorID(i);
    if (behaviorId == -1) break;
    
    double weight = core.ApiBrain().GetResponseWeight(i);
    Console.WriteLine($"Match {i}: Behavior {behaviorId}, Weight {weight:F3}");
}

// Output:
// Match 0: Behavior 42, Weight 0.875
// Match 1: Behavior 38, Weight 0.623
// Match 2: Behavior 55, Weight 0.411

Use Cases:

  • Confidence filtering: Only act if weight > threshold
  • Ambiguity detection: Multiple high-weight matches = ask for clarification
  • Analytics: Track which behaviors are frequently matched

GetVerbal ​

Gets the verbal/TTS version of the response.

csharp
public string GetVerbal(bool nested = false)

Parameters:

  • nested – If true, returns verbal from nested response stack

Returns: string – Verbal response (may differ from text output)

Example:

csharp
string response = core.ApiBrain().GetResponse("What time is it?", null);
string textOutput = response; // "It's 3:45 PM"
string verbalOutput = core.ApiBrain().GetVerbal(); // "It's three forty-five"

core.ApiApp().SetTextOutput(textOutput);
core.ApiApp().SetVoiceOutput(verbalOutput);

GetOutputBehaviorData / GetOutputAbsorberData / GetOutputExuderData ​

Retrieves arbitrary metadata attached to matched behavior/absorber/exuder.

csharp
public string GetOutputBehaviorData(bool nested = false)
public string GetOutputAbsorberData(bool nested = false)
public string GetOutputExuderData(bool nested = false)

Returns: string – Metadata string, or null if not present

Example:

csharp
// In SILVIA Studio, attach JSON metadata to exuders:
// Exuder data field: {"action":"lights_on","zone":"living_room","intensity":80}

string response = core.ApiBrain().GetResponse("turn on living room lights", null);
string exuderData = core.ApiBrain().GetOutputExuderData();

if (!string.IsNullOrEmpty(exuderData)) {
    var command = JsonConvert.DeserializeObject<LightCommand>(exuderData);
    smart_home.ExecuteCommand(command);
}

Use Cases:

  • Embed structured commands in responses
  • Track analytics metadata
  • Store routing information for multi-modal output

SetInteractionDiagnosticsState / GetInteractionDiagnosticsState ​

Enables training/debug mode with verbose inference logging.

csharp
public void SetInteractionDiagnosticsState(bool tf)
public bool GetInteractionDiagnosticsState()

Example:

csharp
// Enable diagnostics for debugging
core.ApiBrain().SetInteractionDiagnosticsState(true);

string response = core.ApiBrain().GetResponse("test input", null);
// Console shows detailed match weights, concept extraction, etc.

core.ApiBrain().SetInteractionDiagnosticsState(false); // Disable for production

Behavior Control & Navigation ​

SILVIA can force specific behaviors to execute, bypassing normal inference.

SetJump ​

Immediately executes a named behavior.

csharp
public bool SetJump(string group, string name, float probability)

Parameters:

  • group – Behavior group name
  • name – Behavior name
  • probability – Execution probability (0.0 to 1.0)

Returns: bool – True if at least one behavior executed

Example:

csharp
// Force a greeting behavior
core.ApiBrain().SetJump("greetings", "welcome_new_user", 1.0f);

// 50% chance to execute upsell behavior
core.ApiBrain().SetJump("sales", "premium_upsell", 0.5f);

Overloads:

csharp
// Delayed jump (async)
public async void SetJump(string group, string name, float probability, float delay)

// Jump after approximate speech duration
public void SetJumpAfterSpeechTime(string group, string name, float probability, float timeScale = 1.0f)

Example – Delayed Jumps:

csharp
// Jump after 3 seconds
core.ApiBrain().SetJump("reminders", "follow_up", 1.0f, 3.0f);

// Jump after AI finishes speaking
core.ApiBrain().SetJumpAfterSpeechTime("smalltalk", "elaboration", 0.8f);

SetJumpToGroup / SetJumpToSubgroup ​

Jumps to random behavior within a group or subgroup.

csharp
public bool SetJumpToGroup(string group, float probability)
public bool SetJumpToSubgroup(string group, string subgroup, float probability)

Example:

csharp
// Random joke from "humor" group
core.ApiBrain().SetJumpToGroup("humor", 1.0f);

// Random tip from "tutorials/beginner" subgroup
core.ApiBrain().SetJumpToSubgroup("tutorials", "beginner", 1.0f);

// If subgroup is null/empty, selects only behaviors without subgroups
core.ApiBrain().SetJumpToSubgroup("tutorials", "", 1.0f);

SetBypassResponse ​

Forces next GetResponse to ignore input and jump to a behavior.

csharp
public bool SetBypassResponse(string group, string name)

Example:

csharp
// Ask a yes/no question
string response = core.ApiBrain().GetResponse("Do you want to continue?", null);
core.ApiApp().SetTextOutput(response);

// Force next input to be interpreted as "yes" response
core.ApiBrain().SetBypassResponse("confirmation", "assume_yes");

string userInput = GetUserInput(); // Could be "yeah", "ok", "sure"...
string result = core.ApiBrain().GetResponse(userInput, null); 
// Bypasses normal inference, executes "confirmation.assume_yes" behavior

Use Cases:

  • State machines (force transitions)
  • Confirmation flows
  • Wizard-style dialogues

NextResponse ​

Advances to the next exuder in the current behavior (if multiple exist).

csharp
public bool NextResponse(string io_log, out string response)

Example:

csharp
// First response
string response = core.ApiBrain().GetResponse("tell me a story", null);
core.ApiApp().SetTextOutput(response);

// Continue story (next exuder in same behavior)
if (core.ApiBrain().NextResponse(null, out string nextPart)) {
    core.ApiApp().SetTextOutput(nextPart);
}

Dynamic Output Generation ​

SILVIA's Markov chain engine generates novel sentences from learned patterns.

GenerateDynamic ​

Generates output expressing specific concepts.

csharp
public string GenerateDynamic(string included, string excluded)

Parameters:

  • included – Space-separated concepts to express
  • excluded – Space-separated concepts to avoid

Returns: string – Dynamically generated sentence

Example:

csharp
// Generate output about "machine learning" but exclude "neural networks"
core.ApiBrain().SetDynamicDepth(4);
core.ApiBrain().SetDynamicAttraction(8);

string output = core.ApiBrain().GenerateDynamic(
    "machine learning algorithms",
    "neural networks deep learning"
);
// Possible output: "Machine learning algorithms analyze patterns in datasets"

GenerateDynamicLimited ​

Generates output limited to specific behaviors.

csharp
public string GenerateDynamicLimited(string included, string excluded, string group, string name)

Parameters:

  • group – Limit generation to this behavior group (null = all)
  • name – Further limit to this specific behavior (null = all in group)

Example:

csharp
// Generate financial advice using only "investment" group knowledge
string advice = core.ApiBrain().GenerateDynamicLimited(
    "portfolio diversification risk",
    "cryptocurrency speculation",
    "investment",
    null
);

GenerateDynamicFromMemory ​

Generates output from conversational feedback stack.

csharp
public string GenerateDynamicFromMemory(string user, string included, string excluded, bool invert)

Parameters:

  • user – Username whose conversation history to use
  • invert – If true, inverts pronouns (first ↔ second person)

Example:

csharp
// Generate summary of what user said about "vacation plans"
string summary = core.ApiBrain().GenerateDynamicFromMemory(
    "user_john",
    "vacation travel destination",
    "work business",
    false
);

Dynamic Generation Parameters ​

Control how SILVIA constructs sentences:

SetDynamicAttraction / GetDynamicAttraction ​

Attraction to specified concepts (higher = more literal inclusion).

csharp
public bool SetDynamicAttraction(int attraction)
public int GetDynamicAttraction()

Example:

csharp
core.ApiBrain().SetDynamicAttraction(10); // High attraction
// Output will aggressively include specified concepts

core.ApiBrain().SetDynamicAttraction(3); // Low attraction
// Output loosely relates to concepts

SetDynamicDepth / GetDynamicDepth ​

Markov chain depth (higher = more grammatically rigid).

csharp
public bool SetDynamicDepth(int depth)
public int GetDynamicDepth()

Typical Values:

  • 2-3 – Creative, free-association style
  • 4-5 – Balanced fluency and creativity
  • 6+ – Highly grammatical, rigid structure

SetDynamicFalloffDepth / GetDynamicFalloffDepth ​

Depth at which statistical falloff begins.

csharp
public bool SetDynamicFalloffDepth(int falloffDepth)
public int GetDynamicFalloffDepth()

SetDynamicFalloff / GetDynamicFalloff ​

Falloff multiplier (how fast rigidity decays).

csharp
public bool SetDynamicFalloff(float falloff)
public float GetDynamicFalloff()

Example:

csharp
core.ApiBrain().SetDynamicDepth(6);
core.ApiBrain().SetDynamicFalloffDepth(3);
core.ApiBrain().SetDynamicFalloff(0.8f);

// Depth 0-3: Rigid Markov traversal
// Depth 4: 80% probability of rigid match
// Depth 5: 64% probability (0.8^2)
// Depth 6: 51% probability (0.8^3)

SetDynamicAdaptation / GetDynamicAdaptation ​

Auto-adapt rigidity to express all required concepts.

csharp
public void SetDynamicAdaptation(bool adapt)
public bool GetDynamicAdaptation()

Example:

csharp
core.ApiBrain().SetDynamicAdaptation(true);
// If knowledge base is insufficient, SILVIA will relax grammatical rules
// to still express all required concepts (may be less fluent)

core.ApiBrain().SetDynamicAdaptation(false);
// SILVIA will express as many concepts as possible within grammatical constraints
// (may omit concepts if knowledge is lacking)

DynamicHasAllConceptsInOne ​

Checks if a single exuder contains all required concepts.

csharp
public bool DynamicHasAllConceptsInOne()

Example:

csharp
string result = core.ApiBrain().GenerateDynamic("artificial intelligence ethics", "");

if (core.ApiBrain().DynamicHasAllConceptsInOne()) {
    // A single exuder had all concepts – high confidence
    core.ApiApp().SetTextOutput(result);
} else {
    // Concepts were scattered across multiple exuders – may be less coherent
    Console.WriteLine("Warning: Low confidence dynamic output");
}

GetDynamicContributors ​

(C# Only) Returns behavior/exuder pairs that contributed to dynamic output.

csharp
public int[] GetDynamicContributors()

Returns: int[] – Alternating [behaviorID, exuderID, behaviorID, exuderID, ...]

Example:

csharp
string output = core.ApiBrain().GenerateDynamic("quantum computing qubits", "");
int[] contributors = core.ApiBrain().GetDynamicContributors();

for (int i = 0; i < contributors.Length; i += 2) {
    int behaviorId = contributors[i];
    int exuderId = contributors[i + 1];
    Console.WriteLine($"  Used: Behavior {behaviorId}, Exuder {exuderId}");
}

Knowledge Management ​

Load / LoadStream ​

Loads brain file(s) into the core.

csharp
public bool Load(string filename, bool merge, bool boot)
public bool LoadStream(BinaryReader brainStream, string[] stopwords, bool merge, bool boot)

Parameters:

  • filename – Path to .sil brain file (can use | separator for multiple files)
  • merge – If true, merges with existing knowledge; if false, replaces
  • boot – If true, executes "boot" behaviors after loading
  • brainStream – Binary stream for embedded/encrypted brains
  • stopwords – Array of stopword strings (for LoadStream)

Example:

csharp
// Load base knowledge
core.ApiBrain().Load("base_knowledge.sil", false, true);

// Merge domain-specific knowledge
core.ApiBrain().Load("medical_terms.sil", true, false);

// Load from encrypted stream
using (var fs = File.OpenRead("secure_brain.sil")) {
    var cryptoReader = core.ApiBrain().GetCryptoReader(fs, "aes256");
    var stopwords = File.ReadAllLines("stopwords.txt");
    core.ApiBrain().LoadStream(cryptoReader, stopwords, false, true);
}

Notes:

  • Brain Reload: If merge=false and boot=true, sensors are automatically reinitialized
  • Loading clears response stack and resets context

Save ​

Saves current brain state to file.

csharp
public bool Save(string filename, string[] groups, bool save_state, bool SILVIA2 = false)

Parameters:

  • filename – Output path for .sil file
  • groups – Array of group names to save (null = all groups)
  • save_state – If true, saves variables and context
  • SILVIA2 – Legacy format flag (use false)

Example:

csharp
// Save entire brain with state
core.ApiBrain().Save("snapshot.sil", null, true);

// Save only "customer_service" and "faq" groups without state
core.ApiBrain().Save("export.sil", new string[] {"customer_service", "faq"}, false);

MergeBrains ​

Merges multiple brain files at runtime.

csharp
public bool MergeBrains(string files, bool boot)

Parameters:

  • files – Pipe-separated list of brain files: "base.sil|addon.sil|custom.sil"

Example:

csharp
// Merge three knowledge bases
core.ApiBrain().MergeBrains("general.sil|industry.sil|company.sil", true);

Export ​

Exports brain to human-readable text format.

csharp
public bool Export(string filename)

Example:

csharp
// Export for review/editing
core.ApiBrain().Export("brain_export.txt");
// Creates: brain_export.txt (behaviors) and brain_export.ex.txt (exuders)

Compiler & Script Management ​

SILVIA embeds a C# compiler for hot-reloadable behavior scripts.

CompileScripts ​

Pre-compiles all behavior scripts.

csharp
public bool CompileScripts()

Example:

csharp
core.ApiBrain().Load("my_brain.sil", false, false);

if (!core.ApiBrain().CompileScripts()) {
    Console.WriteLine("Compilation errors detected!");
    // Check console for error details
} else {
    core.ApiBrain().PostLoadBoot(); // Safe to boot now
}

PostLoadBoot ​

Executes "boot" behaviors after manual script compilation.

csharp
public bool PostLoadBoot()

SetAdditionalReferenceAssemblies / GetAdditionalReferenceAssemblies ​

Manages compiler reference assemblies.

csharp
public bool SetAdditionalReferenceAssemblies(string[] referenceAssemblies)
public string[] GetAdditionalReferenceAssemblies()
public bool[] AddReferenceAssemblies(string[] _additionalAssemblies)

Example:

csharp
// Add references for database and HTTP APIs
core.ApiBrain().SetAdditionalReferenceAssemblies(new string[] {
    "System.Data.SqlClient.dll",
    "Newtonsoft.Json.dll",
    "../CustomLibrary.dll"
});

// Now behavior scripts can use:
// using System.Data.SqlClient;
// using Newtonsoft.Json;

SetTargetCSProjects / AddTargetCSProject / GetTargetCSProjects ​

Compiles external C# projects into SILVIA runtime.

csharp
public bool[] SetTargetCSProjects(string[] targetCSProjects)
public bool AddTargetCSProject(string targetCSProject)
public string[] GetTargetCSProjects()
public bool RemoveTargetCSProject(string _targetCSProject)

Example:

csharp
// Compile helper library project
core.ApiBrain().AddTargetCSProject("C:/Projects/SilviaHelpers/SilviaHelpers.csproj");

// Behavior scripts can now call:
// SilviaHelpers.Utils.ProcessData(...)

SetTargetCSProjsFromSolution / GetCsProjsFromSolution ​

Compiles entire .sln solution.

csharp
public bool SetTargetCSProjsFromSolution(string slnPath)
public string[] GetCsProjsFromSolution(string slnPath)

Example:

csharp
// Load all projects from solution
core.ApiBrain().SetTargetCSProjsFromSolution("C:/Projects/EnterpriseSuite/EnterpriseSuite.sln");

SetAdditionalScriptsPath / GetAdditionalScriptsPath ​

Sets path for shared script includes.

csharp
public bool SetAdditionalScriptsPath(string path)
public string GetAdditionalScriptsPath()

Example:

csharp
core.ApiBrain().SetAdditionalScriptsPath("C:/SilviaScripts/Shared");
// Behavior scripts can reference common utilities in this folder

ExportScriptsForUnity / ExportScriptsAsAssemblyFromUnity ​

AOT compilation for mobile/Unity.

csharp
public bool ExportScriptsForUnity(string scriptFile)
public bool ExportScriptsAsAssemblyFromUnity(string assemblyFileName, string outputDirectory)

Example:

csharp
#if UNITY_EDITOR
// Export scripts as .cs for iOS/Android AOT compilation
core.ApiBrain().ExportScriptsForUnity("Assets/Scripts/BrainScripts.cs");

// Or export as DLL
core.ApiBrain().ExportScriptsAsAssemblyFromUnity("BrainScripts", "Assets/Plugins");
#endif

SetScriptClassType / ClearScriptClassTypes ​

Registers custom script base classes.

csharp
public bool SetScriptClassType(Type t, string internalScriptClassName)
public bool ClearScriptClassTypes()

Example:

csharp
// Allow scripts to inherit from custom base
core.ApiBrain().SetScriptClassType(typeof(MyCustomScriptBase), "MyScriptBase");

// In behavior script:
// public class MyBehavior : MyScriptBase { ... }

Context & Conversational State ​

SILVIA maintains a context stack for multi-turn conversations.

SetContextDepth / GetContextDepth ​

Sets maximum context history depth.

csharp
public bool SetContextDepth(int depth)
public int GetContextDepth()

Example:

csharp
// Keep 5 turns of conversation history
core.ApiBrain().SetContextDepth(5);

// Turn 1: "What's the weather?"
// Turn 2: "And tomorrow?" (SILVIA remembers context: "weather")
// Turn 3: "How about the weekend?" (still has context)

ClearContext ​

Clears conversation context.

csharp
public bool ClearContext()

Example:

csharp
// Start fresh conversation
core.ApiBrain().ClearContext();

AddContext ​

Manually adds context entry.

csharp
public bool AddContext(string input, string response)

Example:

csharp
// Seed context from previous conversation
core.ApiBrain().AddContext(
    "My name is Alice",
    "Nice to meet you Alice"
);

// Now: "What's my name?" will match better due to context

Security & Access Control ​

SetUserSecurityLevel / GetUserSecurityLevel ​

Sets role-based access level (0 = public, higher = privileged).

csharp
public bool SetUserSecurityLevel(int securityLevel)
public int GetUserSecurityLevel()

Example:

csharp
// Public customer
core.ApiBrain().SetUserSecurityLevel(0);
// Can only access behaviors/exuders with security level 0

// Customer service rep
core.ApiBrain().SetUserSecurityLevel(2);
// Can access levels 0-2 (sees internal notes, policies)

// Administrator
core.ApiBrain().SetUserSecurityLevel(5);
// Full access including privileged admin commands

Use Cases:

  • Multi-tenant SaaS with tiered features
  • Medical systems (patient vs doctor vs admin)
  • Industrial control (operator vs supervisor vs engineer)

Optimization & Performance ​

SetAbsorberThreshold / SetReusableThreshold ​

Controls inference confidence thresholds.

csharp
public bool SetAbsorberThreshold(float threshold)
public bool SetReusableThreshold(float threshold)

Parameters:

  • absorberThreshold – Minimum match quality (0.0 to 1.0, default 0.33)
  • reusableThreshold – Fallback match quality (default 100.0 = disabled)

Example:

csharp
// High-stakes application – require strong matches
core.ApiBrain().SetAbsorberThreshold(0.65f);
// Input must match ≥65% of absorber concepts

// Enable reusable exuder fallback for casual responses
core.ApiBrain().SetReusableThreshold(1.2f);
// If no absorber matches, try exuders with aggregate weight ≥1.2

Tuning Guide:

  • High Threshold (0.6+): Safety-critical, command & control, medical
  • Medium Threshold (0.3-0.5): General chatbots, customer service
  • Low Threshold (< 0.3): Creative, exploratory conversations

SetRandomizeResponses ​

Enables/disables random exuder selection.

csharp
public void SetRandomizeResponses(bool flag)

Example:

csharp
core.ApiBrain().SetRandomizeResponses(false);
// Always picks highest-weight exuder (deterministic)

core.ApiBrain().SetRandomizeResponses(true);
// Randomly picks from weighted pool (more varied)

SetOptimization ​

Enables performance optimizations (for low-power devices).

csharp
public void SetOptimization(bool flag)

Example:

csharp
#if EMBEDDED_DEVICE
core.ApiBrain().SetOptimization(true);
// Reduces memory allocations, faster inference (may reduce quality slightly)
#endif

SetUseWordNet / GetUseWordNet ​

Enables WordNet synonym expansion.

csharp
public void SetUseWordNet(bool useWordNet)
public bool GetUseWordNet()

Example:

csharp
#if !MOBILE
core.ApiBrain().SetUseWordNet(true);
// Input: "automobile" also matches "car", "vehicle"
#endif

SetDefaultResponsesEnabled / GetDefaultResponsesEnabled ​

Controls whether "default" behavior is used for unmatched input.

csharp
public void SetDefaultResponsesEnabled(bool enabled)
public bool GetDefaultResponsesEnabled()

Example:

csharp
core.ApiBrain().SetDefaultResponsesEnabled(false);
// If no match, returns null instead of "I don't understand"

SetInteractive ​

Enables interactive mode (for REPL/console interfaces).

csharp
public void SetInteractive(bool interactive)

PAGER Tag Management ​

PAGER tags control animation, expressions, and UI events.

AddPAGERTagPreset ​

Stores a named PAGER tag preset.

csharp
public bool AddPAGERTagPreset(string _tagPresetName, string _tagPresetType, string _tagsData)

Parameters:

  • _tagPresetName – Unique preset name
  • _tagPresetType – Category: "Face", "Body", "LeftHand", "RightHand", or custom
  • _tagsData – XML-like tag string: <Tag param=value />

Example:

csharp
// Store a smile expression
core.ApiBrain().AddPAGERTagPreset(
    "SmileDefault",
    "Face",
    "<FaceExpression type=smile intensity=0.8 />"
);

// Store a hand gesture
core.ApiBrain().AddPAGERTagPreset(
    "ThumbsUp",
    "RightHand",
    "<Gesture type=thumbs_up duration=1.5 />"
);

GetPAGERTagPresetData / RemovePagerTagPreset ​

Retrieves or removes presets.

csharp
public string GetPAGERTagPresetData(string _presetName)
public bool RemovePagerTagPreset(string _presetName)

Example:

csharp
string smileTag = core.ApiBrain().GetPAGERTagPresetData("SmileDefault");
avatar.ApplyExpression(smileTag);

// Clean up unused presets
core.ApiBrain().RemovePagerTagPreset("OldGesture");

GetAllPAGERTagPresets / GetPAGERTagPresetNames / GetPAGERTagPresetTypes / GetPAGERTagPresetStrings ​

Bulk preset retrieval.

csharp
public SilviaTagPresets GetAllPAGERTagPresets()
public List<string> GetPAGERTagPresetNames()
public List<string> GetPAGERTagPresetTypes()
public List<string> GetPAGERTagPresetStrings()

Example:

csharp
// Get all face presets
var allPresets = core.ApiBrain().GetAllPAGERTagPresets();
for (int i = 0; i < allPresets.tagPresetNames.Count; i++) {
    if (allPresets.tagPresetTypes[i] == "Face") {
        string name = allPresets.tagPresetNames[i];
        string tags = allPresets.tagPresetStrs[i];
        facePresetMenu.AddItem(name, tags);
    }
}

Advanced Features ​

Stopword Management ​

Stopwords are low-value words ("the", "a", "is") filtered during concept extraction.

SetStopword / SetStopwords ​

Adds or updates stopwords.

csharp
public bool SetStopword(string stopword, bool state = true)
public bool SetStopwords(string[] stopwords, bool clear = false)

Example:

csharp
// Mark "um" and "uh" as stopwords
core.ApiBrain().SetStopword("um");
core.ApiBrain().SetStopword("uh");

// Bulk load from array
var commonStopwords = new string[] {"the", "a", "an", "is", "are", "was", "were"};
core.ApiBrain().SetStopwords(commonStopwords, true); // clear=true replaces existing

GetStopwords / LoadStopwords ​

Retrieves stopwords or loads from file.

csharp
public string[] GetStopwords()
public string[] LoadStopwords(StreamReader stream)

Example:

csharp
using (var sr = new StreamReader("linguistics/stopwords_en.txt")) {
    var stopwords = core.ApiBrain().LoadStopwords(sr);
    core.ApiBrain().SetStopwords(stopwords, true);
}

RemoveStopwords ​

Strips stopwords from a concept string.

csharp
public string RemoveStopwords(string concepts, string exclude)

Parameters:

  • concepts – Input concept string
  • exclude – Space-separated concepts to keep (even if stopwords)

Example:

csharp
string input = "where is the state of california";
string filtered = core.ApiBrain().RemoveStopwords(input, "where");
// Returns: "where state california"

Wildcard Matching ​

Wildcards (* symbols in absorbers) provide flexible pattern matching.

SetWildcardFloor / GetWildcardFloor / SetWildcardCeiling / GetWildcardCeiling / SetWildcardMultiplier / GetWildcardMultiplier ​

Controls wildcard match weights.

csharp
public bool SetWildcardFloor(float value)
public float GetWildcardFloor()
public bool SetWildcardCeiling(float value)
public float GetWildcardCeiling()
public bool SetWildcardMultiplier(float value)
public float GetWildcardMultiplier()

Example:

csharp
// Wildcards contribute 0.1 to 0.8 to match weight
core.ApiBrain().SetWildcardFloor(0.1f);
core.ApiBrain().SetWildcardCeiling(0.8f);
core.ApiBrain().SetWildcardMultiplier(1.2f);

// Absorber: "my name is *"
// Input: "my name is Alice Smith Johnson"
// Wildcard matches "Alice Smith Johnson", contributes ~0.5 to total weight

Concepts & Tokenization ​

AddConcepts ​

Pre-loads concepts into dictionary.

csharp
public bool AddConcepts(string input, bool punctuate, bool conceptualize)

Example:

csharp
// Ensure technical terms are recognized
core.ApiBrain().AddConcepts("kubernetes docker containerization", false, false);

GetConceptsAsStrings ​

Tokenizes input into concept array.

csharp
public string[] GetConceptsAsStrings(string input, bool punctuate, bool conceptualize)

Example:

csharp
string[] concepts = core.ApiBrain().GetConceptsAsStrings(
    "Hello, how are you?",
    true,  // Include punctuation
    false  // Don't combine into compound concepts
);
// Returns: ["hello", ",", "how", "are", "you", "?"]

GetInputConcepts ​

Returns concepts from last GetResponse call.

csharp
public string[] GetInputConcepts()

Example:

csharp
string response = core.ApiBrain().GetResponse("Tell me about quantum computing", null);
string[] concepts = core.ApiBrain().GetInputConcepts();
// Returns: ["tell", "quantum", "computing"] (stopwords removed)

Narrative Mode Transformation ​

TransformNarrativeMode / GetFirstPerson ​

Inverts pronouns (1st ↔ 2nd person).

csharp
public string TransformNarrativeMode(string input)
public string GetFirstPerson(string input)

Example:

csharp
string userSaid = "I love your design";
string aiPerspective = core.ApiBrain().TransformNarrativeMode(userSaid);
// Returns: "you love my design"

// Store in feedback/memory from AI's perspective
core.ApiFeedback().AddFeedback(aiPerspective);

Addressing Modes ​

SetAddressByName / GetAddressByName ​

Requires AI name in input to respond.

csharp
public void SetAddressByName(bool enabled)
public bool GetAddressByName()

Example:

csharp
core.ApiBrain().SetAddressByName(true);
core.SetVariable("$ai_name", "assistant");

string response1 = core.ApiBrain().GetResponse("What time is it?", null);
// Returns: null (not addressed)

string response2 = core.ApiBrain().GetResponse("Assistant, what time is it?", null);
// Returns: "It's 3:45 PM" (addressed correctly)

SetAllEars / GetAllEars ​

Temporarily overrides addressing requirement.

csharp
public void SetAllEars(bool enabled)
public bool GetAllEars()

Example:

csharp
core.ApiBrain().SetAddressByName(true);

// User says AI name
core.ApiBrain().SetAllEars(true); // Next input doesn't need name

string response = core.ApiBrain().GetResponse("Continue the story", null);
// Works without saying "assistant" again

// SetAllEars resets to false after one use

Language & Culture ​

SetCulture / GetCulture ​

Sets language culture (handled by SilviaCore, but referenced here).

Example:

csharp
core.SetCulture("en-US");
core.ApiBrain().SetMonthName(1, "January");
core.ApiBrain().SetGreetTime(0, "morning");

SetMonthName / SetGreetTime ​

Language-independent localization.

csharp
public bool SetMonthName(int id, string name)
public bool SetGreetTime(int id, string name)

Example:

csharp
// Spanish localization
for (int i = 1; i <= 12; i++) {
    core.ApiBrain().SetMonthName(i, spanishMonths[i-1]);
}

core.ApiBrain().SetGreetTime(0, "mañana");
core.ApiBrain().SetGreetTime(1, "tarde");
core.ApiBrain().SetGreetTime(2, "noche");

Predictive Text ​

RefreshInputPatterns ​

Updates patterns for autocomplete.

csharp
public bool RefreshInputPatterns()

NextNMostLikelyConcepts ​

Predicts next words (for autocomplete UI).

csharp
public string[] NextNMostLikelyConcepts(string input, int n, int hmmDepth, bool alphaSort)

Parameters:

  • input – Partial user input
  • n – Number of suggestions
  • hmmDepth – Markov chain depth for prediction
  • alphaSort – Sort alphabetically (false = sort by probability)

Example:

csharp
// User types: "how do I"
string[] suggestions = core.ApiBrain().NextNMostLikelyConcepts("how do I", 5, 3, false);
// Returns: ["configure", "start", "install", "connect", "access"]

// Display in autocomplete dropdown
foreach (string word in suggestions) {
    autocompleteMenu.AddItem(word);
}

Categories ​

Hierarchical concept organization.

CategoryInit / CategorySetSeparators / CategoryAdd ​

Manages category hierarchies.

csharp
public bool CategoryInit()
public bool CategorySetSeparators(string seps)
public bool CategoryAdd(string path)

Example:

csharp
core.ApiBrain().CategoryInit();
core.ApiBrain().CategorySetSeparators("/");

core.ApiBrain().CategoryAdd("animals/mammals/canines/dog");
core.ApiBrain().CategoryAdd("animals/mammals/canines/wolf");
core.ApiBrain().CategoryAdd("animals/mammals/felines/cat");

// Now SILVIA understands hierarchical relationships

AddPredictivePattern ​

Adds pattern for predictive input.

csharp
public bool AddPredictivePattern(string pattern, bool style)

Binding Queries ​

QueryBinding ​

Queries linguistic relationships.

csharp
public SilviaCore.eDirection QueryBinding(string root, string bound, string type)

Example:

csharp
var direction = core.ApiBrain().QueryBinding("dog", "bark", "action");
// Returns relationship type between concepts

Plugin Loading ​

LoadCommandAssembly ​

(Windows/.NET Only) Loads external command assemblies.

csharp
public bool LoadCommandAssembly(string assemblyName, string nameSpace, string className)

Example:

csharp
#if WINTEL || SERVER2023
// Load custom command DLL
core.ApiBrain().LoadCommandAssembly(
    "CustomCommands",
    "MyCompany.Silvia.Commands",
    "CommandHandler"
);

// Now behaviors can call methods from CustomCommands.dll
#endif

Platform-Specific Integrations ​

Unity ​

csharp
#if UNITY_2019_OR_NEWER
// Export scripts for iOS/Android AOT
core.ApiBrain().ExportScriptsForUnity("Assets/Scripts/BrainScripts.cs");

// Load brain from Resources
var brainAsset = Resources.Load<TextAsset>("Brains/main_brain");
using (var ms = new MemoryStream(brainAsset.bytes)) {
    using (var br = new BinaryReader(ms)) {
        core.ApiBrain().LoadStream(br, stopwords, false, true);
    }
}
#endif

ASP.NET Core ​

csharp
// Startup.cs
public void ConfigureServices(IServiceCollection services) {
    services.AddSingleton<ISilviaService, SilviaService>();
}

// SilviaService.cs
public class SilviaService : ISilviaService {
    private ConcurrentDictionary<string, SilviaCore> _userCores = new();
    
    public async Task<string> GetResponseAsync(string userId, string input) {
        var core = _userCores.GetOrAdd(userId, id => 
            SilviaCoreManager.CreateCore(id, "brain.sil", true));
        
        return await Task.Run(() => 
            core.ApiBrain().GetResponse(input, $"logs/{userId}.txt"));
    }
}

Azure Functions ​

csharp
[FunctionName("SilviaChat")]
public static async Task<IActionResult> Run(
    [HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequest req,
    ILogger log)
{
    string userId = req.Query["userId"];
    string input = await req.ReadAsStringAsync();
    
    var core = GetOrCreateCore(userId);
    string response = core.ApiBrain().GetResponse(input, null);
    
    return new OkObjectResult(new { response });
}

Docker ​

dockerfile
FROM mcr.microsoft.com/dotnet/runtime:6.0
WORKDIR /app
COPY . .

# Pre-compile brain scripts for faster startup
RUN dotnet run --compile-brain

ENTRYPOINT ["dotnet", "SilviaServer.dll"]
bash
docker build -t silvia-api .
docker run -p 8080:8080 \
  -v /data/brains:/app/brains \
  -e SILVIA_BRAIN_PATH=/app/brains/main.sil \
  silvia-api

Best Practices ​

1. Error Handling ​

csharp
try {
    string response = core.ApiBrain().GetResponse(userInput, logPath);
    
    if (string.IsNullOrEmpty(response)) {
        // No match found
        response = "I didn't quite understand that. Could you rephrase?";
    }
    
    double weight = core.ApiBrain().GetResponseWeight(0);
    if (weight < 0.4) {
        // Low confidence match
        response += " (I'm not very confident about this answer)";
    }
    
} catch (Exception ex) {
    logger.LogError($"Inference error: {ex.Message}");
    return "I'm having trouble processing that right now.";
}

2. Multi-Tenant Isolation ​

csharp
// Create isolated cores per user
var core = SilviaCoreManager.CreateCore(
    $"user_{userId}",
    "base_brain.sil",
    true
);

// Set user-specific security and context
core.ApiBrain().SetUserSecurityLevel(user.GetSecurityLevel());
core.ApiBrain().ClearContext(); // Start fresh

// Merge user-specific knowledge
core.ApiBrain().MergeBrains($"users/{userId}/custom.sil", false);

3. Graceful Degradation ​

csharp
// Primary inference
core.ApiBrain().SetAbsorberThreshold(0.5f);
string response = core.ApiBrain().GetResponse(input, null);

if (string.IsNullOrEmpty(response)) {
    // Fallback: Try with relaxed threshold
    core.ApiBrain().SetAbsorberThreshold(0.3f);
    response = core.ApiBrain().GetResponse(input, null);
}

if (string.IsNullOrEmpty(response)) {
    // Fallback: Try dynamic generation
    var concepts = core.ApiBrain().GetConceptsAsStrings(input, false, false);
    response = core.ApiBrain().GenerateDynamic(
        string.Join(" ", concepts),
        ""
    );
}

if (string.IsNullOrEmpty(response)) {
    // Fallback: Default behavior
    core.ApiBrain().SetJump("system", "default_response", 1.0f);
}

4. Performance Optimization ​

csharp
// Startup configuration
core.ApiBrain().SetOptimization(true); // Enable fast path
core.ApiBrain().SetRandomizeResponses(false); // Deterministic = faster
core.ApiBrain().SetUseWordNet(false); // Skip synonym expansion

// Pre-compile scripts
core.ApiBrain().CompileScripts();

// Set reasonable context depth
core.ApiBrain().SetContextDepth(3); // Balance memory vs context

// Tune thresholds for faster rejection
core.ApiBrain().SetAbsorberThreshold(0.4f);

5. Debugging & Diagnostics ​

csharp
// Enable verbose logging
core.ApiBrain().SetInteractionDiagnosticsState(true);

string response = core.ApiBrain().GetResponse("test input", "logs/debug.txt");

// Inspect response stack
for (int i = 0; i < 10; i++) {
    int bId = core.ApiBrain().GetResponseBehaviorID(i);
    if (bId == -1) break;
    
    int aId = core.ApiBrain().GetResponseAbsorberID(i);
    double weight = core.ApiBrain().GetResponseWeight(i);
    
    Console.WriteLine($"Match {i}: B={bId}, A={aId}, W={weight:F3}");
}

// Check dynamic generation contributors
if (response.Contains("[") || response.Contains("#")) {
    int[] contributors = core.ApiBrain().GetDynamicContributors();
    Console.WriteLine($"Dynamic contributors: {contributors.Length / 2}");
}

6. Security Best Practices ​

csharp
// Enforce security levels
core.ApiBrain().SetUserSecurityLevel(user.Role switch {
    "Admin" => 5,
    "Manager" => 3,
    "Employee" => 2,
    _ => 0
});

// Audit privileged access
string response = core.ApiBrain().GetResponse(input, null);
int behaviorId = core.ApiBrain().GetResponseBehaviorID(0);

if (IsBehaviorPrivileged(behaviorId)) {
    auditLog.Write($"User {userId} accessed privileged behavior {behaviorId}");
}

// Disable default responses for sensitive systems
core.ApiBrain().SetDefaultResponsesEnabled(false);

7. Hot-Reloading Knowledge ​

csharp
// Background thread: Watch for brain updates
var watcher = new FileSystemWatcher("brains/");
watcher.Changed += (s, e) => {
    if (e.Name.EndsWith(".sil")) {
        // Reload brain without stopping service
        core.ApiBrain().Load(e.FullPath, false, false);
        core.ApiBrain().CompileScripts();
        core.ApiBrain().PostLoadBoot();
        
        logger.Info($"Hot-reloaded brain: {e.Name}");
    }
};
watcher.EnableRaisingEvents = true;

8. Distributed Systems ​

csharp
// Coordinator-level inference (shared across instances)
SilviaCoreManager.CreateCoordinatorSensor("global_state", "json", "");

// Each instance updates shared state
SilviaCoreManager.SetCoordinatorSensorValue("global_state", stateJson);

// Broadcast updates to all cores
SilviaCoreManager.BroadcastText("$system_update");

// Individual core inference with global context
var core = SilviaCoreManager.GetCore(userId);
string response = core.ApiBrain().GetResponse(input, null);

API Summary ​

Inference ​

  • GetResponse(input, io_log, nested) – Primary inference method
  • ExecutePostEvents() – Run post-exuder scripts
  • IsBusy() – Check if inference is running

Response Stack ​

  • GetResponseBehaviorID(index) – Get matched behavior ID
  • GetResponseAbsorberID(index) – Get matched absorber ID
  • GetResponseWeight(index) – Get match confidence
  • GetVerbal(nested) – Get TTS version of response
  • GetOutputBehaviorData(nested) – Get behavior metadata
  • GetOutputAbsorberData(nested) – Get absorber metadata
  • GetOutputExuderData(nested) – Get exuder metadata
  • GetDynamicContributors() – Get dynamic generation sources

Behavior Control ​

  • SetJump(group, name, probability) – Execute behavior immediately
  • SetJump(group, name, probability, delay) – Delayed execution
  • SetJumpAfterSpeechTime(group, name, probability, timeScale) – Jump after speech
  • SetJumpToGroup(group, probability) – Random behavior in group
  • SetJumpToSubgroup(group, subgroup, probability) – Random in subgroup
  • SetBypassResponse(group, name) – Force next GetResponse
  • NextResponse(io_log, out response) – Next exuder in behavior

Dynamic Generation ​

  • GenerateDynamic(included, excluded) – Generate novel output
  • GenerateDynamicLimited(included, excluded, group, name) – Limited scope
  • GenerateDynamicFromMemory(user, included, excluded, invert) – From feedback
  • DynamicHasAllConceptsInOne() – Check concept coherence
  • SetDynamicAttraction(attraction) / GetDynamicAttraction()
  • SetDynamicDepth(depth) / GetDynamicDepth()
  • SetDynamicFalloffDepth(falloffDepth) / GetDynamicFalloffDepth()
  • SetDynamicFalloff(falloff) / GetDynamicFalloff()
  • SetDynamicAdaptation(adapt) / GetDynamicAdaptation()

Knowledge Management ​

  • Load(filename, merge, boot) – Load brain file
  • LoadStream(brainStream, stopwords, merge, boot) – Load from stream
  • GetCryptoReader(stream, cryptoType) – Decrypt brain stream
  • Save(filename, groups, save_state, SILVIA2) – Save brain
  • Export(filename) – Export to text
  • MergeBrains(files, boot) – Merge multiple brains

Compiler & Scripts ​

  • CompileScripts() – Pre-compile behavior scripts
  • PostLoadBoot() – Execute boot behaviors
  • SetAdditionalReferenceAssemblies(assemblies) – Add references
  • GetAdditionalReferenceAssemblies() – Get references
  • AddReferenceAssemblies(assemblies) – Append references
  • SetTargetCSProjects(projects) – Compile projects
  • AddTargetCSProject(project) – Add project
  • GetTargetCSProjects() – Get projects
  • RemoveTargetCSProject(project) – Remove project
  • SetTargetCSProjsFromSolution(slnPath) – Load solution
  • GetCsProjsFromSolution(slnPath) – Parse solution
  • SetAdditionalScriptsPath(path) – Set shared scripts
  • GetAdditionalScriptsPath() – Get scripts path
  • ExportScriptsForUnity(scriptFile) – AOT export
  • ExportScriptsAsAssemblyFromUnity(assemblyFileName, outputDirectory) – DLL export
  • SetScriptClassType(t, internalScriptClassName) – Register base class
  • ClearScriptClassTypes() – Clear base classes

Context & State ​

  • SetContextDepth(depth) / GetContextDepth() – Conversation history depth
  • ClearContext() – Reset context
  • AddContext(input, response) – Manually add context

Security ​

  • SetUserSecurityLevel(securityLevel) / GetUserSecurityLevel() – Role-based access

Optimization ​

  • SetAbsorberThreshold(threshold) – Match quality threshold
  • SetReusableThreshold(threshold) – Fallback threshold
  • SetRandomizeResponses(flag) – Randomize exuder selection
  • SetOptimization(flag) – Performance mode
  • SetUseWordNet(useWordNet) / GetUseWordNet() – Synonym expansion
  • SetDefaultResponsesEnabled(enabled) / GetDefaultResponsesEnabled() – Default behavior
  • SetInteractive(interactive) – Interactive mode

Stopwords ​

  • SetStopword(stopword, state) – Add/remove stopword
  • SetStopwords(stopwords, clear) – Bulk update
  • GetStopwords() – Get stopwords
  • LoadStopwords(stream) – Load from file
  • RemoveStopwords(concepts, exclude) – Filter stopwords

Wildcards ​

  • SetWildcardFloor(value) / GetWildcardFloor()
  • SetWildcardCeiling(value) / GetWildcardCeiling()
  • SetWildcardMultiplier(value) / GetWildcardMultiplier()

Concepts ​

  • AddConcepts(input, punctuate, conceptualize) – Pre-load concepts
  • GetConceptsAsStrings(input, punctuate, conceptualize) – Tokenize
  • GetInputConcepts() – Get last input concepts

Narrative ​

  • TransformNarrativeMode(input) – Invert pronouns
  • GetFirstPerson(input) – Convert to first-person

Addressing ​

  • SetAddressByName(enabled) / GetAddressByName() – Require AI name
  • SetAllEars(enabled) / GetAllEars() – Override addressing

Localization ​

  • SetMonthName(id, name) – Localize month names
  • SetGreetTime(id, name) – Localize time-of-day

Predictive ​

  • RefreshInputPatterns() – Update patterns
  • NextNMostLikelyConcepts(input, n, hmmDepth, alphaSort) – Autocomplete

Categories ​

  • CategoryInit() – Initialize categories
  • CategorySetSeparators(seps) – Set hierarchy separators
  • CategoryAdd(path) – Add category
  • AddPredictivePattern(pattern, style) – Add pattern

Binding ​

  • QueryBinding(root, bound, type) – Query relationships

PAGER Tags ​

  • AddPAGERTagPreset(presetName, presetType, tagsData) – Store preset
  • GetPAGERTagPresetData(presetName) – Get preset
  • RemovePagerTagPreset(presetName) – Remove preset
  • GetAllPAGERTagPresets() – Get all presets
  • GetPAGERTagPresetNames() – Get names
  • GetPAGERTagPresetTypes() – Get types
  • GetPAGERTagPresetStrings() – Get tag strings

Plugins ​

  • LoadCommandAssembly(assemblyName, nameSpace, className) – Load plugin (Windows/.NET)

Diagnostics ​

  • SetInteractionDiagnosticsState(tf) / GetInteractionDiagnosticsState() – Debug mode

Remarks ​

ApiBrain is SILVIA's inference powerhouse—providing deterministic, auditable, and security-aware AI reasoning for enterprise, industrial, and embedded systems. Its hybrid approach combines pattern matching with dynamic generation, offering the explainability of rule-based systems with the flexibility of statistical models.


© Copyright Cognitive Code Corp. 2007-2026

SILVIA is a registered Trademark of Cognitive Code Corp.

SILVIA is a registered Trademark of Cognitive Code Corp.