Modern Apps git

← Modern-Apps.git

wearlink: add conduit sync-trigger contract and persistent data store

Commit
8d79cb096ad3f75a4d5734abd987402786528d06
Author
Vayun Mathur <[email protected]>
When
2026-12-05 01:22 UTC (1 day ago)
Parents
94b70ac
Owner design: the phone Watch app regularly calls an intent on a
phone app to push its snapshot to its watch counterpart. Adds the
ConduitSync contract (SYNC_TRIGGER action, appId-only payload,
CONDUIT signature permission, package-addressed delivery) and a
pure ConduitSyncDispatcher that fans the trigger out to the
registered appId-to-package registry, tolerating absent apps.

Registrations now record the caller package, and each conduit host
persists its router data cache in a latest-wins, size-capped
ConduitDataStore restored at start, so pushes land even when the
receiving app is not running, in either direction. Wire protocol
and per-app snapshot formats are unchanged.

Verified: :library:wearlink:lint and :library:wearlink:testDebugUnitTest
pass (23 tests, including dispatch, store latest-wins/caps, and
router package/restore coverage).

Diff

library/wearlink/AGENTS.md
diff --git a/library/wearlink/AGENTS.md b/library/wearlink/AGENTS.mdindex d4dc7eabfa..dba70a4d1e 100644--- a/library/wearlink/AGENTS.md+++ b/library/wearlink/AGENTS.md@@ -29,14 +29,31 @@ Migrated: clock, launcher, calendar, weather, music, notes, maps, appstore, cont  The `conduit/` package is the Watch conduit contract and core: `ConduitProtocol` (Messenger codes/keys), `ConduitRouter` (pure-routing: registrations, latest-data replay, bounded queue for-unregistered apps, status fan-out, counters), `WearLinkClientNode`-(drop-in `WearLinkNode` replacement over the conduit binding; reports-`NotInstalled`/`Unavailable` when the Watch app is absent), and-`ConduitHost`/`ConduitRuntime` used by the two Watch apps'-`ConduitService`s. Merged phone/watch pairs ship as single APKs whose phone and watch-experiences pick their side at runtime. This module declares no-Bluetooth permissions; only the Watch apps (:watch, :watch:wear) do.+routing: registrations with caller packages, latest-data replay,+bounded queue for unregistered apps, status fan-out, counters),+`WearLinkClientNode` (drop-in `WearLinkNode` replacement over the+conduit binding; reports `NotInstalled`/`Unavailable` when the Watch+app is absent), and `ConduitHost`/`ConduitRuntime` used by the two+Watch apps' `ConduitService`s. Merged phone/watch pairs ship as+single APKs whose phone and watch experiences pick their side at+runtime. This module declares no Bluetooth permissions; only the+Watch apps (:watch, :watch:wear) do.++Push sync runs on three triggers, all converging on each app's+existing conduit publish path (snapshots are conduit data items;+per-app wire formats are unchanged): (1) the phone Watch app's+scheduled intent — `ConduitSync` is the contract (action+`com.vayunmathur.watch.action.SYNC_TRIGGER`, `appId` extra, no data;+receivers are exported only under the `CONDUIT` signature permission+and the sender package-addresses the intent; `ConduitSyncDispatcher`+fans it out to the registered appId->package registry, tolerating+absent apps); (2) a phone app's own data changing (immediate publish+by that app); (3) a watch app's own data changing (immediate publish+over its conduit client, watch->phone). `ConduitDataStore` is the+persistent latest-wins, size-capped mirror of the router data cache+(one store per conduit host, keyed by appId+path, restored at host+start), so data pushed while the receiving app is not running is+replayed to it on its next registration, in either direction.  ## Verify ```
library/wearlink/src/main/java/com/vayunmathur/library/wearlink/conduit/ConduitDataStore.kt
diff --git a/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/conduit/ConduitDataStore.kt b/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/conduit/ConduitDataStore.ktnew file mode 100644index 0000000000..d9b013a3f9--- /dev/null+++ b/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/conduit/ConduitDataStore.kt@@ -0,0 +1,111 @@+package com.vayunmathur.library.wearlink.conduit++import java.io.File++/**+ * Persistent latest-wins store behind each conduit host, keyed by+ * (appId, path): the last data item written for a key replaces the+ * previous one, and the whole store is size-capped ([maxItems] entries+ * and [maxTotalBytes] across all bodies, oldest evicted first).+ *+ * Both Watch apps host one over the same [ConduitRouter] data cache,+ * so a snapshot that arrives while the receiving app is not running is+ * still on disk — and replayed from the router cache — when that app+ * next registers, in either direction (phone->watch snapshots and+ * watch->phone state alike). One file per key under [dir]; writes go+ * through a tmp file + rename so a killed write never corrupts a key.+ */+class ConduitDataStore(+    private val dir: File,+    private val maxItems: Int = DEFAULT_MAX_ITEMS,+    private val maxTotalBytes: Long = DEFAULT_MAX_TOTAL_BYTES,+) {+    companion object {+        const val DEFAULT_MAX_ITEMS = 256+        const val DEFAULT_MAX_TOTAL_BYTES: Long = 16L * 1024 * 1024+    }++    /** Store [body] as the latest item for (appId, path), evicting oldest past the caps. */+    @Synchronized+    fun put(+        appId: String,+        path: String,+        body: ByteArray,+    ) {+        if (appId.isEmpty() || body.size > maxTotalBytes) return+        dir.mkdirs()+        val target = fileFor(appId, path)+        val tmp = File(dir, target.name + ".tmp")+        tmp.writeBytes(body)+        tmp.renameTo(target)+        target.setLastModified(System.currentTimeMillis())+        evict()+    }++    /** Every stored item, for restoring the router cache at host start. */+    @Synchronized+    fun load(): Map<Pair<String, String>, ByteArray> {+        if (!dir.isDirectory) return emptyMap()+        val result = linkedMapOf<Pair<String, String>, ByteArray>()+        for (file in itemFiles()) {+            val key = keyOf(file) ?: continue+            runCatching { result[key] = file.readBytes() }+        }+        return result+    }++    private fun evict() {+        val files = itemFiles().sortedBy { it.lastModified() }+        var totalBytes = files.sumOf { it.length() }+        var count = files.size+        for (file in files) {+            if (count <= maxItems && totalBytes <= maxTotalBytes) break+            totalBytes -= file.length()+            count--+            file.delete()+        }+    }++    private fun itemFiles(): List<File> =+        dir.listFiles()?.filter { it.isFile && it.name.endsWith(".bin") } ?: emptyList()++    private fun fileFor(+        appId: String,+        path: String,+    ): File = File(dir, encode(appId) + "__" + encode(path) + ".bin")++    private fun keyOf(file: File): Pair<String, String>? {+        val parts = file.name.removeSuffix(".bin").split("__", limit = 2)+        if (parts.size != 2) return null+        return decode(parts[0]) to decode(parts[1])+    }++    /** Filesystem-safe one-way-safe encoding: anything outside [a-zA-Z0-9._-] is %-escaped. */+    private fun encode(value: String): String =+        buildString {+            for (ch in value) {+                if (ch.isLetterOrDigit() || ch == '.' || ch == '_' || ch == '-') {+                    append(ch)+                } else {+                    append('%').append(ch.code.toString(16).padStart(2, '0'))+                }+            }+        }++    private fun decode(value: String): String =+        buildString {+            var i = 0+            while (i < value.length) {+                if (value[i] == '%' && i + 2 <= value.lastIndex) {+                    val hex = value.substring(i + 1, i + 3).toIntOrNull(16)+                    if (hex != null) {+                        append(hex.toChar())+                        i += 3+                        continue+                    }+                }+                append(value[i])+                i+++            }+        }+}
library/wearlink/src/main/java/com/vayunmathur/library/wearlink/conduit/ConduitHost.kt
diff --git a/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/conduit/ConduitHost.kt b/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/conduit/ConduitHost.ktindex fc4e87865d..1f625580ef 100644--- a/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/conduit/ConduitHost.kt+++ b/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/conduit/ConduitHost.kt@@ -88,6 +88,14 @@ class ConduitHost(      val router: ConduitRouter = ConduitRouter(upstream = upstream) +    /**+     * Persistent latest-wins mirror of the router's data cache, so a+     * snapshot that arrives while the receiving app is not running+     * survives this process and is replayed on its next registration —+     * on both hosts, in both directions.+     */+    private val dataStore = ConduitDataStore(File(context.filesDir, "conduit-data"))+     private val peerListener: WearLinkListener =         object : WearLinkListener {             override fun onMessage(@@ -102,6 +110,7 @@ class ConduitHost(                 body: ByteArray,             ) {                 router.onPeerData(path, body)+                dataStore.put(ConduitProtocol.routeKey(path), path, body)             }              override fun onStreamOpen(@@ -207,6 +216,7 @@ class ConduitHost(     val messenger = Messenger(handler)      fun start() {+        router.restoreCachedData(dataStore.load())         node.start()         scope.launch {             node.state.collectLatest { state ->@@ -276,7 +286,7 @@ class ConduitHost(         }         if (!ConduitProtocol.owns(appId, "/$appId/")) return         registrations[replyTo] = appId-        router.register(appId, ClientDownstream(appId, replyTo))+        router.register(appId, ClientDownstream(appId, replyTo), caller)         publishSnapshot()     } @@ -304,11 +314,10 @@ class ConduitHost(         data: Bundle,     ) {         val appId = registeredApp(replyTo, data) ?: return-        router.onLocalData(-            appId,-            data.getString(ConduitProtocol.KEY_PATH) ?: return,-            data.getByteArray(ConduitProtocol.KEY_BODY) ?: ByteArray(0),-        )+        val path = data.getString(ConduitProtocol.KEY_PATH) ?: return+        val body = data.getByteArray(ConduitProtocol.KEY_BODY) ?: ByteArray(0)+        router.onLocalData(appId, path, body)+        dataStore.put(appId, path, body)         publishSnapshot()     } @@ -375,6 +384,7 @@ class ConduitHost(                 peerLabel = peer ?: currentPeer,                 reason = reason ?: currentReason,                 registeredApps = router.registeredApps(),+                registeredPackages = router.registeredPackages(),                 counters = router.countersSnapshot(),                 cachedDataItems = router.cachedDataCount(),             ),
library/wearlink/src/main/java/com/vayunmathur/library/wearlink/conduit/ConduitRouter.kt
diff --git a/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/conduit/ConduitRouter.kt b/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/conduit/ConduitRouter.ktindex 9d2c436136..d7373f33c9 100644--- a/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/conduit/ConduitRouter.kt+++ b/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/conduit/ConduitRouter.kt@@ -97,6 +97,7 @@ class ConduitRouter(     )      private val clients = mutableMapOf<String, ConduitDownstream>()+    private val packages = mutableMapOf<String, String>()     private val dataCache = mutableMapOf<Pair<String, String>, ByteArray>()     private val queues = mutableMapOf<String, ArrayDeque<QueuedMessage>>()     private val inboundStreams = mutableMapOf<Long, String>()@@ -113,6 +114,20 @@ class ConduitRouter(     @Synchronized     fun countersSnapshot(): Map<String, ConduitCounters> = counters.toMap() +    /** appId -> package for every app that has ever registered with a package. */+    @Synchronized+    fun registeredPackages(): Map<String, String> = packages.toMap()++    /** Copy of the latest data item per (appId, path), for persistence. */+    @Synchronized+    fun cachedDataSnapshot(): Map<Pair<String, String>, ByteArray> = dataCache.toMap()++    /** Seed the cache from a persistent store at host start (latest-wins per key). */+    @Synchronized+    fun restoreCachedData(items: Map<Pair<String, String>, ByteArray>) {+        dataCache.putAll(items)+    }+     @Synchronized     fun cachedDataCount(): Int = dataCache.size @@ -121,9 +136,11 @@ class ConduitRouter(     fun register(         appId: String,         downstream: ConduitDownstream,+        callerPackage: String? = null,     ) {         if (appId.isEmpty()) return         clients[appId] = downstream+        if (!callerPackage.isNullOrEmpty()) packages[appId] = callerPackage         counters.putIfAbsent(appId, ConduitCounters())         for ((key, body) in dataCache) {             if (key.first == appId) downstream.deliverData(key.second, body)
library/wearlink/src/main/java/com/vayunmathur/library/wearlink/conduit/ConduitRuntime.kt
diff --git a/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/conduit/ConduitRuntime.kt b/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/conduit/ConduitRuntime.ktindex b67b08b98b..02176cd133 100644--- a/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/conduit/ConduitRuntime.kt+++ b/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/conduit/ConduitRuntime.kt@@ -10,6 +10,7 @@ data class ConduitSnapshot(     val peerLabel: String? = null,     val reason: String? = null,     val registeredApps: Set<String> = emptySet(),+    val registeredPackages: Map<String, String> = emptyMap(),     val counters: Map<String, ConduitCounters> = emptyMap(),     val cachedDataItems: Int = 0, )
library/wearlink/src/main/java/com/vayunmathur/library/wearlink/conduit/ConduitSync.kt
diff --git a/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/conduit/ConduitSync.kt b/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/conduit/ConduitSync.ktnew file mode 100644index 0000000000..164951bea1--- /dev/null+++ b/library/wearlink/src/main/java/com/vayunmathur/library/wearlink/conduit/ConduitSync.kt@@ -0,0 +1,78 @@+package com.vayunmathur.library.wearlink.conduit++/**+ * Contract for the Watch-app-scheduled push sync (owner decision+ * 2026-12-04): "the watch app on the phone regularly calls an intent on+ * the phone app to do a push sync with the corresponding app on the+ * watch."+ *+ * The phone Watch app (`com.vayunmathur.watch`, the sender) fires+ * [ACTION] at every sync-capable phone app, meaning "push your current+ * snapshot to your watch counterpart now" through the app's existing+ * conduit client. The intent carries no data: only [EXTRA_APP_ID],+ * which sync (the conduit appId) is being asked. The snapshot itself+ * travels over the conduit exactly as a change-triggered push does.+ *+ * This is one of three triggers for the same push, all converging on+ * the app's existing conduit publish path:+ * 1. this scheduled intent (link connect, periodic, on-register),+ * 2. the phone app's own data changing (immediate publish, e.g.+ *    Contacts publishes on every book change),+ * 3. the watch app's own data changing (immediate publish over its+ *    conduit client in the watch->phone direction, e.g. Contacts'+ *    watch-state / handoff traffic).+ *+ * Protection follows the conduit's existing surface: the receiver is+ * `exported` only under the signature permission [PERMISSION] (declared+ * by both Watch apps, auto-granted to same-signed apps), and the sender+ * addresses the intent to the registered package explicitly+ * (`setPackage`), so no other app can trigger or receive it.+ */+object ConduitSync {+    /** Action the phone Watch app sends to a phone app: push your snapshot now. */+    const val ACTION = "com.vayunmathur.watch.action.SYNC_TRIGGER"++    /** Extra carrying the conduit appId being asked to push. No data rides the intent. */+    const val EXTRA_APP_ID = ConduitProtocol.KEY_APP_ID++    /** Signature permission guarding every sync-trigger receiver. */+    const val PERMISSION = ConduitProtocol.PERMISSION++    /** Package of the sending Watch app. */+    const val SENDER_PACKAGE = ConduitProtocol.WATCH_PACKAGE++    /** Fallback package for an appId whose registration carried none. */+    fun defaultPackage(appId: String): String = "com.vayunmathur.$appId"++    /** True when [action]/[appId] ask [expectedAppId] to push. Pure: unit-tested. */+    fun isTrigger(+        action: String?,+        appId: String?,+        expectedAppId: String,+    ): Boolean = action == ACTION && !appId.isNullOrEmpty() && appId == expectedAppId++    /** Apps in [current] that were not in [previous] (the on-register trigger set). */+    fun newlyRegistered(+        previous: Set<String>,+        current: Set<String>,+    ): Set<String> = current - previous+}++/**+ * Fans a sync trigger out to a registry of appId -> package. The+ * [send] lambda performs the platform intent send for one app and+ * returns whether it was delivered; an app that is absent (or whose+ * send throws) is tolerated and simply not reported as delivered, so+ * one missing app never blocks the rest. Pure: unit-tested with a+ * fake sender.+ */+class ConduitSyncDispatcher(+    private val send: (appId: String, packageName: String) -> Boolean,+) {+    /** Trigger every registered app; returns the appIds delivered to. */+    fun dispatchAll(registry: Map<String, String>): List<String> =+        registry.entries.mapNotNull { (appId, pkg) -> if (dispatch(appId, pkg)) appId else null }++    /** Trigger one app; false when absent or the send failed. */+    fun dispatch(appId: String, packageName: String): Boolean = runCatching { send(appId, packageName) }.getOrDefault(false)+}
library/wearlink/src/test/java/com/vayunmathur/library/wearlink/conduit/ConduitDataStoreTest.kt
diff --git a/library/wearlink/src/test/java/com/vayunmathur/library/wearlink/conduit/ConduitDataStoreTest.kt b/library/wearlink/src/test/java/com/vayunmathur/library/wearlink/conduit/ConduitDataStoreTest.ktnew file mode 100644index 0000000000..b16fd8e387--- /dev/null+++ b/library/wearlink/src/test/java/com/vayunmathur/library/wearlink/conduit/ConduitDataStoreTest.kt@@ -0,0 +1,53 @@+package com.vayunmathur.library.wearlink.conduit++import java.io.File+import java.nio.file.Files+import kotlin.test.Test+import kotlin.test.assertEquals+import kotlin.test.assertTrue++class ConduitDataStoreTest {+    private fun store(+        dir: File,+        maxItems: Int = 8,+        maxTotalBytes: Long = 1_000_000,+    ) = ConduitDataStore(dir, maxItems, maxTotalBytes)++    @Test+    fun `latest write wins per appId and path and survives reload`() {+        val dir = Files.createTempDirectory("conduit-store").toFile()+        store(dir).put("contacts", "/contacts/snapshot/manifest", "v1".encodeToByteArray())+        store(dir).put("contacts", "/contacts/snapshot/manifest", "v2".encodeToByteArray())+        store(dir).put("notes", "/notes/snapshot", "n".encodeToByteArray())+        val loaded = ConduitDataStore(dir).load()+        assertEquals(2, loaded.size)+        assertEquals(+            "v2",+            loaded["contacts" to "/contacts/snapshot/manifest"]?.decodeToString(),+        )+        assertEquals("n", loaded["notes" to "/notes/snapshot"]?.decodeToString())+    }++    @Test+    fun `item cap evicts oldest items first`() {+        val dir = Files.createTempDirectory("conduit-store").toFile()+        val capped = store(dir, maxItems = 2)+        capped.put("a", "/a/1", byteArrayOf(1))+        Thread.sleep(5)+        capped.put("b", "/b/1", byteArrayOf(2))+        Thread.sleep(5)+        capped.put("c", "/c/1", byteArrayOf(3))+        val loaded = ConduitDataStore(dir, maxItems = 2).load()+        assertEquals(setOf("b", "c"), loaded.keys.map { it.first }.toSet())+    }++    @Test+    fun `byte cap evicts oldest items first`() {+        val dir = Files.createTempDirectory("conduit-store").toFile()+        val capped = store(dir, maxTotalBytes = 5)+        capped.put("a", "/a/1", ByteArray(3))+        Thread.sleep(5)+        capped.put("b", "/b/1", ByteArray(3))+        assertTrue(ConduitDataStore(dir).load().size <= 1)+    }+}
library/wearlink/src/test/java/com/vayunmathur/library/wearlink/conduit/ConduitRouterTest.kt
diff --git a/library/wearlink/src/test/java/com/vayunmathur/library/wearlink/conduit/ConduitRouterTest.kt b/library/wearlink/src/test/java/com/vayunmathur/library/wearlink/conduit/ConduitRouterTest.ktindex 7dba23c68c..c83220d37d 100644--- a/library/wearlink/src/test/java/com/vayunmathur/library/wearlink/conduit/ConduitRouterTest.kt+++ b/library/wearlink/src/test/java/com/vayunmathur/library/wearlink/conduit/ConduitRouterTest.kt@@ -168,6 +168,17 @@ class ConduitRouterTest {         assertEquals(setOf("notes"), router.registeredApps())     } +    @Test+    fun `registration records the caller package and restored data replays`() {+        val router = ConduitRouter(upstream = FakeUpstream())+        router.restoreCachedData(mapOf(("clock" to "/clock/snapshot") to bytes("persisted")))+        val fake = FakeDownstream()+        router.register("clock", fake, "com.vayunmathur.clock")+        assertEquals(mapOf("clock" to "com.vayunmathur.clock"), router.registeredPackages())+        assertEquals("persisted", fake.data.single().second.decodeToString())+        assertEquals(1, router.cachedDataSnapshot().size)+    }+     @Test     fun `stream open is refused for unregistered app and routed when registered`() {         val router = ConduitRouter(upstream = FakeUpstream())
library/wearlink/src/test/java/com/vayunmathur/library/wearlink/conduit/ConduitSyncTest.kt
diff --git a/library/wearlink/src/test/java/com/vayunmathur/library/wearlink/conduit/ConduitSyncTest.kt b/library/wearlink/src/test/java/com/vayunmathur/library/wearlink/conduit/ConduitSyncTest.ktnew file mode 100644index 0000000000..d34f017834--- /dev/null+++ b/library/wearlink/src/test/java/com/vayunmathur/library/wearlink/conduit/ConduitSyncTest.kt@@ -0,0 +1,51 @@+package com.vayunmathur.library.wearlink.conduit++import kotlin.test.Test+import kotlin.test.assertEquals+import kotlin.test.assertFalse+import kotlin.test.assertTrue++class ConduitSyncTest {+    @Test+    fun `trigger matches only the contract action and the app's own appId`() {+        assertTrue(ConduitSync.isTrigger(ConduitSync.ACTION, "contacts", "contacts"))+        assertFalse(ConduitSync.isTrigger(ConduitSync.ACTION, "notes", "contacts"))+        assertFalse(ConduitSync.isTrigger(ConduitSync.ACTION, "", "contacts"))+        assertFalse(ConduitSync.isTrigger("com.example.OTHER", "contacts", "contacts"))+        assertFalse(ConduitSync.isTrigger(null, "contacts", "contacts"))+    }++    @Test+    fun `default package is derived from the appId`() {+        assertEquals("com.vayunmathur.contacts", ConduitSync.defaultPackage("contacts"))+    }++    @Test+    fun `dispatch goes only to registered apps and tolerates absent ones`() {+        val sent = mutableListOf<Pair<String, String>>()+        val dispatcher =+            ConduitSyncDispatcher { appId, pkg ->+                if (pkg == "com.vayunmathur.gone") throw RuntimeException("absent")+                if (pkg == "com.vayunmathur.uninstalled") return@ConduitSyncDispatcher false+                sent.add(appId to pkg)+                true+            }+        val delivered =+            dispatcher.dispatchAll(+                mapOf(+                    "contacts" to "com.vayunmathur.contacts",+                    "gone" to "com.vayunmathur.gone",+                    "uninstalled" to "com.vayunmathur.uninstalled",+                ),+            )+        assertEquals(listOf("contacts" to "com.vayunmathur.contacts"), sent)+        assertEquals(listOf("contacts"), delivered)+    }++    @Test+    fun `newly registered computes the diff against the previous set`() {+        assertEquals(setOf("notes"), ConduitSync.newlyRegistered(setOf("contacts"), setOf("contacts", "notes")))+        assertEquals(emptySet(), ConduitSync.newlyRegistered(setOf("contacts"), setOf("contacts")))+        assertEquals(setOf("contacts"), ConduitSync.newlyRegistered(emptySet(), setOf("contacts")))+    }+}
watch-wear/AGENTS.md
diff --git a/watch-wear/AGENTS.md b/watch-wear/AGENTS.mdindex 202c5f7654..a56a3880ef 100644--- a/watch-wear/AGENTS.md+++ b/watch-wear/AGENTS.md@@ -28,6 +28,11 @@ Every other watch app reaches the phone through `WearLinkClientNode`.   path segment. - The status screen renders `ConduitRuntime.state` (link state,   registered apps, per-app counters).+- Inbound data items are mirrored to the host's persistent+  latest-wins `ConduitDataStore` (in `:library:wearlink`), so a+  snapshot pushed while a watch app is not running replays to it on+  its next registration; watch-originated pushes to the phone land+  the same way in the phone host's store.  ## Verify (this module only) ```