# VectorStore

**Kind:** Class

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

## Methods

| Method | Signature | Returns |
|---|---|---|
| `load` | `load()` | `void` |
| `save` | `save()` | `void` |
| `upsert` | `upsert(chunks: CodeChunk[])` | `void` |
| `remove` | `remove(chunkIds: string[])` | `void` |
| `removeByFile` | `removeByFile(files: string[])` | `void` |
| `getAll` | `getAll()` | `CodeChunk[]` |
| `getByFile` | `getByFile(file: string)` | `CodeChunk[]` |
| `vectorSearch` | `vectorSearch(queryEmbedding: number[], topK: number)` | `Array<{ chunk: CodeChunk; score: number }>` |
| `getMerkle` | `getMerkle()` | `Map<string, string>` |
| `setMerkle` | `setMerkle(merkle: Map<string, string>)` | `void` |

## Where it refuses work

- `VectorStore` stops the work with an early return when `queryEmbedding.length === 0`.

## When something fails

- `VectorStore` handles failure in 3 places: it logs it and continues in 1, turns it into a return value in 1, and discards it silently in 1. A failure discarded silently leaves no trace for whoever debugs this later.
