ConstructionBot RFI automation for gal (renamed from engineerbot 2026-08-15)
  • Rust 92.6%
  • HTML 6.2%
  • Shell 0.5%
  • Dockerfile 0.3%
  • JavaScript 0.3%
  • Other 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
jsutter fd013f2ab8 docs(wave-3): verification report — v0.1.29 replay results and incidents
22/25 due dates (from 6/25), 23/25 routing (from 21), 0 malformed spec
values (from 4), 7/7 submittal cardinality (from 6/7). Zero due dates before
receipt (from 11). Both positive controls extracted the body-stated date while
the attached form's printed date sat in the same document text.

Records the live defect the re-run exposed: submittal_intake_maintenance
shipped with zero call sites, so a sage cold-start stranded all 7 submittal
uploads permanently while the RFI lane self-healed. Fixed in v0.1.29.

Follow-ups: the expedite arm over-firing on two items (a new miss mode, not a
regression), #97's routing missed in both directions across two waves, and the
ingress gate whose workflow file is absent from the checkout.

Assisted-by: deepnet:synthetic/hf:deepseek-ai/DeepSeek-V4.1-Flash-1017
2026-11-03 11:30:18 -08:00
assets feat: multi-RFI pipeline, vendor-tag assignees, unified pipeline UI 2026-08-21 16:11:39 -07:00
docs docs(wave-3): verification report — v0.1.29 replay results and incidents 2026-11-03 11:30:18 -08:00
migrations fix: recover crash-stranded 'processing' uploads on claim age (claimed_at) 2026-09-25 17:24:34 -07:00
scripts docs: align README, example config, Entra runbook, manifest with shipped truth 2026-09-25 17:07:30 -07:00
specs chore: project ditc-posture block into specs/constitution.md (DIT-CON-008) 2026-09-24 19:22:25 -07:00
src fix(submittal): run the sweep's maintenance pass at the top of each drain 2026-11-03 11:13:44 -08:00
templates fix: include the assignee-patterns fragment in project_detail (H6) 2026-09-25 17:07:18 -07:00
tests fix(submittal): a correct decline reaches review, not the failure path (FR-5) 2026-11-03 09:21:52 -08:00
theme deploy: ditc automated deploy 2026-08-12 16:29:48 -07:00
.gitignore docs: merge constructionbot-docs repo into the code repo (29 files: constitution, probes, QA logs, plans, phase drafts, sample RFIs, brainstorm, voice-gallery, spec-registry, wishlist) 2026-08-18 12:19:34 -07:00
Cargo.lock rename: engineerbot -> constructionbot (crate, binary, image, domain, paths) 2026-08-14 20:43:51 -07:00
Cargo.toml rename: engineerbot -> constructionbot (crate, binary, image, domain, paths) 2026-08-14 20:43:51 -07:00
config.example.toml docs: align README, example config, Entra runbook, manifest with shipped truth 2026-09-25 17:07:30 -07:00
config.toml fix(prompts): bar form-printed due dates, enumerate nullables, bound spec guess 2026-11-03 09:29:18 -08:00
Containerfile fix: touch both src files to force app crate recompile after dummy build 2026-08-21 09:47:27 -07:00
ingress.yaml feat(security): forward-auth proof header validation — close W3 spoofing gap 2026-08-15 06:21:53 -07:00
input.css feat: dark mode (theme v2.1) 2026-08-21 09:35:30 -07:00
manifest.yaml recover: repoint extraction LLM to saged (sage.symbiotrip.com, model sage) 2026-10-26 11:24:46 -07:00
provenance.json deploy: ditc automated deploy 2026-11-03 11:19:16 -08:00
README.md docs: align README, example config, Entra runbook, manifest with shipped truth 2026-09-25 17:07:30 -07:00
tailwind.config.js feat: dark mode (theme v2.1) 2026-08-21 09:35:30 -07:00

ConstructionBot

Procore RFI dashboard for the gal tenant. Phase 1 (Layer A): operator drafts RFIs, attaches vendor PDFs, submits to the Procore sandbox. Phase 3 (Layer B): sage-LLM extraction from uploaded RFI PDFs with a human review gate before any Procore write.

Architecture

  • Rust/axum + askama + htmx — single binary, tenant Postgres, tokio background tasks in-process.
  • No secrets in the repo — every secret arrives via env vars, resolved on the runner from OpenBao (see dit.secrets in manifest.yaml): DATABASE_URL, PROCORE_CLIENT_ID, PROCORE_CLIENT_SECRET, LLM_API_KEY (REQUIRED — boot fails closed without it), SAGE_API_KEY (rollback-only during the stream-A cutover; the LLM client falls back to it when LLM_API_KEY is absent), GRAPH_TENANT_ID / GRAPH_CLIENT_ID / GRAPH_CLIENT_SECRET (mailbox intake — the app boots in "no mailbox" mode without them), and FORWARD_AUTH_SECRET (fail-closed at boot without it). Non-secret config lives in the config file (see Config).
  • Human gate — every RFI passes through operator review before Procore. The extraction pre-fills the form; the operator edits and submits.
  • sha256-keyed cache — same PDF → same cached extraction, zero double sage compute (phase3-draft AC-3).

Quick start (local dev)

export DATABASE_URL=postgres://constructionbot:pw@localhost:5432/constructionbot
export PROCORE_CLIENT_ID=...       # sandbox DMSA client id
export PROCORE_CLIENT_SECRET=...   # sandbox DMSA client secret
export LLM_API_KEY=...             # synthshim bearer (required; boot fails closed without it)
export FORWARD_AUTH_SECRET=...     # forward-auth proof (required; boot fails closed without it)
# Optional, mailbox intake only (else the app boots in "no mailbox" mode):
# export GRAPH_TENANT_ID=... GRAPH_CLIENT_ID=... GRAPH_CLIENT_SECRET=...
# SAGE_API_KEY is the rollback-only fallback for LLM_API_KEY (stream-A cutover);
# do not set it for new work.

cargo run -- --check-config   # validate the config file (see Config below)
cargo run                     # serve on :8080

Config

Non-secret config lives in a TOML file; a stray (typo'd) key fails the parse loudly at load — the app never serves a silently-defaulted value (#[serde(deny_unknown_fields)] on Config and every table struct).

Config-path precedence (highest wins):

  1. --config <path> flag
  2. $CONSTRUCTIONBOT_CONFIG
  3. /etc/constructionbot/config.toml (if it exists — the baked image path)
  4. ./config.toml

The local-dev shape is documented in config.example.toml; copy it to config.toml and edit. The live shipped config is config.toml.

Tests

cargo test --lib               # unit tests (offline, no DB needed)
cargo clippy --all-targets -- -D warnings   # lint (clean)
scripts/no_hardcoded_endpoints.sh           # endpoint gate (Constitution P11)
scripts/no_tailnet_endpoints.sh             # tailnet-endpoint gate (stream A constraint 4)
scripts/check_ingress_port.sh               # ingress-port match gate

# Integration tests (need DB + pdftotext):
nix-shell -p poppler-utils --run \
  'DATABASE_URL=postgres://... cargo test --test extraction_cache -- --ignored --nocapture'

# Corpus worksheet (need DB + pdftotext + sage):
nix-shell -p poppler-utils --run \
  'DATABASE_URL=... SAGE_API_KEY=... cargo test --test extraction_corpus -- --ignored --nocapture'

Phase 3 calibration — pilot week

Procedure

After deploying Layer B, run the extraction corpus suite per prompt change and record per-file edit counts:

  1. Run the corpus suite with the current prompt:

    nix-shell -p poppler-utils --run \
      'DATABASE_URL=... SAGE_API_KEY=... cargo test --test extraction_corpus -- --ignored --nocapture'
    
  2. Review the worksheet — for each fixture, the suite prints:

    • subject, question, confidence, assignee hint, spec section, drawings
  3. Upload each fixture through the dashboard and click "Create RFI from extraction." Count how many fields you manually edited before submitting.

  4. Record edit counts in the table below.

  5. Iterate the prompt — edit extraction_system_prompt in config.toml, restart the container (ditc deploy), re-run the suite.

Calibration table

Fixture Prompt ID Subject edits Question edits Assignee edits Total edits Notes
rfi1_civil_conflicting
rfi2_foundation_conduits
rfi4_mat_slab_transition

Target (phase3-draft)

  • 80% of vendor RFI uploads yield an extraction where the operator can click "Create RFI" with ≤2 manual edits.
  • Below 50% = Phase 3 extraction is net-negative; evaluate PlanGrep pivot or drop the feature.

Prompt iteration (phase3-draft AC-5)

Edit extraction_system_prompt in config.toml and restart the container. Each prompt change gets a new prompt_id (short hash of the prompt text), stored per extraction row for attribution. The corpus suite prints the prompt_id so you can compare results across prompt versions.