ANTIGRAVITY LABJP
Articles/Editor View
Editor View/2026-06-29Advanced

When Antigravity Skips Parts of a Long Attached PDF — and a Gate That Forces It to Cite Sources

How to handle the case where Antigravity answers confidently from a long attached PDF but quietly skips a clause. With working code: a prompt that forces citations, and a gate that verifies each cited quote actually exists in the PDF.

antigravity400pdfcontext7agent16verification5

Premium Article

While preparing a store submission for one of the wallpaper apps I run as an indie developer, I attached the store guideline PDF (40-plus pages) to Antigravity and asked it to list anything around in-app purchases that might trip me up. The answer looked solid and was genuinely useful. But one clause about subscription price-change disclosure, sitting in the middle of the document, was simply missing. The agent answered as if it had read everything, so it took me a while to notice the gap.

This behavior — confidently answering from a long PDF while quietly skipping a part — is less a flaw in the attachment feature and more a question of how you hand over long context. Below, I'll lay out why the content thins out, then build something concrete: forcing the agent to show its evidence, and verifying that the evidence actually exists in the PDF.

Why a long PDF thins out inside the context

When you attach a whole PDF, its full text is poured into the model's context. Being in the context means it can be read, but "can be read" and "is referenced when answering" are different things. In long documents, attention spreads across the whole, the opening and closing are picked up more easily, and the small mid-document clauses are the ones most likely to slip through. In my own experience, the part that goes missing is always a short, unremarkable sentence somewhere in the middle.

A second trap is the quality of the PDF's text layer. Store PDFs are full of columns and tables, and the extracted text often comes out with its reading order scrambled. A table that looks natural to a human can end up with each item and its condition scattered across unrelated lines, so the agent fails to connect a clause with its exception.

So there are two things to address. First, narrow the range you hand over. Second, force the agent to state where its evidence came from, and verify it. Let's take them in order.

First, make it state where the evidence came from

The first thing that helps is constraining the shape of the answer. Free-form responses come back as summaries with no evidence. Instead, before the conclusion, require a structured page number and an original quote.

You answer strictly from the attached PDF. Do not fill gaps with general knowledge.

For each finding, output in this exact order:
1. page: the page number used as evidence (sequential page in the PDF)
2. quote: a verbatim quote from that page (20-60 characters, unchanged)
3. finding: the concrete impact on my app implied by the quote

For any item with no basis in the PDF, write "no matching passage" and do not guess.
At the end, output the list of page numbers you checked.

The key is the explicit "strictly from the attached PDF" and "do not fill gaps with general knowledge." A model can talk about store rules in general even without an attachment, so unless you forbid it, it will answer from common sense without reading the PDF. Limiting quotes to 20-60 characters matters because quotes that are too long drift during verification, and quotes that are too short cannot be uniquely located.

Even at this point, gaps become easier to spot. If the "list of page numbers checked" skews toward the front, that is a sign the middle is being skimmed. Still, whether each quote is correct is something a human would otherwise have to cross-check one by one. That is what we mechanize next.

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
You'll understand why a long attached PDF gets skimmed, and you can structurally reduce that context dilution
You'll be able to make the agent emit page and quote before its conclusion, and mechanically verify that each quote actually exists in the PDF
For high-stakes reviews like store submissions or spec checks, you'll have a concrete basis for trusting the agent's answer
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-05-20
When Antigravity Agent Edits Break Diffs Due to Mixed CRLF/LF Line Endings
Working across Windows, Mac, and Linux, you may suddenly see Antigravity Agent edits turn an entire file's diff bright red. This article walks through detecting CRLF/LF mismatches and a three-layer fix across git, the editor, and the Agent itself.
Editor View2026-04-29
Giving Antigravity Precise Context — A Practical Guide to @-References for Sharper AI Outputs
Use Antigravity's @file, @symbol, @docs, and @web references to scope what the AI reads and edits. Patterns and examples I rely on in real projects.
Tips2026-05-24
Why Antigravity's Agent Keeps Referencing the Previous Repo After You Switch Projects — Diagnosis and Fix
When Antigravity carries leftover state from your previous project into a new one, the agent confidently edits files that don't belong to the current repo. Here's how to diagnose and prevent that context bleed.
📚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 →