@argabor/caveman-opencode-plugin
v0.2.0
Published
Caveman communication mode plugin for opencode (V1 and V2)
Downloads
135
Readme
@argabor/caveman-opencode-plugin
Caveman communication mode plugin for opencode. Adapts JuliusBrussee/caveman into hook-based plugin.
Fork of
caveman-opencode-pluginby dantesCode, adding OpenCode V2 support (dual-generation export). Published under the@argaborscope.
Installation
# Global install
opencode plugin @argabor/caveman-opencode-plugin@latest --global
# Or local install
opencode plugin @argabor/caveman-opencode-plugin@latestNPM: https://www.npmjs.com/package/@argabor/caveman-opencode-plugin
Add to opencode.json.
OpenCode V1:
{
"plugin": ["@argabor/caveman-opencode-plugin"]
}OpenCode V2:
{
"plugins": ["@argabor/caveman-opencode-plugin"]
}OpenCode V2 support
This package is dual-generation: one default export provides both implementations.
- V1 calls
server()— requires OpenCode>= 1.18.29for the object entrypoint. - V2 reads
id+setup()and ignoresserver().
The V2 half uses the V2 domain APIs:
ctx.session.hook("context", ...)replaces the V1experimental.chat.system.transformhook for system-prompt injection.ctx.command.transform(...)replaces the V1config+command.execute.beforepair for the/caveman*commands.
caveman.json is read from the same locations on both generations (project root, then $XDG_CONFIG_HOME/opencode/).
On V1 hosts
>= 1.17.10an embedded V2 core may also invokesetup()in a registration-only pass, which can add extra[v2]log lines. It does not change V1 behavior.
Setup
Run the interactive setup script:
# Download and run
curl -fsSL https://raw.githubusercontent.com/argabor/caveman-opencode-plugin/main/setup.sh | bash
# Or clone and run locally
curl -O https://raw.githubusercontent.com/argabor/caveman-opencode-plugin/main/setup.sh
bash setup.shOr create caveman.json manually:
# Project-level config (recommended)
echo '{"enabled":true,"defaultMode":"full","features":{"caveman":true,"commit":true,"review":true}}' > caveman.json
# Or global config in ~/.config/opencode/
mkdir -p ~/.config/opencode
echo '{"enabled":true,"defaultMode":"full","features":{"caveman":true,"commit":true,"review":true}}' > ~/.config/opencode/caveman.jsonUpstream
Behavior mirrors JuliusBrussee/caveman methodology. See UPSTREAM.md for reference and intentional differences.
Configuration
caveman.json example:
{
"enabled": true,
"defaultMode": "full",
"features": {
"caveman": true,
"commit": true,
"review": true
}
}enabled— master switchdefaultMode— mode on session start (lite,full,ultra,wenyan-lite,wenyan-full,wenyan-ultra,off)features— toggle individual features:caveman— enable caveman communication modecommit— enable/caveman-commitcommandreview— enable/caveman-reviewcommand
Config file locations
Plugin looks for caveman.json in this order:
./caveman.json(project root)$XDG_CONFIG_HOME/opencode/caveman.json(global, defaults to~/.config/opencode/caveman.json)
Both files are merged per key, so a global defaultMode is kept unless the project file sets its own. The project file takes precedence over global for the keys it contains.
Commands
| Command | Description |
|---------|-------------|
| /caveman <mode> | Switch caveman mode |
| /caveman-commit <diff> | Generate conventional commit message |
| /caveman-review <code> | One-line code review |
Modes
| Mode | Description |
|------|-------------|
| lite | Light compression, keep some filler |
| full | Full caveman rules (default) |
| ultra | Maximum brevity |
| wenyan-lite | Lite in classical Chinese style |
| wenyan-full | Full classical Chinese style |
| wenyan-ultra | Ultra classical Chinese style |
| off / normal | Disable caveman |
Companion Plugin
For context compression, pair with @tarquinen/opencode-dcp.
License
MIT
