# ContextRetriever

**Kind:** Class

**Source:** [`atloria-monorepo/packages/doc-automation/src/v2/stages/stage-10-generation/context-retriever.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/packages/doc-automation/src/v2/stages/stage-10-generation/context-retriever.ts#L22)

## Methods

| Method | Signature | Returns |
|---|---|---|
| `retrieveForDocument` | `retrieveForDocument(plan: DocumentPlan, featureIds: string[])` | `RetrievedContext` |

## Where it refuses work

- `ContextRetriever` stops the work with an early return when `plan.sourceChunkId`.
- `ContextRetriever` stops the work with an early return when `!featureIds || featureIds.length === 0`.
- `ContextRetriever` stops the work with an early return when `chunkCounts.size === 0`.
- `ContextRetriever` stops the work with an early return when `remainingBudget <= 50`.
- `ContextRetriever` stops the work with an early return when `lines.length === 1`.
