Skip to content

Your phone, on your command. Gotcha is world's first fully on-device AI copilot for Android that turns natural language into real device actions — safely.

merge: resolve PR51 conflicts with origin/development (PR49)

Gotcha Contributor052f7beaeb50
diff --cc CHANGELOG.md
index c30decf,4deb699..02a3dd7
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -3,18 -3,12 +3,24 @@@
All notable changes to Gotcha are documented here.
## [Unreleased]
+### Added
+- Five bundled skills targeting Termux (`termux_operations`, `termux_repositories`,
+ `termux_filesystem`, `termux_background`, `termux_proot`) so the model can speak
+ authoritatively about Termux's limits instead of rediscovering them one failure
+ at a time. See `docs/termux-setup.md` for the user-facing summary.
+- Expanded `run_termux_command` tool description with realistic limits (no
+ interactive prompts, 32KB output cap, 600s timeout, 4-command concurrency,
+ Android 12+ background rule) and pointers to the bundled skills.
+- `TermuxMessages.timedOut` and `startFailed` now point at the relevant skill via
+ `search_skills` so the model recovers with the right pattern on mirror failures
+ and backgrounded-start refusals.
+
+ ### Fixed
+ - The agent is now told how to stop a stuck Termux command: a `run_termux_command`
+ cannot kill a previously running one, so the instructions guide it to open the
+ notifications shade and tap Exit on the Termux notification (asking the user to
+ do so when it cannot reach it), instead of failing or starting more commands.
+
## [1.0.2]
### Fixed
- Release builds now ship with the correct Samosa AI service configuration. The
diff --cc app/src/main/java/com/gotcha/tools/TermuxMessages.kt
index e4c897d,6467d01..5d9e615
--- a/app/src/main/java/com/gotcha/tools/TermuxMessages.kt
+++ b/app/src/main/java/com/gotcha/tools/TermuxMessages.kt
@@@ -85,16 -87,11 +88,19 @@@ internal object TermuxMessages
append("\n- it is waiting for typed input that will never come, since there is no terminal ")
append("here. Retry with a non-interactive flag (e.g. -y) or pass the answer in stdin.")
}
- append("\n- or it is genuinely slow. Retry with a larger timeout_seconds. Note it keeps running ")
- append("either way — a run_termux_command cannot stop it. To stop it, open the notifications shade ")
+ append("\n- or it is genuinely slow. Retry with a larger timeout_seconds (the hard ceiling is 600). ")
- append("Note it keeps running either way — I cannot kill another app's process — so check Termux ")
- append("before starting again.")
++ append("Note it keeps running either way — a run_termux_command cannot stop it — so check Termux ")
++ append("before starting again. To stop a stuck one, open the notifications shade ")
+ append("(global_action or press_key 'notifications') and tap the Exit action on the Termux ")
+ append("notification, which ends every Termux session. If you cannot reach it, ask the user to tap ")
+ append("Exit on the Termux notification.")
+ append("\n- or, if the command was `pkg install` or `apt install` and it never moved past the ")
+ append("mirror-connect phase, the default Termux mirror is slow or blocked on the user's network. ")
+ append("Ask the user to open Termux, run `termux-change-repo` once, pick a closer mirror, and retry.")
+ append("\n- or, if this was a long-running process (server, watcher, build) rather than a one-shot ")
+ append("command, it should be backgrounded with `nohup ... > log 2>&1 < /dev/null & echo $! > pid; ")
+ append("disown` and the call should `exit 0` immediately; `termux-wake-lock` locks Doze off.")
+ append("\nFor the full list of pitfalls, call search_skills('termux_operations').")
}
)
diff --cc app/src/main/java/com/gotcha/tools/ToolDefinitions.kt
index 057b6b9,1843ee8..2eebd1e
--- a/app/src/main/java/com/gotcha/tools/ToolDefinitions.kt
+++ b/app/src/main/java/com/gotcha/tools/ToolDefinitions.kt
@@@ -1878,29 -1878,12 +1878,32 @@@ object ToolDefinitions
"visible here — use run_command for those. Shared storage (/sdcard) is only reachable if " +
"the user has run `termux-setup-storage` in Termux; if a /sdcard path fails, say so " +
"rather than retrying.\n" +
- "You cannot stop a command with this tool — there is no kill, each call only starts a new " +
- "background shell, and a previous one that has not finished (e.g. after a timeout) keeps " +
- "running. To stop a stuck one, open the notifications shade (global_action or press_key " +
- "'notifications') and tap the Exit action on the Termux notification, which ends every " +
- "Termux session. If you cannot reach that, ask the user to tap Exit on the Termux " +
- "notification.",
+ "\nRealistic limits to factor in:\n" +
+ "- No interactive prompts — there is no terminal here, so any command that waits for typed input " +
+ "(pkg install without -y, ssh password, read, mysql>) blocks until the 600s timeout. Always " +
+ "pass -y / --yes / -q where the tool supports them.\n" +
+ "- Output is capped at 32KB by Gotcha and ~100KB by Termux. For larger output, redirect to a " +
+ "file inside Termux (e.g. `... > /sdcard/Download/out.txt`) and read it back via read_file.\n" +
+ "- You cannot kill a command after submitting it. A timed-out command keeps running under " +
- "Termux's UID. There is no kill from here.\n" +
++ "Termux's UID. There is no kill from here. To stop a stuck one, open the notifications shade " +
++ "(global_action or press_key 'notifications') and tap the Exit action on the Termux " +
++ "notification, which ends every Termux session. If you cannot reach that, ask the user to tap " +
++ "Exit on the Termux notification.\n" +
+ "- Hard ceiling: timeout_seconds <= 600. `pkg install` of ffmpeg, chromium, rust, golang, or " +
+ "texlive can hit this — raise timeout_seconds to 600 and warn the user before starting one.\n" +
+ "- 4 commands in flight, process-wide. Sub-agents share the same semaphore.\n" +
+ "- Android 12+ foreground-service rule: if Gotcha is in the background and the assistive ball " +
+ "is off, this tool fails with 'Not allowed to start service'. Tell the user to bring Gotcha to " +
+ "the foreground (or switch the assistive ball on).\n" +
+ "\nIf `pkg install` hangs at \"0% [Connecting to packages.termux.dev]\" or fails with NO_PUBKEY, " +
+ "the default mirror is slow or blocked on the user's network. Tell the user to open Termux and " +
+ "run `termux-change-repo` once, then retry. The full mirror list and the non-interactive " +
+ "sources.list swap are in the termux_repositories skill.\n" +
+ "\nFor long-running processes (servers, watchers, daemons), the foreground process is orphaned " +
+ "the moment Gotcha returns. The persistence pattern (`nohup ... > log 2>&1 < /dev/null & echo $! " +
+ "> pid; disown`) and the termux-wake-lock requirement are in the termux_background skill. For " +
+ "full Debian/Ubuntu via proot-distro (when Termux's bionic/busybox is not enough), see the " +
+ "termux_proot skill.",
schema {
putJsonObject("properties") {
putJsonObject("command") {