> ## Documentation Index
> Fetch the complete documentation index at: https://kawax.biz/llms.txt
> Use this file to discover all available pages before exploring further.

# Session memory

> Use the experimental Laravel Copilot SDK SessionRpc memory.importRecord API to import one user-specified memory into the session's cloud memory service.

## Session memory

Scope: SessionRpc (session-level operations tied to a Session)

For an overview of RPC and the list of all RPC pages, see [RPC](https://kawax.biz/en/packages/laravel-copilot-sdk/rpc.md).

## memory.importRecord (experimental)

`memory()->importRecord()` imports one memory that the user explicitly specified into the session's cloud memory service. It does not infer anything from the input. Set `scope` to `MemoryImportScope::User` (the current user) or `MemoryImportScope::Repository` (the repository the session resolved).

```php theme={null}
use Revolution\Copilot\Contracts\CopilotSession;
use Revolution\Copilot\Enums\MemoryImportScope;
use Revolution\Copilot\Facades\Copilot;
use Revolution\Copilot\Types\Rpc\SessionMemoryImportRecordRequest;

Copilot::start(function (CopilotSession $session): void {
    // memory.importRecord
    $result = $session->rpc()->memory()->importRecord(new SessionMemoryImportRecordRequest(
        scope: MemoryImportScope::Repository,
        subject: 'Test command',
        fact: 'Run the tests for this project with composer test.',
        reason: 'Use the project test command when verifying future changes.',
        citations: 'composer.json:scripts.test',
    ));

    // $result->ok: whether the memory was stored
    // $result->status: the import result
    // $result->code: machine-readable result code
    // $result->message: explanation from the service or runtime
});
```

`subject` is a short title, `fact` is the fact to store, `reason` is why to store it, and `citations` is the source that supports the fact. All of them are required. The return value is a `SessionMemoryImportRecordResult`, and `status` is `MemoryImportStatus|string`. Known values become enum cases, and unknown values stay as strings.

| status | Meaning |
| - | - |
| `imported` | Stored |
| `conflict` | The service rejected it because of a conflict |
| `disabled` | Storing is disabled by policy or settings |
| `unavailable` | Cloud memory storage is unavailable |
| `failed` | The service could not store it |

The session's credentials, repository, memory policy, permission checks, secret filtering and telemetry apply. Conflicts and service failures come back as results, and there is no fallback to a local or host store. Check the input so that you don't send sensitive content.

For importing multiple records from JSONL, see the server-level [memories.import](https://kawax.biz/en/packages/laravel-copilot-sdk/rpc/server-memories.md).


## Related topics

- [SessionRpc overview](https://kawax.biz/en/packages/laravel-copilot-sdk/rpc/session-overview.md)
- [SessionConfig](https://kawax.biz/en/packages/laravel-copilot-sdk/session-config.md)
- [RPC (Remote Procedure Call)](https://kawax.biz/en/packages/laravel-copilot-sdk/rpc.md)
- [Session](https://kawax.biz/en/session.md)
- [Memories](https://kawax.biz/en/packages/laravel-copilot-sdk/rpc/server-memories.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.