mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-06-03 11:36:50 -04:00
5.9 KiB
5.9 KiB
Agent Session Context - Meshtastic Android
Dated handover log. Add new entries at the TOP. Format: ## YYYY-MM-DD —
Capped at the ~5 most recent entries — skim the top entry for current state; you do
not need to read the whole file. When adding an entry pushes the count past ~5, move
the oldest entries to session_context.archive.md (not read by default). The
"Golden Context" block at the bottom is stable across sessions; keep it here.
2026-05-28 — Stabilized DatabaseManager withDb retry host test
- Hardened
DatabaseManagerWithDbRetryTestto remove CI race conditions by running the manager on aStandardTestDispatcher(testScheduler)instead of realDispatchers.IO. - Added a
withTimeout(10_000)guard around the test body to fail fast on coordination stalls instead of hanging/flapping. - Kept the deterministic retry trigger (
error("Connection pool is closed")) and retained assertions that first attempt uses old DB and retry uses current DB. - Made teardown resilient with
if (::manager.isInitialized) manager.close()so setup/early failures do not cascade into teardown crashes. - Verified with
:core:database:jvmTest --tests "org.meshtastic.core.database.DatabaseManagerWithDbRetryTest*"and repeated it 5 consecutive runs without failures;:core:database:detektalso passed.
2026-05-21 — Upgraded Chirpy to a fully-personalized Live Diagnostic Node & Mesh Assistant
- Integrated
NodeRepositoryintoGeminiNanoDocAssistant.ktand the Google AI Koin dependency injection module (GoogleAiModule.kt). - Developed a dynamic live-state prompt formatting block within
buildPrompt(...)that queries current hardware model, firmware version, connection status, GPS capability, channel utilization, airtime, battery level/voltage, user profile long/short names, and total registered mesh peer counts & active online peers directly fromNodeRepository's reactive flows. - Injected this live radio diagnostics context dynamically as a system instruction metadata block on every user query. This empowers the on-device model to answer real-time, personalized diagnostic questions (e.g. "what is my battery level?", "how many active nodes are on my mesh right now?") with 100% on-device offline accuracy.
- Tuned context retrieval constraints for the modern
nano-v4-full(Gemini Nano v4) model: expanded the total context budgetMAX_CONTEXT_CHARSfrom 8,000 to 32,000 characters (up to ~12K tokens out of the model's native 32K window), and scaledMAX_PAGE_CHARSto 16,000 characters andMAX_SNIPPET_CHARSto 8,000 characters to supply vastly richer, more detailed, and complete documentation fragments.
2026-05-21 — Activated full on-device token streaming and polished Chirpy's personality instructions
- Upgraded the on-device inference flow inside
GeminiNanoDocAssistant.ktto use Firebase AI SDK's reactivegenerateContentStream(prompt)instead of the blockinggenerateContentinvocation. - Aggregated chunks and emitted incremental
AIDocAssistantResult.Partialstates down the Kotlin Flow, enabling true word-by-word/chunk-by-chunk streaming in the UI for a much more responsive user experience. - Refined the
SYSTEM_INSTRUCTIONpersonality rules for Chirpy to position him as our adorable LoRa radio Node mascot instead of an avian theme, emphasizing high-enthusiasm mesh networking, signal connectivity, battery status, and radio/routing concepts while preserving technical precision. - Overhauled system error messages inside
DocsNavigation.ktand the loading bubble state insideChirpyAssistantSheet.ktto align with the mascot theme.
2026-05-21 — Implemented streaming chat support and Firebase Remote Config integration for Chirpy
- Added
firebase-configdependency to Version Cataloglibs.versions.tomlandandroidApp/build.gradle.kts. - Added the
AIDocAssistantResult.Partialvariant to support intermediate stream updates. - Extended the
AIDocAssistantinterface and implementedanswerStreamin bothKeywordFallbackAssistantandGeminiNanoDocAssistant. - Integrated Firebase Remote Config into
GeminiNanoDocAssistantto dynamically fetch the model name (chirpy_model_name) and system instruction (chirpy_system_instruction) with release-optimized fetch intervals. - Refactored
GeminiNanoDocAssistant.answerto reuseanswerStreamflow under the hood, eliminating duplicate prompting code. - Verified that all unit tests (
:feature:docs:allTests) and static analysis checks (spotlessApply spotlessCheck detekt) pass 100% green.
2026-05-21 — Fixed Chirpy Assistant invalid model name and enhanced failure fallback suggestions
- Fixed a 404/Unknown inference error by updating
GeminiNanoDocAssistant.kt'sMODEL_NAMEfrom"gemini-3.1-flash-lite"to the correct Firebase AI Logic preview name"gemini-3.1-flash-lite-preview". - Overhauled multi-turn hybrid chat seeding: eliminated the redundant background
chat.sendMessagecall on the first turn; if the first turn is answered on-device, the session caches the Q&A locally and seeds the subsequent cloud-chat session viastartChat(history = ...). - Expanded the hybrid model's
looksLikeNoAnswerheuristics to better detect on-device failure and fall back to the grounded cloud model. - Programmed a smart UI fallback: on inference error (offline, rate limit, model not found), Chirpy displays local keyword search results as recommended page chips.
- Verified 100% compliance with Spotless, Detekt, and unit tests (
:feature:docs:allTestsand:androidApp:testGoogleDebugUnitTest).
Golden Context (stable across sessions)
- Always check
.skills/compose-ui/strings-index.txtbefore readingstrings.xml. - Run
python3 scripts/sort-strings.pyafter adding strings to keep the index organized. - Always check
gh run listbefore pushing. - Pre-commit hook
scripts/ai-guardrail.shprotects against binary leaks (see script for install).