ANTIGRAVITY LABJP
Articles/Agents & Manager
Agents & Manager/2026-07-17Advanced

Three Quarters of My Reference Notes Never Reached the Agent: Measuring What head Cuts Away

I fed reference notes to a scheduled agent with cat and head, and the lines that mattered were quietly cut. Here is the measurement, and how I replaced a line count with a section-level contract.

Antigravity337agents128context design3unattended runs4operations25

Premium Article

My morning update run walked straight into a bug my own notes told it how to avoid. The prompt had not changed since the day before. The workaround was right there in the file.

The agent was not the problem. The head -150 I had written when handing over that file was cutting the text a few lines above the workaround.

The same prompt, and notes that sometimes arrive

As an indie developer, when I put app update work on a schedule, the agent gets reference material: release steps, known issues, device-specific branches. The usual approach is to cat those files into the prompt.

# how I used to hand them over (the flawed version)
cat "${NOTES}/release_steps.md" | head -150
cat "${NOTES}/known_issues.md" | head -150

The head -150 was there for a reason. Notes grow, and a swollen prompt dilutes the actual instruction. As a brake, it was the right instinct.

But that line assumes the top 150 lines are the most important ones. I had never once checked that assumption.

The cut is measured in lines; the value sits in sections

I started by measuring the files I was actually shipping, rather than arguing from intuition.

for f in "${NOTES}"/*.md "${NOTES}"/*.txt; do
  L=$(wc -l < "$f"); B=$(wc -c < "$f"); H=$(head -150 "$f" | wc -c)
  printf '%s: lines=%s bytes=%s head150=%s reach=%s%%\n' \
    "$(basename "$f")" "$L" "$B" "$H" "$(( H * 100 / B ))"
done

Three files, three answers.

FileLinesTotal bytesBytes delivered by head -150Reach
Update history notes (append-on-top)63369,13019,25227%
Keyword and takeaway notes (append-on-top)860105,54023,17421%
Audience and assumptions notes (rewritten in place)432,9192,919100%

Seventy to eighty percent never arrived. Worse, the reach depended entirely on how each file grows. Append-on-top files stack new sections at the head, so a line budget is consumed almost immediately. Files rewritten in place stay small and pass whole. The same head -150 meant something different for every file.

The boundary was the uglier half. Around line 150, the cut landed in the middle of a dated section: the heading and its first two bullets crossed over, and the conclusion of that section did not. From the agent's side, a half-written fragment had been presented as reference material.

A line count is a unit that knows nothing about a file's structure. I was trying to enforce a byte budget and putting the scissors somewhere meaning had not agreed to.

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
Real numbers: a 633-line, 69,130-byte notes file delivered only 19,252 bytes (27%) under head -150, with the cut landing mid-section
The asymmetry that hides the failure: a wrong path, an empty file, and a mid-section cut all exit 0 and look identical downstream
Full implementation of a byte-budgeted section packer plus a preflight that refuses to launch the agent when required sections are missing
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

Agents & Manager2026-07-12
What to Delegate to an Antigravity Agent and What to Keep by Hand, After Two Weeks
After two weeks of handing my daily solo-dev tasks to Antigravity agents, a clear line emerged between the work I was glad to delegate and the work I had to pull back. A retrospective with the operational log.
Agents & Manager2026-06-28
Treating Built-in Guide Skills as Design Assets, Not Throwaway Prompts
Antigravity v2.2.1 added built-in Guide skills. Here is a concrete structure and set of judgment calls for running them as version-controlled, shared design assets instead of one-off instructions.
Agents & Manager2026-04-26
Designing Antigravity Agent Traces That Tell You Why It Failed — Observability in Practice
Run Antigravity agents long enough and unreadable failure logs pile up fast. This piece walks span structure, attribute design, failure tagging, dashboards, cost visibility, and retry policy — backed by six months of production metrics — so you can cut post-incident debugging time in half.
📚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 →