Obsidian Vault Discipline logo

Obsidian Vault Discipline

Community
bacnh85
obsidian-vault-discipline

Enforce using the Obsidian tool (not bash) for all vault file operations. Trigger whenever the user mentions Obsidian, vault, notes, moving files in the vault, archiving notes, or any file operation inside an Obsidian vault path. Also trigger when the agent is about to use bash mv/cp/rm/rename on paths containing "obsidian", "hermes", "vault", ".obsidian", or similar vault indicators. Agents commonly default to bash for file operations — this skill prevents that mistake. Use BEFORE any file operation when vault paths are involved.

Overview

Publisherbacnh85
Repositorypi-extensions
Skill nameobsidian-vault-discipline
Stars
42
Forks
15
Bundled files
1
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by bacnh85 on GitHub. Read the source before you install it.

Installation

Install the Obsidian Vault Discipline AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/bacnh85/pi-extensions/tree/main/pi-obsidian/skills/obsidian-vault-discipline
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/bacnh85/pi-extensions.git /tmp/pi-extensions
mkdir -p .claude/skills
cp -r /tmp/pi-extensions/pi-obsidian/skills/obsidian-vault-discipline .claude/skills/obsidian-vault-discipline
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Obsidian Vault Discipline in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Obsidian Vault Discipline on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Obsidian Vault Discipline is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Obsidian Vault Discipline

Why this exists

The Obsidian CLI maintains its own file index separate from the filesystem. Using bash mv, bash cp, or bash rm on vault files bypasses this index: the file moves on disk but Obsidian can't find it. Search, backlinks, graph view, and all vault-aware operations break silently.

This skill ensures every vault file operation goes through Obsidian's API.

Rules

ALWAYS use the obsidian tool for vault file operations

OperationCommand
Readread file="Note Name"
Createcreate path="folder/note.md" content="..."
Write/overwritewrite file="note.md" content="..." overwrite=true
Move/renamemove file="Note" to="New Path"
Rename in placerename file="Note" name="New Name"
Deletedelete path="old.md" permanent=true
Appendappend file="Note.md" content="\nMore text"
Prependprepend file="Note.md" content="# Header\n"

For bulk operations, use eval with Obsidian's JS API

The eval command runs JavaScript inside the Obsidian app with full access to app.vault API. This is the right tool for batch operations.

Quoting rules for eval

code= follows shell quoting rules — get these wrong and the JS fails with a confusing Unexpected token / Unexpected identifier error.

  • Outer wrapper: single quotes code='...' — literal, no escape decoding. Multi-line is fine; single quotes don't stop at whitespace or newlines.
  • Inner JS strings: always double quotes "...". A single quote inside single-quoted code closes the value early (e.g. code='x = 'hi'' breaks).
  • Avoid code="..." (double) for JS — \n / \t decode to real control chars before the JS engine sees them. Use single-quote mode instead.
  • Escape hatch: if code needs both quote types, use eval file=NoteName — it reads the note body as code, so quoting is a non-issue: eval file="Scripts/bulk-move".

Move files matching a pattern:

eval code='
const files = app.vault.getFiles().filter(f =>
  f.path.startsWith("source/folder/") && f.name.includes("keyword")
);
let n = 0;
for (const f of files) {
  const dest = "dest/folder/" + f.name;
  const folder = dest.split("/").slice(0, -1).join("/");
  if (!app.vault.getAbstractFileByPath(folder))
    await app.vault.createFolder(folder, true);
  await app.vault.rename(f, dest);
  n++;
}
return "Moved " + n + " files.";
'

Delete test/temp files:

eval code='
const files = app.vault.getFiles().filter(f =>
  f.name.startsWith("__test") || f.name.startsWith("Untitled")
);
let n = 0;
for (const f of files) { await app.vault.delete(f, true); n++; }
return "Deleted " + n + " files.";
'

Rename a property in frontmatter (scoped to one file):

eval code='
const f = app.vault.getAbstractFileByPath("path/to/note.md");
let c = await app.vault.read(f);
c = c.replace(/^old_property:/m, "new_property:");
await app.vault.modify(f, c);
return "Renamed.";
'

List files by criteria:

eval code='
return app.vault.getFiles()
  .filter(f => f.stat.size > 100000)
  .map(f => f.path + " (" + f.stat.size + " bytes)")
  .join("\n");
'

Batch update frontmatter across many files:

eval code='
const files = app.vault.getFiles().filter(f =>
  f.path.startsWith("folder/")
);
let n = 0;
for (const f of files) {
  let c = await app.vault.read(f);
  let m = c.match(/^---\s*\n([\s\S]*?)\n---/);
  if (!m || m[1].includes("status: archived")) continue;
  c = c.replace(/^status: active/m, "status: archived");
  await app.vault.modify(f, c);
  n++;
}
return "Updated " + n + " files.";
'

(See references/api-examples.md for more patterns.)

NEVER use bash for vault operations

These commands bypass Obsidian's index and must not be used on vault paths:

❌ Wrong✅ Right
bash mv file.md Archive/move file="file" to="Archive/file.md"
bash rm *.mddelete path="file.md" permanent=true
bash cp note.md backup/eval code="..." with app.vault.copy()
bash find vault -exec mv {} dest/ \;eval code="..." with app.vault.rename()
bash cat > file.md <<EOFcreate path="file.md" content="..."
bash sed -i 's/old/new/' file.mdeval code="..." with app.vault.modify()

Detecting vault paths

A path belongs to an Obsidian vault if any of these are true:

  • Running vault shows a vault whose path is a prefix of the target path
  • The path or any parent directory contains .obsidian/
  • The user explicitly says "vault", "obsidian", "my notes", "my vault"
  • The target directory is known from a previous vault operation in the session

When in doubt, check first: run vault to confirm the vault root, then check if your target path falls under it.

Frontmatter tag validation

The YAML # comment gotcha

In YAML, # starts a comment. An unquoted tag value like:

yaml
tags:
  - #type/research     # ← YAML sees this as a COMMENT, not a value

is silently discarded — Obsidian's tag pane shows nothing. Always quote:

yaml
tags:
  - "#type/research"   # ← YAML sees this as a string value

To detect this, never use bash grep '#type/' — that matches raw text and can't tell the difference. Use the validate-tags subcommand which uses Obsidian's own YAML parser:

obsidian run="files validate-tags" vault="My Vault"

This reports any file where the raw text has #type/ or #domain/ but Obsidian's parser sees zero tags (the unquoted-# bug). By default it checks for type/ and domain/ dimensions. Check custom dimensions:

obsidian run="files validate-tags=type/,domain/,status/" vault="My Vault"

Set list properties correctly

When setting array properties (tags, aliases), use type=list:

obsidian run="property:set name=tags type=list value=#type/research,#domain/ai-agents file=Note"
  • name= (not key=)
  • type=list for array values
  • Values are comma-separated, no brackets, no extra quotes

Verification checklist

Before submitting any change involving vault files, confirm:

  • No bash commands (mv, cp, rm, rename, sed, cat, find) were used on vault paths
  • All file operations used the obsidian tool or eval with Obsidian JS API
  • For bulk ops, the eval script handles folders that don't exist yet
  • Test files created during the session were cleaned up via the obsidian tool

Common pitfalls

  • bash mv is fast, but wrong. One mv command saves 2 seconds but breaks the vault. If you need to move many files, use one eval call with a loop instead of 26 move calls.
  • "But I already used bash and it looks fine." The file is on disk but Obsidian's index is stale. Run obsidian search query="filename" — if it returns nothing, the index is broken. Fix by using eval with app.vault.rename() to move it back through Obsidian's API, then move it properly.
  • cat > file.md in bash. This creates a file on disk that Obsidian doesn't know about. Use create path="..." content="..." instead.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Obsidian Vault Discipline AI skill do?

Enforce using the Obsidian tool (not bash) for all vault file operations. Trigger whenever the user mentions Obsidian, vault, notes, moving files in the vault, archiving notes, or any file operation inside an Obsidian vault path. Also trigger when the agent is about to use bash mv/cp/rm/rename on paths containing "obsidian", "hermes", "vault", ".obsidian", or similar vault indicators. Agents commonly default to bash for file operations — this skill prevents that mistake. Use BEFORE any file operation when vault paths are involved.

Why use Obsidian Vault Discipline on TypingMind?

Because you install it once and use it with any model. Obsidian Vault Discipline is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Obsidian Vault Discipline in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/bacnh85/pi-extensions/tree/main/pi-obsidian/skills/obsidian-vault-discipline. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Obsidian Vault Discipline?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Obsidian Vault Discipline?

As many as you like. As long as a model supports skills, you can use Obsidian Vault Discipline with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Obsidian Vault Discipline AI skill free?

It is published on GitHub by bacnh85. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇