Skip to content
Maxwell CollinsContact

A community campaign that won its zoning fight

An AI-run campaign system for a neighbourhood's zoning appeal: public site, sign-ups, and a gate that blocks uncited claims.

What it achieved

3–1board vote reversing the approval the neighbours appealed

Helped neighbours win their zoning fight: the board voted 3-1 to reverse the approval they appealed.

The short version

This campaign system helped neighbours win their zoning fight: the board voted 3-1 to reverse the approval they had appealed. Maxwell built it to run the campaign with AI. It has a 12-page public site with sign-up, contact and volunteer forms, and a database whose consent record can't be altered. The campaign's non-technical leaders read every sign-up in a Notion workspace. A gate of machine checks refuses any public claim without a cited source. Behind it sits an evidence archive of 31 town filings and the applicant's own videos. It carried the campaign through the win, then a second proceeding.

The problem

In a legal dispute where opposing lawyers read every word, one invented figure ends the campaign, and an AI will treat its own summaries as fact. The outcome is decided by ordinary neighbours, so evidence nobody can absorb is worth nothing. The people running the campaign are board members and lawyers who will never open a database.

In use

  1. The AI read every town filing, including scans it had to read page by page as images, and the town's own recording of the hearing.
  2. Each claim on the site carries a citation to a filing page or a moment in the applicant's video, 81 in all, and a check blocks any claim without one.
  3. A neighbour reads the case in the order they need it (see it, understand it, believe it, act) and signs up.
  4. The sign-up lands in the leaders' Notion workspace with its consent, and a confirmation email goes out.
  5. On hearing morning, a reminder written by the campaign's attorney reached every person on the sign-up list.

What it achieved

  • Won. The zoning board voted 3-1 to reverse the approval the residents had appealed, so the proposed use cannot go ahead.
  • Everyone on the sign-up list got the hearing-morning reminder written by the campaign's attorney, delivered with no retries.
  • The campaign gained its first way to reach neighbours twice, with every sign-up, contact and volunteer landing in a workspace its non-technical leaders read.
  • No claim went public without a source, in a dispute where opposing lawyers read every word: each carries one of 81 citations to 31 town filings or the applicant's own videos, and a check blocks any claim without one.
  • The same platform then carried a second proceeding, with its own sign-up list.

The full record

On this page
In one sentence

Maxwell built an AI-run campaign system, the community campaign: a 12-page public site with sign-up, contact and volunteer forms, a database whose consent record cannot be altered, a Notion workspace the campaign's non-technical leaders read, and a gate of machine checks that refuses any public claim without a cited source, in 9,307 lines of application code in 61 files, 2,228 lines of tests in 21 files (115 test cases) and 93 commits, with an evidence archive of 31 town filings and the applicant's own videos behind it; residents turned out for the zoning hearing, and the board voted 3-1 to reverse the approval: the campaign won. He builds by directing AI agents, and this is what that direction produced.

lines of code
9,307
cited claims
81
public pages
12
zoning reversal
Won
  1. 1Read every filing
  2. 2Cite every claim
  3. 3Public site
  4. 4Sign-up and consent
  5. 5Hearing-day reminder
  6. 6Won

What it does

The size of the whole

The main repository counts 9,307 lines of application code in 61 files and 2,228 lines of tests in 21 files, with 115 written test cases, 12 public pages, 3 form endpoints, 5 database tables (6 table names counting the outbox's rebuild copy, and 8 table-creating statements across the 6 database changes), 6 database changes, 93 commits, and 8,276 lines of Markdown and YAML in its written record (the brief, the registry of citations, the evidence analysis, the status record, the build records). A tracker repository adds 4,175 lines in 18 files and 2 commits. A first repository adds about 3,500 lines of code (site 1,464; tools 826; gate 1,252) and 10 commits. The wireframe folder adds 1,630 lines. Every count is a floor.

The public site (site/src/pages, 12 pages, built in Astro and served from a Cloudflare Worker).

  • The home page, the campaign's argument in the order a neighbour needs it: see it, understand it, believe it, act. It carries the RSVP form, receipt cards that set what the applicant told the town beside what it told its own donors, a process story, a short FAQ and a closing banner.
  • why-oppose, the plain-language case. evidence, the applicant's own title cards and quotes shown as images with their citations. the-appeal, the appellants' 33-page memorandum walked through in 13 parts. documents, a library of 17 published filings and letters. how-you-can-help, the volunteer page, with a sample letter neighbours can download. volunteer, the sign-up for roles. flyer, a printable flyer that prints correctly in print mode. thanks, privacy and terms. second-appeal, the 487-line page for the second proceeding, with the filed site plan's figures read off a 300-dpi render and its own argument.
  • The public site for two proceedings, with sign-up, contact and volunteer forms that work on any phone, plus a printed flyer and a text message drawn from the same cited words (the campaign kit copy, 165 lines).
  • A hearing banner on every page with a countdown, a universal share panel (a share button that never fails silently), calendar files (.ics) for both hearings, structured data for search engines, a sitemap, a robots file, favicons, a share card, and a campaign GoFundMe kit and slot.
  • Design: built from a captured reference (a news site's standard article template, recorded at nine layers: computed styles, interaction states, components), with a recorded token swap, a design-audit test pinned to the reference's measured values, Source Serif 4 and Public Sans served from the site itself, and a hero photo served as a 132 KB static image instead of 1.44 MB.

The forms and the database (site/src/core, site/migrations).

  • Three forms, RSVP, contact and volunteer, each with a server-side spam check that rejects on any doubt, a hidden honeypot field that looks like any other, a flood dampener that is deliberately generous in hearing week, and a submit guard against double-sends.
  • The RSVP collects name, phone and email with a separate, unticked text-message consent box, following the client's recorded decisions. The wording the person agreed to is stored with every sign-up.
  • A database of 5 tables: RSVPs, consent events, contacts, volunteers and the outbox. The consent record is append-only by trigger: the database itself aborts any update or delete of a consent event, so the legal record is protected by the schema and not by anyone's promise. It has no link to the RSVP row, so removing a person from the list never erases the history of what they agreed to.
  • An RSVP, its consent event and its outbox job are written together in one atomic step, so a failure leaves nothing half-recorded.
  • The RSVP is an upsert keyed on email (case-insensitive) and campaign: a repeat sign-up updates the row, and consent only ever ratchets up (the larger of the old and new value), so a second visit can never silently withdraw a recorded consent. Phone numbers are accepted with or without dashes and normalised to the +1 form. Text consent without a phone number is refused both in the form parsing and by a CHECK rule in the database, so the rule has two homes.
  • A bot that trips the honeypot receives the identical success page a real neighbour does and nothing is written, so a bot cannot tell detection from success. The thank-you page shows the running sign-up count for that campaign only, and a sign-up for another campaign is never told about this one's hearing.
  • The text-message disclosure is machine-graded in the browser suite: every input has a visible label, the consent boxes start unticked, and the four required disclosure strings (message frequency varies, message and data rates may apply, text STOP to cancel, HELP for help) must render visibly at full size and contrast.

The outbox and its connections (outbox.ts, notion.ts, email.ts, worker.ts).

  • Every sign-up becomes a job in an outbox that a cron drains every minute: batches of 25, a counter of attempts on each job, a breaker that stops a job after 8 failures while keeping it visible, and an idempotency key on each send so a retry after a crash never duplicates a card or an email. The outbox query excludes tripped jobs, so old failures can never crowd out new neighbours' emails.
  • The Notion window (the shared-list boundary). The platform writes each RSVP, contact and volunteer into the campaign's own Notion workspace, "Campaign Data", through an integration that can only add rows. The consent text and time land in the same row. A second database holds the second proceeding's list, and a creator script (148 lines) built it. A builder script (209 lines) makes the overview page with a big total-RSVPs counter and a newest-first gallery for any campaign, after Maxwell's agents found that Notion's own dashboard type would not render on his plan.
  • A scheduled Worker task (the cron) runs the drain on Cloudflare every minute. It logs a visible "skipped" event until the Notion secrets exist, so an unconfigured site keeps taking RSVPs into the database either way: Notion being down never means data lost. An unconfigured email sender throws, so the job retries and shows its reason in the job's last-error field instead of being marked sent. Contact-form messages are forwarded by email to the campaign inbox so nobody has to poll the Notion mirror.
  • Four kinds of email through Resend: RSVP confirmation, contact notification, volunteer notification and the hearing reminder, in a branded shell translated into email-safe markup. A hearing-morning reminder written by the campaign's attorney went to the whole RSVP list as one outbox job per recipient, delivered to every person on the list with no retries, and a permanent test refuses any reminder that carries the wrong arrival time.

Two campaigns on one platform (campaigns.ts, migrations 0005 and 0006).

  • A registry of campaigns. Every RSVP, consent event, Notion card and confirmation email is stamped with its campaign, and the two lists never mix: a neighbour can sign up for each proceeding and appears once in each. Adding a campaign is one registry row, one Notion database id and one page.
  • Fail-closed routing. An RSVP for a campaign whose Notion database is not configured throws and retries; it never falls back onto the other campaign's list. This was observed on a real sign-up: the first RSVP arrived before its database secret existed, retried four times, and synced the moment the secret landed.
  • The change was shipped in two steps on purpose. Migration 0005 only adds, so the old code keeps working; the new code deploys; migration 0006 then drops the old rule. A test holds the database in the in-between state and proves both code versions work there.
  • The wrangler migration set, in order: 0001 initial schema, 0002 email job kinds, 0003 volunteers, 0004 hearing reminder, 0005 campaigns, 0006 drop the old email-only unique rule. SQLite cannot alter a CHECK rule, so 0002, 0003 and 0004 rebuild the outbox table and copy the data across. A migration-order test file exists so that merging 0005 and 0006 back together "for tidiness" turns the build red.
  • A staging site with its own database, no routes, no cron and a noindex tag, where the owner approves a page before it goes out.

The security and delivery setup.

  • The spam check is Cloudflare Turnstile, verified on the server and failing closed: a missing token, a network error or a refusal all reject. It checks the token was issued for one of the campaign's own hosts (a replay of a token minted for another site is rejected) and deliberately sends no visitor IP, because phone visitors on a private relay or switching from Wi-Fi to cellular can legitimately present two addresses. The check reads the refusal reason out of the response body, and a header lets the smoke check tell a bad visitor token from a broken secret.
  • A flood dampener in a key-value store: 30 submits an hour per address and 6 a day per identity on each form, run after the spam check so bots spend no budget, set well above any household pattern because hearing week is the biggest sign-up week, and failing open on any storage error so a hiccup never costs a real RSVP.
  • HTTPS forced in code and at the edge, with a smoke check that proves it. Security headers (a content-security policy, HSTS, no-framing, no-sniffing) set on the Worker's own pages as well as on static files. A private link for the campaign's attorneys. Hostname and token checks on the spam widget. Secrets held as Worker secrets and named in a config file.
  • Every piece of infrastructure is declared in one config file: the Worker, its D1 database, a key-value store, an image binding, the minute cron, the two custom domains (apex and www), observability, and the private workers.dev link marked noindex both in the Worker and in a host-scoped header rule, because the static-asset layer answers before the Worker runs. The security-header policy lives in two places that a comment and the browser suite keep in step.
  • Three deploy paths: production (build with the real spam-check key, deploy, then run the production smoke check), a preview version upload, and an experiment deploy. The experiment config is derived by make-experiment-config.mjs, which refuses to write anything unless the review Worker has a different name, no routes, no cron and its own database, because a review copy sharing the live database would have broken the live RSVP form the moment migration 0005 touched it.
  • The sitekey is baked in at build time by the deploy script alone and is not a runtime variable, so the testing sitekey can never reach production.

The evidence archive (31 filings, 2 videos). See "Taking in the record" below; the archive is the software's data as much as the site is.

The gate (tools-gate/, ops/checks/). One command whose exit code is "done", described in the method section below, plus a set of instruments that measure what a visitor can actually see.

The command-center wireframes. Three passes of a campaign command center for about ten civic board members who barely use software: pass 1 structure only, pass 2 their words and order, pass 3 the typesetting, built from the Notion export by three scripts (1,100 lines) into three pages, each with a stated list of what it cannot see.

The tracker. An issue tracker with two issue forms, one for findings and one for decisions, a 156-line workflow of gates that read their required fields out of the form itself, and the working evidence of the audit (4,175 lines in all).

Taking in the record

  • The AI went online and captured the applicant's own videos at full quality, with their captions, their full published descriptions, their thumbnails and a frame for every caption (167 frames counted from the captions; 224 frame images on disk, 135 from the facility tour and 89 from the donor video, both videos in 4K at 3840 by 2160, about 316 MB, with the captions burned into the picture so each frame carries its quote and its room together). The evidence folder holds 458 MB. Each file was fingerprinted and a copy was lodged with the public web archive. One video's address stopped working the same day it was captured, so the campaign's strongest evidence exists because it was taken in first. The originals were later copied to cloud storage and their fingerprints checked again.
  • 31 town filings were taken in and read. Eight were scans with no searchable text, so the AI rendered each page and read it by eye.
  • Reading the video's published description surfaced the applicant's own written words "wedding hall", which the attorneys' exhibits did not have.
  • The Town's own recording of the hearing was read at the source.
  • 17 of the documents are published in a library on the site, with personal names stripped from the file properties, and every claim on the site points to a page in one of them.
  • The contradiction analysis (evidence/THE-CONTRADICTION.md, 215 lines in 8 sections) sets the applicant's filing beside its own donor video, its facility-tour video, its fundraising flyer and its own site plan, every cell cited, and a chronology.
  • A registry of 81 citations (C-01 to C-81), each tracing to a Town filing with a page number or a video with a time.

What grew out of it

He turned this campaign into a repeatable service, CommunityWatch, which has its own page (CommunityWatch).

What it achieved

  • The campaign won. The zoning board voted 3-1 to reverse the approval the neighbours had appealed: the proposed use cannot go ahead.

  • The campaign's Notion workspace was exported to the repository as three databases (RSVPs, contact messages, volunteers), with a launch handoff and a 232-line status record beside it.

  • Every sign-up, contact and volunteer landed in the leaders' workspace, giving the campaign its first way to reach neighbours twice.

  • The same platform then carried a second proceeding.

  • He ran all of it remotely, from another state.

  • A hearing-morning reminder delivered to every person on the sign-up list.

  • The site went into production the day the build started, with 40 commits that first day.

The problem it solves

  • An AI produces more of its own summaries than anything else, and it will treat a summary as fact. In a legal dispute where opposing lawyers read every word, one invented figure ends the campaign.
  • The outcome is decided by ordinary neighbours, so evidence nobody can absorb is worth nothing.
  • The people running the campaign are board members and lawyers who will never open a database.
  • An AI that writes itself a specification and obeys it can build a check that blocks true figures. He turned that danger into the rules below.
  • A status document can say an item is closed while it is open. He built instruments that measure what a visitor sees, each stating what it cannot see.
  • Anonymity leaks in boring places: an HTML comment visible in View Source, and an author name in a Word file's properties. He made both machine-checked.
  • The applicant has published both numbers, 120 and 200. The finding is the gap between them, not an accusation, so the campaign carries both and never smooths either.

How he built it

  • The authority order. Five ranks of what an AI may treat as true: his word, the client's recorded words, the original filings and videos, the standing brief, and last, as hearsay, anything an AI wrote, its own summaries included. When a summary and a source disagree, the source wins and the summary is fixed.
  • Cite or don't publish: the truth ledger. Every published claim carries a number pointing to a page of a Town filing or a time in the applicant's own video (81 citations). The campaign's words are written with the source attached to each factual sentence. A check blocks any unsourced claim, and that check is itself tested on broken input.
  • The cite-gate. It reads the built HTML, requires every claim-shaped sentence to sit under a citation, requires every citation id to exist in the registry, and refuses any flagged for verification. It enforces traceability only and has no opinion about whether a figure is true. A bijection contract proves it: a known-bad fixture must fail and a clean one must pass.
  • The AI campaign manager, and "Pat is the gate". The AI works as the campaign's professional. Its job is to turn the evidence into what a 62-year-old neighbour, standing outside with her phone, can take in at once: what, where, when, and what she is asked to do. Nothing counts as done until she can.
  • The substitution test. Every public sentence must read the same whoever the applicant is, so the case is argued only from the record.
  • There is no spec. No AI may write a specification and then obey it. The work starts from a conversation with him.
  • AI cannot grade itself. An agent cannot confirm its own finding or approve its own fix; the tracker refuses it. Nine independent reviewers judged the findings. The audit used seven fresh-context agents, none shown the others' work: three extractors, a conformance reviewer, a craft reviewer against his standards, and an evidence officer who asked only whether each completion claim's instrument could have failed. A refutation counts as much as a confirmation.
  • The judgment gate. Three questions answered in writing before any measurement: what artifact is under judgment, against which yardsticks (conformance and craft), and what result would make it fail.
  • Decisions stay with their owners. Case facts, legal strategy, money and the family's exposure go to the family or the attorney, with the cost of each answer set out. The tracker has a separate decision form for them.
  • The gate (tools-gate/run-gate.mjs). One command, and its exit code is "done". It runs type checks, lint, format, a secret scan, the tests inside the real Workers runtime, a duplication check, a dependency advisory check, the build, the cite-gate and its contract, the render-integrity check, the anonymity check, a production smoke check, and a browser suite in three engines with accessibility, headers, banner, share and end-to-end form tests that go through the spam check to the database. A check that ran nothing exits non-zero by design: three states, pass, fail and nothing ran.
  • What the gate runs in two speeds. A fast slice for before a commit (strict TypeScript, eslint, prettier, gitleaks secret scan) and the full run, with a duplication ceiling of 3 percent (jscpd), a dependency check that queries npm's replacement advisory endpoint directly after npm retired the old one and pnpm had no fix, and a build that uses the testing sitekey so the browser suite can solve the spam check. Commit messages are held to conventional-commit rules by commitlint.
  • The browser suite (site/e2e). Eight spec files in three engines: form behaviour, accessibility by axe, the security headers, the hearing banner, the share panel, rendered-page integrity, and a design audit pinned to values measured from the captured reference (138 lines of recorded values).
  • The anonymity gate. The site is anonymous by the client's decision. A check fails the build on any HTML comment, any family name in the built pages, and any such name in a published document's text or metadata (PDF and Word files).
  • The render-integrity gate. It reads the built pages and fails on any word the compiler glued to an inline tag.
  • The production smoke check. Proves HTTPS redirects and that the spam-check secret is valid.
  • The instruments (ops/checks). A stale-date scan that renders all pages at phone width and tags every mention as visible or hidden, a check that separates a sentence that instructs from one that narrates, and a print-mode render. Each states what it measures, what it cannot see (five named blind spots) and the command that makes it fail, and each was observed failing.
  • Ten Gate Laws, from his standards folder: an unwired machine check is a failure, an empty result never passes, and a gate ships a must-block and a must-allow.
  • House rules. Never delete anything in evidence/ or client/ in an active proceeding; scrub file metadata before publishing a client-supplied file; show Maxwell the running site on his own machine; work only on tasks that can be done remotely; decide the technical matters and escalate only the family's.
  • The issue protocol. Findings are tracker issues, not markdown files, so each has a state, an identity, a search and a link to the fix. A finding is read by claim and not by reasoning, so a wrong frame is not inherited. Citations are by symbol and never by line number.
  • The design record. REPLICATION-MAP.md and four build records (tokens and shell, index sections, email templates, mockup adoption) record every swap from the reference. The campaign accent, a deep civic red, replaced the reference's coral for urgency surfaces after adversary review with the neighbour as the buyer, and email templates inline every token because email clients cannot read style variables or load the site's fonts.
  • Design by replication. Visual execution is copied from a captured real reference, never authored from a prose brief, so an AI cannot emit the generic layout; the brief governs brand, copy and audience. A deviation needs a dated record or does not ship.
  • Review before anything goes out. Four adversary reviews were applied; a staging site gives the owner a place to approve; production was touched only on his word.
  • Reaching a non-technical person. The Notion workspace, the overview counter, the command-center wireframes written for readers around 70, and reminder text sent verbatim from the attorney.

Named concepts

The named concepts, defined

The authority order · Cite or don't publish · Pat is the gate · The substitution test · There is no spec · The shared-list boundary · The contradiction analysis · The truth ledger · The gate · The judgment gate · The issue protocol

What it shows

He can put AI to work where being wrong has legal consequences, and make its output usable by people with no technical background.