Hi everyone! I am preparing a proposal for the "Chat with your note collection using AI" project and would love to get some early feedback from the mentors and community on my architectural approach.
AI Assistance Disclosure
This proposal's core architecture, implementation logic, and timeline were developed manually through researching the Joplin codebase, the plugin API, and forum discussions. AI tools were utilized strictly to improve the clarity, grammar, and structural formatting of the text. I have carefully reviewed all text, verified its correctness, and confirm I fully understand the proposed architecture and implementation.
Links
- Project Idea: Chat with your note collection using AI
- GitHub Profile: JalinaH
- Forum Introduction: Introducing Jalina Hirushan
- Pull Requests:
- PR #14667 (Merged)
- PR #14481 (Closed)
- PR #14473 (Closed)
- PR #14460 (Closed)
- PR #14459 (Closed)
- PR #14425 (Closed)
1. Introduction
- Background / studies: I am a third-year IT undergraduate at the University of Moratuwa, Sri Lanka. I previously engineered a production-like RAG chatbot utilizing Next.js, TypeScript, and Supabase's vector database (
pgvector) to vectorize and query notes. This system gave me a profound understanding of vector mathematics, context window management, and chunk overlap strategies. The core engineering challenge I am tackling for this GSoC project is an architectural transposition—moving these established cloud-native RAG mechanics into Joplin's localized, offline Electron sandbox. - Programming experience: I possess strong proficiency across the MERN stack and deep expertise in React/Next.js, TypeScript/JavaScript, and Node.js. My specialized experience includes developing full-stack AI applications involving Retrieval-Augmented Generation (RAG), working with Vector Databases, utilizing WebAssembly (WASM) to bypass Joplin's strict restrictions against bundling native Node.js (C++) modules , and managing asynchronous, CPU-bound tasks in Web Workers.
- Experience with open source: I am an active contributor to Joplin. Through my past pull requests, I have familiarized myself with the monorepo structure, React/Redux components, and the core contribution guidelines.
2. Project Summary
- What problem it solves: As users accumulate vast markdown knowledge bases, traditional keyword search fails to uncover nuanced relationships. Users lack a way to interrogate their own curated data contextually.
- What will be implemented: A local-first, privacy-preserving Retrieval-Augmented Generation (RAG) assistant built entirely as a Joplin plugin.
- Expected outcome: A conversational React-based chat panel within the application where users can ask natural language questions. The AI will generate answers strictly grounded in the user's local notes and provide clickable citations back to the original source notes.
3. Technical Approach
- Architecture or components involved: The pipeline involves note ingestion via the Joplin Data API, structural markdown chunking, vector embedding, semantic retrieval, and LLM prompt building.**
- Changes to the Joplin codebase: The project will be developed entirely as a plugin using Joplin's Plugin API to maintain modularity and keep heavy AI dependencies out of the core application.
- Libraries or technologies you plan to use: To bypass Joplin's strict native Node.js module restrictions, the architecture relies heavily on WebAssembly (WASM). I will use
sqlite-vecfor local, entirely offline vector storage, as it integrates perfectly with Joplin's existing SQLite environment. Embedding generation will utilize lightweight quantized models (likeBGE-small-en-v1.5) viaTransformers.js. LLM inference will default to local providers like Ollama, with opt-in cloud API fallbacks. - Potential challenges: Running CPU-bound tasks like
Transformers.jsmatrix multiplication on the main Electron thread will cause the Joplin UI to freeze. I will mitigate this by delegating embedding generation to a background Web Worker via asynchronous messaging.
4. Implementation Plan
(Based on the 350-hour Large project requirement mapped over 12 weeks)
- Week 1–2: Infrastructure & Database Scaffold the plugin architecture and establish the UI settings page (API key inputs, model selection). Initialize the
sqlite-vecdatabase schema and validate WASM loading within the plugin environment. - Week 3–4: Ingestion & Chunking Implement the Note Ingestion engine using the Joplin Data API in paginated batches. Develop the structural Markdown chunking algorithm (splitting by headers and using a sliding token window with overlap) and hash notes via SHA-256 for differential syncing.**
- Week 5–6: Embedding Pipeline & Vectorization Integrate
Transformers.jsand load the local ONNX model. Implement Web Worker threading mechanisms to ensure the background embedding process does not block the main application thread. Implement cosine similarity search withinsqlite-vec. - Week 7–8: Prompt Building & LLM Integration Develop the Prompt Builder to enforce strict token budgets and wrap context in XML tags. Integrate the LLM Provider Interface, supporting local endpoints (Ollama) and cloud APIs (OpenAI/Gemini) with robust error handling for timeouts and connection refusals.
- Week 9–10: React Chat UI & IPC Integration Develop the React-based sidebar chat panel. Implement Inter-Process Communication (IPC) to pass user queries to the backend and stream tokens back to the UI. Implement parsing logic to convert LLM citation markers into clickable deep links utilizing
joplin.commands.execute('openNote').** - Week 11–12: Testing, Polish & Delivery Handle edge cases (e.g., empty databases, missing native dependencies, model download failures). Write comprehensive unit tests for chunking and IPC logic. Finalize user and developer documentation and prepare the final GSoC evaluation report.
5. Deliverables
- Implemented features: A complete, local-first RAG plugin featuring a background synchronization engine,
sqlite-vecsemantic search, and an interactive React-based chat sidebar with source citations. - Tests: Unit test suites for the structural chunking algorithm, database schema integrity, and IPC messaging bridges.
- Documentation: A comprehensive user guide for configuring local LLM models (e.g., Ollama) alongside developer documentation detailing the Web Worker architecture.
6. Availability
-
Weekly availability during GSoC: I can commit ~30 hours per week to comfortably meet the 350-hour requirement for this Large-sized project.
-
Time zone: Asia/Colombo (+5.30 UTC)
-
Other commitments: I am currently participating in an internship that concludes in June. I have carefully evaluated my schedule and mapped out my availability to ensure I comfortably meet the 350-hour requirement. My planned schedule is:
-
During Internship (May - June): ~20 hours per week.
-
Post-Internship (June - August): ~35 hours per week. If mentors prefer a slightly less intensive pacing during the overlap, I am completely open to utilizing GSoC's flexible timeline rules to extend the coding period up to 14 or 16 weeks to ensure the highest possible code quality without burnout. I want to be completely upfront about my schedule so we can plan the summer effectively