@@ -5,7 +5,7 @@ OpenCode Remote is a local-first control layer for OpenCode with dual transport
55- WhatsApp (` whatsapp-web.js ` )
66- Telegram (Bot API)
77
8- It routes chat input into a deterministic command model (` @oc ` ) and persists control-plane state in SQLite.
8+ It routes chat input into a deterministic command model (slash commands + natural language ) and persists control-plane state in SQLite.
99
1010Implementation is TypeScript-first (` src/**/*.ts ` , ` tests/**/*.ts ` ) with strict mode enabled and zero explicit ` any ` usage.
1111
@@ -29,7 +29,7 @@ Request flow:
29291 . Transport receives message/update
30302 . App builds a composite dedupe key (` channel:sender:transport_message_id ` )
31313 . Access controller validates allowlist/role
32- 4 . Router parses ` @oc ` prompt or slash command
32+ 4 . Router parses prompt or slash command
33335 . Safety engine enforces guardrails
34346 . Executor calls OpenCode adapter
35357 . Response returns via originating transport
@@ -44,7 +44,60 @@ Request flow:
4444
4545## Quick Start
4646
47- Install from curl (fresh machine):
47+ ### Local (recommended)
48+
49+ Start OpenCode server first (required):
50+
51+ ``` bash
52+ opencode serve --hostname 127.0.0.1 --port 4096
53+ ```
54+
55+ In a second terminal, install and run setup:
56+
57+ ``` bash
58+ npm install
59+ npm run cli -- setup
60+ npm start
61+ ```
62+
63+ ### Docker (lightweight, Telegram-first)
64+
65+ The Docker image is optimized for lightweight operation and disables WhatsApp by default.
66+
67+ 1 ) Start OpenCode server on the host:
68+
69+ ``` bash
70+ opencode serve --hostname 127.0.0.1 --port 4096
71+ ```
72+
73+ 2 ) Configure docker env:
74+
75+ ``` bash
76+ cp .env.docker.example .env
77+ ```
78+
79+ 3 ) Edit ` .env ` with your owner number and Telegram bot token.
80+
81+ 4 ) Start:
82+
83+ ``` bash
84+ docker compose up --build -d
85+ docker compose logs -f remote
86+ ```
87+
88+ Webhook-first production profile:
89+
90+ ``` bash
91+ docker compose -f docker-compose.yml -f docker-compose.webhook.yml up -d --build
92+ ```
93+
94+ Token hygiene:
95+
96+ - If a token is exposed, rotate it in ` @BotFather ` and update ` .env ` .
97+ - Polling with one bot token supports one active consumer.
98+ - Run posture check: ` npm run cli -- security rotate-token-check `
99+
100+ Install from curl (fresh local machine):
48101
49102``` bash
50103curl -fsSL https://raw.githubusercontent.com/Traves-Theberge/opencode-remote/master/scripts/install.sh | bash
@@ -82,6 +135,28 @@ npm start
82135
83136Then pair WhatsApp from QR (if enabled), and message your Telegram bot.
84137
138+ ## Environment Overrides
139+
140+ Config values can be overridden with environment variables using uppercase key names.
141+
142+ Examples:
143+
144+ ``` bash
145+ OPENCODE_SERVER_URL=http://127.0.0.1:4096
146+ WHATSAPP_ENABLED=false
147+ TELEGRAM_ENABLED=true
148+ TELEGRAM_BOT_TOKEN=replace-with-real-token
149+ TELEGRAM_OWNER_USER_ID=123456789
150+ SECURITY_OWNER_NUMBER=+15551234567
151+ STORAGE_DB_PATH=./data/opencode-remote.db
152+ ```
153+
154+ Notes:
155+
156+ - ` TELEGRAM_OWNER_USER_ID ` auto-binds owner access on startup.
157+ - Telegram polling supports one active consumer per bot token. Use a single running instance for a token.
158+ - Set ` SECURITY_REQUIRE_ENV_TOKENS=true ` to force env-only secret loading and reject persisted plaintext token config.
159+
85160## Monorepo Layout
86161
87162- ` apps/daemon/ ` - workspace-native daemon entrypoint
@@ -149,62 +224,68 @@ npx conf set telegram.webhookSecret "<random-secret>"
149224
150225If both are enabled, webhook mode takes precedence and polling is skipped with a warning.
151226
227+ When polling is used, OpenCode Remote reports polling conflict backoff in ` /status ` to make collisions visible.
228+
152229## Security Defaults
153230
154231- Telegram group chats blocked by default (` telegram.allowGroupChats=false ` )
155232- Telegram retry controls are transport-specific:
156233 - ` telegram.messageMaxRetries `
157234 - ` telegram.messageRetryDelayMs `
235+ - Ingress rate limiting enabled with token-bucket controls:
236+ - ` security.ingressPerSenderPerMinute `
237+ - ` security.ingressGlobalPerMinute `
238+ - ` security.ingressBurst `
158239- Dangerous commands require explicit confirmation
159240
160241## Command Model
161242
162- - ` @oc <text>` : pass-through prompt
163- - ` @oc /<command>` : control-plane command
243+ - ` <text> ` : pass-through prompt
244+ - ` /<command> ` : control-plane command
164245
165246Telegram normalization:
166247
167- - Plain text is normalized to ` @oc <text> `
168- - Supported Telegram slash aliases are normalized to shared ` @oc ` commands
248+ - Plain text shorthand is normalized to slash commands where available ( ` status ` , ` help ` , ` runs ` , ` sessions ` , ...)
249+ - Other plain text is treated as prompt input
169250
170251Common commands:
171252
172- - ` @oc /status`
173- - ` @oc /session list`
174- - ` @oc /run <command>`
175- - ` @oc /shell <command>`
176- - ` @oc /runs`
177- - ` @oc /get <runId>`
253+ - ` /status `
254+ - ` /session list `
255+ - ` /run <command> `
256+ - ` /shell <command> `
257+ - ` /runs `
258+ - ` /get <runId> `
178259
179260Advanced control-plane namespaces:
180261
181- - ` @oc /model status`
182- - ` @oc /model list`
183- - ` @oc /model set <providerId> <modelId>`
184- - ` @oc /tools ids`
185- - ` @oc /tools list [providerId] [modelId]`
186- - ` @oc /mcp status`
187- - ` @oc /mcp add <name> <command>`
188- - ` @oc /mcp connect <server>`
189- - ` @oc /mcp disconnect <server>`
190- - ` @oc /skills list`
191- - ` @oc /opencode status`
192- - ` @oc /opencode providers`
193- - ` @oc /opencode commands`
194- - ` @oc /opencode diagnostics`
262+ - ` /model status `
263+ - ` /model list `
264+ - ` /model set <providerId> <modelId> `
265+ - ` /tools ids `
266+ - ` /tools list [providerId] [modelId] `
267+ - ` /mcp status `
268+ - ` /mcp add <name> <command> `
269+ - ` /mcp connect <server> `
270+ - ` /mcp disconnect <server> `
271+ - ` /skills list `
272+ - ` /opencode status `
273+ - ` /opencode providers `
274+ - ` /opencode commands `
275+ - ` /opencode diagnostics `
195276
196277Permission/safety policy matrix is documented in ` docs/COMMAND_MODEL.md ` .
197278
198279Admin commands:
199280
200- - ` @oc /users list`
201- - ` @oc /users add <+number>`
202- - ` @oc /users remove <+number>`
203- - ` @oc /users bindtg <telegramUserId> <+number> [username]`
204- - ` @oc /users unbindtg <telegramUserId>`
205- - ` @oc /users tglist`
206- - ` @oc /lock`
207- - ` @oc /unlock`
281+ - ` /users list `
282+ - ` /users add <+number> `
283+ - ` /users remove <+number> `
284+ - ` /users bindtg <telegramUserId> <+number> [username] `
285+ - ` /users unbindtg <telegramUserId> `
286+ - ` /users tglist `
287+ - ` /lock `
288+ - ` /unlock `
208289
209290## Data and Reliability
210291
@@ -260,3 +341,4 @@ npm run verify
260341- ` docs/OPERATIONS.md `
261342- ` docs/ONBOARDING.md `
262343- ` CHANGELOG.md `
344+ - ` TOFIX.md `
0 commit comments