01 Executive Summary
WeylandAI's SubmittalExpress and TakeOffExpress products are a Cloudflare-native SaaS platform for construction door hardware estimating. The platform extracts hardware schedules from architectural PDFs using AI vision, lets users affirm the data through a human-guided workflow, generates professional quotes, and assembles submittal packages. PAD (Precision Auto Doors) funded $15K for buildout with validated $2K/month/seat pricing.
Pipeline Unification Phases 1–3 DEPLOYED → Extraction Flow Unification (29A audit COMPLETE, 29B–D PLANNED) → Takeoff Table Redesign → Demo-Ready Product. The backend is more complete than the frontend — the light reaches the tube but doesn't yet reach the eyepiece.
02 Platform Architecture
Stack
Cloudflare-Native, Zero Dependencies
| Worker | weyland-worker.js — 14K+ lines, pure JS, Cloudflare Workers runtime |
| Frontend | subx.html — 1.1MB single-page application, Cloudflare Pages |
| Database | Cloudflare D1 (weyland_db) — 89+ tables, SQLite at edge |
| Storage | Cloudflare R2 — subx-uploads (PDFs), subx-outputs (generated docs) |
| Cache | Cloudflare KV — rendered pages, session state |
| Rendering | Cloudflare Browser Rendering (Puppeteer) — 600 DPI extraction, quote PDFs |
| Queue | Cloudflare Queues — cut sheet discovery pipeline |
| AI | Claude Vision API — hardware schedule extraction, constraint-driven prompts |
Extraction Pipeline Flow
The Affirmation Boundary
"Nothing enters assembly-connected infrastructure until affirmed by a human operator and completeness-checked at generation time."
Three Affirm Gates: MARK→HW GROUP (Gate 1) | Components (Gate 2) | Quantities (Gate 3). Each affirmation is literal proof of work. The affirm_audit_log is the permanent source of truth. The AI extracts, the human affirms, and only then does the system act.
Domains
| Domain | Purpose | Serving |
|---|---|---|
| api.weylandai.com | Worker API backend | Cloudflare Worker (weyland) |
| subx.weylandai.com | SubmittalExpress product app | Cloudflare Pages (submittalexpress) |
| weylandai.com | Corporate site + static pages | Cloudflare Pages (submittalexpress) |
| consenta.cc | Consenta CRM/ERP fork | Cloudflare Worker + Pages (consenta) |
03 HASCOM Toolkit — 10 Feature Gifts
HASCOM (originally "MHS Autonomous Systems Command") is the substrate-agnostic infrastructure layer — a fractal capability registry that works with any AI system. These ten features have been battle-tested across 10+ engineering sessions and are ready for immediate use. View complete source code →
Design philosophy: "HASCOM is AI-agnostic infrastructure; building with MCP might over-optimize toward a fleeting point in time."
hascom query Symbol-Level Indexing
Multi-table search across 3,635 indexed symbols in 63 files. Returns exact file:line for routes, functions, tables, columns, and API calls. Completes in 0.7 seconds. The single command that kills the naming mismatch pattern — seven instances discovered (26A through 26N) where unexercised code referenced nonexistent column names.
Impact: ~80% fewer tool calls, ~70% fewer tokens vs raw Glob/Grep exploration. One shell call replaces 15–25 agent tool calls.
hascom brief Domain Briefing
Generates a structured briefing document for any registered domain in the MHS ecosystem. Returns file inventory, capability map, relationship graph, and key patterns. Any new collaborator (human or AI) gets oriented in seconds.
Impact: Eliminates the "where do I start?" problem for new agents joining a session.
hascom context Agent Context Generation
Generates a .hascom_context.md file for injection into any AI agent's context window. Contains the symbol index, domain relationships, and key patterns — formatted for consumption by Claude, GPT, Gemini, or any future system.
Impact: Zero vendor lock-in. Works with any substrate that can read markdown.
hascom analyze Codebase Analysis
Powered by analyzers.py — extracts symbols from JavaScript/Python codebases. Parses route definitions, function signatures, CREATE TABLE statements, column definitions, and API call patterns. Stores results in taxonomy.db (14.7MB SQLite, FTS5 search-enabled).
Impact: Rebuilds the full symbol index in seconds. Run after any major refactor to keep the knowledge graph current.
hascom uat UAT Suite Framework
Drop-in test suites via get_suite() convention (mirrors Flask's get_provider()). Auto-discovered by pkgutil.iter_modules. Kahn topological sort for dependency graphs. 49 tests across 7+ suites. Includes UATSession (urllib, JWT auth), 16 reusable assertions, structured reporting with JSON export.
Impact: Zero framework changes for new suites. Drop a file in uat/suites/, export get_suite(), done.
Taxonomy Database
14.7MB SQLite database at C:\MHS\hascom\taxonomy.db. Contains 9,300+ files, 4,800+ relationships, and 3,635 symbols. FTS5-enabled for full-text search. Domains include athena_system, hascom, ventures, mhsync, subx_tickets, and more.
Impact: The knowledge graph that makes all other HASCOM commands possible. Crawled and indexed automatically.
DevTools Provider — 33 Browser Capabilities
V2.0 general browser infrastructure. Persistent daemon bridge (WS:9876 + HTTP:9877). Includes devtools.find_browser, devtools.screenshot, devtools.console, devtools.network, devtools.run (JS execution via clipboard paste), devtools.topmost (pin any window). Works across Chrome, Edge, and other Chromium browsers.
Impact: Any WRIGHT can see what the browser sees. Born from extraction UAT; evolved into general browser automation by CAPT directive.
Site Profiles — JSON-Driven Navigation
JSON site profile definitions (sites/subx.json, sites/consenta.json). Define navigation flows, authentication sequences, and page state queries for any web application. Used with site_nav, site_action, site_state, site_login capabilities.
Impact: "Build general capabilities enabling testing of any webpage for any WRIGHT." — CAPT
Daemon Bridge — Persistent WS Connection
WebSocket bridge (port 9876) + HTTP API (port 9877) for persistent browser communication. bridge.py implements BrowserTarget + resolve_target (DNS-style window resolution). 9-step safe bootstrap via bridge_inject. Token-per-session auth (Jupyter model). Auto-token-refresh via JWT decode.
Impact: Site profiles over app-specific providers. WebSocket bridge over CDP (works with all browsers including Safari).
Collaboration Briefings & Session Notes
Multi-agent session context management via collab_briefings/ directory. Each collaboration session gets a unique briefing file (collab-{hash}.md) containing session context, discoveries, and state. Combined with SESSION_NOTES_*.md for human-readable session journals and HASCOM source reference for agent orientation.
Impact: Seamless context transfer between agents and sessions. No "cold start" for returning collaborators.
Quick Start
# The one command every collaborator needs
cd C:\MHS
python -m hascom query "hardware_sets."
# Domain briefing
python -m hascom brief athena_system
# Run UAT suite
python -m hascom uat run suite_deploy
# Full codebase re-index
python -m hascom analyze
# Login for API testing
python -m hascom login --token <JWT>
04 Progress Timeline — Feb 6–14, 2026
Eight engineering sessions over nine days. From gap analysis to production deployment across extraction, takeoff, quoting, document intelligence, and developer tooling.
Gap Analyses & Vendor Profile (26F, 26G, 26H)
First Opus 4.6 BOSUN session. Two E2E gap analyses delivered (Submittal + Takeoff). Four new tickets cut (26G–26J). 26H Vendor Profile deployed — 6 gates pass. 26F Preview Overhaul confirmed complete by evolution. Index rev 3.27→3.28.
Pipeline Unification + HASCOM UAT + Quote Persistence
Five sessions in one day. 26K materialization bridge. 26L re-extraction interlock. 26J quote persistence deployed. HASCOM UAT toolkit built (9 files). HASCOM-001 taxonomy bridge. Pipeline Unification Phases 1–2 deployed (project-scoped takeoff, bulk session linking, backfill bridge, auto-link on upload, DSE→line items materialization, set-level price overrides). Index rev 3.29→3.33.
Quote HTML Engine + Consenta Phase 1 + Pipeline Phase 3
CAPT architecture pivot: Vision API extraction for quote rendering REJECTED — replaced with HTML+CSS+env.BROWSER. 26N HTML engine deployed. 26M card-level re-extraction deployed (collaborating WRIGHT pattern). Consenta Phase 1 complete (16 table renames, 9 file renames, 91 D1 tables). Project-scoped quote generation deployed. CPS Price-Informed Takeoff deployed. Index rev 3.35→3.37.
26O Shareable Quote Links + Migration Gap Pattern
26O code was already deployed across 3+ worker deploys but migration 042 was never applied to D1. Quote list endpoints returning 500. Migration gap pattern documented as eighth pattern class. Applied migration, redeployed. Index rev 3.38→3.39.
Family 27: Bookmark-First Discovery (27A)
27A deployed: pdf.js getOutline() bookmark parsing, schedule auto-detection via keyword+AIA+CSI patterns, sheet index sidebar, page range scoping, presigned R2 upload for any file size. OOM fix for 111MB PDFs (R2 streaming). Migration 044 applied.
28A Browser Infra + 28B Symbol Indexing
The session that unlocked everything. 28A: Daemon bridge + auth handshake + site profiles + 33 capabilities + 49 UAT tests (48 PASS). 28B: Symbol-level indexing — 3,635 symbols, 63 files, 0.7s analysis. hascom query becomes the one command to onboard any new collaborator. Index rev 3.47.
Family 29: Extraction Flow Unification (29A)
29A audit complete: Full backend+frontend extraction audit. Range fix deployed. Three extraction paths (detect→affirm→extract, batch-extract, region re-extract) should converge to one coordinated flow. Fetch-after-extract gap identified. CAPT takeoff table + quote package directives captured. Index rev 3.48.
05 Key Files & Metadata
Source Files
| File | Size | Role | Last Modified |
|---|---|---|---|
| weyland-worker.js | ~14K lines | API backend — all routes, auth, extraction orchestration, takeoff, quotes | 2026-02-13 |
| deployment/public/subx.html | 1,171,028 bytes | Single-page frontend — viewer, extraction UI, takeoff, settings | 2026-02-13 |
| hardware-schedule-extractor.js | ~5K lines | Extraction engine — prompts, parsing, region rendering, constraint architecture | 2026-02-13 |
| submittal-assembler.js | ~1K lines | PDF assembly — cover, TOC, HW set pages, cut sheet insertion | 2026-02-09 |
| takeoff-quote-generator.js | ~767 lines | Quote HTML engine (v4.0) — pure HTML, env.BROWSER PDF render | 2026-02-10 |
| data-transformer.js | ~1.5K lines | Data transformation — materializeAffirmedGroup, DSE bridge | 2026-02-09 |
| discovery-engine.js | ~800 lines | Cut sheet discovery — CPS catalogue matching, queue consumer | 2026-01-30 |
Configuration & Infrastructure
| File | Role | Key Detail |
|---|---|---|
| wrangler.toml | Deployment config | v2.4.1. Routes: api.weylandai.com/*, subx.weylandai.com/quote/*, subx.weylandai.com/q/* |
| deployment/public/_worker.js | Pages routing | Advanced mode: domain-based routing (weylandai.com → corporate, subx → app) |
| deployment/public/_headers | Security headers | CSP, CORS, frame protection. Updated 2026-02-13 (fonts.googleapis.com added) |
| migrations/001–044 | D1 schema evolution | 44 migrations applied. 89+ tables. Latest: migration 044 (27A document discovery) |
Ticket & Framework Files
| File | Role | Rev |
|---|---|---|
| Phase2Tickets/00_PHASE2_TICKET_INDEX.json | Master ticket index — families, gates, recon, five-field summary | 3.48 |
| rulesv1.5/MHS_CONSTITUTION_v1.5.json | Framework constitution — Chain & Anchor protocol | 1.5 |
| Phase2Tickets/CE_NOTE_2026-0209_TakeoffPipelineUnification.json | Pipeline unification strategy — 4 phases, demo-critical | — |
06 Deployment Guide
Worker (API Backend)
# Deploy to production
npx wrangler deploy
# Verify
curl https://api.weylandai.com/api/health
Worker name is weyland (not subx-worker). No --name flag needed.
Pages (Frontend)
# Deploy to production
npx wrangler pages deploy \
deployment/public \
--project-name=submittalexpress \
--branch=production
--branch=production is MANDATORY. Without it, deploys go to preview/alpha and production stays stale.
npx wrangler deploy carries all JS changes. But D1 migrations require separate execution:
npx wrangler d1 execute weyland_db --remote --file=migrations/044_xxx.sql
This pattern caused 26O (shareable quote links) to ship code but not schema — quote list endpoints returned 500 for days. Always verify migrations after deploy.
D1 Database
# Query production D1
npx wrangler d1 execute weyland_db --remote --command="SELECT name FROM sqlite_master WHERE type='table' ORDER BY name"
# Run migration (use --file, not --command for long SQL)
npx wrangler d1 execute weyland_db --remote --file=migrations/044_document_discovery.sql
Quick Deploy Both
npx wrangler deploy && npx wrangler pages deploy deployment/public --project-name=submittalexpress --branch=production
07 Known Issues & Service Regressions
Fetch-After-Extract Gap
Batch-extract deposits data in D1 but frontend stores groups:[] in local state and never fetches the data back from the server. Three extraction paths (detect→affirm→extract, batch-extract, region re-extract) operate independently with no coordinated post-extraction data refresh.
IDENTIFIED Ticket 29B planned. Source: 29A audit (2026-02-13).
Batch-Extract OOM on Large PDFs
renderRegionAt600DPI receives full pdfBuffer (e.g., 111MB) instead of pdfStreamUrl. Worker exceeds 128MB memory limit. R2 streaming fix exists (KV-first → R2-stream-fallback) but is not wired into the batch-extract call site (~L3489).
PARTIAL FIX R2 streaming wired for extract-affirmed path. Batch-extract path still uses buffer. Source: DX-2026-0212-001.
Cross-Page Continuation Groups (Orphan Drop)
parseHardwareExtractionResult silently drops groups with no identifier via console.warn + continue. Hardware schedules spanning page breaks lose continuation components. The extraction prompts have zero vocabulary for "continuation" or "orphan."
SPECIFIED Ticket 29B — Orphan Group Detection & Merge. Three-layer fix: prompt engineering, parser orphan detection, frontend resolution UI.
CORS on 5xx Responses
Worker omits CORS headers when returning 500-class errors. Frontend fetch() sees CORS error instead of the actual error message, making debugging difficult.
TODO Identified during 28A diagnostics session.
Kaiser Session Linking
47 Kaiser Sunset sessions exist as orphans with no cross-session linking. 35 door_schedule type, 7 hardware_schedule type. Zero door_schedule_entries persisted. Auto-link on upload (exact name match) is deployed but retroactive linking requires manual bulk-link API call.
TOOLS EXIST POST /api/projects/:projectId/link-sessions + backfill-bridge deployed. Requires CAPT execution.
08 Delivery Roadmap
Active Ticket Families
| Family | Title | Status | Next Step |
|---|---|---|---|
| 26 | E2E Pipeline — Andrew's Workflow | Wave 1–2 DONE | 26P Digital Acceptance, 26Q White Label |
| 27 | Document Intelligence | 27A DEPLOYED | 27B Font CMap Reconstruction, 27C HASCOM Doc Taxonomy |
| 28 | HASCOM DevTools | V2.0 COMPLETE | Tier 2 capabilities (navigate, click, fill, assert) |
| 29 | Extraction Flow Unification | 29A AUDIT DONE | 29B Orphan Merge, 29C Takeoff Redesign, 29D Quote Restructure |
CAPT Design Directives (from 29A)
- Range is the primary selection mechanism — works independently, no index required
- Index enriches when present — shows which pages are what, allows surgical deselection
- Hit extract, it goes — range alone is sufficient to trigger extraction
- One thoughtful flow, not three separate paths
- 1-page quote + expanded line item addendums as single exported package
- Columns: Make, Model, Finish (if), Key (if), Unit Price, Qty
- "Smooth and soothing on the ear" — design ethos must continue in code and service rendered
Revenue Context
PAD paid $15K for buildout. Customers lined up for monthly seat demos. $2K/month/seat validated by Andrew. Every engineering session should drive toward demo-ready. The backend is more complete than the frontend — the pipeline works, the data flows, but the user-facing takeoff table and quote package need the redesign captured in 29C/29D.
09 Quick-Start Commands
HASCOM (from C:\MHS)
# Symbol query — the one command to rule them all
python -m hascom query "hardware_sets."
python -m hascom query "GET.*takeoff"
python -m hascom query "generateQuoteHtml"
python -m hascom query "migration"
# Domain briefing
python -m hascom brief athena_system
# Re-index after code changes
python -m hascom analyze
# Run UAT tests
python -m hascom uat run suite_deploy
python -m hascom uat run suite_26j
# Check auth token status
python -m hascom uat token-status
# Login for API testing
python -m hascom login --token <JWT-from-browser>
Deployment (from Prototype1/)
# Deploy worker + pages (production)
npx wrangler deploy && \
npx wrangler pages deploy deployment/public \
--project-name=submittalexpress --branch=production
# Run D1 migration
npx wrangler d1 execute weyland_db --remote --file=migrations/044_xxx.sql
# Check D1 tables
npx wrangler d1 execute weyland_db --remote \
--command="SELECT name FROM sqlite_master WHERE type='table'"
# Tail production logs
npx wrangler tail
Git (from phase2/Phase2Tickets/)
# Current state
git log --oneline -10
git status
# Latest commits
# a2193a3 v3.48: Families 27-29
# 3c2c4af v3.39: BOSUN session 10
# e725d52 v3.31: BOSUN session 26L/26I/26M
# 2a2e4f5 26K: Materialization bridge
# ea44326 v3.29a: BOSUN review 26H
10 Reference Links & Resources
Production Services
| Service | URL | Purpose |
|---|---|---|
| API Health | api.weylandai.com/api/health | Worker health check — returns JSON status |
| SubX App | subx.weylandai.com | SubmittalExpress product (login required) |
| Corporate Site | weylandai.com | Marketing homepage |
| Consenta | consenta.cc | CRM/ERP fork (login required) |
| Quote View | subx.weylandai.com/quote/:id/view | Rendered quote HTML (requires quote ID) |
| Shared Quote | subx.weylandai.com/q/:id/:token | Public shareable link (requires token) |
Architecture & Product Source
| Resource | URL | Contents |
|---|---|---|
| Architecture — Four Pillars | weylandai.com/handoff-architecture | Constraint-driven extraction, consent & sovereignty, platform northstar (Consenta), tactical vision. The WHY behind the code. |
| Pipeline Source | weylandai.com/handoff-product-source | All 5 pipeline files: extractor (4,744 lines), transformer (1,599), discovery (1,527), assembler (1,142), quote engine (849). Pipeline flow diagram + export tables + full source. |
HASCOM Toolkit
| Resource | URL | Contents |
|---|---|---|
| Source Reference | weylandai.com/handoff-hascom-source | Complete source: core.py, analyzers.py, UAT toolkit (http, assertions, runner) |
| Infrastructure Config | weylandai.com/handoff-infrastructure | wrangler.toml, _worker.js routing, deployment configuration |
Source Repository
| Repo | URL | Scope |
|---|---|---|
| Phase 2 Tickets | github.com/argo147/TakeOffExpress-phase2 | Private. 190 files, 78K+ lines. Ticket index + all ticket families. |
Local File Paths
| Path | What It Is |
|---|---|
| C:\MHS\hascom\ | HASCOM toolkit — providers, UAT, taxonomy, analyzers |
| C:\MHS\hascom\taxonomy.db | Knowledge graph (14.7MB, 9,300 files, 4,800 relationships) |
| C:\AthenaSystem\PADSubX\...\Prototype1\ | Worker source + wrangler.toml + deployment/ |
| ...\Phase2Tickets\ | Ticket index + 96 ticket files + scout reports |
| C:\MHS\Ventures\Consenta\ | Consenta fork — renamed worker + schema |
| C:\MHS\MHSync\ | Encrypted sync relay (Ron↔John) |
| C:\MHS\athena_core\engine\ | ROL engine (Recursive Observer Lagrangian) |
Key Architectural Documents
| Document | Location | Topic |
|---|---|---|
| Ticket Index | Phase2Tickets/00_PHASE2_TICKET_INDEX.json | Master index rev 3.48 |
| Pipeline Unification | Phase2Tickets/CE_NOTE_2026-0209_TakeoffPipelineUnification.json | 4-phase strategy (demo-critical) |
| Sovereignty Schema | Phase2Tickets/CH-2026-0129-SOVEREIGNTY-001_*.json | User sovereignty foundation |
| Extraction Audit | Phase2Tickets/29A_WO-2026-0213-EXTRACTION-001_*.json | Full extraction flow unification |
| Orphan Merge Spec | Phase2Tickets/29B_FX-2026-0213-MERGE-001_*.json | Cross-page continuation detection |
| MHS Constitution | rulesv1.5/MHS_CONSTITUTION_v1.5.json | Framework v1.5 protocol |
| Consenta Phase 2 | memory/consenta-phase2.md | Registry swap completion notes |
Pattern Library (Discovered & Documented)
| Pattern | Instances | Status |
|---|---|---|
| Naming Mismatch | 7 (26A, 26C, 26D, 26B01, 26J, 26M, 26N) | SOLVED via hascom query |
| Migration Gap | 1 confirmed (26O) | DOCUMENTED post-deploy checklist |
| Preflight Corrections | 75% premise-error rate on batched tickets | PROCESS always verify before dispatch |
| Deploy Target | Pages --branch=production mandatory |
DOCUMENTED in wrangler.toml header |
| D1 Long SQL | --command fails with 7403 on wrangler 3.x |
WORKAROUND use --file always |