# Class SQLiteOutcomeStorage

SQLite-based outcome storage implementation.

#### Implements

- IOutcomeStorage

- Defined in packages/nexus-agents/src/learning/outcome-storage.ts:69

##### Index

### Constructors

constructor

### Methods

initializeWithDatabase
initialize
storeDecision
storeOutcome
storeReward
getDecision
getOutcome
getModelStats
getRecentDecisions
getDecisionsByRequestId
prune
getCounts
close

## Constructors

### constructor

- new SQLiteOutcomeStorage(config: OutcomeStorageConfig): SQLiteOutcomeStorage

  #### Parameters

  - config: OutcomeStorageConfig

  #### Returns SQLiteOutcomeStorage

  - Defined in packages/nexus-agents/src/learning/outcome-storage.ts:76

## Methods

### initializeWithDatabase

- initializeWithDatabase(database: ISQLiteDatabase): void

  Initialize with an existing database instance (for testing).

  #### Parameters

  - database: ISQLiteDatabase

  #### Returns void

  - Defined in packages/nexus-agents/src/learning/outcome-storage.ts:92

### initialize

- initialize(): Promise<Result<void, OutcomeStorageError>>

  Initialize the storage backend.

  #### Returns Promise<Result<void, OutcomeStorageError>>

  - Defined in packages/nexus-agents/src/learning/outcome-storage.ts:100

### storeDecision

- storeDecision(
  decision: StoredRoutingDecision,
  ): Promise<Result<void, OutcomeStorageError>>

  Store a routing decision.

  #### Parameters

  - decision: StoredRoutingDecision

  #### Returns Promise<Result<void, OutcomeStorageError>>

  Implementation of IOutcomeStorage.storeDecision

  - Defined in packages/nexus-agents/src/learning/outcome-storage.ts:157

### storeOutcome

- storeOutcome(
  outcome: StoredTaskOutcome,
  ): Promise<Result<void, OutcomeStorageError>>

  Store a task outcome.

  #### Parameters

  - outcome: StoredTaskOutcome

  #### Returns Promise<Result<void, OutcomeStorageError>>

  Implementation of IOutcomeStorage.storeOutcome

  - Defined in packages/nexus-agents/src/learning/outcome-storage.ts:186

### storeReward

- storeReward(reward: StoredReward): Promise<Result<void, OutcomeStorageError>>

  Store a computed reward.

  #### Parameters

  - reward: StoredReward

  #### Returns Promise<Result<void, OutcomeStorageError>>

  Implementation of IOutcomeStorage.storeReward

  - Defined in packages/nexus-agents/src/learning/outcome-storage.ts:215

### getDecision

- getDecision(
  id: string,
  ): Promise<Result<StoredRoutingDecision | null, OutcomeStorageError>>

  Get routing decision by ID.

  #### Parameters

  - id: string

  #### Returns Promise<Result<StoredRoutingDecision | null, OutcomeStorageError>>

  Implementation of IOutcomeStorage.getDecision

  - Defined in packages/nexus-agents/src/learning/outcome-storage.ts:244

### getOutcome

- getOutcome(
  decisionId: string,
  ): Promise<Result<StoredTaskOutcome | null, OutcomeStorageError>>

  Get outcome for a routing decision.

  #### Parameters

  - decisionId: string

  #### Returns Promise<Result<StoredTaskOutcome | null, OutcomeStorageError>>

  Implementation of IOutcomeStorage.getOutcome

  - Defined in packages/nexus-agents/src/learning/outcome-storage.ts:257

### getModelStats

- getModelStats(): Promise<Result<StoredModelStats[], OutcomeStorageError>>

  Get aggregated statistics per model.

  #### Returns Promise<Result<StoredModelStats[], OutcomeStorageError>>

  Implementation of IOutcomeStorage.getModelStats

  - Defined in packages/nexus-agents/src/learning/outcome-storage.ts:270

### getRecentDecisions

- getRecentDecisions(
  model: "claude" | "gemini" | "codex" | "opencode",
  limit: number,
  ): Promise<Result<StoredRoutingDecision[], OutcomeStorageError>>

  Get recent decisions for a model.

  #### Parameters

  - model: "claude" | "gemini" | "codex" | "opencode"
  - limit: number

  #### Returns Promise<Result<StoredRoutingDecision[], OutcomeStorageError>>

  Implementation of IOutcomeStorage.getRecentDecisions

  - Defined in packages/nexus-agents/src/learning/outcome-storage.ts:281

### getDecisionsByRequestId

- getDecisionsByRequestId(
  requestId: string,
  ): Promise<Result<StoredRoutingDecision[], OutcomeStorageError>>

  Get decisions by request ID (for audit trail integration).

  #### Parameters

  - requestId: string

  #### Returns Promise<Result<StoredRoutingDecision[], OutcomeStorageError>>

  Implementation of IOutcomeStorage.getDecisionsByRequestId

  - Defined in packages/nexus-agents/src/learning/outcome-storage.ts:296

### prune

- prune(olderThan: Date): Promise<Result<number, OutcomeStorageError>>

  Prune old records.

  #### Parameters

  - olderThan: Date

  #### Returns Promise<Result<number, OutcomeStorageError>>

  Implementation of IOutcomeStorage.prune

  - Defined in packages/nexus-agents/src/learning/outcome-storage.ts:310

### getCounts

- getCounts(): Promise<
  Result<
  { decisions: number; outcomes: number; rewards: number },
  OutcomeStorageError,
  >,
  >

  Get total record counts.

  #### Returns Promise<
  Result<
  { decisions: number; outcomes: number; rewards: number },
  OutcomeStorageError,
  >,
  >

  Implementation of IOutcomeStorage.getCounts

  - Defined in packages/nexus-agents/src/learning/outcome-storage.ts:333

### close

- close(): void

  Close the database connection.

  #### Returns void

  - Defined in packages/nexus-agents/src/learning/outcome-storage.ts:355