Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Agent Client Plugin - LLM Developer Guide

## Overview
Obsidian plugin for AI agent interaction (Claude Code, Codex, Gemini CLI, Mistral Vibe, custom agents) via ACP.
Obsidian plugin for AI agent interaction (Claude Code, Codex, Gemini CLI, Mistral Vibe, OpenCode, custom agents) via ACP.

**Tech**: React 19, TypeScript, Obsidian API, Agent Client Protocol (ACP)

Expand Down Expand Up @@ -334,6 +334,7 @@ interface ISettingsAccess {
- Codex: `@zed-industries/codex-acp` (OPENAI_API_KEY)
- Gemini CLI: `@google/gemini-cli` (GEMINI_API_KEY)
- Mistral Vibe: `mistral-vibe` (MISTRAL_API_KEY)
- OpenCode: `opencode-ai` (CLI-managed auth, no API key env)
- Custom: Any ACP-compatible agent

---
Expand Down
7 changes: 4 additions & 3 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<a href="https://www.buymeacoffee.com/rait09" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" width="180" height="50" ></a>
</p>

AIエージェント(Claude Code、Codex、Gemini CLI、Mistral Vibe)をObsidianに直接統合。Vault内からAIアシスタントとチャットできます。
AIエージェント(Claude Code、Codex、Gemini CLI、Mistral Vibe、OpenCode)をObsidianに直接統合。Vault内からAIアシスタントとチャットできます。

このプラグインは、Zed の [Agent Client Protocol (ACP)](https://github.com/agentclientprotocol/agent-client-protocol) で構築されています。

Expand All @@ -27,7 +27,7 @@ https://github.com/user-attachments/assets/1c538349-b3fb-44dd-a163-7331cbca7824
- **ノートメンション**: `@ノート名`でノートを参照(ノート内の `[[wikilink]]` の解決済みパスもエージェントに渡る)
- **画像添付**: チャットに画像をペーストまたはドラッグ&ドロップ
- **スラッシュコマンド**: エージェントが提供する`/`コマンドを使用
- **マルチエージェント**: Claude Code、Codex、Gemini CLI、Mistral Vibe、カスタムエージェントを切り替え
- **マルチエージェント**: Claude Code、Codex、Gemini CLI、Mistral Vibe、OpenCode、カスタムエージェントを切り替え
- **マルチセッション**: 複数のエージェントを別々のビューで同時実行
- **フローティングチャット**: 素早くアクセスできる折りたたみ可能なチャットウィンドウ
- **モード・モデル切り替え**: チャット画面からAIモデルやエージェントモードを変更
Expand Down Expand Up @@ -97,7 +97,8 @@ https://github.com/user-attachments/assets/1c538349-b3fb-44dd-a163-7331cbca7824
- [Codex](https://rait-09.github.io/obsidian-agent-client/agent-setup/codex.html)
- [Gemini CLI](https://rait-09.github.io/obsidian-agent-client/agent-setup/gemini-cli.html)
- [Mistral Vibe](https://rait-09.github.io/obsidian-agent-client/agent-setup/mistral-vibe.html)
- [カスタムエージェント](https://rait-09.github.io/obsidian-agent-client/agent-setup/custom-agents.html)(OpenCode、Qwen Code、Kiroなど)
- [OpenCode](https://rait-09.github.io/obsidian-agent-client/agent-setup/opencode.html)
- [カスタムエージェント](https://rait-09.github.io/obsidian-agent-client/agent-setup/custom-agents.html)(Qwen Code、Kiroなど)

**[ドキュメント全文](https://rait-09.github.io/obsidian-agent-client/)**

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<a href="https://www.buymeacoffee.com/rait09" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" width="180" height="50" ></a>
</p>

Bring AI agents (Claude Code, Codex, Gemini CLI, Mistral Vibe) directly into Obsidian. Chat with your AI assistant right from your vault.
Bring AI agents (Claude Code, Codex, Gemini CLI, Mistral Vibe, OpenCode) directly into Obsidian. Chat with your AI assistant right from your vault.

Built on [Agent Client Protocol (ACP)](https://github.com/agentclientprotocol/agent-client-protocol) by Zed.

Expand All @@ -31,7 +31,7 @@ https://github.com/user-attachments/assets/1c538349-b3fb-44dd-a163-7331cbca7824
- **Note Mentions**: Reference your notes with `@notename` syntax; the agent also sees resolved paths for `[[wikilinks]]` inside them
- **Image Attachments**: Paste or drag-and-drop images into the chat
- **Slash Commands**: Use `/` commands provided by your agent
- **Multi-Agent Support**: Switch between Claude Code, Codex, Gemini CLI, Mistral Vibe, and custom agents
- **Multi-Agent Support**: Switch between Claude Code, Codex, Gemini CLI, Mistral Vibe, OpenCode, and custom agents
- **Multi-Session**: Run multiple agents simultaneously in separate views
- **Floating Chat**: A persistent, collapsible chat window for quick access
- **Mode & Model Switching**: Change AI models and agent modes from the chat
Expand Down Expand Up @@ -101,7 +101,8 @@ Open a terminal (Terminal on macOS/Linux, PowerShell on Windows) and run the fol
- [Codex](https://rait-09.github.io/obsidian-agent-client/agent-setup/codex.html)
- [Gemini CLI](https://rait-09.github.io/obsidian-agent-client/agent-setup/gemini-cli.html)
- [Mistral Vibe](https://rait-09.github.io/obsidian-agent-client/agent-setup/mistral-vibe.html)
- [Custom Agents](https://rait-09.github.io/obsidian-agent-client/agent-setup/custom-agents.html) (OpenCode, Qwen Code, Kiro, etc.)
- [OpenCode](https://rait-09.github.io/obsidian-agent-client/agent-setup/opencode.html)
- [Custom Agents](https://rait-09.github.io/obsidian-agent-client/agent-setup/custom-agents.html) (Qwen Code, Kiro, etc.)

**[Full Documentation](https://rait-09.github.io/obsidian-agent-client/)**

Expand Down
1 change: 1 addition & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export default defineConfig({
{ text: "Codex", link: "/agent-setup/codex" },
{ text: "Gemini CLI", link: "/agent-setup/gemini-cli" },
{ text: "Mistral Vibe", link: "/agent-setup/mistral-vibe" },
{ text: "OpenCode", link: "/agent-setup/opencode" },
{ text: "Custom Agents", link: "/agent-setup/custom-agents" },
],
},
Expand Down
16 changes: 5 additions & 11 deletions docs/agent-setup/custom-agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ You can use any agent that implements the [Agent Client Protocol (ACP)](https://

## Install and Configure

1. Install your ACP-compatible agent (e.g., [OpenCode](https://github.com/anomalyco/opencode), [Qwen Code](https://github.com/QwenLM/qwen-code), [Kiro](https://kiro.dev/)).
1. Install your ACP-compatible agent (e.g., [Qwen Code](https://github.com/QwenLM/qwen-code), [Kiro](https://kiro.dev/)).

2. Open **Settings → Agent Client** and scroll to **Custom Agents** section.

Expand All @@ -13,21 +13,15 @@ You can use any agent that implements the [Agent Client Protocol (ACP)](https://
4. Configure the agent:
- **Agent ID**: Unique identifier (e.g., `my-agent`)
- **Display name**: Name shown in menus (e.g., `My Agent`)
- **Path**: Command name or absolute path to the agent executable. The command name alone (e.g., `opencode`) works in many cases. If the agent is not found automatically, set the full path, or click **Auto-detect**.
- **Path**: Command name or absolute path to the agent executable. The command name alone (e.g., `qwen`) works in many cases. If the agent is not found automatically, set the full path, or click **Auto-detect**.
- **Arguments**: Command-line arguments, one per line (if required)
- **Environment variables**: `KEY=VALUE` pairs, one per line (if required)

## Configuration Examples

### OpenCode

| Field | Value |
|-------|-------|
| **Agent ID** | `opencode` |
| **Display name** | `OpenCode` |
| **Path** | `opencode` |
| **Arguments** | `acp` |
| **Environment variables** | (optional) |
::: tip OpenCode
OpenCode is now a built-in preset — see [OpenCode Setup](./opencode). If you previously configured it here as a custom agent with the id `opencode`, your settings migrate to the preset automatically.
:::

### Qwen Code

Expand Down
3 changes: 2 additions & 1 deletion docs/agent-setup/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ Agent Client supports multiple AI agents through the [Agent Client Protocol (ACP
| [Codex](./codex) | OpenAI | `@zed-industries/codex-acp` |
| [Gemini CLI](./gemini-cli) | Google | `@google/gemini-cli` |
| [Mistral Vibe](./mistral-vibe) | Mistral AI | `mistral-vibe` |
| [OpenCode](./opencode) | Multi-provider | `opencode-ai` |
| [Custom Agents](./custom-agents) | Various | Any ACP-compatible agent |

## Common Setup Steps

All agents follow a similar setup pattern:

1. **Install the agent** — see each agent's setup page for the exact command (npm for Claude Code / Codex / Gemini CLI; `curl` on macOS/Linux or `uv` on Windows for Mistral Vibe)
1. **Install the agent** — see each agent's setup page for the exact command (npm for Claude Code / Codex / Gemini CLI; `curl` on macOS/Linux or `uv` on Windows for Mistral Vibe; `curl` or npm for OpenCode)
2. **Set up authentication** (API key or account login)

The plugin resolves bare command names through your login shell's PATH, so path configuration is often not needed. If the agent is not found automatically, use `which` (macOS/Linux) or `where.exe` (Windows) to find the path and configure it in Settings → Agent Client.
Expand Down
66 changes: 66 additions & 0 deletions docs/agent-setup/opencode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# OpenCode Setup

OpenCode is an open-source coding agent that works with many LLM providers. It communicates via ACP through the `opencode acp` command.

## Install and Configure

Open a terminal (Terminal on macOS/Linux, PowerShell on Windows) and run the following commands.

1. Install OpenCode:

::: code-group

```bash [macOS/Linux]
curl -fsSL https://opencode.ai/install | bash
```

```powershell [Windows]
npm install -g opencode-ai
```

:::

Other installers (Homebrew, Scoop, Chocolatey) are listed in the [OpenCode docs](https://opencode.ai/docs/).

2. Find the installation path:

::: code-group

```bash [macOS/Linux]
which opencode
# Example output: /Users/username/.opencode/bin/opencode
```

```cmd [Windows]
where.exe opencode
```

:::

3. Open **Settings → Agent Client**. The default command (`opencode`) works in many cases. If the agent is not found automatically, set the **OpenCode path** to the path found above, or click **Auto-detect**.

## Authentication

OpenCode manages provider credentials itself, so there is no API key field for it in Agent Client.

1. Run OpenCode in your terminal:

```bash
opencode
```

2. Run the `/connect` command in the TUI, select a provider, and paste its API key.

Credentials are stored in `~/.local/share/opencode/auth.json` and are picked up by the `opencode acp` process that Agent Client starts. You can also configure providers from the command line with `opencode auth login`.

::: tip Migrating from a custom agent
If you previously set up OpenCode as a custom agent with the id `opencode` (as these docs once described), your settings are migrated to the preset automatically — saved sessions keep working.
:::

## Verify Setup

1. Click the robot icon in the ribbon or use the command palette: **"Open chat view"**
2. Switch to OpenCode from the agent dropdown in the chat header
3. Try sending a message to verify the connection

Having issues? See [Troubleshooting](/help/troubleshooting).
4 changes: 3 additions & 1 deletion docs/getting-started/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Agent Client supports multiple AI agents. Choose one to start:
| **[Codex](/agent-setup/codex)** | OpenAI | via [Zed's adapter](https://github.com/zed-industries/codex-acp) |
| **[Gemini CLI](/agent-setup/gemini-cli)** | Google | with `--experimental-acp` option |
| **[Mistral Vibe](/agent-setup/mistral-vibe)** | Mistral AI | with built-in ACP support (`vibe-acp`) |
| **[Custom](/agent-setup/custom-agents)** | Various | [Any ACP-compatible agent](https://agentclientprotocol.com/overview/agents) (e.g., OpenCode, Qwen Code, Kiro) |
| **[OpenCode](/agent-setup/opencode)** | Multi-provider | with built-in ACP support (`opencode acp`) |
| **[Custom](/agent-setup/custom-agents)** | Various | [Any ACP-compatible agent](https://agentclientprotocol.com/overview/agents) (e.g., Qwen Code, Kiro) |

## Step 2: Install and Configure the Agent

Expand All @@ -22,6 +23,7 @@ Follow the setup guide for your chosen agent:
- [Codex Setup](/agent-setup/codex)
- [Gemini CLI Setup](/agent-setup/gemini-cli)
- [Mistral Vibe Setup](/agent-setup/mistral-vibe)
- [OpenCode Setup](/agent-setup/opencode)
- [Custom Agents](/agent-setup/custom-agents)

Each guide covers installation, path configuration, and authentication.
Expand Down
6 changes: 3 additions & 3 deletions docs/help/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Frequently asked questions about Agent Client.

### What is Agent Client?

Agent Client is an Obsidian plugin that lets you chat with AI agents directly within Obsidian. It supports Claude Code, Codex, Gemini CLI, Mistral Vibe, and any ACP-compatible agent. The plugin uses the [Agent Client Protocol (ACP)](https://agentclientprotocol.com/) to communicate with agents.
Agent Client is an Obsidian plugin that lets you chat with AI agents directly within Obsidian. It supports Claude Code, Codex, Gemini CLI, Mistral Vibe, OpenCode, and any ACP-compatible agent. The plugin uses the [Agent Client Protocol (ACP)](https://agentclientprotocol.com/) to communicate with agents.

### Is this an official Anthropic/OpenAI/Google plugin?

Expand Down Expand Up @@ -81,7 +81,7 @@ Disabling only hides the agent from lists: already-open chats, restored sessions

### What is a custom agent?

Any ACP-compatible agent beyond the preset ones (Claude Code, Codex, Gemini CLI, Mistral Vibe). You can add custom agents in **Settings → Agent Client → Custom agents**. See [Custom Agents](/agent-setup/custom-agents).
Any ACP-compatible agent beyond the preset ones (Claude Code, Codex, Gemini CLI, Mistral Vibe, OpenCode). You can add custom agents in **Settings → Agent Client → Custom agents**. See [Custom Agents](/agent-setup/custom-agents).

### Do all agents support the same features?

Expand All @@ -95,7 +95,7 @@ Slash commands are provided by the agent, not the plugin. If the input placehold

### Why are the commands different from what I expected?

Each agent provides its own commands. Claude Code, Codex, Gemini CLI, and Mistral Vibe all have different command sets. Refer to your agent's documentation for available commands.
Each agent provides its own commands. Claude Code, Codex, Gemini CLI, Mistral Vibe, and OpenCode all have different command sets. Refer to your agent's documentation for available commands.

## Permissions

Expand Down
3 changes: 3 additions & 0 deletions docs/help/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ The agent requires authentication before processing requests.
- Open **Settings → Agent Client → Preset agents → Mistral Vibe → API key**, click **Link...**, and link or create a secret. See [Mistral Vibe Setup](/agent-setup/mistral-vibe#authentication).
- Or run `vibe` in Terminal first to authenticate with your Mistral account

**For OpenCode:**
- Run `opencode` in Terminal and use the `/connect` command to configure a provider (there is no API key field in the plugin). See [OpenCode Setup](/agent-setup/opencode#authentication).

### "No Authentication Methods" error

The agent didn't provide authentication options.
Expand Down
3 changes: 2 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ Agent Client is an Obsidian plugin that brings AI coding agents directly into yo
| **[Codex](https://github.com/openai/codex)** | OpenAI | via [Zed’s adapter](https://github.com/zed-industries/codex-acp) |
| **[Gemini CLI](https://github.com/google-gemini/gemini-cli)** | Google | with `--experimental-acp` option |
| **[Mistral Vibe](https://github.com/mistralai/mistral-vibe)** | Mistral AI | with built-in ACP support (`vibe-acp`) |
| **Custom** | Various | [Any ACP-compatible agent](https://agentclientprotocol.com/overview/agents) (e.g., OpenCode, Qwen Code, Kiro) |
| **[OpenCode](https://github.com/anomalyco/opencode)** | Multi-provider | with built-in ACP support (`opencode acp`) |
| **Custom** | Various | [Any ACP-compatible agent](https://agentclientprotocol.com/overview/agents) (e.g., Qwen Code, Kiro) |

### Key Features

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/acp-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This page documents which Agent Client Protocol (ACP) features are supported by

The [Agent Client Protocol (ACP)](https://agentclientprotocol.com/) is an open standard for communication between AI agents and client applications. It defines how clients send prompts, receive responses, handle permissions, and manage sessions.

Agent Client implements ACP as a **client**, communicating with ACP-compatible agents like Claude Code, Codex, Gemini CLI, and Mistral Vibe.
Agent Client implements ACP as a **client**, communicating with ACP-compatible agents like Claude Code, Codex, Gemini CLI, Mistral Vibe, and OpenCode.

## Methods

Expand Down
1 change: 1 addition & 0 deletions docs/usage/context-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Each agent uses its own context file:
| Codex | `AGENTS.md` |
| Gemini CLI | `GEMINI.md` |
| Mistral Vibe | `AGENTS.md` |
| OpenCode | `AGENTS.md` (falls back to `CLAUDE.md`) |

Place the context file in your **vault root** to have the agent read it automatically.

Expand Down
16 changes: 15 additions & 1 deletion src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
import { AgentClientSettingTab } from "./ui/SettingsTab";
import { AcpClient } from "./acp/acp-client";
import {
absorbCustomAgents,
normalizeCustomAgent,
ensureUniqueCustomAgentIds,
normalizePresetAgents,
Expand Down Expand Up @@ -1355,6 +1356,19 @@ export default class AgentClientPlugin extends Plugin {
const D = DEFAULT_SETTINGS;
let migratedSecrets = false;

// Docs-advised custom agents (e.g. the OpenCode recipe our docs
// carried before the preset existed) migrate into their new preset
// entries. Must run before ensureUniqueCustomAgentIds renames the
// colliding custom to "{id}-2".
const absorption = absorbCustomAgents(raw, PRESET_AGENTS);
raw.customAgents = absorption.customAgents;
raw.presetAgents = absorption.presetAgents;
for (const entry of absorption.absorbed) {
new Notice(
`[Agent Client] ${entry.displayName} is now a preset agent — your custom agent settings were migrated.`,
);
}

// Extract settings sub-objects
const re = obj(raw.exportSettings) ?? {};
const rd = obj(raw.displaySettings) ?? {};
Expand Down Expand Up @@ -1545,7 +1559,7 @@ export default class AgentClientPlugin extends Plugin {
this.ensureAtLeastOneEnabled();
this.ensureDefaultAgentId();

if (migratedSecrets) {
if (migratedSecrets || absorption.absorbed.length > 0) {
await this.saveSettings();
}
}
Expand Down
27 changes: 27 additions & 0 deletions src/services/preset-agents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ export interface PresetAgentDefinition {
/** data.json 旧形式 top-level command-path key (claude / gemini only). */
legacyCommandPathKey?: string;
apiKey?: PresetAgentApiKey;
/**
* Custom-agent id this preset absorbs on first load (one-shot migration).
* Set ONLY for presets whose id our docs historically advised as a
* custom-agent recipe — those customs are docs-followers by near
* certainty, so adopting their settings preserves what the id meant
* (fence pins, saved sessions, default agent). Deliberately NOT a
* generic custom-id==presetId rule: customs colliding with the original
* four preset ids are dead weight under preset-first resolution, and
* absorbing them would overwrite live preset settings.
*/
absorbsCustomAgentId?: string;
installHint: PresetAgentInstallHint;
settingsCopy: PresetAgentSettingsCopy;
/** Page name under docs/agent-setup/ (for setup-guide references). */
Expand Down Expand Up @@ -192,6 +203,22 @@ export const PRESET_AGENTS: readonly PresetAgentDefinition[] = [
},
docsPage: "mistral-vibe",
},
{
presetId: "opencode",
defaultDisplayName: "OpenCode",
defaultCommand: "opencode",
defaultArgs: ["acp"],
absorbsCustomAgentId: "opencode",
installHint: {
default: "curl -fsSL https://opencode.ai/install | bash",
nativeWindows: "npm install -g opencode-ai",
},
settingsCopy: {
pathDesc:
'Command name or path to opencode. Use just "opencode" to let the login shell resolve it, or enter an absolute path.',
},
docsPage: "opencode",
},
];

/**
Expand Down
Loading
Loading