Obsidian Vault Disciplineのロゴ

Obsidian Vault Discipline

コミュニティ
bacnh85
obsidian-vault-discipline

Vault内のすべてのファイル操作で、bashではなくObsidianツールを使うよう徹底します。ユーザーがObsidian、vault、ノート、Vault内でのファイル移動、ノートのアーカイブ、ObsidianのVaultパス内でのファイル操作に言及した場合に起動します。また、エージェントが「obsidian」「hermes」「vault」「.obsidian」など、Vaultを示す文字列を含むパスに対してbashのmv/cp/rm/renameを使おうとした場合にも起動します。エージェントはファイル操作にbashを使いがちですが、このスキルはその誤りを防ぎます。Vaultのパスが関わるファイル操作の前に必ず使ってください。

概要

公開者bacnh85
リポジトリpi-extensions
スキル名obsidian-vault-discipline
スター
42
フォーク
15
同梱ファイル
1
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 1個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    bacnh85がGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Obsidian Vault Discipline」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/bacnh85/pi-extensions/tree/main/pi-obsidian/skills/obsidian-vault-discipline
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

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
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでObsidian Vault Disciplineを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にObsidian Vault Disciplineを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Obsidian Vault Disciplineは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

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.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Obsidian Vault Discipline」では何ができますか?

Vault内のすべてのファイル操作で、bashではなくObsidianツールを使うよう徹底します。ユーザーがObsidian、vault、ノート、Vault内でのファイル移動、ノートのアーカイブ、ObsidianのVaultパス内でのファイル操作に言及した場合に起動します。また、エージェントが「obsidian」「hermes」「vault」「.obsidian」など、Vaultを示す文字列を含むパスに対してbashのmv/cp/rm/renameを使おうとした場合にも起動します。エージェントはファイル操作にbashを使いがちですが、このスキルはその誤りを防ぎます。Vaultのパスが関わるファイル操作の前に必ず使ってください。

TypingMindでObsidian Vault Disciplineを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Obsidian Vault Disciplineはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにObsidian Vault Disciplineをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/bacnh85/pi-extensions/tree/main/pi-obsidian/skills/obsidian-vault-disciplineを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Obsidian Vault Disciplineを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Obsidian Vault Disciplineで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもObsidian Vault Disciplineを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Obsidian Vault Discipline」は無料ですか?

bacnh85がGitHubで公開しています。ライセンス条件はリポジトリでご確認ください。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇