# ContextManager

**Kind:** Class

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

## Methods

| Method | Signature | Returns |
|---|---|---|
| `add` | `add(item: Omit<ContextItem, 'turn' | 'tokenEstimate'> & { tokenEstimate?: number })` | `void` |
| `nextTurn` | `nextTurn()` | `void` |
| `getItems` | `getItems()` | `ReadonlyArray<ContextItem>` |
| `getTurn` | `getTurn()` | `number` |
| `getTotalTokens` | `getTotalTokens()` | `number` |
| `shouldCompact` | `shouldCompact()` | `boolean` |
| `compact` | `compact()` | `Promise<void>` |
| `clear` | `clear()` | `void` |

## Where it refuses work

- `ContextManager` stops the work with an early return when `this.items.length <= minKeep`.
