Vault Intelligence: Architecture and standards (2026 Edition)
Status: Validated & Active Last Updated: February 2026 Context: This document serves as the authoritative source of truth for both human developers and AI agents (Gemini 3) working on the Vault Intelligence plugin.
1. Core Philosophy & Identity
- Identity: Vault Intelligence is an AI-powered Research Agent and Adaptive Hybrid Search tool.
- AI Backend: Provider-agnostic architecture (via
IReasoningClient). Google Gemini is the default implementation (GeminiProvider). - Data Structure: Knowledge Graph + Vector Embeddings (via
GraphService). - Platform: Obsidian (Desktop and Mobile). Note: Linux/Wayland support is now default in Electron v39 (Jan 2026).
2. Architectural Patterns (Strict SOA)
We strictly adhere to a Service-Oriented Architecture (SOA) to ensure testability and separation of concerns.
2.1 The Golden Rules
- Services are Singletons: All core logic resides in
src/services/. Services must be instantiated once inmain.tsand passed via dependency injection or accessed via the plugin instance. - Views are Dumb: UI components (
src/views/) MUST NOT contain business logic.- Anti-pattern (Avoid):
view.app.vault.read() - Exception: Pragmatic read-only vault access for UI events (e.g., resolving a
TFileto open it in a workspace leaf viagetAbstractFileByPath) is permitted, but complex vault queries must be delegated to a service. - Recommended pattern:
plugin.graphService.getNoteContent()
- Anti-pattern (Avoid):
- No Global State: Avoid
window.app. Always usethis.apppassed through the plugin instance.
2.2 Service Responsibilities
ProviderRegistry: Central manager for AI model providers. Handles dynamic registration of models and APIs.GeminiProvider: Implementation ofIReasoningClient&IEmbeddingClient. Manages Google AI / Gemini interactions. New 2026 Req: Must useSecretStoragefor API keys.OllamaProvider: Implementation ofIReasoningClient&IEmbeddingClientfor local hardware execution.GraphService: Manages the localized knowledge graph and vector store.SearchOrchestrator: Orchestrates Hybrid Search (combining keyword and semantic results).PersistenceManager: Handles all file I/O for plugin state (eg.vault-intelligence/).
3. Obsidian Development Standards (2026 Grounded)
All code must adhere to the latest Obsidian API standards.
3.1 API and security
Secret Management: Use
SecretStorage(API v1.11.4+, Jan 2026) for storing API keys (Gemini API Key). Do not store secrets indata.jsonor plain styling settings.Settings UI: Use
SettingGroup(API v1.11.0+) to organize settings instead of manual headings.File Access:
- Use
app.vault.getAbstractFileByPath()for file resolution (user content). - Exception: Use
app.vault.adapterfor hidden files/folders (e.g..vault-intelligence/) which are not indexed by the Vault API. - Use
app.fileManager.processFrontMatter()for metadata updates (never regex-replace the file content directly). - Performance: Use
cachedReadwhere possible for read-heavy operations.
- Use
3.2 Coding Conventions (TypeScript)
- Modern JS: Strict use of
const/let,async/await. Novar. - Type Safety: No
any. Use strict interfaces for all Service inputs/outputs. - Validation: All user input (paths, file names) must be sanitized using
normalizePath().
3.3 UI/UX standards
Style: Strongly prefer Obsidian CSS variables (eg
--color-red); use custom variables only when necessary and with proper justification.Copy: Use sentence case for all UI strings.
Responsiveness: Ensure views work on mobile (touch targets, layout shifts).
4. Operational Guardrails
4.1 AI Agent Rules
- Verification: Always run
npm run lint,npm run build,npm run testandnpm run docs:buildbefore marking a coding task as complete. - Linting: Do not use
eslint-disablecomments: resolve the issue, don't hide the symptom. Exception:eslint-disableis permitted intests/**directories where deep mocking requires bypassing strict type checks.
4.2 Release Readiness
- Manifest:
minAppVersionshould be updated if using new APIs (e.g.1.11.4forSecretStorage). - Performance:
onloadmust complete in <100ms. Defer heavy initialization (graph loading) toonLayoutReady.
5. References
- Obsidian API Documentation
- ESLint Rules
- See
devs/REFERENCE_LINKS.mdfor external 2026 resources.