Skip to content

Offline Tooling and Documentation

Puzzak edited this page Nov 20, 2026 · 1 revision

Offline Tooling & Built-in Documentation

PAIOS ships a complete 23-page Google ML Kit GenAI & Android AICore Documentation Hub plus embedded PAIOS self-knowledge—available 100% offline inside the app and queryable by Gemini Nano via RAG.


23-Page Docs Explorer (DocExplorerPage)

Defined in assets/docs/docs_manifest.json, the in-app Docs Explorer bundles 22 official Google ML Kit GenAI pure-Markdown guides alongside PAIOS's Hardware & Device Eligibility / Error Matrix (devices.md.txt / genai.md.txt):

  • Direct Model Access (Prompt API): Overview, Get Started, Prompt Design, Evaluate Prompt Quality, System Instructions, Prefix Caching, Structured JSON Output, Thinking Mode, Function Calling, Model Selection & TPU Acceleration.
  • Agentic Workflows: Overview, Defining & Registering Tools, Managing Sessions & Lifecycle, Streaming Events & UI Synchronization.
  • Task & Modality APIs: Speech Recognition, Real-Time Speech Translation, Neural Text-to-Speech, Multimodal Image Description & OCR, Summarization, Proofreading, Rewriting, On-Device Vector Embeddings.
  • Hardware & Errors: Supported Hardware & Device Eligibility Matrix and verified GenAiException.ErrorCode taxonomy.

3-Tier SWR Documentation Sync (DocService)

Every guide uses a Stale-While-Revalidate (SWR) pipeline without scraping HTML:

  1. Tier 1 — Bundled Offline Assets: All 23 .md.txt files live in assets/docs/ for instant 0ms offline access.
  2. Tier 2 — Local Disk Cache: Synced updates are written atomically to ${appDocumentsDir}/docs_cache/${id}.md.txt.
  3. Tier 3 — Direct Google .md.txt Endpoints: Manual refresh (refreshDoc(id) in DocExplorerPage) fetches Google Developers' native pure-Markdown .md.txt URLs (e.g. https://developers.google.com/ml-kit/genai/prompt/android.md.txt).
    • Captive-Portal Protection (_isHtml): Before overwriting Tier 2 cache, _isHtml verifies the response is not an HTML login/error page, safely preserving offline Markdown.
    • Explicit UTF-8 Decoding: All remote doc fetches decode response.bodyBytes as UTF-8.
    • Performance (v1.8.9): Background per-turn syncRemoteDocs() HTTP calls were eliminated from the chat generation path so inference never incurs unnecessary network overhead.

On-Device RAG & PAIOS Self-Knowledge (query_aicore_documentation)

Rather than stuffing feature lists into every prompt's system instruction, PAIOS keeps system_default.md at 2 sentences and moves identity/capability facts into offline RAG (paios.docs, enabled by default):

  • Canonical Tool & Aliases: query_aicore_documentation plus normalized aliases about_paios, paios_info, and get_paios_info (InternalToolsHelper.DOCS_TOOL_ALIASES).
  • Query Normalization: Prompts like "who are you", "tell me about yourself", "what are you", or "introduce yourself" normalize automatically to "PAIOS overview features".
  • Self-Knowledge Sections (genai.md.txt / devices.md.txt):
    • PAIOS Overview, Identity & Privacy
    • PAIOS Model Variants, Thinking Mode & Multimodality
    • PAIOS System Assistant Overlay & On-Demand Screen Inspection
    • PAIOS Extensions & M3x Mesh Ecosystem
  • Term-Frequency Ranking (rankDocumentationSections): Scores matching documentation sections offline across both Dart (DocService) and Kotlin (InternalToolsHelper), boosting PAIOS identity sections on overview queries and returning concise excerpts ready for synthesis.

Related Pages: M3x Mesh Ecosystem & Extensions · Localization & Prompts · Supported Devices & AICore Error Taxonomy

Clone this wiki locally