obsidian_source() returns a dlt resource you pass straight to remember(), and each *.md note becomes one document whose id is its path in the vault. Unlike remember(<folder>), which stores a note once, re-running the sync replaces edited notes and forgets deleted or renamed ones.
Before You Start
- Complete Quickstart to understand basic operations
- Ensure you have LLM Providers configured — the script needs
LLM_API_KEYto extract the graph and answer the question - Read Datasets — the vault is synced into its own
obsidian_vaultdataset - No extra install, account, or token is needed: the connector ships with Cognee and only reads files from a local folder
- Run the script against a throwaway Cognee instance (a scratch
SYSTEM_ROOT_DIRECTORYandDATA_ROOT_DIRECTORY) — it starts by wiping the whole instance, not just this dataset
Code in Action
What Just Happened
Step 1: Configure the Sync
remember(), reused on every sync. write_disposition="merge" upserts notes by their id (their path in the vault); with the default "replace", the next sync would wipe the whole synced vault. max_rows_per_table=0 disables any per-table read cap, so forget-on-delete compares against the entire vault.
Step 2: Sync the Vault and Ask
obsidian_source(vault_path=...) builds a dlt resource over every *.md note in the vault. remember() loads the notes into the obsidian_vault dataset and builds the graph, and source.cognee_sync_stats reports counts such as synced, deleted, and failed. recall() then asks the same question against that dataset.
Step 3: Change the Vault
title names the note and its tags become node sets (obsidian:tag:engineering).
Step 4: Sync Again
Additional Information
Syncing Your Own Vault
Syncing Your Own Vault
Pass your vault’s folder as
vault_path, and folders=[...] to read only some folders. Only regular *.md files are read: hidden files and folders (.obsidian, .trash, .git), attachments, and symbolic links are skipped. A renamed or moved note is a new document under its new path, and the old one is forgotten.When a Sync Fails
When a Sync Fails
If the vault folder is gone, or is empty although notes were synced from it before (a drive that did not mount), the sync raises
ObsidianVaultUnavailableError; a folder that cannot be listed raises ObsidianListingError. Either way nothing is synced and nothing is forgotten. A note that cannot be read keeps what memory already holds and is counted in cognee_sync_stats["failed"], so check it after a normal return.Privacy
Privacy
The text of every note, frontmatter included, goes to your configured LLM and embedding providers. Nothing is read until you build a source and run it. Keep a vault in its own dataset so it is easy to inspect and forget.
cognee.forget does not remove the staged copy of the text, so the next sync builds the notes again.