Offline P2P field assistant on
@qvac/sdk: delegates heavy AI inference from a phone to a nearby laptop via QVAC's peer-to-peer compute mesh. No cloud, no internet, just local Wi-Fi Direct.
- The idea β The Problem & The Solution Β· Why ONLY QVAC: P2P compute delegation (offload heavy LLM/Vision/RAG to a trusted local peer) + local fallback via
@qvac/sdk. - Run it (Native Build Required):
β οΈ Expo Go is NOT supported because@qvac/sdkuses custom C++ native modules.Pair phone and laptop natively via QR/NFC β ask a complex medical or vision query β watch the inference correctly route to the heavy-compute peer. Real-time UI animations visualize the mesh traffic.npm install && python3 scripts/seed.py # install packages and seed the manual npm run provider # Start laptop provider npm run ios # Build and launch the real native iOS app
- Verify offline:
python3 scripts/verify_offline.py(disconnect network first) β cloud-import scan + network isolation. - Tests & metrics:
npm run ciβ typecheck + 265 unit tests at 100% coverage (local-vs-delegate router, P2P pairing, RAG citations, multimodal routing, on-device audit log) + 3 E2E suites.python3 scripts/bench.pyβ inference latency and RAM usage. - No remote APIs (docs/REMOTE_APIS.md) β completion, RAG, TTS, vision, and P2P networking all run locally via
@qvac/sdk; data never leaves the local mesh.
β οΈ Austere Environment Design β Built for disaster zones and combat triage. The zero-internet P2P delegation, strict network timeouts (preventing UI freeze on packet drop), and fallback routing logic are real and unit-tested.
Offline P2P field assistant β delegates heavy AI inference from a phone to a nearby laptop via QVAC's peer-to-peer compute mesh. No cloud, no internet, just local Wi-Fi Direct.
In disaster zones, combat triage, and air-gapped enterprises, internet access is dead. Cloud AI is unreachable. First responders need complex AI, but running heavy Local LLMs and Vision Models on a mobile phone drains the battery in 20 minutes and causes severe thermal throttling.
Beacon is an offline, peer-to-peer AI mesh. It allows lightweight frontline mobile devices to intelligently delegate heavy AI inference (Voice, RAG, Vision) to a high-compute local hub (e.g., a rugged laptop in a medic's backpack) over a local P2P network.
- Zero-Internet P2P Delegation: Devices discover and pair locally, routing complex LLM queries to a heavy-compute node. Real-time UI animations visualize the mesh traffic.
- Battle-Tested Fallbacks: Built for chaotic environments with 90dB noise resilience (automatic high-value triage injection if Whisper STT fails) and strict P2P network timeouts.
- Grounded RAG: Hallucinations cost lives. Every response includes verifiable citations from offline databases.
- Custom network routing with
Promise.race()5s/10s hard timeouts to prevent UI freezing on packet drop. - Implemented Out-of-Band (OOB) NFC secure pairing and QR fallbacks.
- 100% Test Coverage across statements, lines, branches, and functions in our CI pipeline.
graph TD
classDef phone fill:#06b6d4,stroke:#0891b2,stroke-width:2px,color:#fff,rx:8,ry:8;
classDef laptop fill:#8b5cf6,stroke:#7c3aed,stroke-width:2px,color:#fff,rx:8,ry:8;
classDef sdk fill:#1e293b,stroke:#334155,stroke-width:1px,color:#cbd5e1,rx:5,ry:5;
classDef fallback fill:#22c55e,stroke:#16a34a,stroke-width:2px,color:#fff,rx:5,ry:5;
classDef heavy fill:#f59e0b,stroke:#d97706,stroke-width:2px,color:#fff,rx:5,ry:5;
Phone["π± Phone App"]:::phone
Laptop["π» Laptop Provider"]:::laptop
QvacSmall["@qvac/sdk<br/>(small model)"]:::sdk
QvacLarge["@qvac/sdk<br/>(large model)"]:::sdk
LocalFallback["π’ Local fallback"]:::fallback
HeavyInference["π‘ Heavy inference<br/>(delegate)"]:::heavy
Phone <-->|"Wi-Fi Direct"| Laptop
Phone --> QvacSmall
Laptop --> QvacLarge
QvacSmall --> LocalFallback
QvacLarge --> HeavyInference
| Layer | Technology |
|---|---|
| Mobile App | Expo 56, React Native 0.85, React 19 |
| AI Engine | @qvac/sdk (completion, RAG, TTS, vision, P2P) |
| Models | Llama-3.2-1B (general), MedPsy-1.7B (medical triage), SmolVLM2-500M (vision) |
| Pairing | QR (expo-camera) Β· NFC (react-native-nfc-manager) Β· beacon:// deeplink (expo-linking) |
| Provider | Node.js daemon (laptop-side) |
| QVAC SDK Method | Beacon Usage | Cloud Alternative You'd Need |
|---|---|---|
startQVACProvider() |
Laptop hosts model for phone peers | AWS Lambda + API Gateway |
loadModel({ delegate }) |
Phone offloads to laptop provider | OpenAI API + network |
completion() |
Local inference on both devices | OpenAI ChatCompletion |
ragSearch() |
Context-aware field answers | Pinecone + OpenAI |
unloadModel() |
Free RAM after query (critical on phone) | N/A |
Take QVAC out and you'd need 4 separate cloud services (OpenAI + Pinecone + AWS + a VPN), plus a stable internet connection β exactly what you don't have in the field.
Prerequisites for iOS (macOS only):
Because Beacon uses custom native C++ modules (@qvac/sdk and BareKit), you must have a modern version of CocoaPods (β₯ 1.14.0) installed to compile the app.
# If using Homebrew (Recommended)
brew upgrade cocoapods
# OR if using RubyGems
sudo gem install cocoapodsInstallation & Run:
git clone https://github.com/edycutjong/beacon.git
cd beacon
npm install
python3 scripts/seed.py
# Start laptop provider
npm run provider
# Compile and start the custom native iOS app
npm run iosReal-world telemetry captured from a physical Android device delegating heavy inference to a laptop provider over local Wi-Fi:
| Metric | Local Fallback | Delegated (P2P) | Improvement |
|---|---|---|---|
| Inference Latency | 215,947ms | ~100,000ms | 2.15Γ Faster |
| Fallback Switch | 30.5ms | β | <500ms |
| Peak RAM | 17.8 MB | β | <2,048MB |
Note: On-device inference on physical mobile hardware is taxing, taking over 3.5 minutes (215s) for a heavy query. P2P delegation successfully offloads the compute to the laptop peer, cutting the latency by more than half and preserving critical mobile battery life in the field.
265 unit tests (Vitest) at 100% coverage (statements Β· branches Β· functions Β· lines) covering the local-vs-delegate router, multimodal vision routing, Ed25519 P2P pairing, QR/NFC/deeplink key parsing, the auto-fallback path, the on-device audit log (model loads/unloads Β· TTFT Β· tokens/sec), and the UI components, plus 3 E2E suites (Playwright) and the offline-verification checks.
| Gate | Where | How / status |
|---|---|---|
| No remote APIs β zero cloud | docs/REMOTE_APIS.md |
python3 scripts/verify_offline.py scans for cloud SDKs |
| Offline proof β 0 outbound | scripts/verify_offline.py |
unplug Wi-Fi, then run |
| Tests | npm run ci Β· npx playwright test |
265 unit (100% coverage) + 3 E2E |
| Benchmarks | scripts/bench.py |
β
Real Β· reproducible (see data/bench_results.json) |
| Audit log (model loads/unloads Β· TTFT/tokens/sec) | src/core/audit.ts |
β
auto-captured on every inference; shown in-app + getAuditSummary() |
7-stage pipeline: Quality β Security β Build β E2E β Performance β Offline Verify β Deploy
# ββ Evidence Bundle βββββββββββββββββββββββββ
python3 scripts/verify_offline.py
python3 scripts/bench.py
python3 scripts/check_submission_readiness.py
# ββ Advanced Testing ββββββββββββββββββββββββ
npm run e2e # Playwright E2E tests
npm run lighthouse # Lighthouse CI audit| Layer | Tool | Status |
|---|---|---|
| Code Quality | TypeScript strict Β· expo lint | β |
| Unit Testing | Vitest (265 tests Β· 100% coverage) | β |
| E2E Testing | Playwright (3 suites) | β |
| Security (SAST) | CodeQL | β |
| Security (SCA) | Dependabot + npm audit | β |
| Secret Scanning | TruffleHog | β |
| Performance | Lighthouse CI | β |
| Offline Verification | verify_offline.py | β |
beacon/
βββ docs/ # README assets
βββ e2e/ # Playwright E2E specs
βββ scripts/ # seed, bench, verify, readiness
βββ src/
β βββ core/
β β βββ domain.ts # Medical-query classifier
β β βββ manual.ts # Bundled offline field manual (RAG corpus)
β β βββ rag.ts # ragSearch + lexical fallback
β β βββ qvac.ts # @qvac/sdk wrapper (completion, vision, RAG, TTS, P2P)
β β βββ p2p.ts # P2P host/pair lifecycle
β β βββ pairingLink.ts # QR/NFC/deeplink key parsing
β β βββ nfc.ts # NFC tap-to-pair reader (platform-guarded)
β β βββ audit.ts # On-device audit log (loads/unloads Β· TTFT Β· tok/s)
β β βββ router.ts # Local vs delegate routing (text + vision)
β βββ components/
β β βββ QRScanner.tsx # Camera QR pairing
β β βββ NfcPairModal.tsx # NFC tap-to-pair
β β βββ CameraCapture.tsx # Multimodal field-photo capture
β β βββ Markdown.tsx # Dependency-free markdown renderer
β βββ node/
β βββ provider.ts # Laptop-side daemon
βββ App.tsx # Expo UI (pairing Β· query Β· multimodal Β· markdown)
βββ .github/ # CI/CD + CodeQL + Dependabot
βββ README.md
We draw the line between proven and pending ourselves, so you don't have to guess. Nothing here is faked β the πΆ rows are precisely the parts that need physical phone-plus-laptop hardware we couldn't fully capture in the hackathon window. The orchestration that makes Beacon Beacon β the routing, fallback, pairing, RAG and offline guarantee β is real and exhaustively tested.
| Capability | Status | Evidence |
|---|---|---|
| Local-vs-delegate routing + auto-fallback | β Real Β· unit-tested | src/core/router.ts β 265 tests, 100% coverage |
Ed25519 pairing (QR Β· NFC Β· beacon:// deeplink) |
β Real Β· unit-tested | p2p.ts Β· pairingLink.ts Β· nfc.ts |
| Offline RAG citations (bundled field manual) | β Real Β· unit-tested | rag.ts Β· manual.ts |
| On-device audit log (TTFT Β· tok/s Β· load/unload) | β Real Β· auto-captured | audit.ts |
| 100%-offline guarantee (zero cloud SDKs) | β Real Β· verifiable | scripts/verify_offline.py |
@qvac/sdk integration (loadModel Β· completion Β· RAG Β· TTS Β· P2P) |
β Real code, to the SDK's documented API | src/core/qvac.ts |
Delegated-inference token stream (loadModel β provider β completion) over QVAC P2P/DHT |
β Real Β· reproducible | node scripts/verify_delegation.mjs β two live @qvac/sdk peers, fallbackToLocal:false; transcript in docs/evidence/ |
| Same flow on a physical phone β laptop over Wi-Fi (+ real device timings) | β Real Β· verified on-device | Successfully executed full P2P pipeline between a physical Android device and a laptop provider over local Wi-Fi |
| Benchmark timings (latency Β· fallback Β· RAM) | β Real Β· verifiable | run scripts/bench.py on-device to reproduce |
| Web preview (Playwright E2E) | πΆ Uses a mock @qvac/sdk shim |
the native bare-kit worker can't run in a browser β the mobile app loads the real SDK; metro.config.js aliases the mock for web only |
- Peers must share a local network (Wi-Fi Direct / hotspot) β by design; there is no internet relay.
- NFC tap-to-pair and camera/vision need a physical device (no simulator); iOS NFC also needs a paid Apple Developer account to sign the entitlement.
MIT Β© 2026 Edy Cu
Built for QVAC Hackathon I β Unleash Edge AI (DoraHacks). Edge AI isn't about one device β it's about a mesh. QVAC makes that possible.