Your phone, on your command. Gotcha is world's first fully on-device AI copilot for Android that turns natural language into real device actions — safely.
Make New for you usage-driven; open Second Brain from the drawer only
Rishabh Bajpai58ed2210020b
diff --git a/app/src/main/assets/app/about-gotcha.md b/app/src/main/assets/app/about-gotcha.mdindex 7b9bbe9..77dc42c 100644--- a/app/src/main/assets/app/about-gotcha.md+++ b/app/src/main/assets/app/about-gotcha.md@@ -32,6 +32,12 @@ mid-conversation.the call log, find and add contacts, send and read SMS.- **Calendar** — list, create, edit and delete events, and check availability.- **Clock** — set and edit alarms and timers, list them, snooze, dismiss.+- **Second Brain** — persistent memory in files the user owns: SOUL.md+ (identity), MEMORY.md (the map), user.md, and area, people and note files it+ reads at the start of each chat. The user opens the read-only viewer from the+ **Second Brain** entry in the navigation drawer. In Operator, save a fact with+ `write_file` or `edit` under the memory root when the user asks you to+ remember something.- **Scheduled tasks** — in Operator, set up a prompt for Gotcha to run by itselflater, once or on repeat (every few hours or days, chosen weekdays, monthly),in a new chat each time or always the same one, with `schedule_agent_task`;@@ -67,12 +73,12 @@ mid-conversation.## Where the settings are-Everything below is reached from **Settings** in the navigation drawer.+Everything below is reached from **Settings** in the navigation drawer, except+**Second Brain**, which has its own entry in that drawer.| Setting | What it controls || --- | --- || Personal Info | Name, occupation, background, reply style, location, preferred currency and language |-| Second Brain | Gotcha's persistent memory: identity, user card, areas, people and notes (read-only viewer) || Language | App display language, AI reply language, voice language, STT language || AI | Hub for the two pages below || AI > AI Configuration | LLM provider, API key, Base URL, main and navigator models, API timeout (default 180 seconds; 0 never times out), max context tokens, max tool rounds, max repeated tool calls, max navigation tool calls, max consecutive delegations, cache and debug-screenshot clearing |diff --git a/app/src/main/java/com/gotcha/MainActivity.kt b/app/src/main/java/com/gotcha/MainActivity.ktindex 4b3c62f..b918d95 100644--- a/app/src/main/java/com/gotcha/MainActivity.kt+++ b/app/src/main/java/com/gotcha/MainActivity.kt@@ -1200,10 +1200,6 @@ class MainActivity : ComponentActivity() {chatViewModel.openSession(id)currentRoute = Route.HOME},- onStartChat = { prompt, mode ->- chatViewModel.startChatFromTip(prompt, mode)- currentRoute = Route.HOME- },onImportChats = { chatTransfer.startImport() },onBackupAllChats = { chatTransfer.startBackupAll() },page = settingsPage,diff --git a/app/src/main/java/com/gotcha/data/FeatureUsage.kt b/app/src/main/java/com/gotcha/data/FeatureUsage.ktnew file mode 100644index 0000000..2263caa--- /dev/null+++ b/app/src/main/java/com/gotcha/data/FeatureUsage.kt@@ -0,0 +1,39 @@+package com.gotcha.data++import android.content.Context+import com.gotcha.scheduled.ScheduledTask+import com.gotcha.scheduled.ScheduledTaskStore++/**+ * What the user has actually done with the two introduced features.+ *+ * The home screen uses this instead of trusting its own "seen" flags alone: a+ * flag only records a tapped chip, so someone who already keeps notes or+ * already runs a task would still be told the feature is new. Usage wins.+ */+data class FeatureUsage(+ val memory: Boolean = false,+ val schedule: Boolean = false+)++/**+ * Reads both flags. Cheap for the home screen: two small memory files and a+ * couple of directory listings, plus one scheduled-task prefs read. Call it+ * from IO.+ */+fun loadFeatureUsage(+ context: Context,+ /** Injectable for tests: the real store lives in encrypted prefs. */+ loadTasks: () -> List<ScheduledTask> = { ScheduledTaskStore(context).all() }+): FeatureUsage = FeatureUsage(+ memory = MemoryStore.isInUse(),+ schedule = runCatching { scheduleInUse(loadTasks()) }.getOrDefault(false)+)++/**+ * True once the user has a task of their own, or has switched one on. The four+ * paused examples that ship with the app do not count: they are the offer, not+ * the use.+ */+internal fun scheduleInUse(tasks: List<ScheduledTask>): Boolean =+ tasks.any { it.enabled || it.presetId == null }diff --git a/app/src/main/java/com/gotcha/data/MemoryStore.kt b/app/src/main/java/com/gotcha/data/MemoryStore.ktindex 0fc7afc..b542b9b 100644--- a/app/src/main/java/com/gotcha/data/MemoryStore.kt+++ b/app/src/main/java/com/gotcha/data/MemoryStore.kt@@ -92,6 +92,27 @@ object MemoryStore {}}+ /**+ * Whether anything has actually been saved: a detail file, a raw file, or+ * an edited identity or map. Cheaper than [loadSnapshot] because it never+ * reads the notes, so the home screen can ask without paying for the+ * viewer's full load.+ */+ fun isInUse(): Boolean {+ fun hasMarkdown(dir: java.io.File): Boolean =+ dir.listFiles()?.any { it.isFile && it.extension.equals("md", true) } == true+ if (hasMarkdown(GotchaStorage.memoryNotesDir()) ||+ hasMarkdown(GotchaStorage.memoryPeopleDir()) ||+ GotchaStorage.memoryRawDir().listFiles()?.any { it.isFile } == true+ ) {+ return true+ }+ val soul = runCatching { GotchaStorage.soulFile().readText() }.getOrNull()+ val index = runCatching { GotchaStorage.memoryIndexFile().readText() }.getOrNull()+ return (soul != null && !isPristineSoul(soul)) ||+ (index != null && !isPristineMemoryIndex(index))+ }+/*** True while [content] is still the generated skeleton. Used by the viewer* to tell "nothing here yet" from a brain the agent has already shaped,diff --git a/app/src/main/java/com/gotcha/ui/ChatScreen.kt b/app/src/main/java/com/gotcha/ui/ChatScreen.ktindex 5d12294..d278593 100644--- a/app/src/main/java/com/gotcha/ui/ChatScreen.kt+++ b/app/src/main/java/com/gotcha/ui/ChatScreen.kt@@ -94,6 +94,7 @@ import com.gotcha.agent.ChatUiStateimport com.gotcha.agent.ComposerAttachmentimport com.gotcha.agent.ForegroundControlRequestimport com.gotcha.data.FeatureIntroStore+import com.gotcha.data.loadFeatureUsageimport com.gotcha.i18n.stringLookupimport com.gotcha.tools.AgentModeimport com.gotcha.ui.theme.GotchaMono@@ -101,7 +102,9 @@ import com.gotcha.ui.theme.LocalSkinimport com.gotcha.ui.theme.SkinAlertDialogimport com.gotcha.ui.theme.SkinDropdownMenuimport com.gotcha.ui.theme.motionSpec+import kotlinx.coroutines.Dispatchersimport kotlinx.coroutines.delay+import kotlinx.coroutines.withContextimport androidx.compose.foundation.Image as ComposeImage@OptIn(ExperimentalMaterial3Api::class)@@ -148,11 +151,12 @@ fun ChatScreen(val otherChatRunning = state.runningSessionId != null &&state.runningSessionId != state.activeSessionIdval context = LocalContext.current- // Introductions to features added after this user's first run. Read once- // when the home screen appears; a tap retires one for good.+ // Introductions to features added after this user's first run. Starts+ // hidden and is filled in by the usage check below, so an already-used+ // feature never flashes as "new".val featureIntro = remember { FeatureIntroStore(context) }- var showMemoryIntro by remember { mutableStateOf(!featureIntro.hasSeen(FeatureIntroStore.MEMORY)) }- var showScheduleIntro by remember { mutableStateOf(!featureIntro.hasSeen(FeatureIntroStore.SCHEDULE)) }+ var showMemoryIntro by remember { mutableStateOf(false) }+ var showScheduleIntro by remember { mutableStateOf(false) }var input by rememberSaveable { mutableStateOf("") }var inputWasVoice by rememberSaveable { mutableStateOf(false) }val pendingAttachments = state.pendingAttachments@@ -160,6 +164,15 @@ fun ChatScreen(var editingMessageId by rememberSaveable { mutableStateOf<Long?>(null) }// Id of the user message pending a revert confirmation.var pendingRevertId by remember { mutableStateOf<Long?>(null) }+ // "New for you" means new to this user, not merely shipped: a feature they+ // already use never offers its chip, even if they never tapped it. Re-run+ // per empty chat, so using it during this session retires the chip too.+ LaunchedEffect(isHome, state.activeSessionId) {+ if (!isHome) return@LaunchedEffect+ val usage = withContext(Dispatchers.IO) { loadFeatureUsage(context) }+ showMemoryIntro = !featureIntro.hasSeen(FeatureIntroStore.MEMORY) && !usage.memory+ showScheduleIntro = !featureIntro.hasSeen(FeatureIntroStore.SCHEDULE) && !usage.schedule+ }// A draft handed over by the view model (a tapped daily tip): fill, never send.LaunchedEffect(state.composerDraft) {state.composerDraft?.let { draft ->diff --git a/app/src/main/java/com/gotcha/ui/SecondBrainScreen.kt b/app/src/main/java/com/gotcha/ui/SecondBrainScreen.ktindex 9b1d5ee..80c3ca2 100644--- a/app/src/main/java/com/gotcha/ui/SecondBrainScreen.kt+++ b/app/src/main/java/com/gotcha/ui/SecondBrainScreen.kt@@ -127,7 +127,7 @@ fun SecondBrainScreen(}SettingsScaffold(- title = stringResource(SettingsPage.SECOND_BRAIN.title),+ title = stringResource(R.string.settings_page_second_brain),onBack = onBack,overlay = overlay) {diff --git a/app/src/main/java/com/gotcha/ui/SettingsCommon.kt b/app/src/main/java/com/gotcha/ui/SettingsCommon.ktindex e7766ad..31010df 100644--- a/app/src/main/java/com/gotcha/ui/SettingsCommon.kt+++ b/app/src/main/java/com/gotcha/ui/SettingsCommon.kt@@ -127,11 +127,6 @@ enum class SettingsPage(R.string.settings_page_personal_info_summary,"settings_personal_info_row"),- SECOND_BRAIN(- R.string.settings_page_second_brain,- R.string.settings_page_second_brain_summary,- "settings_second_brain_row"- ),CHATS(R.string.settings_page_chats,R.string.settings_page_chats_summary,diff --git a/app/src/main/java/com/gotcha/ui/SettingsScreen.kt b/app/src/main/java/com/gotcha/ui/SettingsScreen.ktindex 5ffbb7d..127be35 100644--- a/app/src/main/java/com/gotcha/ui/SettingsScreen.kt+++ b/app/src/main/java/com/gotcha/ui/SettingsScreen.kt@@ -43,7 +43,6 @@ import com.gotcha.data.FeedbackChannelimport com.gotcha.data.Settingsimport com.gotcha.i18n.Languageimport com.gotcha.i18n.stringLookup-import com.gotcha.tools.AgentModeimport com.gotcha.ui.tour.TourAnchorimport com.gotcha.ui.tour.tourAnchorimport kotlinx.coroutines.delay@@ -128,12 +127,6 @@ fun SettingsScreen(onSendFeedback: () -> Unit = {},/** Leaves Settings for chat [String], e.g. the one a scheduled task's run went into. */onOpenChat: (String) -> Unit = {},- /**- * Leaves Settings for a new chat in [AgentMode] with [String] in the- * composer, e.g. the Second Brain page's "get to know me" prompt. Filled,- * never sent.- */- onStartChat: (String, AgentMode) -> Unit = { _, _ -> },/** Opens the system picker to import chats (Settings ▸ Chats). */onImportChats: () -> Unit = {},/** Backs up every chat through the system save picker (Settings ▸ Chats). */@@ -215,10 +208,6 @@ fun SettingsScreen(onBack = backToHome,onOpenLanguage = { onPageChange(SettingsPage.LANGUAGE) })- SettingsPage.SECOND_BRAIN -> SecondBrainScreen(- onBack = backToHome,- onStartChat = onStartChat- )SettingsPage.CHATS -> ChatsScreen(onBack = backToHome,onImportChats = onImportChats,diff --git a/app/src/main/java/com/gotcha/ui/SettingsSearchEntry.kt b/app/src/main/java/com/gotcha/ui/SettingsSearchEntry.ktindex ea65d72..332b4d2 100644--- a/app/src/main/java/com/gotcha/ui/SettingsSearchEntry.kt+++ b/app/src/main/java/com/gotcha/ui/SettingsSearchEntry.kt@@ -134,10 +134,6 @@ private fun entryFor(page: SettingsPage): SettingsSearchEntry = when (page) {field("settings_user_currency", R.string.settings_field_user_currency)))- SettingsPage.SECOND_BRAIN -> SettingsSearchEntry(- page,- words("memory, second brain, soul, remember, persona, notes, user card")- )SettingsPage.CHATS -> SettingsSearchEntry(page,words("chats, conversations, import, backup, export, restore"),diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xmlindex 4b9a156..aa4ee07 100644--- a/app/src/main/res/values-de/strings.xml+++ b/app/src/main/res/values-de/strings.xml@@ -47,7 +47,6 @@<string name="settings_page_personal_info">Persönliche Infos</string><string name="settings_page_personal_info_summary">Wer du bist, Währung, Antwortstil</string><string name="settings_page_second_brain">Second Brain</string>- <string name="settings_page_second_brain_summary">Gotchas Gedächtnis: Identität, Nutzerkarte, Notizen</string><string name="second_brain_summary">Notizen: %1$d · Personen: %2$d · Bereiche: %3$d</string><string name="second_brain_setup_title">Dein zweites Gehirn</string><string name="second_brain_setup_body">Alles, was Gotcha über dich gelernt hat, in Dateien, die dir gehören. Es liest sie zu Beginn jedes Chats, sodass du dich nicht wiederholst.</string>diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xmlindex d455d2d..41c46e9 100644--- a/app/src/main/res/values-es/strings.xml+++ b/app/src/main/res/values-es/strings.xml@@ -47,7 +47,6 @@<string name="settings_page_personal_info">Información personal</string><string name="settings_page_personal_info_summary">Quién eres, moneda, estilo de respuesta</string><string name="settings_page_second_brain">Segundo cerebro</string>- <string name="settings_page_second_brain_summary">La memoria de Gotcha: identidad, ficha de usuario, notas</string><string name="second_brain_summary">Notas: %1$d · Personas: %2$d · Áreas: %3$d</string><string name="second_brain_setup_title">Tu segundo cerebro</string><string name="second_brain_setup_body">Todo lo que Gotcha ha aprendido sobre ti, en archivos que son tuyos. Los lee al empezar cada chat, así no repites nada.</string>diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xmlindex 91006a1..95f7e77 100644--- a/app/src/main/res/values-fr/strings.xml+++ b/app/src/main/res/values-fr/strings.xml@@ -47,7 +47,6 @@<string name="settings_page_personal_info">Infos personnelles</string><string name="settings_page_personal_info_summary">Qui vous êtes, devise, style de réponse</string><string name="settings_page_second_brain">Second cerveau</string>- <string name="settings_page_second_brain_summary">La mémoire de Gotcha : identité, fiche utilisateur, notes</string><string name="second_brain_summary">Notes : %1$d · Personnes : %2$d · Domaines : %3$d</string><string name="second_brain_setup_title">Votre second cerveau</string><string name="second_brain_setup_body">Tout ce que Gotcha a appris sur vous, dans des fichiers qui vous appartiennent. Il les lit au début de chaque chat, pour que vous ne vous répétiez pas.</string>diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xmlindex 279a518..f1fd6a6 100644--- a/app/src/main/res/values-hi/strings.xml+++ b/app/src/main/res/values-hi/strings.xml@@ -47,7 +47,6 @@<string name="settings_page_personal_info">व्यक्तिगत जानकारी</string><string name="settings_page_personal_info_summary">आप कौन हैं, मुद्रा, जवाब की शैली</string><string name="settings_page_second_brain">सेकंड ब्रेन</string>- <string name="settings_page_second_brain_summary">Gotcha की मेमोरी: पहचान, यूज़र कार्ड, नोट्स</string><string name="second_brain_summary">नोट्स: %1$d · लोग: %2$d · क्षेत्र: %3$d</string><string name="second_brain_setup_title">आपका सेकंड ब्रेन</string><string name="second_brain_setup_body">Gotcha ने आपके बारे में जो सीखा है, वह आपकी अपनी फ़ाइलों में। हर चैट की शुरुआत में इसे पढ़ा जाता है, इसलिए आपको दोहराना नहीं पड़ता।</string>diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xmlindex a703c70..900491f 100644--- a/app/src/main/res/values-it/strings.xml+++ b/app/src/main/res/values-it/strings.xml@@ -47,7 +47,6 @@<string name="settings_page_personal_info">Informazioni personali</string><string name="settings_page_personal_info_summary">Chi sei, valuta, stile delle risposte</string><string name="settings_page_second_brain">Secondo cervello</string>- <string name="settings_page_second_brain_summary">La memoria di Gotcha: identità, scheda utente, note</string><string name="second_brain_summary">Note: %1$d · Persone: %2$d · Aree: %3$d</string><string name="second_brain_setup_title">Il tuo secondo cervello</string><string name="second_brain_setup_body">Tutto ciò che Gotcha ha imparato su di te, in file che sono tuoi. Li legge all\'inizio di ogni chat, così non ti ripeti.</string>diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xmlindex d15cac9..f4b0998 100644--- a/app/src/main/res/values-ja/strings.xml+++ b/app/src/main/res/values-ja/strings.xml@@ -47,7 +47,6 @@<string name="settings_page_personal_info">個人情報</string><string name="settings_page_personal_info_summary">あなたについて、通貨、回答のスタイル</string><string name="settings_page_second_brain">セカンドブレイン</string>- <string name="settings_page_second_brain_summary">Gotcha のメモリ: アイデンティティ、ユーザーカード、ノート</string><string name="second_brain_summary">ノート: %1$d · 人: %2$d · エリア: %3$d</string><string name="second_brain_setup_title">あなたのセカンドブレイン</string><string name="second_brain_setup_body">Gotcha があなたについて学んだことすべてを、あなた自身のファイルに。各チャットの開始時に読み込むので、同じことを繰り返す必要はありません。</string>diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xmlindex 934485d..c1b31aa 100644--- a/app/src/main/res/values-pt-rBR/strings.xml+++ b/app/src/main/res/values-pt-rBR/strings.xml@@ -47,7 +47,6 @@<string name="settings_page_personal_info">Informações pessoais</string><string name="settings_page_personal_info_summary">Quem você é, moeda, estilo das respostas</string><string name="settings_page_second_brain">Segundo cérebro</string>- <string name="settings_page_second_brain_summary">A memória do Gotcha: identidade, ficha do usuário, notas</string><string name="second_brain_summary">Notas: %1$d · Pessoas: %2$d · Áreas: %3$d</string><string name="second_brain_setup_title">Seu segundo cérebro</string><string name="second_brain_setup_body">Tudo o que o Gotcha aprendeu sobre você, em arquivos que são seus. Ele lê no início de cada conversa, então você não se repete.</string>diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xmlindex 6d0e7e0..08a5473 100644--- a/app/src/main/res/values-zh-rCN/strings.xml+++ b/app/src/main/res/values-zh-rCN/strings.xml@@ -47,7 +47,6 @@<string name="settings_page_personal_info">个人信息</string><string name="settings_page_personal_info_summary">你是谁、货币、回复风格</string><string name="settings_page_second_brain">第二大脑</string>- <string name="settings_page_second_brain_summary">Gotcha 的记忆:身份、用户卡片、笔记</string><string name="second_brain_summary">笔记: %1$d · 人物: %2$d · 领域: %3$d</string><string name="second_brain_setup_title">你的第二大脑</string><string name="second_brain_setup_body">Gotcha 了解你的一切,都存放在你自己的文件里。每次聊天开始时它都会读取,所以你不用重复自己。</string>diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xmlindex b73b2d3..a7fb878 100644--- a/app/src/main/res/values/strings.xml+++ b/app/src/main/res/values/strings.xml@@ -70,7 +70,6 @@<string name="settings_page_personal_info">Personal Info</string><string name="settings_page_personal_info_summary">Who you are, currency, reply style</string><string name="settings_page_second_brain">Second Brain</string>- <string name="settings_page_second_brain_summary">Gotcha\'s memory: identity, user card, notes</string><string name="settings_page_chats">Chats</string><string name="settings_page_chats_summary">Import or back up conversations</string><string name="second_brain_intro">What Gotcha remembers about you. Identity first, then the map, then detail. Editing happens through the agent for now.</string>diff --git a/app/src/test/java/com/gotcha/data/FeatureUsageTest.kt b/app/src/test/java/com/gotcha/data/FeatureUsageTest.ktnew file mode 100644index 0000000..01cc5f8--- /dev/null+++ b/app/src/test/java/com/gotcha/data/FeatureUsageTest.kt@@ -0,0 +1,95 @@+package com.gotcha.data++import android.content.Context+import androidx.test.core.app.ApplicationProvider+import com.gotcha.scheduled.Repeat+import com.gotcha.scheduled.RepeatKind+import com.gotcha.scheduled.ScheduledTask+import com.gotcha.scheduled.ScheduledTaskStore+import org.junit.Assert.assertFalse+import org.junit.Assert.assertTrue+import org.junit.Before+import org.junit.Test+import org.junit.runner.RunWith+import org.robolectric.RobolectricTestRunner+import org.robolectric.annotation.Config+import java.io.File+import java.time.LocalDateTime+import java.time.ZoneId++/**+ * Whether the home screen should still call a feature "new": only while the+ * user has not actually used it, whatever the chip flags say.+ */+@RunWith(RobolectricTestRunner::class)+@Config(sdk = [34])+class FeatureUsageTest {++ private val context: Context = ApplicationProvider.getApplicationContext()+ private lateinit var tasks: ScheduledTaskStore++ @Before+ fun setUp() {+ GotchaStorage.memoryRoot().deleteRecursively()+ MemoryStore.ensureSkeleton()+ tasks = ScheduledTaskStore(context)+ tasks.all().forEach { tasks.delete(it.id) }+ }++ private fun usage() = loadFeatureUsage(context) { tasks.all() }++ private fun task(presetId: String? = null, enabled: Boolean = false) = ScheduledTask(+ id = "t",+ name = "Mine",+ prompt = "p",+ startLocal = "2026-11-02T08:00",+ repeat = Repeat(RepeatKind.DAILY),+ enabled = enabled,+ presetId = presetId+ )++ @Test+ fun `a fresh install has used neither feature`() {+ assertFalse(usage().memory)+ assertFalse(usage().schedule)+ }++ @Test+ fun `a saved note counts as memory use`() {+ File(GotchaStorage.memoryNotesDir(), "tea.md").writeText("# Tea\n\nMasala chai.")++ assertTrue(usage().memory)+ }++ @Test+ fun `an edited identity counts as memory use`() {+ GotchaStorage.soulFile().writeText("# SOUL\n\n- Tone: dry")++ assertTrue(usage().memory)+ }++ @Test+ fun `a task the user made counts as scheduling use`() {+ tasks.put(task())++ assertTrue(usage().schedule)+ }++ @Test+ fun `the paused examples alone are not use`() {+ tasks.seedPresets(+ GotchaStorage.memoryRoot().absolutePath,+ LocalDateTime.parse("2026-11-01T09:00").atZone(ZoneId.of("UTC")).toInstant().toEpochMilli(),+ ZoneId.of("UTC")+ )++ assertFalse(usage().schedule)+ }++ @Test+ fun `an example switched on counts as use`() {+ tasks.put(task(presetId = "evening_wrap_up", enabled = true))++ assertTrue(usage().schedule)+ }+}