- Rust 92.6%
- HTML 6.2%
- Shell 0.5%
- Dockerfile 0.3%
- JavaScript 0.3%
- Other 0.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
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 |
||
| assets | ||
| docs | ||
| migrations | ||
| scripts | ||
| specs | ||
| src | ||
| templates | ||
| tests | ||
| theme | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| config.example.toml | ||
| config.toml | ||
| Containerfile | ||
| ingress.yaml | ||
| input.css | ||
| manifest.yaml | ||
| provenance.json | ||
| README.md | ||
| tailwind.config.js | ||
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.secretsin 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 whenLLM_API_KEYis absent),GRAPH_TENANT_ID/GRAPH_CLIENT_ID/GRAPH_CLIENT_SECRET(mailbox intake — the app boots in "no mailbox" mode without them), andFORWARD_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):
--config <path>flag$CONSTRUCTIONBOT_CONFIG/etc/constructionbot/config.toml(if it exists — the baked image path)./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:
-
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' -
Review the worksheet — for each fixture, the suite prints:
- subject, question, confidence, assignee hint, spec section, drawings
-
Upload each fixture through the dashboard and click "Create RFI from extraction." Count how many fields you manually edited before submitting.
-
Record edit counts in the table below.
-
Iterate the prompt — edit
extraction_system_promptinconfig.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.