Skip to content

About

APHAN Reonic — Site Visit Copilot. Offline capture, evidence-based checklists. Big Berlin Hack 2026, Yang and Sascha.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

APHAN – Site Visit Copilot for Reonic (BBH 2026)

APHAN turns unsorted site-visit photos, handheld walkthrough videos, and customer conversations into a completed, evidence-grounded Reonic checklist—flagging contradictions between what the homeowner said and what the camera saw, quantifying installation risks in euros, and requesting missing photos before a second site visit is needed. Built for the Reonic track at Big Berlin Hack 2026, the live extraction, deterministic verifier, and Euro Risk Radar run schema-agnostically across any Reonic checklist template while enforcing strict guardrails so the AI never guesses behind sealed covers or fabricates citations.

Try It — No API Keys Needed

Hackathon project from Big Berlin Hack 2026 (BBH), 28–29 November 2026. Judging is over.

  • Public demo: aphan-reonic.onrender.com shows labelled offline demo snapshots. The live-AI judge access used during BBH judging has been switched off. Works on phone and laptop; open it in Safari/Chrome, not inside a messenger's in-app browser.
  • No keys in the browser: all partner keys (Gemini, Gradium, Tavily, Vonage, ClickHouse) live only as server-side environment variables on the host. The browser never sees them.
  • First open can take ~50 s: the free Render instance sleeps after 15 min idle. After waking, the server pre-warms the five demo cases TC-01–TC-05 so their checklists load fast.
  • Honest labels: results analysed by Gemini show Live. If the AI is unavailable, the UI says Demo (ohne KI) / Demo-Modus · ohne KI and falls back to the rule-based demo matcher. We never present demo output as live AI.
  • 2-minute demo video: youtu.be/_U6mYYKr9IU · Aikido report: see Aikido Security Report.
  • Run it yourself: see Setup (Node 24+, npm ci && npm start; works without keys in demo mode).

Live Studio UI Preview (Synthetic Cases TC-04 & TC-03)

Side-by-Side Conflict Resolution (Live · TC-04) Tight box_2d Evidence & Euro Risk Radar (Live · TC-03)
APHAN Live TC-04 side-by-side hot-water conflict resolution APHAN Live TC-03 Diazed meter cabinet box_2d and Euro Risk Radar

1. The Problem

Installer capacity—not customer demand—is the primary bottleneck of the residential energy transition (65,301 open positions in the German electrical trades in early 2026, ZVEH), and every hour a consultant or planner spends manually transferring site-visit photos and notes into checklists is an hour lost on installations. Worse, overlooked details during the first visit—such as an outdated wooden meter panel with screw fuses, an undersized 3x 35A house connection box with heat pump + wallbox load, or a corrugated fibre-cement roof with potential asbestos (no mounting or covering allowed under § 11 GefStoffV / TRGS 519)—routinely trigger installation-day stops or a second site visit. In a 2026 analysis of 160 heat-pump offers by Verbraucherzentrale Rheinland-Pfalz, the meter-cabinet upgrade had a median cost of 2,966 € (across the 34 offers listing it as an itemized position) and was missing from 46 % (73 of 160) of the offers. Existing survey tools either capture photos without cross-checking the conversation or transcribe voice notes without grounding answers in typed checklist schemas and visual evidence.


2. What It Does

Following the 4-act workflow from the Reonic challenge brief:

  1. Act 1 — A visit happens (Guided Capture, Walkthrough Video & On-Site Triage): The consultant captures site-visit photos or a walkthrough video with live camera feedback (POST /api/live-frame: 6 building-component SVG stencils, video QR-style green flash with pan-speed guidance, and strict e-scooter-style photo verification), imports unsorted photos, a pre-consented meeting transcript, a solo on-site voice note, or a handheld walkthrough video (POST /api/video-ingest extracts sharp keyframes and transcribes the soundtrack). Local quality checks work 100% offline in basements to flag blurry or dark captures immediately, and a hands-free Gradium TTS warning (Anton) alerts the consultant before leaving if a mandatory photo (such as the house connection box) is missing.
  2. Act 2 — The checklist fills itself (Schema-Agnostic Extraction & Evidence): A 5-stage pipeline processes any Reonic checklist schema (Radio, Checkbox, Freetext, Image, Signature, Title, including multi-part Image items and conditionalAction visibility rules). Photos snap into their matching upload slots, and every filled field is linked to a tight component 2D bounding box (box_2d, with an automatic > 76% whole-image guard) and/or a verified verbatim quote from the transcript.
  3. Act 3 — Gaps, conflicts, and euro risks (4-Class Inconsistency Review & 1-Click Follow-Up): The planner filters for actionable items (conflict, missing, needs_human). Side-by-side conflict cards surface all 4 inconsistency classes—photo-vs-transcript (including Freetext serial numbers/dimensions), photo-vs-photo (e.g., two different roofs or electrical panels), transcript-vs-transcript (changing statements across a visit), and cross-field technical contradictions (e.g., denying existing PV despite an 800 W balcony plant & 2.8.0 register)—for one-click human resolution that survives re-runs (humanEdited: true). An 18-rule schema-agnostic Euro Risk Radar quantifies installation-day cost surprises with configurable DACH guideline ranges (costBasis, anchored to Verbraucherzentrale RLP 2026 for meter cabinets) and live regulatory citations via Tavily. Missing photos can be requested from the homeowner via SMS with 2FA verification and automatic upload quality checks.
  4. Act 4 — How we know it works (9-Case Ground-Truth Evaluation, Analytics & Schema Switch): An integrated evaluation runner benchmarks the pipeline against 9 synthetic site-visit test cases with pre-defined ground-truth checklists (TC-01–TC-09, 171 scored fields, 46 generated photos) and persists run telemetry and aggregated accuracy/risk analytics in ClickHouse (GET /api/analytics/summary). Switching schemas live (from Reonic's official h360Offer PV + Heat Pump template to a Wallbox/Electrical schema) demonstrates schema-agnostic extraction and verification.

Core Features

  • F1 · 5-Stage Schema-Agnostic Pipeline (src/pipeline/analyze.ts, src/pipeline/schema.ts, server/gemini-hooks.ts): Dynamically parses Reonic checklist trees (checklist.example.en.json and custom templates) without hardcoding field UUIDs in live extraction, verification, or risk rules.
  • F2 · 4-Class Inconsistency Engine & Evidence-Grounded Review (src/pipeline/verifier.ts, src/domain.ts): Detects photo-vs-photo, transcript-vs-transcript, photo-vs-transcript (incl. Freetext), and cross-field contradictions; pairs tight visual box_2d boxes (normalizeComponentBox2d) with timestamped verbatim transcript quotes and preserves human edits across re-runs via mergeProposals().
  • F3 · 18-Rule Euro Risk Radar with Live Regulatory Citations (src/pipeline/risk-radar.ts, server/partners/tavily.ts): Schema-agnostic technical & commercial blocker detection (MC_FULL_REPLACEMENT_MANDATORY, MAIN_FUSE_BOTTLENECK_DIVERSITY, ASBESTOS_SUSPECT, SCAFFOLDING_COMPLEX, MISSING_ELECTRICAL_EVIDENCE, POOR_PHOTO_QUALITY_BLURRY, CONFLICT_HOT_WATER_SUPPLY, WP_NOISE_NEIGHBOR_CLOSE, HIGH_MOUNTING_EFFORT_BEAVER_TAIL, HERITAGE_PROTECTION_PERMIT, NARROW_PASSAGE_INDOOR_UNIT, SEALED_HAK_UNREADABLE, plus inconsistency flags—all carrying explicit costBasis) with configurable DACH EUR ranges and live norm lookups (VDE-AR-N 4100, § 14a EnWG, TRGS 519, TAB Niederspannung, VDI 4645, TA Lärm).
  • F4 · Guided Camera, Video/Voice & Remote 2FA Gap Closing (server/live-frame-check.ts, server/partners/gradium.ts, server/video-ingest.ts, server/partners/vonage.ts): Guided mobile camera with live camera feedback (POST /api/live-frame: SVG component stencils, video QR-flash check-off, strict online photo verify, 100% offline local blur/light check), parallel-chunked Gradium STT with silence gating, sharp keyframe extraction from handheld video, hands-free German TTS departure warnings (Anton), and 2FA-protected SMS follow-up requests with JPEG sharpness verification on customer uploads.
  • F5 · 9-Case Synthetic Ground-Truth Benchmark & ClickHouse Analytics (src/pipeline/eval.ts, data/test-cases/, server/partners/clickhouse.ts): Nine end-to-end test cases (TC-01–TC-09, 171 fields, 46 reproducible Gemini-generated photos) built Ground Truth First, automated scoring by item type, and live ClickHouse SQL aggregations.

3. Pipeline Design

flowchart LR
  In["Site Visit Input<br/>Photos / Video Stills + Transcript + Reonic Schema"] --> V["Steps 1 + 2 (Combined Parallel Vision Call)<br/>1-photo-triage & 2-photo-facts-box2d<br/>Gemini 3.8 Flash"]
  In --> S3["Step 3 (Parallel Transcript Call)<br/>3-transcript-quotes<br/>Gemini 3.8 Flash"]
  V -->|Slot assignments, quality issues,<br/>visual facts, tight box_2d & hazardTags| S4["Step 4: 4-crosscheck-verifier<br/>Deterministic TypeScript"]
  S3 -->|Candidate quotes + verifyQuoteIsVerbatim| S4
  S4 -->|Validated items & hazard tags| S5["Step 5: 5-euro-risk-radar<br/>Rule Engine + Parallel Tavily Lookup"]
  S5 --> Out["SiteVisitPipelineResult<br/>Grounded Checklist + Risks + Step Trace"]
Loading

Pipeline Stages (steps[] in SiteVisitPipelineResult)

Step ID (steps[].step) Mode / Model Input → Output
1-photo-triage live-gemini (gemini-3.8-flash, thinkingLevel: LOW, MEDIA_RESOLUTION_MEDIUM) or deterministic Runs in a single combined Vision pass together with Step 2 (in parallel with Step 3); assigns matching Image slot IDs via compact alias codes (P1..Pn → SLOT1..SLOTk), flags quality issues (blurry, too_dark, closed_cover, obstructed), and emits focusBox2d.
2-photo-facts-box2d live-gemini (gemini-3.8-flash, thinkingLevel: LOW, MEDIA_RESOLUTION_MEDIUM) or deterministic Extracts visual answers for non-image checklist items in the same Vision pass, returning tight component 2D bounding boxes (box_2d: [ymin, xmin, ymax, xmax] in 0..1000), closedOrUnreadable flags, and domain hazardTags.
3-transcript-quotes live-gemini (gemini-3.8-flash, thinkingLevel: LOW) or deterministic Runs in parallel with Vision; extracts spoken facts mapped to checklist options alongside an exact character-for-character substring (verbatimQuote) and segment ID (S1..Sm).
4-crosscheck-verifier deterministic (src/pipeline/verifier.ts, src/pipeline/analyze.ts) Evaluates conditionalAction visibility, runs 4-class inconsistency detection (photo-vs-photo, transcript-vs-transcript, photo-vs-transcript incl. Freetext, and cross-field), verifies quotes verbatim (verifyQuoteIsVerbatim), enforces tight box_2d (> 76% area → wholeImage: true), and assigns filled, missing, conflict, or needs_human.
5-euro-risk-radar live-tavily (server/partners/tavily.ts) + deterministic rule engine (src/pipeline/risk-radar.ts) Evaluates extracted hazard tags, conflicts, and critical checklist fields against 18 schema-agnostic risk rules (costBasis on every risk), computing configurable DACH EUR ranges (totalRiskMinEur–totalRiskMaxEur) and attaching parallel live regulatory citations via Tavily (3.5 s cap + fallback).

Evidence Grounding & Deterministic Verifier Guardrails

Rather than trusting a single monolithic prompt, src/pipeline/verifier.ts enforces strict post-LLM invariants on every item:

  • Tight visual component grounding (box_2d + whole-image guard): Every photo-backed claim references an actual visit photo ID and carries a clamped [ymin, xmin, ymax, xmax] bounding box (0..1000). normalizeComponentBox2d() automatically discards degenerate or oversized frames covering > 76% of the image area and marks them wholeImage: true so the UI never draws fake full-photo rectangles.
  • Verbatim quote verification (verifyQuoteIsVerbatim): Every transcript-backed claim is checked deterministically against the normalized text of the referenced transcript segment. Paraphrased, truncated, or hallucinated quotes are rejected (verbatimVerified: false) and stripped before item status resolution.
  • Short-alias UUID protection (server/gemini-hooks.ts): Reonic's 36-character item and part UUIDs are mapped to compact aliases (P1..Pn, F1..Fm, SLOT1..SLOTk, S1..Sj) inside model prompts and mapped back deterministically in code, eliminating UUID transcription typos and cutting prompt tokens by >60%.
  • 4-class inconsistency detection (src/pipeline/verifier.ts):
    1. photo-vs-photo: contradictory visual facts across multiple photos of the same site (e.g., modern sub-panel vs. old Diazed board, or two roof types across main house and annex).
    2. transcript-vs-transcript: homeowner reverses or contradicts an earlier statement during the same visit (with a guard so a consultant's visual override on site, as in TC-03, is respected rather than falsely flagged).
    3. photo-vs-transcript: visual evidence disagrees with a verified transcript quote—including Freetext fields such as meter serial numbers and access dimensions.
    4. cross-field: technical/commercial contradictions spanning multiple fields (e.g., existing PV denied despite an 800 W balcony PV / 2.8.0 feed-in register, solar thermal denied despite roof collectors, narrow cellar access < 70 cm / < 185 cm, heritage protection, or sealed HAK).
  • Four explicit item statuses (filled | missing | conflict | needs_human):
    • filled: Supported by at least one verified photo (box_2d or wholeImage) or verified verbatim quote, and—for Radio/Checkbox—exact match against the schema's allowed options (mapped to selectedPartIds).
    • conflict: Verified sources disagree (photo-vs-transcript, photo-vs-photo, transcript-vs-transcript, or cross-field). Both sides and their evidence objects are preserved for one-click planner resolution.
    • missing: Required field or mandatory Image slot with no verified evidence. Always enforced to value: [] and confidence: 0 (0% hallucination on missing fields).
    • needs_human: Optional field without evidence, Signature field (never auto-signed), unreadable/blurry/too-dark capture, value hidden behind a sealed cover (closedOrUnreadable: true), explicit homeowner uncertainty ("Not sure"), or an LLM proposal outside allowed schema options. Degrades safely to value: [] rather than guessing.

4. Partner Technologies

We integrate 6 hackathon partner technologies across the server pipeline, guided camera, evaluation/analytics workflow, and security process:

Partner What we use it for Implementation file(s)
Google DeepMind (Gemini) Parallel multimodal site-visit analysis (gemini-3.8-flash with thinkingConfig.thinkingLevel = "LOW" and MEDIA_RESOLUTION_MEDIUM, SHA-256 disk cache in .cache/gemini/, combined single-pass Vision triage + box_2d facts + parallel transcript quotes), fast live camera feedback (POST /api/live-frame with thinkingLevel = "MINIMAL" for video QR check-off & strict photo verification), guarded audio fallback when Gradium STT is unavailable, plus reproducible generation of all 46 synthetic test photos. server/partners/gemini.ts, server/gemini-hooks.ts, server/live-frame-check.ts, data/test-cases/generate.mjs
Gradium Voice AI in both directions. STT (POST https://api.gradium.ai/api/speech/asr, word timestamps, de default) transcribes solo voice notes and walkthrough video soundtracks, splitting audio >24 s at quiet points into up to 3 parallel chunks; a pre-STT speech-level gate blocks silent audio from reaching any model. TTS (https://api.gradium.ai/api/speech/tts, German voice Anton 3ZKKapPOvuWFcw9f with rewrite_rules: "de", temp: 0.25, acronym expansion) speaks hands-free basement departure warnings. server/partners/gradium.ts, server/media.ts, server/video-ingest.ts
Tavily Live regulatory and technical norm search (https://api.tavily.com/search) with parallel lookup, in-flight deduplication, and 3.5 s timeout enriching Euro Risk Radar flags with current citations for VDE-AR-N 4100, § 14a EnWG, TRGS 519, TAB Niederspannung, VDI 4645, and TA Lärm / R290. server/partners/tavily.ts, src/pipeline/risk-radar.ts
Vonage Outbound SMS follow-up requests (https://rest.nexmo.com/sms/json) asking the homeowner to supply a missing photo (e.g., HAK), paired with a 6-digit single-use 2FA verification flow (verifyCustomerFollowUp2FA using crypto.timingSafeEqual), strict SMS_REDIRECT_TO safety redirection, and automatic JPEG sharpness verification on uploaded follow-up photos (/api/customer-request/upload). server/partners/vonage.ts, server/index.ts
ClickHouse Persisting site-visit telemetry (reonic_visit_runs, fire-and-forget so cloud wakeups never stall /api/analyze) and benchmark scorecards (reonic_eval_runs) in ClickHouse Cloud (MergeTree), plus live SQL aggregation analytics (GET /api/analytics/summary: totals, averages, conflict/risk rollups grouped by schema & mode). server/partners/clickhouse.ts, server/index.ts
Aikido Continuous SAST, secret, dependency and AI-code-analysis hardening throughout development: Aikido repo scan on team after the final security fixes (29.11.2026, PRs #51 & #53): 0 Critical / 0 High / 0 Medium / 0 Low. Starting point was 0/0/10/1 with 27 AI-analysis sub-findings; every finding was fixed in code and closed by Aikido retests (PRs #30–#42) — nothing manually resolved; the 17 ignored groups are listed with reasons in Aikido Security Report. .github/workflows/check.yml, server/security.ts

5. How We Tested

Because real site-visit photos and recordings contain personal data under GDPR, Reonic's official challenge dataset provides unlinked sample images and transcripts plus checklist.example.en.json. Following §4 and §9 of the challenge brief, we built 9 complete, synthetic site visits (TC-01 to TC-09) using a Ground Truth First methodology: we authored expected.json against the exact UUIDs of Reonic's h360Offer template (171 scored fields), planted domain and multi-source inconsistency traps, and then generated matching transcripts (transcript.json) and 46 realistic site-visit photos (data/test-cases/generate.mjs).

Synthetic Ground-Truth Test Suite (data/test-cases/)

Case Folder Scenario Photos Planted Traps & Edge Cases Expected Core Outcomes & Flags
TC-01 TC-01-happy-path/ Modern detached house (built 2014), 10–15 kWp PV + heat pump 7 Clean baseline reference; Signature fields must remain needs_human with value: [] All 19 factual items filled (Frankfurt pan tile, Meter cabinet replacement: No, 1ESY1161448201, Hot water storage tank, 10-20 m), STANDARD_MOUNTING_AND_MODERN_ELECTRICS
TC-02 TC-02-asbestos-roof/ Detached house (built 1978) with grey corrugated fibre-cement roof + conservatory under south eaves 5 1) Suspected pre-1993 Eternit asbestos roof (§ 11 Abs. 3 GefStoffV / TRGS 519 drilling/overcovering ban)
2) Conservatory blocks south scaffolding area
Tile type: Other, Can scaffolding be put up?: No, Meter cabinet replacement: No; High flags: ASBESTOS_SUSPECT, SCAFFOLDING_COMPLEX
TC-03 TC-03-old-meter-cabinet/ Detached house (built 1968), 1994 oil boiler, 7–10 kWp PV + heat pump + 11 kW wallbox 6 1) Homeowner believes electrics are fine, but photo shows 1960s wooden/bakelite board with Diazed screw fuses and Ferraris meter (74829103)
2) Old cast-iron HAK rated at 3x 35A (bottleneck for HP + 11 kW wallbox)
Photo overrides homeowner guess: Meter cabinet replacement: Yes, Meter change needed?: Yes, Tile type: Pantile, § 14a EnWG Module 1 + EEBUS (digital); High flags: MC_FULL_REPLACEMENT_MANDATORY, MAIN_FUSE_BOTTLENECK_DIVERSITY
TC-04 TC-04-hot-water-conflict/ Semi-detached house (built 2003), 5–7 kWp PV + heat pump, Flat tile 6 1) Direct DHW contradiction (photo-vs-transcript): homeowner claims only a small instantaneous heater under the kitchen sink, basement photo shows gas boiler with 160 L hot water storage tank
2) Neighbour setback < 5 m (3.5 m)
How is hot water supplied? set to status: "conflict" with both evidences attached; Distance: < 5 m; High flags: CONFLICT_HOT_WATER_SUPPLY, WP_NOISE_NEIGHBOR_CLOSE
TC-05 TC-05-gaps-and-blurry/ Detached house (built 1988, Beaver tail tiles), newly moved in, basement partially blocked 4 1) Missing service connection box (HAK) photo
2) Only meter cabinet photo (03_meter_cabinet_blurry.jpg) is severely out of focus (detected physically via JPEG SOF0 bpp)
3) Zero hallucination check
Photo of the service connection box → missing ([]); blurry meter cabinet flagged needs_human, meter number stays missing (not guessed); High/Medium flags: MISSING_ELECTRICAL_EVIDENCE, POOR_PHOTO_QUALITY_BLURRY, HIGH_MOUNTING_EFFORT_BEAVER_TAIL
TC-06 TC-06-transcript-contradictions/ Row house (built 1936), pure conversational contradictions 4 transcript-vs-transcript across 4 fields: heritage protection (No → ensemble protection Yes), PV target (10-15 → 5-7 kWp), ownership (Owner → land register father Not the owner), meter number (1EMH0055112233 vs. ...9988) All 4 fields flagged status: "conflict" (transcript-vs-transcript) with both verbatim quotes attached; High flags: INCONSISTENCY_TRANSCRIPT_CONTRADICTION, HERITAGE_PROTECTION_PERMIT
TC-07 TC-07-photo-contradictions/ Detached house (built 1982) + garage annex + two facades + two electrical boards 6 photo-vs-photo across 3 fields: main roof Frankfurt pan tile vs. annex corrugated asbestos Other; open east facade vs. south conservatory; modern ground-floor sub-panel vs. old cellar Diazed wooden panel All 3 fields flagged status: "conflict" (photo-vs-photo) with both photos attached; High flags: INCONSISTENCY_PHOTO_CONTRADICTION, ASBESTOS_SUSPECT, SCAFFOLDING_COMPLEX, MC_FULL_REPLACEMENT_MANDATORY
TC-08 TC-08-cross-field-and-narrow-access/ Existing home (built 1974), solar-thermal contradiction, forgotten balcony PV & narrow cellar access 4 1) photo-vs-transcript: solar thermal denied while roof photo shows 2 flat-plate collectors
2) cross-field: existing PV denied despite 800 W balcony PV & 2.8.0 feed-in register
3) Narrow cellar door 62 cm × 178 cm / stairs 65 cm
Solar thermal & existing PV set to conflict; access dimensions filled; High flags: CONFLICT_SOLAR_THERMAL_EVIDENCE, INCONSISTENCY_CROSS_FIELD, NARROW_PASSAGE_INDOOR_UNIT
TC-09 TC-09-sealed-hak-dark-cellar-uncertain/ Unlit dark cellar, sealed HAK with no amperage imprint, uncertain homeowner 4 1) Pitch-dark meter cabinet photo (too_dark)
2) Sharp photo of sealed HAK without ampere rating (closedOrUnreadable)
3) Homeowner explicitly uncertain ("Not sure") + missing measurements + empty whitespace transcript segment
Dark meter photo → needs_human, replacement → Not sure (needs_human), meter number & setback → missing (0% hallucination), HAK photo → filled; Flags: POOR_PHOTO_QUALITY_BLURRY, SEALED_HAK_UNREADABLE

Measured Live Results (TC-01–TC-09, Committed Snapshots & Walkthrough Video)

  • Full 9-case benchmark (TC-01–TC-09, 171 scored fields against Reonic h360Offer schema, measured 28.11.2026):
    • Deterministic (npm run eval:deterministic): 100.0% field accuracy (171/171), 100% flag recall (21/21), 100% conflict recall (10/10), 0% hallucination on missing fields.
    • Live Gemini (gemini-3.8-flash, --no-cache, uncached): 98.8% field accuracy (169/171), 100% flag recall (21/21), 100% conflict recall (10/10), 0% hallucination on missing fields. Re-measured uncached on 29.11.2026 (team 8c885c9, 85 s for all 9 cases) against the ground truth tightened in PR #37 (13 multi-part photo items whose part photos are all required in the Reonic checklist): again 169/171. The two misses: TC-03 heat-pump distance flagged as a conflict (< 5 m vs. expected 5-10 m) and TC-08 roof photo left missing instead of needs_human.
  • Automated unit, pipeline, verifier, security & voice/video test suite (npm test): 186 passing, 1 skipped, 0 failing; full suite including UI, camera-guide, spoken-answer & persistence tests (tests/*.test.ts tests/pipeline/*.test.ts): 424 passing, 1 skipped (Windows symlink test), 0 failing (29.11.2026).
  • Committed unedited live snapshots (mode: "live-gemini", gemini-3.8-flash + live Tavily citations):
    • TC-03-old-meter-cabinet/live-result.json (16.2 s uncached): 36 items filled, 0 false conflicts, tight component box_2d boxes (Diazed fuse row 7.3% area, HAK 23.5% area), both expected high-risk flags triggered (MC_FULL_REPLACEMENT_MANDATORY 2,500–4,500 € + MAIN_FUSE_BOTTLENECK_DIVERSITY 1,000–3,000 € = 3,500–7,500 € DACH guideline range, both tavily-live), and all Signature items left empty (needs_human).
    • TC-04-hot-water-conflict/live-result.json (10.0 s uncached): 25 items filled, exact 1 conflict (How is hot water supplied?: photo ["Hot water storage tank"] with 12.0% tight tank box_2d vs. verbatim transcript ["Instantaneous water heater"]), both expected high-risk flags triggered (CONFLICT_HOT_WATER_SUPPLY 1,200–2,200 € + WP_NOISE_NEIGHBOR_CLOSE 600–1,600 € = 1,800–3,800 € DACH guideline range, both tavily-live).
  • Live handheld 30 s walkthrough video test (measured 28.11.2026): Moving 30 s 30 fps handheld basement clip with pan motion blur + German narration processed end-to-end through POST /api/video-ingest → POST /api/analyze in 19.1 s (11.4 s frame selection + live-gradium-stt, 7.6 s Gemini analysis); motion-blurred pan frames were skipped automatically and 8 sharp stills were extracted and assigned.
  • Live mobile camera test on physical iPhone (measured 28.11.2026): Guided viewfinder (POST /api/live-frame) tested over local HTTPS on iOS Safari; off-target object (trash bin) was strictly rejected (wrong_subject, red ✕), and on-target captures passed with green ✓.

Running the Evaluation & Tests

# Run unit, pipeline, verifier, security, and voice/video test suites:
npm test

# Run deterministic benchmark without API keys (works on a fresh public clone):
npm run eval:deterministic

# Run live benchmark (uses TC-01..09 when Reonic's checklist.example.en.json is unpacked locally,
# or built-in 5-case synthetic-fixtures on a fresh public clone without private Reonic data):
npm run eval

# Verify live connectivity for Gemini, Gradium (TTS + STT round trip), Tavily, Vonage, and ClickHouse:
npm run check:partners

6. Setup

Prerequisites

  • Node.js 24+ ("engines": { "node": ">=24.0.0" }, uses native --experimental-strip-types to run TypeScript directly for the server and tests).
  • ffmpeg + ffprobe on PATH (optional; or set FFMPEG_PATH in .env.local). Needed for video intake (/api/video-ingest) and non-WAV voice notes (browser WebM recordings). Without ffmpeg, those routes return a clear JSON error (501 FFMPEG_MISSING / reason: "unverified_audio") instead of guessing; everything else works out of the box.

Step-by-Step Installation

  1. Install dependencies:

    npm ci
  2. Create your local environment file:

    cp .env.example .env.local

    Fill in server-side API keys in .env.local (HACKATHON_GEMINI_API_KEY, GRADIUM_API_KEY, TAVILY_API_KEY, VONAGE_API_KEY, VONAGE_API_SECRET, SMS_REDIRECT_TO, CLICKHOUSE_URL, CLICKHOUSE_PASSWORD). Never prefix secrets with VITE_.

  3. Optional — unpack the official Reonic challenge dataset locally (NOT committed to Git): Place Reonic's challenge files inside data/reonic-challenge/ (ignored via .gitignore and enforced by CI). The loader automatically supports both flat and nested layouts:

    data/reonic-challenge/
      checklist.example.en.json          # or checklist/examples/checklist.example.en.json
      transcript-1.json .. transcript-3.json   # or transcripts/transcript-*.json
      images/Hackathon Images/*.jpeg     # or images/*.jpeg
    

    (On a fresh public clone without data/reonic-challenge/, the server, app, npm test, and npm run eval work out of the box using the built-in Reonic schemas reonic-pv-heatpump-v1 + reonic-wallbox-check-v1 and built-in synthetic fixtures.)

  4. Start API server + Vite frontend (single command or two terminals):

    # One command (starts API on :8787 + Vite on :5173):
    npm start
    
    # Or two separate terminals:
    npm run server   # http://127.0.0.1:8787
    npm run dev      # http://127.0.0.1:5173 (proxies /api -> :8787)
  5. Run in offline / zero-key demo mode (optional):

    DEMO_FORCE_MOCK=1 npm run server

All package.json Scripts

Command Description
npm start Starts both the Node.js API server (127.0.0.1:8787) and Vite frontend (127.0.0.1:5173) in one command (scripts/start-all.mjs).
npm run dev Starts the Vite frontend dev server on http://127.0.0.1:5173 (with /api proxy to 127.0.0.1:8787).
npm run server Starts the Node.js HTTP API server (server/index.ts) on http://127.0.0.1:8787.
npm run build Runs tsc --noEmit, builds the production bundle via vite build, and generates the offline service-worker shell (scripts/offline.mjs).
npm run preview Serves the production build locally on 127.0.0.1 for testing offline reload via Service Worker and IndexedDB.
npm test Runs domain, pipeline, verifier, security, and voice/video tests (tests/domain.test.ts, tests/pipeline/pipeline.test.ts, tests/pipeline/security.test.ts, tests/pipeline/voice-video.test.ts; ffmpeg round trips auto-run where ffmpeg is installed, including CI).
npm run check Runs npm test followed by npm run build.
npm run check:partners Probes all 5 runtime partner APIs (Gemini, Gradium TTS + STT round trip, Tavily, Vonage, ClickHouse) via scripts/check-partners.mjs.
npm run eval Executes runBenchmarkSuite() with live Gemini + Tavily lookup and logs results to ClickHouse (uses TC-01..09 when checklist.example.en.json is present locally, otherwise built-in synthetic-fixtures).
npm run eval:deterministic Runs the 9-case benchmark deterministically without Gemini API calls (or 5-case synthetic-fixtures on a fresh clone without private Reonic data).
npm run format Formats all code, JSON, HTML, and Markdown files with Prettier.

7. API Reference (server/index.ts)

The local backend listens on http://127.0.0.1:8787 (configurable via API_PORT) and exposes the following JSON & image endpoints. All /api/* routes except GET /api/health, GET /api/session, and the homeowner 2FA-token routes (POST /api/customer-request/verify, POST /api/customer-request/upload) require an authenticated HttpOnly; SameSite=Strict session cookie obtained via GET /api/session (HMAC-SHA-256 verified with crypto.timingSafeEqual):

Method & Route Rate Limit (Session / Global) Purpose & Payload Summary
GET /api/health — / 240 global per 10 min Public liveness probe returning server health, forceMock flag, boolean configuration status for gemini, gradium, tavily, vonage, and clickhouse, plus media.ffmpeg.
GET /api/session 30 / 120 per 10 min Same-origin loopback session bootstrap (Origin/Referer/Sec-Fetch-Site guarded) requiring the server-side proxy launch proof header X-Aphan-Launch (crypto.timingSafeEqual; 401 without it) or public X-Aphan-Access code. Issues an HttpOnly; SameSite=Strict signed session cookie.
GET /api/schemas — Lists available checklist schemas (official checklist.example.en.json if present locally + built-in reonic-pv-heatpump-v1 and reonic-wallbox-check-v1) and available local Reonic photo count.
GET /api/reonic-dataset — Lists available local photo filenames and transcripts (transcript-1.json..transcript-3.json) from data/reonic-challenge/.
GET /api/test-cases — Lists the 9 committed synthetic site-visit test cases (TC-01–TC-09, 46 photos) with photo URLs, transcript segment counts, and expected risk flags.
GET /api/test-case-photo/:caseId/:file — Serves committed synthetic test-case photos via strict directory allowlist (resolveSafeTestCasePhotoPath, path-traversal safe).
GET /api/reonic-photo/:file — Serves local Reonic challenge photos via strict directory allowlist (resolveSafeOfficialReonicPhotoPath, path-traversal safe).
POST /api/analyze 30 req / 10 min Runs the 5-stage site-visit pipeline (runSiteVisitPipeline) for { visitId, schemaId, testCaseId, photos, reonicPhotoFiles, reonicTranscriptFile, transcript, note }, logs telemetry to ClickHouse asynchronously, and returns SiteVisitPipelineResult.
POST /api/voice-note 30 req / 10 min Transcribes a consultant's solo on-site voice memo ({ audioBase64, mimeType, language, fallbackText }) via Gradium STT (with parallel chunking >24 s and guarded Gemini fallback). Silent, empty, or too-short audio returns text: "" with a reason and is never sent to a model.
POST /api/voice-live-turn 120 req / 10 min Processes an optional live voice turn during a consented on-site walkthrough (transcribes spoken segment and updates pending question/checklist context).
POST /api/voice-live-turn-batch 60 req / 10 min Same as /api/voice-live-turn for several buffered turns at once (used when the device comes back online after recording offline).
POST /api/live-frame 300 req / 10 min Fast live camera feedback (mode: "video-scan" | "photo-verify" | "walk-confirm", fast Gemini scan + verification) returning { verdict, matchedItemId, component, hint, sharpEnough, infoSufficient, rejectReasons }. Checks photo usability & subject match only; never fills checklist values directly.
POST /api/video-ingest 10 req / 10 min Takes one walkthrough video (raw Content-Type: video/mp4, video/quicktime, video/webm up to 96 MB, or JSON { mimeType, base64Data } up to ~32 MB), extracts up to 8 sharp stills with ffmpeg, and transcribes the soundtrack. Returns photos and transcript ready for /api/analyze. See docs/CONTRACT.md.
POST /api/voice-warning 30 req / 10 min Synthesizes a short hands-free German spoken warning ({ text }) as audio/wav base64 via Gradium TTS (Anton, rewrite_rules: "de"), with disk caching and demo WAV fallback.
POST /api/customer-request 10 req / 60 min Creates a missing-item follow-up ticket ({ visitId, itemId, itemLabel }) and sends a redirected Vonage SMS containing a 6-digit 2FA code (createCustomerMissingItemRequest). Never leaks the live 2FA code in HTTP responses.
POST /api/customer-request/verify 30 req / 10 min Verifies a customer follow-up 2FA code ({ token, code }) using crypto.timingSafeEqual (15-min TTL, single-use, max 5 attempts).
POST /api/customer-request/upload 20 req / 10 min Accepts the 2FA-verified homeowner photo upload ({ token, fileName, mimeType, base64Data }), checks byte integrity and JPEG sharpness (estimateJpegQualityFromBuffer), and returns filled or needs_human (if blurry) with photo evidence.
POST /api/eval/run 6 req / 60 min Runs the benchmark suite (runBenchmarkSuite on TC-01..09 if checklist.example.en.json is present, else 5-case synthetic-fixtures) and logs the scorecard to ClickHouse (reonic_eval_runs).
GET /api/eval/history 30 req / 10 min Fetches the 10 most recent evaluation benchmark runs from ClickHouse (fetchRecentEvalRunsFromClickHouse).
GET /api/analytics/summary 30 req / 10 min Runs ClickHouse analytical SQL aggregations (count, sum, avg, argMax, GROUP BY schema_id, mode) across reonic_visit_runs and reonic_eval_runs.

8. Security & Privacy

Implemented in server/security.ts, server/partners/vonage.ts, server/media.ts, and server/env.ts:

  • Strict Server-Side Secret Isolation: All partner credentials are read exclusively by the Node.js server from .env.local / environment variables (server/env.ts). No secret uses the VITE_ prefix, and CI actively scans against leaked tokens and tracked .env or data/reonic-challenge/ files.
  • Launch-Secret Bootstrap, Session Authentication & Proxy-Safe Rate Limiting (server/launch-secret.ts, server/security.ts, vite.config.ts, src/main.tsx): Every /api/* route except GET /api/health, GET /api/session, and the homeowner token/2FA endpoints (/api/customer-request/verify, /api/customer-request/upload) requires a server-signed HttpOnly; SameSite=Strict session cookie (crypto.randomBytes + crypto.timingSafeEqual). GET /api/session additionally requires a 32-byte per-launch secret (X-Aphan-Launch, verified via crypto.timingSafeEqual, shared via APHAN_LAUNCH_SECRET or owner-only 0600 file .cache/launch-secret/port-<PORT>.key through server/safe-cache.ts) that Vite dev/preview injects server-side only on /api/session and never exposes to the browser. Rate limits are keyed strictly per authenticated session (session:<id>), per launch-secret fingerprint on /api/session, per HMAC ticket-token hash on valid homeowner calls, and pure global ceilings on /api/health and invalid-credential buckets—never falling back to req.socket.remoteAddress and never trusting X-Forwarded-For—with bounded maps (MAX_BUCKETS = 4096, MAX_ACTIVE_SESSIONS = 512, MAX_TICKETS = 1000).
  • Hard Payload & Input Caps (LIMITS & validateAnalyzeBody):
    • HTTP JSON body capped at 25 MB (readJsonBody) with prototype-pollution reviver (__proto__, constructor, prototype stripped).
    • Maximum 40 photos per visit and ~6 MB (8 * 1024 * 1024 base64 chars) per photo; strict MIME allowlist (image/jpeg, image/png, image/webp, image/heic, image/heif).
    • Video uploads: MP4 / MOV / WebM verified by magic bytes, max 96 MB raw or ~32 MB base64, first 120 s only, max 2 concurrent jobs.
    • Maximum 600 transcript segments per visit, 4,000 chars per segment, 2,000 chars per visit note, and 120 chars per identifier.
  • Hardened Media Processing (server/media.ts): ffmpeg / ffprobe run via execFile with fixed argument arrays (zero shell interpolation), forced verified container demuxer (blocks playlist/concat SSRF tricks), hard timeouts, and private temporary directories always deleted after use.
  • No Invented Transcripts: Audio is level-checked before any speech model is called; silent, empty, too-short, or unreadable audio yields text: "", and empty segments are dropped before analysis.
  • 2FA & Outbound SMS Safety Guardrails (server/partners/vonage.ts):
    • Live SMS delivery is disabled by default unless SMS_REDIRECT_TO is explicitly set to a valid DACH test number (^(49|43|41)\d{6,14}$).
    • Capped at 3 follow-up requests per server-registered (sessionId, visitId) (visitId must be registered for the session via /api/analyze, max 5 new visitIds per session/hour; unregistered visitIds are rejected with HTTP 400), 5 per hashed recipient number, 6 per authenticated session, and 10 live SMS globally per hour, plus 15-minute code expiry, max 5 attempts, single-use token, and crypto.timingSafeEqual verification.
  • HTTP Security Headers & CSRF/Error Protection: Every API response sets X-Content-Type-Options: nosniff, Cache-Control: no-store, Referrer-Policy: no-referrer, X-Frame-Options: DENY, Content-Security-Policy: default-src 'none', Permissions-Policy, CORP, and COOP. Cross-site POSTs (Sec-Fetch-Site: cross-site) receive HTTP 403. Internal stack traces and keys are redacted before logging (redactSecrets).
  • GDPR & § 201 StGB Compliance by Design:
    • The official Reonic challenge dataset (data/reonic-challenge/) is excluded from version control and CI-guarded.
    • Because covertly recording a two-party conversation in a private home without explicit consent violates § 201 StGB, no recording starts before the consultant picks a mode on a per-visit consent sheet: "Kunde ist einverstanden" (the conversation is recorded and transcribed) or "Nur eigene Notizen" (everything spoken counts as the consultant's own note, never as a customer statement). The choice is stored with the visit and can be changed.

Aikido Security Report

Aikido repository view for APHAN_Reonic on branch team: 0 Critical, 0 High, 0 Medium, 0 Low open issues, 17 ignored

Aikido repo scan on team, 29.11.2026 (after PRs #51, #53, #55): 0 Critical / 0 High / 0 Medium / 0 Low open. Aikido counts 43 issues solved on 29.11.2026 alone, fixed in code and closed by rescans. 17 issue groups are marked Ignored. For transparency, here is every one of them and how it got that status:

14 × AI Scans findings, set to Ignored via the Aikido API on 28.11.2026 (~19:30 CET), each with a written exploitability justification stored in Aikido (e.g. the dev servers bind to loopback only; no attacker-controlled input reaches CLICKHOUSE_URL):

Severity Finding Location
Medium Missing Authentication for Critical Function vite.config.ts, server/index.ts
Medium Unredacted Logging of Sensitive Data .github/workflows/check.yml
Medium Improper Authentication server/partners/vonage.ts
Medium Uncontrolled Resource Consumption server/video-ingest.ts, CameraViewfinderModal.tsx + 1
Medium Exposure of Sensitive Information server/index.ts, AphanFieldStudio.tsx + 3
Low Business Logic Bypass AphanFieldStudio.tsx, src/pipeline/analyze.ts + 2
Low Improper Input Validation src/pipeline/client.ts, server/security.ts + 6
Low Multi-Factor Authentication Bypass server/partners/vonage.ts
Low Transcript facts are misattributed across distinct checklist fields src/pipeline/analyze.ts
Low Benchmark suite ignores fixture minimum-risk metadata src/pipeline/eval.ts
No Risk Failed-photo hazard tags bypass the quality gate src/pipeline/risk-radar.ts
No Risk Benchmark silently ignores missing and type-mismatched checklist fields src/pipeline/eval.ts
No Risk Untrusted visit content can steer the one-click conflict decision AphanFieldStudio.tsx
No Risk Server-Side Request Forgery (SSRF) server/partners/clickhouse.ts

3 × SAST findings, auto-ignored by Aikido's own triage on 29.11.2026 (“Auto ignored … By Aikido”), not by us. We re-checked them in an independent review: no user-controlled input reaches these sinks.

Severity Finding Location
High A timing attack might allow hackers to bruteforce passwords useContinuousVoiceCopilot.ts, RecordingPlayback.tsx
Low Potential file inclusion attack via reading file server/video-ingest.ts, server/media.ts + 5
Low HTTP request might enable SSRF attack demoPhotoPicker.tsx

9. Known Limitations

  1. No guessing behind sealed covers (needs_human by design): When a main fuse rating is hidden behind a sealed house connection box (closed_cover) or a meter cabinet photo is blurry (TC-05), the pipeline refuses to guess values and marks the item needs_human or missing.
  2. Schema-agnostic live pipeline vs. rule-based zero-key fallback: The live Gemini extraction (server/gemini-hooks.ts), deterministic verifier (src/pipeline/verifier.ts), and Euro Risk Radar (src/pipeline/risk-radar.ts) contain zero hardcoded field UUIDs and work on arbitrary Reonic checklists. Only the zero-key offline demo fallback (DEMO_FORCE_MOCK=1 in src/pipeline/analyze.ts) uses rule-based keyword matchers tuned for the demo templates.
  3. EUR risk figures are configurable DACH orientation ranges, not ERP quotes: The meter-cabinet alert is anchored to Verbraucherzentrale Rheinland-Pfalz (2026, median 2,966 € across 34 itemized of 160 heat-pump offers); the remaining Euro Risk Radar ranges (costBasis: "dach-guideline") are conservative DACH orientation bands meant to be customized per installer in production.
  4. Cold live latency (7–16 s uncached): Combined Vision + parallel Transcript calls plus live Tavily norm lookups take ~7–16 s uncached per site visit (and ~19 s end-to-end for a 30 s walkthrough video); SHA-256 disk caching (.cache/gemini/, .cache/gradium/) reduces repeated runs to < 50 ms.
  5. In-memory rate limits and 2FA tickets: Rate-limit buckets (server/security.ts) and Vonage 2FA follow-up tickets (server/partners/vonage.ts) live in process memory (Map) rather than Redis/Postgres, so they reset on server restart.
  6. Local browser storage & no Reonic production write-back: Offline media and visit drafts persist in browser IndexedDB (src/storage.ts) for basement offline resilience, not in a multi-tenant encrypted cloud backend, and checklist export is JSON-based rather than writing back into Reonic's proprietary production API.
  7. Free-tier hosting: The hosted demo runs on one Render free instance in Frankfurt (Docker, non-root, ffmpeg included). It sleeps after 15 min idle (cold start ~50 s), keeps its Gemini/Gradium disk cache only until the next deploy, and Vonage SMS are always redirected to the team's own test number (SMS_REDIRECT_TO), never to real homeowners. Deployment details: docs/DEPLOY.md.

10. Built Before vs. at the Hackathon

  • Built at the hackathon (Saturday, 28 November 2026 onwards): The entire repository, git history, React/TypeScript frontend (src/), 5-stage schema-agnostic pipeline & 4-class deterministic verifier (src/pipeline/), Node.js API server, guided live-camera & video/audio intake & security layer (server/), 5 runtime partner integrations (server/partners/), 9-case synthetic test suite (TC-01 to TC-09 in data/test-cases/), and offline service-worker shell (scripts/) were created from scratch during the hackathon.
  • Prepared before the hackathon: Domain notes on DACH installer pain points, DIN/VDE/TRGS standards (VDE-AR-N 4100, TRGS 519, VDI 4645, TA Lärm), and competitor gap analysis. No pre-existing application or pipeline code was reused.
  • Data provenance: All 46 test-case photos in data/test-cases/TC-*/photos/ were synthetically generated using Google DeepMind Gemini via data/test-cases/generate.mjs. Reonic's official challenge dataset (data/reonic-challenge/) is used locally only and is never committed to the repository.

11. License & Team

  • License: MIT
  • Team: Yang Peduto & Sascha Wirth

About

APHAN Reonic — Site Visit Copilot. Offline capture, evidence-based checklists. Big Berlin Hack 2026, Yang and Sascha.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages