Whatnot builds a daily AI subagent to eliminate GraphQL schema bloat via automated cleanup PRs
Whatnot's GraphQL schema had accumulated over 2,600 unused fields left behind from old features, making the schema more complex and harder to navigate and introducing risk of accidentally reusing old, unoptimized endpoints. Manual cleanup was impractical because making breaking changes to remove fields is tricky, time-consuming, and risks breaking client experiences.
How it works
Common implementation structure
How this type of workflow is generally built, generalized across documented cases — not tied to any one vendor's stack. Click any stage to read what happens there. Specific products that implement these stages appear in “Tools commonly seen” below.
A pipeline parsed 30 days of queries, deduplicated traffic by unique query hashes, and traversed the schema's Abstract Syntax Tree (AST) to record every field visit.
Tools used
GitHub ActionLLMAbstract Syntax Tree (AST)
Outcome
A process that once took an engineer one to two hours per field now takes minutes to review, with the subagent having safely removed 24 of approximately 200 unused root fields at a cost of roughly $1–3 per run in LLM credits, and most PRs requiring no edits at all.
What failed first
Static analysis alone could not reliably identify safe-to-delete fields because older mobile app versions may still call queries removed from the main branch, and admin tooling dashboards execute queries entirely outside the primary repositories.
Results
Time savedfrom one to two hours per field to minutes to review