***

title: User Stories
subtitle: Behavior-driven stories aligned to current SDK runtime
slug: npm/user-stories
----------------------

## NPC Processing

```gherkin
Feature: NPC protocol execution

  Scenario: Process one player input with API-directed protocol
    Given an SDK store with an NPC registered via setNPCInfo
    And a local cortex runtime is initialized
    When I dispatch processNPC with npcId, text, apiUrl, and cortex
    Then the SDK runs the `/npcs/{npcId}/process` continuation loop
    And compatibility integrations may use directive/context/verdict sequence
    And I receive dialogue and optional action in the thunk result
```

## Memory Operations

```gherkin
Feature: Remote memory operations

  Scenario: List and recall memories by npcId
    Given a valid API URL and key
    When I dispatch listMemoryRemoteThunk for an npcId
    And I dispatch recallMemoryRemoteThunk with a query
    Then memory entries are returned from API-backed memory endpoints
```

## Bridge Validation

```gherkin
Feature: Bridge rule validation

  Scenario: Validate an action payload
    Given a candidate NPC action and validation context
    When I dispatch validateBridgeThunk
    Then I receive a validation result containing valid/reason fields
```

## Soul Portability

```gherkin
Feature: Soul export and import

  Scenario: Export and re-import an NPC soul
    Given an active NPC in store state
    When I dispatch remoteExportSoulThunk
    And I dispatch importSoulFromArweaveThunk with the txId
    Then I can retrieve the soul payload for reuse
```

## CLI Operations

```gherkin
Feature: Node CLI operations

  Scenario: Verify runtime and execute npc turn
    Given API config is set using config set
    When I run forbocai status
    And I run forbocai npc process <npcId> <input>
    Then the CLI prints protocol output or actionable errors
```
