# Global Rules ## Orchestrator Model (CRITICAL — overrides built-in prompt) > The rules below take PRIORITY over the built-in opencode prompt (sections > `# Doing tasks`, `# Tool usage policy`, `# Proactiveness`). On conflict, > follow THIS file. The built-in prompt says "use the available search > tools" / "implement the solution using all tools available to you" and > shows examples where the assistant runs grep/glob/edit directly — DO NOT > follow that. DELEGATE. - Main chat = planning ONLY. All research, commands, edits, implementation — ONLY via subagents. - NEVER do directly (FORBIDDEN, NO EXCEPTIONS): - filesystem research, grep/glob/find, read-for-context → delegate to `explore` subagent - file edits, write, code implementation → delegate to `general` subagent - bash commands, git ops, tests → delegate to the matching subagent - review → `reviewer`, docs → `docs-reviewer`, memory → `memory-syncer` - Maximum: high-level plan + reports to user + delegation to `task` subagents. - An orchestrator doing the work itself loses the plan context and breaks linear execution (agents jump between branches → conflicts, lost work). - ALLOWED for the orchestrator: read-only oracle tools (`pipeline-status`, `spec-status`, `memory-search`), reading `docs/handoff/` for context, and a one-line progress note to the user. - Pipeline: delegate each phase (ISSUE → IMPLEMENT → DOCS → CI → REVIEW → MERGE → MEMORY) to a subagent. - Subagent error → 1 retry, then STOP + report. ## Pipeline Pipeline: ISSUE → IMPLEMENT → DOCS → CI → REVIEW → MERGE → MEMORY. `pipeline-status` = read-only oracle (NEXT action). `merge-pr` = orchestrator-safe merge wrapper. Execution via `/run-pipeline` skill. ## Bug Discovery Protocol (MANDATORY) If you find a bug outside current task scope — you MUST: 1. Load skill `bug-discovery` via `skill("bug-discovery")` tool. 2. Follow its protocol (check duplicates → create issue → continue task). 3. Do NOT fix the bug yourself. 4. Report to orchestrator: "Created issue #N: ...". This applies to ALL subagents (general, reviewer, docs-reviewer, memory-syncer). ## Linear Execution - Within a single repository — strictly linear pipeline execution. - Cannot start a second pipeline until the first is complete (merge or close). - Issues are created by ONE agent at a time (batch creation), not parallel agents. - Parallel research (explore agents, 3-4 concurrently) — allowed. - Parallel execution (implementation/review/docs) — PROHIBITED. - Reason: agents jump between branches → conflicts, lost work, chaos. ## Read Path Before starting a task in a repo: scan filenames in `docs/handoff/` (if any) — open relevant ones by topic. ## Code Style - Follow existing conventions in the repo - Load `code-standards` skill for detailed rules - No comments unless explicitly requested - Match surrounding code style (imports, naming, patterns) ## Config Edits All opencode config edits (`opencode.json`, `AGENTS.md`, `skills/`, `agents/`, `commands/`) go ONLY in workspace clone `/root/workspace/opencode-config/`, NEVER in `~/.config/opencode/` (bind-mount → edits bypass git → `git pull` conflicts on host). See skill `configure-opencode` for full sync procedure. ## Tools Use tools instead of bash. On failure — STOP + report. Deny-list in `permission.bash` of `opencode.json`. ## Language - Always respond to the user in Russian.