ANTIGRAVITY LABJP
Articles/Editor View
Editor View/2026-07-16Intermediate

Three Ways to Hand 4,000 Lines of Logs to an Agent — Paste, .txt Attachment, or @ Reference

v2.3.0 added plain-text attachments, which means there are now three ways to hand a long log to an agent — and a new question about which one to pick. Here is how I trim, measure, and decide, with the scripts I actually run.

Antigravity336LogsContext Design2Debugging4Solo Development4

Premium Article

The overnight job was red by morning. As an indie developer shipping app updates on my own schedule, the failure notice usually reaches me within a few minutes of waking up.

The CI log ran to roughly 4,000 lines. With no idea where the failure started, I selected all of it and pasted it into the chat box. As the input field stretched down the screen, I already had the feeling that this was the wrong move.

What came back was not the obvious stack trace near the end of the log. It was a general observation about a warning line near the beginning. The agent had not been lazy. I handed over a 4,000-line block without telling it where the center of gravity was, and that was my design failure, not its reading failure.

v2.3.0 (2026-07-13) added attachment and in-conversation rendering for plain-text files. That brings the number of ways to hand long text to an agent up to three. More options also means more hesitation.

Below, I compare all three against the same log, and lay out how I decide between them — including the trimming and measuring scripts.

Three Handoff Paths, Each Breaking Somewhere Different

Here is the landscape as of today.

Method What it actually is Comfortable length Where it breaks
Paste into chat Becomes part of the conversation body Up to ~120 lines Long pastes crowd the conversation and degrade later turns
.txt attachment (v2.3.0+) Travels as an attachment, rendered in the conversation 120 to a few thousand lines You get a "read the whole thing" summary. It needs a stated focus
@ file reference Points at a file inside the workspace Effectively generous Cannot point outside the workspace

The real difference is not the length ceiling. It is how each one fails.

Pasting contaminates the conversation itself. Those 4,000 lines stay in context for every turn that follows. That is the trap I walked into first.

An attachment keeps the conversation body clean, but without a reading instruction, nothing establishes the center of gravity. Structurally, it is the same phenomenon as an agent skimming a long attached PDF — a topic I covered in why agents skim long attached PDFs, and the verification gate that forces citation.

An @ reference only reaches files inside the workspace. Anything under /var/log, or a log copied over from another machine, is out of reach.

So there are three options, but in any given moment only one or two actually qualify. Deciding that by feel every time was what produced my bad morning.

Trim First — Pulling a Window Out of 4,000 Lines

Before the three-way choice, there is something that has to happen first. Trim.

Of those 4,000 lines, the ones that explain the failure usually number around 100. The rest is progress output that looks identical to a healthy run, and handing it over does not help anyone reason.

Here is the extraction script I use. It finds the error lines and carves out the surrounding context.

#!/usr/bin/env bash
# extract-log-window.sh — carve out just the region around an error
# usage: ./extract-log-window.sh run.log 40 10 > slice.txt
set -euo pipefail
 
LOG="${1:?usage: extract-log-window.sh <logfile> [before] [after]}"
BEFORE="${2:-40}"
AFTER="${3:-10}"
 
# Markers used for detection. Extend these per project.
PATTERN='ERROR|FATAL|Traceback|Exception|panic:|✗|FAIL|exit code [1-9]'
 
if ! grep -nEq "$PATTERN" "$LOG"; then
  echo "# No lines matched the pattern. Emitting the last ${AFTER} lines instead." >&2
  tail -n "$AFTER" "$LOG"
  exit 0
fi
 
TOTAL=$(wc -l < "$LOG")
echo "# source: $LOG (${TOTAL} lines)"
echo "# window: -${BEFORE}/+${AFTER} around /${PATTERN}/"
echo "# ---"
 
# Overlapping windows get joined with --- separators
grep -nE -B "$BEFORE" -A "$AFTER" "$PATTERN" "$LOG"

Running it:

$ wc -l run.log
4127 run.log

$ ./extract-log-window.sh run.log 40 10 > slice.txt
$ wc -l slice.txt
143 slice.txt

4,127 lines became 143 — a 96.5% reduction. At 143 lines, paste and attachment are both viable again.

Why 40 before and only 10 after? The cause of an error is almost always written before the error line. What follows is cleanup and an exit code, which needs far fewer lines. That asymmetry is where I landed after a few rounds of tuning.

One caveat: if you are running shell scripts without set -euo pipefail, the real failure is the first error and everything after it is secondary damage. In that case, look only at the first match.

# Carve a window around the first error only
FIRST=$(grep -nEm1 "$PATTERN" "$LOG" | cut -d: -f1)
sed -n "$((FIRST > 40 ? FIRST - 40 : 1)),$((FIRST + 10))p" "$LOG"

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
A same-log, same-question comparison of paste vs. .txt attachment vs. @ reference, and the decision flow that came out of it
A complete extraction script (bash and Node) that pulls the relevant window out of a 4,000-line log
Measure before you hand off: line count, byte size, and token estimate, so the choice stops being a guess
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

Editor View2026-07-16
Your UI Is in Japanese. Your Commit Log Isn't.
Setting your editor's display language does nothing for the language your agents write into the repository. Here is what six weeks of unattended runs actually produced, how to pin output language per audience, and a gate that catches the drift mechanically.
Editor View2026-07-12
Widening one panel made my agent reviews faster
A field note on turning two quiet additions in Antigravity v2.2.1 — Conversation Width and broader syntax highlighting — into a faster way to read the diffs your agents produce. Small display tweaks, but they changed how quickly I could review.
Editor View2026-07-11
I Only Want to See the Lines the Agent Added: A Changed-Lines Convention Linter
I asked an agent for a small fix, it touched an old file, and the linter threw 13 warnings with no way to tell which were the agent's. Scoping the linter to only the added lines dropped 13 to 3 — about 77% less noise. Here is how to pull added lines out of a diff and check only those, with working code.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →