# Instructions

## Retrieve

`client.projects.instructions.retrieve(stringprojectID, RequestOptionsoptions?): InstructionRetrieveResponse`

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

Get the project's assistant instructions (markdown). Returns 404 if not set. Any project member can read.

### Parameters

- `projectID: string`

### Returns

- `InstructionRetrieveResponse`

  - `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 instruction = await client.projects.instructions.retrieve('projectId');

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

#### Response

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

## Update

`client.projects.instructions.update(stringprojectID, InstructionUpdateParamsbody, RequestOptionsoptions?): InstructionUpdateResponse`

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

Set the project's assistant instructions (markdown, max 50KB). Set content to null to clear. Team or project admins only.

### Parameters

- `projectID: string`

- `body: InstructionUpdateParams`

  - `content?: string`

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

### Returns

- `InstructionUpdateResponse`

  - `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 instruction = await client.projects.instructions.update('projectId');

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

#### Response

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

## Domain Types

### Instruction Retrieve Response

- `InstructionRetrieveResponse`

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

### Instruction Update Response

- `InstructionUpdateResponse`

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