◉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.

Antigravity386agents146context design4unattended runs6operations33

✦ 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-09-06
With scheduled agents, I now look for runs that never happened before I look for failures
My run ledger showed a 100% success rate while the evening slot had not fired for two weeks. Here is the reconciliation I now run against an expected-fire table, with measured notes on cron expansion, exit codes, and how the ledger itself gets written.
◈ Agents & Manager2026-04-26
Designing Antigravity Agent Traces That Tell You Why It Failed — Observability in Practice
How to add OpenTelemetry spans to your own agent loop so a failure can be read in a few lines. Covers span structure, what to keep and drop in attributes, a failure_class taxonomy, a retry table, three dashboard views, cost attributes, and PII handling — with code that runs.
◈ Agents & Manager2026-10-16
Before Handing an Agent a .zip: Dropping .git Cut 29 MB to 15 MB, and 28 Secret Warnings Turned Out to Be Noise
Antigravity app v2.23.0 lets you attach a .zip. I packed my own repository to count what .git weighs and how many secret-scan warnings are false alarms, and I leave the full Python script that excludes, scans, and writes a manifest.