feat: add Builder-Sisyphus agent with independent toggle options (#214)
* feat: add Builder-Sisyphus agent with independent toggle options - Add Builder-Sisyphus agent (disabled by default) for build mode - Implement independent configuration for Builder/Planner-Sisyphus agents - Add replace_build and replace_plan options to control agent demotion - Update schema to support new configuration options - Update README with comprehensive configuration documentation Addresses #212: Users can now keep default OpenCode build mode alongside Builder-Sisyphus * docs: add OpenCode permalinks and update multilingual README files - Add OpenCode source code permalinks to build-prompt.ts (@see tags) - Update README.ja.md with Builder-Sisyphus documentation - Update README.ko.md with Builder-Sisyphus documentation - Update README.zh-cn.md with Builder-Sisyphus documentation Permalinks reference: - Build mode switch: build-switch.txt - Build agent definition: agent.ts#L118-L125 - Default permissions: agent.ts#L57-L68 --------- Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
This commit is contained in:
51
README.ja.md
51
README.ja.md
@@ -714,24 +714,50 @@ Oh My OpenCode は以下の場所からフックを読み込んで実行しま
|
||||
|
||||
### Sisyphus Agent
|
||||
|
||||
有効時(デフォルト)、Sisyphus は2つのプライマリエージェントを追加し、内蔵エージェントをサブエージェントに降格させます:
|
||||
有効時(デフォルト)、Sisyphus はオプションの特殊エージェントを備えた強力なオーケストレーターを提供します:
|
||||
|
||||
- **Sisyphus**: プライマリオーケストレーターエージェント (Claude Opus 4.5)
|
||||
- **Planner-Sisyphus**: OpenCode の plan エージェントの全設定を実行時に継承 (description に "OhMyOpenCode version" を追加)
|
||||
- **build**: サブエージェントに降格
|
||||
- **plan**: サブエージェントに降格
|
||||
- **Builder-Sisyphus**: OhMyOpenCode 強化版のビルドエージェント(デフォルトで無効)
|
||||
- **Planner-Sisyphus**: OhMyOpenCode 強化版のプランエージェント(デフォルトで有効)
|
||||
|
||||
Sisyphus を無効化して元の build/plan エージェントを復元するには:
|
||||
**設定オプション:**
|
||||
|
||||
```json
|
||||
{
|
||||
"omo_agent": {
|
||||
"sisyphus_agent": {
|
||||
"disabled": false,
|
||||
"builder_enabled": false,
|
||||
"planner_enabled": true,
|
||||
"replace_build": true,
|
||||
"replace_plan": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**例:Builder-Sisyphus を有効化し、デフォルトのビルドモードも維持する:**
|
||||
|
||||
```json
|
||||
{
|
||||
"sisyphus_agent": {
|
||||
"builder_enabled": true,
|
||||
"replace_build": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
これにより、Builder-Sisyphus とデフォルトのビルドエージェントの両方を同時に利用できます。
|
||||
|
||||
**例:すべての Sisyphus オーケストレーションを無効化:**
|
||||
|
||||
```json
|
||||
{
|
||||
"sisyphus_agent": {
|
||||
"disabled": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
他のエージェント同様、Sisyphus と Planner-Sisyphus もカスタマイズ可能です:
|
||||
他のエージェント同様、Sisyphus エージェントもカスタマイズ可能です:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -740,6 +766,9 @@ Sisyphus を無効化して元の build/plan エージェントを復元する
|
||||
"model": "anthropic/claude-sonnet-4",
|
||||
"temperature": 0.3
|
||||
},
|
||||
"Builder-Sisyphus": {
|
||||
"model": "anthropic/claude-opus-4"
|
||||
},
|
||||
"Planner-Sisyphus": {
|
||||
"model": "openai/gpt-5.2"
|
||||
}
|
||||
@@ -748,8 +777,12 @@ Sisyphus を無効化して元の build/plan エージェントを復元する
|
||||
```
|
||||
|
||||
| オプション | デフォルト | 説明 |
|
||||
|------------|------------|------|
|
||||
| `disabled` | `false` | `true` の場合、Sisyphus エージェントを無効化し、元の build/plan をプライマリとして復元します。`false` (デフォルト) の場合、Sisyphus と Planner-Sisyphus がプライマリエージェントになります。 |
|
||||
| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `disabled` | `false` | `true` の場合、すべての Sisyphus オーケストレーションを無効化し、元の build/plan をプライマリとして復元します。 |
|
||||
| `builder_enabled` | `false` | `true` の場合、Builder-Sisyphus エージェント(OhMyOpenCode 強化版ビルドモード)を有効化します。デフォルトの OpenCode ビルド体験を維持するため、デフォルトでは無効です。 |
|
||||
| `planner_enabled` | `true` | `true` の場合、Planner-Sisyphus エージェント(OhMyOpenCode 強化版プランモード)を有効化します。デフォルトで有効です。 |
|
||||
| `replace_build` | `true` | `true` の場合、デフォルトのビルドエージェントをサブエージェントモードに降格させます。`false` に設定すると、Builder-Sisyphus とデフォルトのビルドの両方を利用できます。 |
|
||||
| `replace_plan` | `true` | `true` の場合、デフォルトのプランエージェントをサブエージェントモードに降格させます。`false` に設定すると、Planner-Sisyphus とデフォルトのプランの両方を利用できます。 |
|
||||
|
||||
### Hooks
|
||||
|
||||
|
||||
49
README.ko.md
49
README.ko.md
@@ -708,14 +708,40 @@ Schema 자동 완성이 지원됩니다:
|
||||
|
||||
### Sisyphus Agent
|
||||
|
||||
활성화 시(기본값), oh-my-opencode 는 두 개의 primary 에이전트를 추가하고 내장 에이전트를 subagent로 강등합니다:
|
||||
활성화 시 (기본값), Sisyphus는 옵션으로 선택 가능한 특화 에이전트들과 함께 강력한 오케스트레이터를 제공합니다:
|
||||
|
||||
- **Sisyphus**: Primary 오케스트레이터 에이전트 (Claude Opus 4.5)
|
||||
- **Planner-Sisyphus**: OpenCode plan 에이전트의 모든 설정을 런타임에 상속 (description에 "OhMyOpenCode version" 추가)
|
||||
- **build**: subagent로 강등
|
||||
- **plan**: subagent로 강등
|
||||
- **Builder-Sisyphus**: OhMyOpenCode 강화 버전 빌드 에이전트 (기본적으로 비활성화)
|
||||
- **Planner-Sisyphus**: OhMyOpenCode 강화 버전 플랜 에이전트 (기본적으로 활성화)
|
||||
|
||||
Sisyphus 를 비활성화하고 원래 build/plan 에이전트를 복원하려면:
|
||||
**설정 옵션:**
|
||||
|
||||
```json
|
||||
{
|
||||
"sisyphus_agent": {
|
||||
"disabled": false,
|
||||
"builder_enabled": false,
|
||||
"planner_enabled": true,
|
||||
"replace_build": true,
|
||||
"replace_plan": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**예시: Builder-Sisyphus를 활성화하면서 기본 빌드 모드도 유지하기:**
|
||||
|
||||
```json
|
||||
{
|
||||
"sisyphus_agent": {
|
||||
"builder_enabled": true,
|
||||
"replace_build": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
이렇게 하면 Builder-Sisyphus와 기본 빌드 에이전트를 동시에 사용할 수 있습니다.
|
||||
|
||||
**예시: 모든 Sisyphus 오케스트레이션 비활성화:**
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -725,7 +751,7 @@ Sisyphus 를 비활성화하고 원래 build/plan 에이전트를 복원하려
|
||||
}
|
||||
```
|
||||
|
||||
다른 에이전트처럼 Sisyphus 와 Planner-Sisyphus도 커스터마이징할 수 있습니다:
|
||||
다른 에이전트처럼 Sisyphus 에이전트들도 커스터마이징할 수 있습니다:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -734,6 +760,9 @@ Sisyphus 를 비활성화하고 원래 build/plan 에이전트를 복원하려
|
||||
"model": "anthropic/claude-sonnet-4",
|
||||
"temperature": 0.3
|
||||
},
|
||||
"Builder-Sisyphus": {
|
||||
"model": "anthropic/claude-opus-4"
|
||||
},
|
||||
"Planner-Sisyphus": {
|
||||
"model": "openai/gpt-5.2"
|
||||
}
|
||||
@@ -742,8 +771,12 @@ Sisyphus 를 비활성화하고 원래 build/plan 에이전트를 복원하려
|
||||
```
|
||||
|
||||
| 옵션 | 기본값 | 설명 |
|
||||
| ---------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `disabled` | `false` | `true`면 Sisyphus 에이전트를 비활성화하고 원래 build/plan을 primary로 복원합니다. `false`(기본값)면 Sisyphus와 Planner-Sisyphus가 primary 에이전트가 됩니다. |
|
||||
| ------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `disabled` | `false` | `true`면 모든 Sisyphus 오케스트레이션을 비활성화하고 원래 build/plan을 primary로 복원합니다. |
|
||||
| `builder_enabled` | `false` | `true`면 Builder-Sisyphus 에이전트 (OhMyOpenCode 강화 빌드 모드)를 활성화합니다. 기본 OpenCode 빌드 경험을 보존하기 위해 기본적으로 비활성화되어 있습니다. |
|
||||
| `planner_enabled` | `true` | `true`면 Planner-Sisyphus 에이전트 (OhMyOpenCode 강화 플랜 모드)를 활성화합니다. 기본적으로 활성화되어 있습니다. |
|
||||
| `replace_build` | `true` | `true`면 기본 빌드 에이전트를 subagent 모드로 강등시킵니다. `false`로 설정하면 Builder-Sisyphus와 기본 빌드를 모두 사용할 수 있습니다. |
|
||||
| `replace_plan` | `true` | `true`면 기본 플랜 에이전트를 subagent 모드로 강등시킵니다. `false`로 설정하면 Planner-Sisyphus와 기본 플랜을 모두 사용할 수 있습니다. |
|
||||
|
||||
### Hooks
|
||||
|
||||
|
||||
51
README.md
51
README.md
@@ -780,24 +780,50 @@ Available agents: `oracle`, `librarian`, `explore`, `frontend-ui-ux-engineer`, `
|
||||
|
||||
### Sisyphus Agent
|
||||
|
||||
When enabled (default), Sisyphus adds two primary agents and demotes the built-in agents to subagents:
|
||||
When enabled (default), Sisyphus provides a powerful orchestrator with optional specialized agents:
|
||||
|
||||
- **Sisyphus**: Primary orchestrator agent (Claude Opus 4.5)
|
||||
- **Planner-Sisyphus**: Inherits all settings from OpenCode's plan agent at runtime (description appended with "OhMyOpenCode version")
|
||||
- **build**: Demoted to subagent
|
||||
- **plan**: Demoted to subagent
|
||||
- **Builder-Sisyphus**: Optional build agent with OhMyOpenCode enhancements (disabled by default)
|
||||
- **Planner-Sisyphus**: Plan agent with OhMyOpenCode enhancements (enabled by default)
|
||||
|
||||
To disable Sisyphus and restore the original build/plan agents:
|
||||
**Configuration Options:**
|
||||
|
||||
```json
|
||||
{
|
||||
"omo_agent": {
|
||||
"sisyphus_agent": {
|
||||
"disabled": false,
|
||||
"builder_enabled": false,
|
||||
"planner_enabled": true,
|
||||
"replace_build": true,
|
||||
"replace_plan": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Example: Enable Builder-Sisyphus and keep default build mode:**
|
||||
|
||||
```json
|
||||
{
|
||||
"sisyphus_agent": {
|
||||
"builder_enabled": true,
|
||||
"replace_build": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This allows you to have both Builder-Sisyphus AND the default build agent available simultaneously.
|
||||
|
||||
**Example: Disable all Sisyphus orchestration:**
|
||||
|
||||
```json
|
||||
{
|
||||
"sisyphus_agent": {
|
||||
"disabled": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can also customize Sisyphus and Planner-Sisyphus like other agents:
|
||||
You can also customize Sisyphus agents like other agents:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -806,6 +832,9 @@ You can also customize Sisyphus and Planner-Sisyphus like other agents:
|
||||
"model": "anthropic/claude-sonnet-4",
|
||||
"temperature": 0.3
|
||||
},
|
||||
"Builder-Sisyphus": {
|
||||
"model": "anthropic/claude-opus-4"
|
||||
},
|
||||
"Planner-Sisyphus": {
|
||||
"model": "openai/gpt-5.2"
|
||||
}
|
||||
@@ -814,8 +843,12 @@ You can also customize Sisyphus and Planner-Sisyphus like other agents:
|
||||
```
|
||||
|
||||
| Option | Default | Description |
|
||||
| ---------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `disabled` | `false` | When `true`, disables Sisyphus agents and restores original build/plan as primary. When `false` (default), Sisyphus and Planner-Sisyphus become primary agents. |
|
||||
| ------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `disabled` | `false` | When `true`, disables all Sisyphus orchestration and restores original build/plan as primary. |
|
||||
| `builder_enabled` | `false` | When `true`, enables Builder-Sisyphus agent (OhMyOpenCode enhanced build mode). Disabled by default to preserve default OpenCode build experience. |
|
||||
| `planner_enabled` | `true` | When `true`, enables Planner-Sisyphus agent (OhMyOpenCode enhanced plan mode). Enabled by default. |
|
||||
| `replace_build` | `true` | When `true`, demotes default build agent to subagent mode. Set to `false` to keep both Builder-Sisyphus and default build available. |
|
||||
| `replace_plan` | `true` | When `true`, demotes default plan agent to subagent mode. Set to `false` to keep both Planner-Sisyphus and default plan available. |
|
||||
|
||||
### Hooks
|
||||
|
||||
|
||||
@@ -714,24 +714,50 @@ Agent 爽了,你自然也爽。但我还想直接让你爽。
|
||||
|
||||
### Sisyphus Agent
|
||||
|
||||
默认开启。Sisyphus 会加两个主 Agent,把原来的降级成小弟:
|
||||
默认开启。Sisyphus 提供一个强力的编排器,带可选的专门 Agent:
|
||||
|
||||
- **Sisyphus**:主编排 Agent(Claude Opus 4.5)
|
||||
- **Planner-Sisyphus**:运行时继承 OpenCode plan Agent 所有设置(描述里加了"OhMyOpenCode version")
|
||||
- **build**:降级为子 Agent
|
||||
- **plan**:降级为子 Agent
|
||||
- **Builder-Sisyphus**:OhMyOpenCode 增强版构建 Agent(默认禁用)
|
||||
- **Planner-Sisyphus**:OhMyOpenCode 增强版计划 Agent(默认启用)
|
||||
|
||||
想禁用 Sisyphus 恢复原来的?
|
||||
**配置选项:**
|
||||
|
||||
```json
|
||||
{
|
||||
"omo_agent": {
|
||||
"sisyphus_agent": {
|
||||
"disabled": false,
|
||||
"builder_enabled": false,
|
||||
"planner_enabled": true,
|
||||
"replace_build": true,
|
||||
"replace_plan": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**示例:启用 Builder-Sisyphus,同时保留默认构建模式:**
|
||||
|
||||
```json
|
||||
{
|
||||
"sisyphus_agent": {
|
||||
"builder_enabled": true,
|
||||
"replace_build": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
这样你就能同时使用 Builder-Sisyphus 和默认构建 Agent。
|
||||
|
||||
**示例:禁用所有 Sisyphus 编排:**
|
||||
|
||||
```json
|
||||
{
|
||||
"sisyphus_agent": {
|
||||
"disabled": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Sisyphus 和 Planner-Sisyphus 也能自定义:
|
||||
Sisyphus Agent 也能自定义:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -740,6 +766,9 @@ Sisyphus 和 Planner-Sisyphus 也能自定义:
|
||||
"model": "anthropic/claude-sonnet-4",
|
||||
"temperature": 0.3
|
||||
},
|
||||
"Builder-Sisyphus": {
|
||||
"model": "anthropic/claude-opus-4"
|
||||
},
|
||||
"Planner-Sisyphus": {
|
||||
"model": "openai/gpt-5.2"
|
||||
}
|
||||
@@ -748,8 +777,12 @@ Sisyphus 和 Planner-Sisyphus 也能自定义:
|
||||
```
|
||||
|
||||
| 选项 | 默认值 | 说明 |
|
||||
| ---------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `disabled` | `false` | 设为 `true` 就禁用 Sisyphus,恢复原来的 build/plan。设为 `false`(默认)就是 Sisyphus 和 Planner-Sisyphus 掌权。 |
|
||||
| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `disabled` | `false` | 设为 `true` 就禁用所有 Sisyphus 编排,恢复原来的 build/plan。 |
|
||||
| `builder_enabled` | `false` | 设为 `true` 就启用 Builder-Sisyphus Agent(OhMyOpenCode 增强构建模式)。为了保留默认 OpenCode 构建体验,默认禁用。 |
|
||||
| `planner_enabled` | `true` | 设为 `true` 就启用 Planner-Sisyphus Agent(OhMyOpenCode 增强计划模式)。默认启用。 |
|
||||
| `replace_build` | `true` | 设为 `true` 就把默认构建 Agent 降级为子 Agent 模式。设为 `false` 可以同时保留 Builder-Sisyphus 和默认构建。 |
|
||||
| `replace_plan` | `true` | 设为 `true` 就把默认计划 Agent 降级为子 Agent 模式。设为 `false` 可以同时保留 Planner-Sisyphus 和默认计划。 |
|
||||
|
||||
### Hooks
|
||||
|
||||
|
||||
@@ -408,6 +408,120 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"Builder-Sisyphus": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"model": {
|
||||
"type": "string"
|
||||
},
|
||||
"temperature": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"maximum": 2
|
||||
},
|
||||
"top_p": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"maximum": 1
|
||||
},
|
||||
"prompt": {
|
||||
"type": "string"
|
||||
},
|
||||
"prompt_append": {
|
||||
"type": "string"
|
||||
},
|
||||
"tools": {
|
||||
"type": "object",
|
||||
"propertyNames": {
|
||||
"type": "string"
|
||||
},
|
||||
"additionalProperties": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"disable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"mode": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"subagent",
|
||||
"primary",
|
||||
"all"
|
||||
]
|
||||
},
|
||||
"color": {
|
||||
"type": "string",
|
||||
"pattern": "^#[0-9A-Fa-f]{6}$"
|
||||
},
|
||||
"permission": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"edit": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"ask",
|
||||
"allow",
|
||||
"deny"
|
||||
]
|
||||
},
|
||||
"bash": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"ask",
|
||||
"allow",
|
||||
"deny"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"propertyNames": {
|
||||
"type": "string"
|
||||
},
|
||||
"additionalProperties": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"ask",
|
||||
"allow",
|
||||
"deny"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"webfetch": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"ask",
|
||||
"allow",
|
||||
"deny"
|
||||
]
|
||||
},
|
||||
"doom_loop": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"ask",
|
||||
"allow",
|
||||
"deny"
|
||||
]
|
||||
},
|
||||
"external_directory": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"ask",
|
||||
"allow",
|
||||
"deny"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Planner-Sisyphus": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -1236,6 +1350,18 @@
|
||||
"properties": {
|
||||
"disabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"builder_enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"planner_enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"replace_build": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"replace_plan": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
68
src/agents/build-prompt.ts
Normal file
68
src/agents/build-prompt.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* OpenCode's default build agent system prompt.
|
||||
*
|
||||
* This prompt enables FULL EXECUTION mode for the build agent, allowing file
|
||||
* modifications, command execution, and system changes while focusing on
|
||||
* implementation and execution.
|
||||
*
|
||||
* Inspired by OpenCode's build agent behavior.
|
||||
*
|
||||
* @see https://github.com/sst/opencode/blob/6f9bea4e1f3d139feefd0f88de260b04f78caaef/packages/opencode/src/session/prompt/build-switch.txt
|
||||
* @see https://github.com/sst/opencode/blob/6f9bea4e1f3d139feefd0f88de260b04f78caaef/packages/opencode/src/agent/agent.ts#L118-L125
|
||||
*/
|
||||
export const BUILD_SYSTEM_PROMPT = `<system-reminder>
|
||||
# Build Mode - System Reminder
|
||||
|
||||
BUILD MODE ACTIVE - you are in EXECUTION phase. Your responsibility is to:
|
||||
- Implement features and make code changes
|
||||
- Execute commands and run tests
|
||||
- Fix bugs and refactor code
|
||||
- Deploy and build systems
|
||||
- Make all necessary file modifications
|
||||
|
||||
You have FULL permissions to edit files, run commands, and make system changes.
|
||||
This is the implementation phase - execute decisively and thoroughly.
|
||||
|
||||
---
|
||||
|
||||
## Responsibility
|
||||
|
||||
Your current responsibility is to implement, build, and execute. You should:
|
||||
- Write and modify code to accomplish the user's goals
|
||||
- Run tests and builds to verify your changes
|
||||
- Fix errors and issues that arise
|
||||
- Use all available tools to complete the task efficiently
|
||||
- Delegate to specialized agents when appropriate for better results
|
||||
|
||||
**NOTE:** You should ask the user for clarification when requirements are ambiguous,
|
||||
but once the path is clear, execute confidently. The goal is to deliver working,
|
||||
tested, production-ready solutions.
|
||||
|
||||
---
|
||||
|
||||
## Important
|
||||
|
||||
The user wants you to execute and implement. You SHOULD make edits, run necessary
|
||||
tools, and make changes to accomplish the task. Use your full capabilities to
|
||||
deliver excellent results.
|
||||
</system-reminder>
|
||||
`
|
||||
|
||||
/**
|
||||
* OpenCode's default build agent permission configuration.
|
||||
*
|
||||
* Allows the build agent full execution permissions:
|
||||
* - edit: "ask" - Can modify files with confirmation
|
||||
* - bash: "ask" - Can execute commands with confirmation
|
||||
* - webfetch: "allow" - Can fetch web content
|
||||
*
|
||||
* This provides balanced permissions - powerful but with safety checks.
|
||||
*
|
||||
* @see https://github.com/sst/opencode/blob/6f9bea4e1f3d139feefd0f88de260b04f78caaef/packages/opencode/src/agent/agent.ts#L57-L68
|
||||
* @see https://github.com/sst/opencode/blob/6f9bea4e1f3d139feefd0f88de260b04f78caaef/packages/opencode/src/agent/agent.ts#L118-L125
|
||||
*/
|
||||
export const BUILD_PERMISSION = {
|
||||
edit: "ask" as const,
|
||||
bash: "ask" as const,
|
||||
webfetch: "allow" as const,
|
||||
}
|
||||
@@ -30,6 +30,7 @@ export const OverridableAgentNameSchema = z.enum([
|
||||
"build",
|
||||
"plan",
|
||||
"Sisyphus",
|
||||
"Builder-Sisyphus",
|
||||
"Planner-Sisyphus",
|
||||
"oracle",
|
||||
"librarian",
|
||||
@@ -86,6 +87,7 @@ export const AgentOverridesSchema = z.object({
|
||||
build: AgentOverrideConfigSchema.optional(),
|
||||
plan: AgentOverrideConfigSchema.optional(),
|
||||
Sisyphus: AgentOverrideConfigSchema.optional(),
|
||||
"Builder-Sisyphus": AgentOverrideConfigSchema.optional(),
|
||||
"Planner-Sisyphus": AgentOverrideConfigSchema.optional(),
|
||||
oracle: AgentOverrideConfigSchema.optional(),
|
||||
librarian: AgentOverrideConfigSchema.optional(),
|
||||
@@ -105,6 +107,10 @@ export const ClaudeCodeConfigSchema = z.object({
|
||||
|
||||
export const SisyphusAgentConfigSchema = z.object({
|
||||
disabled: z.boolean().optional(),
|
||||
builder_enabled: z.boolean().optional(),
|
||||
planner_enabled: z.boolean().optional(),
|
||||
replace_build: z.boolean().optional(),
|
||||
replace_plan: z.boolean().optional(),
|
||||
})
|
||||
|
||||
export const ExperimentalConfigSchema = z.object({
|
||||
|
||||
37
src/index.ts
37
src/index.ts
@@ -50,6 +50,7 @@ import { createBuiltinMcps } from "./mcp";
|
||||
import { OhMyOpenCodeConfigSchema, type OhMyOpenCodeConfig, type HookName } from "./config";
|
||||
import { log, deepMerge, getUserConfigDir, addConfigLoadError } from "./shared";
|
||||
import { PLAN_SYSTEM_PROMPT, PLAN_PERMISSION } from "./agents/plan-prompt";
|
||||
import { BUILD_SYSTEM_PROMPT, BUILD_PERMISSION } from "./agents/build-prompt";
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
|
||||
@@ -379,11 +380,37 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
||||
const projectAgents = (pluginConfig.claude_code?.agents ?? true) ? loadProjectAgents() : {};
|
||||
|
||||
const isSisyphusEnabled = pluginConfig.sisyphus_agent?.disabled !== true;
|
||||
const builderEnabled = pluginConfig.sisyphus_agent?.builder_enabled ?? false;
|
||||
const plannerEnabled = pluginConfig.sisyphus_agent?.planner_enabled ?? true;
|
||||
const replaceBuild = pluginConfig.sisyphus_agent?.replace_build ?? true;
|
||||
const replacePlan = pluginConfig.sisyphus_agent?.replace_plan ?? true;
|
||||
|
||||
if (isSisyphusEnabled && builtinAgents.Sisyphus) {
|
||||
// TODO: When OpenCode releases `default_agent` config option (PR #5313),
|
||||
// use `config.default_agent = "Sisyphus"` instead of demoting build/plan.
|
||||
// Tracking: https://github.com/sst/opencode/pull/5313
|
||||
|
||||
const agentConfig: Record<string, unknown> = {
|
||||
Sisyphus: builtinAgents.Sisyphus,
|
||||
};
|
||||
|
||||
if (builderEnabled) {
|
||||
const { name: _buildName, ...buildConfigWithoutName } = config.agent?.build ?? {};
|
||||
const builderSisyphusOverride = pluginConfig.agents?.["Builder-Sisyphus"];
|
||||
const builderSisyphusBase = {
|
||||
...buildConfigWithoutName,
|
||||
prompt: BUILD_SYSTEM_PROMPT,
|
||||
permission: BUILD_PERMISSION,
|
||||
description: `${config.agent?.build?.description ?? "Build agent"} (OhMyOpenCode version)`,
|
||||
color: config.agent?.build?.color ?? "#32CD32",
|
||||
};
|
||||
|
||||
agentConfig["Builder-Sisyphus"] = builderSisyphusOverride
|
||||
? { ...builderSisyphusBase, ...builderSisyphusOverride }
|
||||
: builderSisyphusBase;
|
||||
}
|
||||
|
||||
if (plannerEnabled) {
|
||||
const { name: _planName, ...planConfigWithoutName } = config.agent?.plan ?? {};
|
||||
const plannerSisyphusOverride = pluginConfig.agents?.["Planner-Sisyphus"];
|
||||
const plannerSisyphusBase = {
|
||||
@@ -394,19 +421,19 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
||||
color: config.agent?.plan?.color ?? "#6495ED",
|
||||
};
|
||||
|
||||
const plannerSisyphusConfig = plannerSisyphusOverride
|
||||
agentConfig["Planner-Sisyphus"] = plannerSisyphusOverride
|
||||
? { ...plannerSisyphusBase, ...plannerSisyphusOverride }
|
||||
: plannerSisyphusBase;
|
||||
}
|
||||
|
||||
config.agent = {
|
||||
Sisyphus: builtinAgents.Sisyphus,
|
||||
"Planner-Sisyphus": plannerSisyphusConfig,
|
||||
...agentConfig,
|
||||
...Object.fromEntries(Object.entries(builtinAgents).filter(([k]) => k !== "Sisyphus")),
|
||||
...userAgents,
|
||||
...projectAgents,
|
||||
...config.agent,
|
||||
build: { ...config.agent?.build, mode: "subagent" },
|
||||
plan: { ...config.agent?.plan, mode: "subagent" },
|
||||
...(replaceBuild ? { build: { ...config.agent?.build, mode: "subagent" } } : {}),
|
||||
...(replacePlan ? { plan: { ...config.agent?.plan, mode: "subagent" } } : {}),
|
||||
};
|
||||
} else {
|
||||
config.agent = {
|
||||
|
||||
Reference in New Issue
Block a user