Running a 24/7 AI Bot on Your Android Phone with Termux
Your Android phone is a surprisingly capable server. With Termux โ a powerful terminal emulator โ you can run Go programs 24/7 without a cloud subscription. Here's exactly how to set up StudyClaw on your phone.
Step 1: Install Termux from F-Droid
Do not install Termux from the Play Store โ that version is outdated. Instead, download from F-Droid. Once installed, open it and update the package list:
pkg update && pkg upgrade -y
Step 2: Install Go, Git, and Build Tools
pkg install golang git clang make -y
Verify Go is installed correctly:
go version # Expected: go version go1.22.x linux/arm64
Step 3: Clone StudyClaw
git clone https://github.com/roshan30-git/picoclaw-scholar.git cd picoclaw-scholar go mod tidy
Step 4: Get Your Free Gemini API Key
Visit aistudio.google.com and create a free API key. No credit card needed. Then set it in Termux:
export GEMINI_API_KEY="AIzaSy_your_key_here"
~/.bashrc or ~/.profile so it persists across
sessions: echo 'export GEMINI_API_KEY="..."' >> ~/.bashrcStep 5: Run the Bot and Scan QR
go run cmd/main.go
A QR code will appear as ASCII art in your Termux terminal. Open WhatsApp on another device โ Linked Devices โ Link a Device โ Scan the code. Done!
Step 6: Keep It Running 24/7 with nohup
By default, Termux processes stop when you close the app. To run the bot in the background continuously, use
nohup:
nohup go run cmd/main.go > studyclaw.log 2>&1 & echo "Bot started. PID: $!"
To check logs: tail -f studyclaw.log
To stop the bot: pkill -f "studyclaw"
Resource Usage
StudyClaw uses approximately 30โ50 MB of RAM at idle. On a 4GB+ RAM phone, this is negligible. The Go binary compiles to a single efficient executable with no JVM overhead.