Termux Persistent Gateway for Openclaw

A specialized persistence layer for running AI agent gateways on Android via Termux using tmux and wake-locks.

kingofqin2026
v1.1.0
Apr 29, 2026
0
1.1k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install termux-persistent-gateway

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install termux-persistent-gateway using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Termux Persistent Gateway?

Termux Persistent Gateway is a developer-focused utility designed to maintain continuous uptime for AI agent gateways on Android devices. By utilizing tmux for session management and Termux:API for wake-locks, this skill ensures that your Openclaw Skills remain operational even when the screen is off, the app is switched, or the device is rebooted. It provides a systemd-like experience for the Android environment, which is traditionally restrictive regarding background processes.

This tool is essential for anyone looking to transform their mobile hardware into a reliable AI node. It bridges the gap between mobile portability and server-grade persistence, allowing for seamless execution of Openclaw Skills without the risk of the Android OS terminating the gateway process to save battery.

Termux Persistent Gateway Use Cases

  • Deploying a permanent AI gateway on Android hardware for mobile Openclaw Skills access.
  • Preventing the Android OS from killing background AI processes during screen-off intervals.
  • Establishing an auto-start routine that restores your AI environment immediately after a device reboot.
  • Implementing remote health monitoring to auto-restart crashed gateway instances on Termux.

How Termux Persistent Gateway Works

  1. The system initiates a wake lock through the termux-wake-lock command to ensure the CPU remains active while the gateway is running.
  2. A persistent tmux session is created to encapsulate the gateway process, allowing it to survive terminal window closures.
  3. The specified gateway command is executed within the tmux multiplexer, redirecting all output to organized log files.
  4. If configured for boot, the Termux:Boot script triggers the startup sequence as soon as the Android system finishes loading.
  5. An optional health check script, typically scheduled via cron, monitors the tmux session and restarts the process if it detects a failure or termination.

Termux Persistent Gateway Setup

To begin using this with your Openclaw Skills, first install the required packages in Termux:

pkg install tmux termux-api termux-boot

Configure your gateway command and session name within the scripts, then launch the gateway using:

bash scripts/run-gateway.sh

For boot persistence, create the boot directory and copy the template:

mkdir -p ~/.termux/boot/
cp templates/termux-boot.sh ~/.termux/boot/agent-gateway
chmod +x ~/.termux/boot/agent-gateway

Finally, ensure that the Termux app battery settings are set to Unrestricted in your Android system settings.

Termux Persistent Gateway Data Schema & Taxonomy

The skill manages its operational data and logs through a structured directory system to maintain the integrity of your Openclaw Skills environment:

Component Path / Detail Function
Logs Directory ~/.agent/logs/ Stores all historical and real-time output from the gateway.
Gateway Log gateway-termux.log Contains stdout and stderr for debugging process crashes.
Boot Script ~/.termux/boot/ Contains the initialization scripts executed by the Termux:Boot app.
Multiplexer tmux session (agent-gw) Holds the active runtime state of the agent gateway.

Termux Persistent Gateway Advanced Features

  • Integrated Health Monitor: Use the provided healthcheck script with cron to ensure your Openclaw Skills are always reachable.
  • Wake-Lock Management: Automatically prevents CPU throttling to maintain high-performance AI interactions on mobile hardware.
  • Boot-Time Delay: Configurable sleep timers to ensure network availability before the gateway attempts to connect.
  • Notification Support: Leverages termux-notification to provide visual status updates directly in the Android notification tray.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*