# Memory

## Retrieve

`client.projects.memory.retrieve(stringprojectID, RequestOptionsoptions?): MemoryRetrieveResponse`

**get** `/projects/{projectId}/memory`

Get the caller's assistant memory scoped to this project (auto-learned). Returns 404 if empty.

### Parameters

- `projectID: string`

### Returns

- `MemoryRetrieveResponse`

  - `memory: Memory`

    Public JSON shape returned by GET endpoints

    - `id: string`

      The memory ID — deterministic from scope + parent IDs (example: "mem_team_team_abc")

    - `content: string`

      Markdown content of the memory

    - `createdAt: string`

      ISO 8601 timestamp when the memory was first written

    - `sizeBytes: number`

      UTF-8 byte length of the content — used for quota enforcement

    - `updatedAt: string`

      ISO 8601 timestamp when the memory was last updated

    - `updatedBy: string`

      The userId of the last writer — useful for audit/UI

### Example

```typescript
import Scenario from '@scenario-labs/sdk';

const client = new Scenario({
  apiKey: process.env['SCENARIO_SDK_API_KEY'], // This is the default and can be omitted
  apiSecret: process.env['SCENARIO_SDK_API_SECRET'], // This is the default and can be omitted
});

const memory = await client.projects.memory.retrieve('projectId');

console.log(memory.memory);
```

#### Response

```json
{
  "memory": {
    "id": "id",
    "content": "content",
    "createdAt": "createdAt",
    "sizeBytes": 0,
    "updatedAt": "updatedAt",
    "updatedBy": "updatedBy"
  }
}
```

## Update

`client.projects.memory.update(stringprojectID, MemoryUpdateParamsbody, RequestOptionsoptions?): MemoryUpdateResponse`

**put** `/projects/{projectId}/memory`

Set the caller's assistant memory scoped to this project (markdown, max 30KB). Set content to null to clear.

### Parameters

- `projectID: string`

- `body: MemoryUpdateParams`

  - `content?: string`

    Markdown content of the memory. Set to null to clear.
    Max size depends on the scope (20-50 KB).

### Returns

- `MemoryUpdateResponse`

  - `memory?: Memory`

    Public JSON shape returned by GET endpoints

    - `id: string`

      The memory ID — deterministic from scope + parent IDs (example: "mem_team_team_abc")

    - `content: string`

      Markdown content of the memory

    - `createdAt: string`

      ISO 8601 timestamp when the memory was first written

    - `sizeBytes: number`

      UTF-8 byte length of the content — used for quota enforcement

    - `updatedAt: string`

      ISO 8601 timestamp when the memory was last updated

    - `updatedBy: string`

      The userId of the last writer — useful for audit/UI

### Example

```typescript
import Scenario from '@scenario-labs/sdk';

const client = new Scenario({
  apiKey: process.env['SCENARIO_SDK_API_KEY'], // This is the default and can be omitted
  apiSecret: process.env['SCENARIO_SDK_API_SECRET'], // This is the default and can be omitted
});

const memory = await client.projects.memory.update('projectId');

console.log(memory.memory);
```

#### Response

```json
{
  "memory": {
    "id": "id",
    "content": "content",
    "createdAt": "createdAt",
    "sizeBytes": 0,
    "updatedAt": "updatedAt",
    "updatedBy": "updatedBy"
  }
}
```

## Domain Types

### Memory Retrieve Response

- `MemoryRetrieveResponse`

  - `memory: Memory`

    Public JSON shape returned by GET endpoints

    - `id: string`

      The memory ID — deterministic from scope + parent IDs (example: "mem_team_team_abc")

    - `content: string`

      Markdown content of the memory

    - `createdAt: string`

      ISO 8601 timestamp when the memory was first written

    - `sizeBytes: number`

      UTF-8 byte length of the content — used for quota enforcement

    - `updatedAt: string`

      ISO 8601 timestamp when the memory was last updated

    - `updatedBy: string`

      The userId of the last writer — useful for audit/UI

### Memory Update Response

- `MemoryUpdateResponse`

  - `memory?: Memory`

    Public JSON shape returned by GET endpoints

    - `id: string`

      The memory ID — deterministic from scope + parent IDs (example: "mem_team_team_abc")

    - `content: string`

      Markdown content of the memory

    - `createdAt: string`

      ISO 8601 timestamp when the memory was first written

    - `sizeBytes: number`

      UTF-8 byte length of the content — used for quota enforcement

    - `updatedAt: string`

      ISO 8601 timestamp when the memory was last updated

    - `updatedBy: string`

      The userId of the last writer — useful for audit/UI
