> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.forboc.ai/npm/workflow/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.forboc.ai/_mcp/server. # Integration Workflow ## 1. Configure API Access ```bash export FORBOCAI_API_URL=https://api.forboc.ai export FORBOCAI_API_KEY=fb_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ``` ## 2. Create Store and Runtime Components ```typescript import { createSDKStore, setNPCInfo, processNPC, listMemoryRemoteThunk, validateBridgeThunk, remoteExportSoulThunk } from '@forbocai/core'; import { createNodeCortex } from '@forbocai/node'; const store = createSDKStore(); store.dispatch(setNPCInfo({ id: 'npc_guard_001', persona: 'A strict city gate guard.', initialState: { alertLevel: 0 } })); const cortex = createNodeCortex('smollm2-135m'); await cortex.init(); ``` ## 3. Run Protocol Turn ```typescript const turn = await store.dispatch(processNPC({ npcId: 'npc_guard_001', text: 'I need entry to the city.', context: { playerReputation: 12 }, apiUrl: process.env.FORBOCAI_API_URL || 'https://api.forboc.ai', apiKey: process.env.FORBOCAI_API_KEY, cortex })).unwrap(); console.log(turn.dialogue); console.log(turn.action); ``` ## 4. Optional Remote Operations ```typescript // memory list const memories = await store.dispatch(listMemoryRemoteThunk({ npcId: 'npc_guard_001', apiUrl: 'https://api.forboc.ai', apiKey: process.env.FORBOCAI_API_KEY })).unwrap(); // bridge validate const validation = await store.dispatch(validateBridgeThunk({ action: { type: 'OPEN_GATE' }, context: { npcState: { alertLevel: 0 } }, apiUrl: 'https://api.forboc.ai', apiKey: process.env.FORBOCAI_API_KEY })).unwrap(); // soul export const soul = await store.dispatch(remoteExportSoulThunk({ npcId: 'npc_guard_001', apiUrl: 'https://api.forboc.ai', apiKey: process.env.FORBOCAI_API_KEY })).unwrap(); console.log(memories.length, validation.valid, soul.txId); ``` ## 5. CLI Workflow Alternative ```bash npx forbocai config set apiUrl https://api.forboc.ai npx forbocai config set apiKey fb_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx npx forbocai npc create "A strict city guard" npx forbocai npc process "I need entry to the city" npx forbocai memory list npx forbocai soul export ``` > Source-accurate setup for protocol execution