Inspiration: A Construction Daily Log Backed by Proof, Even Offline

4:50 pm, Harbor View Residences, Bay B. Dana, the superintendent, has to close today's daily log: the record of crew, deliveries and delays that everyone pulls out later, when a schedule slips or a claim is disputed. One superintendent reports 20–30 minutes a day on it (r/ConstructionManagers). The fast way is to copy yesterday's and edit.

So the log says "Delivery delayed — supplier caused it." Nobody saw that. The note that would back it up, or contradict it, sits in a notes app. The board photo sits in the camera roll. Sam, the project manager, reads the log the next morning and has nothing to check it against.

A claim with no source, written at a trailer door with one bar of signal. That's the problem.

What It Does: Drafted on the iPhone, Checked in Chrome

DayThread turns short field notes and one photo into a daily log where every line opens the note that proves it, and anything nobody saw stays an open question. Dana writes it on the iPhone, Sam checks it in Chrome, and each AI step runs where the work allows.

  • Offline, on the iPhone. Dana types 14:10 crew waiting for delivery at Bay B. Apple's on-device model drafts one entry per note, and a thread stitches each entry to its note (N1–N3).
  • No source, no claim. No note says why the delivery ran late, so the log doesn't say. It asks: Why did the delivery run late?
  • The photo waits for Gemini. Apple's model reads text only. When signal returns, the board photo goes to Gemini by itself: "Bay B — delivery pending", no date, so the log keeps the wording, never a time.
  • Live in Sam's Chrome. Dana publishes; the revision is on Sam's page about a second later, with no refresh. Sam asks questions, taps Ask Dana for a source, and drafts an owner update that only says what the record supports.
  • Every result shows where it ran, read from the response (modelVersion, inferenceSource), never from a setting.
Yesterday's log DayThread, revision 2
The delay "Delivery delayed — supplier caused it" 14:10 crew waiting (N1) · 14:35 unloading began (N2) · 15:00 framing resumed (N3)
The cause stated as fact open question: nobody on site saw why
A framing note (N3) attached to the blame would pass as "sourced" opened beside the claim, doesn't support, back to open
The supplier's call (N4) — Supplier reported: truck held at their yard · not verified
What the owner reads the blame what was seen, with sources, and that the cause isn't verified

Design. It should look like Apple made it: system type and colours, Liquid Glass only on controls, the brand carried by the thread itself. An open question is calm grey, not an alarm. The route sits quietly in the header, the way iOS shows the camera is on, with its evidence one tap away.

Check it in two minutes

  • Open the record Dana published in the demo: daythread-app.web.app (record bay-b-tuesday). Tap any chip (N1–N4, P1) to open its source.
  • Ask it a question, for example "Why did the crew wait?". The route under the answer comes from inferenceSource: in your browser if your Chrome has Gemini Nano, Gemini otherwise. The cause stays open either way.
  • Draft the owner update: ONLY_IN_CLOUD, on Gemini, with yesterday's line struck through.
  • Read the four files that matter: HybridModel in AIService.swift · the two web models in ai.ts · the Firestore listeners in record.ts and RecordCloud.swift · append-only firestore.rules.
  • Run the tests: cd web && npm test (13 source-rule tests) · swift test in ios/DayThreadCore (10 tests).

How Firebase Helps: One SDK, Two Platforms, One Record

Architecture: Dana's iPhone, Cloud Firestore and Sam's Chrome, with Firebase AI Logic on each side

One Firebase project carries both platforms: a SwiftUI app on iOS 26 and a TypeScript + Vite page on Firebase Hosting. Here is the job each piece does.

Firebase AI Logic: one hybrid SDK, the right model for each step

Every route is chosen by the work or the device, never by a toggle:

Work Where it runs Why
Drafting the log, the question on the iPhone Apple Foundation Model, on device, via HybridModel Short text, and it has to work at the trailer door with no signal
Reading the board photo Gemini, through the same HybridModel call The on-device path on iPhone takes text only
Sam's questions in Chrome Gemini Nano with PREFER_ON_DEVICE Instant, free, and a dispute about who caused a delay stays on the laptop
The owner update Gemini with ONLY_IN_CLOUD Polished writing for someone off site; only the approved revision leaves
Any of these with no local model Gemini Same code, automatic fallback; the app shows the SDK's reason
  • iOS: HybridModel(primary: SystemLanguageModel.default, secondary: gemini). Offline and online are one call. The header reads response.rawResponse.modelVersion: on device it is apple-foundation-models-system-language-model.
  • Web: two models in web/src/ai.ts. The badge reads result.response.inferenceSource and times each call.
  • What it saved: one integration instead of four. Without HybridModel, offline Apple and online Gemini would be two code paths on iOS, and the web would need its own Nano and cloud clients.

Cloud Firestore: one record across platforms, live

Hybrid inference decides where a model runs. Firestore decides what crosses between devices: only what Dana approved, and only what Sam asks for.

Sync

  • Notes, photo and draft never leave the phone. Publishing writes records/{id}/revisions/{n}, then moves a latestRevision pointer.
  • Revisions are append-only, enforced in firestore.rules: create yes, update or delete never. A correction is revision 2.
  • Both sides listen. Chrome's onSnapshot on the record reads the revision the pointer names, so it never shows a half-published log. "Ask Dana for a source" adds requests/{id}, and a snapshot listener puts it on Dana's cause line.
  • The cloud model sees only approved text. The owner update is written from the revision in Firestore, never from Dana's working notes.

App Check, Remote Config, Auth, Hosting

  • App Check attests the app on every model call, on both platforms.
  • Remote Config picks the cloud model (gemini-3.1-flash-lite today) without an app release.
  • Anonymous Auth signs every Firestore write; reads stay open to anyone with the link.
  • Hosting serves Sam's page at daythread-app.web.app.

The model drafts. Code checks every source ID. A person decides what's true.

Trust

  • Source IDs are assigned by code, never by the model.
  • The model answers in a fixed line format (ENTRY|14:10|Crew waiting for delivery|N1). Code drops any ID that isn't in the record and re-asks once.
  • A cause with no source stays an open question. Approve stays blocked until an attached source has been reviewed.

The ID check proves a link exists, not that the note supports the claim. N3 is real, and it's about framing. Only Dana's review catches that, so review is a step, not a setting.

Results

Measured on the recorded demo take (2026-11-30): one log, three notes, one photo, one added note. Not a study.

Check Result
Notes that open from the approved record 4 / 4
Returned source IDs that don't resolve 0
Cause without a supporting source stays open, in revisions 1 and 2, on the iPhone and in Chrome
iPhone draft in airplane mode apple-foundation-models-system-language-model, 1.5 s
Revision published on the iPhone → on Sam's page (Firestore listener) about 1 s
"Ask Dana for a source" in Chrome → on the iPhone about 1 s
Where the AI ran that day, read from each response 3 calls on the iPhone, 1 on Gemini (the photo)
Owner update in_cloud, 1.3 s
Question on a device with no local model in_cloud, 1.6 s, reason "no local model on this device"
N3 attached to the blame passes the ID check, caught at review

What is staged and what is live

  • Staged: the job, the people (Dana, Sam), the notes and the board.
  • Scripted: the iPhone taps in the video, so the take is repeatable. Airplane mode was switched by hand.
  • Live: every model call, route and time on screen, the Firestore sync, and the web app above.
  • Not on video: Gemini Nano answering in Chrome. The recording browser had no local model, so its questions ran on Gemini through the same PREFER_ON_DEVICE call.

Challenges we ran into

  • Text only on device. The photo became its own step, with a visible "waiting for Gemini" state that resolves by itself when signal returns.
  • 4,096 tokens, foreground only. Local requests are capped, so notes stay short and the draft prompt is bounded.
  • The model called Dana's own notes "unverified reports". The prompt now separates what was seen (notes) from what was said (the supplier's call).
  • 1 MiB per Firestore document. A revision carries the board photo, so the app downscales it before publishing; a revision is always one atomic write.
  • The console doesn't show on-device calls. The response field is the only proof of a route, so every badge reads it.
  • Our first design shouted the route with a banner and a theme switch. It looked like a tech demo, so the route moved into the header.

What we learned

A route badge drawn from a setting is a guess. Drawn from the response, it's evidence. And the reason matters more than the route: "photos need Gemini" tells a superintendent why the app behaves the way it does.

What's next

  • Inspections and RFIs on the same source rules.
  • A weekly summary for Sam, sent to Gemini because a week of logs outgrows the local model.
  • A Live Activity for the photo waiting for signal.

Try it: daythread-app.web.app · code: github.com/abssi-maker/daythread (MIT).

Built With

  • apple-foundation-models
  • chrome
  • cloud-firestore
  • firebase-ai-logic
  • firebase-app-check
  • firebase-authentication
  • firebase-hosting
  • firebase-remote-config
  • gemini
  • gemini-nano
  • ios
  • swift
  • swiftui
  • typescript
  • vite
Share this project:

Updates

Submission history