# IterativeDeepLoader

**Kind:** Class

**Source:** [`atloria-monorepo/packages/doc-automation/src/v2/stages/stage-04-analysis/iterative-deep-loader.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/packages/doc-automation/src/v2/stages/stage-04-analysis/iterative-deep-loader.ts#L39)

## Methods

| Method | Signature | Returns |
|---|---|---|
| `executeWithDeepLoading` | `executeWithDeepLoading(initialPrompt: string, chunk: Chunk, options: {
      maxTokens?: number;
      temperature?: number;
      systemPrompt?: string;
    })` | `Promise<DeepLoaderResult>` |

## Where it refuses work

- `IterativeDeepLoader` stops the work with an early return when `!this.needsMoreContext(response.content)`.
- `IterativeDeepLoader` stops the work with an early return when `markerIndex === -1`.
- `IterativeDeepLoader` stops the work with an early return when `!jsonMatch`.
- `IterativeDeepLoader` stops the work with an early return when `chunkEntity.sourceCode`.
- `IterativeDeepLoader` stops the work with an early return when `chunkEntity.signature`.
- `IterativeDeepLoader` stops the work with an early return when `entity.sourceCode`.

## When something fails

- `IterativeDeepLoader` handles failure in 3 places: it logs it and continues in 2, and turns it into a return value in 1.
