# How to Configure the Obsidian Vault for the *patent-reader* Sub-Skill

> Learn how to configure your Obsidian vault for the patent-reader sub-skill in two simple steps. Register your vault path and run the setup script for seamless integration.

- Repository: [handsomestWei/patent-disclosure-skill](https://github.com/handsomestWei/patent-disclosure-skill)
- Tags: how-to-guide
- Published: 2026-09-05

---

**Setting up the Obsidian vault for *patent-reader* requires two steps: register your vault path with [`check_obsidian_env.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/check_obsidian_env.py), then run [`setup_obsidian_vault.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/setup_obsidian_vault.py) to bootstrap CSS snippets, templates, and index files.**

The *patent-reader* sub-skill in the [handsomestWei/patent-disclosure-skill](https://github.com/handsomestWei/patent-disclosure-skill) repository generates structured patent-reading notes directly into an Obsidian vault. Proper configuration ensures seamless integration between the skill and your note-taking system. This guide walks through the exact commands and source code paths needed to configure the Obsidian vault for *patent-reader*.

## Step 1: Register Your Vault Path

The skill must know where your Obsidian vault resides on disk. The helper script [`check_obsidian_env.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/check_obsidian_env.py) persists this path to the runtime configuration.

Run the script with the `--set` flag:

```bash
python skills/patent-reader/tools/vault/check_obsidian_env.py --set "D:/Obsidian/MyVault"

```

This writes to `runtime_config()["obsidian_vault"]` (see [[`shared/common.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/shared/common.py)](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/shared/common.py)), which [`resolve_obsidian_vault()`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-reader/tools/vault/obsidian.py) reads on every skill invocation. You only need to set this once; subsequent calls to the skill automatically resolve the vault.

## Step 2: Bootstrap the Vault with [`setup_obsidian_vault.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/setup_obsidian_vault.py)

Once the path is registered, initialize the vault structure. The bootstrap script [[`setup_obsidian_vault.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/setup_obsidian_vault.py)](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-reader/tools/vault/setup_obsidian_vault.py) performs three critical operations:

- **Copies CSS snippets** from `assets/obsidian/` to `.obsidian/snippets/`
- **Installs the base template** ([`patents.base.yaml`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/patents.base.yaml) → `patents.base`) for consistent note formatting
- **Creates the index note** (`_专利解读索引.md`) with front-matter that the skill queries to discover related patents

Execute:

```bash
python skills/patent-reader/tools/vault/setup_obsidian_vault.py \
    --vault "D:/Obsidian/MyVault"

```

The script prints a summary of actions (lines 70–73) and lazily creates `Research/Patents` and `Research/术语` folders if missing.

### What Happens Inside `bootstrap_vault()`

The core logic lives in [[`obsidian.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/obsidian.py)](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-reader/tools/vault/obsidian.py). Key functions include:

- `repo_obsidian_base_src()` — locates [`patents.base.yaml`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/patents.base.yaml) in `assets/obsidian/`
- `bootstrap_vault()` — orchestrates asset copying and index creation
- `enrich_note_frontmatter()` — adds `read_date`, tags, and aliases to generated notes

## Optional: Manual Folder Structure

While [`setup_obsidian_vault.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/setup_obsidian_vault.py) creates folders on demand, you can pre-create them:

```

MyVault/
├── .obsidian/
│   └── snippets/          # CSS for patent note styling

├── Research/
│   ├── Patents/           # Patent reading notes: <pub>_解读_<date>.md

│   └── 术语/              # Glossary entries for technical terms

└── _专利解读索引.md        # Central index with YAML front-matter

```

## Changing or Reconfiguring the Vault

To migrate to a new vault location, simply re-run the set command:

```bash
python skills/patent-reader/tools/vault/check_obsidian_env.py --set "E:/NewVault"

```

The next skill execution picks up the new path automatically. Re-run [`setup_obsidian_vault.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/setup_obsidian_vault.py) if the new vault lacks the required assets.

## Code Reference: Resolving the Vault Path in Python

For custom integrations, import the resolution logic directly:

```python
from shared.common import resolve_obsidian_vault, runtime_config

vault_path = resolve_obsidian_vault().get("vault") or runtime_config()["obsidian_vault"]
print(f"Obsidian vault: {vault_path}")

```

## Creating Glossary Entries Programmatically

The [[`obsidian.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/obsidian.py)](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-reader/tools/vault/obsidian.py) module exposes `ensure_glossary_stub()` for manual glossary management:

```python
from pathlib import Path
from skills.patent_reader.tools.vault.obsidian import ensure_glossary_stub

vault = Path("C:/Obsidian/PatentVault")
rel_path, created = ensure_glossary_stub(
    vault,
    glossary_dir="Research/术语",
    term="光电传感器",
    definition="A sensor that converts light into an electrical signal.",
    source_pub="CN1234567",
)
print(f"Glossary page: {rel_path} (new={created})")

```

## Key Source Files

| File | Purpose |
|------|---------|
| [`skills/patent-reader/tools/vault/check_obsidian_env.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-reader/tools/vault/check_obsidian_env.py) | CLI helper to set/verify the vault path in runtime config |
| [`skills/patent-reader/tools/vault/setup_obsidian_vault.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-reader/tools/vault/setup_obsidian_vault.py) | Bootstrap script that installs assets and creates index |
| [`skills/patent-reader/tools/vault/obsidian.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-reader/tools/vault/obsidian.py) | Core library: vault resolution, front-matter handling, glossary utilities |
| [`skills/patent-reader/tools/vault/schema_vault.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-reader/tools/vault/schema_vault.py) | Canvas card schemas for visualization |
| [`shared/common.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/shared/common.py) | `runtime_config()` and `resolve_obsidian_vault()` implementations |
| `assets/obsidian/` | CSS snippets and [`patents.base.yaml`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/patents.base.yaml) template |

## Summary

- **Store the vault path** using `check_obsidian_env.py --set` so `resolve_obsidian_vault()` can locate it
- **Bootstrap once** with [`setup_obsidian_vault.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/setup_obsidian_vault.py) to install CSS, templates, and the index note
- **Notes land in** `Research/Patents/` with enriched front-matter added by `enrich_note_frontmatter()`
- **Glossaries live in** `Research/术语/` with optional programmatic creation via `ensure_glossary_stub()`

## Frequently Asked Questions

### What happens if I skip the bootstrap step?

The skill will fail when attempting to write notes. `bootstrap_vault()` in [`obsidian.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/obsidian.py) ensures `.obsidian/snippets/`, the base template, and `_专利解读索引.md` exist; without them, the skill cannot generate properly formatted output or maintain the index.

### Can I use an existing Obsidian vault?

Yes. Point [`check_obsidian_env.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/check_obsidian_env.py) to any valid vault folder. The bootstrap script adds files non-destructively—it only creates missing directories and copies assets without overwriting existing notes.

### Where does the skill read the vault path from?

`resolve_obsidian_vault()` checks `runtime_config()["obsidian_vault"]` first, which is populated by [`check_obsidian_env.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/check_obsidian_env.py). This indirection allows the skill to run without hardcoded paths or environment variables.

### How do glossary entries get created?

The skill automatically calls `ensure_glossary_stub()` when encountering technical terms during patent analysis. You can also invoke it manually (see code example above) to pre-populate definitions with specific source citations.