Files
stitch/DEVELOPMENT_HISTORY.md
T
thekhalidsha 61409cb444 Initial import: Stitch 0.4.3 (versionCode 16)
The project's first commit, six days and 16 releases after it started. Everything
up to this point existed only as files on one machine, with no history and no undo.

Contents: single Gradle module, 62 Kotlin files (11,244 lines) and the Needle 2 JNI
bridge, 70 tools, 87 passing unit tests, and the five documents in docs/ plus
DEVELOPMENT_HISTORY.md and README.md.

Not tracked: build outputs (build/, .cxx/, .gradle/), the release APKs in dist/
(~800 MB, rebuildable), local.properties, and .claude/settings.local.json — all
machine-specific. The prebuilt libneedle.a files (38 MB) *are* tracked on purpose,
so a checkout builds without depending on Hugging Face still serving them.
2026-09-25 14:23:14 +05:30

60 KiB
Raw Blame History

Stitch: Development History & Audit

What this covers: how Stitch was planned, built, tested and fixed, from the first plan to version 0.4.3. It includes every blocker, failure and user-reported bug, with its cause and fix, plus an audit of testing, security, and the changes made to the build machine.

Period covered: 19 Sep 2026, 13:12 IST – 24 Sep 2026 (across several Claude Code sessions). Author of the code and this document: Claude (AI coding agent), working for the project owner, who tested each build on a real phone.


Contents

  1. Summary
  2. How the work was organised
  3. Planning phase
  4. Plan vs. what was built
  5. Architecture as built
  6. Release history
  7. Timeline
  8. Problems, blockers and fixes
  9. Lessons learned
  10. Testing & verification audit
  11. Security & privacy audit
  12. Changes made to the build machine
  13. Known limitations & open risks
  14. Project metrics
  15. How to rebuild

1. Summary

Stitch is a personal "Jarvis"-style Android agent that is sideloaded, not published on Google Play. You type or speak a request, and it acts on the phone: calls, SMS, WhatsApp, alarms, reminders, calendar, contacts, music, settings, notifications, web, and operating any app through the screen.

It uses three layers, cheapest first:

Layer What it is Handles
1. Quick rules Plain Kotlin code (QuickCommands) Alarms, timers, reminders, flashlight, "play X on Y". Instant, offline, deterministic
2. Needle 2 45M-parameter tool-calling model from Cactus Compute, built into the app (~14 MB) Simple one-step phone commands, offline. Gated by strict safety checks
1b. Wake phrase Your own phrase, taught from 5 recordings (MFCC fingerprints + DTW), matched on the phone Opens the bubble over any app, hands what you say to the layers below
3. "Your AI" Cloud (Anthropic, OpenAI, OpenRouter, OpenCode Zen/Go, DeepSeek, Xiaomi MiMo, Gemini, Groq, Ollama, Hermes, custom) or on-phone (Gemma 4 / Granite via Google's LiteRT-LM) Questions, summaries, writing, multi-step tasks, screen control

Owner constraint, set early and kept throughout: personal use only, so maximum control and no Google Play restrictions. SMS sending, call-log access, accessibility control and all-apps visibility are all used freely.

State at 0.4.3:

  • 70 tools
  • 62 Kotlin source files (11,244 lines) plus a JNI bridge
  • 87 automated unit tests, all passing
  • Wake phrase ("Hey Stitch"), trained by your own voice, with a floating bubble that can read the app behind it
  • Main screen with four tabs (Chat, Schedule, Saved, Workflows) and a Settings page grouped into categories
  • Needle offline eval: 0 wrong actions across 64 test phrases
  • APKs for every version in dist/

2. How the work was organised

  • Roles. The owner is not an Android developer. Claude did all design, coding, building and emulator testing, and handed over ready-to-install APKs. The owner installed each build on their phone and reported problems in plain language.
  • Loop per release:
    1. The owner reports an issue or asks for a feature.
    2. Claude reproduces it: runs the exact phrase through Needle on Linux, or unit-tests the rule.
    3. Claude finds the root cause, fixes it, and adds a test for it.
    4. Claude tests in a headless Android 14 emulator.
    5. Claude builds a signed release APK into dist/Stitch-<version>.apk and reports what changed, what was tested, and what wasn't.
  • Testing without paid AI keys. A small fake OpenAI-compatible server on the build machine played the "cloud AI" in emulator tests, so the agent loop, confirmations and tool execution were exercised without spending money.
  • Honesty rule. Each report separates "tested" from "not tested", e.g. real WhatsApp, a real Google account, or Gemma on a real phone.

3. Planning phase

Request (13:12 IST): an Android app where the user connects their own AI (BYOK, OpenCode, Hermes…). The on-device Needle model handles phone actions, and the AI handles everything else. They talk through a structured protocol, e.g. "draft a leave request and keep it in Gmail drafts".

Research done:

Topic Finding Consequence
Needle 2 45M params, ~14 MB, ~28 MB RAM, Apache-2.0. JSON tool calls with a confidence score; empty call list when nothing fits A clean "hand off to the AI" signal
Needle 3 Newer, adds embeddings Planned as primary; Needle 2 was used in practice (below)
Context window 256-token sliding window Can't give Needle 70 tools. Only a 32-tool subset is exposed to it (NEEDLE_TOOLS)
Android binaries libneedle.a for arm64-v8a and armeabi-v7a (the owner correctly pushed to check Hugging Face; no ARMv6 build, none needed) JNI wrapper built with NDK/CMake
Hermes Agent Exposes an OpenAI-compatible API Supported through the generic provider

Output: docs/PLAN.md, a full scope of work covering:

  • architecture and an "Action Plan Protocol" JSON contract
  • a ~50-tool catalogue with risk levels
  • tech stack and 20-module file tree
  • a 14-week phased timeline, risks, acceptance criteria, and 7 open questions

4. Plan vs. what was built

The owner asked for a working MVP right away ("do it yourself… I will try the APK"), so the plan was compressed on purpose. Differences and why:

Plan Built Why
20 Gradle modules, Hilt, Room, DataStore, Tink Single module; SharedPreferences; a small Keystore-backed SecretBox for API keys Speed. One person-day, not 14 weeks. Fewer moving parts to break
play + full build flavours One "full" build Owner: personal use, ignore Play policy
Action Plan Protocol (AI returns a whole JSON plan) Native tool-calling agent loop (AI calls tools step by step, max 40 steps) Modern models do native tool use well, and step-by-step results let the AI react to what actually happened
Needle 3 + embeddings top-k retrieval Needle 2 with a fixed 32-tool on-device subset + deterministic rules Needle 2 was the released Android artefact; a fixed subset was simpler and measurable
Needle confidence ≥ 0.75 decides Confidence ≥ 0.4 plus evidence words, negation, small-talk and app-mention gates Confidence proved meaningless (see §8, B-11)
Gmail REST API with OAuth mailto: compose intent + screen control OAuth needs a Google Cloud project and verification; not worth it for one user
Voice: sherpa-onnx offline STT Android's built-in speech recognizer + TextToSpeech Zero extra download; works on most phones
— (not planned) Accessibility phone control (read screen, tap, type, swipe, screenshots), on-phone LLMs (LiteRT-LM), Default apps, calendar reminders, Markdown rendering, full CRUD Requested by the owner along the way

5. Architecture as built

User text / voice
      │
      ▼
ChatViewModel ──► Agent.handle()
      1. QuickCommands (regex + TimeParser)       → run tool directly
      2. Small talk ("hi", "thanks")              → friendly reply / AI
      3. Needle 2 (JNI, 32 tools)                 → run only if ALL gates pass:
            confidence ≥ 0.4 · evidence words for that tool · no negation ·
            no app-name mismatch · create-tools never run on remove/edit requests ·
            times always recomputed by TimeParser · guessed required args rejected
      4. Question + no AI connected               → open a web search
      5. Your AI: agent loop (≤ 40 steps)         → tools, screen control, final answer
                 │ loop/failure guards, history compaction, screenshots for vision models
                 ▼
Tool executor: permissions → prepare() → confirm (HIGH risk / after untrusted input) → run()
      │
      ▼
Android APIs: AlarmClock, CalendarContract, ContactsContract, CallLog, Telephony SMS,
SmsManager, TelecomManager, MediaSession, NotificationListener, AccessibilityService,
AlarmManager, CameraManager, AudioManager, Settings, LocationManager, Intents…

Main packages (app/src/main/kotlin/app/stitch/):

Package Contents
agent/ Agent (routing, gates, AI loop, system prompt), QuickCommands, Grounding (name correction)
needle/ NeedleEngine, NeedleNative (JNI)
ai/ Providers: OpenAI-compatible, Anthropic Messages, OpenAI Responses, LocalLlmProvider (LiteRT-LM); ModelCatalog, ModelDownloads, TextToolCalls (recovers tool calls written as text)
tools/ 70 tools: Device, Comms, Messaging, Media, System, Knowledge, Productivity, Info, Screen, Manage (CRUD)
core/ Settings/presets/SecretBox, TimeParser, DefaultApps, Reminders, CalendarReminders, Alarms, Notes, Memory, MarkdownParser
accessibility/ StitchAccessibilityService, ScreenReader, AgentOverlay (status pill, Stop, confirm/result cards)
notifications/ StitchNotificationListener, NotificationStore (MessagingStyle parsing)
voice/ Fingerprint (MFCC + DTW wake-word matching), HotwordStore (phrase, samples, policy), HotwordService (listening), PhraseRecorder (training), HotwordTile
root AssistActivity (the bubble), Brain (one shared agent for chat and voice), Bubble (step-aside handle)
ui/ Compose screens: Chat (with Schedule / Saved / Workflows tabs), Settings (category list → sub-pages), provider widgets, Default apps, MarkdownView
app/src/main/cpp/ needle_jni.cpp (real), needle_stub.cpp (x86_64 emulator stand-in)

6. Release history

All times IST. All APKs are in dist/.

Version Built Size Trigger Main content
0.1.0 16:07 31 MB "Build the MVP yourself" 22 tools, Needle on-device, Anthropic + OpenAI-compatible providers, SMS/calls with confirmation, call-log/SMS summaries, voice in/out, encrypted keys
0.2.0 16:57 31 MB Alarm set to 12:30 AM; WhatsApp sent as SMS; "Jarvis" request 54 tools. Accessibility phone control (screen read/tap/type/swipe/screenshot), overlay with Stop. Real WhatsApp send and calls, replies from any chat notification, music in apps, DND/ringer/brightness/rotation, answer/end calls, reminders, memory, weather/web. Time maths moved into code
0.3.0 18:07 54 MB Edge Gallery models; OpenCode/DeepSeek/Xiaomi; model sync; YMusic On-phone LLMs via LiteRT-LM (Gemma 4, Granite; download or import .litertlm). New providers with per-model API routing. Model list sync + picker. Any music app, with screen-control fallback
0.3.1 18:27 54 MB "Set an alarm after 30 minutes" went to the AI, which answered "7am" Deterministic QuickCommands for alarms/timers/reminders/flashlight. when field so no model does time maths. Example times removed from tool descriptions
0.3.2 / 0.3.3 18:44 / 18:50 54 MB "Play Believer in Spotify" opened YMusic In-between builds, not announced separately: named app always wins; Default apps settings (music, clock, calendar, maps, browser, email, camera, files); "play X on Y" rule
0.3.4 19:11 54 MB "Hello" turned on the flashlight; "Hi" answered a call; questions triggered contacts/weather/time; Gemma parse error Evidence gates, small-talk handling, strict question rules, negation respected, real-call check, Gemma tool-call recovery, copy button
0.3.5 19:27 54 MB Names garbled ("Rahul" → "Rahulia"); reminders vs calendar Name correction (Grounding.fixNames), WhatsApp per-sender parsing, "Show data" under replies, calendar reminders option
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.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.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.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 |

Every build installs over the previous one: same package app.stitch, same signing key, and the version code goes up.


7. Timeline

All times IST.

Time Event
13:12 Project brief; research on Needle 2/3, Hermes, Android distribution
13:17 docs/PLAN.md written (SOW, architecture, 14-week plan)
13:55 "Build the MVP yourself; SMS and call logs needed"
13:57 Machine had no Java or Android SDK. Installed JDK 17, SDK, Gradle into the home folder
14:05 Owner: "check Needle 2 on Hugging Face, it has Android binaries". Confirmed arm64/armv7 builds
14:26 First build failed: libneedle.a needs NDK r30 (B-02). Switched NDK
14:34 Build passes. Needle evaluated on Linux against the real tool catalogue
15:09–15:21 Release build hung for 20+ min: a scripted edit had corrupted a file to 143k lines (B-04)
15:34–16:05 Emulator set up; real APK tested; SMS really sent; two-"Ali" ambiguity fixed with a prepare() step
16:08 0.1.0 delivered
16:10 Owner: personal use, maximum control (saved as a standing project rule)
16:25 Owner reports alarm at 12:30 AM (at 4:10 PM) and WhatsApp → SMS. Asks for a "Jarvis" with touch control
16:26 Background research agents surveyed DroidRun, Blurr, mobile-use, AutoGLM, Mobile-Agent, Tasker/MacroDroid
16:30–16:55 Accessibility service, screen tools, messaging, media, settings, reminders built; tested in emulator
16:58 0.2.0 delivered
17:01 Owner asks for Edge Gallery models, OpenCode/DeepSeek/Xiaomi, model sync
17:01–17:15 Research: Edge Gallery's API server exists only as unmerged PRs, so LiteRT-LM was embedded directly. Kotlin upgraded to 2.4.20 for the library
17:23 On-device LLM segfault in emulator (ARM translation) → x86_64 emulator variant (B-06)
17:54 GPU loads but fails at first message → CPU fallback around every attempt (B-08)
18:07 0.3.0 delivered
18:08 Owner asks "what is Granite, is it replacing Needle?" Explained the layers
18:14 Owner: the alarm phrase went to the AI, and the AI said "7am". Root cause admitted: Needle confidence 0.42 vs 0.40 cutoff (B-10)
18:27 0.3.1 delivered (deterministic rules)
18:30 Owner: "play believer in spotify" opened YMusic (B-12)
18:44 Owner: "Hello" → flashlight, "Hi" → answer call, question misfires, Gemma parse error, copy button
19:11 0.3.4 delivered
19:11 Owner: names garbled; reminders should be able to use the calendar
19:27 0.3.5 delivered
19:29 Owner: render Markdown
19:39 0.3.6 built (announced with 0.3.7)
19:40 Owner: can't remove an alarm; wants add/edit/remove everywhere
19:53 0.3.7 delivered
20:18 Owner: "turn off (last) alarm" not understood; removal one minute early
20:27 0.3.8 built; this document written
22 Sep, ~11:55 Three Needle value-garbling bugs fixed in code, with 3 new unit tests (B-26 name, B-27 typed number, B-28 alarm-removal time)
22 Sep, 12:10 Settings page reorganised into categories with sub-pages (separate session; could not compile, see C-11)
22 Sep, 12:13 Chat screen given bottom tabs: Chat, Schedule, Saved, Workflows (separate session; could not compile, see C-11)
22 Sep, 12:51 0.4.1 built: first compile of both UI changes; 53/53 tests pass; Needle eval unchanged (0 wrong)
24 Sep, ~11:23 A separate AI session researched a Hermes integration and wrote docs/UPGRADE_PLAN.md, and rewrote README.md to match the live 0.4.1 code (tool count 54 → 70, chat-history wording). It did not update this document (see C-12)
24 Sep, later Owner asked for that plan to be checked. Its claims were verified against the code, the Hermes install on this machine, and the upstream sources. 16 errors found (C-13). Plan rewritten as the final version, with the correction table kept in it as §12
24 Sep Owner decision: the Hermes bridge goes inside Stitch, not a second app. Recorded as a standing rule
24 Sep, 12:5x docs/STAGE_A_CHECKLIST.md written: the things never tested on a real phone, for the owner to work through
24 Sep, 13:1x Stage B started. core/Backup.kt + ui/BackupSection.kt: encrypted export/restore of all 9 data stores. 15 new tests (53 → 68)
24 Sep, 13:13 Real release keystore generated at ~/.stitch-release-key/ (RSA 4096, valid to 2056). Not yet in use — opt-in via -PreleaseKey, because switching keys forces an uninstall
24 Sep, 13:4x Gradle 8.11.1 → 8.14.5; the Kotlin-plugin deprecation warning is gone. Tests pass, release APK builds
24 Sep, ~13:5x Owner ran docs/STAGE_A_CHECKLIST.md on the real phone — the first real-device test of 0.4.1, and of the wake phrase with an actual voice. Tabs, Settings pages, WhatsApp send, notification reply, a real API key and screen control all worked; six things did not
24 Sep, 15:34 0.4.3 built: per-provider settings (B-36), API-key eye toggle, Robolectric added. 87/87 tests pass; Needle eval unchanged (wrong 0)
24 Sep, 14:11 0.4.2 built: B-29–B-34 fixed, plus the routing setting, the Phone control tile and wake-phrase training scores. 80/80 tests pass; Needle eval unchanged (wrong 0)

8. Problems, blockers and fixes

Every significant failure, in four groups:

  • A. Toolchain and build
  • B. Product bugs, found by the owner or by testing
  • C. Mistakes in Claude's own process
  • D. Platform limits

A. Toolchain & build blockers

ID Problem Root cause Fix
A-01 Android setup stopped halfway unzip not installed on the machine Extracted the archives with Python's zipfile
A-02 Link error undefined symbol __hash_memory libneedle.a was compiled with NDK r30; NDK 27's libc++ lacks the symbol Installed NDK r30 (30.0.16248370) and pinned it in Gradle
A-03 Linux Needle CLI wouldn't link for local evals Library built against libc++ (macOS toolchain paths inside) Used the prebuilt Linux needle binary from the Hugging Face repo
A-04 JNI strings broke on emoji Java's NewStringUTF uses "modified UTF-8" Pass raw UTF-8 byte arrays across JNI
A-05 LiteRT-LM needed newer Kotlin (it depends on kotlin-reflect 2.4) Library/compiler mismatch Upgraded Kotlin to 2.4.20 before adding the dependency
A-06 R8 code shrinking could strip JNI and reflection classes LiteRT-LM and Gson ship no keep rules Added proguard-rules.pro keeps (NeedleNative, litertlm, gson); smoke-tested the shrunk release APK
A-07 Real Needle library has no x86_64 build, so the emulator couldn't load it Only ARM .a files published needle_stub.cpp for x86_64 builds (-Pemulator flag)
A-08 0.3.7 release build failed; the old APK got copied as "0.3.7" Unescaped quotes in a Kotlin string, and the copy step ran after a failed build Caught by comparing file sizes; deleted the stale file, fixed the string, rebuilt, and checked the version with aapt

B. Product bugs

ID Symptom (owner's words) Root cause Fix Version
B-01 Two contacts named "Ali": risk of texting the wrong one Tools resolved contacts after confirmation New prepare() step resolves contact and number before the confirm dialog; ambiguity → ask which one 0.1.0
B-02 "Alarm after 30 minutes" set 12:30 AM at 4:10 PM The small model can't do clock arithmetic ("30 minutes" → 00:30) TimeParser computes all times from the phone clock; Needle's time arguments are always overridden 0.2.0
B-03 "Send WhatsApp to X" asked to send an SMS Needle picked send_sms; nothing checked the app mentioned App-mention guard: if the user names an app, only that app's tools may run on-device. Dedicated WhatsApp tools 0.2.0
B-04 Accessibility service listed as "crashed" and screenshots failed Reinstalling the app kills the running service; Android marks it stale Detect and warn "turn Phone control off and on" in Settings 0.2.0
B-05 System permission dialogs invisible to screen reading Accessibility service not flagged as a tool isAccessibilityTool=true 0.2.0
B-06 On-device LLM segfault in emulator ARM→x86 binary translation x86_64 emulator variant; phones unaffected 0.3.0
B-07 Tiny models overflowed context (Granite 1,280 tokens) Full prompt + tools too big Compact prompt and fewer tools for on-phone models; retry smaller 0.3.0
B-08 "Failed to send message" with GPU backend GPU (OpenCL) loads but fails at first inference, also seen on Pixels Fallback to CPU around every attempt; remembers a failed GPU 0.3.0
B-09 Models wrote tool calls as plain text Small/local models ignore the tool-call format TextToolCalls recovers calls from text 0.3.0
B-10 "Set an alarm after 30 minutes" went to the AI, which answered "7am" and set nothing (1) Needle's confidence 0.42 was barely over the 0.40 cutoff and varies per run. (2) The tool description contained the example "wake me up at 7am", which the AI copied QuickCommands: deterministic rules before any model. when field (AI copies the user's words; code computes the time). Example times removed 0.3.1
B-11 "Hello" → flashlight on; "Hi" → "answered call"; "how are you" → battery at 98% confidence Needle assigns a tool to anything, with meaningless confidence. A low no-AI threshold (0.15) let guesses through Evidence gates (each tool needs words that point to it), small-talk list, removed the low threshold, call-state check before "answer" 0.3.4
B-12 "Play Believer in Spotify" opened YMusic Needle dropped the app name; code then preferred the currently playing app App name read from the user's words by a rule. Priority: named → default → playing → first installed. Default apps settings 0.3.2
B-13 "Meaning of name X" listed contacts; follow-up showed weather for a place named X Same as B-11: a question triggered tools Questions never trigger phone actions; with no AI, questions open a web search 0.3.4
B-14 "What is the…" answered with the time get_time evidence rule too loose Strict evidence ("what time is it", "today's date"); checked 20 "what is the…" questions against all 32 on-device tools 0.3.4
B-15 "Don't turn on the flashlight" turned it on Negation ignored Negation gate (excluding "do not disturb") + Needle's own negation flag 0.3.4
B-16 Gemma error "Failed to parse tool calls from codeblock: call:whatsapp_send(…" Gemma writes slightly off-format calls, and LiteRT throws Parse the intended call out of the error and run it 0.3.4
B-17 Names garbled: "Rahul" → "Rahulia" The AI (esp. small on-device models) rewrites names; WhatsApp notification parsing also produced "Rahul: Rahul" titles Grounding.fixNames corrects near-miss names to real ones from tool data; use EXTRA_CONVERSATION_TITLE; per-sender MessagingStyle parsing; "Show data" panel; prompt says copy names exactly 0.3.5
B-18 Markdown table columns misaligned Each row measured its own widths Fixed per-column widths from the longest cell (48–180 dp), sideways scroll 0.3.6
B-19 Couldn't remove an alarm by asking No delete tool existed, and the rules deliberately skipped "remove/delete/cancel" delete_alarm, list_alarms, cancel_timer and CRUD for everything else. Guard: create-tools never run on remove/edit requests 0.3.7
B-20 "Turn off alarm", "turn off last alarm" not understood Clock apps on real phones (e.g. Samsung) ignore Android's "next alarm" search mode; "alarm to remove" matched no rule Resolve the exact alarm time first (next, or last set by Stitch), then dismiss by exact time. More phrasings 0.3.8
B-25 From the bubble, "read what's on screen" returned only the status bar, not the app behind Once Stitch's own window is in front, Android stops reporting the app underneath, so there was nothing to read The screen is captured the moment the bubble opens and used for reading; screen actions close the bubble first so taps land on the app. Stitch's own windows are skipped when reading 0.4.0
B-24 Music opened search results instead of playing, unlike Google Assistant Apps like YouTube/YMusic ignore the "play from search" request and only show results; Stitch left the last tap to the AI With phone control on, Stitch now taps the first matching result itself and presses Play if a track page opens 0.3.9
B-23 Phone numbers garbled: "+91 9988776655" became "+991 999888772"; same for names, in messages and calls Any digit string from a model was accepted as a phone number. Models re-type numbers from memory and get digits wrong A number is only used if the user typed it, or it belongs to a contact. A near-miss of a real number (≤2 digits off) is corrected to the real one; anything else is refused, and Stitch asks for the contact instead 0.3.9
B-22 Alarm removal claimed success while the alarm stayed on, and sometimes named the wrong alarm The owner's Clock app ignores Android's ACTION_DISMISS_ALARM. Verification only ran when the alarm happened to be the phone's next one, so otherwise Stitch trusted the request Alarms are now turned off on screen: open the Clock list, find the row, flip its switch, read it back. Nothing is reported as done unless the switch is verified off (or Android's next alarm changed). If the row isn't found, Stitch lists the alarms it can see and asks which one 0.3.9
B-26 Contact not found: "Maria Daniya" came through as "Maria Dania" Needle dropped a letter, and the phone's contact search only matches the start of each word, so the misspelling matched nothing If nothing matches, Stitch retries with the last 1–2 letters cut off. A contact found this way is only used if its name is within 2 letters of the request and the user typed that name this turn (so "Alia" never becomes "Ali Khan"). Several matches → asks which one 0.4.1
B-27 A phone number the user typed was refused because the model added digits to it; the refusal message was confusing The number check (B-23) correctly refused the garbled number, but never went back to the number the user actually typed Before refusing, Stitch looks for a phone number in the user's own message. If there is exactly one, that one is used (two or more → still refuses, since it can't know which). Refusal message reworded in plain language 0.4.1
B-28 "Remove the 2:14 AM alarm" failed: the time arrived as "2:1:4" Needle garbled the time, and only setting alarms/timers had their time re-read from the user's words delete_alarm now also gets its time from TimeParser reading the request. Removals without a time ("next", "last", "all", by label) are left exactly as before 0.4.1
B-29 "Play X on Spotify" searched, then tapped the search bar again and stopped. Same on YouTube Music Stitch picks the topmost on-screen item whose text matches the request. After a search the search box still contains the query, so it matched — and being at the top, it always won Search boxes are excluded (editable node, EditText/SearchView class, or a view id containing "search"/"query"), and only items below the search box are considered 0.4.2
B-30 "Remove the 2:14 AM alarm": Stitch opened the Clock app, scrolled the whole list, listed 2:14 AM among the alarms it could see, and then said it couldn't find it The row was read — that is why it appeared in the list. Pairing it with its on/off switch failed: the old rule required the switch's centre to fall between this alarm's time text and the next alarm's, and many Clock apps place the switch level with the top of the card, slightly above the time. With no switch paired, the row was never a candidate Each alarm now takes the nearest unclaimed switch within its neighbours' bounds. The message also distinguishes three cases honestly: not in the list, already off, and "I can see it but can't reach its switch" 0.4.2
B-31 Wake phrase over Reddit: the bubble opened but Stitch's own screen was behind it, not Reddit. Answers about the screen were still correct The bubble's transparency was set up correctly. The bug was launchMode="singleTask" with Stitch's own task affinity, so opening the bubble pulled the entire Stitch app forward. Reading worked because the screen is captured before that happens The bubble gets its own task: taskAffinity=":bubble" + singleInstance 0.4.2
B-32 A long spoken reply (a read-out alarm list) could not be stopped — the chat had a Stop button, the speech did not. Replies also read out entire tables stop() cancelled the AI but never touched the speech engine, and speech was fed the whole reply flattened, table rows and all stop() now silences speech too, a speaking flag drives a stop control, and MarkdownParser.toSpokenText speaks the sentences only — tables and bullets become "the rest is on screen" 0.4.2
B-33 Wake phrase heard the owner 5 times out of 10, and fired by itself a lot — opening WhatsApp would pop the bubble. The owner correctly guessed it was tied to the microphone restarting Five separate causes. (1) Opening the recorder emits a burst of noise, loud enough to pass the speech check and be matched — and the recorder restarts every time the bubble closes. (2) The "is anyone speaking?" check looked at the last 100 ms but matched a 2–4 second window, so one tap let a window of near-silence through. (3) The accept threshold was purely relative to how alike the five training recordings were, with no upper limit. (4) A precedence bug put the intended safety floor on the multiplier instead of the threshold, so it did nothing. (5) Nothing required a match to beat ordinary background noise First 300 ms after the microphone opens is discarded; loudness is measured over the whole window; an absolute ceiling (MAX_DISTANCE = 1.8) caps the threshold; the precedence bug fixed; and two recordings must now agree, not just the best one. Measured: same phrase ≈ 0.7, unrelated audio and mic noise ≥ 2.5. Plus an optional "only show the bubble once I start speaking" (default on), which makes a mis-fire invisible 0.4.2
B-34 Rotating the phone inside a Settings category jumped back to the category list remember instead of rememberSaveable rememberSaveable 0.4.2
B-35 Replies read like statistics, not conversation ("even AI answers are like stats and info") The system prompt asked for exactly that: "Keep them short" plus "use small tables for lists of calls/messages/events" A "How to talk" section: lead with the outcome in a plain sentence, no narrating steps, no status-report phrasing, and tables only when several items were actually asked for — never as the only place the answer appears, since speech skips them 0.4.2
B-36 Set up OpenCode Zen, then MiMo, then switched back to Zen — "invalid API key", because it was now sending MiMo's key Every provider shared one apiKey/baseUrl/model slot, so saving a second provider overwrote the first. The Settings screen made it worse: switching provider reset the URL and model to that preset's defaults but left the key field untouched, so the previous provider's key was carried across and then saved over the new one Settings are stored per provider (apiKey.<provider> and so on), the screen saves the outgoing provider before loading the incoming one, and an upgrade moves the old shared values onto whichever provider was selected rather than dropping them. configuredPresets() marks set-up providers with a ✓, and an eye icon reveals a typed key 0.4.3
B-21 Removal said "removed 8:42" for an 8:43 alarm, and the alarm stayed on Some Clock apps register the alarm a few seconds early (e.g. 20:42:57); Stitch dropped the seconds Round to the nearest minute; snap requested times to a known alarm (±1 min, ±12 h). Verify that Android's next alarm changed; otherwise open the alarm list and say so 0.3.8

C. Mistakes in Claude's own process

These are recorded plainly, since they cost the owner time.

ID Mistake Impact Correction
C-01 A scripted find/replace with an empty search string inserted text between every character of NeedleEngine.kt (143,000 lines) The Kotlin compiler hung for 20+ minutes Rewrote the file cleanly. Later edit scripts assert each match exists and write nothing if any match fails
C-02 pkill -f patterns matched the shell running them (twice) Killed my own command Used bracketed patterns ([q]emu)
C-03 Reported the alarm bug (B-02) fixed in 0.2.0 after testing only the case where Needle handled it The owner hit the same phrase going to the AI in 0.3.0 (B-10) Stated openly in the 0.3.1 report. Rule since: fixes for core commands must not depend on a model's confidence
C-04 Lowered the Needle threshold to 0.15 when no AI was connected, to "handle more offline" Directly caused B-11 (greetings triggering actions) Removed; replaced by evidence gates
C-05 Tool descriptions contained example values ("7am") Copied by a weak model (B-10) No example values in descriptions
C-06 Copied an APK after a failed build (A-08) Nearly shipped a stale 0.3.7 Always check the version with aapt dump badging after building
C-07 The first alarm-removal version (0.3.7) was only verified with the emulator's Google Clock Failed on the owner's phone (B-20, B-21) 0.3.8 no longer relies on Clock-app-specific behaviour, and verifies the result
C-08 0.3.8 still let an unverified alarm removal be reported as success The owner hit it again (B-22) A tool may now only report what it proved. Unverifiable outcomes are reported as such, with the app opened so the owner can finish
C-09 Tools accepted any model-supplied phone number, with no check against real data (B-23) Messages and calls could go to a wrong number — the most dangerous bug so far Values that must be exact (numbers, names, times) are grounded in phone data or the user's own words, never in a model's memory
C-10 The first version of the B-26 name fix only checked "within 2 letters", which would have let "Alia" match "Ali Khan" Caught while writing the test, before any build The matched name must also be one the user typed this turn
C-11 The Settings and Chat-tab changes were written in two separate sessions that weren't allowed to run Gradle, so neither was compiled when it was finished. Both were told to "only touch" one file, so neither updated these docs Unverified code sat in the project; one session ended mid-compile with no result Compiled for the first time in the 0.4.1 release build (it built cleanly and tests passed). Rule: a change isn't finished until it compiles; if a session can't build, it says so and the next release build is the check
C-12 The 24 Sep planning session rewrote README.md and wrote docs/UPGRADE_PLAN.md, but never updated this document — breaking the standing rule in CLAUDE.md. It also listed PLAN.md and HOTWORD_PLAN.md as needing "historical" labels and then didn't apply them, while presenting its Phase 0 as essentially done Two days of project history were missing, and two docs still described shipped features as unbuilt. Anyone reading the docs would have believed the cleanup was finished All four documents brought into line on 24 Sep. The rule stands: docs are part of the change, and a plan may not mark its own cleanup complete while the files still contradict it
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

D. Platform limits

Limit Workaround
Apps can't read the Clock app's alarm list Stitch records alarms it sets; reads Android's "next alarm"; opens the Clock app for the rest
Apps can't toggle Wi-Fi/Bluetooth directly (Android 10+) Opens the settings panel; screen control can tap the toggle
Android 13+ greys out SMS/call-log permissions for sideloaded apps App info → ⋮ → Allow restricted settings (documented in README)
Accessibility service is stopped on every app update Settings warns; switch Phone control off and on
Edge Gallery keeps its models private; its API server is unreleased Stitch runs the same .litertlm models itself with the same engine
Needle's 256-token window 32-tool on-device subset; everything else goes to the AI
ACTION_DISMISS_ALARM behaviour differs per Clock app Dismiss by exact time, verify, fall back to showing the alarm list

9. Lessons learned

  1. A small model's confidence score isn't reliable on its own. Needle said "how are you" meant get_battery at 98% confidence. Every on-device action now also needs evidence words, and the eval counts only actions that would actually run.
  2. Put the deterministic path first. The most common commands (alarms, timers, reminders, flashlight, play X on Y) are handled by plain code before any model, so they behave the same every time.
  3. Never let a model do time arithmetic. Models copy the user's words; code computes times from the phone's clock.
  4. Treat the phone's real behaviour as the truth. The emulator's Google Clock and a Samsung Clock behave differently. Verify results through Android (e.g. nextAlarmClock) instead of trusting a sent intent.
  5. Give every "create" a matching list, edit and delete. The owner found the gap by using the app, not by reading the code.
  6. Be guarded when calling something fixed. Say which path was tested and which wasn't.

10. Testing & verification audit

Automated

Suite Covers
TimeParserTest Relative/absolute times, "after 30 minutes" at 4:10 PM, durations
QuickCommandsTest / PlayCommandTest Alarms, timers, reminders, flashlight, alarm removal ("last", "next", "all", exact time), timer cancel, list alarms, negation, named-app play, minute rounding
EvidenceTest Greetings/questions never trigger tools; real commands still do
GroundingTest Name correction ("Rahulia" → "Rahul") without touching other words
ProviderFormatTest / ProviderRoutingTest / TextToolCallsTest / GemmaCallTest Request formats per provider, OpenCode model routing, text/Gemma tool-call recovery; exports the tool catalogue for the Needle eval
MarkdownParserTest Headings, tables and alignment, lists, checkboxes, quotes, code, plain-text copy
NumberGroundingTest A mistyped digit still matches the real contact number; an invented number does not; the user's own number is found in their message (times and two-number messages excluded); a name missing a letter still matches, a different person does not
FingerprintTest The same phrase matches when spoken faster; a different phrase does not; silence is never a phrase
SpokenReplyTest What gets read aloud: a table is summarised not recited, bullet lists likewise, a plain reply is spoken as-is, a table-only reply still says something, a long reply is cut at a sentence, and Markdown emphasis isn't read as symbols
WakePhraseTest The wake-phrase accept rules: the phrase said again is accepted; a different phrase, microphone start-up noise and silence are refused; a resemblance to exactly one recording is not enough; and unrelated audio scores far enough above the phrase that MAX_DISTANCE sits between them (this last one guards the calibration itself)
ProviderSettingsTest Per-provider settings, under Robolectric: two providers keep their own keys, switching back restores the whole configuration, a fresh restart agrees, an untouched provider falls back to its preset defaults, the picker knows which are set up, a blank key clears only that provider, and an upgrade from the old shared slot keeps the key
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

Result at 0.4.0: 50 tests, 0 failures. At 0.4.1 (22 Sep, 12:51): 53 tests in 10 files, 0 failures, 0 skipped. At 0.4.3 (24 Sep, 15:34): 87 tests in 14 files, 0 failures — ProviderSettingsTest adds 7. At 0.4.2: 80 tests in 13 files, 0 failures. The 27 added since 0.4.1 are BackupTest (15), SpokenReplyTest (6) and WakePhraseTest (6). Compose screens still have no automated tests, so the backup UI, the routing radio buttons, the Phone control tile and the wake-phrase training scores are only checked by compiling. The 3 new tests (in NumberGroundingTest) cover B-26 and B-27: a name missing its last letter still matches the right contact but not a different person, and the user's own number is found in their message. B-28 is covered by the existing TimeParser tests plus a code change in Agent; no dedicated test. The Settings and Chat-tab UI changes have no automated tests. Compose screens aren't unit-tested in this project, so the only check is that they compile.

Needle offline eval (tools-dev/needle/run_eval.py, 64 phrases, the app's real safety rules, threshold 0.4; first run 19 Sep at 0.3.8, re-run at 0.4.1 with identical results). The eval doesn't model the time re-reading step, so it doesn't exercise B-28:

  • Correct tool: 48/64. Correct tool and arguments: 47/64.
  • Would run on-device: 24/64. The rest go to the rules or the AI.
  • Wrong actions that would run: 0. Needle alone is wrong on greetings and questions, e.g. "hey" → answer call, "how are you" → battery. The gates block every one of these.

Emulator (Android 14, headless, fake AI server)

Verified at various versions:

  • flashlight
  • SMS really sent (seen in the Sent folder)
  • cancel/decline handling
  • two-"Ali" disambiguation
  • Contacts app driven through the screen
  • permission dialogs readable
  • Stop bar and result card
  • screenshots reaching the AI
  • reminders firing on time
  • weather and web search
  • model sync against live OpenRouter (447 models), OpenCode Zen (74) and Go (37)
  • Granite on-device model: download, import, and a flashlight call
  • Default apps: "play Believer" → YouTube
  • calendar reminders written as real events
  • Markdown table layout
  • alarm set/remove (next, last, by time, ±1-minute snap), with each result checked against Android's dumpsys alarm
  • bubble opened over the Clock app (app stays visible), Stitch offered by Android as a digital assistant, and "read what's on screen" returning the Clock's contents, not Stitch's own window
  • wake-phrase service running as a microphone foreground service with its notification, no crashes
  • alarm turned off through the Clock app's screen with phone control on: the switch read back as off and Android reported no next alarm

Real phone, 24 Sep (the owner, against docs/STAGE_A_CHECKLIST.md)

The first real-device test of 0.4.1, and the first time the wake phrase heard an actual voice.

Worked: all four tabs with real data; the keyboard/bottom-bar layout; all six Settings pages, saving, and the back gesture; bubble opens on the wake phrase; Google speech recognition and spoken replies; reading the app behind the bubble (correct answers); real WhatsApp auto-send; a notification reply; "any important messages?"; a misspelled contact name typed by hand; a hand-typed phone number; setting an alarm; a real cloud API key, a summary request, and multi-step screen control opening YouTube and searching.

Failed: B-29 to B-35 above, all fixed in 0.4.2. Battery cost of listening (3.8) is still being measured.

Not yet verified

These are known gaps:

  • Real WhatsApp auto-send and notification replies
  • Spotify and YMusic playback
  • A real Google account and calendar sync
  • Gemma 4 E2B on a real phone's GPU
  • Any real paid cloud provider key
  • Samsung/Xiaomi Clock app behaviour for alarm removal (0.3.8 is designed for it but was only tested on Google Clock)
  • Long real-world screen-control tasks
  • Music finished on screen (no Spotify/YMusic in the emulator)
  • Phone-number grounding against a real contact list
  • B-26–B-28 on a phone or in the emulator: the shortened-name contact search, the typed-number fallback, and "remove the 2:14 AM alarm" through Needle. Only the pure helper functions are unit-tested; the contact search and the Needle routing are not
  • Per-provider settings (0.4.3) are unit-tested but untested on a phone. The switching flow in the Settings screen has no automated coverage, and the upgrade path — an existing install's key moving onto the selected provider — has only been exercised under Robolectric.
  • Everything new in 0.4.2 is untested on a device. The fixes were compiled and unit-tested, but only the owner's phone can confirm: music actually playing, alarm removal, the bubble showing the right app, stopping speech, the false-wake rate, backup/restore, the routing setting and the Phone control tile.
  • 0.4.1 UI, never opened in the emulator or on a phone: the Settings category pages (does every setting still save; does the back arrow/back gesture return to the list), the four tabs, the Schedule and Saved lists with real data, and the spacing between the input bar, the keyboard and the new bottom bar
  • Wake-word detection with a real voice — done 24 Sep: 5 hits in 10, with frequent false wakes (B-33). The 0.4.2 fixes are unmeasured
  • Speech recognition in the bubble, and spoken replies — both work

11. Security & privacy audit

Area Status
API keys Encrypted with an Android Keystore-backed key (SecretBox) in app-private storage. Sent only to the chosen provider's endpoint
Network The app talks only to the configured AI, model download hosts (Hugging Face) when downloading, and weather/web-search endpoints when those tools run. No analytics or telemetry
Risk levels Every tool has LOW/MEDIUM/HIGH risk, set by the tool, never by the AI. HIGH (calls, sending messages, deleting contacts/events) always asks first and shows the exact contact, number and text
Prompt injection Tools that read other people's content (SMS, notifications, screen, web) are marked untrusted. After such a read, MEDIUM actions also need confirmation. Screen taps on Send/Pay/Delete-type buttons ask first (can be turned off in Settings)
Runaway agent Max 40 steps; stops on repeated identical steps or repeated failures; visible Stop button over other apps
On-device mode With "On this phone" selected, no request data leaves the phone
Data sent to cloud AI Only what's needed for the request: tool results, and screen text/screenshots during screen control. The "Show data" panel shows what an answer was based on
Permissions used ACCESS_COARSE/FINE_LOCATION, ACCESS_NETWORK_STATE, ACCESS_NOTIFICATION_POLICY, ANSWER_PHONE_CALLS, BIND_ACCESSIBILITY_SERVICE, BIND_NOTIFICATION_LISTENER_SERVICE, BLUETOOTH_CONNECT, CALL_PHONE, INTERNET, POST_NOTIFICATIONS, QUERY_ALL_PACKAGES, READ/WRITE_CALENDAR, READ_CALL_LOG, READ/WRITE_CONTACTS, READ_SMS, SEND_SMS, RECEIVE_BOOT_COMPLETED, RECORD_AUDIO, SCHEDULE_EXACT_ALARM, USE_EXACT_ALARM, WRITE_SETTINGS. Intentionally broad (personal use) and requested just in time
Signing ⚠️ Releases up to and including 0.4.1 are signed with this machine's Android debug key (~/.android/debug.keystore). A proper release key now exists at ~/.stitch-release-key/ (RSA 4096, valid to 2056) but is not in use yet — it is opt-in via -PreleaseKey, because changing keys forces an uninstall. Back up both folders. Cutover steps: docs/SIGNING.md
Backups Settings → Backup & restore writes one AES-256-GCM file, key derived from a user passphrase with PBKDF2-HMAC-SHA256 (210,000 iterations, fresh 16-byte salt and 12-byte IV per file). The API key is decrypted from the Keystore on export and re-sealed with the new device's Keystore on restore — the Keystore key itself cannot leave the phone and dies on uninstall. The envelope header (format, version, app version, date) stays readable so a file can be identified; everything else is inside the encrypted blob. A wrong passphrase and a tampered file are indistinguishable by design — both fail the GCM auth tag
Not done No formal security review, no red-team of injection defences, no audit log of executed actions (the plan had one; not built yet)

12. Changes made to the build machine

Change Location Still present?
JDK 17 ~/.jdks/jdk-17.0.20.1+1 Yes, needed to rebuild
Android SDK, platform 35, build-tools 34/35, NDK r27 + r30, CMake, emulator, Android 14 x86_64 image ~/Android/Sdk Yes
Gradle 8.11.1 wrapper cache in ~/.gradle Yes
Emulator AVD stitch ~/.android/avd/ Yes
Needle downloads (Android libs, Linux CLI, model) ~/.cache/stitch-dl/needle/ Yes
Temporary /dev/kvm access for the user (setfacl) /dev/kvm Removed after each emulator session
Wi-Fi file server for APK transfer offered, never started —

No system packages were installed. Nothing outside the home folder and the project changed, apart from the temporary /dev/kvm ACL.


13. Known limitations & open risks

  1. Real-device coverage is thin. Most verification ran in an emulator. The owner's phone is the real test bed for WhatsApp, Spotify/YMusic, Gemma, and OEM Clock apps.
  2. Needle is weak alone. It handles about 24 of 64 test phrases on-device. Fine-tuning Needle on Stitch's own tool catalogue (planned Phase 4) would raise this.
  3. Alarm visibility. Alarms set outside Stitch are only visible as "the next alarm".
  4. Screen control cost. Each step sends screen text (sometimes a screenshot) to the cloud AI, so long tasks use many tokens.
  5. Chat history: what you and Stitch said now survives restarts (last 40 turns). Tool results and screenshots stay in memory for the session only, since they hold other people's messages.
  6. No offline speech recognition fallback on phones without an on-device recognizer.
  7. Signing key is the machine's debug key (see §11).
  8. Wake word: trained on your voice only, so it may miss you when you whisper, shout, or have a cold; retrain in those conditions to improve it. Speaker verification (only your voice wakes it) is not implemented.
  9. Garbled-value fallbacks (B-26–B-28) have edge cases. The typed-number fallback uses the one number in your message even if the model meant a different, unwritten one. A message like "remove my 2 alarms" can be read as "remove the 2:00 alarm". A name that is off by more than the last two letters is still not found.
  10. New screens (0.4.1) are read-only and partly unfinished. Schedule doesn't show timers, because Stitch doesn't store them. Alarms set outside Stitch don't show either (see 3). Schedule reads the calendar while drawing the screen, so it may stutter on a slow phone with many events (it loads at most 100). Workflows is only a "coming soon" placeholder. Settings forgets which category page was open if the phone is rotated. Nothing in Schedule or Saved can be edited by tapping; ask Stitch instead.
  11. Not built from the plan yet: audit log, routines/triggers, home widget, Gmail API, MCP.
  12. Hermes is not actually integrated. The "Hermes Agent" entry in Settings is a generic OpenAI-compatible provider preset, nothing more. It also points at http://192.168.1.10:8642/v1, which is not this build machine — the reachable address is the Tailscale one, 100.x.y.z. On top of that, Hermes' API server binds to 127.0.0.1 by default and refuses to start without API_SERVER_KEY, so as shipped the preset cannot connect to anything. Fixed in Stage C of docs/UPGRADE_PLAN.md.
  13. No export or restore. Built 24 Sep (unreleased): Settings → Backup & restore. Two caveats remain. It has never been run on a phone — only the encryption and preference encoding are unit tested. And a restore cannot bring back the special permissions (accessibility, notification access, Do Not Disturb, modify system settings); Android requires those to be granted by hand every time, so a reinstall always costs that step.
  14. The wake phrase matches sound, not words. It compares the shape of what it hears against your five recordings. The 0.4.2 fixes narrow the gap, but a template matcher will always mis-fire sometimes and always miss sometimes. "Only show the bubble once I start speaking" hides the mis-fires rather than eliminating them. Getting past this ceiling means a real wake-word engine.
  15. Banking apps refuse to run while Phone control is on. That is the bank's own anti-fraud check against screen-scraping, not Android and not Stitch, and Stitch does not try to evade it. The Quick Settings tile makes switching off one tap; switching back on always needs the system accessibility page, because Android forbids an app from granting itself that access.
  16. Still on SharedPreferences. The Room/DataStore migration in Stage B of the upgrade plan has not been done. It is now safe to attempt, because the backup exists as a fallback — that was the point of building it first.

14. Project metrics

Metric Value (at 0.4.1, measured 22 Sep)
Kotlin source files 62 / 11,244 lines (re-counted 25 Sep at 0.4.3; 59 / 10,102 at 0.4.1)
Native code needle_jni.cpp + x86_64 stub
Test files / tests 14 / 87 at 0.4.3 (all pass; 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
Tools available to the AI 70
Tools available to Needle on-device 32
Deterministic quick commands flashlight, play X on Y, alarm set/remove/list, timer set/cancel, reminder set
AI provider presets 15, each with its own saved key/URL/model since 0.4.3 (Anthropic, OpenAI, OpenRouter, OpenCode Zen, OpenCode Go, DeepSeek, Xiaomi MiMo ×2, Gemini, Groq, on-device, local server, Ollama, Hermes, custom)
API formats OpenAI Chat, OpenAI Responses, Anthropic Messages, LiteRT-LM local
Releases 16 APKs (0.1.0 → 0.4.3)
APK size 54 MB (Needle ~14 MB + LiteRT-LM engine ~22 MB)
Min / target Android 9 (API 28) / 15 (API 35)
Stack Kotlin 2.4.20, AGP 8.7.3, Gradle 8.14.5 (was 8.11.1), Compose BOM 2024.12.01, OkHttp 4.12, LiteRT-LM 0.17.1, NDK r30
On-device instrumentation tests 0 (Compose screens and the accessibility path have no automated coverage)
Build warnings The Kotlin-plugin Gradle deprecation is fixed (it wanted ≥ 8.14.4; 8.14.5 installed). Remaining: three non-fatal R8 "kotlin metadata" warnings, because Kotlin 2.4.20 is newer than the R8 in AGP 8.7.3, and one deprecated sender call in StitchNotificationListener.kt:102

15. How to rebuild

export JAVA_HOME=~/.jdks/jdk-17.0.20.1+1
cd /mnt/ssd-storage/projects/ai-support
./gradlew testDebugUnitTest          # all unit tests
./gradlew assembleRelease            # → app/build/outputs/apk/release/app-release.apk
./gradlew assembleDebug -Pemulator   # adds x86_64 (Needle stub) for the emulator

# Needle offline eval (tool catalogue is exported by the unit tests)
python3 tools-dev/needle/run_eval.py ~/.cache/stitch-dl/needle/linux-x86_64/needle app/build/needle-tools.json 0.4

Before each release:

  1. Bump versionCode/versionName in app/build.gradle.kts.
  2. Copy the release APK to dist/Stitch-<version>.apk.
  3. Confirm with aapt dump badging that the version is right.

See README.md for phone installation and first-time setup, docs/UPGRADE_PLAN.md for what happens next, and docs/PLAN.md for the original (historical) plan.