← All Posts全部文章
Privacy & Technology隐私与技术

A Meditation App That Doesn't Upload Your Data: How On-Device Rules Make It Possible 不上传数据的冥想 App 怎么做?全端侧规则引擎的技术实现

October 2026

Here's an uncomfortable truth about most wellness apps: when you tell them you're feeling anxious or depressed, that information often gets sent to a server. Your emotional state — arguably the most private data you have — lives in a database somewhere, analyzed for product improvement, targeted advertising, or worse. What if it didn't have to be this way? 这里有大多数健康 App 不愿明说的事实:当你告诉它们你感到焦虑或低落时,这些信息通常会被发送到服务器。你的情绪状态——可以说是你最私密的数据——存在于某处的数据库中,被用于产品优化、定向广告,甚至更糟。如果可以不这样呢?

The question we started with:我们出发时的问题: Can you build an AI-powered meditation app where every piece of data stays on the device — and still deliver a genuinely personalized experience? 能不能做一款 AI 驱动的冥想 App,所有数据都留在设备上,同时仍能提供真正的个性化体验?

The short answer is yes. Here's how we built MoodFlow's on-device emotion engine — and why it matters. 答案是能。下面是我们构建心境端侧情绪引擎的方式——以及为什么这很重要。

The Architecture: Rules, Not Models 架构方案:规则引擎,而非大模型

The first design decision was the most consequential: we don't use a cloud LLM. No GPT, no Claude, no server-side inference. Instead, the matching engine is a deterministic rule-based system that runs entirely in-process on iOS. 第一个设计决策也是最重要的一个:我们不使用云端大语言模型。没有 GPT、没有 Claude、没有服务器端推理。匹配引擎是一个确定性的规则系统,完全在 iOS 进程内运行。

Here's the architecture in a nutshell: 架构概览:

All of this — the tag definitions, the rule table, the breathing patterns — ships as JSON files bundled with the app. The matching algorithm is a few hundred lines of Swift. No network call. No server round-trip. Everything happens in under a millisecond on your iPhone. 所有这些——标签定义、规则表、呼吸模式——都作为 JSON 文件打包在 App 内。匹配算法仅几百行 Swift 代码。无网络调用、无服务器往返。一切在你的 iPhone 上毫秒内完成。

Why Rules Beat Models for This Use Case 为什么规则优于模型

In a world obsessed with machine learning, choosing a rule-based system might seem like a step backward. But for emotion-to-intervention matching, rules have specific advantages: 在一个沉迷于机器学习的世界里,选择规则系统似乎是一种倒退。但在情绪到干预的匹配场景中,规则有其独特优势:

What "On-Device" Really Means for the User "端侧运行"对用户到底意味着什么

No account needed. You open the app and start. No email, no password, no OAuth, no phone number. The concept of a "user account" simply doesn't exist in the architecture. 无需账号。打开即用。无需邮箱、无需密码、无需第三方登录、无需手机号。"用户账号"这个概念在架构中根本不存在。

No server exists. There is no MoodFlow backend. No database. No API. The entire product is the iOS app binary and its bundled assets. 没有服务器。心境没有后端。没有数据库。没有 API。整个产品就是 iOS 应用二进制文件和打包的资源。

Your history is yours. Session records and mood check-ins are stored locally in your device's SwiftData store. They sync to your other devices via iCloud if you choose — Apple's encrypted sync, not ours. Delete the app, and the data is gone. We couldn't restore it even if we wanted to. 你的记录是你的。练习记录和情绪打卡存储在设备的 SwiftData 中。如果你选择通过 iCloud 同步,走的是 Apple 的加密同步通道,不是我们的。删除 App 后数据消失,我们即便想恢复也做不到。

The Tradeoff: What We Can't Do 权衡:我们做不到的事

Being honest about the architecture means being honest about its limitations. Because there's no server-side aggregation, we can't: 诚实地讨论架构,意味着诚实地面对它的局限。因为没有服务器端聚合,我们做不到:

We consider these acceptable tradeoffs. The ability to tell users "your data never leaves your device" — and mean it literally — is worth more than a marginally better recommendation engine. 我们认为这是可接受的权衡。能够告诉用户"你的数据永远不会离开你的设备"——并且字面意思上做到——比一个稍微好一点的推荐引擎更有价值。

The bigger picture: As AI becomes embedded in more personal products, the default assumption that your data must flow to a server deserves to be questioned. Not every problem requires cloud AI. Sometimes the best AI is the one that runs in your pocket and answers to no one but you. 更大的图景:随着 AI 嵌入越来越多个人产品,"数据必须上传到服务器"这个默认假设值得被挑战。不是每个问题都需要云端 AI。有时候最好的 AI 是那个在你口袋里运行、只对你负责的。

Try MoodFlow — free, private, no account needed. 试试心境——免费、私密、无需注册。

Download on the App Store 在 App Store 下载