The Second Brief My Agent Wrote Said My Scoring Was Wrong
I spent four days building a feed of insider trades scored by conviction. Open-market buys rank above discretionary sales, which rank above option exercises, and scheduled 10b5-1 plan sales get suppressed no matter how large. Then I put a research agent on top. For any signal scoring 80 or above, the agent reads the filing, the company’s recent filings and the insider’s history, and writes four lines: what happened, why now, who ends up with cash, and how sure it is.
The second brief it ever wrote was about a Snap executive’s sale my feed had scored as discretionary. The agent read footnote 1 and wrote: “shares were sold to cover tax withholding obligations tied to the settlement of RSUs. So this is not a discretionary open-market sale, even though the feed labels it that way.”
It was right. A withholding sale is payroll mechanics. My conviction ladder never looked at that footnote. I had built the agent to explain the feed and the first useful thing it did was audit it. The brief cost four cents.
I let it change my mind for one reason, and it isn’t that the model is usually right. Every agent prompt I’ve written says some version of “only cite sources you actually read.” The model complies, mostly. A brief that cites a filing the model never opened looks identical to one that did, and this feed is meant to be forwarded to people I’m trying to impress. One invented citation and the conversation is over. So the prompt still says it, but the rule doesn’t live there.
The agent has three tools, all read-only, all restricted to sec.gov. Every tool call records the URL it fetched into a set that belongs to that run:
const body = await cachedFetch(ctx.store, url);
if (body === null) return `error: ${url} could not be fetched`;
ctx.fetched.add(url);
When the research loop ends, a second call asks for the brief as structured output with a sources array. Then one pure function runs over it:
export function filterSources(brief: Brief, allowed: Set<string>): Brief {
const sources = brief.sources.filter((s) => allowed.has(s.url));
return {
...brief,
sources,
confidence: sources.length === 0 ? 'low' : brief.confidence,
};
}
Any cited URL the run didn’t fetch is dropped. A brief with no surviving source is marked low confidence whatever the model claimed. The function has a test. The model’s honesty stopped being load-bearing, which is why the Snap brief got to correct me instead of being filed under “probably hallucinated a footnote.”
I went looking for a name for this because I assumed I had reinvented something, and I had. The established term is an output guardrail: a check that runs on the model’s output after generation and rejects or edits it before anyone sees it. Guardrails come in two kinds. One is a second model that judges the first, the LLM-as-judge setup. The other is plain code: schema validation, length limits, a regex for forbidden phrases. This is the plain-code kind. It is not Anthropic’s evaluator-optimizer workflow from “Building effective agents”, where a generator and a critic loop until the critic is satisfied; nothing here loops and no second model is spent. It is also narrower than the citation-verification tools built for academic papers, which retrieve each cited source and ask a judge whether it supports the claim. This check never reads the source. It checks provenance: is the URL in the set of things this run’s tools returned? A deterministic output guardrail over tool-call provenance, if you want the whole label. It costs nothing per run and it cannot be argued with.
The practice I’d generalize from it: verify what you can verify in code, and spend the model only where judgment is needed. Whether a URL was fetched is a set lookup. Whether a footnote means “this is payroll, not a decision” is judgment, and no regex of mine would have caught it, which is exactly why the model is in the loop at all. Putting the first kind of check in the prompt wastes the model on something a Set does better and leaves the reader trusting a sentence instead of a function.
I don’t know yet whether this holds up at volume. Two briefs is two briefs. The daily cap is 40, the budget is whatever the credits on my account cover, and what I’m watching for is the first brief that cites a real URL and still gets the substance wrong. Provenance can’t catch that. It only guarantees that when the agent is wrong, I can click through and see where.