@al-bashkir/opencode-caveman
v0.1.0
Published
Caveman mode plugin and commands for OpenCode
Readme
opencode-caveman
caveman rewritten for opencode as an installable plugin that self-registers slash commands.
Original repo: https://github.com/JuliusBrussee/caveman
What it includes
src/index.ts: persistent caveman mode plugin foropencode- Dynamic
/caveman,/caveman-commit,/caveman-review, and/caveman:compresscommand registration via pluginconfig()hook
Features
- Persistent per-session response mode
- Natural language triggers like
talk like cavemanandnormal mode - Intensity levels:
lite,full,ultra,wenyan-lite,wenyan,wenyan-ultra - Compaction context hook so active mode survives session compaction better
- Dedicated commit and review slash commands for
opencode - Memory-file compression command with upstream-style backup, validation, and repair flow
- No separate markdown command files required
Develop
npm install
npm run typecheck
npm run buildInstall into opencode
Create the global plugin directory if it does not exist:
mkdir -p ~/.config/opencode/pluginsSymlink this repo into your opencode config:
ln -sf "/Users/bashkir/Projects/caveman-opencode/src/index.ts" ~/.config/opencode/plugins/caveman.tsRestart opencode after linking.
The plugin injects its own slash commands at startup, similar to DCP.
Publish to npm
Log in to npm and publish the package:
npm login
npm publishprepublishOnly runs npm run typecheck && npm run build automatically before publish.
Install from npm
Once published, add package name to ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@al-bashkir/opencode-caveman"]
}Restart opencode. The plugin registers /caveman, /caveman-commit, /caveman-review, and /caveman:compress automatically.
Usage
/caveman/caveman ultra/caveman wenyan/caveman normal/caveman-commit/caveman-review/caveman:compress CLAUDE.md/caveman-compress CLAUDE.md
Natural language also works:
talk like cavemancaveman modestop cavemannormal mode
Caveman Compress
Use /caveman:compress <filepath> to shrink natural-language memory files such as CLAUDE.md,
preferences docs, or todo notes.
Examples:
/caveman:compress CLAUDE.md/caveman:compress docs/preferences.md/caveman-compress todos.md
Behavior:
- Accepts
.md,.txt,.rst, and extensionless natural-language files - Rejects code/config files such as
.ts,.js,.json,.yaml,.toml,.sh - Rejects backup files like
CLAUDE.original.md - Creates backup on first run:
CLAUDE.md->CLAUDE.original.md - Aborts if backup already exists, matching the current upstream implementation
- Preserves code blocks, inline code, URLs, file paths, commands, headings, numbers, and technical terms
- Runs local validation after compression
- If validation fails, asks model for targeted fixes up to two times
- Restores original file and removes backup if validation still fails
Implementation note
This plugin now follows the DCP pattern:
- injects commands into
opencodeconfig viaconfig() - intercepts them in
command.execute.before - rewrites
/caveman-commitand/caveman-reviewcommand input into prompt text for the model - handles
/caveman:compressdirectly in plugin code using a temporary session, local validation, targeted repair retries, and restore-on-failure logic
