Transitioning the Bossidian vault away from the Obsidian desktop application into a fully decoupled, headless knowledge system. An automated Cloudflare Workers AI edge service manages knowledge ingestion, voice memo transcription, automated GitHub commits, and semantic retrieval, while Quartz v4 on Cloudflare Pages serves as a high-performance, private reading interface.
1. Executive Summary & Design Philosophy
The primary objective is to replace the heavyweight, proprietary-feeling Obsidian workflow with open standards:
Storage & Version Control: Authoritative source of truth remains the Git repository (Bossidian-okf) adhering strictly to the Open Knowledge Format (OKF v0.2).
Edge Intelligence (Cloudflare Workers AI): Serverless global edge functions listen for incoming text, audio, and search queries, formatting content according to OKF rules and pushing commits via the GitHub API.
Capture Interface (Telegram Bot): Frictionless mobile and desktop interface capable of receiving raw thoughts, voice memos, and conversational questions without opening an editor.
Reading Layer (Quartz on Cloudflare Pages): Hyper-fast, static, zero-plugin Progressive Web Application (PWA) behind Cloudflare Zero Trust authentication.
The deployment follows a reverse build sequence: Core Intelligence & GitHub Sync first, Conversational Bot second, and Static Reading UX third.
Phase 1: Cloudflare Workers AI & GitHub Integration Engine
Objective: Deploy a secure edge worker that communicates bidirectionally with the GitHub repository, executes local model inference, and maintains a local cache of the vault.
1.1 Initialise Cloudflare Worker Project
Scaffold a TypeScript project using Wrangler on the Cloudflare Free tier: npm create cloudflare@latest okf-edge-agent.
Configure wrangler.jsonc with bindings for:
Workers AI (env.AI) bound to multilingual @cf/baai/bge-m3 for semantic search.
Cloudflare KV (VAULT_KV) for fast local note caching.
Cloudflare Vectorize (VAULT_VECTOR_INDEX).
Configure secret variables via npx wrangler secret put:
GITHUB_TOKEN: Fine-grained personal access token with contents:write and metadata:read.
GITHUB_REPO: dainiusluzan/Bossidian-okf.
GEMINI_API_KEY: Google AI Studio key for direct multimodal audio processing.
(Skips build if commit is confined to 00-inbox/captures/, preserving the 500 builds/month free quota).
3.3 Secure Access with Cloudflare Zero Trust
Navigate to Cloudflare Zero Trust → Access → Applications.
Add self-hosted application on custom domain (e.g. notes.yourdomain.com).
Define Access Policy:
Rule: Allow if email is your-email@example.com.
Authenticate via one-time PIN (OTP) or Google/GitHub OAuth.
3.4 Configure Mobile Progressive Web App (PWA)
Open authenticated URL in mobile Safari/Chrome.
Select “Add to Home Screen”.
Confirm full-screen standalone application behaviour and instant search performance.
4. Architectural Alternatives Evaluated
Option
Architecture
Advantages
Disadvantages & Reason for Rejection
Local Sovereign Daemon (Evaluated)
Local Mac runs FastAPI + LiteLLM + Ollama + Tailscale.
Strict local air-gap privacy; direct access to filesystem and CLI tools (git, ripgrep).
Machine sleep dependency: If laptop is closed, mobile capture fails. High battery consumption. Squeezed 7B–14B models struggle with strict OKF schema compliance.
GitHub Actions Serverless (Evaluated)
Mobile commits raw file to 00-inbox/; GitHub Actions triggers LLM workflow.
Zero infrastructure to host; 100% cloud uptime.
High latency: 20–45s boot time per Action run; unsuitable for real-time conversational chat or voice notes.
Signal Bot Capture (Evaluated)
Signal messenger connected to local signal-cli.
High end-to-end encryption reputation.
Excessive maintenance: Signal lacks official serverless webhooks; requires a persistent running container linked to a physical SIM card. Rejected in favour of Telegram’s native webhook API.
100% uptime, zero server maintenance, access to 70B parameter models, built-in Whisper, instant PWA reading.
Data processed in Cloudflare data centres (acceptable trade-off for reliability and zero DevOps).
5. Critical Obstacles & Mitigation Strategies
1. Git Race Conditions & Merge Conflicts
Risk: If a user makes direct edits via mobile GitHub web while the Cloudflare Worker attempts to commit simultaneously, the push will be rejected with an HTTP 409 Conflict.
Mitigation:
Single Writer Domain: All automated edge captures target exclusively 00-inbox/daily-notes/ or generate uniquely timestamped inbox files (00-inbox/captures/YYYYMMDD-HHMMSS.md).
Retry with Fresh Ref: The GitHub client must fetch the current latest main commit SHA immediately before pushing a commit tree, retrying up to 3 times on conflict.
2. OKF Schema Integrity & LLM Hallucinations
Risk: LLMs may hallucinate nonexistent relative file paths or drop required frontmatter fields (status, generated).
Mitigation:
Deterministic Code Guardrails: Never write raw LLM output directly to disk. The Worker parses the LLM output into typed JSON, then passes the object through a deterministic TypeScript formatter that constructs YAML frontmatter and standard relative links according to AGENTS.md.
3. Edge Execution Time Limits
Risk: Free Cloudflare Workers have a 50ms CPU execution limit and a 30s connection timeout. Processing multi-step agent chains or large audio files could timeout.
Mitigation:
Leverage streaming responses for AI inference.
Acknowledge Telegram webhook requests immediately (HTTP 200 OK) and process heavy operations using waitUntil(async () => { ... }) or Cloudflare Queues.
6. Project Checklist & Verification Criteria
Cloudflare Worker handles GET /health with 200 OK.
Worker successfully pushes an automated test commit to 00-inbox/captures/ via GitHub API.
GitHub webhook pushes update Cloudflare KV within 2 seconds of a commit.
Telegram bot responds to /start and rejects unauthorized users.
Voice memo in Telegram produces transcribed text note in GitHub within 5 seconds.
Conversational query in Telegram returns accurate answer cited from existing vault notes.
Cloudflare Pages deploys Quartz v4 without build errors.
Cloudflare Zero Trust blocks unauthenticated public access.
Mobile PWA installed and functional on smartphone.
Ingestion Verification & Live Telemetry Logs
Telegram Text Ingestion (Verified 2026-10-14 & 2026-10-15): Verified via raw test captures 20261014091349-testas-2.md and 20261015073011-testas-1.md successfully committed to 00-inbox/captures/ via GitHub REST API with OCC retry pattern.
Telegram Voice Transcription (Verified 2026-10-15): Verified via voice memo 20261015082338-naujas-darbu-irasas.md transcribed via Gemini Flash multimodal inference and committed to 00-inbox/captures/.
Related Notes & References
AGENTS.md - Vault operational rules and OKF compliance standards.