Token-efficient supertools for opencode agents. Each tool saves significant tokens by replacing multi-step workflows with single, optimized calls.
| Tool | Token Savings | Description |
|---|---|---|
apply_patch |
~90% | Apply unified diff patch instead of full-file write |
batch_edit |
~80% | Search and replace across multiple files in one call |
lint_file |
~60% | Run linter on specific file, return errors only |
run_tests |
~50% | Run specific test file, return failures only |
| Tool | Token Savings | Description |
|---|---|---|
curse_score |
~90% | Rank files by risk via curse score algorithm |
bus_factor |
~85% | Ownership concentration per directory |
implicit_coupling |
~100% | Hidden co-change dependencies |
ownership |
~80% | Author breakdown per file/directory |
blast_radius |
~95% | Impact analysis — what might break? |
git_diff |
~90% | Structured git diff output (staged, file, between refs) |
trend |
~90% | Curse score trends — files getting more dangerous |
pr_risk |
~90% | Risk assessment of uncommitted changes |
git_log_structured |
~50% | Structured git log with filters |
| Tool | Token Savings | Description |
|---|---|---|
gh_pr_create |
~90% | Create a GitHub pull request |
gh_pr_status |
~90% | Check PR mergeability — reviews, CI checks, conflicts |
gh_pr_comment |
~90% | Add a comment to a GitHub pull request |
gitlab_mr_create |
~90% | Create a GitLab merge request |
gitlab_mr_status |
~90% | Check GitLab MR status — state, mergeability, CI |
gitlab_mr_comment |
~90% | Add a comment to a GitLab merge request |
Apply a unified diff patch to a file. Uses standard @@ -old +new @@ format.
Parameters:
file_path(string) — Absolute path to the filepatch(string) — Unified diff patch
Search and replace across multiple files matching a glob pattern.
Parameters:
search(string) — Regex pattern to findreplace(string) — Replacement text ($1, $2 for capture groups)glob(string) — File pattern (e.g.,src/**/*.ts)path(string, optional) — Base directorydry_run(boolean, optional) — Preview without writing
Run appropriate linter on a file and return only errors/warnings.
Parameters:
file_path(string) — File to lintlinter(string, optional) —eslint,phpstan,pint,ruff, orauto
Run tests for a specific file and return only failures.
Parameters:
test_file(string) — Test file to runfilter(string, optional) — Test name patternframework(string, optional) —bun,phpunit,jest,vitest, orauto
Get git diff as structured output with file-level summary and line counts. Complements apply_patch (produce diff → apply diff).
Parameters:
staged(boolean, optional) — Show staged changes (git diff --staged)file(string, optional) — Specific file path to difffrom(string, optional) — From commit/branch/refto(string, optional) — To commit/branch/ref (defaults to HEAD if from is set)
Add to your opencode.json:
{
"plugin": ["file:///home/robby/four-opencode-supertools"]
}TUI sidebar: also register in ~/.config/opencode/tui.json if using GitLab MR tools.
Restart opencode for the plugin to load.
mise run setup # Install dependencies
mise run build # Build the plugin
mise run test # Run tests
mise run typecheck # Type check
mise run lint # Lint code
mise run format # Format code- Bun >= 1.0
- opencode with plugin support
See AGENTS.md for code architecture and ROADMAP.md for the evolution plan.
Apache-2.0 © Four Bytes / Four Flames GmbH & Co. KG
If these tools save you tokens, consider leaving a ⭐ on GitHub.