/obsidian-brain:obsidian-setupfrom obsidian-brain
First-run configuration and upgrade for the Obsidian Brain plugin. Sets up vault path, creates folders, copies dashboard templates, configures hookify nudges, and writes config. Idempotent — safe to re-run to pick up new features without overwriting existing config or dashboards. Use when: (1) first time installing obsidian-brain, (2) changing vault path, (3) /obsidian-setup command, (4) upgrading to a new version.
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.
Configure the obsidian-brain plugin for first use. This skill validates prerequisites, creates vault folders, installs dashboard templates, writes the config file, and verifies everything works.
Tools needed: Bash, Write, Read
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).
Argument handling: If the user ran /obsidian-setup --deps, skip the existing-config detection and jump directly to Step 8.7 (Performance Dependencies). --deps re-triggers the dependency prompt regardless of the optional_deps_prompted flag in config. After Step 8.7 completes, skip to Step 10 (success message).
Check for existing config:
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
c = load_config()
vp = c.get("vault_path", "")
if vp:
sess = c.get("sessions_folder", "claude-sessions")
ins = c.get("insights_folder", "claude-insights")
dash = c.get("dashboards_folder", "claude-dashboards")
chk = c.get("check_items_folder", "claude-check-items")
print(f"EXISTING")
print(f"VAULT={vp}")
print(f"SESS={sess}")
print(f"INS={ins}")
print(f"DASH={dash}")
print(f"CHK={chk}")
else:
print("NO_CONFIG")
'
If the output starts with EXISTING, parse each subsequent line as KEY=VALUE, splitting on the first =. Extract VAULT_PATH and present:
Existing obsidian-brain installation detected.
- Vault path:
<vault_path from config>Would you like to:
- upgrade — add new features (dashboards, nudges) without touching existing config or dashboards
- reconfigure — start fresh (will overwrite config and dashboards)
- cancel — exit setup
If upgrade: store MODE=upgrade. Store VAULT_PATH from the existing config's vault_path field. Also extract sessions_folder (default claude-sessions), insights_folder (default claude-insights), dashboards_folder (default claude-dashboards), and check_items_folder (default claude-check-items). Skip to Step 5 (Create vault folders — mkdir -p is already safe). In upgrade mode:
mkdir -p is idempotent)test -f before each write)optional_deps_prompted/optional_deps_declined config fields; users with declined deps are NOT re-prompted unless they explicitly run /obsidian-setup --depsIf reconfigure: store MODE=reconfigure. Proceed to Step 2 (Ask for vault path) as normal — full setup flow.
If cancel: stop here.
If the output is NO_CONFIG: store MODE=fresh. Proceed to Step 2 (Ask for vault path) — first-time setup.
Before any out-of-workspace writes, test whether Claude Code can write to ~/.claude/:
echo "test" > ~/.claude/.obsidian-brain-canary 2>&1 && rm -f ~/.claude/.obsidian-brain-canary && echo "OK" || echo "FAIL"
If OK: proceed silently to Step 2.
If FAIL: present the following message using AskUserQuestion:
Heads up — setup needs write access outside this project directory.
Obsidian Brain writes config to
~/.claude/and notes to your Obsidian vault. Your current Claude Code permissions block writes outside the working directory.Choose how to fix this:
Switch permission mode (recommended) — Press
Shift+Tabto switch to "accept edits" mode for this session. Or use/configto changepermissions.defaultModepermanently. Then re-run/obsidian-setup.Whitelist paths permanently — Add
$HOME/.claudeand your vault's parent directory tosandbox.filesystem.allowWritein~/.claude/settings.json. Use absolute paths —~is not expanded inside JSON string values:{ "sandbox": { "filesystem": { "allowWrite": ["/Users/you/.claude", "/Users/you/Documents/vault-parent"] } } }Replace
/Users/youwith your actual home directory (runecho $HOMEto find it). Then re-run/obsidian-setup.I'll handle it myself — Continue setup and approve or fix writes as they come up.
Behavior per option:
/obsidian-setup.MODE=upgrade), substitute the known vault parent path from the existing config. In fresh mode, show only the $HOME/.claude entry with a note that the vault parent must be added after the user provides the vault path. Then stop. User edits settings and re-runs.Ask the user:
What is the absolute path to your Obsidian vault? (e.g.
/Users/you/obsidian/my-vault)
Store the response as VAULT_PATH. Strip any trailing slash.
Run:
test -d "$VAULT_PATH" && test -w "$VAULT_PATH" && echo "OK" || echo "FAIL"
If FAIL, tell the user the path does not exist or is not writable and ask them to correct it. Repeat until OK.
Run:
which claude && echo "OK" || echo "FAIL"
If FAIL, warn the user:
The
claudeCLI was not found on PATH. Hook-based AI summarization will not work until it is installed. You can continue setup, but session notes will be raw (unsummarized) untilclaudeis available.
Continue regardless — this is a warning, not a blocker.
First, test that the vault path is writable:
echo "test" > "$VAULT_PATH/.obsidian-brain-canary" 2>&1 && rm -f "$VAULT_PATH/.obsidian-brain-canary" && echo "OK" || echo "FAIL"
If FAIL, tell the user:
Cannot write to your vault at
$VAULT_PATH. This is likely a sandbox restriction. Add your vault's parent directory tosandbox.filesystem.allowWritein~/.claude/settings.json, or switch to "accept edits" mode (Shift+Tab), then re-run/obsidian-setup.
Stop here if FAIL.
If OK, create the folders:
mkdir -p "$VAULT_PATH/claude-sessions" "$VAULT_PATH/claude-insights" "$VAULT_PATH/claude-insights/lessons" "$VAULT_PATH/claude-dashboards" "$VAULT_PATH/claude-wiki"
claude-insights/lessons/ holds the generated retro lesson notes (#471). retro_rollup.py rewrites them; the vault index skips them (type: claude-lesson).
For each dashboard file below, check if it already exists before writing:
test -f "$VAULT_PATH/claude-dashboards/<filename>" && echo "EXISTS" || echo "MISSING"
If EXISTS and MODE=upgrade, skip this file — preserve user customizations.
Otherwise (MISSING, or MODE=fresh, or MODE=reconfigure), write the file using the Write tool.
Dashboard files to install:
File: $VAULT_PATH/claude-dashboards/sessions-overview.md
# Claude Sessions Overview
## Recent Sessions
\```dataview
TABLE date, project, git_branch, duration_minutes
FROM "claude-sessions"
WHERE type = "claude-session"
SORT date DESC
LIMIT 20
\```
## Recent Insights
\```dataview
TABLE date, project, tags
FROM "claude-insights"
WHERE type = "claude-insight" AND (!status OR !startswith(lower(string(status)), "provisional"))
SORT date DESC
LIMIT 10
\```
## Active Decisions
\```dataview
TABLE date, project
FROM "claude-insights"
WHERE type = "claude-decision" AND status = "active"
SORT date DESC
LIMIT 20
\```
File: $VAULT_PATH/claude-dashboards/project-index.md
# Project Index
## Sessions by Project
\```dataview
TABLE length(rows) AS "Sessions", min(rows.date) AS "First", max(rows.date) AS "Last"
FROM "claude-sessions"
WHERE type = "claude-session"
GROUP BY project
SORT length(rows) DESC
\```
## Error Fixes (troubleshooting library)
\```dataview
TABLE date, project
FROM "claude-insights"
WHERE type = "claude-error-fix" AND (!status OR !startswith(lower(string(status)), "provisional"))
SORT date DESC
LIMIT 50
\```
File: $VAULT_PATH/claude-dashboards/weekly-review.md
# This Week in Claude
\```dataview
TABLE date, project, type
FROM "claude-sessions" OR "claude-insights"
WHERE date >= date(today) - dur(7 days) AND (!status OR !startswith(lower(string(status)), "provisional"))
SORT date DESC
LIMIT 100
\```
File: $VAULT_PATH/claude-dashboards/learning-velocity.md
# Learning Velocity
## Topics by Frequency
\```dataviewjs
let pages = dv.pages('"claude-insights"')
.where(p => !p.status || !String(p.status).toLowerCase().startsWith("provisional"))
.where(p => p.tags);
let topics = {};
for (let p of pages) {
let tags = p.tags || [];
if (!Array.isArray(tags)) tags = [tags];
for (let tag of tags) {
if (typeof tag === 'string' && tag.startsWith("claude/topic/")) {
let topic = tag.replace("claude/topic/", "");
topics[topic] = (topics[topic] || 0) + 1;
}
}
}
dv.table(
["Topic", "Notes"],
Object.entries(topics)
.sort((a, b) => b[1] - a[1])
.map(([topic, count]) => [topic, count])
);
\```
## Recent Retrospectives
\```dataview
TABLE date, project
FROM "claude-insights"
WHERE type = "claude-retro"
SORT date DESC
LIMIT 10
\```
## Error Patterns (Most Common)
\```dataviewjs
let pages = dv.pages('"claude-insights"')
.where(p => !p.status || !String(p.status).toLowerCase().startsWith("provisional"))
.where(p => p.type === "claude-error-fix");
let topics = {};
for (let p of pages) {
let tags = p.tags || [];
if (!Array.isArray(tags)) tags = [tags];
for (let tag of tags) {
if (typeof tag === 'string' && tag.startsWith("claude/topic/")) {
let topic = tag.replace("claude/topic/", "");
topics[topic] = (topics[topic] || 0) + 1;
}
}
}
dv.table(
["Error Topic", "Occurrences"],
Object.entries(topics)
.sort((a, b) => b[1] - a[1])
.slice(0, 15)
.map(([topic, count]) => [topic, count])
);
\```
File: $VAULT_PATH/claude-dashboards/decision-timeline.md
# Decision Timeline
## Active Decisions
\```dataview
TABLE date, project
FROM "claude-insights"
WHERE type = "claude-decision" AND status = "active"
SORT date DESC
LIMIT 50
\```
## All Decisions (Chronological)
\```dataview
TABLE date, project, status
FROM "claude-insights"
WHERE type = "claude-decision" AND (!status OR !startswith(lower(string(status)), "provisional"))
SORT date DESC
LIMIT 50
\```
## Superseded Decisions
\```dataview
TABLE date, project
FROM "claude-insights"
WHERE type = "claude-decision" AND status = "superseded"
SORT date DESC
LIMIT 50
\```
## Decisions by Project
\```dataview
TABLE length(rows) AS "Decisions", min(rows.date) AS "First", max(rows.date) AS "Last"
FROM "claude-insights"
WHERE type = "claude-decision" AND (!status OR !startswith(lower(string(status)), "provisional"))
GROUP BY project
SORT length(rows) DESC
\```
File: $VAULT_PATH/claude-dashboards/open-items.md
# Open Items — All Projects
Cross-project view of all unchecked `- [ ]` items from session notes' `## Open Questions / Next Steps` sections, scoped to the last 90 days. Items older than 90 days fall off this view — use `/check-items` (unbounded) or `/vault-search` to find them.
\```dataviewjs
// Single-pass: scan all sessions in the last 90 days exactly once,
// build a master list, then render each section from in-memory data.
const cutoff90 = dv.date("today").minus(dv.duration("90 days"));
const cutoff30 = dv.date("today").minus(dv.duration("30 days"));
const cutoff7 = dv.date("today").minus(dv.duration("7 days"));
const pages = dv.pages('"claude-sessions"')
.where(p => p.type === "claude-session" && p.date && p.date >= cutoff90);
const allItems = [];
for (const p of pages) {
const content = await dv.io.load(p.file.path);
if (!content) continue;
// CRLF-tolerant: \r?\n in lookahead, split on /\r?\n/
const match = content.match(/## Open Questions[^\r\n]*\r?\n([\s\S]*?)(?=\r?\n## |\r?\n# |$)/);
if (!match) continue;
const lines = match[1].split(/\r?\n/);
for (const line of lines) {
const m = line.match(/^- \[ \] (.+?)\s*$/);
if (m) {
allItems.push({
project: p.project || "unknown",
item: m[1],
date: p.date,
file: p.file.link
});
}
}
}
// ----- By Project -----
dv.header(2, "By Project");
if (allItems.length === 0) {
dv.paragraph("No open items in the last 90 days.");
} else {
const byProject = {};
for (const i of allItems) {
if (!byProject[i.project]) byProject[i.project] = [];
byProject[i.project].push(i);
}
const projectNames = Object.keys(byProject).sort();
for (const project of projectNames) {
const items = byProject[project];
dv.header(3, project + " (" + items.length + ")");
// Render as table to preserve clickable file link
dv.table(
["Item", "Source"],
items.map(i => [i.item, i.file])
);
}
}
// ----- Recent (last 7 days) -----
dv.header(2, "Recent (last 7 days)");
const recent = allItems.filter(i => i.date >= cutoff7);
if (recent.length === 0) {
dv.paragraph("No open items from sessions in the last 7 days.");
} else {
dv.table(
["Project", "Item", "Source"],
recent.map(i => [i.project, i.item, i.file])
);
}
// ----- Items from sessions 30-90 days ago -----
dv.header(2, "Items from sessions 30-90 days ago");
dv.paragraph("These are unchecked items captured in session notes that are 30-90 days old. The same item may also appear in a more recent session — in that case it will also show in the \"Recent\" section above. Filter is by source session date, not by item-tracking duration.");
const stale = allItems
.filter(i => i.date < cutoff30)
.sort((a, b) => a.date - b.date);
if (stale.length === 0) {
dv.paragraph("No items from sessions 30-90 days ago.");
} else {
dv.table(
["Project", "Item", "From", "Source"],
stale.map(i => [i.project, i.item, i.date.toFormat("yyyy-MM-dd"), i.file])
);
}
// ----- Stats -----
dv.header(2, "Stats");
const statsByProject = {};
let oldestDate = null;
for (const i of allItems) {
statsByProject[i.project] = (statsByProject[i.project] || 0) + 1;
if (!oldestDate || i.date < oldestDate) oldestDate = i.date;
}
dv.paragraph("**Total open items (last 90 days):** " + allItems.length);
dv.paragraph("**Projects with open items:** " + Object.keys(statsByProject).length);
if (oldestDate) {
dv.paragraph("**Oldest open item from:** " + oldestDate.toFormat("yyyy-MM-dd"));
}
if (Object.keys(statsByProject).length > 0) {
dv.table(
["Project", "Open Items"],
Object.entries(statsByProject).sort((a, b) => b[1] - a[1])
);
}
\```
File: $VAULT_PATH/claude-dashboards/retro-lessons.md
# Retro Lessons
Lessons that came back across sessions, from the retro notes' `## Process Improvements` items. Each row is one lesson note in `claude-insights/lessons/`, rebuilt by `retro_rollup.py`. Rows are ranked by sessions in the last 90 days (the `lessons_recent_days` setting), then all sessions. Snoozed lessons are hidden until their date.
## 1. Raise priority
An open issue exists, and the lesson kept coming back after it was opened.
\```dataview
TABLE WITHOUT ID link(file.link, name) AS "Lesson", recent_sessions AS "Recent", sessions AS "Sessions", sessions_after_tracking AS "Since issue", tracking_ref AS "Issue", issue_milestone AS "Milestone", issue_priority AS "Priority"
FROM "claude-insights/lessons"
WHERE type = "claude-lesson" AND bucket = "raise" AND !dormant AND (!snoozed_until OR date(snoozed_until) < date(today)) AND (!status OR !startswith(lower(string(status)), "provisional"))
SORT recent_sessions DESC, sessions DESC
LIMIT 25
\```
## 2. File an issue
No issue, memory entry or rule tracks the lesson, or its tracking is gone.
\```dataview
TABLE WITHOUT ID link(file.link, name) AS "Lesson", recent_sessions AS "Recent", sessions AS "Sessions", length(projects) AS "Projects", first_seen AS "First seen", last_seen AS "Last seen", tracking AS "Tracking"
FROM "claude-insights/lessons"
WHERE type = "claude-lesson" AND bucket = "file" AND !dormant AND (!snoozed_until OR date(snoozed_until) < date(today)) AND (!status OR !startswith(lower(string(status)), "provisional"))
SORT recent_sessions DESC, sessions DESC
LIMIT 25
\```
## 3. Fix didn't hold
The issue closed, then the lesson came back.
\```dataview
TABLE WITHOUT ID link(file.link, name) AS "Lesson", recent_sessions AS "Recent", sessions AS "Sessions", tracking_ref AS "Issue", tracking_since AS "Opened"
FROM "claude-insights/lessons"
WHERE type = "claude-lesson" AND bucket = "didnt_hold" AND !dormant AND (!snoozed_until OR date(snoozed_until) < date(today)) AND (!status OR !startswith(lower(string(status)), "provisional"))
SORT recent_sessions DESC, sessions DESC
LIMIT 25
\```
## 4. Rule not followed
A memory entry or a skill or CLAUDE.md rule exists, and the lesson still comes back.
\```dataview
TABLE WITHOUT ID link(file.link, name) AS "Lesson", recent_sessions AS "Recent", sessions AS "Sessions", sessions_after_tracking AS "Since rule", tracking_ref AS "Tracked by"
FROM "claude-insights/lessons"
WHERE type = "claude-lesson" AND bucket = "rule_not_followed" AND !dormant AND (!snoozed_until OR date(snoozed_until) < date(today)) AND (!status OR !startswith(lower(string(status)), "provisional"))
SORT recent_sessions DESC, sessions DESC
LIMIT 25
\```
## 5. Tracked and quiet
Tracking exists and nothing came back since.
\```dataview
TABLE WITHOUT ID link(file.link, name) AS "Lesson", sessions AS "Sessions", tracking AS "Tracking", tracking_ref AS "Tracked by", last_seen AS "Last seen"
FROM "claude-insights/lessons"
WHERE type = "claude-lesson" AND bucket = "quiet" AND !dormant AND (!snoozed_until OR date(snoozed_until) < date(today)) AND (!status OR !startswith(lower(string(status)), "provisional"))
SORT sessions DESC
LIMIT 25
\```
## Dormant
No session in the last 90 days. Probably fixed, or no longer relevant.
\```dataview
TABLE WITHOUT ID link(file.link, name) AS "Lesson", sessions AS "Sessions", bucket AS "Bucket", last_seen AS "Last seen"
FROM "claude-insights/lessons"
WHERE type = "claude-lesson" AND dormant AND (!snoozed_until OR date(snoozed_until) < date(today)) AND (!status OR !startswith(lower(string(status)), "provisional"))
SORT last_seen DESC
LIMIT 25
\```
Important: The backslash before the triple backticks above is an escape for this document only. When writing the actual files, use plain triple backticks (no backslash).
If MODE=upgrade: Skip this step — preserve existing config. Keys added since the config was written (for example the four lessons_* / project_repos keys from #471) take their defaults from obsidian_utils._DEFAULTS at load time, so nothing needs writing.
If MODE=fresh or MODE=reconfigure:
Write ~/.claude/obsidian-brain-config.json with this exact structure:
{
"vault_path": "<VAULT_PATH value from Step 2>",
"sessions_folder": "claude-sessions",
"insights_folder": "claude-insights",
"dashboards_folder": "claude-dashboards",
"check_items_folder": "claude-check-items",
"wiki_folder": "claude-wiki",
"min_messages": 3,
"min_duration_minutes": 2,
"summary_model": "haiku",
"auto_log_enabled": true,
"snapshot_on_compact": true,
"snapshot_on_clear": true,
"lessons_enabled": true,
"lessons_recent_days": 90,
"lessons_concurrency": 8,
"project_repos": {}
}
Replace <VAULT_PATH value from Step 2> with the actual vault path. Ensure the file is valid JSON.
First run mkdir -p ~/.claude to ensure the directory exists.
After writing the config file, restrict permissions so only the current user can read it:
chmod 600 ~/.claude/obsidian-brain-config.json
After writing the config, inspect the final snapshot_on_clear and snapshot_on_compact values. If either is False (for instance, when migrating from an older config), warn the user:
⚠
snapshot_on_clearis False — /clear will not preserve pre-clear context. Recommended: True. (This is on by default; only change if you have a specific reason.)
Both flags ship true by default, so the warning only fires when a prior config, manual edit, or migration set them false. Ask the user whether to flip them back to true via /vault-config before continuing.
Run:
TESTFILE="$VAULT_PATH/claude-sessions/.obsidian-brain-test-$$"
echo "test" > "$TESTFILE" && test -f "$TESTFILE" && rm "$TESTFILE" && echo "OK" || echo "FAIL"
If FAIL, warn that vault writes are not working and ask the user to check permissions.
Build (or rebuild) the SQLite FTS5 index for fast vault search and context-driven insight loading:
python3 -c '
import sys, os, json, glob
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, indexed_folders
from vault_index import rebuild_index
try:
# fresh=True: Step 7 may have just rewritten the config this session.
cfg = load_config(fresh=True)
# An unreadable config falls back to defaults (vault_path ""); its
# default folders would make the rebuild prune every custom folder.
if cfg.get("vault_path") != sys.argv[1]:
raise ValueError("config vault_path %r does not match %r (config unreadable or changed)" % (cfg.get("vault_path"), sys.argv[1]))
folders = indexed_folders(cfg, strict=True)
except ValueError as exc:
print(f"ERROR: {exc}", file=sys.stderr)
sys.exit(1)
counts = rebuild_index(sys.argv[1], folders)
print(json.dumps(counts))
' "$VAULT_PATH"
Parse the JSON output. If successful, store N = counts["inserted"] for the success message.
If the command fails (non-zero exit), warn but do not block setup:
⚠️ Could not build vault index. Run
/vault-reindexmanually after setup.
Phase 2 theme clustering can use numpy (vectorized TF-IDF) and scipy (agglomerative batch clustering) for ~4-5x speedups on large vaults. They are strictly optional — every feature works on pure-Python stdlib fallbacks.
Idempotent detection. Load the current config + installed status:
cd '<REPO_ROOT>'
python3 -c '
import sys, os, json
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 check_optional_deps, load_config
cfg = load_config()
status = check_optional_deps()
print("NUMPY=" + ("1" if status["numpy"] else "0"))
print("SCIPY=" + ("1" if status["scipy"] else "0"))
print("PROMPTED=" + ("1" if cfg.get("optional_deps_prompted") else "0"))
print("DECLINED=" + ",".join(cfg.get("optional_deps_declined", [])))
'
Parse each line as KEY=VALUE.
Decision tree:
NUMPY=1 and SCIPY=1 → both installed; skip the prompt entirely. Log one line [setup] numpy + scipy available — theme clustering will use fast paths. and continue to Step 9.PROMPTED=1 AND every missing package appears in DECLINED AND this run was NOT invoked with --deps → user already declined; skip the prompt silently. Continue to Step 9.Prompt the user using AskUserQuestion:
Optional performance dependencies for Phase 2 theme clustering:
numpy: [installed / not installed] scipy: [installed / not installed]
These accelerate batch clustering and TF-IDF math (numpy ~5x, scipy ~4x). Without them, everything still works via pure-Python stdlib fallbacks — daily use is unaffected; only bulk /consolidate runs are slower at very large vault sizes.
- Install missing packages (runs
python3 -m pip install --user <missing>)- Skip — remember my choice (won't ask again; re-trigger anytime with
/obsidian-setup --deps)- Not now — ask again next time
Apply the choice:
python3 -m pip install --user for every missing package. Report success/failure for each. After install, update config:cd '<REPO_ROOT>'
python3 -c '
import sys, os, json, tempfile
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 pathlib import Path
cfg_path = Path.home() / ".claude" / "obsidian-brain-config.json"
try:
cfg = json.loads(cfg_path.read_text())
except FileNotFoundError:
cfg = {}
cfg["optional_deps_prompted"] = True
declined = set(cfg.get("optional_deps_declined", []))
for pkg in ("numpy", "scipy"):
try:
__import__(pkg)
declined.discard(pkg)
except ImportError:
pass
cfg["optional_deps_declined"] = sorted(declined)
fd, tmp_path = tempfile.mkstemp(prefix=".obsidian-brain-config-", suffix=".json.tmp", dir=os.path.dirname(cfg_path))
try:
with os.fdopen(fd, "w") as f:
json.dump(cfg, f, indent=2)
f.flush()
os.fsync(f.fileno())
os.chmod(tmp_path, 0o600)
os.replace(tmp_path, cfg_path)
except Exception:
try:
os.unlink(tmp_path)
except OSError:
pass
raise
print("OK")
'
If pip itself is missing or the install fails (restricted environments, e.g. Homebrew-managed Python), print the failure and continue — all features still work.
optional_deps_declined:cd '<REPO_ROOT>'
python3 - <<'PY'
import json, os, tempfile
from pathlib import Path
cfg_path = Path.home() / ".claude" / "obsidian-brain-config.json"
try:
cfg = json.loads(cfg_path.read_text())
except FileNotFoundError:
cfg = {}
cfg["optional_deps_prompted"] = True
missing = []
for pkg in ("numpy", "scipy"):
try:
__import__(pkg)
except ImportError:
missing.append(pkg)
declined = sorted(set(cfg.get("optional_deps_declined", [])) | set(missing))
cfg["optional_deps_declined"] = declined
fd, tmp_path = tempfile.mkstemp(prefix=".obsidian-brain-config-", suffix=".json.tmp", dir=os.path.dirname(cfg_path))
try:
with os.fdopen(fd, "w") as f:
json.dump(cfg, f, indent=2)
f.flush()
os.fsync(f.fileno())
os.chmod(tmp_path, 0o600)
os.replace(tmp_path, cfg_path)
except Exception:
try:
os.unlink(tmp_path)
except OSError:
pass
raise
print("OK")
PY
/obsidian-setup run will re-prompt.Check if the skill-kit:extract-to-compress nudge (rule file and name keep the old claudeception spelling) is already configured globally (in ~/.claude/, not the project .claude/):
test -f ~/.claude/hookify.claudeception-compress-nudge.local.md && echo "EXISTS" || echo "MISSING"
If EXISTS, skip this step — the nudge is already configured.
If MISSING, write the hookify rule file directly to ~/.claude/ using the Write tool:
File: ~/.claude/hookify.claudeception-compress-nudge.local.md
---
name: claudeception-compress-nudge
enabled: true
event: stop
pattern: Result:\s*PASS|\.claude/skills/[^/]+/SKILL\.md|created skill|skill file written|extracted knowledge
action: warn
---
💡 **skill-kit:extract (was claudeception) extracted knowledge from this session.** Run `/compress` to save it to your Obsidian vault.
Important: This rule MUST be in ~/.claude/ (global), not the project's .claude/ directory. The nudge should trigger in any project where skill-kit:extract runs, not just obsidian-brain.
This is a soft nudge — a non-blocking suggestion, not automatic execution.
If MODE=upgrade:
Obsidian Brain upgraded!
- Vault path:
<VAULT_PATH>(unchanged)- Config: preserved (unchanged)
- New dashboards: installed (existing dashboards preserved)
- skill-kit:extract nudge: configured
- Vault index: N notes indexed (run
/vault-reindexto rebuild) — or omit this line if Step 8.5 failedRe-run
/obsidian-setupanytime to pick up new features.
If MODE=fresh or MODE=reconfigure:
Obsidian Brain setup complete!
- Vault path:
<VAULT_PATH>- Config written to:
~/.claude/obsidian-brain-config.json- Folders created:
claude-sessions/,claude-insights/,claude-insights/lessons/,claude-dashboards/,claude-wiki/- Dashboards installed:
sessions-overview.md,project-index.md,weekly-review.md,learning-velocity.md,decision-timeline.md,open-items.md,retro-lessons.md- skill-kit:extract nudge: configured (run
/compressreminder after knowledge extraction)- Vault index: N notes indexed (run
/vault-reindexto rebuild) — or omit this line if Step 8.5 failedNext step — install the Dataview plugin in Obsidian:
- Open Obsidian Settings > Community Plugins > Browse
- Search for "Dataview" and install it
- Enable the plugin, then go to Dataview settings and turn on:
- Enable JavaScript Queries
- Enable Inline Queries
- The dashboards in
claude-dashboards/will start rendering automaticallyHooks are already registered via
hooks.json— session logging will begin on your next Claude Code session.
What SKILL.md sets; muted values are Claude Code's defaults
21 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./Other plugins' skills for the same job
npx claudepluginhub abhattacherjee/obsidian-brain --plugin obsidian-brain