modes.mdx 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. ---
  2. title: 모드
  3. description: 다양한 사용 사례를 위한 다양한 모드.
  4. ---
  5. :::caution
  6. 모드는 opencode 설정에서 `agent` 옵션을 통해 구성되어 있습니다. 더 보기
  7. `mode` 옵션이 이제 비활성화되었습니다. [더 알아보기](/docs/agents).
  8. :::
  9. opencode의 모드는 다른 사용 사례에 대한 행동, 도구 및 프롬프트를 사용자 정의 할 수 있습니다.
  10. 그것은 두 개의 내장 모드와 함께 제공됩니다 : ** 빌드 ** 및 ** 계획 **. 사용자 정의 할 수 있습니다.
  11. opencode config를 통해 자체를 구성합니다.
  12. 세션 중에 모드를 전환하거나 구성 파일에서 구성할 수 있습니다.
  13. ---
  14. ## 내장
  15. opencode는 2개의 붙박이 형태로 옵니다.
  16. ---
  17. ### 빌드
  18. 빌드는 **default** 모드로 모든 도구가 활성화됩니다. 이것은 파일 운영 및 시스템 명령에 대한 전체 액세스가 필요한 개발 작업을위한 표준 모드입니다.
  19. ---
  20. ## 계획
  21. 계획 및 분석을 위해 설계된 제한 모드. 계획 모드에서 다음 도구는 기본적으로 비활성화됩니다:
  22. - `write` - 새로운 파일을 만들 수 없습니다
  23. - `edit` - `.opencode/plans/*.md`에 위치한 파일을 제외하고 기존 파일을 수정할 수 없습니다.
  24. - `patch` - 패치 적용
  25. - `bash` - shell 명령을 실행할 수 없습니다
  26. 이 모드는 코드를 분석하기 위해 AI를 원할 때 유용합니다. 변경 사항을 제안하거나 코드베이스에 실제 수정없이 계획을 만들 수 있습니다.
  27. ---
  28. ## 전환
  29. Tab 키를 사용하여 세션 중에 모드를 전환할 수 있습니다. 또는 당신의 형성된 `switch_mode` keybind.
  30. 참조 : [Formatters](/docs/formatters) 코드 형식 설정에 대한 정보.
  31. ---
  32. ## 구성
  33. 내장 모드를 사용자 정의하거나 구성을 통해 자신의 만들 수 있습니다. 형태는 2가지 방법으로 형성될 수 있습니다:
  34. ### JSON 구성
  35. `opencode.json` 설정 파일에서 모드 구성:
  36. ```json title="opencode.json"
  37. {
  38. "$schema": "https://opencode.ai/config.json",
  39. "mode": {
  40. "build": {
  41. "model": "anthropic/claude-sonnet-4-20250514",
  42. "prompt": "{file:./prompts/build.txt}",
  43. "tools": {
  44. "write": true,
  45. "edit": true,
  46. "bash": true
  47. }
  48. },
  49. "plan": {
  50. "model": "anthropic/claude-haiku-4-20250514",
  51. "tools": {
  52. "write": false,
  53. "edit": false,
  54. "bash": false
  55. }
  56. }
  57. }
  58. }
  59. ```
  60. ### Markdown 구성
  61. Markdown 파일을 사용하여 모드를 정의할 수 있습니다. 그들에 게:
  62. - 글로벌: `~/.config/opencode/modes/`
  63. - 프로젝트: `.opencode/modes/`
  64. ```markdown title="~/.config/opencode/modes/review.md"
  65. ---
  66. model: anthropic/claude-sonnet-4-20250514
  67. temperature: 0.1
  68. tools:
  69. write: false
  70. edit: false
  71. bash: false
  72. ---
  73. You are in code review mode. Focus on:
  74. - Code quality and best practices
  75. - Potential bugs and edge cases
  76. - Performance implications
  77. - Security considerations
  78. Provide constructive feedback without making direct changes.
  79. ```
  80. Markdown 파일 이름은 모드 이름 (예 : `review.md`는 `review` 모드를 만듭니다)이됩니다.
  81. 이 구성 옵션을 자세히 살펴봅시다.
  82. ---
  83. ### 모델
  84. `model` config를 사용하여 이 모드의 기본 모델을 무시합니다. 다른 작업에 최적화 된 다른 모델을 사용하는 데 유용합니다. 예를 들어, 계획을위한 빠른 모델, 구현을위한 더 많은 모델.
  85. ```json title="opencode.json"
  86. {
  87. "mode": {
  88. "plan": {
  89. "model": "anthropic/claude-haiku-4-20250514"
  90. }
  91. }
  92. }
  93. ```
  94. ---
  95. ### 온도
  96. `temperature` config와 AI의 응답의 임의성과 창의성을 제어합니다. 더 낮은 값은 더 집중하고 세심한 응답을 만듭니다. 더 높은 값은 창의력과 가변성을 증가하면서.
  97. ```json title="opencode.json"
  98. {
  99. "mode": {
  100. "plan": {
  101. "temperature": 0.1
  102. },
  103. "creative": {
  104. "temperature": 0.8
  105. }
  106. }
  107. }
  108. ```
  109. 온도 값은 일반적으로 0.0에서 1.0에 배열합니다:
  110. - **0.0-0.2**: 매우 집중하고 신중한 응답, 코드 분석 및 계획에 이상 -**0.3-0.5**: 일부 창의력과 균형 잡힌 응답, 일반 개발 작업에 좋은
  111. - **0.6-1.0**: 더 창조적이고 다양한 응답, 브레인스토밍 및 탐험에 유용한
  112. ```json title="opencode.json"
  113. {
  114. "mode": {
  115. "analyze": {
  116. "temperature": 0.1,
  117. "prompt": "{file:./prompts/analysis.txt}"
  118. },
  119. "build": {
  120. "temperature": 0.3
  121. },
  122. "brainstorm": {
  123. "temperature": 0.7,
  124. "prompt": "{file:./prompts/creative.txt}"
  125. }
  126. }
  127. }
  128. ```
  129. 온도가 지정되지 않은 경우, opencode는 모델별 기본 (일반적으로 0 대부분의 모델에 대한, 0.55 Qwen 모델)을 사용합니다.
  130. ---
  131. #### 프롬프트
  132. `prompt` config를 가진 이 형태를 위한 주문 체계 prompt 파일을 지정하십시오. prompt 파일은 모드의 목적에 특정한 지시를 포함해야 합니다.
  133. ```json title="opencode.json"
  134. {
  135. "mode": {
  136. "review": {
  137. "prompt": "{file:./prompts/code-review.txt}"
  138. }
  139. }
  140. }
  141. ```
  142. 이 경로는 config 파일이 있는 곳에 관계됩니다. 그래서이 작품
  143. 글로벌 opencode config 및 프로젝트 특정 구성 모두.
  144. ---
  145. ## 도구
  146. 이 모드에서는 `tools` config를 사용할 수 있습니다. `true` 또는 `false`로 설정하여 특정 도구를 활성화하거나 비활성화 할 수 있습니다.
  147. ```json
  148. {
  149. "mode": {
  150. "readonly": {
  151. "tools": {
  152. "write": false,
  153. "edit": false,
  154. "bash": false,
  155. "read": true,
  156. "grep": true,
  157. "glob": true
  158. }
  159. }
  160. }
  161. }
  162. ```
  163. 도구가 지정되지 않은 경우, 모든 도구는 기본적으로 활성화됩니다.
  164. ---
  165. ### 유효한 도구
  166. 여기에 모든 도구는 모드 구성을 통해 제어 할 수 있습니다.
  167. | 도구 | 설명 |
  168. | ----------- | --------------------- |
  169. | `bash` | shell 명령 실행 |
  170. | `edit` | 기존 파일 수정 |
  171. | `write` | 새 파일 만들기 |
  172. | `read` | 읽는 파일 내용 |
  173. | `grep` | 파일 검색 |
  174. | `glob` | 패턴으로 찾기 |
  175. | `list` | 디렉토리 내용 보기 |
  176. | `patch` | 파일에 패치 적용 |
  177. | `todowrite` | 할 일(Todo) 목록 관리 |
  178. | `webfetch` | 웹사이트 가져오기 |
  179. ---
  180. ## 사용자 정의 모드
  181. 구성에 추가하여 사용자 정의 모드를 만들 수 있습니다. 여기에는 두 가지 접근법이 있습니다.
  182. ### JSON 구성 사용
  183. ```json title="opencode.json" {4-14}
  184. {
  185. "$schema": "https://opencode.ai/config.json",
  186. "mode": {
  187. "docs": {
  188. "prompt": "{file:./prompts/documentation.txt}",
  189. "tools": {
  190. "write": true,
  191. "edit": true,
  192. "bash": false,
  193. "read": true,
  194. "grep": true,
  195. "glob": true
  196. }
  197. }
  198. }
  199. }
  200. ```
  201. ### markdown 파일 사용
  202. 프로젝트 별 모드 또는 `~/.config/opencode/modes/`의 모드 파일을 만들 수 있습니다.
  203. ```markdown title=".opencode/modes/debug.md"
  204. ---
  205. temperature: 0.1
  206. tools:
  207. bash: true
  208. read: true
  209. grep: true
  210. write: false
  211. edit: false
  212. ---
  213. You are in debug mode. Your primary goal is to help investigate and diagnose issues.
  214. Focus on:
  215. - Understanding the problem through careful analysis
  216. - Using bash commands to inspect system state
  217. - Reading relevant files and logs
  218. - Searching for patterns and anomalies
  219. - Providing clear explanations of findings
  220. Do not make any changes to files. Only investigate and report.
  221. ```
  222. ```markdown title="~/.config/opencode/modes/refactor.md"
  223. ---
  224. model: anthropic/claude-sonnet-4-20250514
  225. temperature: 0.2
  226. tools:
  227. edit: true
  228. read: true
  229. grep: true
  230. glob: true
  231. ---
  232. You are in refactoring mode. Focus on improving code quality without changing functionality.
  233. Priorities:
  234. - Improve code readability and maintainability
  235. - Apply consistent naming conventions
  236. - Reduce code duplication
  237. - Optimize performance where appropriate
  238. - Ensure all tests continue to pass
  239. ```
  240. ---
  241. ### 사용 사례
  242. 다음은 다른 모드에 대한 일반적인 사용 사례입니다.
  243. - **Build 모드**: 모든 도구와 함께 전체 개발 작업
  244. - **Plan 모드**: 변화없이 분석 및 계획 -**Review 모드**: Code review with read-only access plus 문서 도구
  245. - **Debug 모드**: bash 및 읽기 도구와 함께 조사에 집중
  246. - **Docs 모드**: 파일 작업과 문서 작성하지만 시스템 명령 없음
  247. 다른 모델을 찾을 수 있습니다 다른 사용 케이스에 대 한 좋은.