|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +## Project Purpose |
| 4 | + |
| 5 | +This is the OpenCode adapter instruction overlay for `rldyour-opencode`. |
| 6 | +It is a system file tracked on `main` so that `install_system_opencode.sh` |
| 7 | +copies it to the OpenCode config root on a fresh `git clone`, without |
| 8 | +relying on the `fullrepo` overlay restore step. |
| 9 | + |
| 10 | +Canonical public description: rldyour AI CLI configuration for OpenCode: local plugins, MCP/LSP, permissions, commands, agents, browser/design workflows, and security review. |
| 11 | + |
| 12 | +The file is the OpenCode install surface for the owner-defined project |
| 13 | +memory. It must remain subordinate to checked source files: `opencode.json`, |
| 14 | +`.opencode/**`, `references/**`, scripts, tests, and the root control-plane |
| 15 | +tuple. |
| 16 | + |
| 17 | +## Source Of Truth |
| 18 | + |
| 19 | +- Repository: `NDDev-it-com/rldyour-opencode` |
| 20 | +- Branch: `main` |
| 21 | +- Product version: `1.5.1` |
| 22 | +- Current HEAD: `ba8d8eefea4e15223ad73a925d800f4bf9feab0b` |
| 23 | +- Runtime baseline: OpenCode `1.17.7` |
| 24 | + |
| 25 | +The durable source of truth is the current code/config/tests/git state: |
| 26 | + |
| 27 | +- `opencode.json` |
| 28 | +- `.opencode/**` |
| 29 | +- `references/**` |
| 30 | +- `scripts/**` |
| 31 | +- `tests/**` |
| 32 | +- root `config/repositories.json` |
| 33 | + |
| 34 | +This overlay is derived context only. |
| 35 | + |
| 36 | +## Domain Boundaries |
| 37 | + |
| 38 | +Use OpenCode-native surfaces only: |
| 39 | + |
| 40 | +- `opencode.json` |
| 41 | +- `.opencode/skills/*/SKILL.md` |
| 42 | +- `.opencode/commands/*.md` |
| 43 | +- `.opencode/agents/*.md` |
| 44 | +- `.opencode/plugins/*.ts` |
| 45 | +- `references/rldyour-contract.json` |
| 46 | + |
| 47 | +Do not copy Claude Code plugin formats, Codex plugin formats, or Gemini |
| 48 | +`.gemini` formats into this adapter. |
| 49 | + |
| 50 | +## OpenCode Conventions |
| 51 | + |
| 52 | +When translating shared rldyour policy into OpenCode, use OpenCode-native |
| 53 | +concepts: |
| 54 | + |
| 55 | +- skills live under `.opencode/skills`; |
| 56 | +- slash commands live under `.opencode/commands`; |
| 57 | +- agents live under `.opencode/agents`; |
| 58 | +- local plugins live under `.opencode/plugins`; |
| 59 | +- permission behavior is encoded in `opencode.json` and release-safe overlays; |
| 60 | +- runtime/package baselines are recorded in `references/opencode-baseline.json`. |
| 61 | + |
| 62 | +Do not describe Codex managed agents, Claude Code hooks, or Gemini TOML command |
| 63 | +files as active OpenCode surfaces. Comparative notes are acceptable only when |
| 64 | +they make a boundary explicit. |
| 65 | + |
| 66 | +## System Install Contract |
| 67 | + |
| 68 | +`scripts/install_system_opencode.sh` installs source config from normal branch |
| 69 | +and copies this file only when the `fullrepo` overlay is restored locally. If |
| 70 | +this file is absent in a source-only checkout, the installer must continue with |
| 71 | +an explicit optional-overlay warning. |
| 72 | + |
| 73 | +The installer-required normal source paths are: |
| 74 | + |
| 75 | +- `opencode.json` |
| 76 | +- `.opencode/` |
| 77 | + |
| 78 | +The optional agent-only source path is: |
| 79 | + |
| 80 | +- `AGENTS.md` |
| 81 | + |
| 82 | +`AGENTS.md` must be restored and published through `fullrepo`; it must not be |
| 83 | +made a normal-branch source file only to satisfy system installation. A |
| 84 | +source-only checkout must still install the OpenCode runtime config and report |
| 85 | +that the agent overlay is unavailable. |
| 86 | + |
| 87 | +The system convergence path is owned by root `/ry-repair`: |
| 88 | + |
| 89 | +- preflight source paths before long installer phases; |
| 90 | +- restore `fullrepo` overlays when policy allows it; |
| 91 | +- run OpenCode installer and doctor scripts with explicit timeouts; |
| 92 | +- validate installed surfaces through positive inventories; |
| 93 | +- validate every discovered `opencode` binary on `PATH` against the runtime |
| 94 | + baseline, not only the first active binary. |
| 95 | + |
| 96 | +## Browser And Orchestration Boundary |
| 97 | + |
| 98 | +Browser routing remains shared across the control plane: |
| 99 | + |
| 100 | +- Webwright: high-level long-horizon browser workflows. |
| 101 | +- Playwright CLI: low-level UI evidence, screenshots, snapshots, and traces. |
| 102 | +- Chrome DevTools MCP: console, network, performance, memory, and Lighthouse. |
| 103 | + |
| 104 | +OpenCode agents are not cmux orchestrators. cmux orchestrator mode exists only |
| 105 | +as one visible cmux terminal controlling visible worker terminals. |
| 106 | + |
| 107 | +In standard mode, no software orchestrator exists. The owner operates directly |
| 108 | +through OpenCode, Claude Code, Codex, or Gemini CLI. In cmux orchestrator mode, |
| 109 | +OpenCode can run as a visible worker terminal, but it must not spawn hidden |
| 110 | +background orchestrators, daemon supervisors, or unbounded worker jobs. |
| 111 | + |
| 112 | +OpenCode reviewer agents may analyze and report. They must not push, publish |
| 113 | +fullrepo, delete branches, run system installs, or mutate global policy unless |
| 114 | +the visible orchestrator explicitly delegates that exact action and project |
| 115 | +policy permits it. |
| 116 | + |
| 117 | +## Security And Permissions |
| 118 | + |
| 119 | +Owner-standard OpenCode configuration intentionally allows broad primary |
| 120 | +owner-context permissions for a trusted workstation. That posture is explicit, |
| 121 | +not accidental. Keep these boundaries: |
| 122 | + |
| 123 | +- primary owner contexts may allow `read`, `edit`, `bash`, `task`, |
| 124 | + `external_directory`, and `doom_loop` according to `opencode.json` policy; |
| 125 | +- reviewer agents stay stricter by role; |
| 126 | +- release-safe config remains available as a conservative artifact; |
| 127 | +- secrets, OAuth tokens, API keys, browser profiles, local caches, and runtime |
| 128 | + markers must not be committed; |
| 129 | +- permission observability belongs in OpenCode-native event hooks and plugins, |
| 130 | + not undocumented policy shims. |
| 131 | + |
| 132 | +If a change weakens a guardrail, add a validator or a release note entry. Do |
| 133 | +not rely on prose alone for security-sensitive behavior. |
| 134 | + |
| 135 | +## MCP And Provider Inventory |
| 136 | + |
| 137 | +Active MCP servers are governed by the root positive inventory and adapter |
| 138 | +OpenCode config. Configure only providers listed in the approved active |
| 139 | +inventory. Removed or historical tools must not be reintroduced unless the |
| 140 | +owner updates the inventory and release policy. |
| 141 | + |
| 142 | +Browser provider roles are fixed: |
| 143 | + |
| 144 | +- Webwright handles long-horizon workflows and reusable evidence scripts. |
| 145 | +- Playwright CLI handles low-level UI screenshots, snapshots, traces, and |
| 146 | + visual evidence. |
| 147 | +- Chrome DevTools MCP handles DevTools, console, network, performance, memory, |
| 148 | + Lighthouse, and live Chrome debugging. |
| 149 | + |
| 150 | +Do not reclassify Webwright as MCP and do not silently introduce a second |
| 151 | +browser control provider. |
| 152 | + |
| 153 | +## Release And Fullrepo Policy |
| 154 | + |
| 155 | +OpenCode adapter releases are numeric-tagged. Current exact tag support is |
| 156 | +`1.3.4`; older tags are historical unless the root tuple explicitly pins them. |
| 157 | + |
| 158 | +Before the root control plane advances the OpenCode gitlink: |
| 159 | + |
| 160 | +1. Commit OpenCode-owned changes in this repository. |
| 161 | +2. Tag the adapter release when product-version surfaces change. |
| 162 | +3. Push `main` and the numeric tag. |
| 163 | +4. Publish `fullrepo` after agent-only overlays change. |
| 164 | +5. Update the root `config/repositories.json` expected head and version. |
| 165 | +6. Run root tuple, contract, instruction parity, fullrepo, and release gates. |
| 166 | + |
| 167 | +This file is part of the fullrepo overlay. Update it when OpenCode current |
| 168 | +version, pinned commit, install contract, runtime baseline, browser routing, |
| 169 | +permissions, or agent-only workflow rules change. |
| 170 | + |
| 171 | +## Validation Commands |
| 172 | + |
| 173 | +Run these checks after changing OpenCode-owned source: |
| 174 | + |
| 175 | +```bash |
| 176 | +python3 scripts/validate_contract.py |
| 177 | +python3 scripts/validate_opencode_baseline.py |
| 178 | +python3 scripts/validate_opencode_permissions.py |
| 179 | +python3 scripts/validate_opencode_skill_index.py |
| 180 | +python3 scripts/validate_opencode_command_index.py |
| 181 | +python3 scripts/validate_serena_memory_schema.py |
| 182 | +python3 scripts/validate_serena_memory_semantics.py |
| 183 | +``` |
0 commit comments