## TL;DR

Loading an 800-model manifest.json into context always risks a timeout. The agent should never load the whole file: use `dbt ls --select [SUBSET] --output json` to get just the relevant nodes, or stream slices with `jq`, and cache the pruned graph for the rest of the session.

## Error

```text
dbt fix agent failed with timeout scanning an 800-model project manifest
```

## Steps

1. Stop reading manifest.json directly. Start with a scoped listing: `dbt ls --select [FAILING MODEL]+ --output json`. Expected: a small JSON payload with only the relevant subgraph.
2. When the manifest is unavoidable, stream it: `jq '.nodes | keys | length' target/manifest.json` for counts, `jq '.nodes["model.project.name"]'` for one node. Expected: each command returns in seconds.
3. Extract just the fields the fix needs (depends_on, raw_code, compiled_path) rather than whole node objects. Expected: the working set fits comfortably in context.
4. Cache the pruned node list to a scratch file for the session. Expected: later steps read the cache, not the manifest.
5. Proceed with the fix using the scoped graph. Expected: no more timeouts.

## When to use

- An agent times out or overflows context reading manifest.json on a large project.
- The project has hundreds of models.

## When not to use

- The project is small (a full manifest read is fine).
- The agent needs warehouse data, not graph metadata (query the warehouse instead).

## Tool compatibility

- dbt Core 1.0 and later, all adapters. `dbt ls --output json` and `jq` are the tools.

## Variant phrasings

### Agent context overflow on manifest.json

Same fix: never load the whole file; slice it.

### dbt ls slow on a huge project

Scope with selectors first; full listings are the slow path.

## Why it happens

manifest.json on a large project is tens of megabytes of JSON. Reading it whole into an agent context blows time and token budgets, while the fix almost always concerns a handful of nodes.

## Edge cases

- Partial parsing keeps an in-memory manifest; `dbt ls` still re-reads from disk, which is fine.
- The manifest must exist: run `dbt parse` first if `target/` is empty.
- Node IDs include the package and resource type; quote them for jq (dots in keys).

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_2x_y6kMUrsXu7xNWq_1y8g
