Copilot CLI

unlisted

by boschma1

Embed the GitHub Copilot CLI as an AI coding agent in your vault. The vault becomes Copilot's working directory: chat, file read/write, search, shell, slash commands, @mentions, plan mode, and inline edit.

Updated 12d ago
View on GitHub

Copilot CLI for Obsidian

Embed the GitHub Copilot CLI as an AI coding agent inside your Obsidian vault. Your vault becomes Copilot's working directory — chat, file read/write, search, shell commands, and multi‑step workflows all work out of the box.

The plugin talks to the Copilot CLI over the Agent Client Protocol (ACP) (copilot --acp), so it streams responses, tool calls, diffs, and plans in real time and handles tool‑permission prompts inline.

Inspired by Claudian (MIT), which pioneered embedding coding agents in Obsidian. This project is an independent implementation targeting the GitHub Copilot CLI.

Features

  • Chat sidebar — talk to Copilot with your vault as the working directory.
  • Streaming — responses, reasoning, tool calls, and diffs render live.
  • Tool permissions — approve or reject sensitive actions inline (or auto‑approve).
  • Plan mode — toggle with Shift+Tab; Copilot designs before it acts.
  • Slash commands — type / for Copilot's available commands.
  • @mentions — type @ to attach vault files to your prompt.
  • Inline edit — select text in a note and rewrite it with a diff preview.
  • MCP servers — pass extra Model Context Protocol servers into each session.
  • Models & modes — pick a model and a default mode in settings.

Requirements

  • Desktop only (the plugin spawns the Copilot CLI as a subprocess).
  • GitHub Copilot CLI installed and authenticated:
    # install (see GitHub docs for the current method), then:
    copilot            # run once and use /login to authenticate
    
  • A local (filesystem) vault — the agent needs a real working directory.

Installation (from source)

git clone https://github.com/boschma1/copilot-cli-obsidian.git
cd copilot-cli-obsidian
npm install
npm run build

Copy main.js, manifest.json, and styles.css into your vault at:

<vault>/.obsidian/plugins/copilot-cli-obsidian/

Then enable Copilot CLI in Settings → Community plugins.

For development, symlink the build output into the vault and run the watcher:

ln -s "$(pwd)/main.js"      "<vault>/.obsidian/plugins/copilot-cli-obsidian/main.js"
ln -s "$(pwd)/manifest.json" "<vault>/.obsidian/plugins/copilot-cli-obsidian/manifest.json"
ln -s "$(pwd)/styles.css"   "<vault>/.obsidian/plugins/copilot-cli-obsidian/styles.css"
npm run dev

Usage

  • Open the chat from the ribbon (robot icon) or the command “Copilot CLI: Open chat”.
  • Type a prompt and press Enter (Shift+Enter for a newline).
  • Press Stop to cancel a running turn.
  • Toggle Plan / Agent with the header button or Shift+Tab.
  • Inline edit: select text in a note → run the command “Copilot CLI: Inline edit selection” (bind a hotkey in Obsidian).

Settings

SettingPurpose
CLI pathPath to the copilot binary (auto‑detected if empty).
ModelPreferred model id (empty = Copilot default).
Default modeAgent or Plan for new sessions.
Tool permissionsAsk each time, or auto‑approve.
Show reasoningShow/hide the agent's thinking stream.
MCP serversJSON array of ACP McpServer entries.
Environment variablesExtra env for the CLI process (KEY=VALUE per line).
Additional directoriesExtra absolute paths the agent may access.

How it works

Obsidian plugin  ──stdin/stdout (newline‑delimited JSON‑RPC)──▶  copilot --acp
      │  initialize → session/new(cwd = vault) → session/prompt          │
      │  ◀── session/update (message / thought / tool_call / plan) ───────┤
      │  ◀── session/request_permission ─────────────────────────────────┤
      │  ◀── fs/read_text_file · fs/write_text_file ─────────────────────┘
  • src/acp/ — ACP transport (jsonRpc.ts), typed client (client.ts), subprocess management (subprocess.ts), and protocol types (types.ts).
  • src/agent/CopilotAgent orchestration and the vault filesystem delegate.
  • src/chat/ — the sidebar view and per‑turn renderer.
  • src/inline/ — the inline‑edit modal.
  • src/settings.ts — settings model and tab.
  • src/main.ts — plugin entry point.

License

MIT — see LICENSE.

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.