Skip to main content
Glama
README.md
**English** · [Русский](README.ru.md)

<p align="center">
  <img src="assets/logo.svg" width="108" alt="Obsidian Kit">
</p>

<h1 align="center">Obsidian Kit</h1>

<p align="center">Search, read and edit local Obsidian vaults from Codex, Antigravity and Pi.</p>

<p align="center">
  <img src="assets/badges/node.svg" height="22" alt="Node.js >= 22.18">
  <img src="assets/badges/antigravity.svg" height="22" alt="Antigravity MCP App">
  <img src="assets/badges/codex.svg" height="22" alt="Codex MCP + UI">
  <img src="assets/badges/pi.svg" height="22" alt="Pi 1.6+ Native + TUI">
  <img src="assets/badges/sqlite.svg" height="22" alt="Index SQLite FTS5">
  <img src="assets/badges/license.svg" height="22" alt="License MIT">
</p>

[Quick start](#quick-start) · [Clients](#connect-a-client) · [Language](#interface-language) · [Vaults](#vault-selection) · [Tools](#tool-reference) · [Releases](https://github.com/Shamish/obsidian-kit/releases)

Ask your agent to find every note that links to a project, open the relevant section, or append a decision to today's note. Obsidian Kit reads Markdown files directly. Search, links, properties and editing work with Obsidian Desktop closed.

With the optional Companion running in Obsidian Desktop, the viewer can render notes with your theme and plugins, open a note in the app, and use Obsidian's file manager to update links on rename.

## Quick start

Use Node.js 22.18 or later, Git and npm. Open each vault in Obsidian once so it appears in the local registry. For native previews, use Obsidian Desktop 1.14.4 or later.

```sh
git clone https://github.com/Shamish/obsidian-kit.git
cd obsidian-kit
npm ci
npm run verify
```

[Connect a client](#connect-a-client), then ask it to **list the vaults with `vault_status`**. The response shows each vault's alias and location, the selected vault, the UI language and Companion availability. Choose a vault before editing.

> The index and files live on your machine. Your AI client can send note content to its model provider when you use these tools. Check your client's data settings before working with private notes.

## Connect a client

| Client | Integration | How to open a note |
| --- | --- | --- |
| Codex | Plugin with a local MCP server and bundled skills | Ask for `note_preview` |
| Antigravity | MCP plugin with a viewer panel | Ask for `note_preview` in reader or workspace mode |
| Pi Coding Agent | Native extension loaded in-process | Run `/obsidian` or ask for `note_show_section` |
| Other stdio MCP clients | Local relay | Use `note_read`. The interactive viewer requires MCP Apps support. |

### Codex

From the repository root, register the local marketplace and install the plugin.

```sh
codex plugin marketplace add .
codex plugin add obsidian-kit@obsidian-kit
```

For a development checkout, you can instead point `~/.codex/config.toml` at the built relay directly. Use just one registration per client.

```toml
[mcp_servers.obsidian-kit]
command = "node"
args = ["--no-warnings", "/absolute/path/to/obsidian-kit/dist/relay.mjs"]
startup_timeout_sec = 30
```

### Antigravity

Run the sync script after building. It replaces the plugin's bundled runtime and skills under `%USERPROFILE%\.gemini\config\plugins\obsidian-kit`. Restart the client to pick up the changes.

```powershell
pwsh -NoProfile -File scripts/sync-agy.ps1
```

### Pi Coding Agent

```sh
pi install /absolute/path/to/obsidian-kit
pi list
```

You can also install directly with `pi install https://github.com/Shamish/obsidian-kit.git`. Run `/reload` in an open Pi session after updating. The extension exposes 13 tools under the `obsidian` namespace. It activates core tools in a vault and supports deferred discovery elsewhere.

Use `@research:"Project notes.md"` to include a note in a prompt, or `@obsidian:daily` and `@obsidian:active` for the selected vault. Replace `research` with an alias from `vault_status`.

### Other MCP clients

Add a stdio server to your client's MCP configuration and replace the example path with the absolute path to the built relay.

```json
{
  "mcpServers": {
    "obsidian-kit": {
      "command": "node",
      "args": ["--no-warnings", "/absolute/path/to/obsidian-kit/dist/relay.mjs"]
    }
  }
}
```

## Interface language

Set `locale` in `config.json` in the [data directory](#local-settings). To override it for a single process, set `OBSIDIAN_KIT_LOCALE`. Restart the MCP connection, reload the Companion and run `/reload` in Pi after changing the language. Check `vault_status.locale` to see the effective language.

| Value | Behavior |
| --- | --- |
| `auto` (default) | Use Russian for a Russian runtime locale and English otherwise |
| `en` | English |
| `ru` | Russian |

The setting covers viewer controls, Pi navigation and prompts, Companion settings, tool titles and runtime messages. Tool names, argument keys, note contents, links and frontmatter keys stay unchanged. Set `workflows.clippingLanguage` separately to choose a language for summaries.

## Local settings

No configuration file is required. Put optional preferences in `%LOCALAPPDATA%\ObsidianKit\config.json` on Windows or `~/ObsidianKit/config.json` on macOS and Linux. If you set `OBSIDIAN_KIT_DATA_DIR`, put the file in that directory.

```json
{
  "locale": "auto",
  "vaults": {
    "research": "/home/alex/Notes",
    "library": "/home/alex/Reading"
  },
  "defaultVault": "research",
  "companionVaults": ["research", "library"],
  "workflows": {
    "styling": "preserve",
    "clippingLanguage": "en",
    "clippingOutput": "copy",
    "autoProfile": false
  }
}
```

### Vault selection

An explicit `vault` wins. A single matching MCP workspace root selects its vault. If roots span several vaults or the root request fails, pass a vault explicitly. When no root matches, Kit checks the connecting client's working directory, then `defaultVault`, then the only registered vault. The closest enclosing vault wins for nested paths. If selection is ambiguous, `vault_status` returns `selected: null` and the viewer offers a picker.

- `vaults` maps lowercase aliases to absolute paths already registered with Obsidian. Windows paths such as `C:/Notes` work. Unicode letters, numbers, hyphens and underscores are supported. `obsidian` is reserved for the current vault in Pi.
- Without a mapping, `Research Notes` becomes `research-notes`. Duplicate names get numeric suffixes. Set stable aliases when upgrading from 0.2.x or using identically named vaults. Profiles in `vault-profiles.sqlite` follow the vault path.
- Use `vault_set_profile` to describe what a vault contains and which tasks it serves. The agent can use this information to route searches.
- By default the skills preserve note style and source language, create a separate summary and ask before saving inferred profiles. Opt in with `styling: "rich"`, `clippingLayout: "summary"`, `clippingOutput: "replace"` or `autoProfile: true`. These are agent preferences, not filesystem permissions.

### Obsidian Desktop Companion

The installer copies `main.js` and `manifest.json` into `.obsidian/plugins/obsidian-kit-companion/` and enables the plugin. Choose one command, then reload the plugin in each open vault.

```sh
# A single vault by alias, name or path
node scripts/install-companion.mjs research

# All registered vaults
node scripts/install-companion.mjs --all

# Configured companionVaults, or the selected vault if unset
node scripts/install-companion.mjs
```

For repeatable batch updates, list aliases from `vaults` in `companionVaults`. An unavailable configured alias stops the batch before files are copied. To install manually, extract the Companion ZIP from a release into the plugin directory and enable it in Obsidian.

## Using the viewer

Ask the agent to open a note in `reader` mode for a focused preview or `workspace` mode to search, browse recent notes, inspect source and edit. The editor loads CodeMirror 6 on demand. If another program changes a file, the viewer reports a conflict instead of overwriting that revision. Select an excerpt to send it to chat where supported.

### Pi keyboard shortcuts

Run `/obsidian [vault] [query or path.md]`. Append `#Heading` to open a section.

| Keys | Action |
| --- | --- |
| ↑ ↓ or `j` `k`, PgUp PgDn | Navigate and scroll |
| `/`, Enter, Esc | Search, apply or clear a filter |
| Tab, `1` `2` `3` | Cycle vaults or switch between notes, broken links and orphans |
| Enter, `h`, `b` | Open a note, browse its outline or follow links |
| `i`, `c` | Insert a path or excerpt into the prompt |
| `o`, `r`, Esc | Open in Obsidian, refresh or go back |

## Tool reference

Both integrations expose 12 shared tools plus a client-specific preview tool. Use paths relative to the selected vault.

| Tool | Purpose |
| --- | --- |
| `vault_status` | Inspect vaults, profiles, locale, index counts and Companion status. Set `sync: true` to refresh. |
| `vault_set_profile` | Update the description or task associated with a vault |
| `vault_ls` | List a folder with optional recursion and extension filters |
| `vault_search` | Search with SQLite FTS5 and BM25 ranking. Filter by tags, properties, type, path, modification date or JsonLogic. |
| `vault_graph` | Explore backlinks, outgoing links, unresolved links, orphans, dead ends and tag counts |
| `note_read` | Read Markdown, frontmatter, an outline or one section |
| `note_write` | Create, append or overwrite. Use `mode: "create"` to avoid replacing an existing note. |
| `note_patch` | Edit text, headings, block IDs or frontmatter. Use `Parent::Heading` to disambiguate sections. |
| `note_props` | Change typed YAML properties |
| `note_move` | Move or rename a note. A running Companion can update links. |
| `note_delete` | Delete a note after explicit confirmation |
| `daily` | Resolve, read or append to a daily note using Daily Notes or Periodic Notes settings |
| `note_preview` | Open the MCP Apps viewer |
| `note_show_section` | Display a formatted section in Pi chat |

### MCP resources

- `obsidian://vault/{vault}` returns the vault summary.
- `obsidian://vault/{vault}/active` and `obsidian://vault/{vault}/daily` return the active or daily note.
- `obsidian://vault/{vault}/{+path}` reads a note and supports path completion and change subscriptions.

The app uses six additional UI tools for vault selection, search, rendering, reading and saving source, and opening files in Obsidian. The agent does not need to call them directly.

## Architecture

![How the MCP relay, native Pi extension and optional Companion share the local vault core](assets/architecture.en.svg)

The MCP relay connects over a named pipe or Unix socket to a shared worker. Pi imports the same core directly. SQLite stores an incremental FTS5 index, tags and the wikilink graph. File watchers and on-demand synchronization keep it current. The optional Companion provides native previews, active-note lookup, opening and renaming over a loopback connection.

| Setting | Purpose |
| --- | --- |
| `OBSIDIAN_KIT_DATA_DIR` | Directory for configuration, index databases, connections and worker state |
| `OBSIDIAN_REGISTRY` | Override the path to Obsidian's `obsidian.json` registry |
| `OBSIDIAN_KIT_LOCALE` | Override the interface language |
| `OBSIDIAN_KIT_IDLE_MS` | Worker idle timeout in milliseconds, default 60000 |
| `OBSIDIAN_DIR`, `OBSIDIAN_CLI` | Override installation directory or CLI executable. The `obsidianDir` setting also accepts an absolute directory. |

Bundled skills cover vault operations, Obsidian Markdown, Bases, JSON Canvas, Defuddle, Knap, note styling and clipping summaries. See [skills](skills/) for the individual instructions.

## Development and releases

```sh
npm run typecheck
npm run build
npm test
npm run pack:codex -- --neutral
```

`npm run verify` runs the first three steps. The suite includes relay, viewer, localization and native Pi tests. The Pi integration tests require a local Pi installation. Commit the generated runtime in `dist/` together with the source.

The neutral package ignores private registry settings. For a private npm channel use `GITEA_PACKAGE_OWNER` and `GITEA_PACKAGE_REGISTRY` or the ignored `.local/pack-config.json`. Its optional `marketplace` path preserves an existing npm identity and stages an updated catalog under `.local/upgrade/<version>/` without changing the active one.

To prepare a GitHub release, run **GitHub release** manually on an existing `vX.Y.Z` tag matching the package version. The workflow verifies the project and creates a draft with the Codex archive, Companion ZIP and SHA-256 checksums. Publish the draft separately after review.

## License and credits

[MIT](LICENSE). Native rendering and the shared worker design draw on [oblume](https://github.com/jellyns/oblume). The Markdown, Bases, Canvas, Defuddle and Knap skills adapt [obsidianmd/obsidian-skills](https://github.com/obsidianmd/obsidian-skills). See [third-party notices](THIRD_PARTY_NOTICES.md).