## TL;DR
Summarize dbt results from the run_results artefact in aggregate instead of pasting it into the prompt: count statuses per model and test, keep only failures with their messages, and cap the failure detail list with a pointer to the artefact file. A full run_results file for a large project is mostly passing entries the summary never needs.

```text
context overflow error agent tried to include all dbt test results failed truncation
```

## Use this when
- The check or run fails with this symptom: the agent hits context overflow including all dbt test results.
- You are working on an agent reporting dbt test outcomes after a run and the failure repeats on the same data or configuration.
- You need the failing rows, rule, or stage isolated before changing thresholds or code.

## Not for this skill when
- One failing test whose full compiled SQL is needed, where the fix is fetching that single entry rather than the whole artefact.
- The error text names a different tool, stage, or root cause. Match the verbatim error first and use that skill.

## Steps
1. Parse run_results.json with a script and produce counts: models and tests by status, with total execution time. Verify: the summary starts from computed counts, not raw file text
2. Extract only error and fail entries, with node name, status, and the first lines of the message. Verify: detail is limited to non-passing entries
3. Cap the detailed list, for example at 30 entries, and record the artefact path for the remainder. Verify: the prompt payload stays bounded regardless of project size
4. Include the invocation id and target so the summary can be matched back to the exact run. Verify: the summary names which run it describes

## Variant phrasings
### agent context overflow dbt test results summary
The dbt-results phrasing.
### run results json too large for agent prompt
The artefact-size phrasing.
### agent truncated summarizing dbt run failures
The truncation phrasing.

Compatibility: Agent frameworks summarizing dbt run results and test outcomes

## Why it happens
Run artefacts record every node in the project, so their size grows with the project while the interesting content, the failures, stays small. Pasting the artefact makes the prompt cost proportional to project size and guarantees truncation exactly when the project gets large.

## Edge cases / pitfalls
- Warnings often matter more than their count suggests; include warning entries in the detail cap after failures.
- Very large messages, such as full compiled SQL in an error, should be truncated per entry with the artefact path noted.

## Provenance

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