AI-Powered ADU Permit Review for California

AI Agent Architecture for
ADU Permit Review

A builder friend got a 14-item corrections letter. His engineer took days to parse it. We built an AI agent that does it in 15 minutes.

Skills-first design. Multi-agent orchestration. Full-res construction plan processing. Built with Claude Opus 4.6 + Agent SDK.

28 reference files of CA law|4 specialized subagents|480+ cities supported
ADU architectural miniature

See it in action

Corrections analysis on a real Placentia ADU permit — 14 correction items parsed, verified, and responded to.

Duration: ~15 min Agent Turns: ~50 Cost: ~$3

Anatomy of a Corrections Flow

From PDF upload to professional response letter — four stages, three infrastructure layers, all orchestrated by Claude Opus 4.6.

1. PDF Pre-Processing

Cloud Run

Construction plans arrive as massive PDFs — 7,400px × 4,000px+ at full resolution. Cloud Run splits them into individual PNGs via pdftoppm + ImageMagick, archives them, and uploads to Supabase Storage.

Why Cloud Run: too heavy for the 4GB Vercel Sandbox. Keeps the sandbox pure AI.

2. Skill Loading

Vercel Sandbox

Skills are copied into the sandbox filesystem. The California ADU skill (28 reference files) uses a decision tree router to load only the 3-5 files relevant to each query — not dumped as one giant prompt. City research and corrections interpreter skills load alongside.

3. Agent Execution

Agent SDK + Opus 4.6

The lead agent reads the corrections letter via vision, parses each item, then launches subagents: code research (state law + city municipal code via web search) and plan page analysis (vision on specific PNGs). Rolling window of 3 concurrent subagents — as each completes, the next launches.

query({ prompt, options: { tools: { preset: 'claude_code' }, model: 'claude-opus-4-6' } })

4. Results Pipeline

Supabase Realtime

Outputs are read from the sandbox filesystem, uploaded to Supabase Storage, and written to the outputs table. Contractor questions feed into an interactive Q&A loop. Supabase Realtime pushes every status update to the frontend — no polling.

The Builder

Cameron gets a 14-item corrections letter from the City of Placentia. Each item cites specific code sections. His engineer takes days to parse and respond. CrossBeam does it in 15 minutes — reading plans via vision, cross-referencing state and city law, drafting a professional response with code citations.

The Mayor

Connor Trout, Mayor of Buena Park — a city of 80,000 with 4-5 building staff — needs to 10x permit throughput to meet state housing targets. They spend $250K+/year on outside consultants. The same AI that helps contractors respond to corrections can help cities generate them. Both sides of the same problem.

28 Files, Not One Prompt

The California ADU skill encodes the entire HCD ADU Handbook (54 pages of state law) as structured reference files. A 4-step decision tree router loads only the 3-5 files relevant to each query.

Decision tree, not keyword search. The router classifies each question through 4 steps: lot type → construction type → situational modifiers → process/fees. Each step maps to specific reference files.

Selective loading. A question about setbacks on a single-family lot loads 3 files. A question about fire sprinklers in a coastal zone loads 2 different files. The agent never sees all 28 at once — just what's relevant.

Authoritative source. HCD ADU Handbook (Jan 2025) + 2026 Addendum. Government Code §§ 66310-66342. Current through January 1, 2026.

Height: 16-25 ft by type
Size: 850-1,200 sq ft
Setbacks: 4 ft max side/rear
Parking: max 1, 6 exemptions
california-adu/
├── SKILL.md            ← Decision tree router
├── references/
│   ├── unit-types-*     (4 files)
│   ├── standards-*      (7 files)
│   │   ├── height, size, setbacks
│   │   ├── parking, fire, solar
│   │   └── design
│   ├── zoning-*         (3 files)
│   ├── ownership-*      (3 files)
│   ├── permit-*         (3 files)
│   ├── special-*        (2 files)
│   ├── compliance-*     (4 files)
│   ├── glossary.md
│   └── legislative-changes.md
└── 28 files total

One Page Per Subagent

Construction plan PDFs are 15-26 pages of dense CAD drawings, watermarks, stamps, and tiny annotations. Processing them required solving a real constraint in the Claude API.

The Problem

Multi-page batches accumulate images in the conversation context. Claude's API limits: >20 images caps each at 2,000px. Full-res plans are 7,400px wide — forced downscaling destroys the detail that matters for permit review.

The Solution

One page per subagent. Each gets exactly 1 full-res PNG — no image accumulation, no forced resize. Rolling window: 3 concurrent subagents, new one launches as each completes.

The Pivot: Targeted Viewing

95% accuracy with exhaustive extraction took 35 minutes per binder. Targeted viewing — read corrections first, then look at only the relevant pages — drops it to 10-15 minutes. Time pressure during the hackathon forced a fundamentally better architecture: figure out what matters first, then go look for it.

480 Cities, 3 Research Modes

California law requires every city to publish ADU regulations online. The information always exists — the skill finds it across 480+ different city website architectures.

~30 sec

Discovery

WebSearch finds key URLs: ADU page, municipal code platform (ecode360, Municode, QCode), standard detail PDFs, information bulletins.

~60-90 sec

Targeted Extraction

WebFetch pulls specific content from discovered URLs — ordinance text, standard detail requirements, submittal checklists.

~2-3 min

Browser Fallback

Chrome MCP for cities with difficult websites (e.g., ecode360 law database requires actual click navigation). Only used when Modes 1-2 have gaps.

Why Three Layers

Agent runs take 10-30 minutes. That single constraint shaped the entire infrastructure.

Next.js on Vercel

Frontend + API routes. Dual auth: Supabase sessions for browser users, Bearer tokens for agent API access.

Cloud Run (GCP)

Persistent orchestrator process. Serverless functions timeout at 60-300s — useless for 10-30 min agent runs. Also handles PDF pre-processing (pdftoppm + ImageMagick need system packages).

Vercel Sandbox

Isolated, ephemeral execution environment. Agent SDK needs filesystem access (claude_code preset). Detached mode for connection resilience — GCP's load balancer kills idle connections at ~5 min.

Supabase

Realtime subscriptions push agent status to the frontend without polling. Storage for uploaded plans and generated outputs. Postgres for projects, messages, outputs, and contractor answers.

What the Agent Produces

Real output from a Placentia ADU corrections flow — 14 items analyzed, categorized, and responded to.

Corrections Analysis

Each item categorized: 5 auto-fixable, 2 need contractor input, 6 need professional engineer. Code references verified against state and city law.

Contractor Questions

Structured questions for on-site data: “What is the size of the existing waste/sewer line?” with CPC Table 702.1 context and why the agent needs it.

Response Letter

Professional tone. Item-by-item responses with sheet references. Code citations (CPC, CRC, ASCE 7-16). Technical justifications: sewer capacity calc, wind load calcs, drainage slopes.

429,503

ADU permits in CA since 2018

90%+

require corrections on first submission

$250M+

VC invested in permit tech

$30,000

cost of a 6-month permit delay

Where It Stands

Working

  • Skills architecture (28 reference files)
  • Corrections analysis pipeline
  • Response letter with code citations
  • Multi-agent PDF extraction
  • City code research (3-mode)
  • Cloud Run + Vercel Sandbox deployment
  • API key auth (dual: Bearer + session)

In Progress

  • Cloud deployment stability (detached mode solved 5-min timeout)
  • City-side review flow UI polish
  • Processing time optimization (35 → 15 min via targeted viewing)

Roadmap

  • PDF plan redrawing (7,400px plans need larger sandbox)
  • Per-user API keys + multi-tenant
  • Scale city research to 480+ cities
  • Contractor mobile experience