# Interface IRoutingMemory

Memory interface for routing-related data. Bridges memory backend and routing systems.

This interface enables:

- #148 Preference-Trained Routing: Store preferences and outcomes
- #149 MobiMem Evolution: Store experiences and action patterns

#### Example

    const routingMemory = createRoutingMemory(memoryBackend);

    // Store a routing decision and outcome
    await routingMemory.storePreference(decision, outcome, preference);

    // Get preferences for training
    const prefs = await routingMemory.getPreferences({ taskType: 'code' }, 100);

    // Store experience for MobiMem
    await routingMemory.storeExperience(experience);

interface IRoutingMemory {
storePreference(
decision: RoutingDecisionRecord,
outcome: TaskOutcomeRecord,
preference?: PreferenceSignal,
): Promise<Result<void, RoutingMemoryError>>;
getPreferences(
filter: PreferenceFilter,
limit: number,
): Promise<Result<PreferenceRecord[], RoutingMemoryError>>;
storeExperience(
experience: ExperienceRecord,
): Promise<Result<void, RoutingMemoryError>>;
getExperiences(
query: string,
limit: number,
): Promise<Result<ExperienceRecord[], RoutingMemoryError>>;
storeAction(
action: ActionRecord,
): Promise<Result<void, RoutingMemoryError>>;
getActions(
taskType: string,
limit: number,
): Promise<Result<ActionRecord[], RoutingMemoryError>>;
export(): Promise<Result<RoutingMemoryExport, RoutingMemoryError>>;
import(
data: RoutingMemoryExport,
): Promise<Result<void, RoutingMemoryError>>;
getStats(): Promise<Result<RoutingMemoryStats, RoutingMemoryError>>;
}

- Defined in packages/nexus-agents/src/cli-adapters/routing-memory-types.ts:287

##### Index

### Methods

storePreference
getPreferences
storeExperience
getExperiences
storeAction
getActions
export
import
getStats

## Methods

### storePreference

- storePreference(
  decision: RoutingDecisionRecord,
  outcome: TaskOutcomeRecord,
  preference?: PreferenceSignal,
  ): Promise<Result<void, RoutingMemoryError>>

  Store a routing decision with its outcome for preference learning.

  #### Parameters

  - decision: RoutingDecisionRecord

    The routing decision made

  - outcome: TaskOutcomeRecord

    The task outcome (success, quality, duration)

  - `Optional` preference: PreferenceSignal

    Optional explicit preference signal

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

  - Defined in packages/nexus-agents/src/cli-adapters/routing-memory-types.ts:298

### getPreferences

- getPreferences(
  filter: PreferenceFilter,
  limit: number,
  ): Promise<Result<PreferenceRecord[], RoutingMemoryError>>

  Retrieve preference data for training.

  #### Parameters

  - filter: PreferenceFilter

    Filter criteria for preferences

  - limit: number

    Maximum records to return

  #### Returns Promise<Result<PreferenceRecord[], RoutingMemoryError>>

  - Defined in packages/nexus-agents/src/cli-adapters/routing-memory-types.ts:309

### storeExperience

- storeExperience(
  experience: ExperienceRecord,
  ): Promise<Result<void, RoutingMemoryError>>

  Store an experience record for evolution.

  #### Parameters

  - experience: ExperienceRecord

    The experience to store

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

  - Defined in packages/nexus-agents/src/cli-adapters/routing-memory-types.ts:322

### getExperiences

- getExperiences(
  query: string,
  limit: number,
  ): Promise<Result<ExperienceRecord[], RoutingMemoryError>>

  Retrieve relevant experiences for a task.

  #### Parameters

  - query: string

    Semantic query for experience retrieval

  - limit: number

    Maximum experiences to return

  #### Returns Promise<Result<ExperienceRecord[], RoutingMemoryError>>

  - Defined in packages/nexus-agents/src/cli-adapters/routing-memory-types.ts:329

### storeAction

- storeAction(action: ActionRecord): Promise<Result<void, RoutingMemoryError>>

  Store a successful action pattern.

  #### Parameters

  - action: ActionRecord

    The action pattern to cache

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

  - Defined in packages/nexus-agents/src/cli-adapters/routing-memory-types.ts:342

### getActions

- getActions(
  taskType: string,
  limit: number,
  ): Promise<Result<ActionRecord[], RoutingMemoryError>>

  Retrieve cached actions for a task type.

  #### Parameters

  - taskType: string

    Type of task

  - limit: number

    Maximum actions to return

  #### Returns Promise<Result<ActionRecord[], RoutingMemoryError>>

  - Defined in packages/nexus-agents/src/cli-adapters/routing-memory-types.ts:349

### export

- export(): Promise<Result<RoutingMemoryExport, RoutingMemoryError>>

  Export all routing memory for training or backup.

  #### Returns Promise<Result<RoutingMemoryExport, RoutingMemoryError>>

  - Defined in packages/nexus-agents/src/cli-adapters/routing-memory-types.ts:358

### import

- import(data: RoutingMemoryExport): Promise<Result<void, RoutingMemoryError>>

  Import routing memory from export.

  #### Parameters

  - data: RoutingMemoryExport

    The exported data to import

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

  - Defined in packages/nexus-agents/src/cli-adapters/routing-memory-types.ts:364

### getStats

- getStats(): Promise<Result<RoutingMemoryStats, RoutingMemoryError>>

  Get memory statistics.

  #### Returns Promise<Result<RoutingMemoryStats, RoutingMemoryError>>

  - Defined in packages/nexus-agents/src/cli-adapters/routing-memory-types.ts:373