# JsonStore

**Kind:** Class

**Source:** [`atloria-monorepo/libs/agent-core/src/memory/json-store.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/libs/agent-core/src/memory/json-store.ts#L33)

**Implements:** `MemoryStore`

## Methods

| Method | Signature | Returns |
|---|---|---|
| `save` | `save(record: MemoryRecord)` | `void` |
| `load` | `load(id: string)` | `MemoryRecord | null` |
| `query` | `query(query: MemoryQuery)` | `MemoryRecord[]` |
| `delete` | `delete(id: string)` | `boolean` |
| `getAll` | `getAll(projectId: string)` | `MemoryRecord[]` |
| `count` | `count(projectId: string)` | `number` |
| `touch` | `touch(id: string)` | `void` |

## Where it refuses work

- `JsonStore` stops the work with an early return when `found`, in 2 places.
- `JsonStore` stops the work with an early return when `a.confidence !== b.confidence`.
- `JsonStore` stops the work with an early return when `a.accessCount !== b.accessCount`.
- `JsonStore` stops the work with an early return when `!record`.
- `JsonStore` stops the work with an early return when `this.cache.has(projectId)`.

## When something fails

- `JsonStore` handles failure in 7 places: it discards it silently in 4, turns it into a return value in 2, and logs it and continues in 1.
