MCPcopy Index your code
hub / github.com/allenhutchison/obsidian-gemini

github.com/allenhutchison/obsidian-gemini @4.10.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release 4.10.2 ↗ · + Follow
2,382 symbols 6,313 edges 375 files 653 documented · 27%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Gemini Scribe for Obsidian

Gemini Scribe is an Obsidian plugin that integrates Google's Gemini AI models, providing powerful AI-driven assistance for note-taking, writing, and knowledge management directly within Obsidian. It leverages your notes as context for AI interactions, making it a highly personalized and integrated experience.

Note: Pick one of two setup paths in plugin settings → Provider:

  • Google Gemini (cloud) — requires a Gemini API key (free tier available at Google AI Studio).
  • Ollama (local) — runs locally with no API key; install Ollama, pull a model, and select it in settings. See docs/guide/ollama-setup.md for the feature-parity table.

What's New in v4.10.2

🛠️ Gemini Scribe 4.10.2 - Interactions API transport fix & recoverable deletes

4.10.2 is a hotfix for the 4.10 line — two fixes on top of the full 4.10 feature set:

  • 🧪 Interactions API transport fixed - With Use Interactions API enabled, every request failed with a CORS error ("Failed to fetch") after the Gemini SDK update to @google/genai 2.10.0, breaking chat and summarization for anyone who had the opt-in transport on. Requests now route through Obsidian's requestUrl again, so the Interactions path (streaming text/reasoning, tool calls, grounded sources) works. The transport remains off by default. (#1045)
  • 🗑️ Safer file deletion - When the agent deletes a file or folder it now follows your Obsidian "Deleted files" setting (system trash or the vault's .trash folder) instead of permanently removing it, so deletions are recoverable; includes minor correctness fixes. (#1030)

The full 4.10 feature set is unchanged:

  • 🌍 Localized UI in 20 languages - The entire plugin interface (settings, modals, agent view, commands, notices) is now translated, auto-selected from your Obsidian language with graceful fallback to English.
  • 🧠 Model reasoning display - The agent shows the model's thinking inline in the tool activity block and persists it in session history, so you can follow how it reached an answer.
  • 🧪 Interactions API transport (experimental, opt-in) - New Use Interactions API setting routes Gemini chat through Google's newer Interactions API, with full streaming of text, reasoning, tool calls, and grounded sources. Off by default and runs statelessly (your conversation history stays on your device); enable it under Settings → Agent config → API configuration, or leave it off to keep using the proven generateContent path.
  • 🗺️ Google Maps grounding tool - The agent can ground answers in Google Maps data for place and location questions.
  • 🧠 Per-use-case thinking depth - Reasoning effort is now tuned per task (completions think the least, agent chat the most) instead of one global setting, balancing latency and quality.
  • ⏳ Soft agent turn budget - Long agent runs get a gentle reminder as they approach the turn limit, plus a one-shot extension, instead of stopping abruptly.
  • 📋 Copy buttons for tool calls - Quickly copy tool-call parameters and results from the agent view.
  • 🔄 In-app model-list refresh - Refresh the available Gemini model list without restarting.

Previous Updates (v4.10.1):

  • 📝 Notes-only patch - Completed the 4.10.0 release notes (which omitted several of the features above); no functional changes.

Previous Updates (v4.9.1):

  • 🗂️ Initialize vault context fix - Fixed the "Initialize vault context" / "Update vault context" button, which was sending a malformed model request and failing to generate AGENTS.md. The feature now works correctly.

Previous Updates (v4.9.0):

🪝 Gemini Scribe 4.9 - Lifecycle Hooks, Stable Prefix Caching, Custom Endpoint

  • 🪝 Lifecycle hooks - Trigger headless AI agent runs in response to vault events (file created, modified, deleted, renamed). Create and manage hooks from the Open hook manager command. See the Lifecycle Hooks guide.
  • ⚡ Stable prefix caching - The agent's system instruction is now byte-stable across turns and tool follow-ups, restoring Gemini's implicit prefix cache so long sessions stop reprocessing history each turn.
  • 🌐 Custom API endpoint - New setting to route all Gemini API calls through a proxy or alternate endpoint, covering every SDK call site.
  • 📐 Collapsible settings sections - Settings page reorganized into foldable sections for a cleaner UI.
  • 🔐 MCP hardening - Stdio server environment variables now live in Obsidian's encrypted SecretStorage; offline or unreachable MCP servers no longer block plugin load.
  • 🛡️ Unified tool-policy - Sessions, Projects, Scheduled tasks, and Hooks now share one policy model so per-feature permissions behave consistently.
  • 📦 Two-phase context compaction - Long conversations truncate older tool-result payloads first, summarize second, for cleaner handling near the token limit.

Previous Updates (v4.8.0):

  • ⏰ Scheduled tasks - Run agent tasks on a cron, time-of-day, or day-of-week schedule with full management UI. See the Scheduled tasks guide.
  • 🌙 Missed-run catch-up - Tasks that should have run while Obsidian was closed surface on startup for review.
  • 🛰️ Background tasks - Deep research and image generation now run in the background with output consolidated under [state-folder]/Background-Tasks/. See the Background tasks guide.
  • 🦙 Ollama provider - Point the plugin at a local Ollama server for offline, local-model chat. See the Ollama Setup guide.
  • 🛑 Runaway-loop abort - Repeated tool-loop detections within a turn now abort the turn with a clear notice instead of churning.
  • 🛠️ Headless agent loop - AgentLoop extracted from the agent view so scheduled and background runners share the same execution engine.

Features

  • Agent mode with Tool Calling: An AI agent that can actively work with your vault! It can search for files, read content, create new notes, edit existing ones, move and rename files, create folders, and even conduct deep research with proper citations. Features persistent sessions, granular permission controls, session-specific model configuration, and a diff review view that lets you inspect and edit proposed file changes before they're written.
  • Semantic Vault Search: Search your vault by meaning, not just keywords. Uses Google's File Search API to index your notes in the background. The AI can find relevant content even when you don't remember exact words. Supports PDFs and attachments, with pause/resume controls and detailed status tracking.
  • Context-Aware Agent: Add specific notes as persistent context for your agent sessions. The agent can access and reference these context files throughout your conversation, providing highly relevant and personalized responses.
  • Smart Summarization: Quickly generate concise, one-sentence summaries of your notes and automatically store them in the document's frontmatter, using a dedicated Gemini model optimized for summarization.
  • Selection-Based AI Features: Work with selected text in powerful ways:
  • Rewrite: Transform selected text with custom instructions - right-click and choose "Gemini Scribe: Rewrite text..."
  • Explain Selection: Get AI explanations using customizable prompts - right-click and choose "Gemini Scribe: Apply prompt..."
  • Ask about selection: Ask any question about selected text - right-click and choose "Gemini Scribe: Ask question..."
  • IDE-Style Completions: Get real-time, context-aware text completions as you type, similar to IDEs. Accept completions with Tab or dismiss with any other key. This feature uses a dedicated Gemini model for optimized completion generation.
  • Persistent Agent sessions: Store your agent conversation history directly in your vault as markdown files. Each session is stored in the gemini-scribe/Agent-Sessions/ folder, making it easy to backup, version control, and continue conversations across sessions.
  • Configurable Models: Choose different Gemini models for chat, summarization, and completions, allowing you to tailor the AI's behavior to each task.
  • Custom Prompt System: Create reusable AI instruction templates for agent sessions, allowing you to customize the AI's behavior for different workflows (e.g., technical documentation, creative writing, research). Includes command palette commands for easy creation and management.
  • Image Paste Support: Paste images directly into the chat input to send them to Gemini for multimodal analysis. Images are automatically saved to your Obsidian attachment folder, displayed as thumbnails before sending, and the AI receives the image path for embedding in notes.
  • MCP Server Support: [Experimental] Connect to Model Context Protocol servers to extend the agent with external tools. Supports stdio (desktop) and HTTP transports (all platforms including mobile), with OAuth authentication for remote servers. Configure per-tool trust settings with seamless integration into the confirmation flow.
  • Scheduled tasks: Automate recurring AI prompts — daily summaries, weekly reports, periodic vault maintenance — without manual intervention. Create and manage tasks from the Open scheduler command or Settings → Gemini Scribe → Automation. Each task has a frontmatter schedule (daily, daily@HH:MM, weekly, weekly@HH:MM:DAYS, interval:Xm, etc.) and a prompt body; tasks run as headless agent sessions and write output to your vault. Supports per-task model and tool-category overrides, a configurable tool-iteration cap (maxIterations, default 20) for long multi-step runs, catch-up runs for tasks missed while Obsidian was closed (runIfMissed: true), automatic pause after repeated failures, and a task monitor via the command palette.
  • Lifecycle Hooks: [Opt-in] Trigger headless AI agent runs in response to vault events — file created, modified, deleted, or renamed. Create and manage hooks from the Open hook manager command or Settings → Gemini Scribe → Automation. Each hook specifies a trigger, an optional path glob and frontmatter filter, and a prompt template; runs include debounce, per-hour rate limits, cooldown, a configurable tool-iteration cap (maxIterations, default 20), and auto-pause guards to keep API costs in check. Requires enabling the hooksEnabled setting.
  • Projects: Create scoped agent profiles for different areas of your vault. A project bundles custom instructions, file scope, skill selection, and permission overrides into a single configuration. The agent auto-detects projects from your folder structure and applies project-specific behavior — including scoped file discovery, filtered skills, and per-tool permission overrides. See the Projects guide for details and the blog post for a walkthrough.
  • Agent Skills: Create, edit, and use extensible skill packages that give the agent specialized knowledge and workflows. Skills follow the agentskills.io specification and are stored in your plugin state folder. The agent automatically discovers available skills and activates them on demand. Update existing skills via the edit_skill tool with diff review.
  • Built-in Prompt templates: The plugin uses carefully crafted Handlebars templates for system prompts, agent prompts, summarization prompts, selection rewrite prompts, and completion prompts. These ensure consistent and effective AI interaction.
  • Data Privacy: All interactions with the Gemini API are done directly from your machine. No data is sent to any third-party servers other than Google's. Agent session history is stored locally in your Obsidian vault as markdown files.
  • Robust Session Management:
  • Persistent agent sessions that survive restarts
  • Session-specific permissions and settings
  • Context files that persist across the session
  • Full conversation history with tool execution logs
  • Easy backup and version control of sessions
  • Automatic context compaction when conversations grow large
  • Optional token usage display showing real-time context consumption

Quick Start

  1. Install the plugin from Community Plugins
  2. Get your free API key from Google AI Studio
  3. Add the API key in plugin settings
  4. Open Agent Chat with the ribbon icon or command palette
  5. Manage sessions directly with command palette actions: "New agent session", "Browse agent sessions", "Link project to agent session", and "Agent session settings"
  6. Start using the AI agent to work with your vault!

Prefer running models locally? Gemini Scribe also supports Ollama — install Ollama, pull a model with ollama pull llama3.2, and switch the Provider in settings to "Ollama (local)". A few Gemini-built-in features (Google Search, URL Context, Deep Research, image generation, RAG) are unavailable on Ollama; see docs/guide/ollama-setup.md for details.

Installation

  1. Community Plugins (Recommended):

    • Open Obsidian Settings.
    • Navigate to "Community plugins".
    • Ensure "Restricted mode" is OFF.
    • Click "Browse" and search for "Gemini Scribe".
    • Click "Install" and then "Enable".
  2. Manual Installation:

    • Download the latest release from the GitHub Releases page (you'll need main.js, manifest.json, and styles.css).
    • Create a folder named obsidian-gemini inside your vault's .obsidian/plugins/ directory.
    • Copy the dow

Extension points exported contracts — how you extend this code

Tool (Interface)
(no doc) [54 implementers]
src/tools/types.ts
ModelApi (Interface)
(no doc) [6 implementers]
src/api/interfaces/model-api.ts
VaultInfoCache (Interface)
* Simple cache entry for vault information
src/services/vault-analyzer.ts
MCPToolDefinition (Interface)
* MCP tool definition as returned by client.listTools()
src/mcp/mcp-tool-wrapper.ts
SuggestModalChooser (Interface)
Undocumented internal SuggestModal API for programmatic highlight control.
src/ui/agent-view/file-picker-modal.ts
TestState (Interface)
(no doc)
test/services/failure-pause-tracker.test.ts
StubEntity (Interface)
(no doc)
test/ui/management-modal-base.test.ts
GeminiModel (Interface)
(no doc)
src/models.ts

Core symbols most depended-on inside this repo

t
called by 980
src/i18n/index.ts
execute
called by 293
src/tools/types.ts
log
called by 222
src/utils/logger.ts
error
called by 197
src/utils/logger.ts
initialize
called by 119
src/services/hook-manager.ts
run
called by 96
src/agent/agent-loop.ts
warn
called by 94
src/utils/logger.ts
setName
called by 89
__mocks__/obsidian.js

Shape

Method 1,247
Function 569
Class 415
Interface 141
Enum 10

Languages

TypeScript100%

Modules by API surface

__mocks__/obsidian.js82 symbols
src/services/hook-manager.ts50 symbols
src/ui/agent-view/agent-view.ts41 symbols
src/services/scheduled-task-manager.ts36 symbols
test/ui/management-modal-base.test.ts35 symbols
src/services/rag-indexing.ts33 symbols
src/ui/agent-view/agent-view-messages.ts27 symbols
src/agent/session-manager.ts27 symbols
src/mcp/mcp-manager.ts25 symbols
src/ui/background-tasks-modal.ts24 symbols
src/api/providers/gemini/interactions-mapper.ts24 symbols
src/api/providers/gemini/client.ts24 symbols

For agents

$ claude mcp add obsidian-gemini \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact