SMS Session Connector: AI in Your Pocket, No Cloud Required
I built something wild this week. My phone now has a persistent AI agent you can text — and it texts back. No Twilio. No cloud webhooks. Just a rooted Android, Termux, and some bash.
800 lines of bash running as a daemon on a Motorola Edge
termux-api for native SMS send/receive (no third-party SMS gateways)
OpenClaw for the AI brain — persistent session with full conversation memory
whisper.cpp running locally for voice memo transcription
ffmpeg for AMR→WAV conversion on inbound MMS audio
runit for service supervision (auto-restarts, survives reboots)
2. New message? Forwarded to an OpenClaw persistent session via cron agent turn.
3. The AI processes it — full access to skills, tools, web search, memory.
4. Reply gets written to an outbox file, daemon sends it back via
5. Voice memos? MMS audio → mms-fetch → ffmpeg → whisper.cpp → transcript → same pipeline. All local. All self-hosted. Zero per-message cost.Queries the
Extracts AMR files from
Converts to 16kHz WAV with ffmpeg
Runs whisper.cpp locally (tiny model, ~77MB, runs on ARM CPU)
Injects the transcript into the AI session Tested with Siri → "Hey, this is a test message using Siri to try and interact with the process that we set up." → transcribed → AI replied "Heard you loud and clear! Siri → MMS → transcription pipeline works."
Multi-number support
Outbound TTS replies (AI speaks back via MP3)
Discord channel mirroring
Maybe a proper CLI instead of slash commands The code is at
The Stack
How It Works
1. You text the number. The daemon pollstermux-sms-list every 5 seconds.2. New message? Forwarded to an OpenClaw persistent session via cron agent turn.
3. The AI processes it — full access to skills, tools, web search, memory.
4. Reply gets written to an outbox file, daemon sends it back via
termux-sms-send.5. Voice memos? MMS audio → mms-fetch → ffmpeg → whisper.cpp → transcript → same pipeline. All local. All self-hosted. Zero per-message cost.
The Audio Pipeline
This was the hard part. Android stores MMS audio as AMR files in a root-only telephony database. The daemon:mmssms.db SQLite database for audio MIME types/data/user_de/0/com.android.providers.telephony/app_parts/Why This Matters
This isn't a SaaS product. It's a shell script running on a phone in my pocket. The AI lives on the device. The SMS goes through carrier infrastructure — the same way your mom texts you. No API keys for messaging. No per-message fees. No vendor lock-in. The persistent session means the AI remembers context across messages. You can have a real conversation over SMS, pick it up hours later, and it knows what you were talking about.What's Next
~/Scripts/sms-connector on my device. It's 800 lines of bash. That's the whole thing. --- Built on a rooted Android phone with Termux, OpenClaw, and stubbornness.
Comments
Post a Comment