Atif Ahmed3 downloadsShare the note you are reading, the section you are in and the text you select with Claude Code.
Ask Claude Code about the note you are reading without pasting it in.
Claude Code's VS Code extension tells Claude which file you have open and what you selected. This does the same for Obsidian. Read a note, select a paragraph, switch to your terminal and ask "what does this mean?" Claude already knows which note, which section and which lines you mean.
It has two halves that talk through one small file:
| Half | Lives in | Does |
|---|---|---|
| Claude Code Connector, an Obsidian plugin | your vault | writes what you are reading to ~/.claude/obsidian-context/state.json |
| obsidian-context, a Claude Code plugin | Claude Code | adds that to your prompt, as a short block Claude reads |
flowchart TD
A["You read, scroll or select text in Obsidian"] --> B["Obsidian plugin writes state.json"]
C["You send a prompt in Claude Code"] --> D["Hook reads state.json"]
B -.-> D
D --> E["Claude gets the note, section and selection with your prompt"]
With a paragraph of a cooking note selected, your prompt arrives with this block attached:
<obsidian-context>
What the user has open in Obsidian (updated 2 min ago). Use it to work out what
"this", "here" or "this note" means in their message; ignore it when the message
is about something else. Read the note for its full text.
Vault: notes (note paths below are inside it)
Reading: guides/Cooking basics.md (reading view)
Section: Cooking basics > Knife skills
Selected text (lines 14-15):
<selection>
Keep the tip of the knife on the board.
</selection>
Other open tabs: Index.md
Recently opened: guides/Bread.md (09:30)
</obsidian-context>
It is sent once and again only when something changes, so asking three questions about the same paragraph does not repeat it three times.
You need both halves, a desktop Obsidian (1.5 or newer) and
Node.js 20 or newer on your PATH (the hook runs with
node).
In Obsidian, open Settings → Community plugins, turn community plugins on if they are off, click Browse, search for Claude Code Connector, then install and enable it. Its page in the Obsidian community directory is here.
The status bar now shows Claude: sharing.
To install by hand instead, download main.js and manifest.json from the
latest release
into <your vault>/.obsidian/plugins/claude-code-connector/, click the
refresh icon next to Installed plugins and switch on
Claude Code Connector.
In Claude Code:
/plugin marketplace add SigniorAtif/Obsidian-CC-connector
/plugin install obsidian-context@obsidian-cc-connector
Start a new session. That's it.
From 0.1.1 on, GitHub signs a record of each release file as its release
workflow builds it. With the GitHub CLI, this
confirms that a main.js you have was built from this repository, unchanged:
gh attestation verify main.js --repo SigniorAtif/Obsidian-CC-connector
The hook adds the block to a prompt only when all of these hold:
~/.claude/obsidian-context/state.json. The file holds the path of the open
note, the headings above where you are, the text you selected, the paths of
your open tabs and of the last ten notes you opened. It is deleted when you
pause or disable the plugin and when Obsidian's window closes. If Obsidian
crashes and leaves it behind, the hook sees that Obsidian is no longer
running and ignores it.data.json inside
the vault, like any plugin.| Setting | Default | What it does |
|---|---|---|
| Share with Claude Code | on | Off pauses sharing, the same as clicking the status bar item. |
| Share with every Claude Code session | off | On lets sessions in any folder see what you are reading. |
To move the state file, set the environment variable OBSIDIAN_CONTEXT_DIR
for both Obsidian and Claude Code, for example in your shell profile
(then start Obsidian from that environment).
fs, which mobile
Obsidian does not have.~/.claude/obsidian-context/state.json
exists and changes when you switch notes. If it does, check you started
Claude Code inside the vault or its project, or turn on Share with every
Claude Code session. Run /plugin in Claude Code to see that
obsidian-context is enabled.Bug reports and pull requests are welcome. See CONTRIBUTING.md for the setup, the checks and how releases are made.
MIT © 2026 Atif Ahmed