MINA (My Intelligent National Assistant) is Singapore's sovereign edge AI companion, built on MERaLiON-2-3B by IMDA.
mina-bridge is the intelligence gateway between the MINA Android APK and the on-device MERaLiON model — a lightweight Flask server that handles speech transcription, rule-based agent routing, response generation, and autonomous gap logging, all running locally on a Termux environment with no cloud dependency for inference.
Option 3 architecture: routing is pure Python — deterministic, zero-latency, zero hallucination risk. The LLM is called exactly once per turn, only to generate the response text.
Features
🎙️ Whisper.cpp STT Integration
Offline speech-to-text via whisper-cli subprocess. Accepts base64-encoded WAV from the Android APK, decodes to a temp file, runs ggml-base.bin, strips noise tokens ([BLANK_AUDIO], debugfs, MEMPROF), and returns clean transcript text. No cloud STT dependency.
🧭 ARIA Agent Routing
Four specialist agents dispatched by keyword matching — no LLM routing call:
Resources appended to VITA and SENTINEL replies are driven by the knowledge file, not hardcoded strings. Update the JSON to update the response — no code change needed.
📋 Gap Logging & Autonomous Learning
Every time a user requests a capability MINA doesn't yet have, log_gap():
Appends a structured entry to gaps/gap_log.jsonl (local, persistent)
POSTs to ntfy.sh/{NTFY_TOPIC} for real-time cloud sync
json
1{2"timestamp":"2026-05-02T14:23:01",3"gap_type":"make_phone_call",4"user_request":"can you call SOS for me",5"context":"User requested phone call to SOS",6"status":"pending"7}
The NTFY_TOPIC env var controls the notification channel (default: roar-imda-demo). Gap notifications appear in the ntfy app with tag brain for triage. Network failures are caught silently — gap is always written locally first.
🔒 Sovereign & Offline-First
All inference runs on-device. The only outbound network call is the optional ntfy gap sync (non-blocking, non-critical path). No user speech or transcript data leaves the device during inference.
Endpoints
GET /health
Liveness probe. Android APK polls this at startup every 3 s.
{"status": "ok", "llama": true, "bridge": "v2"}
POST /completion
Main inference endpoint. Accepts two input modes:
Mode A — Pre-transcribed text (fast path):
{"transcript": "I have a meeting tomorrow morning"}
1{2"reply":"Sure lah, let me check your calendar!",3"content":"Sure lah, let me check your calendar!",4"transcript":"I have a meeting tomorrow morning",5"emotion":"neutral",6"valence":0.50,7"arousal":0.38,8"dominance":0.50,9"agent":"KRONOS",10"risk":"none",11"elapsed":1.8412}
Configuration
Env var
Default
Description
LLAMA_URL
http://localhost:8080
llama-server endpoint
BRIDGE_PORT
8081
Flask listen port
MAX_TOKENS
256
Max tokens for transcription call
NTFY_TOPIC
roar-imda-demo
ntfy.sh topic for gap sync
Deployment (Termux)
bash
1# Prerequisites on device2pkg install python whisper-cpp llama-cpp
34# Clone and deploy5git clone https://huggingface.co/munyew/mina-bridge
6cd mina-bridge
78# Start bridge (watchdog via start_mina.sh)9nohup python3 bridge.py >> bridge.log 2>&1&1011# Or restart after update12pkill -f bridge.py &&sleep3&&nohup python3 bridge.py >> bridge.log 2>&1&
Fine-tune MERaLiON-2-3B on v5 dataset (3240 audio files)
🟠 High
Singapore Legal Domain ASR
Generate + fine-tune on CPF/HDB/PDPA domain
🟡 Medium
Edge-optimised SER
Quantize MERaLiON-SER-v1 to INT8/TFLite < 200 MB
🟡 Medium
Code-switched Singlish-Mandarin
Pending MNSC dataset from NUS
Citation
bibtex
1@software{mina_bridge_2026,
2 title = {MINA Bridge: Sovereign Edge AI Gateway for Singapore},
3 author = {Loh, Mun Yew (Darren)},
4 year = {2026},
5 url = {https://huggingface.co/munyew/mina-bridge},
6 note = {Singapore AI Research — ATxSG 2026}
7}
Acknowledgements
Built on MERaLiON-2-3B by IMDA National Multimodal LLM Programme.
Speech transcription via whisper.cpp.
On-device inference via llama.cpp.