Obsidian Data HandlingSAFE
Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com.
Overview
Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com.
4f83675ca38aOBSERVED · 2026-10-09Host compatibility
What the documentation claims. We have not run a compatibility test.
| Host | Status | Notes |
|---|---|---|
| claude-code | mentioned |
What it tells the agent
The instruction file, verbatim from the audited commit — this is the text the model reads, and the surface the audit's instruction layer examines. Quoted here so you can judge it without cloning anything.
--- name: obsidian-data-handling description: 'Implement vault data backup, sync, and recovery strategies. Use when building backup features, implementing data export, or handling vault synchronization in your plugin. Trigger with phrases like "obsidian backup", "obsidian sync", "obsidian data export", "vault backup strategy". ' allowed-tools: Read, Write, Edit version: 1.13.0 license: MIT author: Jeremy Longshore <[email protected]> tags: - saas - obsidian - backup compatibility: Designed for Claude Code --- # Obsidian Data Handling ## Overview Data management patterns for Obsidian plugins: plugin config with loadData/saveData, vault file I/O, frontmatter parsing via metadataCache, handling renames and deletes, cross-device sync considerations, and IndexedDB fallback for large datasets. ## Prerequisites - Working Obsidian plugin (`export default class extends Plugin`) - Understanding of Obsidian's `Vault` and `MetadataCache` APIs - TypeScript compilation configured ## Instructions ### Step 1: Plugin Config with loadData / saveData Obsidian stores plugin data in `.obsidian/plugins/<plugin-id>/data.json`. Use `loadData()` and `saveData()` — never read that file directly. ```typescript interface PluginConfig { version: number; apiEndpoint: string; syncInterval: number; excludedFolders: string[]; } const DEFAULT_CONFIG: PluginConfig = { version: 1, apiEndpoint: 'https://api.example.com', syncInterval: 300, excludedFolders: [], }; export default class DataPlugin extends Plugin { config: PluginConfig; async onload() { await this.loadConfig(); } async loadConfig() { const saved = await this.loadData(); this.config = Object.assign({}, DEFAULT_CONFIG, saved); // Migrate from older config versions if (this.config.version < 1) { this.config.excludedFolders = []; this.config.version = 1; await this.saveConfig(); } } async saveConfig() { await this.saveData(this.config); } } ``` `loadData()` returns `null` on first run — `Object.assign` onto defaults handles this cleanly. ### Step 2: Reading and Writing Vault Files ```typescript import { TFile, TFolder, normalizePath } from 'obsidian'; // Read a markdown file async readNote(path: string): Promise<string | null> { const file = this.app.vault.getAbstractFileByPath(normalizePath(path)); if (file instanceof TFile) { return await this.app.vault.read(file); } return null; } // Write or create a markdown file async writeNote(path: string, content: string): Promise<TFile> { const normalized = normalizePath(path); const existing = this.app.vault.getAbstractFileByPath(normalized); if (existing instanceof TFile) { await this.app.vault.modify(existing, content); return existing; } // Ensure parent folder exists const dir = normalized.substring(0, normalized.lastIndexOf('/')); if (dir && !this.app.vault.getAbstractFileByPath(dir)) { await this.app.vault.createFolder(dir); } return await this.app.vault.create(normalized, content); } // Append to a file (e.g., a log or journal) async appendToNote(path: string, text: string): Promise<void> { const file = this.app.vault.getAbstractFileByPath(normalizePath(path)); if (file instanceof TFile) { await this.app.vault.append(file, '\n' + text); } } ``` Use `vault.cachedRead()` instead of `vault.read()` when you don't need the absolute latest content — it avoids hitting disk on every call. ### Step 3: Working with Frontmatter via MetadataCache Never parse YAML frontmatter manually. Obsidian's `metadataCache` keeps a parsed cache of every file's frontmatter. ```typescript import { TFile, CachedMetadata } from 'obsidian'; // Read frontmatter from a file getFrontmatter(file: TFile): Record<string, any> | null { const cache: CachedMetadata | null = this.app.metadataCache.getFileCache(file); return cache?.frontmatter ?? null; } // Update frontmatter using processFrontMatter (Obsidian 1.4+) async setStatus(file: TFile, status: string): Promise<void> { await this.app.fileManager.processFrontMatter(file, (fm) => { fm.status = status; fm.updated = new Date().toISOString(); }); } // Bulk query: find all files with a specific tag getFilesWithTag(tag: string): TFile[] { const files: TFile[] = []; for (const file of this.app.vault.getMarkdownFiles()) { const cache = this.app.metadataCache.getFileCache(file); const tags = cache?.tags?.map(t => t.tag) ?? []; const fmTags = cache?.frontmatter?.tags ?? []; if (tags.includes(tag) || fmTags.includes(tag.replace('#', ''))) { files.push(file); } } return files; } ``` `processFrontMatter` handles YAML serialization correctly — it preserves comments and formatting, and is the only safe way to update frontmatter programmatically. ### Step 4: Handling File Renames and Deletes Plugins that index file paths must update their state when files move or disappear. ```typescript async onload() { // Track renames to update internal references this.registerEvent( this.app.vault.on('rename', (file, oldPath) => { if (file instanceof TFile) { this.onFileRenamed(file, oldPath); } }) ); // Clean up when files are deleted this.registerEvent( this.app.vault.on('delete', (file) => { if (file instanceof TFile) { this.onFileDeleted(file.path); } }) ); } private onFileRenamed(file: TFile, oldPath: string) { // Update any stored path references if (this.config.pinnedFiles?.includes(oldPath)) { const idx = this.config.pinnedFiles.indexOf(oldPath); this.config.pinnedFiles[idx] = file.path; this.saveConfig(); } } private onFileDeleted(path: string) { // Remove from any indexes if (this.config.pinnedFiles?.includes(path)) { this.config.pinnedFiles = this.config.pinnedFiles.filter(p => p !== path); this.saveConfig(); } } ``` Always use `registerEvent` — it automatically cleans up the listen
Trust audit
SAFEgrade B · trust 89/100 Nothing in the source contradicts what it says it does. Grade A is reserved for packages that have also passed the behavioural sandbox.
| Layer | What it checks | Result |
|---|---|---|
| L0 | Provenance & inventory | PASS |
| L1 | Static analysis of the code | PASS |
| L2 | Instruction surface (what it tells the agent) | PASS |
| L3 | Class-specific surface | PASS |
| L4 | Behavioural (sandbox) | SKIPPED |
What the source does
- Filesystem
- none-observed
- Network
- none-observed
- Shell
- none-observed
- Dependencies
- pinned
- Secrets in source
- none-found
Findings (0)
No findings outside the package's declared scope.
Gates applied: no_behavioural_pass.
4f83675ca38afull audit observations/trust-audit/skill/jeremylongshore__obsidian-data-handling.json · Report an issue / request a re-scanAudit history
Every audit this skill has had.
| Date | Source | Verdict | Grade | Score | Change |
|---|---|---|---|---|---|
| 2026-10-09 | 4f83675ca38a | SAFE | B | 89 | first audit |
Questions
What does the Obsidian Data Handling skill do?
Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com.
Is Obsidian Data Handling safe to install?
The audit found nothing in the source that contradicts what it says it does, and graded it B (89/100). Grade A is held back for packages that have also passed a sandboxed behavioural run, which is why a clean skill reads B.
What can Obsidian Data Handling access on my machine?
The audit observed no filesystem, network or shell use at all in its source.
Which assistants does Obsidian Data Handling work with?
Its documentation mentions claude-code. That is what the text claims, not a compatibility test we ran.
How current is this page?
The grade is for one exact copy of the source (4f83675ca38a), read on 2026-10-09. The repository is watched, and a new audit runs when it changes — this is the first audit.