# Interface IOutcomeStorage

Interface for outcome storage implementations.

interface IOutcomeStorage {
storeDecision(
decision: StoredRoutingDecision,
): Promise<Result<void, OutcomeStorageError>>;
storeOutcome(
outcome: StoredTaskOutcome,
): Promise<Result<void, OutcomeStorageError>>;
storeReward(
reward: StoredReward,
): Promise<Result<void, OutcomeStorageError>>;
getDecision(
id: string,
): Promise<Result<StoredRoutingDecision | null, OutcomeStorageError>>;
getOutcome(
routingDecisionId: string,
): Promise<Result<StoredTaskOutcome | null, OutcomeStorageError>>;
getModelStats(): Promise<Result<StoredModelStats[], OutcomeStorageError>>;
getRecentDecisions(
model: "claude" | "gemini" | "codex" | "opencode",
limit: number,
): Promise<Result<StoredRoutingDecision[], OutcomeStorageError>>;
getDecisionsByRequestId(
requestId: string,
): Promise<Result<StoredRoutingDecision[], OutcomeStorageError>>;
prune(olderThan: Date): Promise<Result<number, OutcomeStorageError>>;
getCounts(): Promise<
Result<
{ decisions: number; outcomes: number; rewards: number },
OutcomeStorageError,
>,
>;
}

#### Implemented by

- SQLiteOutcomeStorage

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

##### Index

### Methods

storeDecision
storeOutcome
storeReward
getDecision
getOutcome
getModelStats
getRecentDecisions
getDecisionsByRequestId
prune
getCounts

## Methods

### storeDecision

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

  Store a routing decision.

  #### Parameters

  - decision: StoredRoutingDecision

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

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

### storeOutcome

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

  Store a task outcome.

  #### Parameters

  - outcome: StoredTaskOutcome

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

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

### storeReward

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

  Store a computed reward.

  #### Parameters

  - reward: StoredReward

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

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

### getDecision

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

  Get routing decision by ID.

  #### Parameters

  - id: string

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

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

### getOutcome

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

  Get outcome for a routing decision.

  #### Parameters

  - routingDecisionId: string

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

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

### getModelStats

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

  Get aggregated statistics per model.

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

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

### 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>>

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

### 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>>

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

### prune

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

  Prune old records.

  #### Parameters

  - olderThan: Date

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

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

### 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,
  >,
  >

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