termux-runner
Skill2 starsChanged 7 months agoMITView on GitHub
Control the Termux app (com.termux) to run commands safely through RunCommandService, monitor long-running logs, collect exit codes, and handle install/update errors in the Android environment.
In this repository47 other files it gives its agents.
- brainstormingSkill
- claude-code-termux-runbookSkill
- cli-patcherSkill
- code-review-workflowSkill
- commit-commandsSkill
- consulting-analysisSkill
- context7-cleanSkill
- data-analysisSkill
- deep-researchSkill
- edit-tool-compat-guardSkill
- env-managerSkill
- executing-plansSkill
- feature-devSkill
- firecrawlSkill
- frontend-designSkill
- gateway-device-pairingSkill
- githubSkill
- glibc-prebuilt-bundleSkill
- gogSkill
- image-generationSkill
- memory-setupSkill
- module-auditorSkill
- module-scaffoldSkill
- openclaw-config-guardianSkill
- openclaw-ollama-runtime-kbSkill
- plugin-cutover-guardianSkill
- plugin-runtime-guardianSkill
- python-env-managerSkill
- self-improving-agentSkill
- simplify-and-hardenSkill
- skill-benchSkill
- skill-creatorSkill
- skill-unificationSkill
- skill-vetterSkill
- socratic-groundingSkill
- subagent-orchestrationSkill
- systematic-debuggingSkill
- tailscale-oauth-bridgeSkill
- termux-packagerSkill
- test-driven-developmentSkill
- vercel-deploy-claimableSkill
- verification-before-completionSkill
- video-generationSkill
- workspace-cleanupSkill
- writing-plansSkill
- yt-dlp-ingest-firstSkill
- zero-downtime-cutoverSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 8 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 34
Always run through com.termux/.app.RunCommandService.
- Distinctive: line 35
Before running an external command, ensure:
- Distinctive: line 37
Every long-running job must have:
- Very specific: line 50
Create a runner script in TERMUX_HOME.
- Very specific: line 55
write the exit code to a .exit file
- Distinctive: line 108
Only consider it successful when verification passes.
- Distinctive: line 112
Do not conclude success if runtime errors still remain.
- Distinctive: line 134
Check results, state validation, and next steps.
- Distinctive: line 137
If input/permissions are missing: state clearly what is missing and request it.
- Distinctive: line 138
If there is a runtime/tool error: return a brief error + possible cause + proposed remediation.
- Distinctive: line 139
If there is a policy/safety risk: stop and escalate via the approval checkpoint.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Termux Runner
A skill that standardizes the process of running commands inside the Termux app (not directly via root shell), suitable for long tasks such as pkg update, npm install, bootstrap/update scripts.
Scope
- In-scope: control the Termux app via RunCommandService, monitor long-running logs, collect exit codes, handle install/update errors on Android.
- Out-of-scope: generic adb/am automation outside the Termux runner contract.
Indexed sub-skill references (source map)
- @[SKILL.md#L1-L136] Standard frontmatter (
name,description). - @[SKILL.md#L6-L136] Termux Runner.
- @[SKILL.md#L10-L136] Indexed sub-skill references.
- @[SKILL.md#L22-L136] When to use.
- @[SKILL.md#L27-L136] Mandatory principles.
- @[SKILL.md#L39-L136] Standard paths.
- @[SKILL.md#L44-L136] Standard flow (long-running).
- @[SKILL.md#L56-L136] Minimal template.
- @[SKILL.md#L79-L136] Start RunCommandService.
- @[SKILL.md#L88-L136] Common errors + how to handle them.
- @[SKILL.md#L109-L136] Job completion checklist.
When to use
- Need to execute commands in the context of the
com.termuxapp. - Need to monitor long-running progress + get logs + clear exit codes.
- Need to debug installation errors in Termux without polluting the main runtime.
Mandatory principles
- Do not run
pkg/aptdirectly via root shell (Termux will block it or the context will be wrong). - Always run through
com.termux/.app.RunCommandService. - Before running an external command, ensure:
~/.termux/termux.propertiescontainsallow-external-apps=true.
- Every long-running job must have:
- a log file (
*.log), - an exit code file (
*.exit), - a dedicated runner script (
*.sh).
- a log file (
- The runner script must use an absolute shebang:
#!/data/data/com.termux/files/usr/bin/bash
Standard paths
TERMUX_HOME=/data/data/com.termux/files/homePREFIX=/data/data/com.termux/files/usrPATH=$PREFIX/bin:$PATH
Standard flow (long-running)
- Create a runner script in
TERMUX_HOME. - In the runner:
- set env
PREFIX,PATH - run the command
- redirect output to the log
- write the exit code to a
.exitfile
- set env
- Start service:
am startservice -n com.termux/.app.RunCommandService -a com.termux.RUN_COMMAND ...
- Poll the
.exitfile with a reasonable timeout. - Return the result with log tail + exit code.
Minimal template
#!/data/data/com.termux/files/usr/bin/bash
set -o pipefail
export PREFIX=/data/data/com.termux/files/usr
export PATH="$PREFIX/bin:$PATH"
cd /data/data/com.termux/files/home || exit 98
LOG="/data/data/com.termux/files/home/job.log"
EXITF="/data/data/com.termux/files/home/job.exit"
rm -f "$EXITF"
{
echo "== [$(date)] start =="
# command here
echo "== [$(date)] done =="
} > "$LOG" 2>&1
code=$?
printf "%s\n" "$code" > "$EXITF"
exit "$code"Start RunCommandService
am startservice -n com.termux/.app.RunCommandService \
-a com.termux.RUN_COMMAND \
--es com.termux.RUN_COMMAND_PATH /data/data/com.termux/files/home/<runner>.sh \
--ez com.termux.RUN_COMMAND_BACKGROUND true \
--es com.termux.RUN_COMMAND_WORKDIR /data/data/com.termux/files/homeCommon errors + how to handle them
1) Cannot run 'pkg' command as root
- Cause: running in the wrong context (root shell instead of Termux app).
- Fix: run via RunCommandService.
2) bad interpreter: /usr/bin/env
- Cause: script shebang like
/usr/bin/env nodedoes not fit the Android/Termux path. - Fix: create a wrapper with the absolute path to
nodein$PREFIX/bin.
3) Script reports "Update Complete" but runtime is still broken
- Cause: the installer skipped some native dependency errors (non-critical warning).
- Fix: always verify after execution with:
command -v openclawopenclaw --version
- Only consider it successful when verification passes.
4) Native deps (e.g. koffi, @discordjs/opus, sharp) fail to build
- Collect the full npm log (
~/.npm/_logs/...) and job log. - Do not conclude success if runtime errors still remain.
Job completion checklist
- Exit file is present
- Exit code is clear
- Log tail has enough error/success context
- Main verify command runs successfully (e.g.
openclaw --version) - If failed: return root cause + next fix step
Trigger Rules
- Positive: Activate when the user request matches
termux-runnerby description: Control the Termux app (com.termux) to run commands safely through RunCommandService, monitor long-running logs, collect exit codes, and handle install/update errors in the Android environment. - Negative: Do not activate for out-of-scope requests or when this skill's workflow/expertise is not needed.
- Escalation: If there is external action/network write or sensitive operations, an approval checkpoint must be added before execution.
Output Contract
- Deliverable: a result aligned with the objective of
termux-runner; clearly state the artifact/path/steps performed (if any). - Validation: report
PASS/FAILstatus together with the main checks run. - Failure mode: when there is an error, state the root cause + proposed remediation.
SOP
- Determine whether the request is within the scope of the skill.
- Execute the skill's main workflow/instructions in safe order.
- Check results, state validation, and next steps.
Error Handling
- If input/permissions are missing: state clearly what is missing and request it.
- If there is a runtime/tool error: return a brief error + possible cause + proposed remediation.
- If there is a policy/safety risk: stop and escalate via the approval checkpoint.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

