User Stories

View as MarkdownOpen in Claude

Úsér_Stóríés // Sýstém_Dóc

ᚠ ᛫ ᛟ ᛫ ᚱ ᛫ ᛒ ᛫ ᛟ ᛫ ᚲ


title: User Stories subtitle: What developers can build with the ForbocAI SDK slug: user-stories

This document defines the core user stories for the ForbocAI SDK. Each story follows the format: As a [role], I want [goal], so that [benefit]. Stories are translated into BDD specifications that drive API endpoint design.


Epic 1: Cortex — Local Inference

Córtex_Módule // Locál_SLM
ᚠ ᛫ ᚢ ᛫ ᚦ ᛫ ᚨ ᛫ ᚱ ᛫ ᚲ

US-1.1: Initialize Local Model

As a developer
I want to initialize a local language model on the user’s device
So that I can run AI inference without server round-trips or API costs

1Feature: Cortex Initialization
2
3 Scenario: Initialize Cortex with a model
4 Given a configured environment
5 When I call Cortex.init with model "smollm2-135m"
6 Then the model weights should be downloaded (if not cached)
7 And the model should be loaded into memory
8 And the Cortex instance should be ready for inference
9
10 Scenario: List available models
11 Given an initialized SDK
12 When I call Cortex.listModels()
13 Then I should receive an array of available models with their sizes and capabilities
MethodEndpointDescription
POST/v1/cortex/initInitialize a Cortex instance
GET/v1/cortex/modelsList available models
GET/v1/cortex/{id}/statusGet Cortex instance status
DELETE/v1/cortex/{id}Destroy a Cortex instance

US-1.2: Generate Completion

As a developer
I want to send a prompt to the local model and receive a completion
So that my application can generate AI-powered text responses

1Feature: Text Completion
2
3 Scenario: Generate a simple completion
4 Given an initialized Cortex instance
5 When I call cortex.complete() with prompt "Hello, my name is"
6 Then I should receive a streaming response with generated tokens
7 And the response should complete within the configured timeout
8
9 Scenario: Generate with system prompt
10 Given an initialized Cortex instance
11 When I call cortex.complete() with a system prompt and user prompt
12 Then the model should follow the system prompt instructions
13 And respond appropriately to the user prompt
14
15 Scenario: Generate structured JSON output
16 Given an initialized Cortex instance
17 When I call cortex.complete() with a JSON schema constraint
18 Then the response should be valid JSON matching the schema
MethodEndpointDescription
POST/v1/cortex/{id}/completeGenerate completion (streaming)
POST/v1/cortex/{id}/complete/structuredGenerate structured output

US-1.3: Handle Offline/Fallback

As a developer
I want to define fallback behaviors if the local model fails or hangs
So that my game remains playable even if the AI subsystem crashes

1Feature: Inference Resilience
2
3 Scenario: Model load failure
4 Given a device with insufficient RAM
5 When Cortex.init() fails
6 Then the SDK should throw a specific "insufficient_resources" error
7 And the game should be able to fall back to "Legacy Rules" mode
8
9 Scenario: Inference timeout
10 Given a complex prompt
11 When the model takes longer than 2000ms to respond
12 Then the SDK should abort the request
13 And return a pre-defined "Default Fallback" response (e.g., "...")
MethodEndpointDescription
N/AClient-Side ConfigConfigure timeouts and fallback strings in Cortex.init()

Epic 2: Agent — Autonomous Entities

Agént_Créate // NPC_Entíty
᛭ ᚠ ᛫ ᚨ ᛫ ᛁ ᛭

US-2.1: Create an Agent

As a developer
I want to create an AI agent with a persona and initial state
So that I can add intelligent NPCs or assistants to my application

1Feature: Agent Creation
2
3 Scenario: Create agent with persona
4 Given an initialized Cortex instance
5 When I call Agent.create() with a persona string and initial state
6 Then an Agent instance should be created
7 And the agent should have an empty memory store
8 And the agent should be ready to process inputs
9
10 Scenario: Create agent from Soul (import)
11 Given a Soul exported to IPFS
12 When I call Agent.fromSoul() with the IPFS CID
13 Then the agent should be restored with its persona, memories, and state
14 And the agent should behave consistently with its previous incarnation
MethodEndpointDescription
POST/v1/agentsCreate a new agent
GET/v1/agents/{id}Get agent details
POST/v1/agents/importImport agent from Soul (IPFS CID)
DELETE/v1/agents/{id}Destroy an agent

US-2.2: Process Agent Input

As a developer
I want to send input to an agent and receive dialogue + actions
So that my agent can respond intelligently and take validated actions

1Feature: Agent Processing
2
3 Scenario: Process dialogue input
4 Given an agent with persona "a suspicious merchant"
5 And the agent has memory of being cheated by the player
6 When I call agent.process() with input "Want to make a deal?"
7 Then the response should include dialogue reflecting suspicion
8 And the response may include an action object
9
10 Scenario: Process with context
11 Given an agent with persona "a guard"
12 When I call agent.process() with input "Let me through"
13 And context includes { playerHasPass: true }
14 Then the response action should be { type: 'ALLOW_PASSAGE' }
15
16 Scenario: Invalid action rejected by Bridge
17 Given an agent with persona "a merchant"
18 When the agent attempts to trade an item it doesn't possess
19 Then the Bridge should reject the action
20 And return an error with reason "ITEM_NOT_IN_INVENTORY"
MethodEndpointDescription
POST/v1/agents/{id}/processProcess input and get response
GET/v1/agents/{id}/stateGet current agent state
PATCH/v1/agents/{id}/stateUpdate agent state externally

Epic 3: Memory — RAG Pipeline

Mémory_Stóre // Véctor_Recáll
ᛊ ᛫ ᛟ ᛫ ᚢ ᛫ ᛚ

US-3.1: Store Observation

As a developer
I want to store events as semantic memories for an agent
So that the agent can recall relevant past events during future interactions

1Feature: Memory Storage
2
3 Scenario: Store a text observation
4 Given an agent with an empty memory store
5 When I call agent.memory.store() with text "The player saved my life"
6 Then the text should be embedded as a vector
7 And stored in the agent's memory database
8 And associated with a timestamp
9
10 Scenario: Store a structured event
11 Given an agent with an existing memory
12 When I call agent.memory.store() with an event object
13 Then the event should be serialized to text
14 And embedded and stored with metadata
MethodEndpointDescription
POST/v1/agents/{id}/memoryStore a memory/observation
GET/v1/agents/{id}/memoryList all memories (paginated)
DELETE/v1/agents/{id}/memory/{memoryId}Delete a specific memory

US-3.2: Recall Relevant Memories

As a developer
I want to retrieve memories semantically related to a query
So that the agent can use past context when responding

1Feature: Memory Retrieval
2
3 Scenario: Recall by semantic similarity
4 Given an agent with memories about "the player's betrayal" and "a sunny day"
5 When I call agent.memory.recall() with query "trust issues"
6 Then the memory about betrayal should be returned
7 And the sunny day memory should not be returned
8
9 Scenario: Recall with limit
10 Given an agent with 100 memories
11 When I call agent.memory.recall() with limit 5
12 Then at most 5 memories should be returned
13 And they should be ordered by relevance score
MethodEndpointDescription
POST/v1/agents/{id}/memory/recallSemantic search over memories

Epic 4: Bridge — Neuro-Symbolic Validation

Brídge_Válidate // Rúle_Chéck
ᛒ ᛫ ᚱ ᛫ ᛁ ᛫ ᛗ

US-4.1: Validate Agent Action

As a developer
I want to validate AI-generated actions against my application’s rules
So that agents cannot perform impossible or invalid actions

1Feature: Action Validation
2
3 Scenario: Valid action passes validation
4 Given a Bridge configured with game rules
5 And an agent with inventory ["sword", "shield"]
6 When the agent outputs action { type: 'EQUIP', item: 'sword' }
7 Then the Bridge should validate the action as VALID
8 And return the action for execution
9
10 Scenario: Invalid action rejected
11 Given a Bridge configured with game rules
12 And an agent with inventory ["sword"]
13 When the agent outputs action { type: 'EQUIP', item: 'shield' }
14 Then the Bridge should reject the action as INVALID
15 And return error { reason: 'ITEM_NOT_OWNED', item: 'shield' }
16
17 Scenario: Custom validation rules
18 Given a Bridge with custom rule "players cannot trade during combat"
19 When an agent attempts a TRADE action during combat state
20 Then the Bridge should reject with reason 'INVALID_DURING_COMBAT'
MethodEndpointDescription
POST/v1/bridge/validateValidate an action against rules
POST/v1/bridge/rulesRegister custom validation rules
GET/v1/bridge/rulesList registered rules

US-4.2: Force Agent Action (GM Override)

As a developer
I want to forcefully inject an action or dialogue into an agent’s stream
So that I can control scripted sequences (cutscenes) without fighting the AI

1Feature: GM Override
2
3 Scenario: Inject scripted dialogue
4 Given an agent in the middle of a "Thinking" loop
5 When I call agent.override({ dialogue: "Follow me, quickly!" })
6 Then the agent should immediately output that dialogue
7 And the AI context should ideally update to remember it said that
8
9 Scenario: Force movement
10 Given an agent deciding where to go
11 When I call agent.override({ action: { type: 'MOVE', target: 'door' } })
12 Then the agent should execute the move immediately
13 And bypass the usual validation rules (GM Authority)
MethodEndpointDescription
POST/v1/agents/{id}/overrideForce a specific state or action

Epic 5: Soul — Portable Agent State

Sóul_Expórt // Státe_Snápshot
ᛊ ᛫ ᛟ ᛫ ᚢ ᛫ ᛚ

US-5.1: Export Agent to Soul

As a developer
I want to export an agent’s complete state (persona, memories, stats) as a Soul
So that it can be persisted, traded, or used in other applications

1Feature: Soul Export
2
3 Scenario: Export to local JSON
4 Given an agent with persona, memories, and state
5 When I call agent.exportSoul({ format: 'json' })
6 Then I should receive a JSON object containing all agent data
7 And the JSON should follow the Soul schema
8
9 Scenario: Export to IPFS
10 Given an agent with memories
11 When I call agent.exportSoul({ storage: 'ipfs' })
12 Then the Soul should be uploaded to IPFS
13 And I should receive the IPFS CID
14 And the Soul should be retrievable via the CID
MethodEndpointDescription
POST/v1/agents/{id}/soul/exportExport agent to Soul
GET/v1/souls/{cid}Retrieve Soul by IPFS CID

US-5.2: Import Agent from Soul

As a developer
I want to recreate an agent from an exported Soul
So that characters can persist across sessions or transfer between applications

1Feature: Soul Import
2
3 Scenario: Import from IPFS CID
4 Given a Soul exported with CID "bafybeif..."
5 When I call Agent.fromSoul({ cid: 'bafybeif...' })
6 Then the agent should be restored with its original persona
7 And all memories should be restored
8 And the agent state should match the export
9
10 Scenario: Import with state merge
11 Given an existing agent and a Soul from another application
12 When I call agent.mergeSoul() with the foreign Soul
13 Then the agent's memories should include both sets
14 And conflicting state should be resolved per merge rules
MethodEndpointDescription
POST/v1/agents/importCreate agent from Soul
POST/v1/agents/{id}/soul/mergeMerge Soul into existing agent

Epic 6: Ghost Agents — Automated QA

Ghóst_Rún // Héadless_Tést
ᛇ ᛫ ᛆ ᛫ ᛟ ᛫ ᛊ ᛫ ᛏ

US-6.1: Run Ghost Agent Session

As a developer
I want to run headless AI agents through my application for automated testing
So that I can validate content, balance, and edge cases at scale

1Feature: Ghost Agent Testing
2
3 Scenario: Run exploration test
4 Given a level with multiple paths
5 When I run a Ghost Agent with goal "maximize exploration"
6 Then the agent should traverse all accessible areas
7 And report exploration coverage percentage
8
9 Scenario: Detect dead-end
10 Given a level with an impassable bug
11 When I run a Ghost Agent
12 And the agent gets stuck for > 60 seconds
13 Then the run should flag a "potential dead-end" at the location
14 And capture a screenshot
15
16 Scenario: Batch testing with seeds
17 Given 10 procedurally generated levels
18 When I run Ghost Agents on all levels in parallel
19 Then I should receive aggregate metrics (completion rate, avg time, failures)
MethodEndpointDescription
POST/v1/ghost/runStart a Ghost Agent session
GET/v1/ghost/{sessionId}/statusGet session status
GET/v1/ghost/{sessionId}/resultsGet session results/metrics
POST/v1/ghost/batchRun batch Ghost Agent tests

Epic 7: Analytics & Debugging — The “Black Box” Insight

Debúg_Log // Tóken_Metrïcs
ᛞ ᛫ ᛖ ᛫ ᛒ ᛫ ᚢ ᛫ ᚷ

US-7.1: Inspect Agent Thought Process

As a developer
I want to view the internal “Chain of Thought” logs of an agent
So that I can understand why an NPC made a specific decision (e.g., why it attacked a friendly player)

1Feature: Reasoning Inspection
2
3 Scenario: View internal monologue
4 Given an agent has just performed an action
5 When I query the agent's debug logs
6 Then I should see the "Thought" chain that led to the "Action"
7 And I should see which Memories were recalled for context
8
9 Scenario: Real-time debug stream
10 Given a game running in "Debug Mode"
11 When an agent "thinks"
12 Then the SDK should emit a `debug:thought` event with the raw SLM reasoning
MethodEndpointDescription
GET/v1/agents/{id}/logsGet decision logs for an agent
GET/v1/agents/{id}/logs/latestGet the most recent thought process

US-7.2: Monitor Token Usage & Cost

As a studio lead
I want to track token usage and API calls per agent/session
So that I can optimize performance and manage infrastructure costs

1Feature: Usage Monitoring
2
3 Scenario: Track session tokens
4 Given an active game session
5 When an agent generates dialogue
6 Then the token usage count should increment
7 And I should be able to set a hard limit to prevent overn-runs
8
9 Scenario: View dashboard metrics
10 Given a dashboard user
11 When I view the "Usage" tab
12 Then I should see a breakdown of Local (Free) vs. Cloud (Paid) inference calls
MethodEndpointDescription
GET/v1/usage/statsGet usage statistics
GET/v1/usage/limitsCheck current rate limits