Counts here come from the files that define them
Built for
the record.
A source-grounded corpus, a Postgres data plane with full-text and semantic retrieval, and a chronicler that cites the file behind every claim. Ingest, analyze, recall, operate.
This page, one line per chapter
- 1One canon, two lanes. Flat-file canon with a Postgres projection; the public lane carries aggregates only.
- 2Every claim anchored. Each answer cites its artifact ID and source path, with a line range where required.
- 3Co-occurrence, measured. The ten demonstration labels, every pair scored by Jaccard similarity.
- 4Three checks, one queue. Three required checks and a squash-only merge queue guard every change to main.
- 5Six services, one plane. Each service deploys as a scanned, leased, zero-traffic candidate; rollback is held until production probes pass.
- 6The production bar. Every pillar pinned to a file or a gate in the repository.
One canon, two lanes. Canon in the repository: aggregates go public, the full record to Postgres.
The canon is flat files: one Markdown manifest indexes every artifact by ID, type, date, person and pattern, beside codices that keep identity, chronology and numbering from drifting. Gated tracked indexes are checked against it on each merge; corpus cross-reference freshness is advisory.
The public lane builds an aggregate snapshot, counts and neutral labels only, served by this site and the corpus API. An export guard checks the bundle against the public contract before the image is built, and fails the build on anything outside it.
The private lane rebuilds a queryable projection in Neon Postgres on merge: full source text, full-text search, and embeddings for semantic retrieval. Shelby’s memory lives there too, shared by the cockpit and Telegram.
Inside the data plane
- Corpus projection
- One row per manifest artifact, full source bodies, and the pattern taxonomy, all full-text indexed.
- Semantic layer
- Every canonical text file, chunked, with 1536-dimension embeddings under an HNSW cosine index.
- Memory
- Threads, messages, and durable per-operator memory, distilled in the background. Cockpit and Telegram read one memory.
- Access
- Row-level security, default-deny for generic roles, a read-only query role, and an idempotent, schema-versioned migrator.
PostgreSQL 17 · pgvector · HNSW cosine · numbered migrations
Every claim anchored. Each claim Shelby makes carries the file it came from.
Shelby does not summarize from memory. He walks the record artifact by artifact, and every factual claim is bound to a manifest ID and a repository source path, with a line range where required. Against the live corpus, the anchors open the source at the cited line.
Both surfaces call Anthropic’s Claude directly from Cloud Run and read one model pin; memory persists in Postgres, so the cockpit and Telegram answer as one chronicler. The full demo exchange lives on the landing page.
How a sidecar reads
The sources behind those anchors are transcribed verbatim, in two tiers.
- Searchable floor
- Machine text, so the page can be found.
- render at 300 dpi or more
- full-page raster OCR
- searchable sidecar
- Gold
- The screen record: every word, marker, and reaction.
- render at 500 dpi or more
- vision pass
- machine reaffirmation
- gold sidecar
Speaker B @ 09:16 > [quoted: Speaker A @ 09:14] > Can you send the exhibit list before the call? Sent. Two attachments below. [IMAGE: exhibit list, page 1 of 3, four-column table] [reaction: thumbs up · Speaker A]
Co-occurrence, measured. Shared over combined artifacts, for the ten labels in the public snapshot.
Strongest pairs
- Motion Posture Witness SequencingJaccard 0.27
- Calendar Control Billing HygieneJaccard 0.23
- Witness Sequencing Billing HygieneJaccard 0.23
- Exhibit Chain Service of ProcessJaccard 0.17
- Calendar Control Deadline CadenceJaccard 0.16
Three checks, one queue. Every change clears three required checks, then a squash-only queue.
The three checks, and the rules behind them
verify- Lint, types, builds, tests, and the corpus suite: ruff, mypy, yamllint, stylelint, shellcheck, actionlint, zizmor; the public app, the cockpit, and the command worker built and tested; per-route bundle budgets; then manifest consistency, the ontology, freshness of gated tracked indexes, content-hash stamps, and identity and rendering audits. Corpus cross-reference freshness is advisory in ordinary verification.
protected code/config scan- Secret scanning on code and configuration, on every pull request and every queue entry. An advisory scan runs over the corpus beside it.
CodeQL gate- Three analyzers: GitHub Actions, JavaScript and TypeScript, Python. The gate passes only when all three finish.
The rules it was built around
- Pointers are not facts.
- The rendering layer can lie.
- Merge-critical truth is machine-enforced.
And for every gate: it must be satisfiable, falsifiable, and fail only on a real defect.
What the lane refuses
Every service deploys through the same eight-stage lane. The numerals mark where it can refuse a deploy.
- Build the image, then a filesystem gate
- Scan Trivy, fixable high and critical findingsi
- Guard the main tip is unchangedii
- Lease one build per serviceiii
- Candidate tagged, at zero traffic
- Probe the exact commit, readyiv
- Promote full traffic, production probesv
- Finalize rollback held, lease released
| Mark | Condition | Caught by | Result |
|---|---|---|---|
| i | A fixable high- or critical-severity finding in the image | Trivy, before push | The build stops; nothing is published. |
| ii | Main advanced with changes to this service | The main-tip guard | The build stops before publishing; the newer build deploys. |
| iii | Another build holds the service | The deploy lease | This build waits for the owner to finish. |
| iv | The candidate serves the wrong commit or fails readiness | The candidate probe | Traffic never moves; production is untouched. |
| v | A production probe fails after promotion | Promote and finalize | The prior revision is restored. |
| — | Derived artifacts sit behind their sources | verify, on the pull request and in the queue | Refused until they are regenerated and committed. |
Six services, one plane. Cloud Run, one region: one service and one build trigger per workload.
stonewall-public- stnwl.ai — this site
stonewall-cockpit- app.stnwl.ai — the operator cockpit and Shelby
stonewall-portal- api.stnwl.ai — the corpus API
stonewall-bot- Shelby on Telegram
knowledge-base-webhook- Signed ingest callbacks
chat-agent-service-c2e9- The operator’s Google Chat agent, bounded tools
stonewall-command- The operator’s command agent, behind Cloudflare Access
Triggers, edge and uptime
The roster above is read from the one surface file CI probes live. One more surface runs beside the fleet on Cloudflare Workers, deployed by hand. The apex sits behind a global external HTTPS load balancer with managed certificates. The stnwl.ai DNS zone uses Google Cloud DNS; stonewall.esq retains Cloudflare DNS-only nameservers. Eleven uptime checks run at a five-minute cadence, with alert policies for uptime-check failures.
| Service | Deploy config | Trigger |
|---|---|---|
stonewall-public | cloudbuild.public.yaml | stonewall-public-main-push |
stonewall-cockpit | web/ | stonewall-cockpit-main-push |
stonewall-portal | cloudbuild.yaml | stonewall-main-push |
stonewall-bot | scripts/ | stonewall-bot-main-push |
knowledge-base-webhook | cloudbuild.webhook.yaml | stonewall-kb-webhook-main-push |
chat-agent-service-c2e9 | apps/ | stonewall-chat-agent-main-push |
stonewall-command | apps/ | wrangler deploy, operator-run |
The full stack
- Languages
- Python 3.12 / 3.13 / 3.14, by service · TypeScript · Node 24 · Markdown
- Canon
- catalog/manifest.md · Markdown + JSON · stdlib stonewall.py CLI
- Data plane
- Neon Postgres 17 · pgvector, HNSW · Row-level security
- Embeddings
- Vercel AI Gateway, the embedding transport · text-embedding-3-small, 1536 dimensions
- Public site
- Next.js 16 standalone · Distroless Node 24 · Self-hosted Geist + Newsreader · GA4, deferred
- Corpus API
- FastAPI · Uvicorn · Repo JSON + in-memory search index
- Cockpit
- Next.js 16 · React 19 · Tailwind · Clerk · AI SDK
- Shelby
- Anthropic Claude · Claude Fable 5.1, the deploy-lane pin · A smaller Claude tier for distillation
- Voice and audio
- Whisper · Gemini 2.5 Pro, listening · TTS-1-HD
- Chat agent
- Gemini 2.5 Flash on Vertex AI · Bounded tools, read-only SQL
- Intake
- pypdfium2 · Tesseract · extract-msg · Two-pass vision
- CI
- GitHub Actions · pytest · Vitest · Playwright · CodeQL · gitleaks · Trivy
- Infrastructure
- Cloud Run · Cloud Build · Artifact Registry · Cloud DNS · HTTPS load balancer · Terraform · Cloud Monitoring
The production bar. Five pillars, each pinned to a file or a gate.
- Reliability
- Zero-traffic candidates, rollback held, hashed assets, live probes.
- Security
- Secret and image scanning, CodeQL, an export guard, default-deny data.
- Performance
- Invariants in CI, per-route bundle budgets, self-hosted type.
- Operations
- One service per workload; triggers and merge rules as code.
- Cost
- Scope-aware CI, frozen lockfiles, duplicate runs cancelled.
Files and gates
Reliability
- Zero-traffic candidate, rollback held
scripts/Cloud Build probes, every lanecloud_run_safe_promote.py - Content-hashed assets
scripts/verifyasset_version_stamp.py - Declared surfaces, probed live
catalog/audit_surface_state.pyintake/ state/ surfaces.toml - Cockpit reads with the API cold
web/bundled snapshot fallbacklib/ api.ts
Security
- Secret scanning
.github/protected code/config scanworkflows/ gitleaks.yml - Static analysis
.github/CodeQL gateworkflows/ codeql.yml - Public export guard
scripts/fails the buildassert_public_portal_payload.py - Operator boundary
web/allowlist, fails closedmiddleware.ts - Default-deny data access
web/row-level securitymigrations/ postgres/ 0028-data-api-default-deny.sql - Security headers, pinned actions
next.config.jsactionlint and zizmor in verify
Performance
- Performance invariants
scripts/verifycheck_web_perf_invariants.py - Per-route bundle budgets
web/pnpm check:bundlesperf-budgets.json - Self-hosted type, deferred analytics
tests/verifytest_public_perf_invariants.py
Operations
- Triggers declared in code
terraform/trigger roster audit, liveedge.tf - Merge rules as code
docs/apply_ruleset_policy.pyruleset-policy.json - Gates tested on a clean tree
scripts/--check and --canaryaudit_gate_lane_parity.py
Cost
- Corpus-only verify for prose
scripts/verify scopedetect_pr_change_scope.py - Frozen lockfiles
Dockerfile.publicpnpm install --frozen-lockfile - Duplicate runs cancelled
.github/janitorworkflows/ cancel-runs-on-janitor-close.yml - Warm capacity per service
docs/public 2 · portal, cockpit, bot 1 · webhook, chat agent 0deployment-current-state.md
How it was built
The innovations book was first written in May 2026, in ten chapters. The first seven are condensed here and corrected to the system as it runs today; the milestones follow.
- The manifest is the database. Sequential artifact IDs, typed rows, joins across people, patterns, and dates, analysis flags. A stdlib CLI queries it; verify checks the gated tracked indexes against it.
catalog/manifest.md scripts/stonewall.py - Agents route on purpose. Ordered reading bundles per task replace reading the whole repository. One sentence of case state fans out to every codex, index, and snapshot in a single sweep.
context/MASTER_INDEX.md scripts/lock_case_state.py - The verification spine. One suite is the merge contract: a corpus-only mode for prose, the whole suite for code. Identity, rendering, and cross-surface drift each carry their own audit.
scripts/verify_all.py scripts/pre_pr_check.py - One truth, many doors. A single declared surface file names every live service, hostname, trigger, and probe; the deployment docs render from it and CI probes it live.
catalog/intake/ state/ surfaces.toml scripts/render_surface_docs.py - The evidence layer. Two-pass vision renders at 500 dpi or better produce the gold sidecars; full-page raster OCR at 300 dpi or better is the searchable floor. Reply chains nest; nothing is summarized.
references/bubble_render_doctrine.md scripts/batch_sidecar_gold_uplift.py - The operator cockpit. Clerk-gated, with a fallback chain of live API, bundled snapshot, and public data, so an artifact still reads when an upstream service is cold.
web/lib/ api.ts scripts/build_cockpit_operator_snapshot.py - Documentation that keeps pace. An on-demand scanner lists the pages that still cite changed paths or symbols; a scheduled documentation pass opens ordinary pull requests through the queue; a janitor keeps one survivor per topic.
scripts/docs_api_drift.py .github/workflows/ close-duplicate-doc-prs.yml
- The control-plane campaign: artifact reader, agent context snapshots, dedupe index, drift audits.
- Google Cloud Run becomes the deploy plane.
- The merge queue settles on main.
- The last external hosts retire; stnwl.ai DNS moves to Google Cloud DNS. The compatibility domain retains Cloudflare DNS.
- The public surface consolidates to four destinations.
- A sixth service joins the fleet: the operator’s chat agent.
- Review threads leave the merge gate; three checks and the queue are the whole contract.
- Every service deploys through the guarded lane.
Chapters IX and X now live on this page: the production bar above, and the one line per chapter at the top.