/obsidian-brain:decidefrom obsidian-brain
Captures 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.
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.
Capture architectural and technical decisions with full context as ADR-lite (Architecture Decision Record) notes in the Obsidian vault. Each decision records the context, options considered, rationale, and trade-offs accepted.
Tools needed: Bash, Read, Write
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
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"))
'
Parse each output line as KEY=VALUE, splitting on the first =.
If the file does not exist or is invalid JSON, tell the user:
Config not found. Please run
/obsidian-setupfirst to configure your Obsidian vault.
Stop here if config is missing.
Run:
test -d "$VAULT_PATH/$INSIGHTS_FOLDER" && test -w "$VAULT_PATH/$INSIGHTS_FOLDER" && echo "OK" || echo "FAIL"
If FAIL, tell the user:
The insights folder
$VAULT_PATH/$INSIGHTS_FOLDERdoes not exist or is not writable. Run/obsidian-setupto fix this.
Stop here if FAIL.
Check if the user provided an argument after /decide.
/decide use Redis for rate limiting): Use the argument as the decision summary and analyze the conversation for supporting context around that decision./decide): Analyze the full conversation to identify the most recent or most significant architectural/technical decision made during the session. Present it to the user for confirmation:Decision detected:
Is this the decision you want to record, or would you like to specify a different one?
Wait for confirmation before proceeding.
Analyze the conversation thoroughly and draft the decision note with these sections:
Context — 2-4 sentences explaining what problem or situation prompted this decision. What were the requirements or constraints?
Options Considered — A numbered list of alternatives that were discussed or could have been considered. For each option, include a brief description (1-2 sentences).
Decision — A clear statement of what was chosen. 1-3 sentences.
Rationale — Why this option was selected over the alternatives. What factors tipped the balance? 2-4 sentences.
Consequences — What trade-offs were accepted by making this decision. Include both positive outcomes and negative trade-offs. Bulleted list of 2-5 items.
Based on the decision content, generate 1-3 topic tags. Tags should be lowercase, hyphenated, and specific. Examples:
claude/topic/caching-strategyclaude/topic/database-choiceclaude/topic/api-designclaude/topic/auth-architecturePresent the full note to the user including frontmatter:
---
type: claude-decision
date: YYYY-MM-DD
created_at: <ISO-8601-UTC>
source_session: <current-session-id>
source_session_note: "[[<session-note-filename>]]"
project: <project-name>
status: active
tags:
- claude/decision
- claude/project/<project-name>
- claude/topic/<auto-generated-topic-1>
- claude/topic/<auto-generated-topic-2>
---
# <Decision Title>
## Context
<What problem prompted this decision>
## Options Considered
1. **<Option A>** — <brief description>
2. **<Option B>** — <brief description>
3. **<Option C>** — <brief description>
## Decision
<What was chosen>
## Rationale
<Why this option won>
## Consequences
- <positive or negative trade-off>
- <positive or negative trade-off>
- <positive or negative trade-off>
Where:
YYYY-MM-DD is today's date
<ISO-8601-UTC> is the current UTC timestamp at second precision. Get it via:
python3 -c 'from datetime import datetime, timezone; print(datetime.now(timezone.utc).isoformat(timespec="seconds"))'
Example: 2026-04-24T18:42:11+00:00
<current-session-id> and <session-note-filename> are derived together. Get session context via the shared helper:
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, get_session_context
try:
from obsidian_utils import resolve_source_session_note
except ImportError:
def resolve_source_session_note(_n="", *_a): return _n
print("WARN: stale obsidian-brain hooks; falling back to the pre-#330 unguarded backlink", file=sys.stderr)
c = load_config()
ctx = get_session_context(c["vault_path"], c.get("sessions_folder", "claude-sessions"))
resolved_note = resolve_source_session_note(ctx["session_note_name"], ctx["session_id"], c["vault_path"], c.get("sessions_folder", "claude-sessions"))
print("SID=" + ctx["session_id"] + " HASH=" + ctx["hash"] + " PROJECT=" + ctx["project"] + " SESSION_NOTE=" + ctx["session_note_name"] + " RESOLVED_NOTE=" + resolved_note)
'
Parse the output to get SESSION_ID, HASH, PROJECT, SESSION_NOTE, and RESOLVED_NOTE.
Important: If SESSION_ID is unknown, use unknown for source_session and omit source_session_note entirely. Otherwise, use RESOLVED_NOTE (not SESSION_NOTE) for the source_session_note wikilink — RESOLVED_NOTE is the note name in the normal case (target absent yet, a forward reference, or present and agreeing) and "" ONLY when the target note exists, parses, and its own session_id frontmatter CONTRADICTS SESSION_ID (#330). When RESOLVED_NOTE is empty, omit source_session_note entirely even though SESSION_ID is known (omit the line — do not write source_session_note: "").
<project-name> is the PROJECT value from get_session_context() (the canonical project name: the main repo's name, also inside a git worktree)
The source_session_note field creates an Obsidian backlink to the source session note
Ask the user:
Preview above. Would you like to:
- save as-is
- edit tags — add or remove tags
- edit content — tell me what to change
- cancel — discard this decision
Wait for the user's response. Apply any requested edits and show the updated preview. Repeat until the user says save or cancel.
If cancel, stop here.
Construct the filename from these parts:
YYYY-MM-DD (today)date +%s | md5 | cut -c29-32 (macOS) or date +%s | md5sum | cut -c1-4 (Linux). Do NOT use tail -c 4 — it counts the trailing newline as a byte and returns only 3 visible characters.-decisionFinal filename: YYYY-MM-DD-<slug>-<hash>-decision.md
Example: 2026-04-04-use-redis-for-rate-limiting-a3f2-decision.md
Run the note-writer CLI, passing the note file with --body-file, so no note text goes into the Bash command (#517). It creates $INSIGHTS_FOLDER if needed and writes the file atomically at mode 0o600 — no mkdir/chmod needed. The HOOKS= line below checks the marketplace-registered directory-source install location FIRST (#278 — on a local checkout that is what loads, not the released cache), and only falls back to the plugin cache, where it sorts versions numerically (a plain max() is lexicographic and picks 3.9.0 over 3.10.0, resolving to a cache with no note_writer.py); the test -f line turns a stale/incomplete cache into the documented ERROR: shape instead of a raw Python can't open file message.
Write the note with the Write tool to ~/.claude/obsidian-brain/<draft-id>-<filename>, using the same filename the command below passes (expand ~ to your home directory; run echo "$HOME" if you do not know it). <draft-id> is 8 random hex characters you pick once per run, so two runs are very unlikely to share a draft file. That path is <BODY_FILE>. The file holds the whole note, shaped like this:
---
type: claude-decision
...
---
# <Decision Title>
...
cd '<REPO_ROOT>'
HOOKS=$(python3 -c "
import glob, json, os, re
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')
print(_ob_hooks())
")
if ! test -f "$HOOKS/note_writer.py"; then echo "ERROR: note_writer.py not found under $HOOKS - resolution checks the marketplace registered install location first, then falls back to the plugin cache; neither path produced a hooks directory containing it. Verify the obsidian-brain install resolved at $HOOKS is complete (git pull for a directory-source checkout, or run /plugin marketplace update for a cache install), then retry." >&2; exit 1; fi
python3 "$HOOKS/note_writer.py" write "$VAULT_PATH" "$INSIGHTS_FOLDER" "YYYY-MM-DD-<slug>-<hash>-decision.md" --body-file '<BODY_FILE>'
After an OK: line, run rm -f '<BODY_FILE>' (the literal path). If the command fails, keep <BODY_FILE> and tell the user its path, so the note text is not lost.
On success this prints OK: <absolute path> — that is the file at $VAULT_PATH/$INSIGHTS_FOLDER/<filename>. On failure it prints ERROR: <reason> to stderr and exits non-zero; surface that message to the user and stop here.
If the error is note already exists, the 4-hex filename hash collided with a note written in the same second. Regenerate the hash (Step 7's command), rebuild the filename, and retry the write once. If it fails again for any reason, surface the error and stop — do not loop.
Print:
Decision recorded!
- File:
$VAULT_PATH/$INSIGHTS_FOLDER/<filename>- Status:
active- Tags:
claude/decision,claude/project/<name>,claude/topic/<topic1>, ...- Open in Obsidian to view, link to other notes, or update the status later.
To revisit past decisions, search for
type: claude-decisionin your vault or check the Active Decisions section of the sessions-overview dashboard.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
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./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./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./error-logCaptures non-obvious errors and their solutions as structured Obsidian notes for future reference. Use when: (1) /error-log command to capture an error from the current session, (2) /error-log <error description> to log a specific error, (3) user wants to document a tricky bug fix or error resolution.npx claudepluginhub abhattacherjee/obsidian-brain --plugin obsidian-brain