<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: CR4CODE</title>
    <description>The latest articles on DEV Community by CR4CODE (@cr4code).</description>
    <link>https://dev.to/cr4code</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4168006%2Fa710bc90-5ee4-4093-9ef6-e91034645ef7.png</url>
      <title>DEV Community: CR4CODE</title>
      <link>https://dev.to/cr4code</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cr4code"/>
    <language>en</language>
    <item>
      <title>I gave a language model hands inside Android — and it built me an app factory</title>
      <dc:creator>CR4CODE</dc:creator>
      <pubDate>Wed, 07 Oct 2026 06:34:44 +0000</pubDate>
      <link>https://dev.to/cr4code/i-gave-a-language-model-hands-inside-android-and-it-built-me-an-app-factory-1390</link>
      <guid>https://dev.to/cr4code/i-gave-a-language-model-hands-inside-android-and-it-built-me-an-app-factory-1390</guid>
      <description>&lt;p&gt;Most LLM assistants are "brains in a jar." They can reason, write code, explain concepts — but they can't do anything in the real world. Everything they produce is text that a human copies and pastes somewhere.&lt;/p&gt;

&lt;p&gt;I decided to fix that. &lt;strong&gt;Termux Assistant AI&lt;/strong&gt; is an Android app that bridges a WebView with DeepSeek Chat and simultaneously gives the assistant direct shell access inside Termux via local HTTP servers. In effect — the language model gets hands.&lt;/p&gt;

&lt;p&gt;The project is fully open source (MIT): &lt;a href="https://github.com/CR4CODE/Termux-Assistant-AI" rel="noopener noreferrer"&gt;github.com/CR4CODE/Termux-Assistant-AI&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Termux is, and why it's the key
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://termux.dev" rel="noopener noreferrer"&gt;Termux&lt;/a&gt; is a terminal emulator for Android with a full Linux environment — no root required. Bash, Python, git, ssh, package manager — all working. Essentially a regular Linux distro in your pocket.&lt;/p&gt;

&lt;p&gt;The key insight: if I have Termux, I have a shell. And if a language model has a shell, it can run arbitrary commands, work with files, compile code, publish releases.&lt;/p&gt;

&lt;p&gt;Two questions remained:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;How to bridge the WebView app with Termux?&lt;/li&gt;
&lt;li&gt;How to safely pass commands from the model to the shell?&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Architecture: three layers
&lt;/h2&gt;

&lt;p&gt;The system consists of three isolated layers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Layer 1: WebView + DeepSeek
&lt;/h3&gt;

&lt;p&gt;The main app is an Android WebView that loads &lt;code&gt;chat.deepseek.com&lt;/code&gt;. The user chats with the model as usual. But the app intercepts the "Send" button and can insert prompts into the input field and read responses from the DOM.&lt;/p&gt;

&lt;p&gt;Implemented via a JavaScript bridge &lt;code&gt;VibeWebBridge&lt;/code&gt;: methods &lt;code&gt;sendMessage&lt;/code&gt;, &lt;code&gt;readLastAnswer&lt;/code&gt;, &lt;code&gt;lastAnswerHash&lt;/code&gt;, &lt;code&gt;isThinking&lt;/code&gt;, &lt;code&gt;isStopped&lt;/code&gt; execute JS in the WebView and return results through callbacks.&lt;/p&gt;

&lt;p&gt;Response reading works by finding &lt;code&gt;[class*=markdown]&lt;/code&gt; elements and hashing the last block to distinguish a new response from an old one.&lt;/p&gt;

&lt;h3&gt;
  
  
  Layer 2: HTTP server in Termux (port 8767)
&lt;/h3&gt;

&lt;p&gt;Inside Termux runs a Python server &lt;code&gt;ai-tasker-server&lt;/code&gt;. It listens on &lt;code&gt;127.0.0.1:8767&lt;/code&gt; and accepts tasks from the app:&lt;br&gt;
 the app accepts tasks:&lt;/p&gt;

&lt;p&gt;POST /task&lt;br&gt;
Body: {"task": "auto:uptime"}&lt;br&gt;
Response: {"status":"success","output":"...","exit_code":0}&lt;/p&gt;

&lt;p&gt;Routes are grouped by prefix:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;auto: — direct bash via bash -c&lt;/li&gt;
&lt;li&gt;project_* — read/write/build Android projects&lt;/li&gt;
&lt;li&gt;vk_&lt;em&gt;, tg_&lt;/em&gt; — posting to VK and Telegram&lt;/li&gt;
&lt;li&gt;release_* — release pipeline: CHANGELOG, tag, GitHub Release&lt;/li&gt;
&lt;li&gt;bot_* — PiarBot management&lt;/li&gt;
&lt;li&gt;apply_patches: — apply patches to source files&lt;/li&gt;
&lt;li&gt;log: — read logs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A key design decision: auto: commands go straight to bash, without LLM-based classification. The first version tried to guess the command type, which caused hangs on non-existent routes. Now it's just subprocess.run(["bash","-c", code], timeout=120).&lt;/p&gt;

&lt;h3&gt;
  
  
  Layer 3: VibeService (port 8768)
&lt;/h3&gt;

&lt;p&gt;A separate Android service that manages the WebView and exposes an HTTP API:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;POST /send — insert text into input field and press "Send"&lt;/li&gt;
&lt;li&gt;GET /read — read last DeepSeek response&lt;/li&gt;
&lt;li&gt;GET /hash — hash of last response (for change detection)&lt;/li&gt;
&lt;li&gt;GET /thinking — is the model generating right now?&lt;/li&gt;
&lt;li&gt;GET /stopped — is the model stuck in "Stopped" state?&lt;/li&gt;
&lt;li&gt;POST /install-apk — install APK from path&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This service is how the assistant talks to DeepSeek and runs autonomous loops.&lt;/p&gt;

&lt;h2&gt;
  
  
  Full development cycle: from prompt to APK
&lt;/h2&gt;

&lt;p&gt;This is the most interesting part — &lt;strong&gt;Vibe mode&lt;/strong&gt;. You write one task, and the system does the rest.&lt;/p&gt;

&lt;p&gt;Workflow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;User runs &lt;code&gt;vibe-run &amp;lt;project&amp;gt; "&amp;lt;task&amp;gt;"&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Script collects project tree and content of all &lt;code&gt;.java&lt;/code&gt;/&lt;code&gt;.xml&lt;/code&gt; files&lt;/li&gt;
&lt;li&gt;Builds a prompt requiring files back in format &lt;code&gt;=== FILE: path === ... === END FILE ===&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Sends to DeepSeek via VibeService (&lt;code&gt;/send&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Waits for response stabilization: hash unchanged for N seconds in a row&lt;/li&gt;
&lt;li&gt;Parses response, applies files to project&lt;/li&gt;
&lt;li&gt;Builds APK via &lt;code&gt;aapt2 → javac → d8 → apksigner&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;If build fails — sends error log back to the model and retries (up to 5 iterations)&lt;/li&gt;
&lt;li&gt;On success — APK is handed over for installation via &lt;code&gt;/install-apk&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The key trick is &lt;strong&gt;self-healing&lt;/strong&gt;. If the model stops in "Stopped" state (e.g., token limit), the background watchdog &lt;code&gt;vibe-auto-resume&lt;/code&gt; checks &lt;code&gt;/stopped&lt;/code&gt; every 5 seconds and automatically sends "continue". Without this, the autonomous run just hangs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real use cases
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fast prototypes&lt;/strong&gt; — idea → working APK in minutes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Phone automation&lt;/strong&gt; — scheduled tasks, parsing, data dispatch&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Content publishing&lt;/strong&gt; — scheduled VK/Telegram posts with LLM-generated text&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Release management&lt;/strong&gt; — build, CHANGELOG, tag, GitHub Release, social announcement&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Honest limitations
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Phone resources.&lt;/strong&gt; Heavy projects (Gradle, Kotlin, Compose) won't fit — the pipeline is tuned for lightweight Java+XML&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fragility of autonomous runs.&lt;/strong&gt; One typo in a patch can crash the server, so all changes are backed up&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dependency on an external LLM.&lt;/strong&gt; DeepSeek Chat is not local. A local option via &lt;code&gt;llama.cpp&lt;/code&gt; in Termux is the next step&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No vision.&lt;/strong&gt; The assistant "sees" only the WebView DOM, not the whole screen&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Voice control&lt;/strong&gt; via Termux API (TTS/STT)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local LLM&lt;/strong&gt; via &lt;code&gt;llama.cpp&lt;/code&gt; for full autonomy&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vision&lt;/strong&gt; — OCR + &lt;code&gt;uiautomator&lt;/code&gt; to control any app&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;APK marketplace&lt;/strong&gt; — build → sign → publish to own channel&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Termux Assistant AI is an experiment: what happens if you give a language model hands? It turns out — a lot. The model builds apps, ships releases, fixes its own bugs, runs social media. All inside a single Android phone, without a PC or cloud infrastructure.&lt;/p&gt;

&lt;p&gt;The project is fully open source:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Code:&lt;/strong&gt; &lt;a href="https://github.com/CR4CODE/Termux-Assistant-AI" rel="noopener noreferrer"&gt;github.com/CR4CODE/Termux-Assistant-AI&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Landing:&lt;/strong&gt; &lt;a href="https://cr4code.github.io/Termux-Assistant-AI/" rel="noopener noreferrer"&gt;cr4code.github.io/Termux-Assistant-AI&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;License:&lt;/strong&gt; MIT&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'm not a programmer. I don't know a single line of code. Everything you see was built by one person and one AI that became my hands.&lt;/p&gt;

&lt;p&gt;Questions and criticism are welcome in the comments.&lt;/p&gt;

</description>
      <category>android</category>
      <category>ai</category>
      <category>termux</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
