How to Configure the Obsidian Vault Path for the Patent‑Reader Skill

Set the PATENT_READER_OBSIDIAN_VAULT environment variable to your vault's absolute path, or use the check_obsidian_env.py helper to persist the configuration in ~/.patent-disclosure-skill/obsidian_vault.txt for automatic resolution across sessions.

The patent-reader skill in the handsomestWei/patent-disclosure-skill repository manages patent analysis workflows by generating structured Obsidian notes. Configuring the Obsidian vault path correctly ensures that CSS snippets, base templates, and generated patent disclosures are written to the correct location without manual path specification on every execution.

Three-Tier Resolution Strategy

The resolution logic resides in skills/patent-reader/tools/shared/common.py, specifically within the resolve_obsidian_vault function (lines 21-48). The system checks for your vault location in three distinct layers, stopping at the first successful match.

Environment Variable

The primary configuration method uses the PATENT_READER_OBSIDIAN_VAULT environment variable. Set this to the absolute path of your Obsidian vault directory. The code also accepts the legacy PATENT_DISCLOSURE_OBSIDIAN_VAULT variable for backward compatibility.

An empty string explicitly disables vault usage for the current session. The helper reads these variables in resolve_obsidian_vault (lines 34-48) before falling back to other methods.

export PATENT_READER_OBSIDIAN_VAULT="/home/user/Documents/ObsidianVault"

Persisted Configuration

If no environment variable is present, the skill falls back to a user-level configuration file at ~/.patent-disclosure-skill/obsidian_vault.txt (lines 38-43). This file stores a single absolute path that persists across terminal sessions and reboots.

The write_persisted_vault function (lines 54-60) handles writing to this location, ensuring the parent directory exists before committing the path. This method is ideal for developers who want a permanent default without cluttering shell profiles.

Automatic Detection

When neither the environment variable nor the persisted file yields a valid path, the system scans OS-specific Obsidian configuration directories and parses obsidian.json to locate active vaults (lines 72-88). It checks common default locations such as ~/Documents/Obsidian Vault.

If the scanner identifies exactly one open vault, it auto-selects that location. When multiple vaults exist or none are detected, the user receives an interactive prompt to specify the correct path.

CLI Configuration Workflow

The repository includes skills/patent-reader/tools/vault/check_obsidian_env.py, a cross-platform utility that simplifies vault path management without manually editing files or environment variables.

Checking Current Status

Run the helper without arguments to display a human-readable report of the current resolution state, including which method successfully located the vault:

python -m skills.patent-reader.tools.vault.check_obsidian_env

Add the --json flag for machine-parseable output suitable for CI pipelines or scripting:

python -m skills.patent-reader.tools.vault.check_obsidian_env --json

Manual Path Configuration

Use the --set flag to write a specific path to the persisted configuration file and immediately set the environment variable for the current process:

python -m skills.patent-reader.tools.vault.check_obsidian_env --set "/path/to/Vault"

On Windows, append --setx to make the variable permanent across new terminal sessions using the setx command:

python -m skills.patent-reader.tools.vault.check_obsidian_env --set "D:\Obsidian\MyVault" --setx

Auto-Accept Mode

For automated environments where only one vault exists, the --auto-accept flag writes the discovered path to the persisted file without user interaction:

python -m skills.patent-reader.tools.vault.check_obsidian_env --auto-accept

This is particularly useful in CI/CD pipelines or Docker containers with pre-configured vault locations.

Bootstrapping the Vault

Once the path is resolved, initialize the vault structure using setup_obsidian_vault.py. This script invokes runtime_config() (which internally calls resolve_obsidian_vault as shown in lines 42-45) to locate the vault, then executes bootstrap_vault to create required CSS snippets, base templates, and an index page.

python -m skills.patent-reader.tools.vault.setup_obsidian_vault \
    --vault "/path/to/Vault" \
    --papers-dir "Research/Patents" \
    --output "vault_status.json"

If the vault path is already configured via environment variable or persisted file, you can omit the --vault argument:

export PATENT_READER_OBSIDIAN_VAULT="/home/user/Obsidian/Vault"
python -m skills.patent-reader.tools.vault.setup_obsidian_vault

Summary

  • The patent-reader skill resolves vault paths through a hierarchy: environment variable → persisted file (~/.patent-disclosure-skill/obsidian_vault.txt) → automatic detection.
  • Set PATENT_READER_OBSIDIAN_VAULT for temporary session-specific overrides, or use check_obsidian_env.py --set for permanent configuration.
  • The automatic detection logic scans obsidian.json and common OS directories, auto-selecting unique vaults while prompting when ambiguities exist.
  • Core resolution logic lives in skills/patent-reader/tools/shared/common.py, while CLI utilities reside in skills/patent-reader/tools/vault/.

Frequently Asked Questions

What is the difference between using the environment variable and the persisted file?

The environment variable (PATENT_READER_OBSIDIAN_VAULT) applies only to the current shell session unless explicitly exported in your shell profile, making it ideal for temporary switches or Docker containers. The persisted file at ~/.patent-disclosure-skill/obsidian_vault.txt survives reboots and applies globally to all new processes, making it better for development workstations with a single primary vault.

How does the skill handle multiple Obsidian vaults?

When automatic detection finds multiple vaults in obsidian.json or common directories, the resolve_obsidian_vault function cannot determine which to use automatically. In this scenario, the CLI prompts the user to select one, or you must explicitly set the path via environment variable or the --set flag to eliminate ambiguity.

Can I disable the Obsidian integration entirely?

Yes. Setting PATENT_READER_OBSIDIAN_VAULT to an empty string explicitly disables vault usage for that session. The resolution logic in common.py interprets an empty environment variable as a signal to skip vault operations, preventing the fallback mechanisms from activating.

Where is the vault path stored on Windows versus Linux/macOS?

The persisted configuration always writes to ~/.patent-disclosure-skill/obsidian_vault.txt, which resolves to %USERPROFILE%\.patent-disclosure-skill\obsidian_vault.txt on Windows and ~/.patent-disclosure-skill/obsidian_vault.txt on Unix-like systems. The automatic detection logic adjusts its search paths based on the OS, checking %APPDATA%/Obsidian on Windows and ~/Library/Application Support/Obsidian on macOS.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →