This repo contains:
loom/: the Loom engine source tree (incl. the Welvet C-ABI bridge)0_75/: prebuilt Welvet (Loom C-ABI) mobile binaries for v0.75.x0_75/android_arm64/welvet.so(+welvet.h)0_75/ios_arm64/welvet.a(+welvet.h)
loom-expo/: an Expo + React Native demo app that runs a small Loom model on-device and stores events in SQLite
The goal is a realistic demo for a diabetes scenario:
“I took meds late, went out, and after walking around (e.g. Costco) my blood sugar can drop. It’d be great to have something that flags risk locally.”
The app in loom-expo/ implements a simple “risk score” flow:
- You enter:
- Blood glucose (mg/dL)
- Minutes since meds
- Walking intensity (steps/min)
- The app computes a risk score (0..1):
- If Loom is available (dev client / built APK): it uses Loom/Welvet on-device
- If Loom is not available (e.g. Expo Go): it uses a deterministic fallback heuristic
- Each “check” is written to SQLite on-device via
expo-sqlite - The Insights screen shows a simple trend chart using
react-native-gifted-charts - A demo notification reminder can be scheduled via
expo-notifications - A demo PIN is stored via
expo-secure-store - A
WebViewscreen demonstrates in-app web rendering
This is an example project and not medical advice. It’s structured as a foundation you can extend with real signals (CGM ingestion, step sensors, insulin-on-board estimation, personal baselines, etc.).
- Expo (dev client) + React Native
- TypeScript
- expo-router (routes live under
loom-expo/app) - expo-sqlite (local SQLite storage)
- nativewind + tailwindcss (Tailwind-style
classNameutilities) - react-native-gifted-charts + react-native-svg (charts)
- expo-notifications (reminders)
- expo-secure-store (secure key/value)
- @react-native-community/datetimepicker (time picker in Settings)
- react-native-webview (web screen)
loom-expo/app/_layout.tsx: router layout + NativeWind CSS importindex.tsx: Dashboard (inputs + Train + Check now + Reminder)insights.tsx: Insights (trend chart)settings.tsx: Settings (SecureStore PIN + time picker)web.tsx: WebView screen
loom-expo/src/db/client.ts: opens SQLite DB, creates schemaschema.ts: TypeScript row types
loom-expo/src/repositories/EventRepository.ts: inserts and queries events
loom-expo/src/services/RiskService.ts: computes risk + logs eventsNotificationsService.ts: schedules a demo reminderSecureStoreService.ts: demo PIN storageanalytics/AnalyticsService.ts: simple moving-average trend + anomaly note
The Loom engine is integrated as a local React Native native module that bundles the prebuilt C-ABI binaries from 0_75/.
loom-expo/packages/loom-welvet/
- Kotlin native module:
packages/loom-welvet/android/src/main/java/com/openfluke/loomwelvet/LoomWelvetModule.kt
- Bundled binary (arm64):
packages/loom-welvet/android/src/main/jniLibs/arm64-v8a/libwelvet.so
- The Kotlin module uses JNA to call into the C-ABI and exposes:
createRiskModel()trainRiskModel(handle)predictRisk(handle, features)
- ObjC++ native module:
packages/loom-welvet/ios/LoomWelvetModule.mm
- Vendored library + header:
packages/loom-welvet/ios/Welvet/libwelvet.apackages/loom-welvet/ios/Welvet/welvet.h
- A podspec wires the vendored library/header:
packages/loom-welvet/loom-welvet.podspec
Because Loom is native code, you must use a dev client (or a built APK/IPA). Expo Go won’t include this module.
RiskService automatically falls back to a deterministic heuristic if NativeModules.LoomWelvet is not present.
This demo uses a very small Loom network:
- A single dense layer: 3 inputs → 1 output
sigmoidactivation → output is a probability-like risk score (0..1)- It is trained on-device using
LoomTrainwith a small hard-coded dataset that reflects:- lower BG → higher risk
- longer time since meds → higher risk
- higher walking intensity → higher risk
This is deliberately small so it’s easy to validate the end-to-end integration (native module → JS service → UI → SQLite → chart).
From loom-expo/:
npm install
npx expo startTo actually use Loom on-device you must build a dev client.
cd loom-expo
npx expo prebuild -p android
npx expo run:androidcd loom-expo
npx expo prebuild -p ios
cd ios && pod install && cd ..
npx expo run:iosTwo helper scripts exist at the repo root:
build-apk-debug.bat: buildsloom-expo/android/app/build/outputs/apk/debug/app-debug.apkinstall-apk-debug.bat: installs the APK to the currently connectedadbdevice/emulator
Usage from repo root:
build-apk-debug.bat
install-apk-debug.batNotes:
- You need Android SDK + platform-tools (
adb) on PATH. - The APK produced is debug and intended for development/testing.
If you want the app to run without Metro / expo start, build a Release APK:
build-apk-release.bat: buildsloom-expo\android\app\build\outputs\apk\release\app-release.apkinstall-apk-release.bat: installs it to the preferredadbdevice (auto-picks192.168.*if present)
Usage from repo root:
build-apk-release.bat
install-apk-release.batNotes:
- This is still signed with the debug keystore (good for local testing, not Play Store).
- Release builds are slower than Debug, but the app is standalone.
README.md(this file)build-apk-debug.batinstall-apk-debug.batbuild-apk-release.batinstall-apk-release.bat

