/obsidian-brain:linkfrom obsidian-brain
Cross-references related Obsidian vault notes with bidirectional wikilinks. Use when: (1) /link to auto-suggest connections for the current session, (2) /link <description> to link specific notes, (3) user wants to connect related notes.
Ships in obsidian-brain. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Search the Obsidian vault for notes related to the current session or a specific description, then create bidirectional wikilinks between them in their respective ## Related sections.
Tools needed: Bash, Grep, Read, Write, Edit
Follow these steps exactly. Do not skip steps or reorder them.
Run this as a command of its own:
git rev-parse --show-toplevel
If it fails (not a git repo), run pwd instead. Keep the printed path; the steps below call it <REPO_ROOT>. Paste that literal path wherever a block below names '<REPO_ROOT>', in single quotes (write a ' inside it as '\''). Do not put git inside $(...): a worktree-isolated session refuses any command substitution whose text contains git (#521).
Run:
cd '<REPO_ROOT>'
python3 -c '
import sys, os
import glob, json, os, re, sys
def _ob_hooks():
try:
for _m in json.load(open(os.path.expanduser("~/.claude/plugins/known_marketplaces.json"))).values():
_s = _m.get("source") if isinstance(_m, dict) else None
if not (isinstance(_s, dict) and _s.get("source") == "directory"):
continue
_i = _m.get("installLocation") if isinstance(_m, dict) else None
if not (isinstance(_i, str) and os.path.isabs(_i)):
continue
_h = os.path.join(_i, "hooks")
if os.path.isfile(os.path.join(_h, "obsidian_utils.py")):
return _h
except Exception:
pass
_c = [_d for _d in glob.glob(os.path.expanduser("~/.claude/plugins/cache/*/obsidian-brain/*/hooks")) if re.fullmatch("[0-9]+([.][0-9]+)*", _d.split("/")[-2])]
return max(_c, key=lambda _p: ([int(_n) for _n in _p.split("/")[-2].split(".")], _p), default="hooks")
sys.path.insert(0, _ob_hooks())
from obsidian_utils import load_config, canonical_project_name
c = load_config()
if not c.get("vault_path"):
print("ERROR: vault_path not configured", file=sys.stderr)
sys.exit(1)
print("VAULT=" + c["vault_path"])
print("SESS=" + c.get("sessions_folder", "claude-sessions"))
print("INS=" + c.get("insights_folder", "claude-insights"))
print("PROJECT=" + canonical_project_name())
'
Parse each output line as KEY=VALUE, splitting on the first =.
If the command exits non-zero or prints ERROR, tell the user:
Config not found. Run
/obsidian-setupfirst to configure your Obsidian vault.
Stop here if config is missing.
Run:
test -d "$VAULT_PATH/$SESSIONS_FOLDER" && test -d "$VAULT_PATH/$INSIGHTS_FOLDER" && echo "OK" || echo "FAIL"
If FAIL, tell the user:
The vault folders do not exist. Run
/obsidian-setupto fix this.
Stop here if FAIL.
Check if the user provided an argument after /link.
/link): Go to Step 4A — auto-suggest connections for the current session./link authentication flow notes): Go to Step 4B — explicit link by description.4A.1 — Derive project name:
Use the PROJECT value from Step 1 (the canonical project name; in a git worktree it is the main repo's name).
4A.2 — Find most recent session note for this project:
ls -t "$VAULT_PATH/$SESSIONS_FOLDER"/ | head -20
From that list, identify the most recent file whose name contains the project name (or whose frontmatter contains project: $PROJECT). If you cannot determine from the filename alone, use Grep:
pattern: "project: $PROJECT"
path: $VAULT_PATH/$SESSIONS_FOLDER/
output_mode: files_with_matches
Sort the matched files by modification time and pick the most recent one. This is the source note. Read its full content using the Read tool.
4A.3 — Extract keywords:
From the current conversation topics and the source note's content, identify 3-5 meaningful keywords or concepts. Prefer: technology names, method names, architectural terms, error types, product feature names. Avoid generic words like "session", "note", "file".
4A.4 — Search vault for related notes (parallel):
Run these searches in parallel using Grep, case-insensitive (-i: true):
For each keyword (run as parallel searches across both folders):
pattern: "<keyword>"
path: $VAULT_PATH/$SESSIONS_FOLDER/
output_mode: files_with_matches
-i: true
pattern: "<keyword>"
path: $VAULT_PATH/$INSIGHTS_FOLDER/
output_mode: files_with_matches
-i: true
Collect all matched files across all keywords. Exclude the source note itself.
4A.5 — Search by overlapping tags:
Read the source note's frontmatter and extract its tags: list. For each tag that starts with claude/topic/, run:
pattern: "<tag>"
path: $VAULT_PATH/$SESSIONS_FOLDER/
output_mode: files_with_matches
pattern: "<tag>"
path: $VAULT_PATH/$INSIGHTS_FOLDER/
output_mode: files_with_matches
Add any new matches to your candidate list, excluding the source note.
4A.6 — Rank candidates:
Score each candidate file:
Sort by score descending. Take the top 5.
4A.7 — Present candidates:
Suggested connections for this session:
- [[note-filename-without-extension]] — <reason: shares topics X and Y>
- [[note-filename-without-extension]] —
- [[note-filename-without-extension]] —
Which would you like to link? (e.g.
1,3orallornone)
Wait for the user's response. If none, stop. For each selected candidate, go to Step 5 with the source note and that candidate as the target.
4B.1 — Identify source note:
If the user's description contains "this session", "current session", or similar: use the PROJECT value from Step 1 and find the most recent session note for that project (same as Step 4A.2).
Otherwise, use the user's description to search for a source note:
pattern: "<keywords from description>"
path: $VAULT_PATH/$SESSIONS_FOLDER/
output_mode: files_with_matches
-i: true
pattern: "<keywords from description>"
path: $VAULT_PATH/$INSIGHTS_FOLDER/
output_mode: files_with_matches
-i: true
4B.2 — Identify target note:
Parse the user's description for target note clues. Search both folders:
pattern: "<target keywords>"
path: $VAULT_PATH/$SESSIONS_FOLDER/
output_mode: files_with_matches
-i: true
pattern: "<target keywords>"
path: $VAULT_PATH/$INSIGHTS_FOLDER/
output_mode: files_with_matches
-i: true
4B.3 — Resolve ambiguity:
If multiple matches were found for either source or target, present them and ask the user to pick:
Found multiple matches. Which note did you mean?
- [[note-filename-1]]
- [[note-filename-2]]
Wait for the user's selection. Once both source and target are unambiguously identified, go to Step 5.
For each source-target pair:
5.1 — Read the source note using the Read tool.
5.2 — Check for duplicate link in source:
Search the source note's content for [[target-filename]] (filename without .md). If the link already exists in the source, skip writing to the source and note it:
[[source-note]] already links to [[target-note]] — skipping source.
5.3 — Add link to source note:
If the source note has a ## Related section: use the Edit tool to append a new line to that section:
- [[target-filename]] — <one-line reason for the connection>
If no ## Related section exists: use the Edit tool to append the following to the end of the file:
## Related
- [[target-filename]] — <one-line reason for the connection>
Use the Write tool only if the note is very short or the Edit tool would be unreliable due to unclear anchor text.
After writing, set permissions:
chmod 600 "<source-note-path>"
5.4 — Read the target note using the Read tool.
5.5 — Check for duplicate link in target:
Search the target note's content for [[source-filename]]. If it already exists, skip writing to the target:
[[target-note]] already links back to [[source-note]] — skipping target.
5.6 — Add link to target note (mirror of 5.3, but reversed — source becomes the linked note):
If the target note has a ## Related section: append:
- [[source-filename]] — <one-line reason for the connection>
If no ## Related section: append:
## Related
- [[source-filename]] — <one-line reason for the connection>
After writing, set permissions:
chmod 600 "<target-note-path>"
For each linked pair, print:
Linked: [[source-note]] ↔ [[target-note]] Reason: Links are bidirectional — both notes now reference each other in their Related section.
If multiple pairs were linked, print a summary after all pairs are done:
All done. N bidirectional link(s) created.
/link again./link <specific description> to search manually..md extension: [[2026-04-04-obsidian-brain-297a]] not [[2026-04-04-obsidian-brain-297a.md]].ls the whole folder for matching./obsidian-setup again.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub abhattacherjee/obsidian-brain --plugin obsidian-brain21 skills in this plugin
/check-itemsTriage open `- [ ]` items across your Obsidian vault with evidence-grounded AI classification. Auto-closes items shipped by merged PRs, surfaces items needing external action (e.g. `gh issue close`), hides stale items by default. Replaces the old token-overlap heuristic with a two-pass AI pipeline backed by a persistence cache. Use when: (1) sweeping a project for done work, (2) auditing what's still actionable, (3) recovering from /recall deferral fatigue./compressInteractively saves curated insights from the current Claude Code session to the Obsidian vault. Use when: (1) /compress command to save session insights, (2) /compress <topic> to extract a specific topic, (3) user wants to capture decisions, patterns, solutions, or error fixes from the current session./consolidateBatch-cluster vault notes into named themes. Use when: (1) /consolidate to seed themes from unassigned notes, (2) /consolidate stats, (3) /consolidate split <id>, (4) /consolidate merge <a> <b>, (5) /consolidate --full to wipe and recluster everything./decideCaptures architectural and technical decisions as ADR-lite notes in the Obsidian vault. Use when: (1) /decide command to record a decision from the current session, (2) /decide <decision summary> to capture a specific decision, (3) user wants to document why a particular technical choice was made./dev-testInstall dev version of obsidian-brain into the plugin cache for local testing, or restore the original. Note: on a directory-source marketplace install the skills already load the checkout (#278), so install is only needed for github-source installs and the cache-asserting test scripts. Use when: (1) /dev-test install to test unreleased changes, (2) /dev-test restore to put back the original, (3) /dev-test to check current status./emergeSurface unnamed patterns across vault themes. Use when: (1) /emerge for last 30 days, (2) /emerge 14d for custom window, (3) /emerge this week.