Add Dir Opencode banner
0xkuze 0xkuze

Add Dir Opencode

Development community

Description

the add-dir command from claude code but for opencode

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

/add-dir for OpenCode

Add working directories to your [OpenCode](https://opencode.ai) session — inspired by Claude Code's [`/add-dir`](https://docs.anthropic.com/en/docs/claude-code/cli-usage#add-dir) command.

When you need an agent to read, edit, or search files outside the current project, this plugin grants access without permission popups. ![add_dir_2](https://github.com/user-attachments/assets/9b048406-0ab0-4510-a424-f5e83923db70)

Quick Start

opencode plugin opencode-add-dir -g

Restart OpenCode. The plugin auto-registers itself in your `tui.json` — no manual config needed.

Alternative: local development
git clone https://github.com/kuzeofficial/add-dir-opencode.git
cd add-dir-opencode
bun install && bun run deploy

Add the local path to both configs:

// ~/.config/opencode/opencode.json
{ "plugin": ["/path/to/add-dir-opencode"] }

// ~/.config/opencode/tui.json
{ "plugin": ["/path/to/add-dir-opencode"] }

Commands

All commands are interactive TUI dialogs — type the command and select from autocomplete.

Command Dialog Description
/add-dir Text input + remember checkbox Add a working directory. Toggle [x] Remember with tab to persist across sessions.
/list-dir Alert Shows all added directories.
/remove-dir Select list + confirm Pick a directory to remove, then confirm.

How It Works

The plugin has two parts: a **TUI plugin** for the interactive dialogs and a **server plugin** for silent permission handling.

TUI Plugin

Handles all three slash commands via dialogs. Directories are stored in two files under `~/.local/share/opencode/add-dir/`:

  • directories.json — Persisted dirs, survive restarts.
  • session-dirs.json — Session-only dirs, cleared automatically on startup.

Which file gets written depends on the "Remember across sessions" toggle in `/add-dir`.

Respects `XDG_DA