Download packages/web/src/content/docs/ko/agents.mdx from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 19.7 kB
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/web/src/content/docs/ko/agents.mdx
- Command line
-
hf download hf://SaylorTwift/opencode/packages/web/src/content/docs/ko/agents.mdx
-
curl -L -o agents.mdx https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/web/src/content/docs/ko/agents.mdx
19.7 kB
| title: Agents | |
| description: Configure and use specialized agents. | |
| agent๋ ํน์ ์์ ๊ณผ ์ํฌํ๋ก์ ๋ง๊ฒ ์ค์ ํ ์ ์๋ ์ ๋ฌธ AI assistant์ ๋๋ค. custom prompt, model, tool ์ ๊ทผ ๊ถํ์ ์กฐํฉํด ๋ชฉ์ ์ ๋ง๋ agent๋ฅผ ๋ง๋ค ์ ์์ต๋๋ค. | |
| :::tip | |
| ์ฝ๋๋ฅผ ์์ ํ์ง ์๊ณ ๋ถ์๊ณผ ์ ์ ๊ฒํ ๋ง ํ๊ณ ์ถ๋ค๋ฉด plan agent๋ฅผ ์ฌ์ฉํ์ธ์. | |
| ::: | |
| ์ธ์ ์ค์ agent๋ฅผ ์ ํํ๊ฑฐ๋ `@` mention์ผ๋ก ํธ์ถํ ์ ์์ต๋๋ค. | |
| ## ์ ํ | |
| OpenCode์ agent๋ primary agent์ subagent, ๋ ๊ฐ์ง ์ ํ์ผ๋ก ๋๋ฉ๋๋ค. | |
| ### Primary agents | |
| primary agent๋ ์ฌ์ฉ์๊ฐ ์ง์ ์ํธ์์ฉํ๋ ๋ฉ์ธ assistant์ ๋๋ค. **Tab** ํค ๋๋ ์ค์ ํ `switch_agent` keybind๋ก ์ํ ์ ํํ ์ ์์ต๋๋ค. primary agent๋ ๋ฉ์ธ ๋ํ๋ฅผ ์ฒ๋ฆฌํ๋ฉฐ, tool ์ ๊ทผ์ permission์ผ๋ก ์ ์ดํฉ๋๋ค. ์๋ฅผ ๋ค์ด Build๋ ๋ชจ๋ tool์ด ํ์ฑํ๋์ด ์๊ณ Plan์ ์ ํ๋์ด ์์ต๋๋ค. | |
| :::tip | |
| ์ธ์ ์ค **Tab** ํค๋ก primary agent๋ฅผ ๋น ๋ฅด๊ฒ ์ ํํ ์ ์์ต๋๋ค. | |
| ::: | |
| OpenCode์๋ ๊ธฐ๋ณธ ์ ๊ณต primary agent์ธ **Build**์ **Plan**์ด ํฌํจ๋์ด ์์ต๋๋ค. ์๋์์ ๊ฐ๊ฐ ์ดํด๋ณด๊ฒ ์ต๋๋ค. | |
| ### Subagents | |
| subagent๋ primary agent๊ฐ ํน์ ์์ ์ ์ํด ํธ์ถํ๋ ์ ๋ฌธ assistant์ ๋๋ค. ๋ฉ์์ง์์ **@ mention**์ผ๋ก ์ง์ ํธ์ถํ ์๋ ์์ต๋๋ค. | |
| OpenCode์๋ ๊ธฐ๋ณธ ์ ๊ณต subagent์ธ **General**, **Explore**, **Scout**๊ฐ ํฌํจ๋์ด ์์ต๋๋ค. ์๋์์ ์ดํด๋ณด๊ฒ ์ต๋๋ค. | |
| ## ๊ธฐ๋ณธ ์ ๊ณต | |
| OpenCode๋ ๊ธฐ๋ณธ์ ์ผ๋ก primary agent 2๊ฐ์ subagent 3๊ฐ๋ฅผ ์ ๊ณตํฉ๋๋ค. | |
| ### Use build | |
| _Mode_: `primary` | |
| Build๋ ๋ชจ๋ tool์ด ํ์ฑํ๋ **default** primary agent์ ๋๋ค. ํ์ผ ์์ ๊ณผ ์์คํ ๋ช ๋ น์ ๋ํ ์ ์ฒด ์ ๊ทผ์ด ํ์ํ ์ผ๋ฐ์ ์ธ ๊ฐ๋ฐ ์์ ์ ์ฌ์ฉํ๋ ํ์ค agent์ ๋๋ค. | |
| ### Use plan | |
| _Mode_: `primary` | |
| Plan์ ๊ณํ๊ณผ ๋ถ์์ ํนํ๋ ์ ํํ agent์ ๋๋ค. ๋ ๋์ ์ ์ด๋ ฅ๊ณผ ์๋์น ์์ ๋ณ๊ฒฝ ๋ฐฉ์ง๋ฅผ ์ํด permission ์์คํ ์ ์ฌ์ฉํฉ๋๋ค. | |
| ๊ธฐ๋ณธ๊ฐ์ผ๋ก ์๋ ํญ๋ชฉ์ ๋ชจ๋ `ask`๋ก ์ค์ ๋ฉ๋๋ค. | |
| - `file edits`: ๋ชจ๋ write, patch, edit | |
| - `bash`: ๋ชจ๋ bash ๋ช ๋ น | |
| ์ฝ๋๋ฒ ์ด์ค๋ฅผ ์ค์ ๋ก ์์ ํ์ง ์๊ณ LLM ๋ถ์, ๋ณ๊ฒฝ ์ ์, ๊ณํ ์๋ฆฝ๋ง ์งํํ๊ณ ์ถ์ ๋ ์ ์ฉํฉ๋๋ค. | |
| ### Use general | |
| _Mode_: `subagent` | |
| ๋ณต์กํ ์ง๋ฌธ์ ์กฐ์ฌํ๊ณ ๋ค๋จ๊ณ ์์ ์ ์ํํ๊ธฐ ์ํ ๋ฒ์ฉ agent์ ๋๋ค. todo๋ฅผ ์ ์ธํ ๋ชจ๋ tool ์ ๊ทผ์ด ๊ฐ๋ฅํ๋ฏ๋ก ํ์ํ๋ฉด ํ์ผ ์์ ๋ ํ ์ ์์ต๋๋ค. ์ฌ๋ฌ ์์ ๋จ์๋ฅผ ๋ณ๋ ฌ๋ก ์ฒ๋ฆฌํ ๋ ์ฌ์ฉํ์ธ์. | |
| ### Use explore | |
| _Mode_: `subagent` | |
| ์ฝ๋๋ฒ ์ด์ค ํ์์ ์ต์ ํ๋ ๋น ๋ฅธ ์ฝ๊ธฐ ์ ์ฉ agent์ ๋๋ค. ํ์ผ์ ์์ ํ ์ ์์ต๋๋ค. ํจํด ๊ธฐ๋ฐ ํ์ผ ํ์, ํค์๋ ๊ฒ์, ์ฝ๋๋ฒ ์ด์ค ๊ด๋ จ ์ง์ ์๋ต์ ๋น ๋ฅด๊ฒ ์ฒ๋ฆฌํ ๋ ์ฌ์ฉํ์ธ์. | |
| ### Use Scout | |
| _Mode_: `subagent` | |
| ์ธ๋ถ docs์ dependency ๋ฆฌ์์น๋ฅผ ์ํ ์ฝ๊ธฐ ์ ์ฉ agent์ ๋๋ค. dependency repository๋ฅผ OpenCode์ ๊ด๋ฆฌํ cache์ cloneํ๊ฑฐ๋, ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์์ค๋ฅผ ์ดํด๋ณด๊ฑฐ๋, workspace๋ฅผ ์์ ํ์ง ์๊ณ ๋ก์ปฌ ์ฝ๋๋ฅผ upstream ๊ตฌํ๊ณผ ๊ต์ฐจ ํ์ธํด์ผ ํ ๋ ์ฌ์ฉํ์ธ์. | |
| ### Use compaction | |
| _Mode_: `primary` | |
| ๊ธด context๋ฅผ ๋ ์งง์ ์์ฝ์ผ๋ก ์์ถํ๋ ์จ๊ฒจ์ง ์์คํ agent์ ๋๋ค. ํ์ํ ๋ ์๋์ผ๋ก ์คํ๋๋ฉฐ UI์์ ์ง์ ์ ํํ ์ ์์ต๋๋ค. | |
| ### Use title | |
| _Mode_: `primary` | |
| ์งง์ ์ธ์ ์ ๋ชฉ์ ์์ฑํ๋ ์จ๊ฒจ์ง ์์คํ agent์ ๋๋ค. ์๋์ผ๋ก ์คํ๋๋ฉฐ UI์์ ์ง์ ์ ํํ ์ ์์ต๋๋ค. | |
| ### Use summary | |
| _Mode_: `primary` | |
| ์ธ์ ์์ฝ์ ์์ฑํ๋ ์จ๊ฒจ์ง ์์คํ agent์ ๋๋ค. ์๋์ผ๋ก ์คํ๋๋ฉฐ UI์์ ์ง์ ์ ํํ ์ ์์ต๋๋ค. | |
| ## ์ฌ์ฉ๋ฒ | |
| 1. primary agent๋ ์ธ์ ์ค **Tab** ํค๋ก ์ํ ์ ํํ ์ ์์ต๋๋ค. ์ค์ ํ `switch_agent` keybind๋ฅผ ์ฌ์ฉํ ์๋ ์์ต๋๋ค. | |
| 2. subagent ํธ์ถ ๋ฐฉ๋ฒ: | |
| - **Automatically**: primary agent๊ฐ ์ค๋ช (description)์ ๋ฐํ์ผ๋ก ํนํ ์์ ์ ์๋ ํธ์ถํฉ๋๋ค. | |
| - ์๋ ํธ์ถ: ๋ฉ์์ง์์ subagent๋ฅผ **@ mention**ํ์ฌ ํธ์ถํฉ๋๋ค. ์: | |
| ```txt frame="none" | |
| @general help me search for this function | |
| ``` | |
| 3. **์ธ์ ๊ฐ ์ด๋**: subagent๊ฐ child session์ ๋ง๋ค๋ฉด ์๋ ํค๋ก parent session๊ณผ child session ์ฌ์ด๋ฅผ ์ด๋ํ ์ ์์ต๋๋ค. | |
| - **\<Leader>+Right** (๋๋ ์ค์ ํ `session_child_cycle` keybind): parent โ child1 โ child2 โ ... โ parent ์๋ฐฉํฅ ์ํ | |
| - **\<Leader>+Left** (๋๋ ์ค์ ํ `session_child_cycle_reverse` keybind): parent โ child1 โ child2 โ ... โ parent ์ญ๋ฐฉํฅ ์ํ | |
| ์ด๋ฅผ ํตํด ๋ฉ์ธ ๋ํ์ ํนํ subagent ์์ ์ฌ์ด๋ฅผ ์์ฐ์ค๋ฝ๊ฒ ์ค๊ฐ ์ ์์ต๋๋ค. | |
| ## ๊ตฌ์ฑ | |
| ๊ธฐ๋ณธ ์ ๊ณต agent๋ฅผ ์ปค์คํฐ๋ง์ด์ฆํ๊ฑฐ๋ config๋ฅผ ํตํด ์ง์ agent๋ฅผ ๋ง๋ค ์ ์์ต๋๋ค. agent๋ ๋ ๊ฐ์ง ๋ฐฉ์์ผ๋ก ์ค์ ํฉ๋๋ค. | |
| ### JSON | |
| `opencode.json` config ํ์ผ์์ agent๋ฅผ ์ค์ ํฉ๋๋ค. | |
| ```json title="opencode.json" | |
| { | |
| "$schema": "https://opencode.ai/config.json", | |
| "agent": { | |
| "build": { | |
| "mode": "primary", | |
| "model": "anthropic/claude-sonnet-4-20250514", | |
| "prompt": "{file:./prompts/build.txt}", | |
| "tools": { | |
| "write": true, | |
| "edit": true, | |
| "bash": true | |
| } | |
| }, | |
| "plan": { | |
| "mode": "primary", | |
| "model": "anthropic/claude-haiku-4-20250514", | |
| "tools": { | |
| "write": false, | |
| "edit": false, | |
| "bash": false | |
| } | |
| }, | |
| "code-reviewer": { | |
| "description": "Reviews code for best practices and potential issues", | |
| "mode": "subagent", | |
| "model": "anthropic/claude-sonnet-4-20250514", | |
| "prompt": "You are a code reviewer. Focus on security, performance, and maintainability.", | |
| "tools": { | |
| "write": false, | |
| "edit": false | |
| } | |
| } | |
| } | |
| } | |
| ``` | |
| ### Markdown | |
| Markdown ํ์ผ๋ก๋ agent๋ฅผ ์ ์ํ ์ ์์ต๋๋ค. ๋ค์ ์์น์ ๋์ธ์. | |
| - Global: `~/.config/opencode/agents/` | |
| - Per-project: `.opencode/agents/` | |
| ```markdown title="~/.config/opencode/agents/review.md" | |
| description: Reviews code for quality and best practices | |
| mode: subagent | |
| model: anthropic/claude-sonnet-4-20250514 | |
| temperature: 0.1 | |
| tools: | |
| 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 ํ์ผ๋ช ์ agent ์ด๋ฆ์ด ๋ฉ๋๋ค. ์๋ฅผ ๋ค์ด `review.md`๋ `review` agent๋ฅผ ๋ง๋ญ๋๋ค. | |
| ## ์ต์ | |
| ๊ฐ config ์ต์ ์ ์์ธํ ์ดํด๋ณด๊ฒ ์ต๋๋ค. | |
| ### Description | |
| `description` ์ต์ ์ผ๋ก agent์ ์ญํ ๊ณผ ์ฌ์ฉ ์์ ์ ๊ฐ๋จํ ์ค๋ช ํ์ธ์. | |
| ```json title="opencode.json" | |
| { | |
| "agent": { | |
| "review": { | |
| "description": "Reviews code for best practices and potential issues" | |
| } | |
| } | |
| } | |
| ``` | |
| ์ด ์ต์ ์ **ํ์** config ํญ๋ชฉ์ ๋๋ค. | |
| ### Temperature | |
| `temperature` config๋ก LLM ์๋ต์ ๋ฌด์์์ฑ๊ณผ ์ฐฝ์์ฑ์ ์ ์ดํฉ๋๋ค. | |
| ๊ฐ์ด ๋ฎ์์๋ก ์๋ต์ด ๋ ์ง์ค๋๊ณ ๊ฒฐ์ ์ ์ด๋ฉฐ, ๊ฐ์ด ๋์์๋ก ์ฐฝ์์ฑ๊ณผ ๋ค์์ฑ์ด ์ปค์ง๋๋ค. | |
| ```json title="opencode.json" | |
| { | |
| "agent": { | |
| "plan": { | |
| "temperature": 0.1 | |
| }, | |
| "creative": { | |
| "temperature": 0.8 | |
| } | |
| } | |
| } | |
| ``` | |
| Temperature ๊ฐ์ ์ผ๋ฐ์ ์ผ๋ก 0.0~1.0 ๋ฒ์๋ฅผ ์ฌ์ฉํฉ๋๋ค. | |
| - **0.0-0.2**: ๋งค์ฐ ์ง์ค๋๊ณ ๊ฒฐ์ ์ ์ธ ์๋ต, ์ฝ๋ ๋ถ์/๊ณํ์ ์ ํฉ | |
| - **0.3-0.5**: ์ ๋นํ ์ฐฝ์์ฑ์ด ์์ธ ๊ท ํํ ์๋ต, ์ผ๋ฐ ๊ฐ๋ฐ ์์ ์ ์ ํฉ | |
| - **0.6-1.0**: ๋ ์ฐฝ์์ ์ด๊ณ ๋ค์ํ ์๋ต, ๋ธ๋ ์ธ์คํ ๋ฐ/ํ์์ ์ ์ฉ | |
| ```json title="opencode.json" | |
| { | |
| "agent": { | |
| "analyze": { | |
| "temperature": 0.1, | |
| "prompt": "{file:./prompts/analysis.txt}" | |
| }, | |
| "build": { | |
| "temperature": 0.3 | |
| }, | |
| "brainstorm": { | |
| "temperature": 0.7, | |
| "prompt": "{file:./prompts/creative.txt}" | |
| } | |
| } | |
| } | |
| ``` | |
| temperature๋ฅผ ์ง์ ํ์ง ์์ผ๋ฉด OpenCode๋ model๋ณ ๊ธฐ๋ณธ๊ฐ์ ์ฌ์ฉํฉ๋๋ค. ์ผ๋ฐ์ ์ผ๋ก ๋๋ถ๋ถ์ model์ 0, Qwen model์ 0.55๋ฅผ ์ฌ์ฉํฉ๋๋ค. | |
| ### Max steps | |
| agent๊ฐ ํ ์คํธ ์๋ต๋ง ํ๋๋ก ๊ฐ์ ๋๊ธฐ ์ ๊น์ง ์ํํ ์ ์๋ agentic iteration์ ์ต๋ ํ์๋ฅผ ์ ์ดํฉ๋๋ค. ๋น์ฉ์ ๊ด๋ฆฌํ๋ ค๋ ์ฌ์ฉ์์๊ฒ agentic action ์ ํ์ ์ ๊ณตํ๊ธฐ ์ํ ์ต์ ์ ๋๋ค. | |
| ์ด ๊ฐ์ ์ค์ ํ์ง ์์ผ๋ฉด model์ด ์ค๋จ์ ์ ํํ๊ฑฐ๋ ์ฌ์ฉ์๊ฐ ์ธ์ ์ ์ค๋จํ ๋๊น์ง agent๋ ๊ณ์ ๋ฐ๋ณตํฉ๋๋ค. | |
| ```json title="opencode.json" | |
| { | |
| "agent": { | |
| "quick-thinker": { | |
| "description": "Fast reasoning with limited iterations", | |
| "prompt": "You are a quick thinker. Solve problems with minimal steps.", | |
| "steps": 5 | |
| } | |
| } | |
| } | |
| ``` | |
| ์ ํ์ ๋๋ฌํ๋ฉด agent๋ ์์ ์์ฝ๊ณผ ๋จ์ ๊ถ์ฅ ์์ ์ ์๋ตํ๋๋ก ์ง์ํ๋ ํน์ ์์คํ prompt๋ฅผ ๋ฐ์ต๋๋ค. | |
| :::caution | |
| ๋ ๊ฑฐ์ `maxSteps` ํ๋๋ deprecated์ ๋๋ค. ๋์ `steps`๋ฅผ ์ฌ์ฉํ์ธ์. | |
| ::: | |
| ### Disable | |
| `true`๋ก ์ค์ ํ๋ฉด agent๋ฅผ ๋นํ์ฑํํฉ๋๋ค. | |
| ```json title="opencode.json" | |
| { | |
| "agent": { | |
| "review": { | |
| "disable": true | |
| } | |
| } | |
| } | |
| ``` | |
| ### Prompt | |
| `prompt` config๋ก ํด๋น agent์ custom ์์คํ prompt ํ์ผ์ ์ง์ ํฉ๋๋ค. prompt ํ์ผ์๋ agent ๋ชฉ์ ์ ๋ง๋ ์ง์์ฌํญ์ ์์ฑํ์ธ์. | |
| ```json title="opencode.json" | |
| { | |
| "agent": { | |
| "review": { | |
| "prompt": "{file:./prompts/code-review.txt}" | |
| } | |
| } | |
| } | |
| ``` | |
| ์ด ๊ฒฝ๋ก๋ config ํ์ผ ์์น ๊ธฐ์ค์ ์๋ ๊ฒฝ๋ก์ ๋๋ค. ๋ฐ๋ผ์ ์ ์ญ OpenCode config์ ํ๋ก์ ํธ๋ณ config ๋ชจ๋์์ ๋์ผํ๊ฒ ๋์ํฉ๋๋ค. | |
| ### Model | |
| `model` config๋ก ํด๋น agent์ model์ overrideํ ์ ์์ต๋๋ค. ์์ ํน์ฑ์ ๋ง์ถฐ model์ ๋ฌ๋ฆฌ ์ธ ๋ ์ ์ฉํฉ๋๋ค. ์๋ฅผ ๋ค์ด ๊ณํ์๋ ๋ ๋น ๋ฅธ model, ๊ตฌํ์๋ ๋ ๊ฐ๋ ฅํ model์ ์ฌ์ฉํ ์ ์์ต๋๋ค. | |
| :::tip | |
| model์ ์ง์ ํ์ง ์์ผ๋ฉด primary agent๋ [์ ์ญ์ผ๋ก ์ค์ ํ model](/docs/config#models)์ ์ฌ์ฉํ๊ณ , subagent๋ ํด๋น subagent๋ฅผ ํธ์ถํ primary agent์ model์ ์ฌ์ฉํฉ๋๋ค. | |
| ::: | |
| ```json title="opencode.json" | |
| { | |
| "agent": { | |
| "plan": { | |
| "model": "anthropic/claude-haiku-4-20250514" | |
| } | |
| } | |
| } | |
| ``` | |
| OpenCode config์ model ID๋ `provider/model-id` ํ์์ ์ฌ์ฉํฉ๋๋ค. ์๋ฅผ ๋ค์ด [OpenCode Zen](/docs/zen)์ ์ฌ์ฉํ๋ค๋ฉด GPT 5.1 Codex์ `opencode/gpt-5.1-codex`๋ฅผ ์ฌ์ฉํฉ๋๋ค. | |
| ### Tools | |
| `tools` config๋ก agent์์ ์ฌ์ฉํ tool์ ์ ์ดํฉ๋๋ค. ๊ฐ tool์ `true` ๋๋ `false`๋ก ์ค์ ํด ํ์ฑํ/๋นํ์ฑํํ ์ ์์ต๋๋ค. | |
| ```json title="opencode.json" {3-6,9-12} | |
| { | |
| "$schema": "https://opencode.ai/config.json", | |
| "tools": { | |
| "write": true, | |
| "bash": true | |
| }, | |
| "agent": { | |
| "plan": { | |
| "tools": { | |
| "write": false, | |
| "bash": false | |
| } | |
| } | |
| } | |
| } | |
| ``` | |
| :::note | |
| agent๋ณ config๋ ์ ์ญ config๋ฅผ overrideํฉ๋๋ค. | |
| ::: | |
| ์์ผ๋์นด๋๋ฅผ ์ฌ์ฉํ๋ฉด ์ฌ๋ฌ tool์ ํ ๋ฒ์ ์ ์ดํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด MCP ์๋ฒ์ ๋ชจ๋ tool์ ๋นํ์ฑํํ๋ ค๋ฉด ๋ค์๊ณผ ๊ฐ์ด ์ค์ ํฉ๋๋ค. | |
| ```json title="opencode.json" | |
| { | |
| "$schema": "https://opencode.ai/config.json", | |
| "agent": { | |
| "readonly": { | |
| "tools": { | |
| "mymcp_*": false, | |
| "write": false, | |
| "edit": false | |
| } | |
| } | |
| } | |
| } | |
| ``` | |
| [tool์ ๋ํด ๋ ์์๋ณด๊ธฐ](/docs/tools). | |
| ### Permissions | |
| permission์ ์ค์ ํด agent๊ฐ ์ํํ ์ ์๋ action์ ์ ์ดํ ์ ์์ต๋๋ค. ํ์ฌ `edit`, `bash`, `webfetch` tool์ permission์ ๋ค์ ๊ฐ์ผ๋ก ์ค์ ํ ์ ์์ต๋๋ค. | |
| - `"ask"` โ tool ์คํ ์ ์ ์น์ธ ์์ฒญ | |
| - `"allow"` โ ์น์ธ ์์ด ๋ชจ๋ ์์ ํ์ฉ | |
| - `"deny"` โ tool ๋นํ์ฑํ | |
| ```json title="opencode.json" | |
| { | |
| "$schema": "https://opencode.ai/config.json", | |
| "permission": { | |
| "edit": "deny" | |
| } | |
| } | |
| ``` | |
| ์ด permission์ agent๋ณ๋ก overrideํ ์ ์์ต๋๋ค. | |
| ```json title="opencode.json" {3-5,8-10} | |
| { | |
| "$schema": "https://opencode.ai/config.json", | |
| "permission": { | |
| "edit": "deny" | |
| }, | |
| "agent": { | |
| "build": { | |
| "permission": { | |
| "edit": "ask" | |
| } | |
| } | |
| } | |
| } | |
| ``` | |
| Markdown agent์์๋ permission์ ์ค์ ํ ์ ์์ต๋๋ค. | |
| ```markdown title="~/.config/opencode/agents/review.md" | |
| description: Code review without edits | |
| mode: subagent | |
| permission: | |
| edit: deny | |
| bash: | |
| "*": ask | |
| "git diff": allow | |
| "git log*": allow | |
| "grep *": allow | |
| webfetch: deny | |
| Only analyze code and suggest changes. | |
| ``` | |
| ํน์ bash ๋ช ๋ น์ ๋ํด์๋ permission์ ์ค์ ํ ์ ์์ต๋๋ค. | |
| ```json title="opencode.json" {7} | |
| { | |
| "$schema": "https://opencode.ai/config.json", | |
| "agent": { | |
| "build": { | |
| "permission": { | |
| "bash": { | |
| "git push": "ask", | |
| "grep *": "allow" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| ``` | |
| ์ฌ๊ธฐ์๋ glob ํจํด์ ์ฌ์ฉํ ์ ์์ต๋๋ค. | |
| ```json title="opencode.json" {7} | |
| { | |
| "$schema": "https://opencode.ai/config.json", | |
| "agent": { | |
| "build": { | |
| "permission": { | |
| "bash": { | |
| "git *": "ask" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| ``` | |
| ๋ํ `*` ์์ผ๋์นด๋๋ก ๋ชจ๋ ๋ช ๋ น์ permission์ ์ ์ดํ ์ ์์ต๋๋ค. | |
| ๋ง์ง๋ง์ผ๋ก ์ผ์นํ ๊ท์น์ด ์ฐ์ ํ๋ฏ๋ก `*` ์์ผ๋์นด๋๋ฅผ ๋จผ์ ๋๊ณ , ๊ตฌ์ฒด์ ์ธ ๊ท์น์ ๋ค์ ๋์ธ์. | |
| ```json title="opencode.json" {8} | |
| { | |
| "$schema": "https://opencode.ai/config.json", | |
| "agent": { | |
| "build": { | |
| "permission": { | |
| "bash": { | |
| "*": "ask", | |
| "git status *": "allow" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| ``` | |
| [permission์ ๋ํด ๋ ์์๋ณด๊ธฐ](/docs/permissions). | |
| ### Mode | |
| `mode` config๋ก agent ๋ชจ๋๋ฅผ ์ ์ดํฉ๋๋ค. `mode` ์ต์ ์ agent๋ฅผ ์ด๋ค ๋ฐฉ์์ผ๋ก ์ฌ์ฉํ ์ง ๊ฒฐ์ ํฉ๋๋ค. | |
| ```json title="opencode.json" | |
| { | |
| "agent": { | |
| "review": { | |
| "mode": "subagent" | |
| } | |
| } | |
| } | |
| ``` | |
| `mode`๋ `primary`, `subagent`, `all` ์ค ํ๋๋ก ์ค์ ํ ์ ์์ต๋๋ค. ์ค์ ํ์ง ์์ผ๋ฉด ๊ธฐ๋ณธ๊ฐ์ `all`์ ๋๋ค. | |
| ### Hidden | |
| `hidden: true`๋ฅผ ์ค์ ํ๋ฉด `@` ์๋์์ฑ ๋ฉ๋ด์์ subagent๋ฅผ ์จ๊ธธ ์ ์์ต๋๋ค. ๋ค๋ฅธ agent๊ฐ Task tool์ ํตํด programmatic์ผ๋ก๋ง ํธ์ถํด์ผ ํ๋ ๋ด๋ถ subagent์ ์ ์ฉํฉ๋๋ค. | |
| ```json title="opencode.json" | |
| { | |
| "agent": { | |
| "internal-helper": { | |
| "mode": "subagent", | |
| "hidden": true | |
| } | |
| } | |
| } | |
| ``` | |
| ์ด ์ค์ ์ ์๋์์ฑ ๋ฉ๋ด์์์ ์ฌ์ฉ์ ๊ฐ์์ฑ์๋ง ์ํฅ์ ์ค๋๋ค. permission์ด ํ์ฉ๋๋ฉด hidden agent๋ ๋ชจ๋ธ์ด Task tool์ ํตํด ํธ์ถํ ์ ์์ต๋๋ค. | |
| :::note | |
| `mode: subagent` agent์๋ง ์ ์ฉ๋ฉ๋๋ค. | |
| ::: | |
| ### Task permissions | |
| `permission.task`๋ก Task tool์ ํตํด ํด๋น agent๊ฐ ํธ์ถํ ์ ์๋ subagent ๋ฒ์๋ฅผ ์ ์ดํฉ๋๋ค. ์ ์ฐํ ๋งค์นญ์ ์ํด glob ํจํด์ ์ฌ์ฉํฉ๋๋ค. | |
| ```json title="opencode.json" | |
| { | |
| "agent": { | |
| "orchestrator": { | |
| "mode": "primary", | |
| "permission": { | |
| "task": { | |
| "*": "deny", | |
| "orchestrator-*": "allow", | |
| "code-reviewer": "ask" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| ``` | |
| `deny`๋ก ์ค์ ๋๋ฉด ํด๋น subagent๋ Task tool ์ค๋ช ์์ ์์ ํ ์ ๊ฑฐ๋๋ฏ๋ก ๋ชจ๋ธ์ด ํธ์ถ์ ์๋ํ์ง ์์ต๋๋ค. | |
| :::tip | |
| ๊ท์น์ ์ ์ธ ์์๋๋ก ํ๊ฐ๋๋ฉฐ, **๋ง์ง๋ง์ผ๋ก ์ผ์นํ ๊ท์น์ด ์น๋ฆฌํฉ๋๋ค**. ์ ์์์์ `orchestrator-planner`๋ `*`(deny)์ `orchestrator-*`(allow) ๋ชจ๋์ ์ผ์นํ์ง๋ง, `orchestrator-*`๊ฐ ๋ค์ ์์ผ๋ฏ๋ก ๊ฒฐ๊ณผ๋ `allow`์ ๋๋ค. | |
| ::: | |
| :::tip | |
| ์ฌ์ฉ์๋ agent์ task permission์ด deny์ฌ๋ `@` ์๋์์ฑ ๋ฉ๋ด๋ฅผ ํตํด ์ด๋ค subagent๋ ์ง์ ํธ์ถํ ์ ์์ต๋๋ค. | |
| ::: | |
| ### Color | |
| `color` ์ต์ ์ผ๋ก UI์์ agent์ ์๊ฐ ์คํ์ผ์ ์ง์ ํ ์ ์์ต๋๋ค. ์ธํฐํ์ด์ค์์ agent๊ฐ ํ์๋๋ ๋ฐฉ์์ ์ํฅ์ ์ค๋๋ค. | |
| ์ ํจํ hex ์์(์: `#FF5733`) ๋๋ theme ์์(`primary`, `secondary`, `accent`, `success`, `warning`, `error`, `info`)์ ์ฌ์ฉํ์ธ์. | |
| ```json title="opencode.json" | |
| { | |
| "agent": { | |
| "creative": { | |
| "color": "#ff6b6b" | |
| }, | |
| "code-reviewer": { | |
| "color": "accent" | |
| } | |
| } | |
| } | |
| ``` | |
| ### Top P | |
| `top_p` ์ต์ ์ผ๋ก ์๋ต ๋ค์์ฑ์ ์ ์ดํฉ๋๋ค. ๋ฌด์์์ฑ์ ์ ์ดํ๋ Temperature์ ๋์์ ๋๋ค. | |
| ```json title="opencode.json" | |
| { | |
| "agent": { | |
| "brainstorm": { | |
| "top_p": 0.9 | |
| } | |
| } | |
| } | |
| ``` | |
| ๊ฐ ๋ฒ์๋ 0.0~1.0์ ๋๋ค. ๊ฐ์ด ๋ฎ์์๋ก ์ง์ค๋๊ณ , ๋์์๋ก ๋ค์ํด์ง๋๋ค. | |
| ### Additional | |
| agent config์ ์ง์ ํ ๋๋จธ์ง ์ต์ ์ ๋ชจ๋ธ ์ต์ ์ผ๋ก provider์ **๊ทธ๋๋ก ์ ๋ฌ(pass through)** ๋ฉ๋๋ค. ์ด๋ฅผ ํตํด provider๋ณ ๊ธฐ๋ฅ๊ณผ ํ๋ผ๋ฏธํฐ๋ฅผ ํ์ฉํ ์ ์์ต๋๋ค. | |
| ์๋ฅผ ๋ค์ด OpenAI reasoning model์์๋ reasoning effort๋ฅผ ์ ์ดํ ์ ์์ต๋๋ค. | |
| ```json title="opencode.json" {6,7} | |
| { | |
| "agent": { | |
| "deep-thinker": { | |
| "description": "Agent that uses high reasoning effort for complex problems", | |
| "model": "openai/gpt-5", | |
| "reasoningEffort": "high", | |
| "textVerbosity": "low" | |
| } | |
| } | |
| } | |
| ``` | |
| ์ด ์ถ๊ฐ ์ต์ ์ model ๋ฐ provider๋ง๋ค ๋ค๋ฆ ๋๋ค. ์ฌ์ฉ ๊ฐ๋ฅํ ํ๋ผ๋ฏธํฐ๋ provider ๋ฌธ์๋ฅผ ํ์ธํ์ธ์. | |
| :::tip | |
| ์ฌ์ฉ ๊ฐ๋ฅํ model ๋ชฉ๋ก์ `opencode models` ๋ช ๋ น์ผ๋ก ํ์ธํ ์ ์์ต๋๋ค. | |
| ::: | |
| ## ์์ด์ ํธ ์์ฑ | |
| ์๋ ๋ช ๋ น์ผ๋ก ์ agent๋ฅผ ๋ง๋ค ์ ์์ต๋๋ค. | |
| ```bash | |
| opencode agent create | |
| ``` | |
| ์ด ์ธํฐ๋ํฐ๋ธ ๋ช ๋ น์ ๋ค์์ ์ํํฉ๋๋ค. | |
| 1. agent ์ ์ฅ ์์น๋ฅผ ๋ฌป์ต๋๋ค(์ ์ญ/ํ๋ก์ ํธ). | |
| 2. agent๊ฐ ์ํํ ์์ ์ ์ค๋ช ์ ๋ฐ์ต๋๋ค. | |
| 3. ์ ์ ํ ์์คํ prompt์ ์๋ณ์๋ฅผ ์์ฑํฉ๋๋ค. | |
| 4. agent๊ฐ ์ ๊ทผํ tool์ ์ ํํ๊ฒ ํฉ๋๋ค. | |
| 5. ๋ง์ง๋ง์ผ๋ก agent config๊ฐ ๋ด๊ธด Markdown ํ์ผ์ ์์ฑํฉ๋๋ค. | |
| ## ์ฌ์ฉ ์ฌ๋ก | |
| ์๋ก ๋ค๋ฅธ agent์ ๋ํ์ ์ธ ์ฌ์ฉ ์ฌ๋ก๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค. | |
| - **Build agent**: ๋ชจ๋ tool์ ํ์ฑํํ ์ ์ฒด ๊ฐ๋ฐ ์์ | |
| - **Plan agent**: ์ฝ๋ ๋ณ๊ฒฝ ์์ด ๋ถ์๊ณผ ๊ณํ ์ํ | |
| - **Review agent**: ์ฝ๊ธฐ ์ ์ฉ ์ ๊ทผ + ๋ฌธ์ํ tool ๊ธฐ๋ฐ ์ฝ๋ ๋ฆฌ๋ทฐ | |
| - **Debug agent**: bash/read tool ์ค์ฌ์ ์กฐ์ฌ ์์ | |
| - **Docs agent**: ํ์ผ ์์ ์ ๊ฐ๋ฅํ์ง๋ง ์์คํ ๋ช ๋ น์ ์๋ ๋ฌธ์ ์์ฑ ์์ | |
| ## ์์ | |
| ์ค์ ๋ก ์ ์ฉํ๊ฒ ์ธ ์ ์๋ ์์ agent๋ฅผ ์๊ฐํฉ๋๋ค. | |
| :::tip | |
| ๊ณต์ ํ๊ณ ์ถ์ agent๊ฐ ์๋์? [PR ์ ์ถํ๊ธฐ](https://github.com/anomalyco/opencode). | |
| ::: | |
| ### Documentation agent | |
| ```markdown title="~/.config/opencode/agents/docs-writer.md" | |
| description: Writes and maintains project documentation | |
| mode: subagent | |
| tools: | |
| bash: false | |
| You are a technical writer. Create clear, comprehensive documentation. | |
| Focus on: | |
| - Clear explanations | |
| - Proper structure | |
| - Code examples | |
| - User-friendly language | |
| ``` | |
| ### Security auditor | |
| ```markdown title="~/.config/opencode/agents/security-auditor.md" | |
| description: Performs security audits and identifies vulnerabilities | |
| mode: subagent | |
| tools: | |
| write: false | |
| edit: false | |
| You are a security expert. Focus on identifying potential security issues. | |
| Look for: | |
| - Input validation vulnerabilities | |
| - Authentication and authorization flaws | |
| - Data exposure risks | |
| - Dependency vulnerabilities | |
| - Configuration security issues | |
| ``` | |