# Verifit: an Anti-Hallucination Career Engine with Sanity Agent Actions

> Source: <https://dev.to/saad4software/verifit-an-anti-hallucination-career-engine-with-sanity-agent-actions-46ac>
> Published: 2026-09-21 19:12:25+00:00

*This is a submission for the [Sanity Challenge, Path Two: Vibe-Code Something Strange](https://dev.to/challenges/sanity-2026-09-16)*

## 
  
  
  What I Built

**Verifit** is an anti-hallucination career intelligence engine, CV tailoring suite, and job application tracker. 

### 
  
  
  The Problem

Most AI resume builders suffer from unchecked fabrication. Ask a generic LLM to *"tailor this resume for this job posting"*, and within seconds it invents 5 years of Kubernetes experience, fabricates degrees, and inflates past job titles. On the employer side, automated ATS keyword matchers lack semantic understanding and reward buzzword stuffing rather than verified experience.

### 
  
  
  The "Strange" Idea: A Zero-Trust Career Graph

We asked: *What if career records and job opportunities weren't treated as static markdown files or flat text dumps, but as an **auditable, structured content graph** inside Sanity, backed by deterministic scoring, cloud-deployed schema contracts, and human-in-the-loop workflows?*

Verifit turns Sanity into a verifiable AI operating system:

1. 
**Multi-Source Ingestion & Extraction** : Ingests candidate CVs (PDF/DOCX/text) and live job postings (via URL or text) directly into structured Sanity schemas.
2. 
**Hierarchical Requirement Trees** : Deconstructs job postings into discrete requirements with min/max experience ranges and boolean`AND` /`OR` alternative groupings (e.g.,*"BS in Computer Science OR 4+ years of practical experience"* ).
3. 
**Zero-Hallucination Evidence Matching** : Candidate experience is evaluated against job requirements with strict anti-fabrication guardrails. Every match**must be backed by verbatim quoted excerpts** with direct field paths. Unsubstantiated claims are rejected by a deterministic scoring engine.
4. 
**Anti-Hallucination CV Tailoring & Bespoke Cover Letters** : Re-frames summaries and aligns verified accomplishments against identified job gaps without ever fabricating history.
5. 
**Full Application Pipeline** : A custom Kanban tracking board (`Draft` →`Applied` →`Interviewing` →`Offered` →`Rejected` ) with side-by-side before-and-after score delta analytics and an export drawer.

## 
  
  
  Demo

### 
  
  
  Key Interactive Features

- 
**Interactive Modular CV Editor** : Dynamic section reordering and editing with optimistic updates and Sanity revision preconditions (`_rev` ).

- 
**Human-in-the-Loop JD Review Stepper** : Visual side-by-side evidence checker pairing structured criteria against the original source text.

**Grounded Matches Panel** : Real-time evaluation of CVs against confirmed job requirements with expandable, verbatim quote citations.
**Score & Requirement Delta Analysis** : Instant side-by-side progression showing closed requirement gaps (`not_evidenced` →`met` ) after tailoring.

- 
**Application Package Drawer** : One-click clipboard bundle containing tailored CV content, cover letter, and job metadata ready for submission.

## 
  
  
  Code

- 
**GitHub Repository:**[https://github.com/saad4software/Verifit](https://github.com/saad4software/Verifit) ### Core Stack
- 
**Frontend & Fullstack:** Next.js 16 (App Router, Server Actions,`proxy.ts` ,`after()` ), React 19, Tailwind CSS v4, Lucide React
- 
**Content Lake & AI:** Sanity Studio v5, Sanity Agent Actions (`@sanity/client` API`vX` ),`@sanity/vision`
- 
**Identity & Persistence:** Better Auth over Turso LibSQL & Drizzle ORM
- 
**Security & Extraction:**`@mozilla/readability` ,`jsdom` ,`ipaddr.js` (SSRF pinning),`mammoth` ,`unpdf`
- 
**Testing & Quality:** Over 200 automated unit, DOM, and Playwright integration tests

## 
  
  
  My Build Process

### 
  
  
  The AI-Native IDE & Prompting Philosophy

Verifit was built through an AI-native pair programming workflow using **Antigravity IDE** and **Claude Code**. Rather than using vibe-coding to generate throwaway scripts, the focus was on **prompt-driven systems architecture**:

- Enforcing modular separation of concerns (`modules/cvs` ,`modules/jds` ,`modules/matching` ,`modules/applications` )
- Writing formal Architecture Decision Records (ADRs) before implementing complex features
- Pair-prompting automated test suites (200+ unit and integration tests) to ensure models didn't introduce regressions

### 
  
  
  Prompts That Worked: Sanity Cloud Schema-Constrained Agent Actions

The critical breakthrough was steering away from freeform conversational prompts. Instead, we leveraged **Sanity Cloud Schema-Constrained Agent Actions** with `noWrite: true`. 

By deploying strict schemas directly to the Sanity cloud (`sanity schemas deploy`), the AI was bound to a strict data contract:

### 
  
  
  Where the Model Got Stuck & How We Course-Corrected

1. The Hallucinated Scoring Trap:

- Problem: When early prompts asked the AI agent to output both the evidence and the final match score, it hallucinated generous numbers (awarding 95% scores to unqualified candidates).
- Course Correction: We decoupled reasoning from calculation. The Sanity Agent Action only extracts candidate evidence and identifies verbatim quotes; a deterministic TypeScript scoring engine (requirements-v1) computes weights, boolean groups, penalties, and coverage percentages.

1. SSRF Vulnerabilities on Remote Job Fetching:

- Problem: When prompting URL extraction for job postings, models routinely generated naive fetch(url) code that exposed internal network vectors and cloud metadata endpoints (169.254.169.254).
- Course Correction: We engineered an SSRF protection layer using ipaddr.js to perform DNS resolution checks and aggressively block loopback, link-local, and private subnets before fetching.

1. Long-Running Execution & Worker Timeouts:

- Problem: Deep multi-pass document structuring can take 15–25 seconds, causing HTTP connection drops.
- Course Correction: We utilized Next.js 16's after() background execution pattern combined with 5-minute distributed lease locks stored directly on match records in Sanity to prevent duplicate runs across multi-tab sessions.

## 
  
  
  Reaching Past the Studio: Bonus Criteria

1. Custom App on Top of Content (App SDK Ethos)
Verifit is an interactive application, not a read-only viewer:

- Direct Workspace: Candidates manage their master CV, reorder sections, import job postings, run evaluations, and move applications through a live Kanban pipeline.
- Optimistic UI & Mutation Guards: Mutations to CV sections and JD fields use optimistic UI updates backed by Sanity _rev revision checks to prevent concurrent overwrites.

1. Workflows Modeled as Data Next to Content
Rather than treating generation as a single black-box step, Verifit models multi-step human/AI workflows directly in the document schemas:

- Human-in-the-Loop Review: Newly ingested JDs stay in Needs Review. Users verify that extracted requirements faithfully represent the source posting before clicking Confirm.
- Atomic Pending Replacement Pattern: If a job posting changes, reprocessing creates an isolated pendingReplacement sub-tree. Existing applications continue referencing the confirmed version until the user explicitly accepts the replacement.

## 
  
  
  Sanity Project Details

- Sanity Project ID: 3cdwvm16
- Dataset: production (and main_db)
- Studio Mount: Embedded at /studio
- Test Account: Free to create new accounts or use [alex@gmail.com](mailto:alex@gmail.com) /12345678

## 
  
  
  Key Schema Modeling

- cv: Modular professional record (personalInfo, summary, sections[], isPrimary, isTailored, ownerId).
- jobDescription: Structured job representation storing raw source text, requirement trees, nested alternative groupings, and pendingReplacement tracking.
- cvMatch: Deterministic match assessments holding verbatim quoted citations, gap counts, rubric scores, and distributed evaluation leases.
- application: Recruitment lifecycle tracker connecting confirmed JDs to tailored CV variants, cover letters, and recruitment stages (draft, applied, interviewing, offered, rejected).

## 
  
  
  Agent Session

The architecture and implementation were shaped through iterative prompt sessions covering specification drafting, test scaffolding, schema deployment, and security hardening.

To explore the architecture decision records, specs, and Agent Action designs, visit the /docs directory in the GitHub repository.
