DEV Community

Cover image for Building a Knowledge Integrity Platform with Sanity and AI
Tejas Rawool
Tejas Rawool

Posted on

Building a Knowledge Integrity Platform with Sanity and AI

Sanity Challenge Path Two Submission

This is a submission for the Sanity Challenge, Path Two: Vibe-Code Something Strange

What I Built

ATLAS: AI Knowledge Integrity Auditor

AI can generate an answer in seconds.

The harder question is whether that answer can actually be trusted.

That question led me to build ATLAS, an AI-powered knowledge integrity platform that transforms unstructured content into structured, interconnected knowledge and then investigates factual claims against that knowledge.

Instead of treating an article as one large block of text, ATLAS transforms it into:

Source → Entity → Claim → Relationship → Conflict → Verdict
Enter fullscreen mode Exit fullscreen mode

A user provides a real article or documentation URL. ATLAS extracts entities, atomic claims, relationships and provenance, then stores them as structured documents inside the Sanity Content Lake.

The user can then investigate a specific factual claim instead of simply asking an AI model to summarize the article.

The result is an inspectable investigation containing:

  • Evidence
  • Sources
  • Claims
  • Relationships
  • Conflicts
  • Verdict
  • Evidence graph
  • Adversarial audit results
  • Cryptographic certificate

Don't just trust the answer. Inspect the evidence.


Demo Video

Watch the complete ATLAS workflow:

The demonstration covers:

Ingest Article
      ↓
Extract Structured Knowledge
      ↓
Store Knowledge in Sanity
      ↓
Investigate Claim
      ↓
Generate Verdict
      ↓
Inspect Evidence Graph
      ↓
Run Adversarial Audit
      ↓
Generate Certificate
      ↓
Verify Investigation
Enter fullscreen mode Exit fullscreen mode

The demo uses a real-world article concerning NVIDIA and India's AI infrastructure investment and investigates specific factual claims from that content.


Code

The complete source code is available on GitHub:

GitHub logo TejasRawool186 / Atlas

ATLAS is an autonomous knowledge-integrity platform that investigates factual questions by querying a Sanity-backed Content Lake and Knowledge Base, running adversarial audit probes, and producing tamper-evident cryptographic certificates.

ATLAS

Audit factual claims against structured knowledge with cryptographic verification.

ATLAS is an epistemic integrity auditor that validates factual assertions against relational schemas in Sanity, evaluates contradictions across sources, and seals the evidence into tamper-evident Merkle certificates.

Node TypeScript Tests License Sanity

Overview • How it works • Tech stack • Getting started • Testing


Overview

ATLAS validates factual claims against structured source documents and generates an auditable cryptographic proof for every verdict. The system is designed for engineering, compliance, and research teams that require autonomous agents to produce citations linked to structured schemas rather than ungrounded completions. Standard retrieval engines pass unstructured text chunks to an LLM, making temporal conflicts and subtle hallucinations difficult to isolate. ATLAS replaces this pattern by structuring sources into entities, claims, and relations within the Sanity Content Lake, evaluating conflicts with explicit authority rules, and executing a 10-probe audit suite before issuing a verdict. Every completed investigation produces a…

The repository contains:

  • Investigation agent
  • Sanity integration layer
  • Sanity Studio schemas
  • GROQ queries
  • Evidence graph
  • Conflict detection
  • Adversarial audit system
  • Cryptographic certificate generation
  • Certificate verification
  • Subsystem documentation

Why I Built It

Traditional RAG systems are very good at finding text that looks relevant.

But similarity is not the same thing as evidence.

If two sources disagree, a typical retrieval pipeline can return both pieces of text and leave the model to decide what sounds correct.

I wanted to explore a different approach.

What if the underlying knowledge itself was structured?

What if an AI system could understand that:

Entity
   ↓
Claim
   ↓
Source
   ↓
Relationship
   ↓
Conflict
Enter fullscreen mode Exit fullscreen mode

is not just stored data, but part of the reasoning process?

That became the foundation of ATLAS.


How ATLAS Works

The application follows a structured investigation pipeline.

Article / Documentation
        ↓
Structured Knowledge Extraction
        ↓
Sanity Content Lake
        ↓
Entity Resolution
        ↓
Claim Retrieval
        ↓
Evidence Comparison
        ↓
Conflict Detection
        ↓
AI Investigation
        ↓
Epistemic Verdict
        ↓
Evidence Graph
        ↓
Adversarial Audit
        ↓
Cryptographic Certificate
        ↓
Verification
Enter fullscreen mode Exit fullscreen mode

Each stage has a specific responsibility.

The AI model is not simply given an article and asked to produce an answer.

Instead, the system first builds structured knowledge and then retrieves the evidence required for the investigation.


The Knowledge Model

ATLAS uses Sanity to represent knowledge as interconnected documents.

The primary document types are:

entity
claim
source
relationship
conflict
knowledge_doc
Enter fullscreen mode Exit fullscreen mode

A claim contains structured information such as:

Subject
Predicate
Object
Source
Confidence
Status
Validity Window
Enter fullscreen mode Exit fullscreen mode

This allows the system to reason about individual claims rather than treating an entire article as one piece of text.

For example:

Source
   ↓
Entity: India
   ↓
Claim: AI investment = $1.2B
   ↓
Source: Article
   ↓
Relationship: supported_by
Enter fullscreen mode Exit fullscreen mode

The same structure can also represent conflicting evidence.


How Sanity Fits Into the Application

Sanity is not being used as a simple CMS or secondary database.

It is the structured knowledge layer behind ATLAS.

The Content Lake stores the entities, claims, sources, relationships, conflicts and knowledge documents used by the investigation system.

This means the application can query individual pieces of knowledge and follow their relationships.

The underlying flow is:

User Question
      ↓
Relevant Entities
      ↓
Related Claims
      ↓
Supporting Sources
      ↓
Relationships
      ↓
Conflicts
      ↓
Evidence Set
Enter fullscreen mode Exit fullscreen mode

This structure is what allows ATLAS to investigate relationships rather than simply perform keyword matching.


GROQ Retrieval

The application uses GROQ to retrieve structured knowledge from Sanity.

The investigation first resolves relevant entities.

It then retrieves claims associated with those entities and follows related documents.

The retrieval layer can access:

  • Entities
  • Claims
  • Sources
  • Relationships
  • Conflicts
  • Knowledge documents

This allows the investigation agent to construct an evidence set before generating its conclusion.


The Investigation Agent

Once the relevant knowledge has been retrieved, the investigation agent takes over.

The agent:

  1. Analyzes the question
  2. Plans the investigation
  3. Resolves relevant entities
  4. Retrieves related claims
  5. Retrieves supporting sources
  6. Traverses relationships
  7. Detects competing claims
  8. Applies source authority and recency rules
  9. Generates a citation-backed conclusion
  10. Audits the generated answer
  11. Produces the final verdict

The AI therefore operates on structured evidence rather than an arbitrary collection of text chunks.


Epistemic Verdicts

ATLAS does not force every investigation into a simple yes or no.

It produces four possible outcomes:

SUPPORTED

PARTIALLY_SUPPORTED

CONTRADICTED

INSUFFICIENT_EVIDENCE
Enter fullscreen mode Exit fullscreen mode

The last state is especially important.

If the structured knowledge does not provide enough evidence, ATLAS can return:

INSUFFICIENT_EVIDENCE
Enter fullscreen mode Exit fullscreen mode

instead of inventing an answer.


Conflict Detection

One of the central parts of ATLAS is its contradiction engine.

The system compares structured claims using factors such as:

Subject
Predicate
Object
Source
Validity Interval
Source Authority
Recency
Enter fullscreen mode Exit fullscreen mode

Source authority is also considered when competing claims are discovered.

This allows ATLAS to distinguish between:

Different information
        ↓
Newer information
        ↓
More authoritative information
        ↓
Actual contradiction
Enter fullscreen mode Exit fullscreen mode

This would be much harder to implement reliably when all evidence is stored as raw text.


Adversarial Audit

Generating an answer is not the final step.

ATLAS runs a 10-probe adversarial audit against the generated investigation.

The audit examines areas such as:

Grounding
Unsupported Claims
Citation Coverage
Entity Drift
Evidence Consistency
Temporal Ordering
Counterfactual Source Removal
Retrieval Completeness
Contradictory Evidence
Answer Resilience
Enter fullscreen mode Exit fullscreen mode

The objective is to actively search for weaknesses in the conclusion.

If a statement cannot be connected to the retrieved evidence, the audit can identify the problem instead of silently accepting it.


Evidence Graph

Because the underlying knowledge is represented as connected documents, ATLAS can construct a live evidence graph.

The graph connects:

Entities
   ↓
Claims
   ↓
Sources
   ↓
Relationships
   ↓
Conflicts
Enter fullscreen mode Exit fullscreen mode

This provides a visual explanation of how the final verdict was reached.

Instead of seeing only:

Answer: SUPPORTED
Enter fullscreen mode Exit fullscreen mode

the user can inspect the evidence that led to that result.


Cryptographic Certificate

ATLAS also adds an integrity layer to the investigation.

The evidence used during an investigation can be sealed into a cryptographic certificate using:

HMAC-SHA256
+
Merkle Tree
Enter fullscreen mode Exit fullscreen mode

The certificate commits the investigation to the evidence used at that point in time.

The process is:

Evidence
   ↓
Hash Evidence
   ↓
Build Merkle Tree
   ↓
Generate Certificate
   ↓
Verify Later
Enter fullscreen mode Exit fullscreen mode

If the underlying evidence is modified, verification can detect that the investigation no longer matches the original evidence state.


Demo Investigation

For the demonstration, I used a real-world article concerning NVIDIA and India's AI infrastructure investment.

Rather than asking ATLAS to simply summarize the article, I used the article as the starting point for structured knowledge extraction and then investigated specific factual claims.

Claim 1

"India's current AI investment is $1.2B."

ATLAS returned:

SUPPORTED
Enter fullscreen mode Exit fullscreen mode

The result was connected to the extracted claim and its supporting source through the evidence graph.

Claim 2

"The Union Budget provides a 10-year tax holiday."

ATLAS returned:

CONTRADICTED
Enter fullscreen mode Exit fullscreen mode

The investigation found that although the article contained the AI investment figure, the evidence associated with the tax holiday indicated a 20-year period rather than 10 years.

This demonstrates the central idea behind ATLAS.

The agent is not simply repeating what an article says.

It is decomposing the content into structured claims and investigating those claims against their available evidence.


Technology Stack

Frontend
React 19
Vite
TypeScript
Tailwind CSS

Backend
Node.js
Express
Server-Sent Events

Knowledge Layer
Sanity
Sanity Content Lake
GROQ
Sanity Studio

AI
Gemini 2.5 Flash

Integrity
HMAC-SHA256
Merkle Trees
Enter fullscreen mode Exit fullscreen mode

The application uses AI for interpretation-heavy tasks such as extraction, planning and answer synthesis.

Deterministic code handles retrieval, relationship traversal, source weighting, auditing and certificate verification.

This separation makes the system easier to reason about and debug.


Project Architecture

                         ATLAS
                           |
          +----------------+----------------+
          |                                 |
          v                                 v
      React 19                         Node.js
      Vite                             Express
          |                                 |
          +---------------+-----------------+
                          |
                          v
                  Investigation Agent
                          |
             +------------+------------+
             |                         |
             v                         v
          Gemini                    Sanity
        AI Layer                  Content Lake
                                      |
                           +----------+----------+
                           |          |          |
                           v          v          v
                        Claims    Entities   Sources
                           |          |          |
                           +----------+----------+
                                      |
                                      v
                                Relationships
                                      |
                                      v
                                   Conflicts
                                      |
                                      v
                              Evidence Graph
                                      |
                                      v
                              Adversarial Audit
                                      |
                                      v
                             Cryptographic Proof
Enter fullscreen mode Exit fullscreen mode

My Build Process

The project started with a simple question:

What would an AI system look like if its answer had to be investigated rather than simply generated?

The first step was designing the knowledge model.

Instead of storing an article as a single document, I modeled the application around relationships between:

Sources
Entities
Claims
Relationships
Conflicts
Knowledge Documents
Enter fullscreen mode Exit fullscreen mode

Once that structure existed, I built the ingestion pipeline.

The application takes a URL, extracts the relevant content and uses the AI layer to identify structured entities and atomic claims.

Those objects are then stored in Sanity.

The next challenge was retrieval.

Rather than sending the entire article to the model, the agent first resolves entities and retrieves the relevant structured documents using GROQ.

This made the investigation process more controlled and explainable.

The next stage was contradiction detection.

I introduced explicit rules for comparing claims, evaluating source authority and handling recency.

After that came the adversarial audit.

The audit was designed around one principle:

The system should try to break its own answer.

Finally, I added the cryptographic certificate so that the evidence used by an investigation could be verified after the investigation was complete.


What Worked

The biggest success was using Sanity as a structured knowledge layer rather than treating it as a conventional content backend.

Once claims, entities and relationships became first-class documents, many capabilities became easier to implement.

GROQ also made it possible to express retrieval around the structure of the knowledge instead of relying entirely on semantic similarity.

The evidence graph naturally followed from the relationships already stored in Sanity.


What Did Not Work

The first approach was too close to a traditional RAG system.

It was tempting to retrieve relevant text and immediately ask the model for an answer.

That worked for simple questions, but it did not provide enough visibility into why the answer was correct.

The application therefore evolved toward structured claims and explicit provenance.

Another challenge was avoiding excessive dependence on the AI model.

The final architecture separates AI-assisted tasks from deterministic operations.

AI handles interpretation.

Deterministic code handles retrieval, relationship traversal, source weighting, auditing and verification.


Why Sanity Was Important

The project would have been much harder to build if the article remained one large block of text.

Sanity provided the structure needed to turn content into interconnected knowledge.

The application can reason about:

Who made the claim?
What exactly was claimed?
Where did it come from?
What other claims are related?
Does another source disagree?
When was the claim valid?
How strong is the evidence?
Enter fullscreen mode Exit fullscreen mode

That is where structured content becomes part of the application's reasoning model rather than simply being storage.


Sanity Project Details

Project ID

hrexnsmi
Enter fullscreen mode Exit fullscreen mode

Dataset

production
Enter fullscreen mode Exit fullscreen mode

Sanity Project

https://www.sanity.io/organizations/ofyfft9qh/project/hrexnsmi

Document Types

entity
claim
source
relationship
conflict
knowledge_doc
Enter fullscreen mode Exit fullscreen mode

Studio Schemas

https://github.com/TejasRawool186/Atlas/tree/main/sanity-studio/schemaTypes


Agent Session

An agent session can be included here if available.

The session should be made public before publishing so that judges can access it.


Final Thought

ATLAS started with a simple question:

Can we build an AI system that does not ask users to blindly trust its answer?

The result is an application where the answer is only one part of the investigation.

The evidence, sources, relationships, conflicts, audit results and cryptographic certificate are part of the result too.

The goal is not to make AI appear infallible.

The goal is to make its evidence easier to inspect.

Don't just trust the answer. Inspect the evidence.


Top comments (0)