Skip to content

Local-First AI Apps: Writing Down Exactly What Leaves the Device

A remote AI feature can send selected data off-device. A data boundary worksheet says which fields go where, for how long and what deletion really covers. This article shows a proposed worksheet for a task-breakdown app, a validated request builder, and the browser facts that should shape both.

A dashed device boundary encloses Notes and Goal text; only selected fields cross to a Proxy-to-model box.
A proposed device boundary retains notes, history and timer sessions. A validated request sends goalText, parentStepText and depth through a proxy; voice and unresolved retention are called out separately.
Proposed three-field proxy request; notes are excluded in this sample builder. Primitive/nested-value validation is not a network audit or a promise about all code paths.

Text equivalent. Local-first AI Teaching diagram • What stays. What leaves. What is unknown. DEVICE BOUNDARY / PROPOSED Local fields Notes · history · timer sessions Generated steps (may be resent if selected) Outbound request builder goalText · parentStepText · depth Validate types, depth and byte size App proxy > model provider Credentials stay server-side Retention / region: UNRESOLVED Selected fields Voice is a separate path May use browser-vendor processing Typing fallback if unavailable Local delete is not remote delete. Transport metadata also leaves the device. Synthetic worksheet, not a network audit • browser storage may be evicted; no blanket privacy claim

Full-size diagram

"Local-first" is a reassuring label. In this article it means something specific: the user's data is stored and usable on their device by default, and anything that leaves the device is a deliberate, listed exception. It doesn't mean "has local history", and it doesn't mean the AI runs offline. A fully on-device model might send nothing. A remote AI feature can send selected data off-device: if a language model on a server breaks a goal into steps, the goal has to reach that server. Voice input may also involve a service you don't run.

The honest answer is to write a data boundary worksheet before you build. It lists every field, where it lives, what leaves the device, why, for how long, what deletion covers and what happens when something fails. This article shows a proposed worksheet for a task-breakdown app. It also covers the browser behaviour that decides what "stored locally" really means.

What this is. The worksheet below is a PROPOSED design for a synthetic task-breakdown app. It isn't a network audit of any product, and several of its cells are deliberately unresolved. It doesn't describe the implementation, model host or retention of Task Decomposer, my own task-breakdown product, which is described as local-first with voice input. That product is why this kind of app is a useful example. IndexedDB and the Web Speech API appear here as options, not as anyone's confirmed stack.

Four things "local" doesn't mean

Storing data in the browser is a good default for personal task data. It doesn't give you these four things for free.

  1. Not automatically private from your own code. Anything your scripts can read, your scripts can send. Third-party scripts on the same page run with the same access. MDN notes that IndexedDB "follows a same-origin policy". That protects data from other sites, not from code you load.
  2. Not automatically encrypted. IndexedDB is described by MDN as "a low-level API for client-side storage of significant amounts of structured data". Encryption at rest, if you need it beyond what the device provides, is a separate design decision.
  3. Not automatically durable. By default, browser data is "best-effort". MDN's page on storage quotas and eviction explains this under "When is data evicted?" and "How is data evicted?". Best-effort data persists only "as long as the origin is below its quota, the device has enough storage space, and the user doesn't choose to delete the data". Under storage pressure, browsers use a "Least Recently Used (LRU) policy". Safari can also evict data "proactively, for origins that aren't used regularly". An origin can request persistence with navigator.storage.persist(), and persistent data is evicted only "if the user chooses to". Persistence is not a backup. It doesn't make data confidential, and it doesn't protect against the user clearing it. In private browsing, "stored data is usually deleted when the private browsing mode ends."
  4. Not automatically offline. The AI step needs the network if the model runs remotely. Voice recognition may too, as the next section explains.

Voice: the path people forget

Voice input is where "nothing leaves the device" claims most often break. MDN's SpeechRecognition page is direct: "On some browsers, like Chrome, using Speech Recognition on a web page involves a server-based recognition engine. Your audio is sent to a web service for recognition processing, so it won't work offline."

Newer parts of the specification let an app ask for on-device recognition. MDN documents a processLocally property: when true, recognition "must be done locally". When false (the default), "the user agent can choose whether to do the processing locally or remotely." There are also SpeechRecognition.available() and install() for checking and installing on-device language packs. Support, permissions and language-pack availability vary by browser and device. Detect them at runtime, and don't assume local recognition will be there.

For the worksheet, that gives three honest paths: audio sent to the browser vendor's recognition service, audio processed on the device, or voice input unavailable. On the remote path, the audio and the resulting transcript have already been processed outside the device before your app sees them. The app's retention and deletion promises don't extend to a recognition service it doesn't operate.

Where the model call goes from

One architecture decision changes the worksheet: whether the browser calls the model provider directly. A direct call means the browser holds a provider credential, and anyone can extract that from the page. The safer pattern is a small backend proxy you operate. It holds the credential, enforces the request format, and forwards only the allowed fields. That adds a destination to the worksheet (your proxy and its logs), and it changes who sees what. The provider sees the proxy's connection, not necessarily the user's IP address.

The proposed boundary worksheet

The synthetic app turns a typed or spoken goal into ordered steps, lets the user break a step down further (up to three levels), and keeps notes, completion history and focus-timer sessions. Cells marked UNRESOLVED are open questions to answer before anyone writes a user-facing disclosure.

FieldWhere it's storedLeaves the device?DestinationPurposeRetentionDeletionFailure mode
Goal textIndexedDB (option)Yes, when the user requests a breakdownApp's proxy → model provider (provider and region: UNRESOLVED)Generate stepsLocal: until deleted or evicted. Proxy logs: UNRESOLVED (set a policy). Provider: UNRESOLVED, per its API terms; don't assume zeroLocal deletion removes the device copy. It doesn't itself request remote deletion. What's possible remotely depends on the proxy's log policy and the provider's terms and processModel unavailable or offline: keep the goal locally and say so. No silent retry later
Parent step text + depthIndexedDBYes, only for "break this step down"App's proxy → model providerContext for the sub-stepsAs aboveAs aboveDepth limit reached, or invalid input: the builder throws, so the caller has nothing to send
Generated stepsIndexedDBNot on receipt. A selected step's text is resent when the user requests a deeper breakdown(as the row above, when resent)Display, completionUntil deleted or evictedLocal deleteQuota exceeded: show an error and keep the previous state. Don't drop data silently
Voice audioNot stored by the appBrowser-dependent: may go to the browser's recognition serviceBrowser vendor (if remote)Speech to textOutside the app's controlOutside the app's control; tell the userRecognition or permission unavailable: fall back to typing
Transcript before confirmationMemory onlyOn the remote voice path, it was produced outside the device. It's not resent to the model until the user confirms it as goal textBrowser vendor (if remote)Let the user edit before sendingApp: discarded on confirm or cancel. Vendor: outside the app's controln/a in the app—
NotesIndexedDBNo—User's own contextUntil deleted or evictedLocal deleteEviction: lost unless exported
Completion history, timer sessionsIndexedDBNo—Progress viewUntil deleted or evictedLocal deleteEviction: lost unless exported
Network metadata—Yes, with any requestFirst hop: the app's proxy/hosting. The provider sees the proxy's connectionTransportPer each party's logging (UNRESOLVED for the proxy)Not controllable from the device—

On network metadata: request timing and the connecting IP address are observable by whoever receives the connection. Exactly which party sees the user's IP address or user agent depends on the path: browser, proxy, CDN and any forwarding headers.

Some things to notice:

  • "Selected fields," not "nothing." Three app fields go to the model via the proxy (goal text, parent step text and depth), plus the transport metadata that comes with any request. Writing that down is more credible than a blanket promise.
  • Deletion has two boundaries. "Delete all my data" clears the device. Remote copies depend on your proxy's log policy and the provider's terms. Say which is which in the UI.
  • Retention cells that can't be filled are findings. If nobody knows how long the provider keeps request data, the worksheet shows UNRESOLVED. Don't write "not stored".

Validating the outbound request in code

A worksheet nobody enforces is documentation. One enforcement point is a single function that builds the outbound request. It accepts only primitive values of the right type and size, bounds the depth, caps the serialized size, and projects to three fixed keys. It's a request builder, not a boundary audit: it can't see other code paths. Here is the synthetic version, condensed from the tested file (comments removed, some error messages shortened; the logic is the same):

js
export const OUTBOUND_FIELDS = Object.freeze(['goalText', 'parentStepText', 'depth'])
export const MAX_DEPTH = 3, MAX_TEXT = 2000, MAX_BODY_BYTES = 4096

const text = (v, name, nullable) => {
  if (nullable && v === null) return null
  if (typeof v !== 'string') throw new TypeError(`${name} must be a string`)
  const t = v.trim()
  if (!t) throw new RangeError(`${name} is empty`)
  if (t.length > MAX_TEXT) throw new RangeError(`${name} exceeds ${MAX_TEXT} characters`)
  return t
}

export function buildBreakdownRequest(record, parentStep = null) {
  let depth = 1, parentStepText = null
  if (parentStep !== null) {
    if (typeof parentStep !== 'object') throw new TypeError('parentStep must be an object or null')
    const d = parentStep.depth
    if (!Number.isSafeInteger(d) || d < 1 || d >= MAX_DEPTH) throw new RangeError('invalid parent depth')
    depth = d + 1
    parentStepText = text(parentStep.text, 'parentStep.text', false)
  }
  const body = { goalText: text(record?.goalText, 'goalText', false), parentStepText, depth }
  const bytes = new TextEncoder().encode(JSON.stringify(body)).length
  if (bytes > MAX_BODY_BYTES) throw new RangeError(`body is ${bytes} bytes`)
  return Object.freeze(body)
}

Its tests (Node 24.22.1 test runner) recorded 7 PASS / 0 FAIL. They check:

  • the body has exactly the three keys;
  • for the test fixture, the record's notes, history, timer sessions, id, timestamps and raw transcript don't appear in the serialized body;
  • depths 2 and 3 are built and depth 4 is refused;
  • nested objects or arrays under an allowed key are rejected, so notes can't ride along inside goalText;
  • NaN, negative, zero, fractional, string, infinite and missing depths are rejected;
  • empty, missing and over-length text, and an over-size body, are rejected.

An earlier version of this sample only projected keys. When the new test suite was run against it, 5 of 7 tests failed. A separate test shows the earlier version would serialize a nested private note under goalText and accept a depth of NaN. That's why key filtering alone isn't validation.

What these tests don't prove: when the builder throws, its caller has nothing to send. No network call was made or observed, though. The tests don't show that no other code path, analytics script, error reporter or the browser itself sends data. Confirming that needs a network-level check of the real app, such as watching every request across the main user journeys. The worksheet and the builder are where that audit starts. They don't replace it.

Telling users plainly

Once the UNRESOLVED cells are filled in, the worksheet's main use is to draft a short disclosure, for example:

"Your tasks, notes and history are stored in this browser. When you ask for a breakdown, the goal text (and the step you're breaking down) is sent through our server to our AI provider to generate steps. Voice input may be processed by your browser's speech service. Browser storage can be cleared by the browser when space runs low, so export anything you want to keep."

That's a template, not a ready-to-ship statement. It must be checked against the app's actual requests, destinations, provider terms and logging before use.

Privacy and compliance

A boundary worksheet is engineering documentation. It is not a privacy policy, a data protection impact assessment or legal advice. If your app handles health, financial or children's data, or has users in regulated jurisdictions, the worksheet is useful input for that review. It doesn't replace it.


Planning an AI feature and want to be precise about what leaves the device? I design and build AI-powered products as part of SaaS & Product Engineering. Start here.


Sources

Put the thinking to work

What could this change for you?

Tell me what you’re building — I’ll tell you honestly where I’d start.

Start a project with me