The 24/7 always-on Flowork node, in your pocket. Separate from the desktop monorepo (../FLowork_os) but reuses the SAME Go core (agent + router) — one source of truth, no fork.
APK
├── Foreground Service (Kotlin)
│ ├─ exec libflowork-agent.so → 127.0.0.1:1987 (agent engine + panel)
│ └─ exec librouter.so → 127.0.0.1:2402 (LLM router + mesh)
├── MainActivity → WebView → http://127.0.0.1:1987 (the same panel + Router drawer as desktop)
└── BootReceiver → start the service on boot (always-on)
Why exec-binary: the agent + router cross-compile to a pure-Go Android PIE binary
(CGO_ENABLED=0 GOOS=android GOARCH=arm64) that links the bionic loader
(/system/bin/linker64) with no NDK required — verified. The APK ships these as
lib*.so under jniLibs/; Android extracts them to the app's nativeLibraryDir where they
are executable (Android 10+ needs PIE — satisfied). 100% code reuse, near-zero Go changes.
Default = Claude via the router cloak, but there is no VS Code on a phone, so the cloak token is pasted once in the router Settings → API Keys (decision: paste-token first; OAuth later). Local llama.cpp is a later opt-in (heavy: GB-size models, battery). Cloud/cloak = v1.
Prereqs (a real build machine — NOT needed to write code, only to assemble the APK):
- Android Studio or Android SDK + build-tools + platform-34, JDK 17, Gradle 8.
- Go 1.25+ (for the core binaries).
- The desktop monorepo checked out at
../FLowork_os(source of the Go core).
# 1. cross-compile the Go core into the APK's jniLibs (no NDK needed):
scripts/build-core.sh
# 2. assemble + sign the APK:
./gradlew assembleRelease # or assembleDebug
# APK -> app/build/outputs/apk/scripts/build-core.sh runs CGO_ENABLED=0 GOOS=android GOARCH=arm64 go build -buildmode=pie
on ../FLowork_os/agent and ../FLowork_os/router, dropping the results as
app/src/main/jniLibs/arm64-v8a/libflowork-agent.so and librouter.so.
Foreground service + persistent notification (so Android won't kill it), battery-optimization
exemption request, WorkManager for periodic wakeups, Doze handling. This is the whole point:
run Flowork around the clock, not just in the evening.
The agent/router write their DB + agents to the app's private filesDir (passed as
FLOWORK_HOME). App updates replace CODE; this DATA survives (same additive/seed-new model as
../FLowork_os/docs/AUTO-UPDATE.md).
The phone joins the P2P mesh via the WAN rendezvous (carrier CGNAT needs it) — see the Hybrid discovery decision in the desktop repo. Always-on = a strong mesh contributor.
Status: scaffold, build-ready. The Go core for Android is verified-buildable here; final APK assembly needs the Android SDK/Gradle on a build machine (or CI).