Compare commits

..
11 Commits
Author SHA1 Message Date
thekhalidsha 8f3dbc880a Update repository URLs to git.openkhalix.com 2026-09-28 19:24:04 +05:30
thekhalidsha ec7802463a ci: mirror Gitea releases to GitHub via Actions (release event)
Mirror release to GitHub / mirror (release) Successful in 3s
2026-09-28 14:29:21 +05:30
thekhalidsha d9d4c4219e docs: the owner is the only contributor 2026-09-28 14:11:06 +05:30
thekhalidsha 9f336d4edc README: show the app icon; repository avatar 2026-09-28 13:28:00 +05:30
thekhalidsha 557ee5c936 docs: release order on Gitea follows tag dates 2026-09-28 13:19:18 +05:30
thekhalidsha 31f8e52e74 docs: history cleaned, repository public, branch protection 2026-09-28 13:12:09 +05:30
thekhalidsha 917d4632c2 Open source under Apache 2.0, with a new README
- LICENSE (Apache 2.0), NOTICE with credits (Needle 2, LiteRT-LM, Thinai),
  LICENSES/Thinai-MIT.txt, SPDX headers on every source file
- CONTRIBUTING (fork, branch from develop, PR into develop, maintainer
  merges), CODE_OF_CONDUCT (Contributor Covenant 2.1), SECURITY, Gitea
  issue and pull-request templates
- README rewritten with screenshots; the detailed guide moved to
  docs/USER_GUIDE.md
- Personal details removed: made-up contact names in examples and tests,
  a placeholder for the Tailscale address, made-up web-search fixtures
  in place of saved third-party pages
- B-43: the emulator reports Needle as unavailable instead of "init failed"
- B-44: chat previews show plain text, not Markdown symbols
2026-09-28 12:40:28 +05:30
thekhalidsha 0bd9888335 docs: 0.4.4 is the current release 2026-09-28 12:18:50 +05:30
thekhalidsha 5b24df82c6 docs: branch and release model, a release for every version since 0.1.0 2026-09-28 12:08:12 +05:30
thekhalidsha 5a4470fc5e docs: Gitea releases, per-version branches, Bitwarden key backup steps 2026-09-28 11:36:54 +05:30
thekhalidsha 48dce2853d docs: record the online repository on the owner's Gitea server 2026-09-28 11:30:36 +05:30
113 changed files with 1342 additions and 151 deletions

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
---
name: Bug report
about: Something in Stitch doesn't work as it should
title: "[Bug] "
labels: []
---
**What did you ask or do?**
<!-- e.g. "said 'remove the 6:30 alarm'" -->
**What happened?**
**What did you expect?**
**Details**
- Stitch version (Settings shows it):
- Phone model and Android version:
- AI provider in use (e.g. on this phone, Thinai, OpenAI…):
- Does it happen every time?
<!-- Screenshots help. Please blur any names, numbers or messages you don't want public. -->
+14
View File
@@ -0,0 +1,14 @@
---
name: Feature request
about: An idea for something Stitch could do
title: "[Idea] "
labels: []
---
**What would you like Stitch to do?**
<!-- Describe it the way you'd say it to Stitch, e.g. "read my unread emails aloud in the morning" -->
**Why would it help you?**
**Anything it must never do?**
<!-- e.g. "should never send without asking" — safety limits are part of the design -->
+15
View File
@@ -0,0 +1,15 @@
<!-- Pull requests go into `develop`, not `main`. Only the maintainer merges. -->
**What this changes and why**
**How it was tested**
- [ ] `./gradlew testDebugUnitTest` passes
- [ ] `./gradlew assembleDebug` builds
- [ ] Tested on a phone or emulator (which one?):
- [ ] Needle eval still at 0 wrong (only if requests to the on-device model changed)
**Safety check**
- [ ] Anything that calls, sends, deletes, pays or posts still asks the user first
- [ ] New source files carry the SPDX license header
Related issue: #
+191
View File
@@ -0,0 +1,191 @@
name: Mirror release to GitHub
# Mirrors Gitea releases (title, body, prerelease flag, APK assets) to
# github.com/${{ github.repository }}. The Gitea push mirror only syncs git
# refs (branches/tags), never releases — this workflow closes that gap.
# Requires repo secret: GH_PAT (GitHub PAT with repo scope / contents:write).
on:
release:
workflow_dispatch:
inputs:
tag:
description: "Gitea tag to mirror (blank = latest Gitea release)"
required: false
jobs:
mirror:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Mirror release to GitHub
env:
GH_PAT: ${{ secrets.GH_PAT }}
EVENT_TAG: ${{ github.event.release.tag_name }}
INPUT_TAG: ${{ github.event.inputs.tag }}
GITEA_SERVER: ${{ github.server_url }}
GH_REPO: ${{ github.repository }}
run: |
cat > /tmp/mirror-release.cjs <<'SCRIPT_EOF'
const { spawnSync } = require("node:child_process");
const fs = require("node:fs");
const GH_PAT = process.env.GH_PAT || "";
const GITEA = (process.env.GITEA_SERVER || "https://git.openkhalix.com").replace(/\/+$/, "");
const REPO = process.env.GH_REPO || "thekhalidsha/stitch";
const TAG = ((process.env.EVENT_TAG || "") + "").trim() || ((process.env.INPUT_TAG || "") + "").trim();
function curlJson(url, opts = {}) {
const args = ["-sS", "-L", "-X", opts.method || "GET", "-w", "\n%{http_code}", url];
if (opts.token) args.push("-H", "Authorization: token " + opts.token);
args.push("-H", "Accept: application/json");
if (opts.body !== undefined) {
args.push("-H", "Content-Type: application/json");
args.push("--data", JSON.stringify(opts.body));
}
const r = spawnSync("curl", args, { encoding: "utf8", maxBuffer: 64 * 1024 * 1024 });
if (r.error || r.status !== 0) throw new Error("curl failed for " + url + ": " + (r.stderr || r.error));
const out = r.stdout;
const nl = out.lastIndexOf("\n");
const code = parseInt(out.slice(nl + 1), 10);
const txt = out.slice(0, nl);
let body = null;
try { body = txt ? JSON.parse(txt) : null; } catch { body = txt; }
return { status: code, body };
}
function curlDownload(url, out, token) {
const args = ["-sS", "-L", "--fail", "--retry", "3", "-o", out, url];
if (token) args.splice(1, 0, "-H", "Authorization: token " + token);
const r = spawnSync("curl", args, { encoding: "utf8" });
if (r.error || r.status !== 0) throw new Error("download failed: " + (r.stderr || r.error));
}
function main() {
if (!GH_PAT) {
console.error("ERROR: GH_PAT secret is not set");
process.exit(1);
}
// 1. Resolve the tag to mirror (event -> input -> latest Gitea release)
let tag = TAG;
if (!tag) {
const latest = curlJson(`${GITEA}/api/v1/repos/${REPO}/releases?limit=1&page=1`);
if (latest.status !== 200 || !Array.isArray(latest.body) || latest.body.length === 0) {
console.error("ERROR: cannot list Gitea releases:", latest.status, latest.body);
process.exit(1);
}
tag = latest.body[0].tag_name;
console.log(`No tag given - using latest Gitea release: ${tag}`);
}
// 2. Fetch the Gitea release (source of truth)
const gr = curlJson(`${GITEA}/api/v1/repos/${REPO}/releases/tags/${encodeURIComponent(tag)}`);
if (gr.status === 404) {
console.log(`Release ${tag} not found on Gitea (deleted or draft) - nothing to mirror.`);
process.exit(0);
}
if (gr.status !== 200) {
console.error("ERROR: Gitea API error", gr.status, gr.body);
process.exit(1);
}
const g = gr.body;
console.log(`Gitea release: ${g.tag_name} "${g.name}" prerelease=${g.prerelease} assets=${(g.assets || []).length}`);
// 3. Upsert the GitHub release (title / body / prerelease flag)
const hr = curlJson(`https://api.github.com/repos/${REPO}/releases/tags/${encodeURIComponent(tag)}`, { token: GH_PAT });
const payload = {
tag_name: g.tag_name,
name: g.name || g.tag_name,
body: g.body || "",
prerelease: !!g.prerelease,
draft: false,
target_commitish: g.target_commitish || undefined,
};
let gh;
if (hr.status === 404) {
const created = curlJson(`https://api.github.com/repos/${REPO}/releases`, { token: GH_PAT, method: "POST", body: payload });
if (created.status !== 201 && created.status !== 200) {
console.error("ERROR: creating GitHub release failed:", created.status, created.body);
process.exit(1);
}
gh = created.body;
console.log(`Created GitHub release ${tag} (prerelease=${payload.prerelease})`);
} else if (hr.status === 200) {
gh = hr.body;
const differs =
(gh.name || "") !== payload.name ||
(gh.body || "") !== payload.body ||
!!gh.prerelease !== payload.prerelease;
if (differs) {
const upd = curlJson(`https://api.github.com/repos/${REPO}/releases/${gh.id}`, {
token: GH_PAT, method: "PATCH",
body: { name: payload.name, body: payload.body, prerelease: payload.prerelease },
});
if (upd.status === 200) {
gh = upd.body;
console.log("Updated existing GitHub release to match Gitea (title/body/prerelease)");
} else {
console.log("WARN: could not update release fields:", upd.status);
}
} else {
console.log(`GitHub release ${tag} already exists and matches - no field changes`);
}
} else {
console.error("ERROR: GitHub API error", hr.status, hr.body);
process.exit(1);
}
// 4. Mirror assets (download from Gitea, upload to GitHub, size-verified)
const gassets = g.assets || [];
for (const a of gassets) {
const existing = (gh.assets || []).find((x) => x.name === a.name);
if (existing && existing.size === a.size) {
console.log(`Asset ${a.name} already present (${a.size} B) - skip`);
continue;
}
if (existing) {
const d = curlJson(`https://api.github.com/repos/${REPO}/releases/assets/${existing.id}`, { token: GH_PAT, method: "DELETE" });
console.log(`Removed mismatched asset ${a.name} (HTTP ${d.status})`);
}
const tmp = "/tmp/" + a.name.replace(/[^\w.\-]/g, "_");
console.log(`Downloading ${a.name} (${a.size} B) from Gitea...`);
curlDownload(a.browser_download_url, tmp, process.env.GITEA_TOKEN || "");
const got = fs.statSync(tmp).size;
if (got !== a.size) {
console.error(`ERROR: download size mismatch ${got} != ${a.size}`);
process.exit(1);
}
const up = spawnSync("curl", [
"-sS", "--fail", "--retry", "3", "-X", "POST",
"-H", "Authorization: token " + GH_PAT,
"-H", "Content-Type: application/octet-stream",
"--data-binary", "@" + tmp,
`https://uploads.github.com/repos/${REPO}/releases/${gh.id}/assets?name=${encodeURIComponent(a.name)}`,
"-o", "/tmp/gh-upload.json",
], { encoding: "utf8" });
fs.unlinkSync(tmp);
if (up.error || up.status !== 0) {
console.error("ERROR: upload failed:", up.stderr, fs.existsSync("/tmp/gh-upload.json") ? fs.readFileSync("/tmp/gh-upload.json", "utf8") : "");
process.exit(1);
}
console.log(`Uploaded ${a.name} to GitHub`);
}
// 5. Final verification: refetch GitHub release, asset names + sizes must match
const verify = curlJson(`https://api.github.com/repos/${REPO}/releases/${gh.id}`, { token: GH_PAT });
let ok = verify.status === 200;
for (const a of gassets) {
const m = ((verify.body || {}).assets || []).find((x) => x.name === a.name);
if (!m || m.size !== a.size) {
ok = false;
console.error(`VERIFY FAIL: ${a.name} missing or size mismatch on GitHub`);
}
}
if (!ok) process.exit(2);
console.log(`DONE: ${tag} mirrored to GitHub - ${gassets.length} asset(s) verified, prerelease=${payload.prerelease}`);
}
main();
SCRIPT_EOF
node /tmp/mirror-release.cjs
+15
View File
@@ -25,6 +25,21 @@ cp app/build/outputs/apk/release/app-release.apk dist/Stitch-<version>.apk
~/Android/Sdk/build-tools/35.0.0/aapt dump badging dist/Stitch-<version>.apk | head -1 # verify version ~/Android/Sdk/build-tools/35.0.0/aapt dump badging dist/Stitch-<version>.apk | head -1 # verify version
``` ```
- Work on `develop` (or a `feature/<name>` branch off it). For a release, branch `release/<version>` from
`develop`, bump the version there, build, test, then merge into `main` and back into `develop`.
- Tag it: `v<version>-alpha.N` (tests pass), `-beta.N` (phone checklist passed), plain `v<version>` (used
on the phone without problems). Push branches and tags, then create the Gitea release (pre-release for
alpha/beta) and attach the APK. Token: `~/.config/gitea/token`, passed per command with
`-c http.extraHeader`, never stored in the repo config; send a normal User-Agent to the Gitea API
(it rejects Python's default with a 403).
Gitea orders releases by the **tag's date**: a tag made after the fact must be given the real release
date (`GIT_COMMITTER_DATE`), or it jumps to the top of the Releases tab.
- Stitch is open source (Apache 2.0). New source files start with the SPDX header
(`// SPDX-FileCopyrightText: 2026 Mohammed Khalid` / `// SPDX-License-Identifier: Apache-2.0`); code
adapted from elsewhere is credited in `NOTICE`. Never commit personal data: real contact names or
numbers, private addresses, keys or tokens. Examples use made-up names.
- **The owner is the only contributor.** No `Co-Authored-By:` lines, "Generated with" footers or other AI
attribution in commits, tags, pull requests or release notes. Commit as the repo's configured identity.
- Bump `versionCode` **and** `versionName` in `app/build.gradle.kts` first. - Bump `versionCode` **and** `versionName` in `app/build.gradle.kts` first.
- Never copy the APK before confirming the build succeeded (a stale copy once shipped as a new version). - Never copy the APK before confirming the build succeeded (a stale copy once shipped as a new version).
- **Signing:** leave the default (debug key) so builds install over the owner's phone. `-PreleaseKey` switches to the real key at `~/.stitch-release-key/` and makes the APK refuse to install over the current app — only use it for the deliberate cutover in `docs/SIGNING.md`. - **Signing:** leave the default (debug key) so builds install over the owner's phone. `-PreleaseKey` switches to the real key at `~/.stitch-release-key/` and makes the APK refuse to install over the current app — only use it for the deliberate cutover in `docs/SIGNING.md`.
+85
View File
@@ -0,0 +1,85 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at the maintainer by opening an issue titled "Conduct report" (no details in it) and asking to be contacted privately; reports are handled in confidence. All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of actions.
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
+80
View File
@@ -0,0 +1,80 @@
# Contributing to Stitch
Thanks for wanting to help. Stitch is maintained by one person, so this guide keeps things simple and
predictable for everyone.
## The short version
1. **Fork** the repository and clone your fork.
2. Create a branch **from `develop`**: `git checkout -b feature/short-name develop`
(use `fix/short-name` for bug fixes).
3. Make your change, **with tests**, and run the checks below.
4. Open a **pull request into `develop`** (never into `main`).
5. The maintainer reviews it. Only the maintainer merges; `main` and `develop` are protected.
Please open an issue first for anything larger than a small fix, so no one spends a weekend on
something that won't be merged.
## How the branches work
| Branch | What it holds | Who writes to it |
|---|---|---|
| `main` | Released versions only | Maintainer, by merging a release |
| `develop` | The next version, as it comes together | Maintainer, by merging pull requests |
| `feature/*`, `fix/*` | One change each | You, in your fork |
| `release/<version>` | One per version | Maintainer |
Releases are tagged `v<version>-alpha.N` (tests pass), `v<version>-beta.N` (tested on a real phone) and
`v<version>` (final). See the README for the full model.
## Before you open a pull request
```sh
export JAVA_HOME=/path/to/jdk-17
./gradlew testDebugUnitTest # every test must pass
./gradlew assembleDebug # it must build
```
If you touched how requests reach the on-device model (tool descriptions, `agent/Agent.kt`, `QuickCommands`),
also run the Needle eval; its "wrong" count must stay **0**:
```sh
python3 tools-dev/needle/run_eval.py path/to/needle app/build/needle-tools.json 0.4
```
No paid AI key is needed to test: `python3 tools-dev/fake-ai/fake_ai.py` runs a stand-in AI server.
## What a good change looks like
- **Safety comes first.** Stitch can call, text and tap on someone's phone. Anything that sends,
deletes, pays or posts must go through the existing confirmation path (`Tool.risk`,
`needsConfirmation`). Values that must be exact — phone numbers, names, times — come from the phone's
data or the user's own words, never from a model's memory.
- **Match the surrounding code**: Kotlin, Jetpack Compose, one module, comments that explain *why*.
- **Plain language** in anything a user reads: Stitch is used by people who are not developers.
- **Tests** for behaviour, especially bug fixes: a test that fails before the fix and passes after.
- **New source files** start with the license header:
```kotlin
// SPDX-FileCopyrightText: 2026 Your Name
// SPDX-License-Identifier: Apache-2.0
```
## Commit messages
A short summary line (under ~70 characters), a blank line, then *why* the change was needed. Reference
the issue if there is one (`Fixes #12`).
## Licensing of contributions
Stitch is licensed under the **Apache License 2.0**. By submitting a pull request you agree that your
contribution is licensed under the same terms (section 5 of the license), and that you have the right
to submit it. No separate agreement is needed.
## Reporting bugs and asking for features
Use the issue templates. For a bug, the Stitch version (Settings shows it), your phone model and Android
version, what you said to Stitch, and what happened are the four things that matter most.
Security problems: please **don't** open a public issue — see [SECURITY.md](SECURITY.md).
Everyone taking part is expected to follow the [Code of Conduct](CODE_OF_CONDUCT.md).
+34 -8
View File
@@ -169,14 +169,11 @@ All times IST. All APKs are in `dist/`.
| **0.3.6** | 19:39 | 54 MB | Show Markdown nicely | Built-in Markdown renderer: headings, lists, tables, code, quotes, links | | **0.3.6** | 19:39 | 54 MB | Show Markdown nicely | Built-in Markdown renderer: headings, lists, tables, code, quotes, links |
| **0.3.7** | 19:53 | 54 MB | Couldn't remove an alarm by asking | **CRUD across the app**: list/delete alarms, cancel timer, edit reminders, edit/delete calendar events, edit/delete contacts, notes, list memories, clear notifications | | **0.3.7** | 19:53 | 54 MB | Couldn't remove an alarm by asking | **CRUD across the app**: list/delete alarms, cancel timer, edit reminders, edit/delete calendar events, edit/delete contacts, notes, list memories, clear notifications |
| **0.3.8** | 20:27 | 54 MB | "Turn off (last) alarm" not understood; removal one minute early (8:42 vs 8:43) | Exact alarm resolution with minute rounding and snapping, "last" alarm, more phrasings, verify-then-fallback to the Clock app | | **0.3.8** | 20:27 | 54 MB | "Turn off (last) alarm" not understood; removal one minute early (8:42 vs 8:43) | Exact alarm resolution with minute rounding and snapping, "last" alarm, more phrasings, verify-then-fallback to the Clock app |
| **0.3.9** | 20 Sep, 23:42 | 54 MB | Alarm removal still failed (claimed success, alarm stayed on); phone numbers garbled in messages and calls; music opened search instead of playing | Alarms turned off **on screen** in the Clock app and checked visually. Phone numbers must come from contacts or the user's own words. Music: taps the first result automatically. Conversation now survives app restarts |
| **0.4.0** | 21 Sep, 01:05 | 54 MB | "Build the hotword in one go; the bubble should also see what's on screen" | **Wake phrase** taught by your voice (MFCC + DTW, fully offline), listening service with battery policy, **bubble** over any app with voice + typing, Stitch registers as a **digital assistant** (power-button hold), Quick Settings tile, and the bubble can **read the app behind it** | | **0.4.0** | 21 Sep, 01:05 | 54 MB | "Build the hotword in one go; the bubble should also see what's on screen" | **Wake phrase** taught by your voice (MFCC + DTW, fully offline), listening service with battery policy, **bubble** over any app with voice + typing, Stitch registers as a **digital assistant** (power-button hold), Quick Settings tile, and the bubble can **read the app behind it** |
| **0.3.9** | 20 Sep, 00:05 | 54 MB | Alarm removal still failed (claimed success, alarm stayed on); phone numbers garbled in messages and calls; music opened search instead of playing | Alarms turned off **on screen** in the Clock app and checked visually. Phone numbers must come from contacts or the user's own words. Music: taps the first result automatically. Conversation now survives app restarts |
| **0.4.1** | 22 Sep, 12:51 | 54 MB | Needle garbled a contact name, a typed number and an alarm time; owner asked for a tidier Settings page and tabs on the main screen | **Fixes B-26, B-27, B-28** (a slightly misspelled contact name is still found; your own typed number is used when the model mangles it; "remove the 2:14 AM alarm" reads the time from your words). **Settings** split into six categories (AI & provider, Voice & hotword, Phone control, Permissions & access, On-device model, Default apps), each on its own page with a back arrow. **Main screen tabs:** Chat, Schedule (alarms, reminders, calendar events, soonest first), Saved (notes and memories), Workflows (placeholder) | | **0.4.1** | 22 Sep, 12:51 | 54 MB | Needle garbled a contact name, a typed number and an alarm time; owner asked for a tidier Settings page and tabs on the main screen | **Fixes B-26, B-27, B-28** (a slightly misspelled contact name is still found; your own typed number is used when the model mangles it; "remove the 2:14 AM alarm" reads the time from your words). **Settings** split into six categories (AI & provider, Voice & hotword, Phone control, Permissions & access, On-device model, Default apps), each on its own page with a back arrow. **Main screen tabs:** Chat, Schedule (alarms, reminders, calendar events, soonest first), Saved (notes and memories), Workflows (placeholder) |
| **0.4.2** | 24 Sep, 14:11 | 54 MB | Owner tested 0.4.1 on a real phone for the first time and reported back against `docs/STAGE_A_CHECKLIST.md` | **First release driven by real-phone testing.** Fixes B-29 (music now plays instead of tapping the search bar), B-30 (alarm removal), B-31 (the bubble shows the app you were in), B-32 (spoken replies can be stopped, and no longer recite tables), B-33 (wake-phrase false wakes), B-34 (Settings survives rotation). New: **backup & restore**, a **who answers you** setting (Hybrid / on-device only / always my AI), a **Phone control** Quick Settings tile for banking apps, per-recording wake-phrase scoring, and conversational replies instead of status reports | | **0.4.2** | 24 Sep, 14:11 | 54 MB | Owner tested 0.4.1 on a real phone for the first time and reported back against `docs/STAGE_A_CHECKLIST.md` | **First release driven by real-phone testing.** Fixes B-29 (music now plays instead of tapping the search bar), B-30 (alarm removal), B-31 (the bubble shows the app you were in), B-32 (spoken replies can be stopped, and no longer recite tables), B-33 (wake-phrase false wakes), B-34 (Settings survives rotation). New: **backup & restore**, a **who answers you** setting (Hybrid / on-device only / always my AI), a **Phone control** Quick Settings tile for banking apps, per-recording wake-phrase scoring, and conversational replies instead of status reports |
| **0.4.3** | 24 Sep, 15:34 | 54 MB | Owner: "I can't save separate settings for each provider" — switching from OpenCode Zen to MiMo and back reported an invalid key | **B-36:** every provider now keeps its own API key, address and model, so you can switch freely. An upgrade moves the existing key onto whichever provider was selected. Plus an eye icon to check a key you've typed, a ✓ in the picker next to providers that are set up, and Robolectric so settings and backups can be tested without a device | | **0.4.3** | 24 Sep, 15:34 | 54 MB | Owner: "I can't save separate settings for each provider" — switching from OpenCode Zen to MiMo and back reported an invalid key | **B-36:** every provider now keeps its own API key, address and model, so you can switch freely. An upgrade moves the existing key onto whichever provider was selected. Plus an eye icon to check a key you've typed, a ✓ in the picker next to providers that are set up, and Robolectric so settings and backups can be tested without a device |
| **0.4.4** | 28 Sep, 10:53 | 54 MB | Owner asked what could be taken from **Thinai**, an open-source on-device AI app, then asked for all of it: use Thinai as a model, its prompt-injection hardening, its web search, and its chats panel and model guide | **Chats panel** (☰): every conversation saved; new chat, switch, search, rename, delete, delete all (B-38). **Model guide**: 20 real `.litertlm` models, the phone's RAM/CPU/storage, use-case chips, "runs well / tight / too big" and a speed estimate. **Thinai preset**, and any server on the phone gets the small-model treatment. **Web search** with a Bing fallback, engine resting and a relevance filter (B-37). **Random-id wrapper** for other people's text (B-40). **Wake phrase no longer crashes the app after an update** (B-39, found while testing) | | **0.4.4** | 28 Sep, 10:53 | 54 MB | Owner asked what could be taken from **Thinai**, an open-source on-device AI app, then asked for all of it: use Thinai as a model, its prompt-injection hardening, its web search, and its chats panel and model guide | **Chats panel** (☰): every conversation saved; new chat, switch, search, rename, delete, delete all (B-38). **Model guide**: 20 real `.litertlm` models, the phone's RAM/CPU/storage, use-case chips, "runs well / tight / too big" and a speed estimate. **Thinai preset**, and any server on the phone gets the small-model treatment. **Web search** with a Bing fallback, engine resting and a relevance filter (B-37). **Random-id wrapper** for other people's text (B-40). **Wake phrase no longer crashes the app after an update** (B-39, found while testing) |
Every build installs over the previous one: same package `app.stitch`, same signing key, and the version code goes up. Every build installs over the previous one: same package `app.stitch`, same signing key, and the version code goes up.
@@ -250,6 +247,21 @@ All times IST.
| 28 Sep, 10:37 | Emulator: the app crashed on launch — the wake-phrase service, restarted by Android after the reinstall, was refused the microphone (B-39, pre-existing). Fixed and re-tested | | 28 Sep, 10:37 | Emulator: the app crashed on launch — the wake-phrase service, restarted by Android after the reinstall, was refused the microphone (B-39, pre-existing). Fixed and re-tested |
| 28 Sep, 10:4x | Emulator run of the chats panel, the Thinai path (simulated with `adb reverse`) and the model guide. Found and fixed: failed exchanges reloaded as unanswered questions (B-41), keyboard covering the panel, "0.0 GHz" on the emulator (B-42) | | 28 Sep, 10:4x | Emulator run of the chats panel, the Thinai path (simulated with `adb reverse`) and the model guide. Found and fixed: failed exchanges reloaded as unanswered questions (B-41), keyboard covering the panel, "0.0 GHz" on the emulator (B-42) |
| 28 Sep, 10:53 | **0.4.4 built**: 124 tests (0 failed), Needle eval unchanged (wrong 0), version confirmed with `aapt`, new features confirmed present in the APK | | 28 Sep, 10:53 | **0.4.4 built**: 124 tests (0 failed), Needle eval unchanged (wrong 0), version confirmed with `aapt`, new features confirmed present in the APK |
| 28 Sep, ~11:1x | 0.4.4 committed (`33be675`), merged into `master` and tagged `v0.4.4` |
| 28 Sep, ~11:3x | **First off-machine copy of the project.** The owner created a private repository on their Gitea server; `master`, `release/0.4.4`, `v0.4.3` and `v0.4.4` pushed and checked against the local copy. The access token was passed per command, not stored in the repository's settings |
| 28 Sep, ~11:4x | Owner saw no releases on Gitea: tags don't create them. Created **Gitea releases** for v0.4.3 and v0.4.4 with their APKs attached (checksums verified against `dist/`), and a `release/0.4.3` branch from its tag. Versions before 0.4.3 have no source in git, so they have no branch. Gitea's API refused Python's default User-Agent with a 403; sending a normal one fixed it. `docs/SIGNING.md` gained Bitwarden backup and restore steps |
| 28 Sep, ~12:0x | Owner saved the signing key in Bitwarden, then asked for a proper branch structure. Explained that alpha, beta and staging are usually stages marked by tags, not branches; owner chose the standard model (`main`, `develop`, `feature/*`, `release/<version>`, `hotfix/*`; alpha/beta/final as tags) and renaming `master` → `main`. Done here and on Gitea, where `main` is now the default |
| 28 Sep, ~12:1x | **A branch, tag and Gitea release for every version from 0.1.0.** `dist/` checked first: 17 APKs, versionCodes 1–17 with none missing. The 15 versions before git (0.1.0–0.4.2) got archive branches that hold only their release notes and the APK's SHA-256, since their source no longer exists; their APKs are attached to their releases. All 17 uploaded APKs downloaded back and checked: all identical to `dist/`. Also fixed in this document: 0.3.9's build time (23:42, not 00:05, per the APK) and its place in the release table |
| 28 Sep, ~12:3x | Owner: make 0.4.4 the latest working release. Its Gitea release changed from pre-release to **release**; Gitea now shows it as Latest. This is ahead of the usual rule (a full release after phone use), by the owner's choice; the release notes say the phone checklist hasn't been run on it yet |
| 28 Sep, ~12:4x | Owner decided to **open-source Stitch**: anyone may use, modify, fork and sell it, with contributions merged only by the owner, and credit appreciated. Chose the **Apache License 2.0** (permissive, commercial use allowed, a NOTICE file that carries the credit, a patent grant, and the same license as every library Stitch uses) over MIT. Copyright: Mohammed Khalid |
| 28 Sep, ~12:5x | Pre-publication check of every tracked file and the whole history. Found: possibly real contact names from the owner's bug reports ("Maria Daniya", "Rahul"), the build machine's Tailscale address, the owner's email on every commit, and a saved Bing results page (third-party content) as a test fixture. Owner chose to clean the history as well as the current files |
| 28 Sep, ~13:0x | Added `LICENSE` (official Apache 2.0 text), `NOTICE` (owner's credit; Needle 2, LiteRT-LM and Thinai attributions), `LICENSES/Thinai-MIT.txt`, SPDX headers on 93 source files, `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md` (Contributor Covenant 2.1), `SECURITY.md`, Gitea issue and pull-request templates. Contact names replaced with made-up ones ("Maria Daniya", "Rahul"), the Tailscale address with a placeholder, and the Bing and DuckDuckGo fixtures with made-up pages in the same structure. 125 tests pass |
| 28 Sep, ~13:2x | New README with screenshots taken in the emulator against a demo AI (tools kept in scratch, not the repo); the old README's detail moved to `docs/USER_GUIDE.md`. Two small bugs found while taking them: B-43, B-44 |
| 28 Sep, ~13:4x | **History cleaned.** A full backup bundle was made first. `git filter-branch` rewrote all 23 commits on every branch and tag: the same name/address replacements and made-up fixtures applied to every old version of every file, and the owner's email replaced with `[email protected]`. The 17 annotated tags were recreated with that address, keeping their dates and messages. Every file in every commit then searched: nothing left (the only hits were the OAuth scope name `gmail.compose` in `docs/PLAN.md`). Force-pushed; all 36 branches and tags on Gitea checked identical to the local copy. The v0.3.5 release notes on Gitea were corrected too. This repository now commits with the no-reply address. The session paused once mid-way without saying so; nothing had been pushed at that point |
| 28 Sep, ~13:5x | Branch protection on Gitea for `main`, `develop` and `release/*`: only the owner may push or merge, force pushes blocked. Description and topics set, wiki off. **Repository made public**; checked without logging in: the page opens, Gitea detects Apache-2.0, and the 0.4.4 APK downloads |
| 28 Sep, ~14:0x | Owner: the Releases tab showed 0.4.2 on top, not 0.4.4. Gitea orders releases by their **tag's date**, and the archive tags for 0.1.0–0.4.2 had all been created at 11:58 that day, after 0.4.4's tag. A first attempt, recreating the 0.4.3 and 0.4.4 release pages, changed nothing (C-16). Fix: the 15 archive tags re-created with each APK's real build date as the tag date and force-pushed (tags only; commits unchanged). The list now runs 0.4.4 (Latest) → 0.1.0, each dated when it was built, all 17 APKs still attached |
| 28 Sep, ~14:3x | App icon added to the top of the README (`docs/images/icon.svg` from the icon's own vector shapes, plus a 512 px `icon.png` drawn from them, since no SVG converter is installed) and set as the Gitea repository's avatar |
| 28 Sep, ~14:5x | Owner saw Claude listed as a contributor on Gitea: every commit message ended with a `Co-Authored-By: Claude …` line. Owner asked for it gone from the whole history. All 26 commit messages rewritten without it (backup bundle first; authors, dates and tag dates unchanged, so the release order held); branch protection briefly allowed a force push for the owner only, then re-locked. Gitea checked: every commit by `thekhalidsha` alone, 17 releases intact. Rule added to `CLAUDE.md`: no AI attribution in git |
--- ---
@@ -320,6 +332,8 @@ Every significant failure, in four groups:
| B-40 | *(security, found comparing with Thinai)* A web page or message could step outside the "this is other people's text" wrapper | The wrapper was a fixed `<untrusted_content>` tag, so text containing `</untrusted_content>` appeared to end it. Small on-phone models also see chat-template tokens (`<\|im_end\|>`, `<start_of_turn>`) raw, which let text fake a new turn | Ported from Thinai: a fresh random id per wrap, forged markers stripped, control tokens broken with an invisible character, inline images defused | 0.4.4 | | B-40 | *(security, found comparing with Thinai)* A web page or message could step outside the "this is other people's text" wrapper | The wrapper was a fixed `<untrusted_content>` tag, so text containing `</untrusted_content>` appeared to end it. Small on-phone models also see chat-template tokens (`<\|im_end\|>`, `<start_of_turn>`) raw, which let text fake a new turn | Ported from Thinai: a fresh random id per wrap, forged markers stripped, control tokens broken with an invisible character, inline images defused | 0.4.4 |
| B-41 | *(found in the emulator before release)* A reloaded chat sent the AI questions whose answers had failed, back to back | Error replies were rightly excluded from what the AI sees, but their questions were kept | A failed or stopped exchange is dropped whole, the way the live conversation already did | 0.4.4 | | B-41 | *(found in the emulator before release)* A reloaded chat sent the AI questions whose answers had failed, back to back | Error replies were rightly excluded from what the AI sees, but their questions were kept | A failed or stopped exchange is dropped whole, the way the live conversation already did | 0.4.4 |
| B-42 | *(found in the emulator)* The model guide said "4 cores up to 0.0 GHz" | The emulator reports its CPU speed as "2" | Speeds under 0.5 GHz are treated as unknown | 0.4.4 | | B-42 | *(found in the emulator)* The model guide said "4 cores up to 0.0 GHz" | The emulator reports its CPU speed as "2" | Speeds under 0.5 GHz are treated as unknown | 0.4.4 |
| B-43 | *(found in the emulator, since 0.3.0)* The top bar said "Needle init failed (error -1)" on the x86_64 emulator | x86_64 emulators also list ARM among their supported CPU types, so Stitch assumed the real engine was installed, when the emulator build installs a stand-in that always fails | Stitch checks which native-library folder Android actually installed; the emulator now says "Not available on this CPU (x86_64)". Phones are unaffected | next release |
| B-44 | *(found in the emulator)* The chats panel previews showed Markdown symbols ("\*\*Subject:\*\*") | The preview was the raw reply text | Previews go through `MarkdownParser.toPlainText`; a test covers it | next release |
### C. Mistakes in Claude's own process ### C. Mistakes in Claude's own process
@@ -342,6 +356,7 @@ These are recorded plainly, since they cost the owner time.
| C-14 | **The project had no version control at all for its first six days and 16 releases.** Nobody asked for it, and I never raised it | Every edit was a one-way change to the only copy. C-01 (a script that inserted text between every character of `NeedleEngine.kt`) had no undo — the file had to be rewritten from scratch. Any accidental overwrite of working code between releases would have been unrecoverable, and there is no record of what changed between the 16 APKs beyond this document | `git init` on 25 Sep, one initial-import commit, tagged `v0.4.3`. From now on each release is its own commit and tag. The history before 0.4.3 cannot be reconstructed; the APKs in `dist/` are all that remains of it. Rule: a project that is producing releases gets a repository on day one, whether or not it was asked for | | C-14 | **The project had no version control at all for its first six days and 16 releases.** Nobody asked for it, and I never raised it | Every edit was a one-way change to the only copy. C-01 (a script that inserted text between every character of `NeedleEngine.kt`) had no undo — the file had to be rewritten from scratch. Any accidental overwrite of working code between releases would have been unrecoverable, and there is no record of what changed between the 16 APKs beyond this document | `git init` on 25 Sep, one initial-import commit, tagged `v0.4.3`. From now on each release is its own commit and tag. The history before 0.4.3 cannot be reconstructed; the APKs in `dist/` are all that remains of it. Rule: a project that is producing releases gets a repository on day one, whether or not it was asked for |
| C-13 | The same session's plan stated 16 things that were not true — most importantly that the `hermes-android` bridge was "not installed locally" when it is cloned in the next folder along, and "42 tools" when the project's own README says 38. It also proposed creating files that already exist and omitted every package the app actually has | The plan read as researched but had not been checked against the source tree or the machine. Acting on it would have meant rebuilding things that exist and missing the two real blockers (the API server's loopback bind and its mandatory key) | Every claim re-verified against code, `~/.hermes`, and the upstream sources. Full list kept as §12 of `docs/UPGRADE_PLAN.md`. Rule: a plan that quotes a number must say where the number was read from | | C-13 | The same session's plan stated 16 things that were not true — most importantly that the `hermes-android` bridge was "not installed locally" when it is cloned in the next folder along, and "42 tools" when the project's own README says 38. It also proposed creating files that already exist and omitted every package the app actually has | The plan read as researched but had not been checked against the source tree or the machine. Acting on it would have meant rebuilding things that exist and missing the two real blockers (the API server's loopback bind and its mandatory key) | Every claim re-verified against code, `~/.hermes`, and the upstream sources. Full list kept as §12 of `docs/UPGRADE_PLAN.md`. Rule: a plan that quotes a number must say where the number was read from |
| C-15 | The fake AI server used for every emulator test since 19 Sep was never saved in the project | On 28 Sep the emulator still pointed at it, every AI request failed, and it had to be rewritten from memory before anything could be tested | Now kept at `tools-dev/fake-ai/fake_ai.py`, with instructions. Rule: a tool the testing depends on lives in the repository | | C-15 | The fake AI server used for every emulator test since 19 Sep was never saved in the project | On 28 Sep the emulator still pointed at it, every AI request failed, and it had to be rewritten from memory before anything could be tested | Now kept at `tools-dev/fake-ai/fake_ai.py`, with instructions. Rule: a tool the testing depends on lives in the repository |
| C-16 | The archive tags (0.1.0–0.4.2) were created with today's date, and the first fix for the resulting release order (recreating two release pages) was tried before checking how Gitea sorts | 0.4.2 showed above 0.4.4 on the public Releases tab; one wasted round of re-uploads | Gitea sorts by tag date; tags now carry their build dates. Rule: a back-filled tag gets the date of the thing it marks, and a fix is chosen after the cause is confirmed |
### D. Platform limits ### D. Platform limits
@@ -388,7 +403,7 @@ These are recorded plainly, since they cost the owner time.
| `ClockScreenTest` | Reading alarm rows off a Clock app's screen: several time formats, and rows without a time ignored (the B-22/B-30 path) | | `ClockScreenTest` | Reading alarm rows off a Clock app's screen: several time formats, and rows without a time ignored (the B-22/B-30 path) |
| `BackupTest` | Backup encryption and the SharedPreferences round-trip: seal/open, wrong passphrase refused, a single flipped character detected, two backups of the same data differ, unicode survives, a non-backup file is rejected, a newer-version backup is refused, the header reads without the passphrase, every preference type returns as the type it was (a Long does not collapse to an Int, a Float does not become a Double), wake-phrase fingerprints survive byte-identical, an unknown type is skipped rather than crashing | | `BackupTest` | Backup encryption and the SharedPreferences round-trip: seal/open, wrong passphrase refused, a single flipped character detected, two backups of the same data differ, unicode survives, a non-backup file is rejected, a newer-version backup is refused, the header reads without the passphrase, every preference type returns as the type it was (a Long does not collapse to an Int, a Float does not become a Double), wake-phrase fingerprints survive byte-identical, an unknown type is skipped rather than crashing |
| `ChatStoreTest` | Saved chats (Robolectric): titles from the first question, new chat keeps the old one and reuses an empty one, deleting the current chat moves to the newest other, rename, search by text, delete all, the one-time move from the old single chat, failed exchanges dropped whole from what the AI sees, only the last ~40 lines sent | | `ChatStoreTest` | Saved chats (Robolectric): titles from the first question, new chat keeps the old one and reuses an empty one, deleting the current chat moves to the newest other, rename, search by text, delete all, the one-time move from the old single chat, failed exchanges dropped whole from what the AI sees, only the last ~40 lines sent |
| `WebSearchTest` | DuckDuckGo HTML and Lite parsing (adverts dropped, redirects unwrapped, lookalike hosts refused), a **real saved Bing page** with its tracking links decoded, the real DuckDuckGo challenge page recognised, off-topic results dropped, Tamil words kept whole, question → keywords, the fall-through to Bing with 10-minute resting, "blocked" and "unreachable" reported honestly. Plus a live test (`STITCH_LIVE=1`) against the real engines | | `WebSearchTest` | DuckDuckGo HTML and Lite parsing (adverts dropped, redirects unwrapped, lookalike hosts refused), a Bing-shaped results page (made up, in the real page's structure) with its tracking links decoded, the DuckDuckGo challenge page recognised, off-topic results dropped, Tamil words kept whole, question → keywords, the fall-through to Bing with 10-minute resting, "blocked" and "unreachable" reported honestly. Plus a live test (`STITCH_LIVE=1`) against the real engines |
| `UntrustedTest` | Other people's text can't close its wrapper early (random id, forged and old-style markers removed), split forged markers, chat-template tokens broken, inline images defused, ordinary text (including Tamil) unchanged | | `UntrustedTest` | Other people's text can't close its wrapper early (random id, forged and old-style markers removed), split forged markers, chat-template tokens broken, inline images defused, ordinary text (including Tamil) unchanged |
| `ModelGuideTest` | Catalogue entries unique and well-formed, phone classes, fit on 4 GB vs 12 GB, "not enough storage" unless installed, Tamil strictness (Gemma 3 1B is English-only), untried models capped for phone commands, Gemma 4 recommended on a mid-range phone, a 3 GB phone only offered models that fit, a 32-bit phone told why, speed in plain words, servers on 127.0.0.1 counted as on-phone | | `ModelGuideTest` | Catalogue entries unique and well-formed, phone classes, fit on 4 GB vs 12 GB, "not enough storage" unless installed, Tamil strictness (Gemma 3 1B is English-only), untried models capped for phone commands, Gemma 4 recommended on a mid-range phone, a 3 GB phone only offered models that fit, a 32-bit phone told why, speed in plain words, servers on 127.0.0.1 counted as on-phone |
@@ -544,6 +559,9 @@ No system packages were installed. Nothing outside the home folder and the proje
from the contact list. This needs deciding before Stage D is written, not during. from the contact list. This needs deciding before Stage D is written, not during.
19. ~~**No version control.**~~ Fixed 25 Sep: the project is a git repository, tagged `v0.4.3`. The 19. ~~**No version control.**~~ Fixed 25 Sep: the project is a git repository, tagged `v0.4.3`. The
history of the first 16 releases is gone; only the APKs in `dist/` remain. history of the first 16 releases is gone; only the APKs in `dist/` remain.
Since 28 Sep it is also on the owner's Gitea server (public, open source since the same day), so a lost
disk no longer loses the code. Still **not** backed up off this machine: the APKs in `dist/` (deliberately
not in git) and the release signing key at `~/.stitch-release-key/` (must never go into git).
20. **Thinai's server has no password by default, and allows any web page's scripts.** Any app on the 20. **Thinai's server has no password by default, and allows any web page's scripts.** Any app on the
phone — or a web page open in the phone's browser — can use a running Thinai server's model. That phone — or a web page open in the phone's browser — can use a running Thinai server's model. That
costs battery, not data (Stitch's own tools are never exposed through it). Setting an access token costs battery, not data (Stitch's own tools are never exposed through it). Setting an access token
@@ -556,6 +574,13 @@ No system packages were installed. Nothing outside the home folder and the proje
engines and two DuckDuckGo surfaces mean one layout change costs one engine, not the feature. engines and two DuckDuckGo surfaces mean one layout change costs one engine, not the feature.
24. **Saved chats are stored in one preferences file.** Fine for hundreds of chats; if it ever grows 24. **Saved chats are stored in one preferences file.** Fine for hundreds of chats; if it ever grows
to thousands it should move to a database (planned with the audit log, Stage D). to thousands it should move to a database (planned with the audit log, Stage D).
25. **Old commit IDs may linger on the Gitea server** until it cleans up unreferenced data (usually
two weeks or more). They were never public and nothing links to them, so this is a small risk; an admin
can run "Garbage collect all repositories" on the Gitea server to remove them sooner.
26. **The name "Stitch"** is not checked against trademarks; Google also has a design product called
Stitch. Worth a look before promoting the project widely.
27. **No private channel for security or conduct reports yet.** `SECURITY.md` and `CODE_OF_CONDUCT.md`
ask people to open a contact-request issue; a dedicated email address would be better.
--- ---
@@ -563,12 +588,13 @@ No system packages were installed. Nothing outside the home folder and the proje
| Metric | Value (at 0.4.4, measured 28 Sep unless noted) | | Metric | Value (at 0.4.4, measured 28 Sep unless noted) |
|---|---| |---|---|
| Kotlin source files | 67 / 12,908 lines at 0.4.4 (measured 28 Sep; 62 / 11,244 at 0.4.3; 59 / 10,102 at 0.4.1) | | Kotlin source files | 67 / 13,118 lines on `develop` after 0.4.4, license headers included (12,908 at 0.4.4; 62 / 11,244 at 0.4.3; 59 / 10,102 at 0.4.1) |
| Native code | `needle_jni.cpp` + x86_64 stub | | Native code | `needle_jni.cpp` + x86_64 stub |
| Test files / tests | 18 / 124 at 0.4.4 (0 failed, 1 live test skipped by default; 87 at 0.4.3, 80 at 0.4.2, 53 at 0.4.1, 50 at 0.4.0) | | Test files / tests | 18 / 125 on `develop` after 0.4.4 (0 failed, 1 live test skipped by default; 124 at 0.4.4, 87 at 0.4.3, 80 at 0.4.2, 53 at 0.4.1, 50 at 0.4.0) |
| Needle eval (64 phrases, threshold 0.4) | tool 48 · tool+args 47 · on-device 24 · **wrong 0** (re-run 28 Sep at 0.4.4: identical) | | Needle eval (64 phrases, threshold 0.4) | tool 48 · tool+args 47 · on-device 24 · **wrong 0** (re-run 28 Sep at 0.4.4: identical) |
| Version control | git, since 25 Sep. Tags `v0.4.3` and `v0.4.4` (committed 28 Sep on `release/0.4.4`, merged into `master`). `dist/` and build outputs excluded | | Version control | git, since 25 Sep. Tags `v0.4.3` and `v0.4.4` (committed 28 Sep on `release/0.4.4`, merged into `main`, formerly `master`). `dist/` and build outputs excluded. **Online since 28 Sep, public since 28 Sep (Apache 2.0):** `thekhalidsha/stitch` on the owner's Gitea server (`git.openkhalix.com`): `main` (default) and `develop`, a `release/<version>` branch and `v<version>` tag for **every version 0.1.0–0.4.4** (0.1.0–0.4.2 as archive entries: notes and APK fingerprint only, since their source was never kept), and a Gitea release per version with its APK attached, all 17 checked against `dist/` |
| On-phone model catalogue | 20 `.litertlm` models from litert-community (sizes from the Hugging Face API, 28 Sep); 8 use cases | | On-phone model catalogue | 20 `.litertlm` models from litert-community (sizes from the Hugging Face API, 28 Sep); 8 use cases |
| License | Apache 2.0 since 28 Sep 2026 (open source); `NOTICE` carries the credits |
| Tools available to the AI | 70 | | Tools available to the AI | 70 |
| Tools available to Needle on-device | 32 | | Tools available to Needle on-device | 32 |
| Deterministic quick commands | flashlight, play X on Y, alarm set/remove/list, timer set/cancel, reminder set | | Deterministic quick commands | flashlight, play X on Y, alarm set/remove/list, timer set/cancel, reminder set |
+202
View File
@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 Abhinivesh
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+29
View File
@@ -0,0 +1,29 @@
Stitch — an on-device Android agent
Copyright 2026 Mohammed Khalid
This product is licensed under the Apache License, Version 2.0 (see LICENSE).
https://git.openkhalix.com/thekhalidsha/stitch
If you build on Stitch, a credit such as "Based on Stitch by Mohammed Khalid" in your app's
About screen or README is warmly appreciated. It is not required beyond what the license asks:
keep this NOTICE file with any copy or derivative you redistribute.
-------------------------------------------------------------------------------------------------
This product includes third-party software:
* Needle 2 by Cactus Compute — the on-device tool-calling engine and model, shipped as the
prebuilt libraries in app/src/main/cpp/needle/.
Apache License 2.0. https://huggingface.co/Cactus-Compute/needle2
* LiteRT-LM by Google — the engine that runs on-phone language models (a Gradle dependency).
Apache License 2.0. https://github.com/google-ai-edge/LiteRT-LM
* Code adapted from Thinai by Abhinivesh (Copyright (c) 2026 Abhinivesh), MIT License:
the untrusted-text wrapper (agent/Untrusted.kt), the web-search parsing, relevance and query
rules (tools/WebSearch.kt), and the model rating approach (ai/ModelGuide.kt).
The full MIT license text is in LICENSES/Thinai-MIT.txt.
https://github.com/Aravindargutus/Thinai
Other dependencies (AndroidX, Jetpack Compose, Kotlin coroutines, OkHttp) are fetched by Gradle
and are licensed under the Apache License 2.0.
+163 -139
View File
@@ -1,181 +1,205 @@
# Stitch: on-device Android agent <div align="center">
Stitch turns what you type or say into actions on your phone. <img src="docs/images/icon.png" width="128" height="128" alt="Stitch app icon: a white needle trailing a light-blue thread on indigo"/>
- **On-device first:** [Cactus Needle 2](https://huggingface.co/Cactus-Compute/needle2), a 45M-parameter tool-calling model built into the app, handles simple phone commands offline in well under a second: flashlight, alarms, timers, calls, texts, call log, media, and settings. # Stitch
- **Your AI for everything else:** summaries ("summarize my last 5 calls"), writing ("draft a leave request email"), questions, and multi-step tasks. Supported: Anthropic, OpenAI, OpenRouter, Gemini, Groq, Ollama / LM Studio on your PC, a generic OpenAI-compatible server, and the current generic Hermes Agent provider preset. Your provider key stays on the phone, encrypted with the Android Keystore.
- **Safe by default:** calls and SMS always show a confirmation with the exact recipient and text. After the AI reads other people's messages, every follow-up action needs confirmation too (prompt-injection guard).
**Current release:** Stitch 0.4.4. The live Android registry contains 70 tools, 32 are exposed to Needle, and the current test suite has 124 unit tests. The original [docs/PLAN.md](docs/PLAN.md) is retained as a historical design document; it is not the current implementation contract. **An AI assistant that actually runs your Android phone.**
Type or say what you want; Stitch sets the alarm, sends the message, finds the song or taps through the app,
using a tiny model on the phone for everyday commands and the AI of your choice for everything else.
**Before anything else:** 0.4.2, 0.4.3 and 0.4.4 have never been tested on a phone. Between them they [![License: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
changed the six things that were broken in 0.4.1, the provider keys, and (0.4.4) saved chats, the model ![Version](https://img.shields.io/badge/version-0.4.4-brightgreen.svg)
guide, Thinai and web search. [docs/STAGE_A2_CHECKLIST.md](docs/STAGE_A2_CHECKLIST.md) is a 35-minute ![Android](https://img.shields.io/badge/Android-9%2B-3DDC84.svg?logo=android&logoColor=white)
list to confirm they work. ![Kotlin](https://img.shields.io/badge/Kotlin-Jetpack%20Compose-7F52FF.svg?logo=kotlin&logoColor=white)
![Status](https://img.shields.io/badge/status-beta-orange.svg)
**New in 0.4.4** (several ideas ported from the open-source Thinai app): [**Download the APK**](https://git.openkhalix.com/thekhalidsha/stitch/releases/latest) ·
- **Chats panel:** tap ☰ on the Chat tab. Every conversation is kept; start a new one, go back to an old [User guide](docs/USER_GUIDE.md) ·
one, search, rename or delete. Conversations now survive restarts, AI replies included. [Contributing](CONTRIBUTING.md) ·
- **Model guide:** Settings → AI & provider → On this phone shows your phone's RAM and processor, asks [Development history](DEVELOPMENT_HISTORY.md)
what you want a model for (phone commands, Tamil, writing…) and recommends ones that fit, with a speed
estimate. 20 models to choose from.
- **Thinai** as a provider: runs GGUF models on the phone and Stitch uses them offline.
- **Web search that keeps working:** DuckDuckGo blocks repeated questions, so Bing is now the backup, and
results that aren't about the question are thrown away.
- **Safer reading of other people's text:** a web page or message can no longer fake the end of the
"this is someone else's text" wrapper.
See [docs/UPGRADE_PLAN.md](docs/UPGRADE_PLAN.md) for what happens next: connecting Stitch and Hermes in both directions, so Hermes can use your phone and Stitch can use your server. **None of it is in 0.4.3 yet.** It will all be built **inside Stitch** — there will never be a second app to install. [docs/PLAN.md](docs/PLAN.md) and [docs/HOTWORD_PLAN.md](docs/HOTWORD_PLAN.md) are historical design documents, kept for the reasoning; neither describes current behaviour. </div>
## Install on your phone <table align="center">
<tr>
<td align="center"><img src="docs/images/chat.png" width="250" alt="A chat: an alarm set on the phone in 0 ms, then an email drafted by the AI"/></td>
<td align="center"><img src="docs/images/chats-panel.png" width="250" alt="The chats panel with search, new chat and saved conversations"/></td>
<td align="center"><img src="docs/images/model-guide.png" width="250" alt="The model guide recommending an on-phone model for this phone"/></td>
</tr>
<tr>
<td align="center"><sub>Phone commands run on the phone; writing goes to your AI</sub></td>
<td align="center"><sub>Every conversation saved and searchable</sub></td>
<td align="center"><sub>Picks a model that fits your phone</sub></td>
</tr>
</table>
1. Copy the newest APK from `dist/` (currently `Stitch-0.4.4.apk`) to your phone and tap it to install. It installs over earlier versions and keeps your settings. <p align="center"><sub>Screenshots from an Android 14 emulator with a demo AI.</sub></p>
2. Open **Stitch → ⚙ Settings**. Settings is a list of categories; tap one to open it and use the back arrow to return. Set up the following:
- **AI & provider:** pick a provider, paste your key, and tap **Test connection**.
- **Phone control:** tap **Turn on phone control**, open *Stitch phone control* and switch it on. If Android says "restricted setting", go to **App info → ⋮ → Allow restricted settings** and try again.
- **Permissions & access:** grant permissions (contacts, calls, call log, SMS, calendar, location, notifications, microphone) and special access: Do Not Disturb, "modify system settings" (for brightness and rotation), and read notifications (for WhatsApp replies and music control).
- **Who answers you:** Hybrid (recommended), on-device only, or always your AI. Under *On-device model*.
- The other categories are **Voice & hotword**, **Default apps** and **Backup & restore**.
3. **After every Stitch update,** open Settings → Phone control. If it shows "on but not running", switch it off and on again. Android stops accessibility services when an app is updated. If you use the wake phrase, a "Wake phrase is off" notification appears too: tap it once to turn listening back on (Android doesn't let an app restart the microphone by itself).
## The main screen (0.4.4) ---
Four tabs along the bottom: ## Why Stitch
- **Chat:** talk to Stitch. **☰** (top left, or swipe from the left edge) opens your chats: New chat, search, and a ⋮ menu on each chat to rename or delete it, plus Delete all at the bottom. The **new chat** button and the settings gear are at the top right.
- **Schedule:** your upcoming alarms, reminders and calendar events, soonest first. Timers and alarms set outside Stitch aren't listed.
- **Saved:** your notes and the facts Stitch remembers.
- **Workflows:** coming soon.
Schedule and Saved are view-only. To change something, ask Stitch in Chat (e.g. "delete my 7am alarm"). Phone assistants either do very little on their own, or send everything to the cloud. Stitch splits the work:
- **Plain code first.** Alarms, timers, reminders, the flashlight and "play X on Spotify" are handled by
deterministic rules: instant, offline, and they can't misunderstand.
- **A tiny model on the phone.** [Needle 2](https://huggingface.co/Cactus-Compute/needle2), a 45-million-parameter
tool-calling model (about 14 MB), handles simple one-step commands offline in well under a second, behind
strict safety checks.
- **Your AI for the rest.** Summaries, writing, questions and multi-step tasks go to the AI *you* choose:
Claude, GPT, Gemini, OpenRouter, a model on your PC, or a model running on the phone itself.
## What it can do ## What it can do
Stitch currently exposes 70 Android tools through the live registry. They cover native device actions, calls and messages, calendar and reminders, media, knowledge, memory, notes, and Accessibility-based screen control. The exact catalog is generated from the app code rather than this README. | | |
| Area | Examples |
|---|---| |---|---|
| Operate any app (Phone control) | "Open YouTube and search for lo-fi music", "In Settings, turn on dark mode", "Find Ali in Contacts". The AI reads the screen, taps, types, scrolls and swipes like a person. It can also take a screenshot and look at it, for games, maps and images. A floating bar shows each step with a **Stop** button. | | 📱 **Operate any app** | "Open YouTube and search for lo-fi music". It reads the screen, taps, types and scrolls like a person, with a floating **Stop** button |
| Messages | "WhatsApp Ahmed I'm on my way" (really sends), "reply to Sara on WhatsApp: ok" (replies from the notification; works for Telegram, Instagram, Slack…), "text Mom…", "WhatsApp video call Ali", "any important messages?" | | 💬 **Messages & calls** | Send WhatsApp messages and texts, reply from notifications (WhatsApp, Telegram, Slack…), call, answer, hang up, summarize your recent calls |
| Calls | "call Ali Khan", "summarize my last 5 calls", "any missed calls?", "hang up", "answer" | | ⏰ **Time** | Alarms, timers, reminders and calendar events, with every time worked out by code from your phone's clock |
| Music | "play Believer on Spotify", "play lofi on YouTube Music", "what's playing?", "next song", "skip forward 30 seconds" | | 🎵 **Music** | "Play Believer on Spotify", skip, pause, what's playing |
| Time | "alarm in 30 minutes", "alarm at 6:30 tomorrow", "timer 5 minutes", "remind me to call the bank tomorrow at 10", "add a meeting with Sara on Monday 3pm" | | ⚙️ **Phone settings** | Do Not Disturb, ringer, brightness, rotation, volume, flashlight, screenshots |
| Phone settings | Do Not Disturb, silent/vibrate, brightness, auto-rotate, screen timeout, volume, flashlight, lock screen, screenshot, phone status report | | 🌐 **Knowledge** | Web search that falls back to a second engine when one blocks, page reading, weather, location |
| Knowledge | Weather (no key needed), web search, "read this page and summarize", your location, the time | | 🧠 **Memory** | "Remember my manager is Sara": used later, e.g. when writing emails |
| Memory | "remember my manager is Sara Khan". It's used in later requests, for example when writing emails. | | 🗣️ **Wake phrase** | Your own phrase, trained on your voice and matched on the phone, opens a bubble over any app |
| 💾 **Saved chats** | Every conversation kept: new chat, search, rename, delete |
| 🤖 **On-phone models** | Run Gemma 4 and other models fully offline, with a guide (20 models) that recommends one for your phone and your use |
## AI providers 70 tools in all. See the [user guide](docs/USER_GUIDE.md) for everything, with examples.
⚙ Settings → AI & provider: ## Safe by design
- **Cloud:** Anthropic, OpenAI, OpenRouter, OpenCode Zen, OpenCode Go, DeepSeek, Xiaomi MiMo (pay-as-you-go or Token Plan), Google Gemini, Groq.
- **Your own servers:** Ollama / LM Studio on your PC, a local server on the phone, or any OpenAI-compatible server.
- **Thinai (on this phone, offline):** [Thinai](https://github.com/Aravindargutus/Thinai) is a separate free app that runs GGUF models (Qwen, Llama, Gemma, Phi…) and serves them on the phone at `127.0.0.1:11434`. Install it, download a model, start its server, then pick **Thinai** in Stitch and tap ⟳ to choose the model. Any server on the phone itself gets the same treatment as the built-in engine: short instructions and the 33 phone tools rather than all 70, because these are small models. Keep Thinai's LAN mode off, and set an access token in Thinai if you want to stop other apps on the phone from using it.
- **Hermes (current behaviour):** the "Hermes Agent" entry is an ordinary OpenAI-compatible provider connection, nothing more. Two things stop it working as shipped: its address (`192.168.1.10`) is not the build machine, and Hermes' own API server only listens on the PC itself and won't start without a key being set. Both are fixed in Stage C of [docs/UPGRADE_PLAN.md](docs/UPGRADE_PLAN.md).
- **On this phone (offline):** Gemma 4 and other `.litertlm` models, running in the same engine Google AI Edge Gallery uses (LiteRT-LM). **"Which model should I get?"** reads your phone's RAM, processor and free storage, asks what you want the model for, and recommends models that do that well *and* fit, each with "Runs well / Tight fit / Too big" and a speed estimate. "Show all 20 models" lists the whole catalogue. Ratings are editorial (what each model's makers claim, plus its size), not tests; only Gemma 4 (the default) and Granite 350M have been run in Stitch — others are marked "Not tried in Stitch yet". Or import a file. Edge Gallery keeps its own models private to that app, so they can't be shared. Edge Gallery's planned local API server isn't released yet; if it ships, pick "Local server on this phone". On-device models need a 64-bit phone and get a smaller tool set (no screen control).
- **Every provider keeps its own settings.** Its key, address and model are saved separately, so you can set up several and switch between them without retyping anything. A ✓ in the list marks the ones you've set up, and the eye icon next to the key field shows what you typed. (Before 0.4.3 they shared one slot, so a second provider overwrote the first.)
- **Models:** type any model name, or tap ⟳ to download the provider's model list and pick from it. Typing filters the list. The chosen model is remembered per provider too.
- **OpenCode:** each model is automatically sent to the right API format (Claude/Qwen → Messages, GPT/Grok → Responses, others → Chat Completions; MiniMax on Go → Messages). Gemini models on OpenCode aren't supported yet.
**Banking apps:** most banks refuse to run while Phone control is on — that's their own anti-fraud rule about screen reading, not something Stitch can or should work around. Add the **Phone control** tile to your Quick Settings to switch it off in one tap; tapping it again takes you to the page to switch it back on (Android won't let an app re-enable itself). Stitch can call, text and tap on your phone, so safety is built into how every action runs, not added on top:
**Safety:** Calls, sent messages, and taps on Send/Pay/Delete/Post-type buttons ask you first. The screen-tap check can be turned off in Settings. After Stitch reads other people's messages or web pages, it also confirms any follow-up action. - **Calls, messages and deletions always ask first**, showing the exact contact, number and text.
- **Exact values are never trusted from an AI's memory.** Phone numbers must come from your contacts or your
own words; times are computed from the phone's clock.
- **Other people's text can't give orders.** Messages, notifications, web pages and screen text are wrapped
in a marker the text can't forge, and after Stitch reads them, follow-up actions need your confirmation too.
- **Runaway protection:** a step limit, loop detection and a Stop button over every app.
- **Your keys stay on the phone**, encrypted with the Android Keystore. No analytics, no telemetry.
- **On-phone mode sends nothing anywhere.**
**How requests are routed:** deterministic Kotlin rules handle common commands first, then Needle handles simple on-device tool calls, and the configured AI handles reasoning, writing, summaries, and multi-step tasks. Settings → On-device model lets you change this: **Hybrid** (the default, as described), **on-device only** (nothing leaves the phone, and it says so when it can't help), or **always my AI** (skips Needle). The built-in rules always run first whichever you pick — they're plain code, not a model. Times are always computed by code from your phone's clock, never by a model. If the model picks a tool for a different app than the one you named, is missing grounded arguments, or isn't confident, the request falls back safely to the configured AI. ## How it works
## Build it yourself ```mermaid
flowchart TD
A([You type or speak]) --> B{Built-in rules}
B -- "alarm, timer, reminder,<br/>flashlight, play X on Y" --> T[Tools]
B -- anything else --> C{Needle 2<br/>on the phone}
C -- "confident, grounded,<br/>passes the safety gates" --> T
C -- otherwise --> D[Your AI<br/>cloud · your PC · on the phone]
D -- "tool calls, step by step" --> T
T --> E{Risky?}
E -- "call, send, delete" --> F[/Ask you first/]
E -- no --> G[Android]
F -- yes --> G
```
The project is a git repository as of 25 Sep 2026, starting at tag `v0.4.3`; each release from here on is ## Get started
its own commit and tag. Build outputs and the APKs in `dist/` are deliberately not tracked, the prebuilt
`libneedle.a` files are.
Requirements: JDK 17, Android SDK (platform 35, build-tools 35.0.0), NDK `30.0.16248370`, CMake 3.22.1. The prebuilt Needle engine needs NDK r30's C++ runtime; older NDKs fail to link. Gradle is 8.14.5 (the wrapper downloads it on first build). 1. **Download** the latest APK from [Releases](https://git.openkhalix.com/thekhalidsha/stitch/releases/latest)
and open it on your phone. (Stitch is installed directly rather than from the Play Store, because it
uses permissions the Play Store restricts: SMS, call log and screen control.)
2. **Connect an AI** in ⚙ Settings → AI & provider, or pick *On this phone* and let the model guide
recommend a download.
3. **Allow phone control** in Settings → Phone control. If Android says "restricted setting", open
*App info → ⋮ → Allow restricted settings* and try again.
The [user guide](docs/USER_GUIDE.md) walks through every setting.
### Supported AI providers
| Where it runs | Providers |
|---|---|
| Cloud | Anthropic (Claude), OpenAI, OpenRouter, Google Gemini, Groq, DeepSeek, Xiaomi MiMo, OpenCode Zen / Go |
| Your computer | Ollama, LM Studio, any OpenAI-compatible server, Hermes Agent |
| This phone | Built-in engine (Gemma 4 and other `.litertlm` models via LiteRT-LM), [Thinai](https://github.com/Aravindargutus/Thinai) (GGUF models), any local server |
Every provider keeps its own key, address and model, so you can switch freely.
## Build from source
Requirements: JDK 17, Android SDK (platform 35, build-tools 35.0.0), **NDK 30.0.16248370** (the prebuilt
Needle engine needs r30), CMake 3.22.1. The Gradle wrapper fetches Gradle itself.
```sh ```sh
./scripts/fetch-needle.sh # prebuilt Needle 2 engine (only needed on a fresh checkout) git clone https://git.openkhalix.com/thekhalidsha/stitch.git && cd stitch
./scripts/fetch-needle.sh # prebuilt Needle 2 engine (already in the repo; this refreshes it)
./gradlew testDebugUnitTest # unit tests
./gradlew assembleRelease # → app/build/outputs/apk/release/app-release.apk ./gradlew assembleRelease # → app/build/outputs/apk/release/app-release.apk
./gradlew testDebugUnitTest # unit tests; also writes app/build/needle-tools.json
STITCH_LIVE=1 ./gradlew testDebugUnitTest --tests app.stitch.WebSearchTest # also asks the real search engines
``` ```
For emulator tests without a paid key, `python3 tools-dev/fake-ai/fake_ai.py` runs a stand-in AI on port 8099 (use `http://10.0.2.2:8099/v1` as a Custom provider in the emulator). - **Emulator:** `./gradlew assembleDebug -Pemulator` adds an x86_64 stand-in for Needle, which has no x86 build.
- **No paid key needed for testing:** `python3 tools-dev/fake-ai/fake_ai.py` runs a stand-in AI on port 8099.
- **Tuning Needle:** `tools-dev/needle/run_eval.py` runs 64 phrases through the real engine and the app's
safety rules; the number of *wrong actions that would run* must stay at 0.
To test on-device models in an x86_64 emulator, build with `./gradlew -Pemulator assembleDebug`. It adds x86_64 native libraries, with a stand-in for Needle, which has no Android x86 build. Without that flag, the emulator runs the ARM engine through translation and crashes. <details>
<summary><b>Project layout</b></summary>
The release APK is signed with the local debug key so it installs directly. Keep building on the same machine so updates install over the old version. A proper release key now exists at `~/.stitch-release-key/` and is used only when you pass `-PreleaseKey` — switching to it is a one-time move that requires uninstalling first, so read [docs/SIGNING.md](docs/SIGNING.md) before you use that flag.
### Tuning Needle
`tools-dev/needle/run_eval.py` runs `eval_set.tsv` through the Needle CLI (Linux/Mac build from the Hugging Face repo) against the app's real tool catalog and reports what would run on-device:
```sh
python3 tools-dev/needle/run_eval.py path/to/needle app/build/needle-tools.json 0.4
```
Tool descriptions matter a lot to Needle's accuracy. Change them in `app/src/main/kotlin/app/stitch/tools/`, re-run the unit tests to regenerate the catalog, then re-run the eval.
## Layout
``` ```
app/src/main/cpp/ JNI bridge + prebuilt libneedle.a (arm64-v8a, armeabi-v7a)
app/src/main/kotlin/app/stitch/ app/src/main/kotlin/app/stitch/
needle/NeedleEngine.kt on-device model (single thread, confidence + grounding gate) agent/ router, safety gates, AI loop, saved chats, untrusted-text wrapper
agent/Agent.kt router: Needle first → your AI with tool calling; permissions + confirmations needle/ the on-device Needle engine (JNI)
ai/ Anthropic + OpenAI-compatible clients (thin, raw HTTP) ai/ providers (OpenAI, Anthropic, Responses, LiteRT-LM), model guide, downloads
tools/ 70 tools: device, calls, SMS, WhatsApp, music, reminders, calendar, weather, web, memory, notes, and screen control tools/ the 70 tools, web search
automation/ phone control: accessibility service, screen reader, floating overlay automation/ phone control: accessibility service, screen reader, floating overlay
notifications/ notification listener (kept in memory only) voice/ wake phrase: fingerprints, listening service, training
ui/ Compose chat + settings notifications/ notification listener (kept in memory only)
tools-dev/needle/ eval set + runner core/ settings, time parser, reminders, backup, Markdown
tools-dev/fake-ai/ stand-in AI server for emulator tests ui/ Jetpack Compose screens
app/src/main/cpp/ JNI bridge and the prebuilt Needle libraries
tools-dev/ Needle eval, fake AI server
docs/ user guide, plans, signing, checklists
``` ```
## Tested so far vs. not yet </details>
Tested in an Android 14 emulator with a scripted fake AI: ## Project status
- Phone control: opening Contacts, reading the screen, tapping search, typing, and reading system permission dialogs
- The floating status bar with Stop, and the result card
- Screenshots reaching the AI
- Reminders firing on time
- Weather, web search, and the phone status report
- SMS sending with confirmation, and the ambiguous-contact case
Tested in the emulator for 0.4.4 (fake AI server): Stitch is **beta**: a personal project, built and tested mostly in an emulator, and used on one real phone.
- The chats panel: new chat, switching back with the right history sent to the AI, rename, search, delete, and chats surviving an app update Its [development history](DEVELOPMENT_HISTORY.md) records every release, bug, cause and fix, including
- Thinai's path (a server on 127.0.0.1:11434, simulated): connect, sync models, and the 33-tool set being sent what is still untested. Next up ([plan](docs/UPGRADE_PLAN.md)): connecting Stitch with the Hermes agent
- The model guide on a 2.4 GB emulator: it recommends only models that fit and says when better ones are too big in both directions, an action log, and fine-tuning Needle on Stitch's own tools.
- An update with the wake phrase on no longer crashes the app
- Web search asked the real engines from the build machine: 4 of 4 questions answered while DuckDuckGo was blocking
Not yet tested on real apps: ## Contributing
- WhatsApp auto-send (WhatsApp isn't installed in the emulator)
- Music playback in Spotify, YouTube Music and YMusic
- Cloud providers with a real key (model-list sync was tested live against OpenRouter and OpenCode Zen/Go)
- The real Thinai app (only simulated), and any model in the guide other than Granite 350M
- On-device Gemma 4 on a real phone (the engine, tool calls and downloads were tested in the emulator with the small Granite model)
- Notification replies
- Any run with a real AI model
## Known limits Contributions are welcome: bug reports, ideas and pull requests. Fork the repository, branch from
`develop`, and open a pull request into `develop`; the maintainer reviews and merges. Please read
[CONTRIBUTING.md](CONTRIBUTING.md) first, and follow the [Code of Conduct](CODE_OF_CONDUCT.md).
Found a security problem? See [SECURITY.md](SECURITY.md).
- Needle's confidence scores are conservative, so many commands go to your AI. Fine-tuning Needle on this tool catalog is the eventual fix (post-1.0 roadmap in docs/UPGRADE_PLAN.md). <details>
- Wi-Fi, Bluetooth, and mobile data can't be switched by apps on Android 10+. The AI can do it through phone control by opening Quick Settings and tapping the toggle. <summary><b>Branches and releases</b></summary>
- Banking apps and other protected screens block screenshots. Screen reading usually still works there.
- **Backups exist but are untested on a phone.** Settings → Backup & restore saves everything to one encrypted file (new in 0.4.2), including every provider's key. Until you've confirmed a backup actually restores, treat uninstalling as permanent — installing a new APK over the old one is safe, uninstalling is not. Note that Android never restores the *special* permissions (Phone control, notification access, Do Not Disturb, modify system settings); those are always re-granted by hand after a reinstall.
- Chat history (0.4.4): every conversation is saved separately in app-private storage (up to 1,000 lines each), and included in backups. Only what you and Stitch said is saved; tool results, screenshots, notification bodies and the "Show data" panel stay in memory for the session only, since they hold other people's messages. When you return to a chat, the AI is shown its last ~40 lines. Remembered facts, notes, and reminders are saved separately.
| Branch | What it holds |
|---|---|
| `main` | Released versions only (default) |
| `develop` | The next version, as it comes together |
| `feature/*`, `fix/*` | One change each; pull requests into `develop` |
| `release/<version>` | One per version |
| `hotfix/<version>` | Urgent fixes to a release |
## Wake phrase and the bubble (0.4.2) Releases are tagged `v<version>-alpha.N` (tests pass) → `-beta.N` (tested on a real phone) → `v<version>`.
Every version since 0.1.0 has a release with its APK. 0.1.0–0.4.2 predate version control, so their branches
hold release notes only; the full source starts at `release/0.4.3`.
1. **Settings → Wake phrase:** turn on *Listen for my wake phrase*, type your phrase (e.g. "Hey Stitch"), </details>
then tap **Record** five times, saying it each time. Only sound fingerprints are stored; the audio is deleted.
2. Say the phrase anywhere: a **bubble** opens over the app you are in. Speak, or type in it. ## License
It can read the app behind it ("read what's on screen", "what does this say?").
3. **Sensitivity** slider: left = fewer false wakes, right = wakes more easily. Retrain if it misses you. Stitch is free and open source under the [Apache License 2.0](LICENSE): use it, change it, fork it and
Each recording is now scored against the others, and any one you said differently is flagged — tap build on it, including commercially. Keep the [NOTICE](NOTICE) file with any copy you share.
**Redo** on just that one rather than clearing them all. How strictly Stitch matches is worked out
from how alike your recordings are, so one odd recording spoils the lot. If Stitch helps your project, a line like *"Based on Stitch by Mohammed Khalid"* is warmly appreciated.
3b. **Only show the bubble once I start speaking** (on by default). Matching sound will always mis-fire
occasionally; with this on a mis-fire stays invisible and closes itself instead of interrupting you. ## Acknowledgements
The trade is that the bubble appears as you speak rather than the instant it hears the phrase.
4. **Listen when:** always / screen on or charging (default) / only charging. The notification has a Pause button. - [Needle 2](https://huggingface.co/Cactus-Compute/needle2) by Cactus Compute: the on-device tool-calling model (Apache 2.0)
5. **Replace Google Assistant:** Settings → *Use Stitch instead of Google Assistant* → Digital assistant app → Stitch. - [LiteRT-LM](https://github.com/google-ai-edge/LiteRT-LM) by Google: the on-phone model engine (Apache 2.0)
Holding the power button then opens Stitch. A Quick Settings tile is also available. - [Thinai](https://github.com/Aravindargutus/Thinai) by Abhinivesh: the untrusted-text wrapper, web-search and
model-guide ideas were adapted from it (MIT)
- The models in the guide come from Hugging Face's [litert-community](https://huggingface.co/litert-community)
<div align="center"><sub>Made by Mohammed Khalid.</sub></div>
+27
View File
@@ -0,0 +1,27 @@
# Security policy
Stitch has deep access to a phone: calls, messages, contacts, notifications and on-screen control.
Security reports are taken seriously.
## Reporting a problem
**Please don't describe a vulnerability in a public issue.** Instead, open an issue titled
**"Security contact request"** with no details in it, and the maintainer will get in touch privately.
Once there is a private channel, include what an attacker could do, the steps to reproduce it, and the
Stitch version.
You can expect an acknowledgement within a week. Fixes for confirmed problems are released as soon as
practical and credited to the reporter, unless you'd rather stay anonymous.
## What counts
Especially welcome:
- a way to make Stitch **call, message, tap or delete without the user's confirmation**;
- **prompt injection**: text in a message, notification, web page or screen that gets the AI to act
against the user;
- anything that sends **API keys, messages or other personal data** somewhere the user didn't choose;
- weaknesses in the **encrypted backup** format.
## Supported versions
Only the latest release receives fixes.
+2
View File
@@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
import java.util.Properties import java.util.Properties
plugins { plugins {
+3
View File
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
// JNI bridge to the Needle 2 C API (needle.h). Needle keeps one process-global conversation, // JNI bridge to the Needle 2 C API (needle.h). Needle keeps one process-global conversation,
// so the Kotlin side calls these from a single thread only. // so the Kotlin side calls these from a single thread only.
// Strings cross JNI as UTF-8 byte arrays: JNI's own string functions use "modified UTF-8", // Strings cross JNI as UTF-8 byte arrays: JNI's own string functions use "modified UTF-8",
+3
View File
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
// Stand-in for CPU types Needle has no prebuilt engine for (x86_64 emulators): every call reports failure, // Stand-in for CPU types Needle has no prebuilt engine for (x86_64 emulators): every call reports failure,
// so the app runs normally with the on-device command model shown as unavailable. // so the app runs normally with the on-device command model shown as unavailable.
#include "needle.h" #include "needle.h"
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch package app.stitch
import android.Manifest import android.Manifest
+3
View File
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch package app.stitch
import android.content.Context import android.content.Context
+3
View File
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch package app.stitch
/** /**
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch package app.stitch
import android.app.Application import android.app.Application
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch package app.stitch
import android.content.ActivityNotFoundException import android.content.ActivityNotFoundException
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.agent package app.stitch.agent
import android.content.Context import android.content.Context
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.agent package app.stitch.agent
import android.content.Context import android.content.Context
@@ -130,7 +133,8 @@ object ChatStore {
title = title, title = title,
updated = turn.at, updated = turn.at,
count = list.size, count = list.size,
preview = turn.text.replace(Regex("\\s+"), " ").take(90), // Plain text: the panel shows one line, and "**Subject:**" should read as "Subject:".
preview = app.stitch.core.MarkdownParser.toPlainText(turn.text).replace(Regex("\\s+"), " ").take(90),
) )
prefs(c).edit().putString(key(id), encode(list)).putString(INDEX, encodeIndex(idx)).apply() prefs(c).edit().putString(key(id), encode(list)).putString(INDEX, encodeIndex(idx)).apply()
changed() changed()
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.agent package app.stitch.agent
/** /**
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.agent package app.stitch.agent
import app.stitch.core.TimeParser import app.stitch.core.TimeParser
@@ -1,3 +1,7 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-FileCopyrightText: 2026 Abhinivesh (adapted from Thinai, MIT: see LICENSES/Thinai-MIT.txt)
// SPDX-License-Identifier: Apache-2.0 AND MIT
package app.stitch.agent package app.stitch.agent
import java.security.SecureRandom import java.security.SecureRandom
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.ai package app.stitch.ai
import app.stitch.tools.Tool import app.stitch.tools.Tool
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.ai package app.stitch.ai
import app.stitch.tools.Tool import app.stitch.tools.Tool
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.ai package app.stitch.ai
import android.content.Context import android.content.Context
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.ai package app.stitch.ai
import android.content.Context import android.content.Context
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.ai package app.stitch.ai
import android.app.DownloadManager import android.app.DownloadManager
@@ -1,3 +1,7 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-FileCopyrightText: 2026 Abhinivesh (adapted from Thinai, MIT: see LICENSES/Thinai-MIT.txt)
// SPDX-License-Identifier: Apache-2.0 AND MIT
package app.stitch.ai package app.stitch.ai
import android.app.ActivityManager import android.app.ActivityManager
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.ai package app.stitch.ai
import app.stitch.tools.Tool import app.stitch.tools.Tool
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.ai package app.stitch.ai
import app.stitch.tools.Tool import app.stitch.tools.Tool
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.ai package app.stitch.ai
import org.json.JSONObject import org.json.JSONObject
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.automation package app.stitch.automation
import android.accessibilityservice.AccessibilityService import android.accessibilityservice.AccessibilityService
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.automation package app.stitch.automation
import android.content.Context import android.content.Context
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.automation package app.stitch.automation
import android.content.Context import android.content.Context
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.automation package app.stitch.automation
import android.content.Intent import android.content.Intent
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.automation package app.stitch.automation
import android.graphics.Rect import android.graphics.Rect
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.automation package app.stitch.automation
import android.accessibilityservice.AccessibilityService import android.accessibilityservice.AccessibilityService
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.core package app.stitch.core
import android.app.AlarmManager import android.app.AlarmManager
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.core package app.stitch.core
import android.content.Context import android.content.Context
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.core package app.stitch.core
import android.Manifest import android.Manifest
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.core package app.stitch.core
import android.content.Context import android.content.Context
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.core package app.stitch.core
/** The Markdown blocks AI replies use, parsed without any library so the chat can draw them natively. */ /** The Markdown blocks AI replies use, parsed without any library so the chat can draw them natively. */
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.core package app.stitch.core
import android.content.Context import android.content.Context
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.core package app.stitch.core
import android.content.Context import android.content.Context
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.core package app.stitch.core
import android.app.AlarmManager import android.app.AlarmManager
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.core package app.stitch.core
import android.content.Context import android.content.Context
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.core package app.stitch.core
import java.time.LocalDateTime import java.time.LocalDateTime
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.needle package app.stitch.needle
import android.content.Context import android.content.Context
@@ -73,8 +76,13 @@ class NeedleEngine(private val context: Context, private val toolsJson: String)
var status: String = "Not loaded yet" var status: String = "Not loaded yet"
private set private set
/**
* Whether the real Needle engine was installed. x86_64 emulators also list ARM in SUPPORTED_ABIS (they
* translate ARM code), but an emulator build installs the x86_64 stand-in, which always fails — so
* look at which native library folder Android actually picked.
*/
val isSupportedDevice: Boolean val isSupportedDevice: Boolean
get() = Build.SUPPORTED_ABIS.any { it == "arm64-v8a" || it == "armeabi-v7a" } get() = context.applicationInfo.nativeLibraryDir.substringAfterLast('/').startsWith("arm")
suspend fun warmUp(system: String) = withContext(thread) { ensureReady(system) } suspend fun warmUp(system: String) = withContext(thread) { ensureReady(system) }
@@ -113,7 +121,7 @@ class NeedleEngine(private val context: Context, private val toolsJson: String)
private fun load(): Boolean { private fun load(): Boolean {
if (!isSupportedDevice) { if (!isSupportedDevice) {
status = "Not available on this CPU (${Build.SUPPORTED_ABIS.firstOrNull()})" status = "Not available on this CPU (${context.applicationInfo.nativeLibraryDir.substringAfterLast('/')})"
return false return false
} }
return try { return try {
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.notifications package app.stitch.notifications
import android.app.Notification import android.app.Notification
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.tools package app.stitch.tools
import android.Manifest import android.Manifest
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.tools package app.stitch.tools
import android.Manifest import android.Manifest
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.tools package app.stitch.tools
import android.content.Context import android.content.Context
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.tools package app.stitch.tools
import android.Manifest import android.Manifest
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.tools package app.stitch.tools
import android.Manifest import android.Manifest
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.tools package app.stitch.tools
import android.Manifest import android.Manifest
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.tools package app.stitch.tools
import android.app.SearchManager import android.app.SearchManager
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.tools package app.stitch.tools
import android.Manifest import android.Manifest
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.tools package app.stitch.tools
import android.Manifest import android.Manifest
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.tools package app.stitch.tools
import android.content.Intent import android.content.Intent
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.tools package app.stitch.tools
import android.Manifest import android.Manifest
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.tools package app.stitch.tools
import android.content.Context import android.content.Context
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.tools package app.stitch.tools
import org.json.JSONArray import org.json.JSONArray
@@ -1,3 +1,7 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-FileCopyrightText: 2026 Abhinivesh (adapted from Thinai, MIT: see LICENSES/Thinai-MIT.txt)
// SPDX-License-Identifier: Apache-2.0 AND MIT
package app.stitch.tools package app.stitch.tools
import app.stitch.ai.Http import app.stitch.ai.Http
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.ui package app.stitch.ui
import androidx.compose.foundation.background import androidx.compose.foundation.background
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.ui package app.stitch.ui
import android.net.Uri import android.net.Uri
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.ui package app.stitch.ui
import android.text.format.DateUtils import android.text.format.DateUtils
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.ui package app.stitch.ui
import androidx.compose.foundation.background import androidx.compose.foundation.background
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.ui package app.stitch.ui
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.ui package app.stitch.ui
import android.Manifest import android.Manifest
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.ui package app.stitch.ui
import androidx.compose.foundation.border import androidx.compose.foundation.border
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.ui package app.stitch.ui
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.ui package app.stitch.ui
import android.net.Uri import android.net.Uri
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.ui package app.stitch.ui
import android.content.Intent import android.content.Intent
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.ui package app.stitch.ui
import android.os.Build import android.os.Build
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.voice package app.stitch.voice
import kotlin.math.PI import kotlin.math.PI
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.voice package app.stitch.voice
import android.Manifest import android.Manifest
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.voice package app.stitch.voice
import android.content.Context import android.content.Context
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.voice package app.stitch.voice
import android.content.Intent import android.content.Intent
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch.voice package app.stitch.voice
import android.annotation.SuppressLint import android.annotation.SuppressLint
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch package app.stitch
import app.stitch.core.Backup import app.stitch.core.Backup
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch package app.stitch
import android.content.Context import android.content.Context
@@ -119,6 +122,13 @@ class ChatStoreTest {
assertEquals("line 99", (conv.last() as ConvItem.Assistant).text) assertEquals("line 99", (conv.last() as ConvItem.Assistant).text)
} }
@Test
fun `the panel preview is plain text, not Markdown`() {
val id = ChatStore.currentId(c)
say(id, "draft an email", "Here's a draft:\n\n**Subject:** Leave on _Friday_")
assertEquals("Here's a draft: Subject: Leave on Friday", ChatStore.list(c).single().preview)
}
@Test @Test
fun `long titles are shortened at a word`() { fun `long titles are shortened at a word`() {
val t = ChatStore.titleFrom("Please summarize the last five calls from yesterday and tell me who needs a callback") val t = ChatStore.titleFrom("Please summarize the last five calls from yesterday and tell me who needs a callback")
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch package app.stitch
import app.stitch.automation.ClockScreen import app.stitch.automation.ClockScreen
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch package app.stitch
import app.stitch.agent.Agent import app.stitch.agent.Agent
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch package app.stitch
import app.stitch.voice.Fingerprint import app.stitch.voice.Fingerprint
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch package app.stitch
import app.stitch.agent.Grounding import app.stitch.agent.Grounding
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch package app.stitch
import app.stitch.core.MarkdownParser import app.stitch.core.MarkdownParser
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch package app.stitch
import app.stitch.ai.ModelGuide import app.stitch.ai.ModelGuide
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch package app.stitch
import app.stitch.tools.Contacts import app.stitch.tools.Contacts
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch package app.stitch
import app.stitch.ai.AnthropicProvider import app.stitch.ai.AnthropicProvider
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch package app.stitch
import app.stitch.ai.ConvItem import app.stitch.ai.ConvItem
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch package app.stitch
import android.content.Context import android.content.Context
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch package app.stitch
import app.stitch.agent.QuickCommands import app.stitch.agent.QuickCommands
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch package app.stitch
import app.stitch.core.MarkdownParser import app.stitch.core.MarkdownParser
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch package app.stitch
import app.stitch.core.TimeParser import app.stitch.core.TimeParser
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch package app.stitch
import app.stitch.agent.Untrusted import app.stitch.agent.Untrusted
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: 2026 Mohammed Khalid
// SPDX-License-Identifier: Apache-2.0
package app.stitch package app.stitch
import app.stitch.voice.Fingerprint import app.stitch.voice.Fingerprint
Loaded 100 of 113 files, more files were not shown because too many files have changed in this diff. Show more