# MemoryBackend

**Kind:** Class

**Source:** [`atloria-monorepo/libs/agent-core/src/context/checkpoint-backend.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/libs/agent-core/src/context/checkpoint-backend.ts#L83)

**Implements:** `CheckpointBackend`

## Methods

| Method | Signature | Returns |
|---|---|---|
| `save` | `save(snap: Snapshot)` | `void` |
| `load` | `load(relPath: string)` | `Snapshot[]` |
| `loadLatest` | `loadLatest(relPath: string)` | `Snapshot | null` |
| `deleteFile` | `deleteFile(relPath: string)` | `void` |
| `deleteFrom` | `deleteFrom(relPath: string, fromIndex: number)` | `void` |
| `getTrackedFiles` | `getTrackedFiles()` | `string[]` |
| `getTotalCount` | `getTotalCount()` | `number` |
| `getSnapshotCount` | `getSnapshotCount(relPath: string)` | `number` |
| `clear` | `clear()` | `void` |
| `evictOldest` | `evictOldest()` | `boolean` |

## Where it refuses work

- `MemoryBackend` stops the work with an early return when `!snaps || snaps.length === 0`.
- `MemoryBackend` stops the work with an early return when `!snaps`.
- `MemoryBackend` stops the work with an early return when `fromIndex < 0 || fromIndex >= snaps.length`.
