opencarlOpenCARL - Dynamic rule injection for OpenCode. Rules load when relevant, disappear when not. Adapted from CARL by Chris Kahler.
1
183
近 7 天 4
28.4
生态多维模型
4 个月前
2026-03-23
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencarl@2.1.31"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencarl@2.1.31"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencarlopencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
OpenCARL
Context Augmentation & Reinforcement Layer — Dynamic rules for OpenCode.
"Rules that load when relevant, disappear when not."
What is OpenCARL?
OpenCARL is a dynamic rule injection plugin for OpenCode. Define your preferences once, and they load automatically when relevant to your current task.
Key Features:
- Keyword-based rule loading
- Star-commands for explicit triggers (
*brief,*deep) - Context-aware behavior
- Global and project-level rules
Documentation
Full documentation: krisgray.github.io/opencarl
Guides:
- Installation Guide
- OpenCARL Overview
- Domain Guide
- Commands Guide
- Manifest Reference
- Context Rules
- Suggest Domain
Tutorials:
- Python API Tutorial — Test-driven development with pytest, mocks, and external APIs
Troubleshooting: Troubleshooting Guide
Quick Start
# 1. Install
npm install opencarl
# 2. Add to opencode.json
echo '{"plugin": ["opencarl"]}' > opencode.json
# 3. Run setup
npx opencarl --local
Restart OpenCode. Type *opencarl for interactive help.
Usage
*opencarl # Interactive help mode
*opencarl docs # View documentation
*brief explain this # Concise response
*deep analyze this # Comprehensive analysis
Rules load automatically when your prompt matches domain keywords (e.g., "fix bug" loads development rules).
CLI Commands
npx opencarl --local # Install for current project
npx opencarl --global # Install for all projects
npx opencarl --integrate # Add OpenCARL section to AGENTS.md
npx opencarl --integrate-opencode # Add docs to opencode.json
npx opencarl --help # Show all options
Configuration
.opencarl/
├── manifest # Domain registry (states + keywords)
├── global # Always-loaded rules
├── commands # Star-command definitions
└── {domain} # Custom domains (lowercase, no extension)
Troubleshooting
| Problem | Fix |
|---|---|
| Rules not loading | Check STATE=active in manifest |
| Plugin not found | Verify opencode.json has "plugin": ["opencarl"] |
| Domain ignored | Filename must be lowercase, no extension |
Debug mode: OPENCARL_DEBUG=true
Full guide: Troubleshooting Guide
License
MIT License. See LICENSE for details.
OpenCode is powerful. OpenCARL makes it personal.