OCS Mattermost OCS Plugin
Guide

Coding Bot Guide

Use OpenCode-backed coding agents inside Mattermost without inventing a second execution system.

What Makes Coding Mode Different

Coding bots add repository-aware behavior on top of the same OpenCode session model used by conversation bots.

  • Project context can be attached from the current OpenCode project.
  • Referenced files can be looked up and inserted into the prompt.
  • Coding plans can be returned as ocs-task cards.
  • Approved commands can run through OpenCode session execution flows.
  • Session diffs can be surfaced back into Mattermost.

API Boundaries

The plugin keeps coding mode inside OpenCode server capabilities. Project context, file lookup, search, shell, command execution, and diffs are routed through OpenCode APIs instead of hidden local filesystem execution in the plugin.

Recommended Bot Profiles

  • implementer: for focused code changes
  • reviewer: for change analysis and risk spotting
  • triage: for reproduction, root-cause narrowing, and issue shaping
  • release: for packaging and rollout checklists

Prompt Enrichment

Use workspace snapshots sparingly and keep referenced file limits tight. It is usually better to attach a few highly relevant files than to overload the model with a large repository dump.

Approval Flow

  1. The bot returns a coding plan and optional commands.
  2. The plugin renders a task card in Mattermost.
  3. A user explicitly approves a safe command.
  4. The result is reflected back into the same task context.
가이드

코딩 봇 가이드

Mattermost 안에서 OpenCode 기반 코딩 에이전트를 쓰되, 플러그인 내부에 별도 실행 체계를 억지로 만들지 않는 방법을 설명합니다.

코딩 모드가 다른 점

코딩 봇은 대화 봇과 같은 OpenCode 세션 구조 위에 저장소 인식 기능을 추가합니다.

  • 현재 OpenCode 프로젝트 컨텍스트를 프롬프트에 붙일 수 있습니다.
  • 참조된 파일을 조회해 본문에 넣을 수 있습니다.
  • 코딩 계획을 ocs-task 카드로 돌려줄 수 있습니다.
  • 승인된 명령을 OpenCode 세션 실행 흐름으로 보낼 수 있습니다.
  • session diff를 다시 Mattermost에 노출할 수 있습니다.

API 경계

코딩 모드는 OpenCode 서버가 공식적으로 제공하는 범위 안에서만 동작하도록 잡았습니다. 프로젝트 컨텍스트, 파일 조회, 검색, 셸, 명령 실행, diff 모두 OpenCode API를 통해 처리하고 플러그인 로컬 파일 시스템 실행에 의존하지 않습니다.

권장 봇 프로필

  • implementer: 실제 코드 수정 중심
  • reviewer: 변경 분석과 리스크 점검 중심
  • triage: 재현과 원인 축소, 이슈 정리 중심
  • release: 패키징과 배포 체크리스트 중심

프롬프트 보강

워크스페이스 스냅샷과 파일 첨부는 과하지 않게 쓰는 편이 좋습니다. 큰 저장소를 통째로 넣기보다, 관련성이 높은 파일 몇 개를 정확히 붙이는 쪽이 훨씬 안정적입니다.

승인 흐름

  1. 봇이 코딩 계획과 선택적 명령 목록을 돌려줍니다.
  2. 플러그인이 Mattermost 안에 태스크 카드를 렌더링합니다.
  3. 사용자가 안전한 명령을 명시적으로 승인합니다.
  4. 결과가 같은 태스크 맥락 안으로 다시 반영됩니다.