Skip to content

fix(agent): bound research output size - #160

Merged
iamjr15 merged 1 commit into
mainfrom
fix/research-output-bounds
Aug 4, 2026
Merged

fix(agent): bound research output size#160
iamjr15 merged 1 commit into
mainfrom
fix/research-output-bounds

Conversation

@iamjr15

@iamjr15 iamjr15 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Why

The production trace after PR #159 proved that Anthropic native structured output was active, but query passes generated 11-23 exhaustive claims and exhausted the response budget before emitting required fields. Responses were valid JSON prefixes cut off mid-claim or before summary.

What changed

  • Bound each query pass to 1-6 concise claims and 1-3 exact provider citations per claim.
  • Prompt the model to produce 4-6 synthesis-ready claims instead of restating the whole evidence pack.
  • Bound synthesis to 16 consolidated claims and 4 source IDs per claim.
  • Give the final synthesis an explicit 8,192-token allowance while keeping the report below 2,000 words.
  • Keep all strict Exa/Firecrawl provenance validation in place.

No database, migration, dependency, environment, or deployment-topology changes.

Verification

  • pnpm lint
  • pnpm typecheck
  • pnpm turbo build --force
  • pnpm deadcode
  • pnpm architecture:check
  • pnpm turbo skills:build

After deployment, production QA will repeat natural-language and explicit-tool research flows and validate PDF generation, viewing, download, refresh persistence, and / file recall.

@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
cheatcode Skipped Skipped Aug 4, 2026 10:38pm

@iamjr15
iamjr15 merged commit d8c5226 into main Aug 4, 2026
6 checks passed
@iamjr15
iamjr15 deleted the fix/research-output-bounds branch August 4, 2026 22:40
iamjr15 added a commit that referenced this pull request Aug 4, 2026
## Why

The post-#160 production trace showed a complete, bounded six-claim
research pass with a valid summary. Anthropic respected the array bounds
but did not enforce JSON Schema `maxLength`; Mastra post-validation
rejected one 1,020-character claim against the 800-character
model-facing limit.

## What changed

- Remove provider-unreliable string-length constraints from model-facing
claim, summary, and report fields.
- Keep the working max-items limits for claims and source fan-out.
- Keep explicit prompt concision, synthesis token allowance, and strict
Exa/Firecrawl provenance validation unchanged.

No database, migration, dependency, environment, or deployment-topology
changes.

## Verification

- `pnpm lint`
- `pnpm typecheck`
- `pnpm turbo build --force`
- `pnpm deadcode`
- `pnpm architecture:check`
- `pnpm turbo skills:build`

Production QA will repeat the complete PDF lifecycle after deployment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant