컨텐츠로 건너뛰기

고급 구성

고급 구성

이 문서는 Oh My OpenCode의 고급 구성 옵션을 소개하여 특정 요구 사항에 맞게 사용자 정의할 수 있도록 돕습니다.

구성 파일 위치 및 우선순위

구성 파일 위치

Oh My OpenCode는 다음 순서로 구성 파일을 찾습니다:

1. .opencode/oh-my-opencode.json (프로젝트 수준, 가장 높은 우선순위)
2. ~/.config/opencode/oh-my-opencode.json (사용자 수준, macOS/Linux)
3. %APPDATA%\opencode\oh-my-opencode.json (사용자 수준, Windows)

구성 병합 규칙

여러 구성 파일은 우선순위에 따라 병합됩니다:

프로젝트 수준 구성 (.opencode/oh-my-opencode.json):

{
  "sisyphus": {
    "enabled": true,
    "max_concurrent_tasks": 2
  }
}

사용자 수준 구성 (~/.config/opencode/oh-my-opencode.json):

{
  "sisyphus": {
    "max_concurrent_tasks": 3  // 프로젝트 수준 설정을 덮어씀
  },
  "agents": {
    "oracle": { "enabled": true }
  }
}

최종 유효 구성:

{
  "sisyphus": {
    "enabled": true,
    "max_concurrent_tasks": 3  // 사용자 수준에서 가져옴
  },
  "agents": {
    "oracle": { "enabled": true }  // 사용자 수준에서 가져옴
  }
}

JSONC 지원

Oh My OpenCode는 주석이 있는 JSON(JSONC) 형식을 지원합니다:

{
  // 이것은 주석입니다
  "sisyphus": {
    "enabled": true,
    /* 
     * 다중 행 주석
     * 구독 플랜에 따라 조정하십시오
     */
    "max_concurrent_tasks": 3
  },
  
  // 에이전트 구성
  "agents": {
    "oracle": {
      "enabled": true,
      // "temperature": 0.7,  // 사용하지 않는 구성은 주석 처리 가능
    }
  }
}

구독 플랜 구성

Claude Max20 전체 구성

집약적인 개발 작업에 적합한 가장 강력한 구성입니다:

{
  "subscription": "claude-max20",
  "sisyphus": {
    "enabled": true,
    "max_concurrent_tasks": 3,
    "task_timeout": 300,
    "auto_delegate": true,
    "delegation_strategy": "optimal"
  },
  "agents": {
    "oracle": {
      "enabled": true,
      "model": "claude-sonnet-4",
      "temperature": 0.7,
      "max_tokens": 4096
    },
    "librarian": {
      "enabled": true,
      "model": "claude-sonnet-4",
      "temperature": 0.5
    },
    "frontend-engineer": {
      "enabled": true,
      "model": "claude-sonnet-4",
      "temperature": 0.6
    },
    "backend-engineer": {
      "enabled": true,
      "model": "claude-sonnet-4",
      "temperature": 0.6
    },
    "explore": {
      "enabled": true,
      "model": "claude-sonnet-3.5",
      "temperature": 0.3
    }
  },
  "lsp": {
    "enabled": true,
    "languages": ["typescript", "javascript", "python", "go", "rust"]
  },
  "background_task": {
    "defaultConcurrency": 3,
    "providerConcurrency": {
      "anthropic": 3,
      "openai": 5
    }
  }
}

ChatGPT Plus/Pro 구성

성능과 비용의 균형을 맞춘 구성입니다:

{
  "subscription": "chatgpt-plus",
  "sisyphus": {
    "enabled": true,
    "max_concurrent_tasks": 2,
    "delegation_strategy": "balanced"
  },
  "agents": {
    "oracle": {
      "enabled": true,
      "model": "gpt-4-turbo"
    },
    "librarian": {
      "enabled": true,
      "model": "gpt-4-turbo"
    },
    "frontend-engineer": {
      "enabled": true,
      "model": "gpt-4"
    },
    "backend-engineer": {
      "enabled": false  // 할당량 절약
    },
    "explore": {
      "enabled": true,
      "model": "gpt-4"
    }
  },
  "background_task": {
    "defaultConcurrency": 2,
    "providerConcurrency": {
      "openai": 2
    }
  }
}

Gemini Advanced 구성

높은 가성비를 제공하는 구성입니다:

{
  "subscription": "gemini-advanced",
  "sisyphus": {
    "enabled": true,
    "max_concurrent_tasks": 2
  },
  "agents": {
    "oracle": {
      "enabled": false  // Gemini는 아키텍처 설계에 약간 취약함
    },
    "librarian": {
      "enabled": true,
      "model": "gemini-pro-1.5"
    },
    "frontend-engineer": {
      "enabled": true,
      "model": "gemini-pro-1.5"
    },
    "explore": {
      "enabled": true,
      "model": "gemini-pro-1.5"
    }
  }
}

에이전트 사용자 정의

전체 에이전트 구성 옵션

{
  "agents": {
    "oracle": {
      // 기본 구성
      "enabled": true,
      "model": "claude-sonnet-4",
      "temperature": 0.7,
      "max_tokens": 4096,
      "top_p": 0.9,
      
      // 프롬프트 사용자 정의
      "prompt_append": "자세한 기술적 결정 근거와 트레이드오프 분석을 제공해주세요",
      "system_prompt_override": "당신은 수석 아키텍트입니다...",
      
      // 동작 제어
      "auto_retry": true,
      "max_retries": 3,
      "retry_delay": 2,
      
      // 도구 권한
      "tools": {
        "lsp": true,
        "ast_grep": true,
        "file_operations": true,
        "shell_commands": false  // 보안 고려 사항
      },
      
      // 리소스 제한
      "rate_limit": {
        "requests_per_minute": 20,
        "tokens_per_minute": 50000
      }
    }
  }
}

맞춤형 에이전트 프롬프트

특정 프로젝트에 맞게 에이전트 동작을 조정하십시오:

{
  "agents": {
    "frontend-engineer": {
      "enabled": true,
      "prompt_append": "귀하는 저희 팀의 프론트엔드 엔지니어입니다. 다음 표준을 준수하십시오:\n\n1. 기술 스택:\n   - React 18+ 및 TypeScript\n   - 스타일링을 위한 Tailwind CSS\n   - 데이터 페칭을 위한 React Query\n\n2. 코드 스타일:\n   - 함수형 컴포넌트 및 Hook 사용\n   - Props는 TypeScript 인터페이스 정의 필수\n   - 상속보다 합성을 우선함\n\n3. 접근성:\n   - 모든 인터랙티브 요소는 키보드로 접근 가능해야 함\n   - 시맨틱 HTML 사용\n   - 적절한 ARIA 레이블 제공\n\n4. 성능:\n   - React.memo를 사용하여 렌더링 최적화\n   - 이미지는 지연 로딩(lazy loading) 사용 필수\n   - 렌더링 함수 내에서 객체 생성 지양"
    }
  }
}

권한 제어 구성

파일 작업 권한

{
  "permissions": {
    "file_operations": {
      "read": {
        "allow": ["src/**", "docs/**", "*.md"],
        "deny": [".env*", "*.key", "secrets/**"]
      },
      "write": {
        "allow": ["src/**", "docs/**"],
        "deny": ["package.json", "tsconfig.json"]  // 중요 파일은 수동 확인 필요
      },
      "delete": {
        "require_confirmation": true,
        "allow": ["temp/**"],
        "deny": ["**"]  // 기본적으로 삭제 거부
      }
    }
  }
}

쉘 명령 권한

{
  "permissions": {
    "shell_commands": {
      "enabled": true,
      "whitelist": [
        "npm test",
        "npm run lint",
        "git status",
        "git diff"
      ],
      "blacklist": [
        "rm -rf",
        "sudo",
        "curl *",  // 데이터 유출 방지
        "wget *"
      ],
      "require_confirmation_for": [
        "git push",
        "npm publish",
        "docker"
      ]
    }
  }
}

API 호출 권한

{
  "permissions": {
    "api_calls": {
      "allowed_domains": [
        "api.github.com",
        "registry.npmjs.org"
      ],
      "rate_limit": {
        "requests_per_minute": 60
      },
      "require_user_secrets": true  // API 키는 사용자가 제공해야 함
    }
  }
}

백그라운드 작업 동시성 제어

동시성 전략 구성

{
  "background_task": {
    "defaultConcurrency": 5,
    "providerConcurrency": {
      "anthropic": 3,
      "openai": 5
    },
    
    // 우선순위 구성
    "priority_levels": {
      "high": {
        "max_concurrent": 2,
        "timeout": 600
      },
      "normal": {
        "max_concurrent": 2,
        "timeout": 300
      },
      "low": {
        "max_concurrent": 1,
        "timeout": 120
      }
    },
    
    // 리소스 할당 전략
    "scheduling": {
      "strategy": "fair",  // fair(공평), priority(우선순위), round-robin(라운드 로빈)
      "preemption": false,  // 높은 우선순위 작업의 선점 허용 여부
      "queue_size": 10
    },
    
    // 실패 처리
    "error_handling": {
      "retry_failed": true,
      "max_retries": 2,
      "fallback_to_sync": true  // 실패 후 동기 실행으로 전환
    }
  }
}

작업 유형 구성

{
  "task_types": {
    "analysis": {
      "can_run_in_background": true,
      "priority": "low",
      "timeout": 120
    },
    "code_generation": {
      "can_run_in_background": false,  // 코드 생성은 사용자 확인 필요
      "priority": "high"
    },
    "documentation": {
      "can_run_in_background": true,
      "priority": "low"
    },
    "testing": {
      "can_run_in_background": true,
      "priority": "normal"
    }
  }
}

Sisyphus 에이전트 구성 옵션

전체 Sisyphus 구성

{
  "sisyphus": {
    // 기본 구성
    "enabled": true,
    "max_concurrent_tasks": 3,
    "task_timeout": 300,
    
    // 위임 전략
    "auto_delegate": true,
    "delegation_strategy": "optimal",  // optimal, balanced, sequential, parallel
    
    // 작업 분해
    "task_decomposition": {
      "enabled": true,
      "max_subtasks": 10,
      "min_subtask_complexity": 2
    },
    
    // 에이전트 선택
    "agent_selection": {
      "strategy": "capability_match",  // capability_match, load_balance, random
      "consider_workload": true,
      "prefer_specialists": true
    },
    
    // 결과 집계
    "result_aggregation": {
      "strategy": "merge",  // merge, vote, best
      "conflict_resolution": "oracle_decides"
    },
    
    // 컨텍스트 관리
    "context_sharing": {
      "enabled": true,
      "share_between_agents": true,
      "max_context_size": 8192
    }
  }
}

Hook 통합 구성

수명 주기 Hook

{
  "hooks": {
    "pre_task": {
      "enabled": true,
      "script": ".opencode/hooks/pre-task.sh",
      "timeout": 30
    },
    "post_task": {
      "enabled": true,
      "script": ".opencode/hooks/post-task.sh"
    },
    "on_error": {
      "enabled": true,
      "script": ".opencode/hooks/error-handler.sh",
      "notify_user": true
    },
    "on_agent_switch": {
      "enabled": true,
      "script": ".opencode/hooks/agent-switch.sh"
    }
  }
}

Hook 스크립트 예시

#!/bin/bash
# .opencode/hooks/pre-task.sh

# 작업 시작 전 실행
echo "작업 시작: $TASK_ID"

# 코드 품질 확인
npm run lint || {
  echo "Lint 실패. 계속하기 전에 수정하십시오."
  exit 1
}

# 최신 코드 가져오기
git pull origin main

exit 0

MCP 서버 구성

모델 컨텍스트 프로토콜(Model Context Protocol) 통합

{
  "mcp": {
    "enabled": true,
    "servers": [
      {
        "name": "github",
        "command": "mcp-server-github",
        "args": ["--token", "${GITHUB_TOKEN}"],
        "env": {
          "GITHUB_API_URL": "https://api.github.com"
        }
      },
      {
        "name": "database",
        "command": "mcp-server-postgres",
        "args": ["--connection", "${DATABASE_URL}"]
      },
      {
        "name": "slack",
        "command": "mcp-server-slack",
        "args": ["--token", "${SLACK_TOKEN}"]
      }
    ],
    
    // 서버 리소스 제한
    "resource_limits": {
      "max_connections": 5,
      "timeout": 30,
      "retry_attempts": 3
    }
  }
}

전체 구성 예시

엔터프라이즈급 구성 템플릿

{
  "version": "1.0",
  "subscription": "claude-max20",
  
  "sisyphus": {
    "enabled": true,
    "max_concurrent_tasks": 3,
    "delegation_strategy": "optimal"
  },
  
  "agents": {
    "oracle": {
      "enabled": true,
      "model": "claude-sonnet-4",
      "temperature": 0.7,
      "prompt_append": "회사의 기술 스택 및 아키텍처 원칙을 따르십시오"
    },
    "librarian": {
      "enabled": true,
      "model": "claude-sonnet-4"
    },
    "frontend-engineer": {
      "enabled": true,
      "model": "claude-sonnet-4",
      "prompt_append": "React + TypeScript + Tailwind 사용"
    },
    "backend-engineer": {
      "enabled": true,
      "model": "claude-sonnet-4",
      "prompt_append": "Node.js + Express + PostgreSQL 사용"
    },
    "explore": {
      "enabled": true,
      "model": "claude-sonnet-3.5"
    }
  },
  
  "lsp": {
    "enabled": true,
    "languages": ["typescript", "python", "go"]
  },
  
  "background_task": {
    "defaultConcurrency": 5,
    "providerConcurrency": {
      "anthropic": 3,
      "openai": 5
    }
  },
  
  "permissions": {
    "file_operations": {
      "read": {
        "allow": ["src/**", "docs/**"],
        "deny": [".env*", "secrets/**"]
      },
      "write": {
        "allow": ["src/**", "docs/**"],
        "deny": ["package.json"]
      }
    },
    "shell_commands": {
      "whitelist": ["npm test", "npm run lint", "git status"]
    }
  },
  
  "hooks": {
    "pre_task": {
      "enabled": true,
      "script": ".opencode/hooks/pre-task.sh"
    },
    "post_task": {
      "enabled": true,
      "script": ".opencode/hooks/post-task.sh"
    }
  },
  
  "context_injection": {
    "enabled": true,
    "files": [".opencode/CONTEXT.md", "AGENTS.md"]
  }
}

구성 유효성 검사

구성 파일 유효성 검사

# 구성 구문 유효성 검사
opencode "구성 파일 유효성 검사"

# 구성 테스트
opencode "현재 구성을 사용하여 테스트 작업 수행"

# 유효 구성 보기
opencode "현재의 전체 구성 보여줘"

일반적인 구성 오류

// ❌ 오류: 동시성이 구독 한계를 초과함
{
  "sisyphus": {
    "max_concurrent_tasks": 10  // Claude Max20 최대치는 3입니다
  }
}

// ✅ 올바름
{
  "sisyphus": {
    "max_concurrent_tasks": 3
  }
}

// ❌ 오류: 비활성화된 에이전트
{
  "sisyphus": {
    "auto_delegate": true
  },
  "agents": {
    "oracle": { "enabled": false }  // Sisyphus가 위임을 시도할 수 있음
  }
}

// ✅ 올바름
{
  "agents": {
    "oracle": { "enabled": true }
  }
}

다음 단계

구성을 마친 후 다음 항목을 권장합니다:

  1. 💡 사용 사례에서 구성을 적용하는 방법 확인
  2. 📖 베스트 프랙티스를 검토하여 워크플로우 최적화
  3. 🧪 실제 프로젝트에서 구성을 테스트하고 조정하십시오