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

# Simple Memory

> @obversa/memory-simple: the memory port in one process, for tests and short runs.

`@obversa/memory-simple` keeps memory files in one process, with the same
commands, limits and error codes as every other adapter. Use it in tests
and in runs that don't need memory to outlive the process; for memory that
survives a restart, use [Git Memory](/docs/packages/memory-git).

## Install

<CodeGroup>
  ```bash npm theme={null}
  npm install @obversa/memory-simple
  ```

  ```bash pnpm theme={null}
  pnpm add @obversa/memory-simple
  ```
</CodeGroup>

Included in `@obversa/obversa`.

## Requirements

Nothing beyond Node.js.

## Quickstart

Create the adapter with a scope, write a note and read it back:

```ts examples/memory-simple.ts (excerpt) {1} theme={null}
const memory = createSimpleMemory({ scope: 'memory-simple-example' });
await memory.execute({
  command: 'create',
  path: '/memories/notes.md',
  text: 'Keep the result small.\n',
});
const result = await memory.execute({
  command: 'view',
  path: '/memories/notes.md',
});
```

The adapter supports all six commands of the [memory port](/docs/memory):
`view`, `create`, `str_replace`, `insert`, `delete` and `rename`. Pass it to
`run(job, { memory })` and every job reads it as `ctx.memory`. Run the
whole file with `npx tsx memory-simple.ts`:

```text Output theme={null}
Keep the result small.
```

## Options

| Field | Type | Default | Description |
| - | - | - | - |
| `scope` | `string` | required | The memory scope. |
| `limits` | `Partial<MemoryLimits>` | 64 KB per file, 1 MB and 256 files per scope | `maxFileBytes`, `maxTotalBytes`, `maxFiles`, for a smaller budget. |

## Errors

* **The port's error codes**, listed on [Memory port](/docs/memory#failure).
* **A write past a limit** removes the earliest-written files until it fits,
  never the file being written.

## API

* **`createSimpleMemory(options)`**: a `Memory` in one process.
  [Quickstart](#quickstart).
* **`SimpleMemoryOptions`**: its options.

## Next steps

* [Memory adapters](/docs/memory/adapters): the three adapters side by side.
* [Memory mechanics](/docs/memory/mechanics): `ground`, `curate` and
  `consolidate` over this adapter.


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