opencode-pi-augment-plugin
v0.1.0
Published
OpenCode plugin that ports pi-augment style prompt enhancement through a command-driven workflow.
Maintainers
Readme
OpenCode Pi Augment Plugin
An OpenCode plugin that ports the core idea of pi-augment into a command-driven workflow for OpenCode.
Version 1 is intentionally scoped to a single command:
/augment
It does not attempt transparent prompt interception or automatic editor rewrites before send.
What it does
This plugin enhances raw user prompts into a more structured, execution-ready form.
Current behavior includes:
- intent detection for common request types
- rewrite mode selection (
plainvsexecution-contract) - structured prompt expansion for implementation, planning, bugfix, analysis, and documentation tasks
- optional model-family and project-context hints
The plugin exposes that behavior through an OpenCode TUI command handler instead of trying to patch the editor input pipeline.
Install
1. Install dependencies
npm install2. Build the plugin
npm run build3. Make the plugin available to OpenCode
This repository is designed as a standalone plugin package. Load it using your OpenCode plugin workflow.
At a high level, OpenCode plugins are typically loaded from one of these paths:
.opencode/plugins/- OpenCode plugin configuration
Depending on your setup, that usually means either:
- linking the built plugin into an OpenCode plugin directory, or
- referencing the built package from your OpenCode config
Because OpenCode environments can differ, treat this repository as the plugin source package and connect it to your local OpenCode installation using the plugin-loading mechanism supported by your setup.
Usage
Once the plugin is loaded into OpenCode, use the command-oriented workflow:
/augment write release notes for the latest bugfixesYou can also invoke /augment with the prompt text supplied through command arguments if your OpenCode setup passes command payload fields separately.
The plugin will:
- detect the likely intent of the request
- choose a rewrite mode
- return an augmented prompt body
The current implementation is designed for command execution via tui.command.execute.
Example
Input:
/augment plan a plugin migration from pi to opencodeExpected outcome:
- the command is recognized as
/augment - the input prompt is extracted
- the prompt is rewritten into a more structured result
- the rewritten result is returned by the plugin command handler
Development
Build
npm run buildTypecheck
npm run typecheckLint
npm run lintLimitations
Version 1 is deliberately conservative.
Included in v1
/augmentcommand handling- reusable augmentation core
- command-result-based prompt rewriting
Not included in v1
- transparent pre-send prompt interception
- automatic replacement of whatever is already in the editor
- deep OpenCode core patches
- richer TUI customization beyond command execution
These limitations are intentional because current planning evidence supports a command-triggered plugin path more strongly than an editor-interception path.
Repository layout
src/augment.ts # reusable prompt augmentation logic
src/index.ts # OpenCode-facing plugin command entrypoint
package.json # package manifest and scriptsStatus
This repository is currently focused on the first usable milestone:
- greenfield plugin structure
- reusable augment core
/augmentcommand-only integration
If later OpenCode plugin APIs expose stronger input/editor hooks, a future version can expand beyond the current command-only model.
