$ show allenhutchison/obsidian-gemini
An Obsidian plugin (Gemini Scribe) that integrates multiple AI providers (Gemini, Anthropic, OpenAI, Ollama) for chat, agent-based automation, and knowledge management within the Obsidian vault. The system provides a modular architecture with an agent loop that executes tools (vault operations, web search, RAG semantic search, image generation, deep research) with confirmation flows and diff previews. It features a declarative settings UI with per-feature provider routing, a skill system following the agentskills.io spec, MCP server integration, scheduled tasks, lifecycle hooks, and an evaluation harness for benchmarking agent behavior. The codebase demonstrates strong engineering practices: thorough unit testing (73%+ line coverage), clean module boundaries with leaf modules to prevent circular imports, and reusable patterns like typed event buses, retry decorators, and cancellation-safe streaming.
The LLM identified 7 files worth highlighting for reuse:
A generic retry decorator that wraps any ModelApi implementation with exponential backoff, jitter, and optional API-provided delay from Google RetryInfo. It handles non-retryable errors, cancellation, and streaming vs. non-streaming methods. Reusable for any API client that needs resilient calling with configurable retry policy.
A cancellation-safe streaming wrapper that ensures exactly-once finalization (success, error, or cancel) for any async iterable stream. Supports AbortSignal-first cancellation and separates stream lifecycle from business logic. Used across all provider clients for consistent streaming behavior.
A typed event bus for agent lifecycle events with priority-based handlers, error isolation (one handler failure doesn't affect others), and frozen event payloads. Supports unsubscribe and clear. Reusable pattern for any system needing typed pub-sub with guarantees.
A provider-agnostic pairing of tool-call IDs across conversation turns. It assigns stable IDs to function calls and tracks responses, enabling correct replay of tool results in multi-turn conversations. Used by OpenAI and Anthropic clients to avoid duplicated logic for ID management.
A small, isolated utility for safe YAML scalar quoting: single-quotes by default (with escaped single quotes), falls back to double-quoting only for strings containing control characters. Used by all frontmatter writing paths to ensure user-authored strings are serialized safely.
A field descriptor table (HOOK_FIELDS) that defines parse/normalize/serialize methods for each frontmatter field in hook definitions. This pattern prevents drift between read and write paths, and can be adapted for any YAML-frontmatter-backed configuration system.
An abstract base class for CRUD modals with list, create, edit, and delete views. Provides shared form fields (name, description, tool policy editor), inline deletion with confirmation, and integration with Obsidian's Modal API. Used by HookManagementModal and SchedulerManagementModal, demonstrating a reusable UI pattern for managing file-backed configuration entities.