Batch edit Markdown frontmatter with SQL

Harmonize, refactor, and bulk edit YAML frontmatter across thousands of Markdown files at once.

brew install nofuss-io/tap/fm
go install github.com/nofuss-io/frontmatter/cmd/fm@latest

Then teach your agent to use it with fm install-skill claude|codex|copilot|gemini

Obsidian vaults are tables in disguise

Documents are rows, properties are columns. SQL is the de facto language for tabular data, so fm speaks it.

fm trades generality for ergonomics compared to jq, yq, dasel and (if you're brave) sed with multiline regex. Frontmatter isn't deeply nested, so keep it simple.

Using templates a lot?

Migrate existing notes on template change.

Import content from other sources?

Harmonize to match your own structure.

Using Obsidian programmatically?

Curate to build reliable automations.

Examples

Turn tag into link

Consider a Vault with notes on people and companies. Find all people associated with the ACME company and introduce a new property employer that links to the company.

Invoke fm in the shell:

~/vault git(main): fm

Enter query on command line:

update *
set
    employer = "[[ACME]]",
    tags -= "acme"
where tags >= ["person", "acme"]
Ctrl D to run, Ctrl C to cancel.

Turn multiple properties into a list

Consider a vault folder with the recipes of your personal cookbook. Harmonize boolean tags then turn into a list (full tutorial at GitHub).

Write a multi-statement script diet.sql:

-- Inspect current state
select vegan, vegetarian, veggie, diet from * where tags >= "recipe";

-- Normalize fields
update * set diet:list, vegan:bool, vegetarian:bool, veggie:bool where tags >= "recipe";

-- Populate diet list from existing fields
update * set diet+="vegan"      where vegan=true;
update * set diet+="vegetarian" where vegetarian=true or veggie=true;

-- Clean up deprecated fields
alter * drop vegan, vegetarian, veggie;

Read into fm:

~/vault git(main): fm < diet.sql