An open API service indexing awesome lists of open source software.

https://github.com/thoreinstein/gemini-obsidian

A Gemini CLI extension for interfacing with an Obsidian vault with local first RAG capabilities
https://github.com/thoreinstein/gemini-obsidian

gemini-cli gemini-cli-extensions gemini-extensions obsidian-md

Last synced: 2 months ago
JSON representation

A Gemini CLI extension for interfacing with an Obsidian vault with local first RAG capabilities

Awesome Lists containing this project

README

          

# Gemini Obsidian Extension

This is a powerful [Gemini CLI](https://github.com/google/gemini-cli) extension that integrates your **Obsidian Vault** directly into your AI workflow. It transforms Gemini into a "Second Brain" assistant capable of reading, searching, connecting, and managing your notes.

## Features

- **🧠 Semantic Search (RAG)**: Ask natural language questions about your notes. The extension indexes your vault using embeddings (via LanceDB) to find relevant context.
- **πŸ•ΈοΈ Graph Traversal**: Navigate your knowledge graph. Find backlinks (`[[linked from]]`) and outgoing links to surf your ideas.
- **πŸ“ Smart Journaling**: Fetch today's daily note or append logs to specific headings (e.g., `## Work Log`) with timestamps.
- **⚑ Management**: Create, move, rename notes, and safely update YAML frontmatter without breaking formatting.
- **πŸ” Fuzzy Search**: Quickly find files by name or content.

## Demo

![demo.gif](docs/demo.gif)

## Prerequisites

- **Node.js**: v18 or higher.
- **Gemini CLI**: The host application for this extension.
- **Obsidian Vault**: A local folder containing your markdown notes.

## Installation

1. **Install via Gemini CLI**:
```sh
gemini extensions install https://github.com/thoreinstein/gemini-obsidian
```

2. **Install Native Dependencies**:
This extension requires native binaries for semantic search. You **must** run `npm install` inside the extension directory:
```sh
cd ~/.gemini/extensions/gemini-obsidian && npm install
```

## Configuration

The extension needs to know where your Obsidian vault is located.

**Option 1: Environment Variable**
Set `OBSIDIAN_VAULT_PATH` in your shell profile:
```bash
export OBSIDIAN_VAULT_PATH="/Users/you/Documents/MyVault"
```

**Option 2: Runtime Configuration**
The first time you use a tool, gemini will ask to set `vault_path`. It will be cached in `~/.gemini-obsidian.config.json`.

## Data Storage & Troubleshooting

- **Vector Index**: The semantic search index is stored locally in `~/.gemini-obsidian-lancedb`.
- **Module Not Found Error**: If you see an error like `Cannot find module '@lancedb/lancedb'`, it means the native dependencies were not installed. Run `npm install` in the extension directory as shown in the Installation section.
- **Cache Reset**: If you suspect the index is corrupted or want a fresh start, you can manually delete the `~/.gemini-obsidian-lancedb` folder. The next time you run `/obsidian:index` or `obsidian_rag_index`, it will be recreated.
- **Logs**: If you encounter issues, check the extension logs. Since this runs as an MCP server, errors are typically output to stderr.

## Commands

The extension comes with pre-configured slash commands for common workflows:

| Command | Description |
| :--- | :--- |
| `/obsidian:daily` | Retrieve today's daily note, summarize tasks, and ask for updates. |
| `/obsidian:ask` | Ask a question to your vault using RAG (e.g., `/obsidian:ask "What did I learn about React?"`). |
| `/obsidian:search` | Fuzzy search for files by name or content. |
| `/obsidian:index` | Trigger a manual re-index of the vault for semantic search. |

## Available Tools

The following tools are exposed to the Gemini agent:

### Retrieval & Search
- `obsidian_rag_index`: Index the vault for semantic search.
- `obsidian_rag_query`: Perform a semantic search query.
- `obsidian_search_notes`: Simple text/filename search.
- `obsidian_list_notes`: List files in a folder.
- `obsidian_read_note`: Read the full content of a note.

### Graph & Connections
- `obsidian_get_backlinks`: Find all notes that link TO a specific note.
- `obsidian_get_links`: Find all notes linked FROM a specific note.

### Management & Journaling
- `obsidian_create_note`: Create a new markdown note.
- `obsidian_append_note`: Append text to the end of a note.
- `obsidian_append_daily_log`: Append text to a specific heading (e.g., "Log") in today's daily note with a timestamp.
- `obsidian_move_note`: Rename or move a note.
- `obsidian_update_frontmatter`: Safely update YAML frontmatter keys.
- `obsidian_get_daily_note`: Get or create today's daily note.

## Development

```bash
# Build changes
npm run build

# Watch mode
npm run watch
```

## License

ISC