Defined in: [src/memory/types.ts:228](https://github.com/strands-agents/harness-sdk/blob/main/strands-ts/src/memory/types.ts#L228)

Configuration for memory context injection.

When enabled on a [MemoryManager](/pr-cms-5569/docs/api/typescript/MemoryManager/index.md), the manager searches memory before a model call and makes the top results available to the model for that call, so relevant knowledge is present without the model choosing to search. The results are written into the latest user message as an `InjectedBlock`, which stays in the conversation and the session. Extraction leaves it out.

Extends the generic [InjectionConfig](/pr-cms-5569/docs/api/typescript/InjectionConfig/index.md) (which carries `trigger`) with the memory-owned knobs: how many entries to retrieve, how to derive the query, and how to render the results.

## Extends

-   [`InjectionConfig`](/pr-cms-5569/docs/api/typescript/InjectionConfig/index.md)

## Properties

### trigger?

```ts
trigger?:
  | InjectionTrigger
  | ((context) => boolean);
```

Defined in: [src/injection/types.ts:43](https://github.com/strands-agents/harness-sdk/blob/main/strands-ts/src/injection/types.ts#L43)

When injection runs. An [InjectionTrigger](/pr-cms-5569/docs/api/typescript/InjectionTrigger/index.md) name selects a built-in policy; a predicate is the escape hatch — it receives the [InjectionContext](/pr-cms-5569/docs/api/typescript/InjectionContext/index.md) and returns whether to inject this call. A predicate that throws fails open (injection is skipped, the model call proceeds).

#### Default Value

```ts
'userTurn'
```

#### Inherited from

[`InjectionConfig`](/pr-cms-5569/docs/api/typescript/InjectionConfig/index.md).[`trigger`](/pr-cms-5569/docs/api/typescript/InjectionConfig/index.md#trigger)

---

### maxEntries?

```ts
maxEntries?: number;
```

Defined in: [src/memory/types.ts:241](https://github.com/strands-agents/harness-sdk/blob/main/strands-ts/src/memory/types.ts#L241)

Maximum number of entries to retrieve and inject per model call.

A store ranks by semantic similarity, which is not the same as contextual usefulness, so the default injects a small candidate set rather than betting on the top hit. Raising this improves recall at the cost of a larger prepend (context bloat); lower it for a tighter injection.

With multiple stores, results are concatenated in store-registration order with no cross-store ranking, so this cap can favor entries from earlier-registered stores.

#### Default Value

```ts
5
```

---

### query?

```ts
query?: (context) => string;
```

Defined in: [src/memory/types.ts:249](https://github.com/strands-agents/harness-sdk/blob/main/strands-ts/src/memory/types.ts#L249)

Derives the search query from the current conversation. Return `undefined` or an empty string to skip injection for this call. A callback that throws fails open (injection is skipped).

Defaults to an adaptive query: the latest user message’s text on a user turn, otherwise the most recent assistant message’s text (the previous step on an autonomous turn).

#### Parameters

| Parameter | Type |
| --- | --- |
| `context` | { `messages`: [`MessageData`](/pr-cms-5569/docs/api/typescript/MessageData/index.md)\[\]; } |
| `context.messages` | [`MessageData`](/pr-cms-5569/docs/api/typescript/MessageData/index.md)\[\] |

#### Returns

`string`

---

### format?

```ts
format?: (context) => string;
```

Defined in: [src/memory/types.ts:263](https://github.com/strands-agents/harness-sdk/blob/main/strands-ts/src/memory/types.ts#L263)

Renders retrieved entries into the injected text. A callback that throws fails open (injection is skipped).

Defaults to a `<memory>` XML block with one `<entry>` per result, carrying a `source` attribute naming the originating store (when known) so the model can attribute and weigh each memory. The default escapes entry content and source, so a custom `format` that emits markup is responsible for its own escaping.

Receives only entries that aren’t already in a block this manager wrote earlier in the conversation. With a custom `format`, an entry counts as written when its content appears in such a block.

#### Parameters

| Parameter | Type |
| --- | --- |
| `context` | { `entries`: [`MemoryEntry`](/pr-cms-5569/docs/api/typescript/MemoryEntry/index.md)\[\]; } |
| `context.entries` | [`MemoryEntry`](/pr-cms-5569/docs/api/typescript/MemoryEntry/index.md)\[\] |

#### Returns

`string`