Files
backnotprop__plannotator/apps/opencode-plugin/README.md
T

176 lines
5.9 KiB
Markdown
Raw Normal View History

# @plannotator/opencode
**Annotate plans. Not in the terminal.**
Interactive Plan Review for OpenCode. Select the exact parts of the plan you want to change—mark for deletion, add a comment, or suggest a replacement. Feedback flows back to your agent automatically.
Feat/save to obsidian (#11) * Add Obsidian integration for auto-saving approved plans - Auto-detect Obsidian vaults from system config - Settings UI with vault dropdown and folder config - Save plans with YAML frontmatter (created, source, tags) - Extract tags heuristically from H1 title and code fence languages - Human-readable filenames: "Title - Jan 2, 2026 2-30pm.md" - Cross-platform support (macOS, Windows, Linux) - Add local test script for hook simulation * Add backlinks and improve filename generation - Add [[Plannotator Plans]] backlink to saved notes for graph connectivity - Extract title from H1 for human-readable filenames - Format: "Title - Jan 2, 2026 2-30pm.md" - Add bulk test script for ~/.claude/plans - Add fix script to add backlinks to existing vault files * Add Obsidian integration docs to README, landing page, and plugins - Root README: Quick note about Obsidian support after video table - apps/hook README: Detailed setup and example file format - apps/opencode-plugin README: Feature list and setup instructions - Landing page: New "Save to Obsidian" feature card Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add Obsidian Integration section to README * Screenshot Obsidian settings Added an implementation plan section for user authentication. * Update README with Obsidian auto-save feature Added information about auto-saving approved plans to Obsidian. * Update README with Obsidian integration link Added link to details about Obsidian integration. * Update README to include Obsidian auto-saving feature Clarified the new feature for saving to Obsidian with a link. ---------
2026-01-02 11:08:19 -08:00
Obsidian users can auto-save approved plans to Obsidian as well. [See details](#obsidian-integration)
<table>
<tr>
<td align="center">
<strong>Watch Demo</strong><br><br>
<a href="https://youtu.be/_N7uo0EFI-U">
<img src="https://img.youtube.com/vi/_N7uo0EFI-U/maxresdefault.jpg" alt="Watch Demo" width="600" />
</a>
</td>
</tr>
</table>
## Install
Add to your `opencode.json`:
```json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@plannotator/opencode@latest"]
}
```
Restart OpenCode. By default, the `submit_plan` tool is available to OpenCode's `plan` agent, not to `build` or other primary agents.
> **Slash commands:** Run the install script to get `/plannotator-review`, `/plannotator-annotate`, and `/plannotator-last`:
> ```bash
> curl -fsSL https://plannotator.ai/install.sh | bash
> ```
> This also clears any cached plugin versions.
## Workflow Modes
Plannotator supports three OpenCode workflows:
- **`plan-agent`** (default): `submit_plan` is available to OpenCode's built-in `plan` agent plus any extra agents listed in `planningAgents`. This keeps Plannotator integrated with OpenCode plan mode without nudging `build` to call it.
- **`manual`**: `submit_plan` is not registered. Use `/plannotator-last`, `/plannotator-annotate`, `/plannotator-review`, and `/plannotator-archive` when you want Plannotator.
- **`all-agents`**: legacy broad behavior. Primary agents can see and call `submit_plan`.
Default config:
```json
{
"$schema": "https://opencode.ai/config.json",
"plugin": [
["@plannotator/opencode@latest", {
"workflow": "plan-agent",
"planningAgents": ["plan"]
}]
]
}
```
If you use other OpenCode plugins, keep everything in one `plugin` array and attach Plannotator's options directly to the Plannotator entry:
```json
{
"$schema": "https://opencode.ai/config.json",
"plugin": [
["@plannotator/opencode@latest", {
"workflow": "plan-agent",
"planningAgents": ["plan", "sisyphus"]
}],
"@tarquinen/opencode-dcp@latest",
"octto",
"oh-my-opencode-slim"
]
}
```
Do not put `{ "workflow": "plan-agent" }` as its own item in the `plugin` array. OpenCode plugin entries must be either a plugin string or a two-item array like `[pluginName, options]`.
Restore the old broad behavior:
```json
{
"$schema": "https://opencode.ai/config.json",
"plugin": [
["@plannotator/opencode@latest", {
"workflow": "all-agents"
}]
]
}
```
Use commands only:
```json
{
"$schema": "https://opencode.ai/config.json",
"plugin": [
["@plannotator/opencode@latest", {
"workflow": "manual"
}]
]
}
```
## How It Works
1. The configured planning agent calls `submit_plan` → Plannotator opens in your browser
2. Select text → annotate (delete, replace, comment)
3. **Approve** → Agent proceeds with implementation
4. **Request changes** → Annotations sent back as structured feedback
## Features
- **Visual annotations**: Select text, choose an action, see feedback in the sidebar
- **Runs locally**: No network requests. Plans never leave your machine.
- **Private sharing**: Plans and annotations compress into the URL itself—share a link, no accounts or backend required
- **Plan Diff**: See what changed when the agent revises a plan after feedback
- **Annotate last message**: Run `/plannotator-last` to annotate the agent's most recent response
- **Annotate files, folders, and URLs**: Run `/plannotator-annotate` when you want manual review of an artifact
Feat/save to obsidian (#11) * Add Obsidian integration for auto-saving approved plans - Auto-detect Obsidian vaults from system config - Settings UI with vault dropdown and folder config - Save plans with YAML frontmatter (created, source, tags) - Extract tags heuristically from H1 title and code fence languages - Human-readable filenames: "Title - Jan 2, 2026 2-30pm.md" - Cross-platform support (macOS, Windows, Linux) - Add local test script for hook simulation * Add backlinks and improve filename generation - Add [[Plannotator Plans]] backlink to saved notes for graph connectivity - Extract title from H1 for human-readable filenames - Format: "Title - Jan 2, 2026 2-30pm.md" - Add bulk test script for ~/.claude/plans - Add fix script to add backlinks to existing vault files * Add Obsidian integration docs to README, landing page, and plugins - Root README: Quick note about Obsidian support after video table - apps/hook README: Detailed setup and example file format - apps/opencode-plugin README: Feature list and setup instructions - Landing page: New "Save to Obsidian" feature card Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add Obsidian Integration section to README * Screenshot Obsidian settings Added an implementation plan section for user authentication. * Update README with Obsidian auto-save feature Added information about auto-saving approved plans to Obsidian. * Update README with Obsidian integration link Added link to details about Obsidian integration. * Update README to include Obsidian auto-saving feature Clarified the new feature for saving to Obsidian with a link. ---------
2026-01-02 11:08:19 -08:00
- **Obsidian integration**: Auto-save approved plans to your vault with frontmatter and tags
## Environment Variables
| Variable | Description |
|----------|-------------|
| `PLANNOTATOR_REMOTE` | Set to `1` / `true` for remote mode, `0` / `false` for local mode, or leave unset for SSH auto-detection. Uses a fixed port in remote mode; browser-opening behavior depends on the environment. |
| `PLANNOTATOR_PORT` | Fixed port to use. Default: random locally, `19432` for remote sessions. |
| `PLANNOTATOR_BROWSER` | Custom browser to open plans in. macOS: app name or path. Linux/Windows: executable path. |
| `PLANNOTATOR_SHARE_URL` | Custom share portal URL for self-hosting. Default: `https://share.plannotator.ai`. |
| `PLANNOTATOR_PASTE_URL` | Custom paste service URL for self-hosting. Default: `https://plannotator-paste.plannotator.workers.dev`. |
| `PLANNOTATOR_PLAN_TIMEOUT_SECONDS` | Timeout for `submit_plan` review wait. Default: `345600` (96h). Set `0` to disable timeout. |
Fix/devcontainer & plan auto switching (opencode) (#31) * Refactor: shared server package with PLANNOTATOR_REMOTE env var - Create packages/server/ with shared server implementation - Add PLANNOTATOR_REMOTE=1 env var for devcontainer/SSH mode - Deprecate SSH_CONNECTION detection (still works with warning) - Both Claude Code and OpenCode now use identical server logic - OpenCode gains Obsidian/Bear integrations and remote detection - Update documentation with environment variables section Fixes #27 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Remove PLANNOTATOR_ORIGIN env var, fix onReady callback timing - Remove PLANNOTATOR_ORIGIN hack from Claude Code hook (hardcode "claude-code") - Fix onReady callback to pass port directly (was referencing undefined server) - Create tests/manual/test-server.ts for testing either origin - Update test-hook-2.sh to use new test server with opencode origin 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add devcontainer test setup, reduce logging verbosity - Add tests/devcontainer/ with devcontainer.json for testing remote mode - Add tests/opencode-local/ for local OpenCode testing - Update package.json build script for proper bundling - Remove verbose multi-line error messages, keep useful errors - Clean up unused deprecationWarned variable 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add devcontainer support and documentation - Add PLANNOTATOR_REMOTE env var for container/remote detection - Remove console logging (silent operation) - Add devcontainer.md with full setup instructions - Add devcontainer section to OpenCode plugin README - Add port-only test setup to reproduce common misconfiguration - Update test devcontainers to forward port 4096 for opencode web - Bump version to 0.4.1 Fixes #27 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Update CLAUDE.md: legacy SSH detection, not deprecated Removed incorrect mention of deprecation warning - SSH_TTY/SSH_CONNECTION detection is silent by design. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix OpenCode agent switching after plan approval After approving a plan, the conversation context stayed in "plan" mode even though the TUI showed "build". This caused edits to fail because the plan agent has edit permissions denied. The fix uses session.prompt() to inject a message with agent: "build", which triggers a new agentic loop with proper build agent permissions. Fixes #29 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-06 14:25:19 -08:00
## Devcontainer / Docker
Works in containerized environments. Set the env vars and forward the port:
Fix/devcontainer & plan auto switching (opencode) (#31) * Refactor: shared server package with PLANNOTATOR_REMOTE env var - Create packages/server/ with shared server implementation - Add PLANNOTATOR_REMOTE=1 env var for devcontainer/SSH mode - Deprecate SSH_CONNECTION detection (still works with warning) - Both Claude Code and OpenCode now use identical server logic - OpenCode gains Obsidian/Bear integrations and remote detection - Update documentation with environment variables section Fixes #27 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Remove PLANNOTATOR_ORIGIN env var, fix onReady callback timing - Remove PLANNOTATOR_ORIGIN hack from Claude Code hook (hardcode "claude-code") - Fix onReady callback to pass port directly (was referencing undefined server) - Create tests/manual/test-server.ts for testing either origin - Update test-hook-2.sh to use new test server with opencode origin 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add devcontainer test setup, reduce logging verbosity - Add tests/devcontainer/ with devcontainer.json for testing remote mode - Add tests/opencode-local/ for local OpenCode testing - Update package.json build script for proper bundling - Remove verbose multi-line error messages, keep useful errors - Clean up unused deprecationWarned variable 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add devcontainer support and documentation - Add PLANNOTATOR_REMOTE env var for container/remote detection - Remove console logging (silent operation) - Add devcontainer.md with full setup instructions - Add devcontainer section to OpenCode plugin README - Add port-only test setup to reproduce common misconfiguration - Update test devcontainers to forward port 4096 for opencode web - Bump version to 0.4.1 Fixes #27 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Update CLAUDE.md: legacy SSH detection, not deprecated Removed incorrect mention of deprecation warning - SSH_TTY/SSH_CONNECTION detection is silent by design. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix OpenCode agent switching after plan approval After approving a plan, the conversation context stayed in "plan" mode even though the TUI showed "build". This caused edits to fail because the plan agent has edit permissions denied. The fix uses session.prompt() to inject a message with agent: "build", which triggers a new agentic loop with proper build agent permissions. Fixes #29 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-06 14:25:19 -08:00
```json
{
"containerEnv": {
"PLANNOTATOR_REMOTE": "1",
"PLANNOTATOR_PORT": "9999"
},
"forwardPorts": [9999]
}
```
If nothing opens automatically, open `http://localhost:9999` when `submit_plan` is called.
Fix/devcontainer & plan auto switching (opencode) (#31) * Refactor: shared server package with PLANNOTATOR_REMOTE env var - Create packages/server/ with shared server implementation - Add PLANNOTATOR_REMOTE=1 env var for devcontainer/SSH mode - Deprecate SSH_CONNECTION detection (still works with warning) - Both Claude Code and OpenCode now use identical server logic - OpenCode gains Obsidian/Bear integrations and remote detection - Update documentation with environment variables section Fixes #27 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Remove PLANNOTATOR_ORIGIN env var, fix onReady callback timing - Remove PLANNOTATOR_ORIGIN hack from Claude Code hook (hardcode "claude-code") - Fix onReady callback to pass port directly (was referencing undefined server) - Create tests/manual/test-server.ts for testing either origin - Update test-hook-2.sh to use new test server with opencode origin 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add devcontainer test setup, reduce logging verbosity - Add tests/devcontainer/ with devcontainer.json for testing remote mode - Add tests/opencode-local/ for local OpenCode testing - Update package.json build script for proper bundling - Remove verbose multi-line error messages, keep useful errors - Clean up unused deprecationWarned variable 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add devcontainer support and documentation - Add PLANNOTATOR_REMOTE env var for container/remote detection - Remove console logging (silent operation) - Add devcontainer.md with full setup instructions - Add devcontainer section to OpenCode plugin README - Add port-only test setup to reproduce common misconfiguration - Update test devcontainers to forward port 4096 for opencode web - Bump version to 0.4.1 Fixes #27 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Update CLAUDE.md: legacy SSH detection, not deprecated Removed incorrect mention of deprecation warning - SSH_TTY/SSH_CONNECTION detection is silent by design. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix OpenCode agent switching after plan approval After approving a plan, the conversation context stayed in "plan" mode even though the TUI showed "build". This caused edits to fail because the plan agent has edit permissions denied. The fix uses session.prompt() to inject a message with agent: "build", which triggers a new agentic loop with proper build agent permissions. Fixes #29 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-06 14:25:19 -08:00
See [devcontainer.md](./devcontainer.md) for full setup details.
Feat/save to obsidian (#11) * Add Obsidian integration for auto-saving approved plans - Auto-detect Obsidian vaults from system config - Settings UI with vault dropdown and folder config - Save plans with YAML frontmatter (created, source, tags) - Extract tags heuristically from H1 title and code fence languages - Human-readable filenames: "Title - Jan 2, 2026 2-30pm.md" - Cross-platform support (macOS, Windows, Linux) - Add local test script for hook simulation * Add backlinks and improve filename generation - Add [[Plannotator Plans]] backlink to saved notes for graph connectivity - Extract title from H1 for human-readable filenames - Format: "Title - Jan 2, 2026 2-30pm.md" - Add bulk test script for ~/.claude/plans - Add fix script to add backlinks to existing vault files * Add Obsidian integration docs to README, landing page, and plugins - Root README: Quick note about Obsidian support after video table - apps/hook README: Detailed setup and example file format - apps/opencode-plugin README: Feature list and setup instructions - Landing page: New "Save to Obsidian" feature card Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add Obsidian Integration section to README * Screenshot Obsidian settings Added an implementation plan section for user authentication. * Update README with Obsidian auto-save feature Added information about auto-saving approved plans to Obsidian. * Update README with Obsidian integration link Added link to details about Obsidian integration. * Update README to include Obsidian auto-saving feature Clarified the new feature for saving to Obsidian with a link. ---------
2026-01-02 11:08:19 -08:00
## Obsidian Integration
Save approved plans directly to your Obsidian vault.
1. Open Settings in Plannotator UI
2. Enable "Obsidian Integration" and select your vault
3. Approved plans save automatically with:
- Human-readable filenames: `Title - Jan 2, 2026 2-30pm.md`
- YAML frontmatter (`created`, `source`, `tags`)
- Auto-extracted tags from plan title and code languages
- Backlink to `[[Plannotator Plans]]` for graph view
<img width="1190" height="730" alt="image" src="https://github.com/user-attachments/assets/5036a3ea-e5e8-426c-882d-0a1d991c1625" />
## Links
- [Website](https://plannotator.ai)
- [GitHub](https://github.com/backnotprop/plannotator)
- [Claude Code Plugin](https://github.com/backnotprop/plannotator/tree/main/apps/hook)
## License
Copyright 2025 backnotprop Licensed under [MIT](../../LICENSE-MIT) or [Apache-2.0](../../LICENSE-APACHE).