logancyang_obsidian-copilot/docs/custom-commands.md

155 lines
5.5 KiB
Markdown
Raw Normal View History

docs: add user-facing documentation (#2254) * docs: add user-facing documentation (closes #2253) - 13 docs covering all major features: getting started, chat interface, LLM providers, models/parameters, context/mentions, custom commands, vault search/indexing, agent mode/tools, projects, system prompts, Copilot Plus/self-host, troubleshooting/FAQ, and index - Written for non-technical Obsidian users - Each doc is standalone with cross-references to related docs - All values verified against source code (defaults, model names, etc.) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs: improve user docs with website reference material - getting-started: add glossary (LLM, API, Token, Context Window, Embeddings, RAG, Vector Store) and API key billing note - chat-interface: add user/AI message buttons (edit, copy, delete, insert/replace at cursor, regenerate), [[Note Title]] inline reference syntax, Relevant Notes feature, manual Save Chat button, and auto-compact user experience note - context-and-mentions: add PDF context (+ Add context button) and image context (drag/drop or image button) methods - custom-commands: fix placeholder syntax ({} not {selected text}), add {FolderPath} variable, note tags must be in note properties, add richer example prompts - llm-providers: add LM Studio CORS requirement, 3rd-party CORS warning - vault-search-and-indexing: add cost estimation tip (Count total tokens command), RangeError/partitioning note, tag property note - agent-mode-and-tools: add Revert option, note @composer works in both Plus and Projects modes - projects: add 50+ file type support detail - copilot-plus-and-self-host: add dashboard URL - troubleshooting-and-faq: add first-steps section, RangeError fix, response cut-off fix, notes-not-found checklist, note referencing FAQ, English response FAQ, image/PDF FAQ, privacy note Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: remove UI_RENDERING_PERFORMANCE.md from docs (already in designdocs) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs: add doc maintenance rule to CLAUDE.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs: fix custom command variable syntax and project deletion claim Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs: clarify 16 built-in providers + unlimited OpenAI-compatible models Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs: fix semantic search default and partitioning claims Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs: fix self-host status and remaining partitioning claim Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs: fix self-host setup steps, tool count, and memory tool availability Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04 01:39:00 +00:00
# Custom Commands
Custom commands are preset AI prompts you define once and reuse on any note or selected text. They're stored as markdown files in your vault and can be triggered from the right-click context menu, the command palette, or as slash commands in chat.
---
## Overview
A custom command is like a template prompt. You write an instruction (with optional variables) and save it. From then on, you can apply it to any note or selected text with a single click.
**Examples of what you might create:**
- "Summarize this note in bullet points"
- "Extract all action items as a task list"
- "Rewrite this in a more formal tone"
- "Translate to Spanish"
- "Create a Fleeting Note from this"
---
## Creating a Custom Command
### From Settings
1. Go to **Settings → Copilot → Command**
2. Click **Add new command**
3. Fill in the fields:
- **Name** — What the command is called (also becomes its ID)
- **Prompt** — The instruction to send to the AI
- **Show in context menu** — Whether it appears when right-clicking text in a note
- **Model** — Optional: use a specific model for this command (defaults to the current chat model)
4. Save
### From the Command Palette
You can also create a command on the fly:
1. Open the command palette (`Ctrl/Cmd+P`)
2. Run **Add new custom command**
3. A form will open to fill in the command details
---
## Prompt Template Variables
Inside your prompt, you can use variables that get replaced with real content when the command runs:
| Variable | What it inserts |
|---|---|
| `{}` or `{selected_text}` | The text currently selected in the editor |
| `{activeNote}` | The full content of the currently active note |
| `{[[Note Title]]}` | The content of a specific note by title |
| `{FolderPath}` | All notes within a specific folder |
| `{#tag1, #tag2}` | All notes with any of the specified tags |
> **Important**: Tags in `{#tag1, #tag2}` must be in the note's **properties (frontmatter)**, not inline tags within the note body.
**Example — quiz generator using two variables:**
```
Come up with multiple choice questions using {activeNote}, and follow
the format of {[[Quiz Template]]} to start a quiz session.
Ask one question at a time, stop and wait for the user.
After the user answers, provide the correct answer and explanation.
Repeat until the user says STOP.
```
**Example — comparison using specific notes:**
```
Compare my notes on {[[Product Roadmap]]} and {[[Competitor Analysis]]} and identify gaps.
```
**Example — acting on selected text:**
```
Rewrite this in a more formal tone: {selected_text}
```
Variable substitution must be enabled in **Settings → Copilot → Command → Enable custom prompt templating** (on by default).
---
## Using Commands
### From the Right-Click Context Menu
If a command has **Show in context menu** enabled:
1. Select some text in a note (optional)
2. Right-click to open the context menu
3. Hover over **Copilot** → select your command
4. The AI processes your selection or note and shows the result
### From the Command Palette
1. Select text or open the note you want to work with
2. Open the command palette (`Ctrl/Cmd+P`)
3. Run **Apply custom command**
4. Pick your command from the list
### As a Slash Command in Chat
Inside the chat input, type `/` followed by the command name to run it:
```
/summarize
```
The command runs in the context of your current chat session and active note.
> **Note**: The `@composer` mention (for AI note editing) requires Copilot Plus. In free modes, `@composer` will not be available.
---
## Managing Commands
Go to **Settings → Copilot → Command** to manage all your custom commands:
- **Edit** — Click the edit icon next to any command
- **Reorder** — Drag commands to change their order (affects the context menu and command list)
- **Duplicate** — Copy an existing command as a starting point
- **Delete** — Remove a command permanently
- **Sort strategy** — Choose how commands are sorted: manually, by recent use, or alphabetically
### Custom Prompts Folder
Commands are stored as markdown files in your vault. The default folder is `copilot/copilot-custom-prompts/`. You can change this in **Settings → Copilot → Basic → Custom prompts folder**.
---
## Quick Command
**Quick Command** opens a modal where you can run a one-off AI prompt on your selected text without creating a permanent command.
- **Trigger**: Command palette → **Trigger quick command**
- **Assign a hotkey**: Settings → Hotkeys → search "Trigger quick command"
- **Behavior**: Opens a prompt input, lets you choose a model and whether to include the note context, then runs the prompt on your selection
---
## Quick Ask
**Quick Ask** is a floating inline panel that appears at the cursor position in your editor. It's designed for quick, in-context AI queries while you're writing.
- **Trigger**: Command palette → **Quick Ask** (or assign a hotkey, recommended: `Ctrl/Cmd+K`)
- **Not available in Source Mode** — Works in Live Preview and Reading view
- **How it works**: A small input appears right where your cursor is. Type your question, press Enter, and the response appears inline.
Quick Ask is great for things like "rephrase this sentence," "what does this term mean?", or "suggest three alternatives."
---
## Related
- [Chat Interface](chat-interface.md) — Using slash commands in chat
- [Context and Mentions](context-and-mentions.md) — How context is passed to commands
- [Agent Mode and Tools](agent-mode-and-tools.md) — More powerful note editing with @composer