모드
다양한 사용 사례를 위한 다양한 모드.
opencode의 모드는 다른 사용 사례에 대한 행동, 도구 및 프롬프트를 사용자 정의 할 수 있습니다.
그것은 두 개의 내장 모드와 함께 제공됩니다 : ** 빌드 ** 및 ** 계획 **. 사용자 정의 할 수 있습니다. opencode config를 통해 자체를 구성합니다.
세션 중에 모드를 전환하거나 구성 파일에서 구성할 수 있습니다.
내장
opencode는 2개의 붙박이 형태로 옵니다.
빌드
빌드는 default 모드로 모든 도구가 활성화됩니다. 이것은 파일 운영 및 시스템 명령에 대한 전체 액세스가 필요한 개발 작업을위한 표준 모드입니다.
계획
계획 및 분석을 위해 설계된 제한 모드. 계획 모드에서 다음 도구는 기본적으로 비활성화됩니다:
write- 새로운 파일을 만들 수 없습니다edit-.opencode/plans/*.md에 위치한 파일을 제외하고 기존 파일을 수정할 수 없습니다.patch- 패치 적용bash- shell 명령을 실행할 수 없습니다
이 모드는 코드를 분석하기 위해 AI를 원할 때 유용합니다. 변경 사항을 제안하거나 코드베이스에 실제 수정없이 계획을 만들 수 있습니다.
전환
Tab 키를 사용하여 세션 중에 모드를 전환할 수 있습니다. 또는 당신의 형성된 switch_mode keybind.
참조 : Formatters 코드 형식 설정에 대한 정보.
구성
내장 모드를 사용자 정의하거나 구성을 통해 자신의 만들 수 있습니다. 형태는 2가지 방법으로 형성될 수 있습니다:
JSON 구성
opencode.json 설정 파일에서 모드 구성:
{ "$schema": "https://opencode.ai/config.json", "mode": { "build": { "model": "anthropic/claude-sonnet-4-20250514", "prompt": "{file:./prompts/build.txt}", "tools": { "write": true, "edit": true, "bash": true } }, "plan": { "model": "anthropic/claude-haiku-4-20250514", "tools": { "write": false, "edit": false, "bash": false } } }}Markdown 구성
Markdown 파일을 사용하여 모드를 정의할 수 있습니다. 그들에 게:
- 글로벌:
~/.config/opencode/modes/ - 프로젝트:
.opencode/modes/
---model: anthropic/claude-sonnet-4-20250514temperature: 0.1tools: write: false edit: false bash: false---
You are in code review mode. Focus on:
- Code quality and best practices- Potential bugs and edge cases- Performance implications- Security considerations
Provide constructive feedback without making direct changes.Markdown 파일 이름은 모드 이름 (예 : review.md는 review 모드를 만듭니다)이됩니다.
이 구성 옵션을 자세히 살펴봅시다.
모델
model config를 사용하여 이 모드의 기본 모델을 무시합니다. 다른 작업에 최적화 된 다른 모델을 사용하는 데 유용합니다. 예를 들어, 계획을위한 빠른 모델, 구현을위한 더 많은 모델.
{ "mode": { "plan": { "model": "anthropic/claude-haiku-4-20250514" } }}온도
temperature config와 AI의 응답의 임의성과 창의성을 제어합니다. 더 낮은 값은 더 집중하고 세심한 응답을 만듭니다. 더 높은 값은 창의력과 가변성을 증가하면서.
{ "mode": { "plan": { "temperature": 0.1 }, "creative": { "temperature": 0.8 } }}온도 값은 일반적으로 0.0에서 1.0에 배열합니다:
- 0.0-0.2: 매우 집중하고 신중한 응답, 코드 분석 및 계획에 이상 -0.3-0.5: 일부 창의력과 균형 잡힌 응답, 일반 개발 작업에 좋은
- 0.6-1.0: 더 창조적이고 다양한 응답, 브레인스토밍 및 탐험에 유용한
{ "mode": { "analyze": { "temperature": 0.1, "prompt": "{file:./prompts/analysis.txt}" }, "build": { "temperature": 0.3 }, "brainstorm": { "temperature": 0.7, "prompt": "{file:./prompts/creative.txt}" } }}온도가 지정되지 않은 경우, opencode는 모델별 기본 (일반적으로 0 대부분의 모델에 대한, 0.55 Qwen 모델)을 사용합니다.
프롬프트
prompt config를 가진 이 형태를 위한 주문 체계 prompt 파일을 지정하십시오. prompt 파일은 모드의 목적에 특정한 지시를 포함해야 합니다.
{ "mode": { "review": { "prompt": "{file:./prompts/code-review.txt}" } }}이 경로는 config 파일이 있는 곳에 관계됩니다. 그래서이 작품 글로벌 opencode config 및 프로젝트 특정 구성 모두.
도구
이 모드에서는 tools config를 사용할 수 있습니다. true 또는 false로 설정하여 특정 도구를 활성화하거나 비활성화 할 수 있습니다.
{ "mode": { "readonly": { "tools": { "write": false, "edit": false, "bash": false, "read": true, "grep": true, "glob": true } } }}도구가 지정되지 않은 경우, 모든 도구는 기본적으로 활성화됩니다.
유효한 도구
여기에 모든 도구는 모드 구성을 통해 제어 할 수 있습니다.
| 도구 | 설명 |
|---|---|
bash | shell 명령 실행 |
edit | 기존 파일 수정 |
write | 새 파일 만들기 |
read | 읽는 파일 내용 |
grep | 파일 검색 |
glob | 패턴으로 찾기 |
list | 디렉토리 내용 보기 |
patch | 파일에 패치 적용 |
todowrite | 할 일(Todo) 목록 관리 |
todoread | 할 일(Todo) 목록 읽기 |
webfetch | 웹사이트 가져오기 |
사용자 정의 모드
구성에 추가하여 사용자 정의 모드를 만들 수 있습니다. 여기에는 두 가지 접근법이 있습니다.
JSON 구성 사용
{ "$schema": "https://opencode.ai/config.json", "mode": { "docs": { "prompt": "{file:./prompts/documentation.txt}", "tools": { "write": true, "edit": true, "bash": false, "read": true, "grep": true, "glob": true } } }}markdown 파일 사용
프로젝트 별 모드 또는 ~/.config/opencode/modes/의 모드 파일을 만들 수 있습니다.
---temperature: 0.1tools: bash: true read: true grep: true write: false edit: false---
You are in debug mode. Your primary goal is to help investigate and diagnose issues.
Focus on:
- Understanding the problem through careful analysis- Using bash commands to inspect system state- Reading relevant files and logs- Searching for patterns and anomalies- Providing clear explanations of findings
Do not make any changes to files. Only investigate and report.---model: anthropic/claude-sonnet-4-20250514temperature: 0.2tools: edit: true read: true grep: true glob: true---
You are in refactoring mode. Focus on improving code quality without changing functionality.
Priorities:
- Improve code readability and maintainability- Apply consistent naming conventions- Reduce code duplication- Optimize performance where appropriate- Ensure all tests continue to pass사용 사례
다음은 다른 모드에 대한 일반적인 사용 사례입니다.
- Build 모드: 모든 도구와 함께 전체 개발 작업
- Plan 모드: 변화없이 분석 및 계획 -Review 모드: Code review with read-only access plus 문서 도구
- Debug 모드: bash 및 읽기 도구와 함께 조사에 집중
- Docs 모드: 파일 작업과 문서 작성하지만 시스템 명령 없음
다른 모델을 찾을 수 있습니다 다른 사용 케이스에 대 한 좋은.