PolicySmith AI – Natural Language to Executable Policy Engine

PolicySmith AI is a high-performance system designed to bridge the gap between human-readable legal documents and executable technical logic. It transforms ambiguous natural language policies into strict, machine-readable JSON rule sets.

Inspiration

The idea for PolicySmith AI came from a common friction point in enterprise environments: the policy-to-code gap. Compliance teams write long, ambiguous documents, and engineers struggle to translate them into code. This leads to misinterpretation, compliance drift, and manual audit bottlenecks. The goal was to build a reasoning engine that acts as a translator, turning legal language into precise, executable logic.

What it does

PolicySmith AI uses Gemini 3’s advanced reasoning capabilities to:

  • Analyze policy architecture by ingesting large documents and extracting titles, scopes, and rule sets
  • Deconstruct logic by identifying conditions, exceptions, and consequences for each clause
  • Audit for risk by flagging ambiguous language such as “should” or “reasonable” and detecting logical conflicts between sections
  • Provide a compliance lab where users can test real-world scenarios against extracted rules
  • Deliver explainable results by mapping compliance decisions back to specific policy identifiers

How we built it

  • AI Core: Gemini 3 Flash optimized for speed and quota efficiency, with deterministic JSON schema enforcement
  • Frontend: A React 19 interface using Tailwind CSS, featuring dashboards for rule visualization and a sandbox for scenario testing
  • Architecture: A custom service layer with retry logic and exponential backoff to support high-volume reasoning tasks
  • Deployment: ES6 modules and Import Maps enabling a zero-build, high-performance deployment suitable for Vercel or Netlify

Challenges we ran into

  • Schema enforcement: Ensuring the AI consistently produced strict JSON while reasoning over complex legal text required carefully designed system instructions
  • Logical conflict detection: Identifying contradictions across distant sections of a document required multi-pass, long-context reasoning
  • Quota management: Large policy documents pushed API limits, leading to the creation of a reusable retry and batching utility

Accomplishments we’re proud of

  • Converting ambiguous policy paragraphs into a clean, machine-readable rule tree
  • Building a functional compliance lab that mirrors human-style legal reasoning
  • Delivering a polished, enterprise-grade interface suitable for real-world compliance teams

What we learned

  • How to leverage Gemini 3 thinking budgets differently for extraction versus auditing tasks
  • How to design text-first systems that remain ready for multimodal expansion
  • Why explainability is essential when AI systems support legal and compliance decisions

What’s next for PolicySmith

  • Policy versioning to track logical changes across document revisions
  • CI/CD integration via a CLI tool to test code changes against policy logic
  • Multi-document synthesis to compare internal policies with external regulations such as GDPR or HIPAA

Free Deployment (Vercel)

  1. Push the code to GitHub
  2. Connect the repository to Vercel
  3. Add API_KEY to environment variables
  4. Deploy

Built With

  • and-strict-json-schema-enforcement.-*-platform-&-hosting:-vercel-deployed-on-a-global-edge-network-to-ensure-high-availability-and-low-latency-access.-*-architecture:-no-build-architecture-based-on-es6-modules
  • backoff
  • css
  • enabling-high-speed-reasoning
  • es6
  • exponential
  • flash
  • gemini
  • gemini-3-flash-preview)
  • google
  • google/genai
  • import
  • json
  • leveraging-browser-native-import-maps-for-zero-latency-dependency-loading.-*-logic-enforcement:-deterministic-outputs-ensured-through-strict-json-schema-definitions
  • maps
  • modules
  • multimodal-readiness
  • react
  • retry
  • schema
  • tailwind
  • utility-first-styling.-*-ai-engine:-google-gemini-3-flash-(gemini-3-flash-preview)-accessed-via-the-@google/genai-sdk
  • vercel
Share this project:

Updates