How raja-jaloka/veriaudit- works
Purpose and Entry Points
VeriAudit is a local full-stack document-intelligence system that audits text against compliance rules, extracts grounded facts, synthesizes domain rules, and rejects prompt injection. The backend FastAPI application starts at backend/main.py; the Vite/React workbench starts at frontend/src/main.tsx and mounts frontend/src/App.tsx. Batch verification enters through run_evals.py.
API Orchestration Boundary
backend/main.py is the server-facing boundary for audit, ad-hoc rule prompting, rule synthesis, entity extraction, and file upload APIs. It accepts document text or uploaded files, invokes deterministic engine stages, and returns typed response payloads defined in backend/models/schemas.py. The frontend consumes this API rather than embedding audit logic locally.
Document Ingestion and Canonical Text
Uploaded source files are converted into a canonical document-text buffer before analysis. backend/ingestion/file_parser.py handles supported document formats; backend/ingestion/cleaner.py normalizes content; backend/ingestion/chunker.py prepares analysis-sized text segments. Character-position fidelity at this boundary is architecturally critical because downstream citations refer back to the original text buffer.
Grounded Audit Pipeline
The audit path evaluates selected or supplied rules against document text. Rule packs originate in backend/rules/presets.py; backend/engine/audit_agent.py coordinates verification. backend/engine/grounding_validator.py validates affirmative and counter-evidence as exact document substrings and character offsets, establishing the no-unsupported-claim boundary. backend/engine/hallucination_guard.py screens adversarial or injection-style instructions before they can alter rule interpretation.
Rules and Ad-Hoc Queries
Rules can be loaded from presets, dynamically generated, or derived from a user question. backend/engine/rule_synthesizer.py classifies document vocabulary/domain and creates tailored rule candidates. The same API orchestration in backend/main.py exposes natural-language prompt rules, translating a question into a form evaluated by the grounded audit path rather than returning an unconstrained model-style answer.
Fact Extraction and Confidence
backend/engine/extractor.py identifies structured entities and contextual occurrences across domains, including repeated mentions that may be consolidated into canonical records. backend/engine/confidence_engine.py computes evidence-based confidence from grounding, salience, multiplicity, authority, and penalties. These outputs augment audit reports but remain subordinate to substring validation.
UI Workbench
The React UI is an operator surface for supplying documents, selecting/managing rules, running audits and benchmarks, and inspecting/exporting evidence. frontend/src/components/ImportDocumentModal.tsx manages intake; frontend/src/components/AdHocPrompter.tsx drives query-based audits; frontend/src/components/AuditReportView.tsx presents verdicts and citations. frontend/src/components/SplitPaneDocumentViewer.tsx is the key evidence-review boundary between source text and results.
Evaluation and Runtime
Python 3.10+ runs FastAPI/Uvicorn; Node 18+ runs the Vite frontend. The evaluation harness in backend/evaluator/runner.py and backend/evaluator/benchmark_suite.py executes fixed benchmark scenarios, with run_evals.py as its root launcher. The repository indicates no database, queue, cloud runtime, or external AI service dependency; analysis is organized as in-process Python engine modules.
Components 21
Backend
In-process FastAPI document-analysis system.
- FastAPI API · Serves audit, rules, extraction, synthesis, and upload endpoints.
backend/main.py - Typed payloads
backend/models/schemas.py - File parser · Converts supported uploads to document text.
backend/ingestion/file_parser.py - Text cleaner · Normalizes canonical document text.
backend/ingestion/cleaner.py - Text chunker · Prepares analysis-sized segments while preserving text fidelity.
backend/ingestion/chunker.py - Rule presets
backend/rules/presets.py - Rule synthesizer · Creates domain-tailored rule candidates.
backend/engine/rule_synthesizer.py - Injection guard · Rejects adversarial instructions that could alter rule interpretation.
backend/engine/hallucination_guard.py - Audit agent · Evaluates selected, synthesized, or prompt-derived rules.
backend/engine/audit_agent.py - Grounding validator · Requires evidence and offsets to match exact document substrings.
backend/engine/grounding_validator.py - Entity extractor · Finds and consolidates contextual structured entities.
backend/engine/extractor.py - Confidence engine · Scores grounded facts using salience, multiplicity, authority, and penalties.
backend/engine/confidence_engine.py
React Workbench
Operator-facing Vite application.
- Vite entry
frontend/src/main.tsx - Workbench app · Coordinates document, rule, audit, and benchmark workflows.
frontend/src/App.tsx - Document import
frontend/src/components/ImportDocumentModal.tsx - Ad-hoc prompter
frontend/src/components/AdHocPrompter.tsx - Audit report · Displays verdicts and citations.
frontend/src/components/AuditReportView.tsx - Evidence viewer · Connects source text with audit results.
frontend/src/components/SplitPaneDocumentViewer.tsx
Evaluation
Fixed benchmark execution path.
- Evaluation launcher
run_evals.py - Evaluation runner
backend/evaluator/runner.py - Benchmark suite
backend/evaluator/benchmark_suite.py
Connections 24
- Vite entry → Workbench app: mounts
- Workbench app → Document import: intake
- Workbench app → Ad-hoc prompter: query audits
- Workbench app → Audit report: shows results
- Audit report → Evidence viewer: reviews citations
- Workbench app → FastAPI API: API requests
- FastAPI API → Typed payloads: typed responses
- FastAPI API → File parser: uploads
- File parser → Text cleaner: parsed text
- Text cleaner → Text chunker: canonical text
- FastAPI API → Rule presets: loads rules
- FastAPI API → Rule synthesizer: synthesizes rules
- FastAPI API → Audit agent: runs audit
- Text chunker → Audit agent: document segments
- Rule presets → Audit agent: selected rules
- Rule synthesizer → Audit agent: candidate rules
- Injection guard → Audit agent: safe rule interpretation
- Audit agent → Grounding validator: validates evidence
- Audit agent → Entity extractor: extracts facts
- Entity extractor → Confidence engine: grounded occurrences
- Grounding validator → Confidence engine: validated evidence
- Evaluation launcher → Evaluation runner: starts
- Evaluation runner → Benchmark suite: executes scenarios
- Evaluation runner → Audit agent: verifies pipeline