How your-papa/obsidian-smart2brain works
Project type and purpose
• This is a full-stack Obsidian plugin (“Your Smart Second Brain”) built in TypeScript and Svelte.
• It embeds and retrieves your Markdown notes via a RAG (Retrieval-Augmented Generation) pipeline and lets you chat with a local or cloud LLM (e.g. Ollama daemon or OpenAI).
File structure
• Top-level: Obsidian plugin metadata (manifest.json), build configs (vite.config.ts, svelte.config.ts, tsconfig.json), styling (tailwind.config.js).
• src/SmartSecondBrain.ts: plugin bootstrap—registers views, commands, settings.
• src/views: three “view” classes that hook into Obsidian’s pane system—Chat, Onboarding, Settings.
• src/components: Svelte UI components for chat interface, modals, settings, onboarding flow, base controls.
• src/controller: business logic and adapters—Messages.ts orchestrates the RAG pipeline; Ollama.ts and OpenAI.ts handle LLM calls.
• src/store.ts: Svelte store for state management; src/lang & i18n.ts: localization; logging.ts: centralized logging.
README for additional insights
• Describes a RAG pipeline embedding vault notes into vectors, retrieving by similarity, and then generating answers.
• Supports two LLM integration modes: local via Ollama (CLI or REST), or cloud via OpenAI API.
• Mentions external vector store technologies (Orama) and Langchain in the backend.