Obsidian plugin to copy vault context files to clipboard for AI assistants. Features: - Copy vault context files to clipboard with one hotkey - Context generator with configurable conventions - Settings for folder, separator, preview, exclusions - Auto-detect vault folder structure - Include active note option - Ribbon icon for quick access - Full English UI and documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
285 lines
6.8 KiB
Markdown
285 lines
6.8 KiB
Markdown
<div align="center">
|
|
|
|
# Claude Context
|
|
|
|
[](https://obsidian.md)
|
|
[](https://www.typescriptlang.org/)
|
|
[](LICENSE)
|
|
|
|
**Copy your vault context to clipboard with one hotkey.**
|
|
|
|
Give AI assistants (Claude, ChatGPT, etc.) instant understanding of your vault's conventions, structure, and workflows.
|
|
|
|
[Features](#features) • [Installation](#installation) • [Usage](#usage) • [Configuration](#configuration) • [Generator](#context-generator)
|
|
|
|
</div>
|
|
|
|
---
|
|
|
|
## The Problem
|
|
|
|
When working with AI assistants on your Obsidian vault, you constantly need to explain:
|
|
- How you name files
|
|
- Where things go
|
|
- What link style you use
|
|
- Your tag conventions
|
|
- Your workflows
|
|
|
|
This is repetitive and error-prone. The AI forgets, you forget to mention something, and inconsistencies creep in.
|
|
|
|
---
|
|
|
|
## The Solution
|
|
|
|
**Claude Context** stores your vault's conventions in a dedicated folder (`_claude/`) and copies everything to your clipboard with a single hotkey. Paste it into any AI chat, and the assistant immediately understands how to work with your vault.
|
|
|
|
---
|
|
|
|
<div align="center">
|
|
|
|
## Features
|
|
|
|
</div>
|
|
|
|
### 📋 One-Click Context Copy
|
|
|
|
Press a hotkey or click the ribbon icon to copy all context files to your clipboard. The output is formatted with clear separators between files.
|
|
|
|
### ⚙️ Context Generator
|
|
|
|
Don't want to write context files manually? The built-in generator walks you through your preferences:
|
|
|
|
- **Language** - English or German
|
|
- **File naming** - kebab-case, snake_case, camelCase, or free
|
|
- **Link style** - Wikilinks or Markdown
|
|
- **Tag style** - Hierarchical, flat, or none
|
|
- **Frontmatter fields** - Customize required fields
|
|
- **Custom rules** - Add your own conventions
|
|
- **Folder purposes** - Auto-detects your folders, you describe their purpose
|
|
- **Templates** - Define your note templates
|
|
|
|
Click "Generate" and your context files are created instantly.
|
|
|
|
### 📁 Auto-Detect Vault Structure
|
|
|
|
The generator automatically scans your vault's folder structure. Just fill in the purpose for each folder, and `structure.md` is generated with your actual directories.
|
|
|
|
### 🔧 Flexible Settings
|
|
|
|
- **Context folder** - Change from `_claude/` to any name
|
|
- **Separator** - Customize the separator between files
|
|
- **Include filenames** - Toggle `# === filename.md ===` headers
|
|
- **Show preview** - Preview before copying
|
|
- **Include active note** - Append the currently open note
|
|
- **Excluded files** - Skip specific files from being copied
|
|
|
|
### 📝 Include Active Note
|
|
|
|
Working on a specific note and want context for it? Use "Copy context with current note" or enable "Include active note" in settings. The current note is appended to your context with an `ACTIVE:` prefix.
|
|
|
|
---
|
|
|
|
<div align="center">
|
|
|
|
## Installation
|
|
|
|
</div>
|
|
|
|
### From Source
|
|
|
|
1. Clone this repository into your vault's plugins folder:
|
|
```bash
|
|
cd /path/to/vault/.obsidian/plugins
|
|
git clone https://github.com/yourusername/obsidian-claude-context.git claude-context
|
|
```
|
|
|
|
2. Install dependencies and build:
|
|
```bash
|
|
cd claude-context
|
|
npm install
|
|
npm run build
|
|
```
|
|
|
|
3. Enable the plugin in Obsidian:
|
|
- Settings → Community Plugins → Enable "Claude Context"
|
|
|
|
### Development Setup
|
|
|
|
For development with hot reload:
|
|
|
|
```bash
|
|
cd /path/to/vault/.obsidian/plugins/claude-context
|
|
npm run dev
|
|
```
|
|
|
|
---
|
|
|
|
<div align="center">
|
|
|
|
## Usage
|
|
|
|
</div>
|
|
|
|
### Quick Start
|
|
|
|
1. **Generate context files**: `Ctrl+P` → "Claude Context: Generate context files"
|
|
2. **Configure your preferences** in the generator modal
|
|
3. **Click "Generate"** to create your context files
|
|
4. **Copy context**: `Ctrl+P` → "Claude Context: Copy context to clipboard"
|
|
5. **Paste** into ChatGPT, Claude, or any AI assistant
|
|
|
|
### Commands
|
|
|
|
| Command | Description |
|
|
|---------|-------------|
|
|
| Copy context to clipboard | Copies all context files |
|
|
| Copy context with current note | Copies context + active note |
|
|
| Generate context files | Opens the context generator |
|
|
|
|
### Ribbon Icon
|
|
|
|
Click the clipboard icon in the left sidebar for quick access to "Copy context to clipboard".
|
|
|
|
---
|
|
|
|
<div align="center">
|
|
|
|
## Configuration
|
|
|
|
</div>
|
|
|
|
### Settings
|
|
|
|
Access via Settings → Claude Context:
|
|
|
|
| Setting | Description | Default |
|
|
|---------|-------------|---------|
|
|
| Context folder | Folder containing context files | `_claude` |
|
|
| Separator | Text between files | `---` |
|
|
| Include filenames | Add filename headers | On |
|
|
| Show preview | Preview before copying | Off |
|
|
| Include active note | Always include open note | Off |
|
|
| Excluded files | Files to skip (comma-separated) | Empty |
|
|
|
|
### Context Files
|
|
|
|
The plugin expects markdown files in your context folder:
|
|
|
|
```
|
|
_claude/
|
|
├── VAULT.md # Main entry point (always first)
|
|
├── conventions.md # Naming and formatting rules
|
|
├── structure.md # Folder organization
|
|
├── workflows.md # How to do things
|
|
├── templates.md # Note templates
|
|
└── examples.md # Concrete examples
|
|
```
|
|
|
|
`VAULT.md` is always copied first. Other files are sorted alphabetically.
|
|
|
|
---
|
|
|
|
<div align="center">
|
|
|
|
## Context Generator
|
|
|
|
</div>
|
|
|
|
The generator creates a complete context setup based on your preferences.
|
|
|
|
### Sections
|
|
|
|
**General**
|
|
- Vault description (free text explaining your vault's purpose)
|
|
- Language selection
|
|
|
|
**Formatting**
|
|
- File naming convention
|
|
- Link style (Wikilinks vs Markdown)
|
|
- Maximum heading depth
|
|
- Date format
|
|
|
|
**Tags**
|
|
- Tag style (hierarchical, flat, or none)
|
|
- Predefined tags for consistency
|
|
|
|
**Frontmatter**
|
|
- Required fields for all notes
|
|
|
|
**Rules**
|
|
- Custom rules for the AI to follow
|
|
- Forbidden actions (folders/files the AI should never touch)
|
|
|
|
**Folder Structure**
|
|
- Auto-detected folders with purpose fields
|
|
- Generates "where does what go" documentation
|
|
|
|
**Note Templates**
|
|
- Define template names, target folders, and tags
|
|
- Generates template documentation
|
|
|
|
**Files to Generate**
|
|
- Toggle which context files to create
|
|
- Skip files you don't need
|
|
|
|
---
|
|
|
|
<div align="center">
|
|
|
|
## Example Output
|
|
|
|
</div>
|
|
|
|
When you copy context, you get something like:
|
|
|
|
```markdown
|
|
# === VAULT.md ===
|
|
|
|
# Vault Context for AI Assistants
|
|
|
|
Personal Zettelkasten for development and knowledge management.
|
|
|
|
## Quick Reference
|
|
|
|
- Language: English
|
|
- File naming: kebab-case
|
|
- Links: [[wikilinks]]
|
|
- Frontmatter: `date`, `tags`
|
|
...
|
|
|
|
---
|
|
|
|
# === conventions.md ===
|
|
|
|
# Conventions
|
|
|
|
## Language
|
|
|
|
- Vault language: English
|
|
...
|
|
|
|
---
|
|
|
|
# === structure.md ===
|
|
...
|
|
```
|
|
|
|
Paste this into any AI chat, and it immediately understands your vault.
|
|
|
|
---
|
|
|
|
<div align="center">
|
|
|
|
## License
|
|
|
|
</div>
|
|
|
|
MIT License - see [LICENSE](LICENSE) for details.
|
|
|
|
---
|
|
|
|
<div align="center">
|
|
|
|
Made with ♥ for the Obsidian community
|
|
|
|
</div>
|