Automation & Scripts

Last reviewed: 2026-07-15

Plainva has no plugin system that runs third-party code. Instead the vault itself is the extension interface: your notes are plain Markdown, databases are plain YAML (.base), and the OKF conventions give every file a predictable structure. Anything that can read and write files — a shell script, a Python program, a CLI tool, a scheduled job or an AI agent — can extend, generate or reorganize your vault without a single Plainva-specific API.

This page explains how to do that safely. The exact byte-level format of every file is documented separately in the File Format Reference; this page is the practical companion: the rules, the workflow, and what to hand an AI assistant.

Why files instead of a plugin sandbox

If you want something Plainva does not do out of the box, you do not wait for a plugin — you write a small script against the files.

Reading a vault safely

Everything is UTF-8 text:

Reading never needs care — text files cannot be “corrupted” by reading them. The rules below are all about writing.

Writing a vault safely

Follow these rules and Plainva (and Obsidian) will accept your changes cleanly. Plainva watches the vault folder: an external write is picked up and re-indexed automatically, usually within a second.

  1. Write UTF-8 without a BOM, with LF line endings. Windows tools that default to UTF-16 or CRLF produce files Plainva treats as changed on every sync.
  2. Write atomically. Write to a temporary file in the same folder, then rename it over the target. A half-written note (for example after a crash) is worse than no change. Plainva itself writes every note this way.
  3. Preserve OKF frontmatter and unknown keys. Keep type and okf_version when you rewrite a note, and never drop frontmatter keys you do not recognize — round-trip them unchanged. Do not “tidy” keys you do not understand.
  4. Never touch .plainva/. That folder holds Plainva’s device-local index, backups, graph pins and sync state. It is not part of your content and must never be written, synced or committed to Git by your scripts.
  5. Respect the .base rules. A .base uses only Obsidian’s four top-level keys (filters, formulas, properties, views); every view needs a name; filters are single-rooted. All Plainva-specific data goes under nested plainva: sub-keys. The File Format Reference has the full contract, including a two-sided relations example.
  6. Don’t fight the editor. If a note is open and has unsaved edits in Plainva, prefer not to rewrite it from a script at the same moment. Plainva has a conflict resolver as a safety net, but the cleanest path is to let the app save first (or edit notes that are not currently open).

Patterns

A few common jobs, all just file operations:

Keep scripts idempotent where you can: running twice should not duplicate content.

Handing the vault to an AI assistant

An AI agent with read/write access to a vault folder is exactly the case this design is built for. To let it work correctly:

  1. Give it the File Format Reference. It is written for a machine reader: the OKF frontmatter contract, the property→YAML serialization, the full .base schema with its hard Obsidian rules, the index.md contract and the safety rules — everything an agent needs to edit files without breaking them.
  2. Point it at the vault folder, not the .plainva/ folder. State clearly that .plainva/ is off-limits.
  3. Ask for atomic, minimal edits. An agent that rewrites a whole note to change one property should preserve the rest of the frontmatter and body verbatim.

Because the contract is a document, not a live API, the same instructions work with any assistant, offline or online.

Safety recap

See also