hvac_fable / HANDOFF.md
Rachel7's picture
Deploy Fable B-test analyzer
dac3297 verified
|
Raw History Blame Contribute Delete
33 kB

HVAC Blueprint Analyzer β€” Handoff

Updated: 2026-07-09 (supersedes all earlier versions of this file). Paste this whole file into a new session so the agent has full context instantly.

Read order for a new agent: (1) this file, top to bottom; (2) PLAN.md (operative plan β€” Β§4b–4j are the running progress log; Β§4i/Β§4j are newest); (3) analyzer_b/results/error_taxonomy_notes.md (failure families). Ignore .gsd/ (dead planning system), PUBLICATION_ROADMAP.md / INTEGRATED_PLAN.md (parallel paper track), and SPRINT_BRIEF.md's day-calendar (rationale valid, calendar superseded).


0b. SESSION STATE (2026-07-10) β€” bake-off A/D + snap (read first)

New self-contained bench harness in analyzer_b/hvac_pipeline/: bench_common.py (logged multi-model calls Anthropic+Gemini, thinking OFF; render /resize; recipe primitives; strict/loose scorer), run_bakeoff.py (Tracks A+D on 5 gold pages, parallel), snap_experiment.py (local tesseract OCR-snap, no API), run_track_a_ablation.py (Track-A levers one-at-a-time). Scoring is full-page 300-DPI center-match, strict 0.7x / loose 1.5x unit size (loose ~= recall after grounding). Full detail: analyzer_b/results/bakeoff_2026_07_10.md; raw under bakeoff_out/ (summary*.csv, SNAP_SUMMARY.md, TRACK_A_ABLATION.md, per-cell JSON+PNG, calls/ log = every call+image+cost+time). ~$6 total spent this session. 5 gold pages: 1326 p1 (hard), carroll p8 (dense), carroll p13 (leader-callout), lewis p2 (VRF), 23042 p8 (clean).

Findings:

  • Track D (copy Fable's recipe with a cheap driver, Gemini-flash/Haiku) β€” SHELVE. Recipe = whole-page + tile-sweep + self gap-hunt. Ceiling ~0.4-0.5 loose on easy pages, ~0 on hard/leader-callout, strict ~0, 30-100 FP/page, erratic (4x4 tiles helped p8/lewis but HURT 23042). Cheap vision on downscaled plans is the wall, not the scaffold. PDF-text/notes-prior steps won't save it.
  • Track A (gap-hunt on REAL v31 base) β€” keep FABLE hunter, DROP Opus. Fable moved recall where it mattered; Opus too conservative (added 0 on hard pages β€” base FP red boxes made it say "nothing missing"). Base = v31 detections.json, reproduces official v31 recall (1326 p1 = 0/11).
  • Track A ablation (add Fable's missing steps ONE AT A TIME) β€” the useful part:
    • A1 = hide the base's ungrounded (non-green) red boxes = THE winner. 1326 p1 loose 0.55->1.0 (found all 11), lewis ->1.0/1.0, ~0 added FP (38->39), cheapest. Root cause: the current track's own FPs were BLINDING the hunter.
    • A4 = hi-res per-region hunt = the STRICT lever (only thing that moved 1326 strict, 0->0.36; reads tags at full res). 6x cost; hard/sparse pages only.
    • A3 = schedule/"read-the-document-first" checklist = MINOR (+0.09 loose on the hard page, flat else). Keep as ~free prompt line, not a headline lever.
    • A2 = snap gap-hunt proposals = no effect (snap helps the BASE, not props).
    • carroll p13 stays 0.33/1.0 under EVERY lever = leader-callout body-vs-tag-circle OFFSET (needs leader-line following / body-centering, not hunt/OCR).
    • Best config (not yet run combined): A1 + A4(hard pages) + A3(free).
  • A1 generalizes WITHOUT gold (the key question): it filters red boxes on the engine's own OCR-GROUNDED flag (= green tier), not truth. Grounded-only precision measured 0.50-1.00 vs 0.16-0.43 raw base -> grounding IS a real gold-free FP signal (matches tier calibration). And it's RECALL-SAFE by construction: filtering only changes what the hunter is SHOWN; all base boxes stay in the output; a hidden true box gets re-proposed + deduped. Worst case degrades to A0, never below. Breaks only where grounding breaks (leader-callout). Deployable form: draw only GREEN boxes as "found", re-hunt yellow/gray. NOT yet validated on a true unseen building (all 5 pages are tuned gold) β€” first-contact run is the honest next check.
  • OCR-snap β€” helps sometimes, GUARD it. +0.13 strict on lewis (tag on body); NO help on carroll p13 (1/35 grounded); HURT carroll p8 (0.95->0.90, grounded onto wrong text) unless guarded (exact-tag + bounded move). Grounding 25-35%.
  • Track C (fable_propose) held per user β€” highest upside (Fable as clean proposer likely beats all; 0.64-0.73 loose as a mere HUNTER on the hardest page). B stays dead. Next threads: (1) fold A1 green-filter into the ship gap-hunt + validate on an unseen first-contact building; (2) run combined A1+A4; (3) Track C.

0. SESSION STATE (2026-07-08/09) β€” read this first

Git: on branch session/2026-07-08-thinkfix-validation-withers. PR #1 MERGED to main (v31 scoring, editor delete-persist, Track B kill-switch, first thinking work). PR #2 OPEN (this branch: thinking-fix + validation, rotate boxes, Withers, harvest) β€” do NOT merge until the gold regression finishes clean (below). Everything committed & pushed.

THE session win β€” verify thinking-truncation fix (SHIPPED). Gemini 2.5 ran thinking ON with a 512-tok verify budget β†’ thinking ate the budget β†’ JSON truncated before tag_text β†’ engine silently kept the schedule-echo guess tag. Root-caused with a new offline crop bench (verify_crop_bench.py) on 38 E082 units: thinking ON = 0/38 tag reads; thinking OFF = 38/38 family-token correct. Fixed thinking_budget=0 on _refine_hit_box + title-block reader (HVAC_VERIFY_THINK=1 reverts). Impact: E082 as-detected tag accuracy 32%β†’91%, recall held. This is why the two levers behave now and why Withers was clean.

Levers: Lever B (adaptive-UNKNOWN) SHIPPED default-on (replay danger=0 on 945 boxes). Lever A (pattern re-read) OPT-IN (HVAC_TAG_PATTERN=1) β€” E082 full-stack ship-check with all fixes on was danger=0, but keep opt-in until re-validated on the other buildings' FRESH (thinking-fixed) detections.

First-contact ledger grew (all the honest product metric):

  • Row 4 E082: 100% recall / 29.7% prec (pre-thinking-fix; 28 relabels needed).
  • Row 5 5 Withers: BEST YET β€” 100% recall, 0.80 prec, 0 relabels, 0 yellow pile (near-zero-touch on unseen bldg; the fixed stack working).
  • Row 6 150 Lawrence: RUN DONE, AWAITING USER REVIEW β€” p2 Cellar + p7 6th Fl in outputs\24-0610 - 150 Lawrence St - Mechanical Set\ (_prereview\ snapshot taken). Preview: p2 = 2 grn/6 ylw/4 gry (harder cellar, has CDU condensers); p7 = 11 grn/1 ylw/8 gry. After review: score indoor-only (CU/ERV/CDU are real equipment but NOT indoor β€” keep, don't count), ledger row 6, harvest.

BIG new direction β€” Fable-as-proposer (PLAN.md Β§4j). User showed Claude Fable one-pass (chat, no tiling/schedule) marking whole floors at ~100% recall+precision with correct tags+categories. Tested blind on the 2 gold floors that most broke Gemini: 1326 p1 = 11/11 (Gemini 0/11); Carroll p13 leader-callout = 6/6 (Gemini 4/6 only w/ special code) β€” all tags correct, 0 FP, correct exclusion of exhaust/vent callouts. PROVEN: recall+tag-ID. NOT yet measured: coordinate precision (my scores used EYEBALLED centers β†’ strict-center failed; that's measurement error, loose tol = 11/11 & 6/6). Built analyzer_b/hvac_pipeline/fable_propose.py (pre-resizes to Claude's high-res tier per Anthropic's coordinate docs so emitted PIXEL coords map 1:1, asks for absolute-pixel boxes, scores vs gold). BLOCKED: needs ANTHROPIC_API_KEY in .env (missing; OpenRouter is set but may lack claude-fable-5 + small cap). Next: run it on hard+dense+clean floors β†’ measure real precision+cost β†’ Fable becomes a Track-C proposer (Fable proposes β†’ OCR-snap grounds), maybe deleting tiling/consensus/verify.

Gold regression (thinking-fix safety gate) β€” INCOMPLETE, must finish. A background agent re-ran gold with thinking-fix (levers off, isolate) but STOPPED after only Lewis. Lewis: 73.3% recall (v31 baseline 60.0%) β€” UP +13pts, FP 51β†’23, 0 mistag. No regression; improvement. Carroll/1326/23042 NOT run (outputs\_gold_thinkfix_carroll empty). MUST finish: re-run those 3 with HVAC_TAG_PATTERN=0 HVAC_ADAPTIVE_UNKNOWN=0 + --refresh-detections into outputs\_gold_thinkfix_<b>, score with run_render_failures.py vs the gold dirs, compare to baseline (Carroll 90.4/1326 70.4/23042 92.1). Only after all 4 hold is the thinking-fix fully cleared and PR #2 mergeable.

Rotatable review boxes SHIPPED (script.js v17). Editor can rotate a box (circle handle above it, or [/] keys, Shift=15Β°) for angled units. Additive (angle 0 = unchanged); angle round-trips via a new review-CSV column. GUI needs server restart + hard-refresh to load.

Stopped background agents (this session): gold-regression (finish it, above) and the old lever-implementation agent (SUPERSEDED β€” Lever B already shipped; ignore). Two Sonnet harvest agents completed fine (E082+Withers merged to bank, queue at 418).


1. WHAT THIS IS AND WHAT THE USER WANTS

A pipeline that reads mechanical-blueprint PDFs and finds every HVAC indoor unit (tag, location, capacity), plus a FastAPI web GUI (the actual product).

  • Commercial product; the web app IS the product. Contractors upload a PDF β†’ units/capacities/CSVs out β†’ review flagged boxes in the browser.
  • North star: zero-touch. Review is a maturing-phase crutch.
  • RECALL-FIRST, cardinal rule: a missed unit costs trust/money; a false positive costs one glance. NO code path may silently delete a candidate β€” suspects become flagged review rows (yellow) or gray "noise" rows.
  • Decision rule: max center-recall (nearest-center within 0.7Γ— unit size); cost + review-rate break ties within ~2 points.
  • A/B/C bake-off (~to 2026-07-29): A = Gemini prompts+guardrails (ship path), B = local YOLO, C = cascade (proposer + Flash patch-verify β€” the cost/zero-touch bet).
  • Budget is NOT a constraint but log every paid run (~$50 spent so far, logged in PLAN.md / ledger notes).
  • The user reviews boxes personally; her verification is what makes any score real. She runs Kaggle GPU training on her account. Agents may be used for well-specified implementation tasks β€” use model "sonnet" for those (her request, saves usage); keep diagnosis/vision work in the main session.

2. RESULTS SO FAR (all human-verified)

Gold set (regression testing β€” NEVER train/harvest/tune on these)

4 buildings, 245 units: Lewis (p2,5 = 15u), Carroll (p4,6,8,11,13,19 = 83u), 1326 (p1,3,5,7 = 71u), 23042 (p3,4,5,8,10 = 76u). CSVs in analyzer_b/ground_truth/_gold_*/; no-train list analyzer_b/gold_buildings.txt (also bars 355/Dean β€” old tuning set, NOT valid unseen gold).

Config (17 gold pages) Lewis Carroll 1326 23042 TOTAL FP F1 $
strict v26-era 13.3% 51.8% 66.2% 3.9% 39% 29 0.52 $6.13
v30_inclusive 60.0% 90.4% 80.3% 69.7% 79.2% 445 0.44 $14.66
v31 taxonomy prompts (SHIP) 60.0% 90.4% 70.4% 92.1% 83.3% 499 0.43 ~$13.65

v31 scored 2026-07-05 (PLAN.md Β§4e) and independently re-scored 2026-07-07 with identical numbers. 23042 solid-bar clause worked (+22.4 pts, p3/p8 100%). ⚠ 1326 p1 (Cellar) collapsed 80.3%β†’0/11 despite 31 preds on the page β€” now 27% of all gold FNs, THE top diagnosis target. F1 β‰₯0.52 commitment still unmet (0.43): levers = 1326-p1 diagnosis, mistag hardening, Track C.

Standing commitment: precision work must bring F1 back β‰₯0.52 at ~79% recall. ⚠ The 23042 solid-bar prompt clause was derived from gold β†’ gold is no longer pristine for Track A prompt tuning; the first-contact ledger (below) is the honest generalization metric now.

First-contact ledger (analyzer_b/results/first_contact_ledger.csv) β€” THE product metric

Every NEW building is scored once, human-verified, BEFORE any fix derives from it; then it joins the training pool. Never re-score after fixes.

Building Config Recall Precision Notes
72-01 Queens Blvd (18 fl) v26-era 92.9% 57.2% 22 units missed; 216 FPs deleted
554 W 46th (2 pg) v31 ship 100% 29.6% green tier PERFECT (8/8); all junk contained in yellow/gray
527 Grand Ave (2 pg) v26-era CACHE 100% ~100% easy building, June cache β€” old-config datapoint

Tier calibration (the zero-touch pathway β€” evidence to date)

GREEN (OCR-grounded) boxes are ~99–100% precise everywhere measured. Green COVERAGE varies: 100% on well-labeled buildings (554), incomplete where labels are odd (Queens fl28 had 7 real units in yellow). Policy: auto-accept green, review yellow, skim/bulk-delete gray. Proposed next lever (designed, not built): pages with HIGH snap-rate β†’ demote UNKNOWN bodies to gray (adaptive-UNKNOWN, error_taxonomy_notes.md).

3. ENGINE/GUI STATE (all fixes live; GUI engine IS analyzer_b/analyze_blueprint_b.py)

Fix series F1–F8 + later work β€” details in PLAN.md 4b–4g and file comments:

  • F1 flag-don't-drop (verify rejects β†’ status noise, conf 0.3, gray dashed; GUI "Delete noise (N)" button; Approve-all & bulk-yellows SKIP noise).
  • F2 two-question verify (_refine_hit_box: unit-present? + read-the-tag; mismatch never rejects). FP-family negatives mined from Queens deletes are in that prompt (grilles "(250) SG-1", room text, keynote circles, shafts, bare "A/C", fixtures).
  • F3/F8 _schedule_quarantine (junk entries leave vocabulary; >30% junk β†’ whole schedule distrusted + auto-switch to inclusive prompt).
  • F6 UNKNOWN unit bodies (leader-callout plans; skips snap; verify reads tag).
  • Solid-bar clause (23042-style small dark bars, stacked dual-floor labels).
  • Outdoor guardrail wired in-engine: ACCU-/AC-CU-/CUH- demoted to noise (_nonindoor_family), measured FP βˆ’20 recall Β±0 on Carroll.
  • Prefix-aware snap (_match_wanted_tag): schedule 'AC-C' grounds on printed 'AC-C-8', adopts fuller tag, lands orange. Unit-tested.
  • F7 multi-floor sheets, end-to-end: titles "3RD-4TH", "10TH & 11TH", "THIRD THRU SIXTH" β†’ plan pages with floors_covered/floors_list manifest columns (_parse_floors_covered, 11 patterns tested); engine summary multiplies (Γ—N shown); GUI build_result EXPANDS a multi-floor sheet into one row per real floor (verified: 554 p6 β†’ floors 3–7 Γ—7 units; 527 p5 β†’ floors 2–4 Γ—18); manifest floor_name beats stale CSV names; floor_number parsed from name not page.
  • Title-block reader v2 (the user's 3-step plan, VALIDATED): (1) 350-DPI fitz-CLIP OCR of right strip + bottom-right corner + bottom strip; (2) sheet-number parsing (M-303.00) β†’ new sheet_no manifest column; (3) Gemini-Flash fallback on the title-block strip when no INFORMATIVE standard title (bare "MECHANICAL (PLAN) (FILED)" = uninformative β€” _UNINFORMATIVE_TITLE; that gate bug initially masked the fallback). HVAC_CLASSIFY_LLM=0 disables. Result on 554 W 46th: 0 β†’ 12 plan pages, all floors correct, p6 auto-detected "3RD TO 7TH" Γ—5. ~$0.01/failing page.
  • Floor-name fallback no longer glues FLOOR to numbers across newlines (527 "Floor 44" ghost) and "PARTIAL 5TH" parses fine ("Page 35" explained).
  • GUI: upload β†’ loadReview(uploadTaskId) surfaces cached results instantly; _out_dir_for strips the <uuid>_ upload prefix (ends the 270-Bergen fragmented-dirs bug β€” re-uploads reconnect to their results).
  • Symbol Bank tab complete (approve/reject/skip, box adjust, keyboard a/r/s, progress): types incl. multi_position_ahu; "Other" β†’ custom type text persisted to analyzer_b/symbol_types.json and future dropdowns. Queue analyzer_b/harvest/bank_queue.json (352 entries / 34 exemplars from Queens + 554 + 527); decisions in bank_decisions.json; approved crops β†’ analyzer_b/symbol_crops/<type>/ + symbol_library.json. User approved Queens+554 exemplars; 12 from 527 possibly still pending β€” check bank_decisions.json.
  • Track B dataset SHIPPED: analyzer_b/hvac_pipeline/build_dataset_typed.py β†’ C:\hvac_work\dataset_typed_v1 (949 tiles + 3368 flip-n-slide augmented; floor-level split; hard negatives; class 0=indoor_unit, ids 1–3 reserved; type-metadata sidecar) + C:\hvac_work\kaggle_upload_v1.zip (434.7 MB, REBUILT with POSIX zip paths β€” Kaggle rejects backslashes) + kaggle_run_v1.py (trains yolov8n COCO control vs yolov8n-doclaynet main; "YOLO26n" does not exist in ultralytics 8.4.54). User is uploading/running it on Kaggle T4 β€” expect back runs/{ctrl_yolov8n,main_doclaynet}/weights/best.pt.

4. IMMEDIATE QUEUE FOR THE NEXT SESSION (in order)

NEW as of 2026-07-09 (do these first β€” details in Β§0):

  • A. Finish the gold regression (Carroll/1326/23042 with thinking-fix, levers off) β†’ confirm no recall drop β†’ clears the thinking-fix β†’ PR #2 mergeable. Lewis already improved (60β†’73.3%).
  • B. Score 150 Lawrence (row 6) once the user reviews it (indoor-only). Then harvest.
  • C. Fable-as-proposer: get ANTHROPIC_API_KEY, run fable_propose.py on 1326 p1 / Carroll p13 / a dense floor (Carroll p8) / a clean floor β†’ measure real coordinate precision + $/floor β†’ decide if it becomes the Track-C proposer. This is the highest-upside open thread.
  • D. Then the queued precision work: verify crop-tightness (exact-seq reads were 18/38 β€” 1800px crop holds neighbor tags), schedule template-row parser, 1326-p1 dense-cluster diagnosis (unique-instance-label prompt test), Track C.

Historical DONE items (this + prior sessions) below for context:

  1. βœ… DONE 2026-07-07 β€” v31 scored (turned out a 2026-07-05 session had already scored it and logged to PLAN.md Β§4e; re-run reproduced identical numbers, Β§2 table updated, _v31_engine_frozen.py deleted). Original instructions kept below for the command pattern: outputs/_v31_lewis|_v31_carroll|_v31_1326|_v31_23042 hold 2/6/4/5 detection jsons. Per building:
    .\.venv\Scripts\python.exe analyzer_b\hvac_pipeline\run_render_failures.py `
      --pred "outputs\_v31_carroll" `
      --gold analyzer_b\ground_truth\_gold_417_carroll `
      --pdf  "raw_pdfs\23092024 - 417 CARROLL ST. - MECHANICAL.pdf" `
      --use-json --out "outputs\_failure_sheets\v31_carroll"
    
    (PDFs: 11 Lewis Ave HVAC Design - DOB 8-9-22.pdf β€” two spaces β€”, 1326 Mechanical Plans Received 2,5,2016(1) (2).pdf, New plan - 23042 - Mechanical(06.28.24).pdf.) Fill the Β§2 table, update PLAN.md Β§4e; expect 23042 recall to jump (solid-bar clause) and F1 β†’ β‰₯0.52. NOTE the v31 runs used the frozen snapshot analyzer_b/_v31_engine_frozen.py β€” delete it after scoring.
  2. βœ… DONE 2026-07-07 β€” task #10 shipped: script.js delete paths (button, Del/d key, delete-noise) now MARK action='delete', deleted=true instead of splice; drawEditor/boxAt/updateNoiseCount/approveAll skip deleted; save payload carries them; index.html bumped to ?v=15; review_mining.py mines corrections_log.csv result=deleted rows (deduped by page/id/x/y). Verified: py_compile + node --check pass; live mining run unchanged on existing data (no deleted rows exist yet). NOTE: no bulk-approve-yellows handler exists in script.js (server endpoint exists, frontend never calls it). Needs a hard-refresh + server restart to take effect. Original spec: already writes any action sent). In public/script.js: deleteSelBtn, Delete/d-key, and deleteNoiseBtn must MARK boxes (action='delete', deleted=true) instead of splice; drawEditor + boxAt + updateNoiseCount skip b.deleted; approveAllBtn must skip deleted; save then carries delete rows β†’ engine --apply-review records them in corrections_log.csv (the durable FP evidence β€” review CSVs get rewritten to survivors). Bump script.js?v= in index.html (currently 14). ALSO: extend review_mining.py to mine corrections_log.csv result=deleted rows (dedupe by page/id/x/y β€” the log appends per save) since CSVs lose delete rows after apply.
  3. βœ… DONE 2026-07-07 β€” E082 reviewed by user + scored: ledger row 4 = 100% recall / 29.7% precision (38 real, 90 deleted, 0 added). Tiers: green 9/9, orange 4/4, noise 11/11 junk β€” auto-accept-green evidence now 4-for-4. Delete persistence worked live (90 delete rows). NEW LEVER DISCOVERED: per-floor sequential tag pattern (AC-10-1..31 / AC-C-1..6) β€” see Β§4 item 5 and error_taxonomy_notes. Harvest/bank-merge ran same day. Was: ⏳ RUN DONE 2026-07-07, AWAITING USER REVIEW β€” E082 first-contact executed on p13 (Cellar) + p18 (10th Fl), $1.74, out dir = GUI stem dir outputs\20260415-E08201001-... (NOT _fc_e082 β€” classify artifacts copied over so the GUI reconnects; _prereview/ snapshot taken). p13 = 39 boxes, p18 = 89 boxes. After her review: score via review_mining β†’ ledger row 4 β†’ harvest + bank merge. Original spec: First-contact on "20260415-E08201001-Mechanical_100% Construction Documents.pdf" (never analyzed; 2026-era set). CLASSIFY IS DONE (2026-07-07): the new title reader found 30 plan pages of 46, every floor named, multi-floor sheets auto-detected (p16 "6TH-8TH TYPICAL" Γ—3, p23 "16TH-17TH" Γ—2, piping twins p30/p37). ⚠ NEW STRUCTURAL PATTERN: duplicate floor series β€” every floor appears TWICE: a DUCTWORK plan (M-5xx, pages 13–26) AND a PIPING plan (M-6xx, pages 27–40), plus a stray M-219 "19TH" (p6). Counting units across both series would DOUBLE the building; the pipeline has no concept of this yet. The product eventually needs series de-duplication or user series selection. RECOMMENDED first-contact pages: p16 (6TH-8TH ductwork Γ—3 β€” typical + exercises F7) and p32 (10TH piping) β€” one per series also reveals which series carries the unit tags, informing the de-dup design. Manifest ready β†’ check outputs/_fc_e082/classify_log.txt + pages_manifest.csv. Pick 2 plan pages (one typical + one dense/weird), run v31 ship config:
    $env:HVAC_TILE_WORKERS='12'; $env:HVAC_FAST_OCR='1'; $env:HVAC_VERIFY_DEBUG='1'; $env:PYTHONIOENCODING='utf-8'
    .\.venv\Scripts\python.exe analyzer_b\analyze_blueprint_b.py "raw_pdfs\20260415-E08201001-Mechanical_100% Construction Documents.pdf" `
      --pages "<p1>,<p2>" --dpi 300 --tile-size 1800 --runs 2 --consensus 2 `
      --all-tags --recall-prompt --no-yolo -y --out-dir "outputs\_fc_e082"
    
    (~$2). BEFORE the user reviews: snapshot the pre-review CSVs (copy floor_*_review.csv to a _prereview/ subdir) so deletes are reconstructable until #2 lands. User verifies in the GUI β†’ score with review_mining logic β†’ ledger row 4 β†’ then harvest (harvest_review_crops.py --pdf ... --reviews ...) + prep_bank_candidates --csv <new harvest csv> --out <temp> + append-merge into bank_queue.json (see the merge snippet pattern in this session: namespace colliding ids).
  4. βœ… DONE 2026-07-07 β€” KILL-SWITCH FIRED: Track B shelved (pending user sign-off). Gold tile set built (build_gold_tiles.py β†’ C:\hvac_work
    gold_tiles_v1, 3,136 tiles, 245/245 GT sanity-checked, overlay-verified). bench_detectors on both Kaggle checkpoints (best_ctrl_yolov8n.pt / best_main_doclaynet.pt in C:\hvac_work), center-match, imgsz 1024:
    model R@.25 P propR@.05 propFP
    ctrl_yolov8n 0.14 0.34 0.20 530
    main_doclaynet 0.05 0.07 0.14 967
    vs same-corpus Kaggle holdout 0.94/0.98 β†’ catastrophic cross-building
    generalization cliff, NOT a harness bug (labels sanity-checked; models
    simply don't fire on unseen drafting styles). Per-tile scoring double-
    counts overlap-tile GT (430 tile-instances of 245 units) so unit-level
    propR might reach ~0.3 with SAHI fusion β€” still nowhere near the 0.85
    kill-switch. **Track C falls back to "Gemini proposes, Flash
    patch-verifies"** per plan. Retraining with much more data (public
    datasets + auto-labeled own plans, per recalibration memory) is the only
    revival path β€” not this sprint. Original spec:
    When the user delivers Kaggle weights (best.pt Γ—2, likely in
    C:\hvac_work): score proposal-recall on gold β€”
    `bench_detectors.py --model "name=path\best.pt" --center-match
    --proposal-recall` with a YOLO-format gold test set (may need building
    gold tiles first β€” check bench_detectors --test-images expectations).
    Kill-switch: proposal-recall@0.05 < ~0.85 β†’ shelve B; C falls back to
    "Gemini proposes, Flash patch-verifies".
  5. LEVER STATUS 2026-07-08: implemented (tag_pattern.py + engine _apply_review_burden_levers + replay_demotion_rules.py; 37 unit tests pass) but replay gate FAILED on E082: danger=17 β€” Lever A's local-OCR re-read fails on exactly the labels live snap already failed on (rescued=0), so demote-on-failed-reread graybins real units. Both levers flipped to OPT-IN (HVAC_TAG_PATTERN=1 / HVAC_ADAPTIVE_UNKNOWN=1 to enable; default OFF). Upside real: 65 junk pre-demoted on E082. Fix path: (1) βœ… DONE 2026-07-08 β€” crop bench (verify_crop_bench.py) DISPROVED anchor-echo; REAL bug = Gemini-2.5 thinking-ON truncates the 512-tok verify JSON before tag_text β†’ engine keeps the schedule-echo guess. Bench/38 units: thinking OFF 38/38 family-token, 18/38 exact, 0/28 echoed; thinking ON 0/38. FIXED thinking_budget=0 on _refine_hit_box + title reader (HVAC_VERIFY_THINK=1 restores); kept anchor prompt. E082 re-run validation β†’ outputs_e082_thinkfix. Next: re-run replay β†’ Lever A danger should collapse (correct tags ground before levers) β†’ un-bench Lever A. (2) verify_debug still logs only boxes/outcome, add tag_text/unit_present; (3) similarity-score protection before demotion; (4) exact-seq reads 18/38 β€” 1800px crop holds neighbor tags, TIGHTEN verify radius; (5) Flash-Lite A/B on the bench; (6) title reader needs re-verification (same fix, no bench). LEVER B ISOLATED REPLAY (2026-07-08): danger=0 on ALL 17 pages / 945 boxes (win=51). SHIPPED default-ON (HVAC_ADAPTIVE_UNKNOWN=0 to disable); Lever A stays opt-in. Follow-up: replay inert column shows 1 on every page yet win>0 on some β€” display/accounting inconsistency, verify win magnitudes before trusting them (danger=0 is trustworthy: harness cleanly split A's 17 vs B's 0). Then, in order: (a0) schedule TEMPLATE-ROW parser (user-identified on E082's schedule: designation "AC-FLOOR-#" = explicit per-floor tag grammar
    • uniform wall-mounted model/capacity; parse placeholder designations into a tag_template cache entry β†’ per-page wanted-tag prefixes for snap + verify + pattern-lever seeding + type/capacity metadata; kills the AC-A schedule-echo at the source β€” full design in error_taxonomy_notes.md); (a) tag-pattern conformance lever (NEW, from E082: mine grounded tags per page for <FAM>-<floor-token>-<seq> patterns; when β‰₯3 grounded tags fit β†’ demote non-conforming yellows/UNKNOWN to gray, keep/boost conforming, and report sequence GAPS as possible-miss flags β€” on E082 p18 this alone would have cut yellows ~75% and flagged the AC-10-21 gap); (b) adaptive-UNKNOWN rule (E082 adds UNKNOWNΓ—37 deleted / 0 kept evidence); (c) "covers floors N-M" GUI input; (d) Track C cascade assembly (Gemini proposes + Flash patch-verifies β€” YOLO proposer is dead per item 4); bake-off = A vs C.

5. ENVIRONMENT GOTCHAS (read before running anything)

  • Windows 11, PowerShell (no &&; backtick continuation; quote spaced paths; multi-line python -c after ; fails β€” write scratchpad .py files). Engine output piped through Select-Object may exit 255 benignly β€” redirect to a log file instead (*> log.txt).
  • Engine python: .venv\Scripts\python.exe. GUI server: SYSTEM python (python server.py, port 8000, browse http://localhost:8000 β€” NOT 0.0.0.0). Split is intentional.
  • After editing public/: bump script.js?v=N in index.html + hard-refresh. After editing server.py/modules/: restart the server.
  • Heavy IO β†’ C:\hvac_work (OneDrive Errno 22), foreground.
  • .env has GEMINI_API_KEY (monthly cap raised) + OPENROUTER (small daily cap). ⚠ Repo root junk HVAC-Blueprint-Analyzer* (U+F05C filenames) includes a stray .env with LIVE keys (GROQ/FEATHERLESS possibly unique) β€” gitignored; do NOT delete without the user; NEVER git add.
  • Git: everything is uncommitted and a STALE .git/index.lock from 2026-07-01 blocks writes. User paused committing ("hold off on git") β€” when she asks: remove the stale lock (verify no git process first), git add -A, scan staged for .env|pdf|png|zip|pt, commit with the Claude co-author trailer.
  • Session limits kill background agents/runs silently β€” on any resume, VERIFY artifacts (not reports) before assuming work landed.
  • Costs: full-page detection ~$0.35–0.90/page; 2-page first-contact ~$1–2; gold sweep ~$10–15; Flash title reads ~$0.01/page. Log in PLAN.md.
  • Detection caches: re-running WITHOUT --refresh-detections reuses per-floor caches (free). The GUI reuses caches too β€” 527's "first contact" accidentally measured June's cache; NOTE the config in every ledger row.

6. FILE MAP

  • PLAN.md β€” operative plan + progress log (Β§4b–4g) + costs. Source of truth.
  • analyzer_b/analyze_blueprint_b.py β€” THE engine (GUI runs it via modules/pipeline.py ENGINE). Key fns: _detection_prompt_inclusive, _refine_hit_box, _qwen_verify_refine, _schedule_quarantine, _local_ocr_snap + _match_wanted_tag, _review_status, _dedupe_cross_location, _parse_floors_covered, _ocr_titleblock_text, _sheet_number_from_text, _llm_titleblock_title, _UNINFORMATIVE_TITLE, _nonindoor_family demotion at final-assembly.
  • analyzer_b/versions.py β€” config registry; v30_inclusive = ship knobs (v31 = same knobs + current prompts; prompts live in the engine).
  • analyzer_b/hvac_pipeline/ β€” review_mining.py (is_human_verified = THE shared human-touched rule), harvest_review_crops.py, prep_bank_candidates.py, run_render_failures.py (gold scorer), ab_guardrails.py, bench_detectors.py, build_dataset_typed.py, flip_n_slide.py, error_taxonomy.py.
  • analyzer_b/results/ β€” first_contact_ledger.csv (PRODUCT METRIC), error_taxonomy_notes.md, review_mining.csv, LEADERBOARD.md (OLD tuning-set numbers, don't trust for generalization).
  • analyzer_b/harvest/ β€” fp_crops/, bank_candidates/, bank_queue.json, bank_decisions.json, harvest_*.csv, contact sheets.
  • modules/pipeline.py β€” DEFAULT_RECIPE (recall_prompt: True = ship), build_result (multi-floor expansion), _out_dir_for (uuid strip), _manifest_floor_info. modules/symbol_bank.py β€” bank backend.
  • server.py + public/ β€” FastAPI + frontend (Review tab: box editor, noise band; Bank tab). script.js cache-bust currently ?v=14.
  • outputs/<building>/ β€” review CSVs (human edits live here; apply-review rewrites them to survivors), detections.json (rewritten on apply too!), corrections_log.csv (DURABLE human-decision record), pages_manifest.csv (now with floors_covered/floors_list/sheet_no), schedule cache.
  • raw_pdfs/ β€” ~24 buildings. Verified: Queens, 554 W 46th, 527 Grand. Next candidates: E08201001 (in flight), 5 Withers, 150 Lawrence (note: those two have June-era caches β€” fresh --refresh-detections runs needed for v31 ledger rows). Skip 270 Bergen fragments + 355/Dean.

7. WHAT THE USER DOES (never do these for her)

  • Verify boxes (first-contact reviews, bank approvals). No score is real until she confirms. Her conventions: box = unit body + tag when adjacent (body only on leader-callout plans); product boxes need not be pixel-tight, training boxes should be.
  • Kaggle GPU runs (in progress β€” kaggle_upload_v1.zip; steps: attach dataset, GPU T4, Internet ON, paste kaggle_run_v1.py, set INPUT slug line, Run All; bring back both best.pt + printed recalls).
  • Decisions: git commits, junk-dir deletion, ship sign-offs, big spends.
  • Pending user follow-ups she flagged: wall-mounted units exist on 554's unreviewed pages (review one page later for type diversity in training); 12 bank exemplars from 527 may be pending approval.