Skip to content

API Reference parrot.interfaces.obsidian.index

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.interfaces.obsidian.index

View source

In-memory vault index: wikilink resolution, backlinks, tags, aliases.

One resolution engine shared by every Obsidian consumer (toolkit search, FEAT-392 graph bridge, wikitoolkit vault scan) so a [[wikilink]] always resolves to the same note everywhere.

Resolution replicates Obsidian's semantics (FEAT-392 §7 gotcha): an exact vault-relative path wins, then a basename match (shortest path on duplicates — Obsidian's tiebreak), then an alias match.

Alias ObsidianLink

Re-exported from parrot.interfaces.obsidian.models.ObsidianLink.

Alias ObsidianNote

Re-exported from parrot.interfaces.obsidian.models.ObsidianNote.

Class VaultIndex

Immutable index over a parsed vault snapshot.

Build with :meth:build; rebuild after any note mutation (the toolkit invalidates its cached index after write/delete/move operations).

Method VaultIndex.build

Build the index from parsed notes.

build(notes: list[ObsidianNote]) -> VaultIndex

Parameter Type Default Description
notes list[ObsidianNote] All parsed markdown notes of the vault.

Returns: VaultIndex — A fully populated :class:VaultIndex (links resolved, backlink map computed, unresolved links recorded).

Method VaultIndex.resolve

Resolve a wikilink target to a normalized vault path.

resolve(target: str, from_path: Optional[str] = None) -> Optional[str]

Parameter Type Default Description
target str Raw wikilink target (note, folder/note, alias).
from_path Optional[str] None Path of the linking note (reserved for future relative-resolution rules; Obsidian's default "shortest path when ambiguous" does not depend on it).

Returns: Optional[str] — Normalized vault-relative path (no .md), or None when the target does not resolve to any note.

Method VaultIndex.note

Return the parsed note at a vault path, or None.

note(path: str | Path) -> Optional[ObsidianNote]

Parameter Type Default Description
path str | Path

Returns: Optional[ObsidianNote]

Method VaultIndex.paths

All indexed note paths (normalized, sorted).

paths() -> list[str]

Returns: list[str]

Method VaultIndex.backlinks

Notes whose wikilinks resolve to this note (sorted paths).

backlinks(path: str | Path) -> list[str]

Parameter Type Default Description
path str | Path

Returns: list[str]

Method VaultIndex.outlinks

This note's outgoing wikilinks/embeds (resolved or not).

outlinks(path: str | Path) -> list[ObsidianLink]

Parameter Type Default Description
path str | Path

Returns: list[ObsidianLink]

Method VaultIndex.notes_by_tag

Notes carrying a tag; nested tags match by prefix (a ⊇ a/b).

notes_by_tag(tag: str) -> list[str]

Parameter Type Default Description
tag str

Returns: list[str]

Method VaultIndex.tags

Tag -> note count over the whole vault.

tags() -> dict[str, int]

Returns: dict[str, int]

Method VaultIndex.aliases

Alias (lowercased) -> normalized note path.

aliases() -> dict[str, str]

Returns: dict[str, str]

Method VaultIndex.orphans

Notes with no resolved incoming and no outgoing links.

orphans() -> list[str]

Returns: list[str]

Method VaultIndex.unresolved

(from_path, raw_target) pairs for broken wikilinks.

unresolved() -> list[tuple[str, str]]

Returns: list[tuple[str, str]]

Attribute logger

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally