DEV Community

Cover image for Curriculum Truth Ledger Path One Agent
Rajab Baig
Rajab Baig

Posted on

Curriculum Truth Ledger Path One Agent

Sanity Challenge Path One Submission

This is a submission for the Sanity Challenge, Path One: Ship an Agent That Queries Real Content

I built Curriculum Truth Ledger Agent, Sanity project ID dxnjdo5l a public assistant that answers questions about Grade 10 Computer Science curriculum evidence in Punjab, Pakistan. Teachers, students, and reviewers can ask whether programming is included and inspect the exact learning outcomes, printed textbook pages, verification status, confidence, human reviewer, and recorded official source behind an answer.

Code

GitHub logo rajab-rajab / curriculum-truth-ledger-agent

Evidence-grounded AI agent for Punjab Grade 10 Computer Science, using Sanity Context MCP to answer curriculum questions with verified textbook excerpts and human-reviewed citations.

Curriculum Truth Ledger Agent — Path One

A public-facing evidence assistant for curriculum questions. The Next.js App Router server route reads full entries from Sanity's hosted Context MCP before asking an OpenAI model to produce a structured answer. The server then removes claims, citations, learning outcomes, links, and verification metadata that are not present in the retrieved evidence.

This repository is Path One only. The separate Path Two frontend and Sanity Studio are independent projects and must not be copied into this repository.

Architecture

  • Next.js 16 App Router UI and Node.js route handler
  • Vercel AI SDK with an OpenAI model
  • Sanity hosted Context MCP and Knowledge Base kbxER3k8a700
  • Upstash Redis distributed sliding-window request control
  • Server-side question validation, evidence grounding, and safe diagnostics

POST /api/answer accepts { "question": "..." }. Questions must be 5–800 characters and request bodies are capped at 4 KiB. Public traffic is limited to six requests…

How I Used Sanity

I started with a question I face as a teacher: if someone says a topic is in the curriculum, can they point to the exact learning outcome and page?

In Sanity, I created three linked document types: curriculumClaim, evidence, and source. A claim records what is being checked and its verification status. Each evidence record links that claim to a source and stores the excerpt, printed textbook location, confidence, and reviewer analysis.

I connected the published production dataset to a Sanity Knowledge Base. The agent uses a Sanity Context MCP endpoint to find relevant entries and read their full contents before answering. It uses entry outlines to navigate, but checks the full retrieved evidence before making a claim or showing a citation.

For example, the records link the verified Grade 10 programming claim to two Student Learning Outcomes in the cited textbook: an introduction to Python on printed page 40 and Python control structures on printed page 55. The answer can therefore show what the record says, where the evidence appears, and who reviewed it. In a test with an unsupported question, the agent returned no matching record without inventing a citation or source link.

Sanity project details

  • Project ID: dxnjdo5l
  • Dataset: production
  • Knowledge Base ID: kbxER3k8a700
  • Published records: One curriculum claim, two evidence records, and one source record
  • Jurisdiction: Punjab, Pakistan
  • Recorded publisher: Punjab Education Curriculum Training and Assessment Authority (PECTAA)
  • Sanity Studio
  • Public Path One agent
  • Path One source code

Sanity Project Details

Top comments (0)