omp-superagent 0.1.8 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/DESIGN.md +16 -8
  2. package/README.ko.md +28 -374
  3. package/README.md +30 -421
  4. package/THIRD_PARTY_NOTICES.md +8 -8
  5. package/config.example.json +7 -0
  6. package/docs/OPERATIONS.en.md +2223 -0
  7. package/docs/OPERATIONS.md +164 -23
  8. package/docs/design/execution.md +164 -18
  9. package/docs/design/messaging.md +78 -17
  10. package/docs/kakao-bridge-protocol.md +193 -0
  11. package/docs/releases/0.1.10.md +17 -0
  12. package/docs/releases/0.1.9.md +18 -0
  13. package/gateway/bin/omp-gateway-darwin-arm64 +0 -0
  14. package/gateway/bin/omp-gateway-darwin-x64 +0 -0
  15. package/gateway/bin/omp-gateway-linux-arm64 +0 -0
  16. package/gateway/bin/omp-gateway-linux-x64 +0 -0
  17. package/host-owner/bin/notices/darwin-arm64/Cargo-LICENSES.txt +2 -0
  18. package/host-owner/bin/notices/darwin-arm64/Cargo-SOURCES.txt +2 -0
  19. package/host-owner/bin/notices/darwin-arm64/crates/bitflags-2.13.2/LICENSE-APACHE +201 -0
  20. package/host-owner/bin/notices/darwin-arm64/crates/bitflags-2.13.2/LICENSE-MIT +25 -0
  21. package/host-owner/bin/notices/darwin-arm64/crates/rustix-1.1.6/COPYRIGHT +29 -0
  22. package/host-owner/bin/notices/darwin-arm64/crates/rustix-1.1.6/LICENSE-APACHE +201 -0
  23. package/host-owner/bin/notices/darwin-arm64/crates/rustix-1.1.6/LICENSE-Apache-2.0_WITH_LLVM-exception +220 -0
  24. package/host-owner/bin/notices/darwin-arm64/crates/rustix-1.1.6/LICENSE-MIT +23 -0
  25. package/host-owner/bin/notices/darwin-x64/Cargo-LICENSES.txt +2 -0
  26. package/host-owner/bin/notices/darwin-x64/Cargo-SOURCES.txt +2 -0
  27. package/host-owner/bin/notices/darwin-x64/crates/bitflags-2.13.2/LICENSE-APACHE +201 -0
  28. package/host-owner/bin/notices/darwin-x64/crates/bitflags-2.13.2/LICENSE-MIT +25 -0
  29. package/host-owner/bin/notices/darwin-x64/crates/rustix-1.1.6/COPYRIGHT +29 -0
  30. package/host-owner/bin/notices/darwin-x64/crates/rustix-1.1.6/LICENSE-APACHE +201 -0
  31. package/host-owner/bin/notices/darwin-x64/crates/rustix-1.1.6/LICENSE-Apache-2.0_WITH_LLVM-exception +220 -0
  32. package/host-owner/bin/notices/darwin-x64/crates/rustix-1.1.6/LICENSE-MIT +23 -0
  33. package/host-owner/bin/notices/linux-arm64/Cargo-LICENSES.txt +3 -0
  34. package/host-owner/bin/notices/linux-arm64/Cargo-SOURCES.txt +3 -0
  35. package/host-owner/bin/notices/linux-arm64/crates/bitflags-2.13.2/LICENSE-APACHE +201 -0
  36. package/host-owner/bin/notices/linux-arm64/crates/bitflags-2.13.2/LICENSE-MIT +25 -0
  37. package/host-owner/bin/notices/linux-arm64/crates/linux-raw-sys-0.12.1/COPYRIGHT +29 -0
  38. package/host-owner/bin/notices/linux-arm64/crates/linux-raw-sys-0.12.1/LICENSE-APACHE +201 -0
  39. package/host-owner/bin/notices/linux-arm64/crates/linux-raw-sys-0.12.1/LICENSE-Apache-2.0_WITH_LLVM-exception +220 -0
  40. package/host-owner/bin/notices/linux-arm64/crates/linux-raw-sys-0.12.1/LICENSE-MIT +23 -0
  41. package/host-owner/bin/notices/linux-arm64/crates/rustix-1.1.6/COPYRIGHT +29 -0
  42. package/host-owner/bin/notices/linux-arm64/crates/rustix-1.1.6/LICENSE-APACHE +201 -0
  43. package/host-owner/bin/notices/linux-arm64/crates/rustix-1.1.6/LICENSE-Apache-2.0_WITH_LLVM-exception +220 -0
  44. package/host-owner/bin/notices/linux-arm64/crates/rustix-1.1.6/LICENSE-MIT +23 -0
  45. package/host-owner/bin/notices/linux-x64/Cargo-LICENSES.txt +3 -0
  46. package/host-owner/bin/notices/linux-x64/Cargo-SOURCES.txt +3 -0
  47. package/host-owner/bin/notices/linux-x64/crates/bitflags-2.13.2/LICENSE-APACHE +201 -0
  48. package/host-owner/bin/notices/linux-x64/crates/bitflags-2.13.2/LICENSE-MIT +25 -0
  49. package/host-owner/bin/notices/linux-x64/crates/linux-raw-sys-0.12.1/COPYRIGHT +29 -0
  50. package/host-owner/bin/notices/linux-x64/crates/linux-raw-sys-0.12.1/LICENSE-APACHE +201 -0
  51. package/host-owner/bin/notices/linux-x64/crates/linux-raw-sys-0.12.1/LICENSE-Apache-2.0_WITH_LLVM-exception +220 -0
  52. package/host-owner/bin/notices/linux-x64/crates/linux-raw-sys-0.12.1/LICENSE-MIT +23 -0
  53. package/host-owner/bin/notices/linux-x64/crates/rustix-1.1.6/COPYRIGHT +29 -0
  54. package/host-owner/bin/notices/linux-x64/crates/rustix-1.1.6/LICENSE-APACHE +201 -0
  55. package/host-owner/bin/notices/linux-x64/crates/rustix-1.1.6/LICENSE-Apache-2.0_WITH_LLVM-exception +220 -0
  56. package/host-owner/bin/notices/linux-x64/crates/rustix-1.1.6/LICENSE-MIT +23 -0
  57. package/host-owner/bin/omp-host-owner-darwin-arm64 +0 -0
  58. package/host-owner/bin/omp-host-owner-darwin-x64 +0 -0
  59. package/host-owner/bin/omp-host-owner-linux-arm64 +0 -0
  60. package/host-owner/bin/omp-host-owner-linux-x64 +0 -0
  61. package/package.json +10 -8
  62. package/skills/head/SKILL.md +28 -14
  63. package/skills/head/references/routing.md +23 -17
  64. package/skills/head/references/supervision.md +22 -1
  65. package/skills/lane/SKILL.md +11 -0
  66. package/skills/lane/references/workflow.md +17 -8
  67. package/src/cli.ts +6 -4
  68. package/src/config.ts +44 -3
  69. package/src/contracts.ts +101 -8
  70. package/src/discord-command-registration.ts +34 -186
  71. package/src/extension.ts +44 -6
  72. package/src/gateway-client.ts +11 -59
  73. package/src/gateway-protocol.ts +35 -1
  74. package/src/head-recovery.ts +226 -17
  75. package/src/host-extension.ts +132 -17
  76. package/src/host-protocol.ts +6 -9
  77. package/src/host-reply-voice.ts +181 -0
  78. package/src/lane-extension.ts +46 -8
  79. package/src/lane-models.ts +8 -0
  80. package/src/lane-report.ts +22 -0
  81. package/src/managed-ulw-probe.ts +22 -20
  82. package/src/message-order.ts +2 -1
  83. package/src/messenger-command-catalog.json +6 -3
  84. package/src/messenger-commands.ts +9 -2
  85. package/src/operator.ts +77 -0
  86. package/src/pr-github-schema.ts +2 -0
  87. package/src/pr-intake-automation.ts +1 -2
  88. package/src/pr-intake-comment.ts +1 -2
  89. package/src/pr-intake-fix.ts +1 -2
  90. package/src/pr-intake-github.ts +1 -2
  91. package/src/pr-intake-material.ts +1 -2
  92. package/src/pr-intake-tree.ts +1 -2
  93. package/src/pr-review-models.ts +28 -0
  94. package/src/result-attachment.ts +60 -79
  95. package/src/runtime.ts +1862 -298
  96. package/src/setup-profiles.ts +26 -65
  97. package/src/setup.ts +2 -1
  98. package/src/slack-command-registration.ts +48 -197
  99. package/src/soul.ts +214 -0
  100. package/src/store.ts +643 -55
  101. package/src/superkit-skills.ts +22 -0
  102. package/src/telegram-command-languages.json +17 -0
  103. package/src/telegram-command-registration.ts +32 -134
  104. package/src/worker-bridge.ts +21 -0
  105. package/src/worker-enrollment.ts +2 -1
  106. package/src/worker-host.ts +0 -24
  107. package/src/worker-serve-prepare.ts +19 -0
  108. package/src/worker-service.ts +51 -47
  109. package/scripts/ci.ts +0 -44
  110. package/scripts/release.ts +0 -112
  111. package/scripts/test-omp.sh +0 -44
  112. package/src/discord-commands.ts +0 -29
  113. package/src/discord-markdown.ts +0 -399
  114. package/src/slack-commands.ts +0 -18
  115. package/src/telegram-signal.ts +0 -14
  116. package/src/worker-stdio.ts +0 -61
@@ -0,0 +1,2223 @@
1
+ # Operations and Installation Guide
2
+
3
+ [Back to the project overview](../README.md) · [Korean guide](OPERATIONS.md) ·
4
+ [Design](../DESIGN.md) · [Example configuration](../config.example.json) ·
5
+ [Attribution and license notices](../THIRD_PARTY_NOTICES.md)
6
+
7
+ [Install](#1-local-preparation--does-not-start-the-bot) · [Platform apps](#2-platform-apps-and-access) · [Configuration](#3-configuration) · [Daily use](#4-commands-and-daily-use) · [Recovery](#5-operational-scope-and-recovery-constraints) · [Developer verification](#6-developer-verification)
8
+
9
+ This guide covers installation, configuration, day-to-day operation, and recovery. Unless
10
+ otherwise noted, file and code paths and shell commands are relative to the **repository root**.
11
+ For an npm installation, run the same management commands with `omp-sa` instead of
12
+ `bun --no-env-file src/cli.ts` and keep the configuration file in your own working directory.
13
+ See the [design](../DESIGN.md) for the current architecture and authority contract. Verification
14
+ results in the [release records](releases/) apply only to the listed version, baseline, and scope.
15
+
16
+ The Gateway owns messenger connections and the lifecycle of the designated OMP head. The head
17
+ controller accepts and routes operator input. The shared HEAD model handles ordinary requests
18
+ that are not bound to a lane. Ordinary work in a bound topic continues in its lane session, and
19
+ replies are delivered without another turn of the shared model. Control commands and restricted
20
+ groups follow separate routes. All configured platforms connect concurrently, and their owners
21
+ must represent the **same trusted operator**. The main context is shared, but platform, account,
22
+ conversation, and topic identities stay separate. This is neither a multi-tenant setup nor an OS
23
+ security sandbox. Attaching a native TUI or herdr to the same managed RPC Host process is not
24
+ supported.
25
+
26
+ Optional [Discord real-time voice chat](discord-voice.md) (Korean guide) handles ordinary conversation in a
27
+ separate OpenAI Live session. If started with `/voice start work`, spoken work requests can be
28
+ posted as drafts in the designated text channel. For a draft to be accepted as an ordinary text
29
+ request, the owner must reply to it with `/voice confirm`. Results are delivered only as Discord
30
+ text.
31
+
32
+ ### Lane Management Tools and Operator Skills
33
+
34
+ Only the head can use `lane_models`, `lane_init_presets`, `lane_start`, `lane_set_model`,
35
+ `lane_inspect`, `lane_message`, `lane_pause`, `lane_resume`, `lane_close`,
36
+ `thread_inspect`, `lane_thread_update`, `messenger_presence`, `lane_watch`, `pr_watch`, `pr_watch_list`,
37
+ `discord_context`, `discord_purpose_list`, `discord_purpose_set`, `discord_purpose_clear`,
38
+ `decision_list`, `decision_inspect`, and `decision_withdraw`.
39
+ `decision_ask` is available to HEAD and root lanes, but not to native children.
40
+ Use `lane_inspect({})` to list lanes. Lanes do not receive management authority, and
41
+ native children receive neither management nor board access. Do not install these extensions
42
+ globally in ordinary OMP. See the [management tool contract](design/execution.md#management-tools)
43
+ for tool arguments and role boundaries.
44
+
45
+ - `skill://superagent-head`: Routing, model selection, and supervision. Only the role
46
+ instructions from `SKILL.md` are injected into the root head; read detailed references from
47
+ the package path when needed. Changes to the role file take effect after the Host restarts.
48
+ - `skill://superagent-lane`: Direct work within scope, bounded delegation, verification, and
49
+ reporting. Read the detailed workflow as needed.
50
+ - Native discovery resolves these URIs regardless of the current working directory. It does
51
+ not overwrite user or project skills. Do not use `--no-skills` in this URI-based workflow.
52
+
53
+ ### Online Presence and Work Watches
54
+
55
+ | Example operator request | Behavior |
56
+ | --- | --- |
57
+ | `Keep the Discord bot online` / `Show online status` / `Turn off online presence` | Maintain or query the current Discord bot's online presence, or set it to `invisible`. Does not track other users or accounts. |
58
+ | `Watch this lane` / `Show my watches` / `Stop watching this lane` | Observe the selected lane's recorded progress, reasons it stops, and termination from the original conversation. Turning off notifications does not pause the lane or cancel work. |
59
+ | `Tell me when CI passes on owner/repo#35` | Register a PR watch as described below. HEAD checks the registration result before replying. |
60
+
61
+ If the target is unclear, provide a lane name or PR URL. HEAD handles unambiguous watch
62
+ requests even in a bound conversation; ordinary work and quoted text are treated as before.
63
+ Use `/head` if you need to route the request explicitly. Registrations do not automatically
64
+ move to another conversation. The existing Gateway and HEAD must be running; no extra bot or
65
+ token is needed. A configured status without an actual connection does not mean the bot
66
+ appears online in the messenger.
67
+
68
+ Discord's online or invisible setting is applied when the same Gateway reconnects. Status
69
+ queries distinguish the **configured value, current connection, and last value written to
70
+ the current socket**. They do not prove what users see, whether HEAD is ready, or whether a
71
+ lane is running. The default behavior before startup is unchanged, and becoming invisible
72
+ does not turn off message reception. Manage the online presence of Slack Socket Mode bots
73
+ in the [Slack app settings](https://docs.slack.dev/apis/web-api/user-presence-and-status/#events-api-bots).
74
+ The Telegram Bot API does not support online presence. Do not use user tokens or cookies
75
+ to get around either platform's limits.
76
+
77
+ ### PR Follow-up Tracking
78
+
79
+ Give the head a PR URL and ask it to track the PR. `pr_watch` takes `action: "track"`,
80
+ `ref` (a GitHub PR URL or `owner/repo#number`), the actual original `sourceId`, and an optional
81
+ `intervalSeconds` (defaults to five minutes). `laneId` associates the watch with an existing
82
+ lane for reference, and `ignoreAuthors` lists GitHub logins to exclude from notifications.
83
+ For example, you can request a check for review and CI changes every 300 seconds. Watches
84
+ are not registered automatically.
85
+
86
+ Use `pr_watch_list({sourceId, ref?})` to inspect this conversation's watches, baselines,
87
+ latest observations, next check times, errors, and holds. Use
88
+ `pr_watch({action: "untrack", ref, sourceId})` to stop tracking. These are native HEAD tools,
89
+ not messenger slash commands or shell commands.
90
+
91
+ - A separately installed `gh` must be on the HEAD environment's PATH and have read
92
+ authentication for `github.com`. The watch uses existing `gh` authentication; it does not
93
+ store its own tokens or perform login. Enterprise hosts are not supported.
94
+ - The first successful query only saves a baseline. Subsequent observations deliver new
95
+ reviews and comments, review status changes, CI passes, failures and repeat failures for
96
+ the current PR head, external or unknown changes to the PR head, and PR closures,
97
+ reopenings, and merges as HEAD inputs in the original registration conversation. Reports
98
+ distinguish a result with an actual successful check and some skipped or neutral checks.
99
+ No checks or all-skipped checks do not count as a pass. Passing CI does not guarantee the
100
+ PR is mergeable. The authenticated user's own comments, pushes made only by that user,
101
+ and already observed items do not generate repeat notifications.
102
+ - Ordinary code in the HEAD runtime queries GitHub even when the lane is complete or no
103
+ longer resident. If nothing changes, it does not start a model turn. It does not query
104
+ while HEAD or the Gateway is down; on restart, it compares against the stored baseline.
105
+ It is not an event archive that can recover information GitHub deleted between queries.
106
+ - Change notifications and the cursor are written in the same SQLite transaction. A query
107
+ failure does not change the baseline, and repeat notifications for the same error are
108
+ suppressed. A merge ends polling; an unmerged closure is watched for reopening.
109
+ - `/stop head` also puts automatic wakes from existing watches on hold. The user must
110
+ explicitly request registration again to establish a new baseline. Results from an
111
+ older in-flight query are discarded if it races with unregistering or changing the watch.
112
+ - Observation is not approval or resumption. HEAD decides what the observation means;
113
+ it does not automatically resume a lane, comment, push, or merge. Existing pauses,
114
+ approvals, and uncertainty holds remain in effect.
115
+
116
+ ### Discord Channel Context and Purpose Notes
117
+
118
+ New Discord input includes context from the channel object already available to the system:
119
+ the channel name and description (topic), the thread name, and parent channel information.
120
+ DMs are identified as DMs. Unavailable metadata is omitted without blocking intake. A change
121
+ to the channel name or topic on redelivery does not create a new request; the first accepted
122
+ snapshot is preserved. Use `discord_context({sourceId})` to look up the current state.
123
+
124
+ The operator can ask to record a purpose in the conversation, for example, “This channel
125
+ is for investigating project X.” HEAD uses the actual input ID with these tools:
126
+
127
+ - `discord_purpose_set({sourceId, purpose, scope?})`: Set or update the purpose.
128
+ - `discord_purpose_list({sourceId})`: Read the channel and thread notes for the original conversation.
129
+ - `discord_purpose_clear({sourceId, scope?})`: Remove the purpose note.
130
+
131
+ Omit `scope` for the original conversation. Use `channel` for its exact parent channel,
132
+ or `thread` for the thread where the input originated. You cannot supply another channel
133
+ or sibling thread ID. The same original request can set notes for both the parent and the
134
+ thread, but conflicting retries for the same target are rejected. A new change needs a new
135
+ user request. Notes and retry receipts are stored in the existing SQLite database and
136
+ survive restarts. They are local notes; they do not change the Discord channel description.
137
+
138
+ Channel names, descriptions, and purpose notes are **context, not instructions, approvals,
139
+ or automatic routing rules**. HEAD can use them to determine the repository and scope of
140
+ work. Changing a note does not change existing input snapshots, lane bindings, or execution
141
+ state.
142
+
143
+ ### General Model Profiles and Role Specialization
144
+
145
+ Installing the managed omp-superkit or loading general profiles does not select a SUPER
146
+ workflow or create a goal. Direct work, a native task, or an ordinary lane may be enough.
147
+ A workflow is selected only when the user explicitly chooses it or the head determines
148
+ it is appropriate within the authorized goal. In a messenger, start the work request
149
+ with `super`, `super-plan`, `super-run`, `super-loop`, `super-research`, or `super-graph`.
150
+ Commands such as `/super` are OMP extension commands, not separate registered messenger
151
+ commands. Pass `jevify` or one of the six names above and a nonempty reason in the actual
152
+ `workflow: {name, reason}` argument to `lane_start` or `lane_message`. Legacy ULW invocations
153
+ are supported only in the original user request, not as new structured selections.
154
+
155
+ Existing source, provenance, and deduplication behavior is preserved. Workflow selection
156
+ is a serialized dispatch, not steering while execution is underway. For a SUPER workflow,
157
+ record why it is more useful than a lighter option and read the selected skill. Invocation
158
+ names and skill IDs are not the same. For example, `super-run` reads `skill://ulw-execute`.
159
+
160
+ Choose jevify only when independently applying a fixed rubric to a sufficiently large,
161
+ homogeneous set reduces reading or context costs. There is no fixed cutoff by count or
162
+ difficulty. Use deterministic processing for exact rules, direct reading for small batches,
163
+ contextual investigation for reasoning across items, and tests or runtime checks for actual
164
+ verification. If asked only to plan, do not implement. Do not bypass native approval,
165
+ artifact review, cost and scope limits, pause or cancel, or uncertainty holds.
166
+ See the [workflow contract](design/execution.md#workflow-selection) for selection by
167
+ method, structured handoffs, exact skill IDs, native mode mappings, and the upstream baseline
168
+ revision.
169
+
170
+ For a user to select jevify, the original input must begin with the standalone lowercase
171
+ word `jevify` in prose. `/jevify`, uppercase, quoted text, code, paths, negation, and later
172
+ mentions do not count. The head can use the structured selection field even when the
173
+ original input contains no invocation. The runtime's `workflowPrompt` prefixes the
174
+ lowercase native keyword `jevify` outside the fenced context and does not query SUPER
175
+ extension-command capabilities. The lane follows the actual OMP jevify notice and the
176
+ judge guidance indicated by `eval` (`help://eval/judge` in OMP 19.1). Whether the notice
177
+ activates depends on native `magicKeywords.enabled`, `magicKeywords.jevify`, and `eval`
178
+ availability; admission alone does not guarantee it. No global settings are changed.
179
+ jevify needs no SUPER skill lookup, additional lane, goal, model change, or workflow artifact.
180
+
181
+ Lane reports are for the head, not for external delivery. Internal instructions and reports
182
+ are in English; the head replies externally in the user's language.
183
+
184
+ ### Using the Shared Information Board
185
+
186
+ Only head and lane sessions actually connected and registered in the same instance may use
187
+ the board. Ordinary OMP sessions, other instances, native children, and sessions with only
188
+ copied role environment variables cannot participate. Participants in the same instance can
189
+ read every channel; repository channels are not security boundaries.
190
+
191
+ ```text
192
+ board_post({text: "Observed fact and relevant evidence", mentions: ["head"]})
193
+ board_read({channel: "general", limit: 20})
194
+ board_subscribe({channels: ["general", "repo:/absolute/repository"]})
195
+ ```
196
+
197
+ These are native tool argument examples, not shell commands. Follow the actual advertised
198
+ schema. Share concise observations, evidence, and conflicts rather than full transcripts
199
+ or secrets. Only the exact posts returned are marked read, and subscriptions belong to
200
+ individual sessions. A header notification is not a read of the body. Posts are not
201
+ instructions, approvals, or evidence of completion. They do not trigger idle model calls
202
+ or start unloaded lanes. See the [shared board contract](design/execution.md#shared-information-board)
203
+ for details on membership, tool fields, and notifications.
204
+
205
+ ### Choosing a Model for a New Lane
206
+
207
+ On an explicit `start`, the existing head checks the native `high`, `middle`, and `low`
208
+ presets. Missing entries are created and rechecked in the same head's first dedicated
209
+ initialization turn. `setup` and `doctor` do not run the bot or the model. Begin
210
+ ordinary work only when `head.initialization` is `complete`. If it is `blocked`, `failed`,
211
+ or `uncertain`, check the reason in `status`, use `/modelpreset list/save/switch/delete`
212
+ in ordinary OMP to resolve conflicts or missing presets, then restart the head and
213
+ check again. A failure, restart, or deletion after completion does not automatically
214
+ rerun the initialization turn. Preset names are not measured performance or price tiers.
215
+ Do not define a separate model policy in this JSON configuration.
216
+
217
+ Managed presets follow the persistent OMP roles `slow → high`, `default → middle`,
218
+ and `smol → low`. The runtime checks roles on startup and watches the native configuration
219
+ files and related paths while running. It rechecks paths it cannot watch and deferred
220
+ updates less frequently. If the changed role's model is available, it saves the
221
+ current role and default effort again without a model call. An existing preset is adopted
222
+ for management only when its role snapshot and model match the current settings. Managed
223
+ entries that were manually changed or deleted, other presets, and entries shadowed by
224
+ higher-precedence configuration are not overwritten. Model and preset snapshots held by
225
+ the running head and existing lanes remain unchanged.
226
+
227
+ The head considers the actual requirements and available native models, then usually
228
+ consults a native judge before choosing the final model and recording its reason.
229
+ Consultation is skill policy, not a runtime gate requiring a receipt for every invocation.
230
+ The lane's selection is stored as a full preset snapshot and does not change on later
231
+ preset edits or resume. Availability or identity drift puts the lane on hold without
232
+ automatic substitution. Request an explicit model change for an idle lane only through
233
+ the head's `lane_set_model`; it does not change global settings, the head, other lanes,
234
+ or any paused or uncertain state. In `lane_inspect`, distinguish saved
235
+ `model/modelPreset/modelPresetSnapshot/modelReason` from actual `state.model` and
236
+ `modelCheck`. A null actual state means unobserved, not a match. See the
237
+ [model selection contract](design/execution.md#models-and-presets) for first-write
238
+ exceptions, judge limits, model adoption, and the private overlay contract.
239
+
240
+ ## 1. Local Preparation — Does Not Start the Bot
241
+
242
+ The current source uses Git, **Bun >= 1.4.4** (`packageManager: bun@1.4.4`), and a local
243
+ Unix socket. You can install the package without OMP. Running the Host requires a separately
244
+ installed stock OMP. Rather than gating by version number, the Host checks interfaces for
245
+ `rpc-ui`, session resumption, extensions, model selection, and process observation. OMP 18
246
+ is subject to manual compatibility checks; the automated CI SDK baseline is
247
+ [OMP 19.1.1](https://github.com/can1357/oh-my-pi/commit/31ffee513f27a01bba7d4dfbe12bae239cdc646a).
248
+ `doctor` reports the executable path selected by `command`, its version, and the service
249
+ backend. It does not guarantee login or runtime compatibility. The Host performs actual RPC
250
+ initialization and ownership checks.
251
+
252
+ Before upgrading from 18 to 19, check the background services owned by the existing Host.
253
+ OMP 19's per-user daemon does not take over services from the previous broker. An empty list
254
+ in the new daemon is not evidence that you may stop or reclaim work whose completion was
255
+ never confirmed in the old session.
256
+
257
+ The default `command: ["omp"]` looks up OMP on PATH. To use a different installation, put
258
+ its OMP path in the first entry of `command`. A relative path is resolved against the
259
+ configuration file's directory, and all lanes use the same path. This repository does not
260
+ download OMP or build it from source.
261
+
262
+ ```sh
263
+ bun add --global --trust omp-superagent@0.1.10
264
+ omp-sa --help
265
+ ```
266
+
267
+ `--trust` allows package installation scripts, including preparation of the managed
268
+ omp-superkit. Add the output of `bun pm bin --global` to PATH. If Bun is on PATH, you can
269
+ also use `npm install --global omp-superagent@0.1.10`. Create the configuration in your
270
+ own working directory, not the installation directory, with
271
+ `omp-sa setup --config ./config.local.json`. Installation alone does not activate the bot.
272
+
273
+ The published npm package includes the Gateway and Host relay executables for its target
274
+ platform. For a source checkout or a GitHub source tarball, have stable Rust and Cargo,
275
+ CMake, and a C compiler ready, then run the following from the repository root. Cargo builds
276
+ the two executables using their respective `Cargo.lock` files; it does not build OMP.
277
+ After editing Rust source, run `bun run build:native` to rebuild them.
278
+
279
+ ```sh
280
+ bun install --frozen-lockfile
281
+ ```
282
+
283
+ Installation does not run OMP. `setup`, `doctor`, and actual Host startup check the selected
284
+ CLI. The root SDK dependencies are the published `@oh-my-pi/pi-coding-agent`,
285
+ `@oh-my-pi/pi-ai`, `@oh-my-pi/pi-catalog`, `@oh-my-pi/pi-natives`, `@oh-my-pi/pi-tui`,
286
+ and `@oh-my-pi/pi-utils`, all pinned to the same baseline. Installation does not start
287
+ the bot or replace an existing OMP executable or global settings.
288
+
289
+ To avoid changing the system Bun, you can use an isolated local copy. Point the following
290
+ `bun` commands and any Bun path in the configuration at that copy.
291
+
292
+ ```sh
293
+ npm install --prefix .upstream/toolchain --no-save bun@1.4.4
294
+ export PATH="$PWD/.upstream/toolchain/node_modules/.bin:$PATH"
295
+ ```
296
+
297
+ This changes PATH only in the current shell. No global installation, replacement of the
298
+ existing OMP, or automatic startup registration is required. Configure model provider
299
+ authentication separately as you would in OMP. This project does not replace its
300
+ authentication engine.
301
+
302
+ ### Required Managed omp-superkit Installation and Updates
303
+
304
+ Installation always includes the official [dbc-hbin/omp-superkit](https://github.com/dbc-hbin/omp-superkit).
305
+ The root `bun install` postinstall prepares the managed package. Activation checks use
306
+ actual prompt composition from the published native SDK. For the current layout, the
307
+ checks verify the instructions and pointers for `skill://super` and `skill://super-*`
308
+ and verify that the older skill IDs resolve as aliases. Valid installations in the
309
+ previous layout still work. To prepare only omp-superkit again, run:
310
+
311
+ ```sh
312
+ bun run prepare:ulw
313
+ ```
314
+
315
+ `upstream/ulw.json` specifies the official remote and `checkIntervalMs: 3600000` (one hour).
316
+ Installation checks the remote's **default branch HEAD**. A production Gateway needs a
317
+ valid active installation before startup. Once it confirms that, it starts IPC and the
318
+ head first, checks the remote in the background, and then checks hourly for new commits
319
+ to prepare and activate. A slow or unreachable upstream does not delay startup if the
320
+ Gateway already has a valid active installation. Ordinary code checks for updates; this
321
+ is not a model watchdog, does not run a work lane, and does not authorize messenger bot
322
+ login. Git and dependency downloads need network access. The process does not modify the
323
+ user's omp-superkit checkout, global OMP installation or configuration, or shared prompt
324
+ sources.
325
+
326
+ Only an immutable revision that passes preparation and the offline composition probe is
327
+ activated, and activation is atomic. Once a revision is active, only fast-forwards from
328
+ the same remote are allowed. The same check applies to the official `omp-ulw` →
329
+ `omp-superkit` rename. Failures, rewinds, and divergence leave the previous revision active.
330
+ See the [design](design/execution.md#managed-omp-superkit-integration) for the lock, staging,
331
+ and probe contracts. Do not bypass them by manually editing the managed pointer or lock.
332
+ If there is no valid active revision, `start` fails before activating adapters. Recover
333
+ first with `bun run prepare:ulw`. `doctor` does not check remote freshness or whether
334
+ loading succeeds. Older revisions are not deleted automatically.
335
+
336
+ To check installation status without network access, run:
337
+
338
+ ```sh
339
+ bun run prepare:ulw -- --status
340
+ ```
341
+
342
+ The Gateway status response's `ulw` fields distinguish `revision`, `packagePath`,
343
+ `upstreamRevision`, `checkedAt`, `error`, and `updating`. `injected` appears only for test
344
+ injection. `revision` and `packagePath` identify the **active package the next new Host
345
+ will use**, not the version of every running Host. `upstreamRevision` is the last observed
346
+ remote result; read it alongside `checkedAt`, `error`, and `updating`. A failed or
347
+ unperformed remote check does not show as a confirmed match with the latest version.
348
+ In `omp-sa status --config FILE`, `gateway.head.loadedSuperkitPath` is the package path
349
+ verified when the connected head's actual OMP session started. If it differs from
350
+ `gateway.ulw.packagePath`, the head is still using the older version.
351
+
352
+ Each new head and lane starts only if the session's active list contains every extension
353
+ module in the manifest. Having the files is not enough: an import or initialization
354
+ failure, or an inactive module, prevents readiness. Do not reconnect to an existing Host
355
+ for work if it cannot verify the modules it loaded. Check any running work, shut down
356
+ gracefully, and start again. Installation and checks do not change ordinary OMP's global
357
+ settings.
358
+
359
+ **The revision of a running Host may differ from the revision of the next Host.** Running
360
+ head and lane sessions keep the exact package path they loaded. An update does not restart
361
+ them or hot-reload the package. Each new Host resolves the active package at the time it
362
+ starts. A long-running head that later starts a new lane does not force that lane to inherit
363
+ the head's older package path. Reconnecting an existing Host's control connection does not
364
+ apply a new revision. Successful installation or updating is separate from verifying native
365
+ workflow selection, mode activation, goal creation, and actual model responses.
366
+
367
+ ## 2. Platform Apps and Access
368
+
369
+ Set up only the platforms you intend to use. Pass tokens to adapters **only through
370
+ environment variables**, never in ordinary JSON configuration, command-line arguments, or
371
+ Git-tracked files. You can save the settings below in a separate owner-only environment
372
+ file. For `tokenEnv`, `botTokenEnv`, and `appTokenEnv`, use the environment variable name,
373
+ not the token itself.
374
+
375
+ ### 2.1 Discord
376
+
377
+ 1. Create an application and bot in the [Discord Developer Portal](https://discord.com/developers/applications).
378
+ In the bot settings, enable **Privileged Gateway Intents → Message Content Intent**.
379
+ Reading server message content requires both the intent request in code and the portal setting.
380
+ 2. Invite the bot to the server with the `bot` and `applications.commands` scopes. Grant
381
+ View Channel, Read Message History, Send Messages, Send Messages in Threads,
382
+ Create Public Threads, Attach Files, and Add Reactions in the required channels.
383
+ Optionally grant Embed Links to display cards. If that permission is missing or cannot
384
+ be verified, cards are sent as code blocks. The bot must actually have access to private
385
+ threads and similar restricted surfaces. Administrator permission is not required.
386
+ 3. Use Discord Developer Mode to copy the owner's **user ID**, the server ID, and the
387
+ allowed **parent channel IDs**. Configure numeric ID strings, not names or mention strings.
388
+ 4. Only the `ownerId` can send input and approve on the ordinary operator route. Bot and
389
+ webhook input is rejected. To give other users limited access, use the separate
390
+ [`groupRooms` rules](#group-chat-and-server-access-separation). Server input must pass
391
+ **both** `allowedGuildIds` and `allowedChannelIds`. Threads follow the parent channel
392
+ allowlist. An empty array blocks server input; it does not allow all servers. The owner's
393
+ 1:1 DM is separate from the server allowlists. Group DMs are out of scope.
394
+ 5. If the channel is shared with other bots or you want to exclude the owner's casual
395
+ conversation, set `discord.requireAddressing` to `true` in the configuration file.
396
+ The default is `false`; changes take effect on the next Gateway start. If it is running,
397
+ use `omp-sa stop main --config FILE` and confirm a graceful shutdown before running
398
+ `omp-sa start --config FILE`. In an allowed server's parent channel, an ordinary message
399
+ from the owner is accepted only if it **actually mentions this bot** or **replies to a
400
+ message this bot sent in the same channel**. Typing the bot's name or mentioning a
401
+ different bot does not count. The same criteria apply to edits and messages fetched
402
+ during connection recovery. In an allowed thread created by this bot, conversation can
403
+ continue without mentions or replies. In a thread created by another bot or person,
404
+ mention this bot or reply to one of its messages, just as in the parent channel.
405
+ Owner 1:1 DMs, Discord app commands, approval buttons, and restricted `groupRooms`
406
+ rules are unchanged. Real-time `/voice` controls in the designated text channel follow
407
+ the [voice chat rules](discord-voice.md#사용).
408
+
409
+ ```sh
410
+ read -r -s DISCORD_BOT_TOKEN
411
+ export DISCORD_BOT_TOKEN
412
+ ```
413
+
414
+ This Bash example reads the token without exposing it on screen or in shell history.
415
+ Processes run with the current user's permissions and environment. Lanes and worktrees
416
+ are not security sandboxes.
417
+
418
+ Register Discord autocomplete commands explicitly. Before registration, both the Gateway
419
+ and HEAD must be running the new version. Replacing only the Gateway may reconnect it to
420
+ an old HEAD. Send `/help` in Discord and check that `/usage-reset` is listed. If it is
421
+ not, do not register commands; finish updating HEAD first. Do not kill a busy HEAD.
422
+
423
+ ```sh
424
+ bun --no-env-file src/cli.ts discord-commands --config config.local.json
425
+ bun --no-env-file src/cli.ts discord-commands --config config.local.json --apply
426
+ ```
427
+
428
+ The first command previews changes without writing. `--apply` **replaces this bot's entire
429
+ global command list**; use it only with a dedicated Superagent app. It removes Hermes-only
430
+ commands and registers the [shared commands (including `/head`) and Discord-only `/usage-reset`](../src/messenger-command-catalog.json).
431
+ If separate guild commands shadow global commands, registration reports the conflict
432
+ rather than silently deleting them. Registration does not start the model or open a
433
+ messenger connection, and is not a side effect of `setup`, `doctor`, or `start`.
434
+ Commands that take arguments use an optional `text` field. For example, enter `preset high`
435
+ in `/model`'s `text` field and `head` in `/stop`'s `text` field. `/status` also works as
436
+ an ordinary message. In a parent channel with `discord.requireAddressing` enabled, mention
437
+ this bot or reply to one of its messages just as for any ordinary message.
438
+
439
+ Commands follow the same owner, allowed channel, thread, and 1:1 DM boundaries. After
440
+ durably accepting a command, the system sends a private acknowledgement and delivers the
441
+ actual result through the existing outbox to the original conversation. An interaction ID
442
+ is not a message ID and is not used as a history cursor, reaction target, message fetch
443
+ target, or thread source. Interaction tokens are not stored or passed to the head.
444
+ Discord requires an initial response within three seconds. If admission or acknowledgement
445
+ is uncertain, the command is not replayed automatically. Check state before repeating the
446
+ same change. See [Discord's interactions documentation](https://docs.discord.com/developers/interactions/receiving-and-responding)
447
+ for the API contract.
448
+
449
+ ### 2.2 Telegram
450
+
451
+ 1. Create a bot with the official [BotFather](https://core.telegram.org/bots/features#botfather)
452
+ and keep the token in an environment variable such as `TELEGRAM_BOT_TOKEN`. The owner
453
+ must first start a private chat with the bot.
454
+ 2. Set `ownerId` to a **positive numeric user ID string** and `allowedChatIds` to
455
+ **negative chat ID strings** for the allowed groups or supergroups (for example, a
456
+ real `-100…` ID). Names, phone numbers, and usernames are not IDs. The owner's private
457
+ chat is allowed separately, and an empty array blocks group input. In the ordinary
458
+ operator route, even allowed groups accept only messages sent directly by the configured
459
+ owner. Anonymous administrator `sender_chat`, bot messages, forwarded messages, and
460
+ via-bot or business inputs do not carry operator authority. Registered restricted groups
461
+ follow separate `groupRooms` rules.
462
+ 3. To handle ordinary group messages, the bot must be able to see them. Adjust
463
+ [Privacy Mode](https://core.telegram.org/bots/features#privacy-mode) in BotFather
464
+ or explicitly configure visibility through bot administrator rights. Do not assume
465
+ that all ordinary messages arrive with Privacy Mode on. Follow Telegram's guidance
466
+ on whether the bot must be re-added to the group after a change.
467
+ 4. Native forum topics are used in supergroups with forums enabled. To create a new topic,
468
+ the bot needs the administrator permission **`can_manage_topics`** and must be allowed
469
+ to send messages and documents. Lanes are separated by the actual `message_thread_id`.
470
+ When the head hands off to a new topic in a private chat, a bot with
471
+ `getMe.has_topics_enabled` tries to create a real topic first. Private chats without
472
+ support use logical topics with `/new` and `/main`. The system does not invent forum or
473
+ thread IDs for ordinary groups or turn on topic mode on its own.
474
+ 5. Startup verifies the bot with Telegram Bot API `getMe`, checks `getWebhookInfo`, then
475
+ uses `getUpdates` long polling. No public endpoint is needed. **An existing webhook
476
+ blocks startup and is not deleted automatically.** Do not run alongside an existing
477
+ webhook or polling consumer; the operator must switch explicitly. Authentication
478
+ alone does not open polling. Intake starts only after startup approval reconciliation
479
+ in the runtime is complete. If that preparation fails or is stopped while waiting,
480
+ intake stops without advancing the offset or acknowledgement.
481
+
482
+ ```sh
483
+ read -r -s TELEGRAM_BOT_TOKEN
484
+ export TELEGRAM_BOT_TOKEN
485
+ ```
486
+
487
+ The adapter uses the [Telegram Bot API](https://core.telegram.org/bots/api#getupdates).
488
+ After durably accepting the source event, the Gateway stores the next offset. Telegram
489
+ acknowledges the update when the next poll uses that offset. The Bot API has no chat
490
+ history or arbitrary `getMessage` lookup. Recovery is limited to the saved offset and
491
+ Telegram's **update retention of at most 24 hours**. It cannot restore arbitrary past
492
+ conversations, expired updates, or edits and deletions to old messages. The observation
493
+ time of the last accepted update is also stored durably. If at least 24 hours have passed
494
+ without an update, the timestamp is missing or invalid, or the clock moves backward,
495
+ the next request omits the stale offset. This handles the
496
+ [random reset of `update_id` after at least one week of inactivity](https://core.telegram.org/bots/api/types/update.md);
497
+ it is not chat history recovery. Do not assume `update_id` keeps increasing across idle
498
+ periods. Redeliveries are identified by stable message IDs and callback-query IDs.
499
+
500
+ Preview and apply the Telegram command menu with the following commands. They do not
501
+ start polling or change any webhook.
502
+
503
+ ```sh
504
+ bun --no-env-file src/cli.ts telegram-commands --config config.local.json
505
+ bun --no-env-file src/cli.ts telegram-commands --config config.local.json --apply
506
+ ```
507
+
508
+ Only the owner scopes for the 1:1 DM and verified allowed groups are updated. Other users
509
+ and scopes are preserved. A `/status@botusername` command sent from a group menu is
510
+ treated as `/status` only after checking the actual command entity and bot username.
511
+ Commands targeting other bots are ignored. Message ID, topic, and durable offset boundaries
512
+ are unchanged. Select a language-specific list with a flag such as `--language ko`.
513
+ The Telegram API cannot enumerate every existing language override, so it cannot
514
+ guarantee cleanup for languages you did not select. The official API methods are
515
+ [setMyCommands](https://core.telegram.org/bots/api/methods/setmycommands) and
516
+ [getMyCommands](https://core.telegram.org/bots/api/methods/getmycommands).
517
+
518
+ ### 2.3 Slack
519
+
520
+ 1. Create a [Slack app](https://api.slack.com/apps) and enable
521
+ [Socket Mode](https://docs.slack.dev/apis/events-api/using-socket-mode).
522
+ Grant **`connections:write`** to an App-Level Token for that same app to get an
523
+ `xapp-…` token. The Bot Token is a separate **`xoxb-…`** token. Do not substitute a
524
+ user token.
525
+ 2. In OAuth & Permissions, configure these Bot Token Scopes and install the app in
526
+ the workspace. Reinstall after changing scopes. Grant the read and history scopes
527
+ for the channel types you use.
528
+
529
+ | Purpose | Bot scope |
530
+ | --- | --- |
531
+ | Send messages and verify the owner | `chat:write`, `users:read` |
532
+ | Acknowledge receipt and show processing reactions | `reactions:write` |
533
+ | Identify public and private channels and 1:1 DMs | `channels:read`, `groups:read`, `im:read` |
534
+ | Recover known conversations and threads and check approval cards | `channels:history`, `groups:history`, `im:history` |
535
+ | Inspect and download attachments and upload long output | `files:read`, `files:write` |
536
+
537
+ 3. Enable Event Subscriptions and subscribe to the bot events **`message.channels`**,
538
+ **`message.groups`**, and **`message.im`**. Enable Interactivity too. Events, Block Kit
539
+ buttons, modals, and registered commands arrive through Socket Mode; no public
540
+ Request URL or web server is required. Commands also need the bot OAuth `commands` scope.
541
+ 4. Set `teamId` to the `T…` workspace ID, `ownerId` to an active human `U…` or `W…`
542
+ user ID in that workspace, and `allowedChannelIds` to `C…` or `G…` channel ID strings.
543
+ Invite the app to the allowed channels. At startup the adapter checks the bot and
544
+ workspace via `auth.test` and the owner via `users.info`. The ordinary operator route
545
+ does not accept input from other workspaces, users, bots, or apps; only the owner's
546
+ 1:1 DM is allowed separately from the channel allowlist. Registered restricted groups
547
+ follow separate `groupRooms` rules. Group DMs are unsupported. An empty array blocks
548
+ workspace channel input.
549
+ 5. In ordinary Slack messages, use **`!new [request]`, `!main`, `!stop`, and `!resume`**.
550
+ The adapter normalizes them to the shared runtime controls. Slack's composer can
551
+ intercept commands such as `/new`, so do not give operators the Discord or Telegram
552
+ `/` forms as Slack controls. Commands registered in Slack's picker use
553
+ **`/superagent-<command>`**, for example `/superagent-new`, `/superagent-main`,
554
+ and `/superagent-status`, to avoid conflicts with built-in Slack commands.
555
+
556
+ Command registration needs an **app configuration token**, separate from the bot token and
557
+ the `connections:write` app token. Put it in an environment variable or private credential
558
+ file. Pass the variable name, not its value, for `NAME` below. The first call is read-only;
559
+ only `--apply` replaces the manifest command list.
560
+
561
+ ```sh
562
+ bun --no-env-file src/cli.ts slack-commands --config config.local.json --manifest-token-env NAME
563
+ bun --no-env-file src/cli.ts slack-commands --config config.local.json --manifest-token-env NAME --apply
564
+ ```
565
+
566
+ Registration looks up the current bot, workspace, app identity, and manifest, applies
567
+ changes only to that same app, and preserves other settings. At runtime the Rust Gateway
568
+ compares the app ID from `bots.info` with Socket Mode's `hello.connection_info.app_id`.
569
+ On reconnect, commands are not accepted until the app identity has been verified and
570
+ matches. Check `commandsGrant`, `requiresReinstall`, and `permissionsUpdated`. Saving
571
+ the manifest alone does not establish that the current installation's OAuth grant changed.
572
+ Complete any required reinstall or approval separately. The implementation uses the
573
+ official [manifest API](https://docs.slack.dev/app-manifests/configuring-apps-with-app-manifests)
574
+ and [Socket Mode commands](https://docs.slack.dev/apis/events-api/using-socket-mode#command).
575
+ API failures and uncertain updates are not retried automatically. Tokens and `response_url`
576
+ are not written to logs or the coordination database.
577
+
578
+ Slack slash commands are not messages and have no source `ts` or thread. Invocations are
579
+ deduplicated using a token-free fingerprint, and results go to the original allowed
580
+ conversation's outbox. The DM topic boundary falls after the last durably accepted actual
581
+ owner message. Commands with the same anchor follow admission order. The system does not
582
+ represent that as a fabricated Slack timestamp or platform-wide send order. Edits to
583
+ existing messages stay in the original topic.
584
+
585
+ ```sh
586
+ read -r -s SLACK_BOT_TOKEN
587
+ read -r -s SLACK_APP_TOKEN
588
+ export SLACK_BOT_TOKEN SLACK_APP_TOKEN
589
+ ```
590
+
591
+ The Rust Gateway uses [Socket Mode](https://docs.slack.dev/apis/events-api/using-socket-mode/)
592
+ and the [Web API](https://docs.slack.dev/apis/web-api/). Registration uses a one-off Rust
593
+ REST command from the same distribution, without starting Socket Mode or the Gateway daemon.
594
+ Thread lookup follows the bot history scopes in the current official
595
+ [conversations.replies](https://docs.slack.dev/reference/methods/conversations.replies/)
596
+ documentation. Do not assume the former restriction that a bot token can never read
597
+ channel threads. Actual access permissions, workspace retention, and API rate limits
598
+ still apply.
599
+
600
+ ### 2.4 KakaoTalk (local bridge, owner one-to-one only)
601
+
602
+ > **Terms of service risk.** KakaoTalk has no official bot API. Automating a personal
603
+ > Kakao account is not an official integration, can violate Kakao's terms of service,
604
+ > and may lead to account restriction or suspension. The operator chooses and runs the
605
+ > bridge and is responsible for it. Use a separate account where possible and do not
606
+ > automate other people's chats.
607
+
608
+ This adapter **never signs in to Kakao** or contacts Kakao servers. A **bridge** that
609
+ the operator runs on the same machine owns the Kakao session. It records only the
610
+ messages the owner sends in the owner's one-to-one chat; the Gateway reads that inbox
611
+ and replies through a bridge endpoint that only delivers to the same chat. The
612
+ repository ships only a [reference bridge](../scripts/kakao-reference-bridge.ts) that
613
+ does not connect to Kakao. The request/response contract and security requirements
614
+ for a real bridge are in the [KakaoTalk bridge protocol](kakao-bridge-protocol.md).
615
+
616
+ - Example:
617
+ `"kakao": {"bridgeUrl":"http://127.0.0.1:PORT","tokenEnv":"KAKAO_SUPERAGENT_TOKEN","botUserId":"…","ownerId":"…","chatId":"…"}`.
618
+ `bridgeUrl` accepts only the literal addresses `127.0.0.1` or `[::1]`; host names such as
619
+ `localhost` are refused. `botUserId` is the bridge account, `ownerId` the owner, and
620
+ `chatId` their one-to-one chat.
621
+ - The token named by `tokenEnv` is dedicated to this interface: at least 24 characters
622
+ from `[A-Za-z0-9_-]`. Do not reuse a token that opens other bridge features.
623
+ - Supported: text input and replies (Markdown converted to plain text, split into
624
+ 1500-character chunks) and DM controls such as `/new`. Unsupported: threads,
625
+ attachments, reactions and approval cards. When an approval is needed the adapter
626
+ sends a notice and **cancels** it; it never accepts on the owner's behalf.
627
+ - Delivery requires a verified bridge destination and a Kakao message receipt
628
+ for every chunk. A queue acknowledgement or partial send is not confirmation.
629
+ - The adapter never executes messages flagged `stale` and attempts one notice.
630
+ First contact never replays earlier history.
631
+ - `groupRooms` cannot use kakao. `omp-sa setup` does not ask about kakao; add the block
632
+ to the configuration file manually.
633
+ - Local check: `KAKAO_SUPERAGENT_TOKEN=… KAKAO_BOT_USER_ID=900 KAKAO_OWNER_CHAT_ID=777 KAKAO_OWNER_ID=42 bun scripts/kakao-reference-bridge.ts`
634
+ prints its base URL on the first line. `POST /demo/owner-message` injects an owner
635
+ message, and replies are printed in the terminal.
636
+
637
+ ### Message Receipt and Processing Reactions
638
+
639
+ For work that needs a new lane, confirm the scope and working directory, then first
640
+ send a **short kickoff describing what will be done and how** to the assigned thread or
641
+ topic. The required `lane_start` `kickoff` is an external report in the user's language,
642
+ separate from the internal English `brief`. Lane execution does not start until the
643
+ delivery receipt is confirmed. Failed or uncertain delivery puts execution on hold;
644
+ the kickoff is not resent automatically. Answer questions that need no repository in
645
+ the original conversation. Ordinary messages in a bound topic continue the existing work.
646
+ Private chats without native topic support retain the existing logical topic constraints.
647
+
648
+ In a Discord forum, you can ask “Create a new work post with the bug tag.” For existing
649
+ work, you can ask “Rename this thread,” “Archive this thread,” or “Reopen it.” The head
650
+ uses `thread_inspect` to look up actual tag IDs and current state. It sets
651
+ `lane_start.appliedTags` for a new post and uses `lane_thread_update` for an existing
652
+ managed thread. Specifying tags replaces the complete set; omitting them preserves the
653
+ set. A forum with required tags does not accept an empty tag set, and nonexistent tags
654
+ cannot be specified. Managing an existing thread or using moderated tags requires the bot
655
+ to have **Manage Threads**. The system does not change server permissions automatically
656
+ or support thread changes in DMs, on other platforms, or in unregistered threads.
657
+ Archiving and reopening are separate from stopping, completing, and resuming a lane.
658
+ They can affect delivery of an active lane's reports; do not auto-archive on completion
659
+ alone. If a change result is uncertain, look up the current state and make any correction
660
+ through a new explicit request. Do not resend the same request automatically.
661
+
662
+ A Discord work thread shows `⏳` in its title while it has running or queued requests,
663
+ unresolved approvals, or results awaiting delivery. After the last run succeeds and
664
+ delivery of the final reply is confirmed, the marker automatically changes to `✅`.
665
+ This means the request result was delivered; it does not mean the lane was closed or
666
+ the work's acceptance criteria were independently verified. Explicitly completed lanes
667
+ also show `✅`. A new follow-up changes it back to `⏳`; stopping or cancelling clears
668
+ the marker. On startup, the service reconciles existing thread markers from its saved
669
+ records. Work and reporting continue if the bot lacks **Manage Threads** or a title
670
+ update fails.
671
+
672
+ For long work, the system sends concise **interim progress reports** to the same work
673
+ thread after kickoff. For direct topic work where the lane replies in the user's
674
+ language, and for direct HEAD work, the controller delivers interim messages through the
675
+ existing send path. With a review-style handoff, HEAD reviews the lane's internal reports
676
+ before relaying them. Lane execution does not pause for reporting or wait for a head
677
+ reply. Reports occur at meaningful execution boundaries, not on a fixed heartbeat.
678
+ There may be no new report if the model or a long-running tool has made no new
679
+ progress or HEAD has not finished reviewing. There is no additional watch model,
680
+ periodic wake, or full log forwarding. Applying updated role instructions to an existing
681
+ Host requires a separately authorized restart. A source change alone does not update the
682
+ running service.
683
+
684
+ In a bound topic, `/status` (Slack `!status`) shows stored evidence and wait observations
685
+ along with native state. The head can see the same information with `lane_inspect`.
686
+ `lastReportAt` is the structured report time. `lastEvidenceAt` is the last time selected
687
+ file contents or a successful native tool result changed. Ordinary activity, repeat
688
+ reports, and different call IDs with the same result do not advance the evidence time.
689
+ `waiting.target` is the actual tool, approval, or job ID, or the dependency name.
690
+ `waiting.since` is the first time that wait was reported. Repeated reports of the same
691
+ wait preserve the timestamp, and ordinary `progress` does not clear it. Only completion
692
+ of the matching native tool or approval, or a `resolved` report with both the target
693
+ and evidence, clears the wait. Jobs and dependencies use an explicit `resolved` with
694
+ evidence.
695
+
696
+ If `observationState.ownerCurrent` is false, the record is historical, not evidence of a
697
+ current wait in the connected execution. It also says nothing about Host connectivity.
698
+ `lane_inspect` and `/status` separately report `queueHolds`, including whether the
699
+ runtime is blocked (`runtimeBlocked`), `uncertainInputIds`, and the delivery ID and
700
+ status of any unconfirmed kickoff (`kickoff`). `lane_inspect` returns durable hold
701
+ information even if the connected Host's state cannot be confirmed. `/status` in a
702
+ bound topic still returns queue information if HEAD's state cannot be confirmed.
703
+ `lane_message` returns the durable input ID and state. When it returns `pending`, it
704
+ also shows uncertain IDs for earlier inputs or inputs joined to the current execution,
705
+ and any runtime or kickoff blocks. `pending` does not guarantee native delivery or
706
+ execution.
707
+
708
+ Elapsed time is calculated at query time and is null if the clock moves backward. Only
709
+ the root lane's `lane_report` selects and hashes actual files or tool results and records
710
+ them in the native journal. In `eval`, finish the report cell before entering a long
711
+ wait so the head can collect it at that boundary. On restart, the system checks the same
712
+ original input/request/session/file/generation and the pre-submission cursor before
713
+ reading uncollected records and deduplicating them. Native children cannot use the
714
+ reporting tool. An observation is not verified acceptance or proof the target is still
715
+ alive. It does not create a watch model, timer, automatic reminder, resume, or stop.
716
+
717
+ The Gateway adds a receipt reaction after durably accepting an allowed source message.
718
+ It can acknowledge receipt even without a head. Waiting for a reaction API response
719
+ does not delay platform acknowledgements or offsets, model execution, or replies.
720
+ Redelivery of the same input does not trigger another receipt reaction attempt.
721
+
722
+ | Platform | Accepted | Native processing | Finished, stopped, or waiting for approval |
723
+ | --- | --- | --- | --- |
724
+ | Discord | 👀 | Keep 👀 and add 💭 | Remove only the bot's own 💭 |
725
+ | Slack | `eyes` | Keep `eyes` and add `thought_balloon` | Remove only the bot's own `thought_balloon` |
726
+ | Telegram | 👀 | Replace with 🤔 | Return to 👀 |
727
+
728
+ Telegram uses 🤔 because 💭 is not on its
729
+ [allowed reaction list](https://core.telegram.org/bots/api/types/reactiontypeemoji.md) and
730
+ [bots can set only one reaction per message](https://core.telegram.org/bots/api/methods/setmessagereaction.md).
731
+ Chat reaction restrictions or a service message can cause rejection. Discord uses
732
+ the [API for its own reactions](https://docs.discord.com/developers/resources/message#create-reaction).
733
+ Slack uses [`reactions.add`](https://docs.slack.dev/reference/methods/reactions.add) and
734
+ [`reactions.remove`](https://docs.slack.dev/reference/methods/reactions.remove).
735
+ Existing Slack apps must be reinstalled in the workspace after adding `reactions:write`.
736
+
737
+ Reactions apply only to the original account, conversation, and message. The system
738
+ does not fabricate a reaction in a new lane thread or on an internal report. When runs
739
+ for the same message overlap, whether from edits, head work, or lane work, the processing
740
+ indicator clears when the last run ends. It returns after a native approval response.
741
+ Permissions, rate limits, and network errors are recorded only as diagnostics without
742
+ secrets. They do not turn intake or replies into failures and are not retried automatically.
743
+ A reaction does not verify task success or completion and is not a platform read receipt.
744
+ Remote reaction cleanup is not guaranteed after a forced stop or API failure.
745
+
746
+ ## 3. Configuration
747
+
748
+ ### Terminal Setup
749
+
750
+ Run the following wrapper from the prepared checkout. This is an independent implementation
751
+ inspired by Hermes's `/dev/tty` setup entry point and its use of hidden input and a separate
752
+ environment file. It does not run the Hermes installer or install a Gateway service.
753
+
754
+ ```sh
755
+ bash scripts/setup.sh
756
+ # Use a different path:
757
+ bash scripts/setup.sh --config /absolute/path/to/config.json
758
+ # Equivalent direct CLI invocation:
759
+ bun --no-env-file src/cli.ts setup --config config.local.json
760
+ # Disable automatic loading in the outer Bun process when using the package script too:
761
+ bun --no-env-file run setup
762
+ ```
763
+
764
+ `bash scripts/setup.sh --help` prints help even without a controlling terminal. Actual setup and
765
+ token entry still require a terminal; without one, setup refuses to proceed and saves nothing.
766
+
767
+ The wrapper defaults to `config.local.json` in the checkout. For a new configuration, select the
768
+ platforms to use and enter the owner IDs, Slack workspace ID, optional group or channel allowlists,
769
+ actual `headCwd` and `stateDir` paths, and execution budget. An empty group or channel allowlist
770
+ does not allow everyone in: group access remains blocked under the existing policy. Setup gets the
771
+ OMP path from the separately installed stock CLI and the suggested budget values from the existing
772
+ `config.example.json`. It does not set up model providers, presets, or accounts.
773
+
774
+ Tokens are entered without echo on the controlling terminal and are not committed until the final
775
+ save confirmation. Ctrl+C or EOF cancels setup. If no terminal is available, setup does not fall
776
+ back to an input method that echoes secrets. An existing valid JSON configuration is not rewritten.
777
+ Setup prompts only for the configured credential names. Press Enter to keep an existing value;
778
+ changing an existing credential requires a separate confirmation.
779
+
780
+ Credentials are saved to `<config path>.env` with mode `0600`, for example `config.local.json.env`.
781
+ This is a plaintext secrets file for the current OS user, not an encrypted store. Do not put it in
782
+ Git, shared folders, or support logs. Unlike a default `.env`, this file is not automatically
783
+ loaded by Bun from the working directory. Only `start` and `doctor` read it, using a standard dotenv
784
+ parser, and pass only the configured credential names into the environment. They do not use shell
785
+ `source` or `eval`. A nonempty value in the existing shell takes precedence over the file; remove the
786
+ old value from that shell variable to use a newly saved token. Secrets files that are symbolic
787
+ links, belong to another owner, or have public permissions are rejected. Values do not appear in
788
+ diagnostics or error messages.
789
+ The wrapper, the direct CLI commands below, and newly generated native Bun commands use
790
+ `--no-env-file` to disable automatic loading of unrelated `.env` files from the working directory.
791
+ If you invoke Bun without that option or retain an older configured Bun command that omits it,
792
+ Bun may read environment files before the application starts. The credential loader cannot tell
793
+ those values apart from the original shell environment or undo the loading.
794
+ An outer invocation such as `bun run setup` without the option can pass down values that were
795
+ automatically loaded before the wrapper started, so use the invocations shown above.
796
+ The OMP library's own handling of project dotenv files is separate from Bun's automatic loading
797
+ option. Setup and diagnostics do not import that runtime module. `start` loads the Gateway module
798
+ only after validating the required credentials from the explicit environment or selected secrets
799
+ file. This does not change OMP model providers' existing environment resolution policy and is not
800
+ a security boundary that protects the secrets file from the same OS user.
801
+
802
+ Credential updates are serialized with `<config path>.env.lock`. While holding the lock, setup
803
+ checks that the original file it read has not changed. It does not take another setup process's
804
+ lock or overwrite changes made in the meantime. If a forced termination leaves a lock containing a
805
+ PID, remove it explicitly only after confirming that the corresponding setup process is no longer
806
+ running. An owner-only staging hard link left behind while publishing the initial file does not
807
+ make the existing secrets file unreadable and is not automatically deleted on read.
808
+
809
+ Setup does not connect a resident bot, send messages, start or restart the Gateway, register a
810
+ service, or change shell configuration. After saving, run `doctor` separately, then run `start`
811
+ when you are ready. Local preparation alone does not verify actual token validity or all platform
812
+ permissions. Running with credentials supplied only through environment variables remains
813
+ supported.
814
+
815
+ Just before the final save prompt, setup explains that it will replace the Discord and Telegram
816
+ profile pictures with the repository's signature mascot. Once you confirm and the local files are
817
+ saved successfully, setup automatically uploads `assets/superagent-avatar.jpg` for both new
818
+ configurations and existing credential updates. This distributed asset was converted from the
819
+ original WebP to a JPG with a white background; no separate image conversion tool is needed.
820
+ Setup uses only [Discord Modify Current User](https://docs.discord.com/developers/resources/user#modify-current-user)
821
+ and [Telegram setMyProfilePhoto](https://core.telegram.org/bots/api#setmyprofilephoto). It does not
822
+ start the Gateway, polling, Socket Mode, or an OMP session, and does not send messages. `doctor` does
823
+ not call these APIs. Declining before save, cancelling, or a save conflict prevents the profile
824
+ calls too.
825
+
826
+ Setup resolves the configured credential names with the same shell precedence as `start`. If an
827
+ old token remains in the shell, the picture changes for that token's bot, not for the token just
828
+ saved to the file. Setup checks the actual bot identity before uploading. On Discord, it verifies
829
+ that a GET returns the avatar ID from the upload response. On Telegram, it checks for a successful
830
+ response and checks the current photo through `getUserProfilePhotos`; it does not verify that the
831
+ photo is byte-for-byte identical. If an update fails, the CLI exits unsuccessfully and preserves
832
+ the local save. It does not print tokens or raw API errors. The change may already have taken
833
+ effect on some platforms, so check the actual pictures before deciding whether to rerun setup.
834
+ There are no automatic retries. Cancelling aborts the request in progress and skips the remaining
835
+ platforms.
836
+
837
+ On Slack, [users.setPhoto](https://docs.slack.dev/reference/methods/users.setPhoto/) changes the
838
+ photo of the user whose token is used; there is no official app icon upload API for the current bot
839
+ or app tokens. If Slack is configured, setup ends by showing where to upload the same JPG
840
+ manually: `https://api.slack.com/apps` → select the app → **Basic Information → Display Information → App icon**.
841
+ Setup neither presents per-message icons as automatic profile picture setup nor changes a user's
842
+ personal picture.
843
+
844
+ **Managed heads and lanes require a supported OMP memory backend whose effective setting is not
845
+ `off`.** If a backend is already enabled, it is left as is. Existing Superagent configurations
846
+ follow the same rule. `setup`, `doctor`, and Gateway startup and restart check the head's working
847
+ directory and the profile and configuration overlays of the OMP it will run. The Gateway checks
848
+ before connecting to messengers. New head and lane Hosts check their own working directories and
849
+ actual launch configuration before running stock OMP.
850
+
851
+ If the effective setting is unset or comes from a global `off`, setup explains before final save
852
+ that it will set only the global `memory.backend` for the selected native profile to `mnemopi`.
853
+ There is no separate confirmation prompt for memory. The change is applied only after you approve
854
+ the final save and the local files are saved successfully. Declining, cancelling before save, or a
855
+ save conflict prevents it. Gateway startup and restart and new Host launches use the same rule for
856
+ filling in the default. `doctor` is read-only. If memory is still off or the effective setting
857
+ cannot be determined, it exits with a nonzero code. It does not write settings even if startup
858
+ could fill in the default.
859
+
860
+ If a `.env` in the working directory points to a different profile directory, setup does not
861
+ automatically write the global settings there. It can still use an already enabled backend. If
862
+ automatic configuration is needed, specify the profile explicitly in the launch arguments or
863
+ environment. The runtime does not write settings if it reuses an existing Gateway or if startup
864
+ authorization fails. `/restart` only reads settings until the old Gateway has exited. If settings
865
+ cannot be written after process exit and the ownership transfer are confirmed, the restart fails.
866
+ It does not automatically start the bot or the old process again.
867
+
868
+ Before writing global settings, the runtime takes the native lock and checks that the settings it
869
+ previously inspected still apply. After saving, it reads the effective setting again. It does not
870
+ overwrite intervening changes or bypass `off` or an explicit unset in a project setting or a
871
+ higher-priority overlay such as `PI_CONFIG_FILES` or `--config`. The memory database, scope,
872
+ embedding, LLM, and auto-save options, and existing memories are preserved. If a usable backend
873
+ still cannot be confirmed, startup is blocked. In that case setup exits with a nonzero code while
874
+ keeping the saved configuration and credentials. Fix the cause in the applicable native profile
875
+ and working directory, then run `doctor` again.
876
+
877
+ This preflight does not initialize a memory backend, call or download models, or open account
878
+ stores. If only unmigrated native settings or account stores remain and the effective backend
879
+ cannot be determined, no automatic change is made. Migrate the settings with stock OMP under the
880
+ selected profile, then try again. To set the global value manually, use stock OMP's
881
+ `config set memory.backend mnemopi` and check higher-priority settings separately. A global change
882
+ can also affect ordinary OMP sessions. Subsequent use of memory can store or retrieve long-term
883
+ memories or use or download models, as specified by the native settings. A diagnostic saying the
884
+ backend is enabled does not establish that retrieval succeeds. Looking up past work from another
885
+ operator channel requires Mnemopi to be active and searchable on the head.
886
+
887
+ After saving a new configuration successfully, setup checks the native settings in the head's
888
+ working directory in read-only mode, regardless of the memory setup outcome. If there is no
889
+ effective `modelRoles.judge`, it **recommends selecting one in regular OMP under `/models` → Roles
890
+ → Judge**. Existing global, project, and overlay selections and alias or selector chains are
891
+ preserved. If a higher-priority layer clears the role, setup respects that effective state.
892
+ A settings read failure is reported as "could not determine," not "unset." Setup checks only
893
+ whether the role exists, not model or authentication availability or whether a judge call works.
894
+ It does not automatically change the model, fallback, or timeout, or open the account database.
895
+ A selector chain consisting only of commas and whitespace counts as unset. If there is no current
896
+ global settings file and only legacy `settings.json` or `agent.db` remains, setup reports that
897
+ the effective role could not be determined. It only checks whether the legacy files exist; it
898
+ does not read or migrate them. The precedence of explicit higher-layer role selections or clears
899
+ and current global settings is preserved.
900
+ The messenger `/model` command controls the model for the selected session; it is not recommended
901
+ as a substitute for setting a persistent judge role. Neither this check nor the recommendation
902
+ runs when updating tokens in an existing configuration, cancelling, or failing to save.
903
+
904
+ ### Manual Configuration and Fields
905
+
906
+ For manual setup, copy `config.example.json` to `config.local.json` and replace **all paths and
907
+ `REPLACE` values**. The example has one block per platform. **Remove the blocks you will not use**
908
+ and leave at least one. The ID placeholders in each retained block are intentionally invalid
909
+ platform IDs; startup will fail until you replace them. An existing Discord-only configuration
910
+ remains valid. There is no field for the token itself.
911
+ During the dedicated initialization turn on explicit `start`, the existing head uses the native
912
+ mechanism to initialize only missing high/middle/low presets and reads back whether initialization
913
+ completed. Do not add a separate preset block to this configuration file.
914
+
915
+ | Field | Meaning |
916
+ | --- | --- |
917
+ | `command` | Argument vector for the separately installed, unmodified OMP executable. This is not a shell command string; shell variables and `~` are not expanded. Setup finds the installed CLI on `PATH` and recommends an absolute path that works regardless of the launch working directory. |
918
+ | `stateDir` | Short, dedicated path owned by the current user. Stores sockets, the SQLite ledger, sessions, logs, and attachments. Do not use a shared or symlinked directory. A socket path longer than 100 bytes is rejected. |
919
+ | `headCwd` | Existing directory where the head runs. It is not the default repository for requests; each lane's working directory is selected separately based on verified work scope. |
920
+ | `maxHosts` | Budget for resident Hosts, including one head. Required integer, minimum 2. Work above that limit waits. |
921
+ | `maxSubagents` | Native task concurrency budget distributed across all Hosts. Required integer, at least `maxHosts`. The per-Host limit is `floor(maxSubagents / maxHosts)`. |
922
+ | `idleMs` | Time in milliseconds before safely settled idle lanes are reclaimed. Required nonnegative integer. Does not apply to the head and does not remove session history. |
923
+ | `model` | Optional OMP model identifier for starting the head. If omitted, existing OMP settings apply. This is not the default for all new lanes: select each new lane's model or preset through `lane_start`. Resuming a lane keeps its saved selection. |
924
+ | `discord` | Optional block. If present, `tokenEnv`, `ownerId`, `allowedGuildIds`, and `allowedChannelIds` are all required. |
925
+ | `discord.requireAddressing` | Optional boolean, default `false`. With `true`, in parent channels of allowed servers and threads not created by this bot, only ordinary messages from the owner with an actual mention of this bot or a reply to a message it sent are accepted. |
926
+ | `discord.editProgressInPlace` | Optional boolean, default `false`. With `true`, intermediate progress updates for a Discord request edit one `⏳` status message in place instead of posting new messages. |
927
+ | `telegram` | Optional block. If present, `tokenEnv`, `ownerId`, and `allowedChatIds` are all required. Keep the minus sign on group chat IDs. |
928
+ | `slack` | Optional block. If present, `botTokenEnv`, `appTokenEnv`, `ownerId`, `teamId`, and `allowedChannelIds` are all required. |
929
+ | `groupRooms` | Optional list. Enables the group modes below only for the specified rooms and users. Even the operator has only ordinary group permissions in those rooms. Defaults to an empty list. |
930
+
931
+ Relative paths for state and working directories, and relative executable paths containing a slash
932
+ in `command[0]`, are resolved relative to the configuration file. The rest of the `command`
933
+ arguments are not rewritten this way. An absolute executable path is recommended.
934
+ Do not point to an OMP CLI in a source checkout or a locally patched binary. Use a supported,
935
+ separately installed stock CLI.
936
+
937
+ The example values `maxHosts: 4`, `maxSubagents: 8`, and `idleMs: 300000` are adjustable examples,
938
+ not hard-coded defaults. This example budgets up to three lanes in addition to the head, with task
939
+ concurrency of two per Host. These are not hard limits on CPU, memory, token costs, or disk
940
+ allocation. The operator manages retention of saved records and downloaded files and their disk
941
+ usage.
942
+
943
+ ### Group Chat and Server Access Separation
944
+
945
+ For a room added to the existing platform allowlist, also specify its exact platform, server, and
946
+ channel IDs in `groupRooms`. Existing operator routes not on this list behave as before. Other
947
+ channels in the same server are not opened automatically. The same rules apply to threads and forum
948
+ topics under a registered parent channel. Use your own DM or a separate operator channel for
949
+ administrative commands, approvals, and sending result files.
950
+
951
+ ```json
952
+ {
953
+ "groupRooms": [
954
+ {
955
+ "platform": "discord",
956
+ "guildId": "1234567890",
957
+ "channelId": "1234567891",
958
+ "userIds": ["1234567892"],
959
+ "mode": "request",
960
+ "dailyLimit": 10
961
+ }
962
+ ]
963
+ }
964
+ ```
965
+
966
+ - `platform` is `discord`, `telegram`, or `slack`. For Telegram, put the same negative group ID in
967
+ `guildId` and `channelId`. For Slack, use the configured `teamId` as `guildId`. Use actual user
968
+ IDs, not display names, in `userIds`. Include the operator's ID too if they need to use restricted
969
+ mode. A server admin role does not grant access.
970
+ - Calls from unauthorized IDs are neither accepted nor run, including slash commands. On Discord
971
+ and Slack, registered slash commands may be visible in the app menu, but nobody can run them in a
972
+ restricted group. Authorized IDs can only use the one command configured for that room:
973
+ `!request`, `!ask`, or `!work`.
974
+ - `request`: `!request <request text>` only acknowledges receipt; it does not run a model or tools.
975
+ The operator can inspect the original locally with `omp-sa group --config FILE` or
976
+ `omp-sa group REQUEST_ID --config FILE`. To run a reviewed request, the operator starts it as a
977
+ new request in their own allowed conversation.
978
+ - `chat`: `!ask <question>` sends only the current question to a separate OMP run and returns a
979
+ short text answer. It does not use a working directory, tools, past conversations, or operator
980
+ memory. Set `model` to an exact `provider/model`.
981
+ - `work`: `!work <task>` uses `model` and the repository the operator specified in `repository`.
982
+ Only after the acknowledgment has actually reached the same room does it read and edit allowed
983
+ files in a separate Git worktree created from a commit in that repository. It does not run shell
984
+ or test commands, or commit, push, or merge in Git. The group sees only predefined status updates.
985
+ The operator checks the actual diff and worktree location locally with
986
+ `omp-sa group REQUEST_ID --config FILE`. A terminal status does not mean the changes have been
987
+ verified or approved for deployment.
988
+ - With Telegram privacy mode enabled, use `/request@BotUsername`, `/ask@BotUsername`, or
989
+ `/work@BotUsername` with the bot's actual username. Editing an input does not create a new job.
990
+ - `dailyLimit` is the daily admission limit per room in UTC. Only one `chat` or `work` execution
991
+ runs at a time, using a spare slot in the Host budget. Put separate OMP model credentials for
992
+ groups in `stateDir/groups/models.yml`. The operator profile is not inherited. Specify only
993
+ repositories and data that may be sent to this model. A worktree is not an OS sandbox. Do not
994
+ apply unreviewed files to the original checkout or run them.
995
+ - Configuration changes take effect the next time the Gateway starts. Interrupted runs and
996
+ responses whose delivery is uncertain are not automatically rerun or resent. Messages already
997
+ made public before switching to group mode are not deleted.
998
+
999
+ Rooms in `request` mode do not need a model file. To use `chat` or `work`, make
1000
+ `stateDir/groups` accessible only to the account running the service (`0700`) and save `models.yml`
1001
+ inside it with mode `0600`. For example, for an OpenAI-compatible API, use the following
1002
+ configuration and set the room's `model` to `group-provider/EXACT_MODEL_ID`. Replace the URL,
1003
+ key, limits, and prices with your provider's actual values. A dedicated group API key and
1004
+ provider-side usage limits are recommended in place of operator credentials.
1005
+
1006
+ ```yaml
1007
+ providers:
1008
+ group-provider:
1009
+ api: openai-completions
1010
+ baseUrl: https://provider.example/v1
1011
+ apiKey: REPLACE_WITH_GROUP_ONLY_API_KEY
1012
+ models:
1013
+ - id: EXACT_MODEL_ID
1014
+ name: Group model
1015
+ contextWindow: 32768
1016
+ maxTokens: 4096
1017
+ cost: {input: 1, output: 4, cacheRead: 0, cacheWrite: 0}
1018
+ ```
1019
+
1020
+ Group questions and tasks make real model calls and may incur provider charges. Local time and
1021
+ cost limits constrain execution but cannot cancel charges for a request already submitted or
1022
+ guarantee the amount the provider bills.
1023
+
1024
+ ## 4. Commands and Daily Use
1025
+
1026
+ The CLI executable is `omp-sa`. Install the global package as described above, or register the
1027
+ prepared checkout with `bun link`. Put the corresponding global bin directory on `PATH` to run
1028
+ commands such as `omp-sa --help` and `omp-sa status --config config.local.json`. The project and
1029
+ package name remains `omp-superagent`. The direct invocation from source shown below runs the same
1030
+ CLI. Both invocation methods disable automatic `.env` loading.
1031
+
1032
+ For the management commands below, pass `--config FILE`. Start with diagnostics that do not start the
1033
+ bot:
1034
+
1035
+ ```sh
1036
+ bun --no-env-file src/cli.ts doctor --config config.local.json
1037
+ bun --no-env-file src/cli.ts status --config config.local.json
1038
+ ```
1039
+
1040
+ `doctor` checks the configuration, the installed OMP version, required CLI capabilities, effective
1041
+ memory settings, and execute permission for the Host relay. It is read-only. It prints the relay
1042
+ path this package will use in `hostOwnerExecutable`, the configured platforms in `platforms`,
1043
+ **a boolean indicating presence** for each environment variable name in `credentials`, and
1044
+ `messengersActivated: false`. It prints neither token values nor the old Discord-only
1045
+ `discordTokenPresent` and `discordActivated` fields. It does not verify bot login, model
1046
+ authentication, or actual task success.
1047
+ `status` lists the lanes and socket paths in the ledger and reports Gateway and head readiness
1048
+ separately. A record by itself does not prove that a process is live, that ownership is exact, or
1049
+ that work is complete.
1050
+
1051
+ | Status field | Meaning |
1052
+ | --- | --- |
1053
+ | `gateway.ready` | Actual Gateway transport authentication and readiness. |
1054
+ | `gateway.admissionReady` | Whether the Gateway has passed the first head's native approval recovery barrier and opened durable admission. |
1055
+ | `gateway.unresolvedEvents` | Count of unresolved ingress events awaiting safe recovery of admission or reply. Ambiguous inputs are not discarded as rejected or completed. |
1056
+ | `head.pid` | Native head process ID. Does not indicate controller or adapter readiness or work completion. |
1057
+ | `head.ready` | Whether the head controller gate has been passed and preset initialization is complete. Remains `false` if initialization is incomplete or admission is unresolved. |
1058
+ | `head.connected` | Connection between the Gateway and the head client. |
1059
+ | `head.initialization` | Native preset initialization state and details. This is separate from transport login and input admission; only `complete` means initialization has finished. |
1060
+
1061
+ Once the Gateway passes the initial admission barrier, it maintains durable admission even if the
1062
+ head later goes away. `head.ready` or `head.connected` becoming `false` neither closes admission
1063
+ that is already open nor causes the Gateway to poll the model.
1064
+
1065
+ **The following `start` command requests activation of all configured adapters.** `prepare` and
1066
+ `doctor` do not substitute for `start`. The separate macOS `install` authorizes this `start` to run
1067
+ at the next login. With actual credentials, `start` connects to all configured Discord, Telegram,
1068
+ and Slack platforms.
1069
+
1070
+ ```sh
1071
+ bun --no-env-file src/cli.ts start --config config.local.json
1072
+ ```
1073
+
1074
+ `start` **starts a detached Gateway first**. The Gateway starts the one designated head or
1075
+ connects to an existing head whose ownership is verified. The sockets, logs, and readiness output
1076
+ do not constitute receipts for platform login or actual model calls. Check the Gateway and Host logs
1077
+ listed by the CLI to distinguish the actual errors and states for each stage. The Gateway's local
1078
+ endpoint is `<stateDir>/run/gateway.sock`; the actual adapter and supervisor logs are in
1079
+ `<stateDir>/logs/gateway.log`. Do not confuse the native head log with the transport log.
1080
+ A ready Gateway persists incoming events before ACK even when the head is absent. Unresolved
1081
+ admissions or replies keep their pending order and appear in `gateway.unresolvedEvents` and as
1082
+ `head.ready: false`.
1083
+ Reconnection or redelivery of an admission event does not authorize rerunning the original work or
1084
+ external effects. Compare the logs and original receipt with the recorded native PID, session ID
1085
+ and file, and socket inode. Do not start a duplicate managed Host if the existing one is still
1086
+ alive or its identity is uncertain. Do not work around an unknown or replaced socket by deleting
1087
+ it. If the runtime crashes immediately after launch but before recording ownership, it may
1088
+ remain blocked pending manual reconciliation. Not every crash can be recovered automatically, and
1089
+ restarting does not overwrite the existing head's model with `config.model`.
1090
+ For the exact contracts, see [admission](design/messaging.md#durable-admission-and-recovery) and
1091
+ [ownership recovery](../DESIGN.md#startup-readiness-and-shutdown).
1092
+
1093
+ When the head runtime accepts authenticated input, it records the original request and
1094
+ conversation address together. In bound work threads or topics, ordinary messages continue work
1095
+ in the existing session without going through the shared head model. Input to a topic still
1096
+ being opened also stays with its existing assignment.
1097
+
1098
+ Other ordinary requests go to the shared HEAD unchanged, even if they name a repository. HEAD
1099
+ answers questions that do not require a repository directly. For repository work, it uses clues
1100
+ in the request and the conversation context to find and verify the actual directory before
1101
+ assigning the work. It does not select a default repository or the last active chat or lane. If
1102
+ the target or scope is still materially ambiguous after checking, it asks a specific question in
1103
+ the original conversation. A request in an unbound Discord thread is handled in that thread
1104
+ unless the operator asks to split it out; no sibling thread is created.
1105
+
1106
+ A first line of `cwd: /actual/work/path`, `/new` with a task, an exact reply to an assignment
1107
+ message with a verified path, or an explicit past-work lookup stays on the runtime's assignment
1108
+ path. An invalid explicit path is not executed. Reusing just the path from an earlier task does
1109
+ not import the previous conversation. If the assignment flow needs to confirm the working
1110
+ directory, reply to the original question with the repository name or absolute path to continue
1111
+ the **original request**. Lanes do not have messenger credentials. To compare multiple topics or
1112
+ explicitly address the shared HEAD, use `/head <request>` (Slack: `!head <request>`).
1113
+
1114
+ **Change the shared reply voice (SOUL)** by telling HEAD in a fresh message:
1115
+ “From now on, answer like an editor, formally and briefly, with the answer first.”
1116
+ There is no required SOUL keyword. In a bound work thread only, address HEAD
1117
+ with the existing `/head` prefix (Slack: `!head`); ordinary messages there
1118
+ still go to the lane. “Reset your reply style” restores the default. Check the tool's saved
1119
+ revision in HEAD's confirmation. The setting survives restart and applies to
1120
+ new HEAD and direct lane replies, not messages already being written, internal
1121
+ reports, or code-generated status/approval messages. One-off requests are not stored.
1122
+ The supported concepts are editorial, mentoring, and plain. They do not change
1123
+ models, identity, tools, approvals, or workflows.
1124
+
1125
+ If Mnemopi is active and searchable on the head, you can describe when the work happened and what
1126
+ it was in another operator channel or DM, for example: `Continue where we left off with the login
1127
+ bug last week`. You do not need a repository name, the original message link, or `/new`. The head
1128
+ first uses **OMP Mnemopi `recall`** from its profile to find leads, then checks them against original
1129
+ work sessions that this instance is allowed to access. If retrieval succeeds but returns no
1130
+ memories, the head can still search the original sessions. If another backend is in use or the
1131
+ lookup fails, the runtime does not guess an assignment through this path. If there are several
1132
+ candidates, answer the question with a number.
1133
+ Input that needs a past-work lookup is durably accepted by the head before the separate search
1134
+ runs. Later ordinary input in the same physical channel or DM stays in order while the lookup is
1135
+ pending, but other conversations are not blocked.
1136
+ `recall` uses the memory bank scope configured for the head; it does not open private banks
1137
+ belonging to other projects. Raw memories are not sent to chats or new sessions. When continuing
1138
+ from another channel, only the previous repository and evidence relevant to the task are passed to
1139
+ an independent session in the current conversation. In an already bound Discord work thread, no
1140
+ new session is opened; only verified evidence goes to the current lane, and the question, work,
1141
+ and answer stay in that thread.
1142
+ For a past-work selection question in that thread only, if no answer arrives within five minutes
1143
+ after confirmed delivery, the runtime prefers the current session among verified candidates, then
1144
+ the most recent candidate in the same working directory. If none is valid, it uses only the
1145
+ current lane's context. An on-time selection takes precedence. This timeout does not move the
1146
+ work to another directory or substitute for approval. Ongoing work and approvals are not
1147
+ transferred from the original session, and the full previous conversation is not posted to the
1148
+ messenger. `last week` means the seven days immediately before Monday at 00:00 UTC of the week
1149
+ containing the request.
1150
+ The operator does not need to create a thread in advance. In channels that support work threads,
1151
+ the bot sends the result there; in ordinary Discord or Telegram channels that cannot create
1152
+ threads, it replies in the same channel. A generic `Continue` is still a follow-up to the current
1153
+ topic.
1154
+
1155
+ **Ordinary follow-up input defaults to steering.** Conversations served by HEAD, such as the main
1156
+ channel, go to HEAD; a bound work thread goes to its lane. `/head <request>` explicitly targets
1157
+ HEAD even in a thread. If work is running in the same conversation, the input is applied at the
1158
+ next OMP steering boundary without `/steer`. If idle, it starts a new run. The first reply just
1159
+ after opening a thread can also join the original run if that thread is confirmed as the run's
1160
+ reply route. Admission of a message or acceptance of an RPC call does not prove the model read
1161
+ the input. Other conversations, internal reports, workflow selections, and control commands are
1162
+ not mixed into the current run. Steering does not bypass pauses, approvals, compaction, or holds
1163
+ for uncertainty. The original Discord addressing policy still applies, and final replies or reports
1164
+ for the same run are not sent twice.
1165
+
1166
+ **You can request a new topic without a command, too.** When a new lane is needed, an independent
1167
+ OMP session in the verified working directory is bound to a supported thread or topic. In a
1168
+ bound Discord server work thread, typing a different `cwd:` alone does not change the path or
1169
+ thread. To split work into a new thread under the same parent, use `/new <request>` or state both
1170
+ the split and the task on one plain-text line, such as `Split this into a new thread: Check login`
1171
+ or `Do the login check in a new thread` (also `이건 따로 빼줘: 로그인 점검` or
1172
+ `로그인 점검은 새 스레드에서 해줘` in Korean). For work in a different directory, put
1173
+ `/new cwd: /actual/work/path` on the first line and the task on the next line.
1174
+ If you leave the task unspecified, as in `Split this into a new thread` (`이건 따로 빼줘`), the bot
1175
+ asks you to specify the task with `/new` in the same thread and does not create a new thread.
1176
+ Edited messages, quotes, and attachments do not count as instructions to create a thread.
1177
+ The plain-text split instruction does not apply in Discord DMs or on other platforms. The Gateway
1178
+ does not use an LLM for classification or execute lanes.
1179
+
1180
+ | Platform | Automatic topic creation |
1181
+ | --- | --- |
1182
+ | Discord | Public threads in allowed text and announcement channels; posts with a starter message in forum and media channels. DMs use logical topics. If a forum or media channel requires tags, creation is rejected rather than guessing tags. |
1183
+ | Telegram | Forum supergroups where the bot is an admin with `can_manage_topics`, or private topics for a bot with `has_topics_enabled`. Unsupported private chats use logical topics; ordinary groups cannot create native topics. |
1184
+ | Slack | Threads use a real root message's `ts` in allowed channels and owner DMs. Splitting a new topic from an existing thread creates a separate root message. |
1185
+
1186
+ Official APIs: [Discord threads](https://docs.discord.com/developers/topics/threads),
1187
+ [Telegram createForumTopic](https://core.telegram.org/bots/api/methods/createforumtopic.md),
1188
+ [Telegram bot capability](https://core.telegram.org/bots/api/types/user.md), and
1189
+ [Slack thread_ts](https://docs.slack.dev/messaging/sending-and-scheduling-messages/#threading).
1190
+ The runtime does not create channels or servers on its own or change permissions or BotFather
1191
+ settings. Permission and network failures are not hidden as missing support. If creation or
1192
+ delivery is uncertain, redelivery does not automatically repeat it.
1193
+
1194
+ Send the following as **plain-text commands** on Discord and Telegram. Discord treats registered
1195
+ slash commands the same way. On Slack, use `!new` and `!main`, or the registered
1196
+ `/superagent-new` and `/superagent-main`, in the corresponding situations.
1197
+
1198
+ | DM input | Behavior |
1199
+ | --- | --- |
1200
+ | `/new <request text>` | Accepts a separate topic boundary. Once the working directory is confirmed, prefers creating and binding a native topic. Only unsupported DMs use a logical topic. |
1201
+ | `/new` | Activates only an empty topic and sends one fixed prompt asking for the request. By itself, it does not call a model or start a lane. |
1202
+ | Ordinary message | Continues in the selected topic's session, restoring it if necessary and steering active work when applicable. While a topic is being opened, the existing assignment applies. The shared HEAD decides how to handle other ordinary requests. |
1203
+ | `/main` | Routes future DM input back to the main conversation address. Preserves earlier topics and lanes. Use `/head <request>` to explicitly target the shared HEAD. |
1204
+
1205
+ The head can use `lane_start` to hand off even an ordinary DM task it has already accepted to an
1206
+ independent topic. It keeps ownership of the original head request and creates a separate
1207
+ handoff. If it creates a native thread, continue the conversation in the indicated thread. With
1208
+ the logical-topic fallback, subsequent DM input follows that topic. No server needs to be created.
1209
+ A handoff can also target a server thread that has been explicitly allowed.
1210
+ In group and workspace channel conversations, `/new` without arguments (Slack: `!new`) sends
1211
+ instructions for using a new thread or topic. It is not forwarded as OMP's own `/new`.
1212
+ In a conversation bound to a lane, `/stop` and `/resume` (Slack: `!stop` and `!resume`) pause and
1213
+ explicitly resume it, respectively. Previously, resuming only reopened the runtime queue. Now an
1214
+ existing paused native lane goal resumes only when resumption is explicitly authorized. Automatic
1215
+ reports, reconnection, and new queued input do not authorize resumption. Resuming does not create
1216
+ a missing goal, clear uncertainty, or automatically replay an interrupted prompt.
1217
+ Editing an accepted `/new` or `/main` control message does not change the existing boundary, work,
1218
+ or current topic. The runtime only records the edit and sends a fixed notice asking you to send a
1219
+ new control message. The same policy applies to Slack's `!` controls. Editing an ordinary work
1220
+ message creates a new input revision and does not undo external effects that have already occurred.
1221
+
1222
+ ### Model Selection and Head Effort
1223
+
1224
+ In a Discord lane thread, run **`/model` by itself**. In the first dropdown, select **HEAD** or
1225
+ **the current lane**. Select a provider in the second dropdown; that dropdown then shows the
1226
+ provider's models. The change only happens when you select a model. If the conversation is not
1227
+ bound to a lane you can change, you can select only HEAD.
1228
+ When sending a model ID directly as text, omitting `--lane` changes **HEAD** even in a lane thread.
1229
+ Discord and Telegram support plain-text `/` commands; Discord also supports registered slash
1230
+ commands. Slack supports plain-text `!model` and `!effort` and the registered `/superagent-model`
1231
+ and `/superagent-effort`. There is no separate HTTP endpoint.
1232
+
1233
+ | Command | Behavior |
1234
+ | --- | --- |
1235
+ | `/model` | Opens the model picker. On Discord, choose HEAD or the current lane; on Telegram and Slack, the picker changes HEAD. |
1236
+ | `/model list` | Lists chat models selectable with the current native authentication and enabled settings. |
1237
+ | `/model <provider/model>` | Changes the head model to the exact `provider/model` from the list. |
1238
+ | `/model --lane <provider/id>` | Directly changes only the model of the idle lane bound to the current conversation. Does not call the HEAD model or rerun a failed request. |
1239
+ | `/effort` | Shows the current effort and opens the picker for levels supported by the current model. |
1240
+ | `/effort <level>` | Changes head effort to a level shown by the query. |
1241
+ | `/model preset` or `/model preset list` | Lists existing native presets, their validity, and their available default models. |
1242
+ | `/model preset <name>` | Applies all roles and default effort from the named native preset to the idle head session. |
1243
+ | `/model preset <name> --global` | Also saves the identical snapshot applied and verified on the current head as the native global default roles and effort. |
1244
+
1245
+ If a lane model's quota is confirmed exhausted, the runtime notifies the original conversation
1246
+ once. Follow-up requests in that lane wait for the operator to pick a model. If it is unclear
1247
+ whether a request ran, verify the original effect, then close the request with the
1248
+ `/resolve --lane <input-id>` command in the notice. HEAD handles other execution errors, such as
1249
+ transient 429s, within the original scope of work. Quota exhaustion alone does not change the
1250
+ HEAD model or global settings.
1251
+ If the model change response is lost, **open a new `/model` picker in the original Discord lane
1252
+ conversation, select the current lane, and reselect the same provider and model**. To do this by
1253
+ text, send a new `/model --lane <provider/id>` in the same conversation. If the change already
1254
+ took effect, the runtime confirms it rather than applying it again. If the actual model or
1255
+ ownership cannot be verified, it holds the change. A later report about the previous error does
1256
+ not overwrite a model you subsequently selected.
1257
+ If a manually run `/cron pr-review` exhausts its quota, you can change the model in that PR thread. In
1258
+ that case, selecting the current lane shows only models capable of static review without tools.
1259
+ Selecting HEAD in the same card shows the regular model list. This does not apply to unattended
1260
+ PR review.
1261
+
1262
+ Discord and Slack use dropdowns, and Telegram uses inline buttons. Opening or paging through a
1263
+ menu does not change any settings. Menus expire after five minutes or on Gateway restart. If the
1264
+ head model changes while an effort menu is open, open the menu again. Accepting a click and
1265
+ completing the change are separate; the result is reported separately in the original
1266
+ conversation. Text commands still work.
1267
+
1268
+ Queries are handled during execution without calling the model. HEAD changes are processed only
1269
+ when the head is idle and has no pending approvals, goals, background work, owned services,
1270
+ compaction, or uncertain submissions. Changes are rejected while it is busy; send a new command
1271
+ after the work settles. The runtime does not automatically interrupt active work to make a change.
1272
+ After changing the model, effort may be adjusted to the model's native supported range. The
1273
+ response shows the actual value read back. An unavailable model or effort is not silently
1274
+ substituted. If native state has no explicit effort, the response shows the model default; this
1275
+ is not `off`. If the current model advertises `auto`, select it in the menu or enter
1276
+ `/effort auto`. In automatic mode, the setting `auto` may differ from the effort OMP actually
1277
+ applies. The option is not shown on older Hosts that do not advertise `auto`, and no fixed
1278
+ effort is applied in its place.
1279
+
1280
+ You can also ask explicitly, for example `/head Change the head model to 6.2 Astra`. The head
1281
+ checks the available models and applies the change only to the shared head after the current
1282
+ turn finishes successfully. A response that schedules the change is not confirmation that it
1283
+ has been applied. The runtime replies to the original message with the actual result. It does
1284
+ not automatically retry if the original turn is interrupted or if the head is still busy after
1285
+ the turn ends.
1286
+
1287
+ Changes without options preserve global OMP defaults and existing lane selections. All messengers
1288
+ use the same head, so its future work uses the same changed settings. Restarting the same native
1289
+ session restores its recorded selection. `--global` is not supported for ordinary `/model` or
1290
+ `/effort`, and `--once` is not supported at all. Duplicate deliveries do not reapply changes. If a
1291
+ change response is lost or the actual state cannot be confirmed, the runtime does not show success
1292
+ or automatically repeat the change. Use `/model` or `/effort` to query the actual state, but a
1293
+ query does not clear existing uncertainty.
1294
+
1295
+ Presets are read from OMP's existing `modelPresets`. The messenger cannot create, edit, or
1296
+ delete named preset definitions. Any configured name can be used, not just high/middle/low.
1297
+ After applying a preset, the runtime verifies all roles and default effort against native state.
1298
+ It keeps only the confirmed per-session settings and removed roles as restart metadata and
1299
+ restores them through a private settings overlay for the new Host. Active values separately
1300
+ selected later with `/model` or `/effort` are restored from the native transcript and are not
1301
+ overwritten with the earlier preset's defaults.
1302
+ If a preset omits its default effort, the current head session's policy remains in force. The
1303
+ persistent default is not loaded again. The precedence between an explicit preset effort and a
1304
+ model selector's effort is unchanged.
1305
+
1306
+ **By default, a preset applies only to the current head session.** Only a preset selection with
1307
+ an explicit `--global` saves the same roles and default effort to native global settings after
1308
+ the change on the current head is confirmed. It does not change running lanes or explicit
1309
+ selections in other sessions, or remove configuration overrides for other projects. The change
1310
+ notice reports the preset name, the actual model and effort before and after, and either
1311
+ `session-only` or whether the global save succeeded. If the preset was applied to the head but
1312
+ saving or verifying the global settings failed, the runtime reports those as separate outcomes;
1313
+ it does not retry automatically or claim success. A change to global defaults can affect new
1314
+ sessions and paths that inherit those defaults.
1315
+
1316
+ ### Scheduled Jobs (`/cron`)
1317
+
1318
+ Use `/cron` on Discord and Telegram, and `!cron` in ordinary Slack messages. You can
1319
+ also make a natural-language request, such as “Summarize the CI status at 9 a.m. Seoul
1320
+ time on weekdays and send it to this conversation.” HEAD registers the job with
1321
+ `cron_create` and verifies its actual ID and next run time. If the time zone or the task
1322
+ is unclear, HEAD asks for clarification. Each request registers one job. Manage jobs
1323
+ created in natural language with `/cron` in the same conversation.
1324
+ To use registered app commands, put the subcommand in the `text` option of Discord’s
1325
+ `/cron` or pass it to Slack’s `/superagent-cron`. Rerun command registration separately
1326
+ to refresh existing app command menus; ordinary message commands do not need this step.
1327
+
1328
+ ```text
1329
+ /cron add "in 30m" Remind me to check the build
1330
+ /cron add "every 2h" Read and summarize the CI status
1331
+ /cron add "TZ=Asia/Seoul 0 9 * * 1-5" Summarize today's schedule on weekday mornings
1332
+ /cron add "at 2027-01-09T09:00:00+09:00" Tell me what I need to do today
1333
+ /cron list
1334
+ /cron show ID
1335
+ /cron edit ID "every 4h" Summarize the CI status and why any checks failed
1336
+ /cron edit ID prompt Summarize the results in three lines
1337
+ /cron pause ID
1338
+ /cron resume ID
1339
+ /cron run ID
1340
+ /cron remove ID
1341
+ ```
1342
+
1343
+ - Schedules use `in` (one time), `every` (at least one minute, using `s/m/h/d`),
1344
+ `at` with an explicit UTC offset (one time), or a five-field cron expression.
1345
+ Without an explicit time zone such as `TZ=Asia/Seoul`, a cron expression uses the
1346
+ host time zone at registration. The list displays the next run time in UTC.
1347
+ - Manage a job only from the platform, bot account, conversation, and thread or
1348
+ logical topic where it was registered. The owner must send a new message. Editing
1349
+ an existing message or producing a model reply cannot change the schedule.
1350
+ - Runs use the same queue as HEAD requests on **shared HEAD**, with its current
1351
+ model. Results and approval requests go back only to the original conversation.
1352
+ Scheduling does not create a separate session or lane, reuse attachments, or grant
1353
+ standing approval. It does not by itself authorize tool use that requires approval
1354
+ or any new external effect.
1355
+ - Direct shell scheduling (`/cron add shell`) is not supported. Scheduling an
1356
+ ordinary HEAD task still uses the existing approval flow. Shell jobs registered by
1357
+ older builds can be inspected or removed, but cannot be resumed or run. Runs that
1358
+ have not started are canceled, and unsent shell output is not posted. If a job had
1359
+ already started in an older build, check whether it exited on the original host
1360
+ and clear the hold with `/resolve`.
1361
+ - `run` queues a one-off run without changing the schedule. `pause` and `remove`
1362
+ cancel runs that are queued but have not been submitted. To stop a run that has
1363
+ been submitted, use `/stop head`. After canceling a queued one-time run, use `run`
1364
+ or `edit` to schedule it again. `edit` affects runs queued from then on; already
1365
+ admitted runs keep the previous prompt.
1366
+ - Jobs do not run while the service is down. On restart, at most one missed
1367
+ occurrence is admitted per job. Recurring jobs skip overlapping occurrences while
1368
+ a previous run is pending or in progress. `/stop head` also holds existing
1369
+ schedules; resume the jobs you want individually with `/cron resume ID`. If the
1370
+ outcome of a previous run is uncertain, check the original session and clear the
1371
+ hold with `/resolve <run-id>` first. Registration, queue admission, and completion
1372
+ are distinct states.
1373
+
1374
+ #### Reviewing New External PRs (`/cron pr-add`)
1375
+
1376
+ **New registrations default to unattended review and a GitHub comment.** The owner
1377
+ can select a level in the same parent channel without sending a separate start
1378
+ command for every PR. Each level includes the actions allowed by the previous one.
1379
+
1380
+ | Recognized Korean text to send in the parent channel | Equivalent command | Unattended behavior |
1381
+ | --- | --- | --- |
1382
+ | `무인으로 리뷰만` (“Unattended review only”) | `/cron pr-mode JOB review` | Review in a per-PR Discord thread and a tool-free OMP lane, then leave only a GitHub review comment tied to that SHA. Do not submit an approving review. |
1383
+ | `무인으로 리뷰 후 수정커밋까지` (“Unattended review and fix commits”) | `/cron pr-mode JOB fix` | In addition to reviewing and commenting, create a regular commit only if a fix can be applied safely, then review the new SHA. Do not merge. |
1384
+ | `무인으로 수정커밋후 머지까지` (“Unattended fix commits and merge”) | `/cron pr-mode JOB merge` | If needed, fix and review again. Perform a regular merge only if the final SHA passes review and independent approval, required CI, and branch protection rules are all satisfied. |
1385
+
1386
+ If the channel has multiple registered repositories, specify the target with
1387
+ `/cron pr-mode OWNER/REPO review|fix|merge`. In the actual command, choose one of
1388
+ the three values. Check the resulting setting with `/cron show JOB`. You can also
1389
+ select a level by number, for example `PR 자동화 2단계로 바꿔줘` (“Set PR automation
1390
+ to level 2”).
1391
+ If `discord.requireAddressing` is enabled, start the message by mentioning the
1392
+ actual bot or reply to one of its messages in the parent channel. Increasing the
1393
+ level does not retroactively grant authority to earlier proposals or results.
1394
+ Discovery-only registrations created by older versions remain manual until you
1395
+ explicitly select a mode. An older command recovered late by Discord does not
1396
+ overwrite a newer mode. If a command that omitted the repository has an ambiguous
1397
+ target, send a new command specifying the repository. Quoted owner messages,
1398
+ edited messages, PR descriptions, and model output are not configuration commands.
1399
+ For example, to register `dbc-hbin/omp-superagent`, authenticate `gh` on HEAD as
1400
+ `dbc-hbin` on `github.com` and send the commands below as the configured owner in
1401
+ **a parent channel of an allowed Discord server**. GitHub organizations, repositories
1402
+ owned by someone else, DMs, and existing threads are not eligible. Putting the same
1403
+ instructions in an ordinary `/cron add` prompt will not enable this feature.
1404
+
1405
+ ```text
1406
+ /cron pr-add "every 5m" dbc-hbin/omp-superagent
1407
+ /cron show JOB
1408
+ /cron run JOB
1409
+ ```
1410
+
1411
+ `JOB` is the ID shown in the registration reply. The first poll verifies the GitHub
1412
+ repository and user ID and excludes PRs from the authenticated account. Only PRs
1413
+ created strictly after registration or resumption and still open when polled are
1414
+ eligible. PRs that open and close between polls may be missed, as may PRs opened
1415
+ within the same second when their ordering cannot be proven. `/cron run` just polls
1416
+ once immediately; it does not authorize execution. All PRs found in a poll are
1417
+ recorded, but at most one notification goes out per poll, for the open PR that has
1418
+ been waiting longest. The same PR is not announced again after a restart or
1419
+ re-registration. If delivery is uncertain, check the original proposal and delivery
1420
+ status with `/cron show JOB PR_NUMBER` in the parent channel.
1421
+
1422
+ 1. **Parent channel:** In automatic mode, Superagent opens one Discord thread using
1423
+ a bot notification with confirmed delivery as the starter message. The bot needs
1424
+ permissions to read messages and message history, create public threads, and send
1425
+ messages in threads. Forum and media channels that cannot start a thread from an
1426
+ existing message are not supported by this automatic flow. The registration message
1427
+ is not copied as if it were owner input for each PR. The lane runs only after the
1428
+ actual thread and delivery of the starter message are verified. If you need to
1429
+ proceed manually, use `/cron pr-review JOB NUMBER SHA` from the notification. If a
1430
+ thread is already open for the PR, use that thread.
1431
+ 2. **Created thread:** The lane performs a static review only of the changes fetched
1432
+ from GitHub for that SHA. It does not check out the PR branch on the host or install,
1433
+ build, or test it. The configured model provider processes the changes sent to the
1434
+ model. Replies and fix proposals may contain excerpts of the code and can be seen
1435
+ by anyone who can read that Discord thread. Check both disclosure boundaries before
1436
+ registering a private repository. Keep `stateDir` outside the Git checkout.
1437
+ Restricted mode uses an empty local directory and a stock OMP session with no tools.
1438
+ If isolation cannot be verified, for example because of custom launch arguments or
1439
+ a model provider with its own execution tools, the job is held rather than moved
1440
+ to an ordinary coding lane. Supported native APIs are `openai-completions`,
1441
+ `openai-responses`, `openai-codex-responses`, `azure-openai-responses`, and
1442
+ `anthropic-messages`. External agent CLIs are not supported.
1443
+ Limits are 32 changed files, 16 KiB of patch per file, and 64 KiB of total review
1444
+ material. A partial review does not count as approval if a patch is missing or binary
1445
+ or cannot be checked against the Git blob and file mode. The default mode publishes
1446
+ the final review summary as a GitHub comment tied to the reviewed SHA. Results and
1447
+ CI are checked again on the existing cron cadence. Use `/cron pr-status JOB NUMBER`
1448
+ to see the result and the available next commands.
1449
+ 3. **If a fix is needed:** Levels 2 and 3 automatically apply allowed proposals. To
1450
+ approve one manually, check the proposed file and replacement, then send
1451
+ `/cron pr-fix JOB NUMBER SHA DIGEST` in the same thread. The digest identifies the
1452
+ change and the full target SHA. A regular commit replaces only a uniquely matching
1453
+ string in one allowed ordinary source file under `src/`, `lib/`, `test/`, or `tests/`.
1454
+ This does not apply to forks, default or protected branches, or changes whose safety
1455
+ cannot be verified. In those cases, the contributor must make the fix in a safe
1456
+ environment. Automatic processing reviews the new SHA in the same lane. Automatic
1457
+ fixes are limited to one per PR. Up to three distinct SHAs can be reviewed under the
1458
+ same policy. If the PR keeps changing or another fix is needed after re-review,
1459
+ hand it back to the owner. To continue manually, send
1460
+ `/cron pr-review JOB NUMBER NEW_SHA` in the same thread.
1461
+ 4. **To merge:** At level 3, once the final review result has actually been delivered to
1462
+ the thread, the system checks the SHA, the current PR and change material,
1463
+ independent GitHub approval, CI, and server-side protection rules. `pending` is not
1464
+ success; it is checked again on a later poll. To approve an individual merge in
1465
+ level 1 or 2, send `/cron pr-merge JOB NUMBER SHA`. This is not standing approval:
1466
+ if the conditions are met later, check the status and send a new command. The system
1467
+ does not use `--admin`, force-push, or unconditionally queue GitHub auto-merge.
1468
+
1469
+ **Supported merge policy:** The PR must be open, non-draft, and target the default
1470
+ branch. Repository-owned rulesets must cover all branches and have no bypass actors.
1471
+ The only permitted exclusion is **this PR’s source branch in the same repository,
1472
+ specified by its exact name**. Only this allows a fix commit on that unprotected
1473
+ branch followed by a merge into the same repository’s protected default branch.
1474
+ Wildcards and exclusions for other branches are not allowed, and the bot does not
1475
+ change rules. The rules must dismiss stale approvals, require approval of the most
1476
+ recent push, enforce strict required CI, and pin required checks to a GitHub App.
1477
+ The system checks every required check from the rulesets that actually apply to the
1478
+ target branch. It does not merge if an observed check has any status other than
1479
+ `success`, including `skipped` or `neutral`, or if independent GitHub approval is
1480
+ missing. This flow may be refused for unprotected repositories, configurations with
1481
+ only classic protection, or configurations that allow only a merge queue or squash
1482
+ merges. Where direct writes to all branches are prohibited, the contributor must also
1483
+ apply any proposed fix through an allowed procedure, such as a separate fork. Use
1484
+ GitHub’s normal procedure rather than weakening protection rules.
1485
+ Merge requests use the immutable PR node ID and expected head SHA. Fix requests use
1486
+ the branch node ID and expected head SHA. The head SHA is what GitHub compares
1487
+ atomically, and the server enforces the rules at write time. The client’s CI lookup
1488
+ and write are not a single transaction. They do not lock out concurrent changes to
1489
+ protection settings or the default or target branch, or reruns of checks on the same
1490
+ head. A merge is not marked successful unless the target and both parent commits
1491
+ can be verified from the response.
1492
+
1493
+ Use `/cron pause JOB`, `/cron resume JOB`, and `/cron remove JOB` in the original
1494
+ parent channel. `/stop head` also holds discovery and new writes. Resuming a
1495
+ registration does not restore earlier write approvals or reviews. If the action cannot
1496
+ be ordered relative to Discord messages, as with `/stop head` from another messenger,
1497
+ send `/cron show JOB` in the original parent channel, then send `/cron resume JOB`
1498
+ **as a reply to that bot response**. Use `/stop` separately in the PR thread if you
1499
+ need to stop an already-running lane. Do not assume a request already submitted to
1500
+ GitHub has been canceled. If the outcome is ambiguous, use `/cron pr-status JOB NUMBER`
1501
+ in the original PR thread of the active registration for read-only reconciliation.
1502
+ If evidence is insufficient, inspect the actual merge or commit history on GitHub and
1503
+ the original Discord thread directly. `/resolve` and re-registration do not retry
1504
+ GitHub writes.
1505
+ If you sent a review command directly in the parent channel and only the thread
1506
+ creation response was lost, you can send a new message with the **same** `pr-review`
1507
+ command in the actual thread attached to that message. The thread ID must match the
1508
+ original message ID, the thread must be active in Discord, and it must not already be
1509
+ assigned. Even without a physical starter message, as with an app command, this
1510
+ recovery works if the exact Discord thread ID was already confirmed and saved.
1511
+ Without either kind of evidence, the system does not adopt a different thread.
1512
+
1513
+ ### Status, Context, Usage, and Stopping Work
1514
+
1515
+ These commands are also ordinary text messages on Discord and Telegram. On Slack,
1516
+ use `!` instead of `/`.
1517
+
1518
+ | Command | What it does |
1519
+ | --- | --- |
1520
+ | `/help` | Lists the supported commands and their targets. |
1521
+ | `/head <request>` | Sends a request explicitly to shared HEAD, regardless of the current topic’s binding. |
1522
+ | `/status` | Shows shared HEAD’s execution status, the current topic and connected lane, and pending or unresolved inputs and approvals. |
1523
+ | `/restart` | Checkpoints a busy HEAD, then replaces the Gateway and HEAD. Confirms acknowledgement in the original conversation and an actual safe shutdown, restores the same session and model, and resumes eligible goals safely. Keeps lanes running and holds uncertain effects. |
1524
+ | `/context` | Shows HEAD’s native context usage and limit. Estimates and unknown values are labeled as such. |
1525
+ | `/usage` | Shows per-provider account limits, usage, and reset times from stock `omp usage` in the configured profile. This is not session token or cost accounting. |
1526
+ | `/usage-reset` (Discord), `/usage reset` (Telegram), `!usage reset` (Slack) | Shows the number of reset credits available now by account and in total. Choose an account and press Confirm to use one of that account’s credits. |
1527
+ | `/compact [content to preserve]` | Compacts the native context of an idle HEAD. Accepts multiline preservation instructions. |
1528
+ | `/stop` | Pauses the connected lane. In an unassigned conversation, reply to the routing question or the original message of a running request to identify the target. If assignment is pending alongside HEAD execution, or edits point to different lanes, the system gives guidance in the same conversation instead of stopping a target arbitrarily. |
1529
+ | `/stop head` | Stops shared HEAD work regardless of the current topic. |
1530
+ | `/stop <lane-id>` | Pauses only the specified lane if it is registered with this instance and authorized. |
1531
+ | `/resolve [input-id]` | Explicitly cancels **one** HEAD input already marked `uncertain` so later HEAD work can proceed. It does not rerun the original task or claim that it ran or completed. |
1532
+ | `/resolve --lane <input-id>` | Explicitly cancels **one** exact `uncertain` input for the lane connected to the current conversation. It does not rerun the input, unpause the lane, or restart the Host. |
1533
+
1534
+ If the topic **assignment** itself is uncertain, the original conversation shows
1535
+ the assignment ID. Check the actual thread and delivery result, then clear the hold
1536
+ with `/resolve <assignment-id>` in that conversation. It does not repeat the
1537
+ assignment, execution, or delivery.
1538
+
1539
+ The Gateway attempts to rotate to a new HEAD session only after it confirms HEAD has
1540
+ been idle for **at least 30 consecutive minutes** and its native context usage is
1541
+ **at least 50%**. It does not rotate with outstanding approvals, execution, delivery,
1542
+ or other unresolved work, or if usage is unknown. This is separate from the lane
1543
+ `idleMs` setting. See `head.rotation` in `status` for the old and new session IDs
1544
+ and the rotation stage. Unlike automatic rotation, `/restart` restores the same
1545
+ HEAD session.
1546
+
1547
+ `/usage` with no arguments does not call a model. It sends only the numbers the
1548
+ installed OMP reports to the original conversation. Remaining limits and reset
1549
+ times for each provider use the Superagent host’s local time zone automatically.
1550
+ Results include both built-in and extension-registered providers queried by OMP.
1551
+ Any `--no-extensions`, `--extension`, `--hook`, or `--config` flags the operator
1552
+ specified in the launch command also apply when checking or using reset credits.
1553
+ Accounts show the account or organization name as masked by OMP, or an account
1554
+ number if no name is available. Unverified limits and inactive accounts are marked
1555
+ separately. Replies omit full email addresses and IDs, raw JSON, and CLI diagnostics.
1556
+ CLI lookup failures are distinguished from lookups with no verifiable limits.
1557
+ On Slack, use `!usage` or the registered `/superagent-usage` command.
1558
+
1559
+ The reset-credit menu works when the installed OMP CLI supports using a credit for
1560
+ a specific account. In the Discord command picker and allowed ordinary chat, use
1561
+ only `/usage-reset` with no arguments. On Discord, `/usage` with no arguments is
1562
+ only for checking limits. The old chat command `/usage reset` and the old registered
1563
+ form `/usage text:reset` are rejected; they do not open the reset menu or start any
1564
+ model or lane work. After updating the Gateway and HEAD, verify that Discord `/help`
1565
+ lists `/usage-reset`. Then verify that the read-only `discord-commands` output
1566
+ includes `/usage-reset` and follow the global registration procedure above. Once
1567
+ you have checked `/help`, you can send `/usage-reset` in Discord as an **ordinary
1568
+ chat message** even before registration. Mention the bot or reply to it in channels
1569
+ that require addressing. On Telegram use `/usage reset`, and on Slack use
1570
+ `!usage reset` or `/superagent-usage reset`.
1571
+ Entries such as `Codex · 계정 #7 · al…` (`계정` means “account”) show the account
1572
+ selection number for the local `omp usage reset` command and a short masked account
1573
+ or organization name when available. Full email addresses and provider account IDs
1574
+ are not sent to chat.
1575
+ Opening the menu, selecting an account, and pressing Cancel cost nothing. The
1576
+ confirmation card expires after five minutes, and only the operator in the original
1577
+ conversation can use it once by pressing Confirm. An uncertain result is not retried
1578
+ automatically. The lookup also shows credits you hold but cannot use right now. To
1579
+ use a credit for the same account again, check the remaining credits, clear the
1580
+ original hold with the indicated `/resolve` command (`!resolve` on Slack), and
1581
+ confirm on a new card.
1582
+
1583
+ `/restart` takes no arguments. On Slack, use `/superagent-restart` in the command
1584
+ picker or `!restart` in an ordinary message. Once the acceptance reply has actually
1585
+ been delivered, the Gateway handles graceful shutdown and launches a one-shot
1586
+ successor. The new HEAD verifies that it is ready in the same session and reports
1587
+ the result to the original conversation. Do not treat the acceptance notification
1588
+ alone as proof that the restart completed. You do not need to send `/stop head`
1589
+ first. The restart cancels the busy HEAD’s original approval cards, withdraws queued
1590
+ inputs, and stops any in-progress turn and goal. It also cancels native background
1591
+ work owned by HEAD and waits for actual exit. The new HEAD reuses the same session,
1592
+ working directory, and existing native profile, and checks memory configuration
1593
+ as on startup. It verifies the same model and effort and continues only the goal
1594
+ that was active immediately before restart, in its original conversation.
1595
+ Work already paused or canceled, submissions without receipts, and uncertain
1596
+ external effects are not replayed. An active goal made idle by no-progress handling
1597
+ retains the source and route it was created with. If ownership cannot be verified,
1598
+ the service is replaced but automatic goal resumption is held; the goal is not
1599
+ rerouted to the restart conversation. Independent lanes keep their original Hosts
1600
+ and approval identities. Owned work or services that have not exited, or uncertain
1601
+ ownership, leave a specific hold directing you to check the original HEAD’s native
1602
+ state rather than forcing it to exit. If the checkpoint was saved but shutdown was
1603
+ not requested yet, resolve the remaining work and try again with a new `/restart`.
1604
+ Duplicate deliveries of the earlier command and requests with uncertain shutdown
1605
+ outcomes are not retried.
1606
+ If you changed an operational setting such as `idleMs` after startup, use `/restart`
1607
+ to apply it. Replacement is held if the state directory, HEAD working directory or
1608
+ OMP launch profile, or messenger access permissions changed, or if the file was
1609
+ edited again after the request was accepted. Check the Gateway’s refusal reason in
1610
+ chat.
1611
+ Before handoff, `/stop head` and an explicit CLI `stop main` take precedence over a
1612
+ restart and prevent the successor from reviving the service. Even if native OMP is
1613
+ too busy and refuses the CLI stop, a restart requested before the stop is not
1614
+ reauthorized. Restart and stop controls and the initial approval recovery barrier
1615
+ can proceed even with an uncertain approval response waiting at the Gateway.
1616
+ Ordinary inputs keep their order, and the original answer and its effects remain
1617
+ isolated. If a question generation still pending in native OMP was canceled, late
1618
+ answers are rejected. This does not roll back consumed approvals or external
1619
+ effects. Uncertain delivery, shutdown, and startup are not automatically repeated
1620
+ for the same request; check the state and the original receipt.
1621
+
1622
+ An `uncertain` input continues to block later inputs to the same target without an
1623
+ automatic retry. HEAD may first attempt the evidence-based automatic recovery
1624
+ described below. If the result still cannot be determined, only the operator’s
1625
+ explicit `/resolve [input-id]` can discard the request. `/status` shows the exact
1626
+ held input ID. If there is more than one hold, `/resolve` without an ID is rejected
1627
+ rather than arbitrarily picking the latest one.
1628
+ `/resolve` does not resubmit the original work or claim a result. It tells the
1629
+ conversation only that the input was closed, then immediately drains the queue
1630
+ again. If you still need the same work, send a new request. Resolution does not
1631
+ change the native session, so it works even if HEAD is busy or native state cannot
1632
+ be verified. The cancellation target is durably pinned before applying the effect,
1633
+ so a restart mid-operation does not select a different request. Clearing a stored
1634
+ hold and stopping native execution are separate. Once native OMP is confirmed idle,
1635
+ the system also clears the in-memory state for the canceled admission and runs
1636
+ subsequent work while continuing to check the results of other admitted inputs.
1637
+ In ordinary Slack messages, use `!resolve [input-id]`.
1638
+
1639
+ For a lane, find the uncertain input ID via `/status` in the connected conversation.
1640
+ Check the original session and external effects first. If you choose to close the
1641
+ input while its outcome remains unknown, send `/resolve --lane <input-id>` in the
1642
+ same conversation (`!resolve --lane <input-id>` in ordinary Slack messages). Only
1643
+ the exact matching uncertain input is canceled. The command does not assert the
1644
+ outcome of the original task or rerun it. Other uncertain inputs or blockers such as
1645
+ pauses, approvals, connectivity, or ownership problems remain in place. Subsequent
1646
+ inputs take the normal route only when the lane is open and its native state can be
1647
+ verified.
1648
+
1649
+ #### Evidence-Based Automatic HEAD Recovery
1650
+
1651
+ When the exact HEAD request record confirms a Codex `usage_limit_reached` failure
1652
+ with no tool execution or partial response, HEAD checks OMP’s usage data for that
1653
+ model about every five minutes. Once a fresh report after the failure shows that
1654
+ an account usable in the same session has recovered, HEAD cancels only the failed
1655
+ input and processes subsequent queued inputs in order. The expected reset time
1656
+ having passed is not enough, nor is unclear cache or account evidence. Recovery does
1657
+ not spend a reset credit, make a test model call, or resubmit the failed task. Other
1658
+ failures and uncertain external effects stay on hold.
1659
+
1660
+ A HEAD request that ends before any tool starts, such as a model refusal
1661
+ (`provider_refusal`) or a provider error, is closed as failed without a hold if
1662
+ confirmed by the same execution record: one request, a failure response without a
1663
+ tool call, and usage records only. The next request is handled without retrying
1664
+ the failed one. Quota and usage-limit refusals stay on hold until recovery is
1665
+ confirmed, even if there is a `session_exit` after restart, a model change, or no
1666
+ adapter available. Recovery checks after restart also close previously held inputs
1667
+ of the same kind: after the receipt, only usage records and custom records such
1668
+ as `session_exit` are allowed. A later message, new execution, or tool start keeps
1669
+ the hold in place. If any tool started or the records cannot be read, the input
1670
+ remains held and the failure notice includes the exact `/resolve <input-id>`
1671
+ command. If a new HEAD message arrives during the hold, the blocking input ID and
1672
+ `/resolve` instructions are saved with a marker in one transaction and sent once.
1673
+
1674
+ When a request outcome becomes uncertain, code first checks native evidence
1675
+ against the execution identity. If sufficient evidence exists to make a judgment,
1676
+ the same HEAD runs a separate recovery decision turn in the existing native session.
1677
+ It does not create another AI supervisor or a new session, or resubmit the original
1678
+ request. The recovery turn does not start if execution, a goal, asynchronous work,
1679
+ an owned service, or approval remains outstanding, or if native state cannot be
1680
+ verified. It responds to actual events, such as reconnection or native exit, and
1681
+ does not make repeated model calls on the same evidence. The automatic decision
1682
+ turn is submitted at most once per original input. An input that has not yet been
1683
+ submitted for recovery because evidence was insufficient may be reconsidered when
1684
+ a new native receipt arrives, but a submitted recovery turn is not blindly resent.
1685
+
1686
+ HEAD uses `head_recovery` to decide whether to clear or keep the hold by reviewing
1687
+ the original request ID, the receipt tied to the session and execution generation,
1688
+ that execution’s final result, and the state of related effects. Code checks the
1689
+ evidence IDs and current state again, so a model’s explanation alone cannot clear a
1690
+ hold. Confirmed native completion or a recorded native interruption may be
1691
+ reflected in coordination state, but this is not a claim that the task’s acceptance
1692
+ criteria were verified. A missing receipt, uncertain failure, or uncertain external
1693
+ effect keeps the hold in place. Without an original receipt or evidence of execution
1694
+ ownership, no model call is made just to guess. The recovery decision is reported
1695
+ to the original conversation.
1696
+
1697
+ The recovery turn blocks every tool except `head_recovery`. It does not allow file
1698
+ edits, shell or eval, lane execution, approval bypass, or replay of the original
1699
+ request. This restriction does not permanently remove tools from normal HEAD work.
1700
+ The ordinary queue stays blocked until the recovery turn itself has ended in native
1701
+ OMP. The original identity is preserved so an intervening restart, duplicated event,
1702
+ or late result does not create a new decision or cancel a different request. An
1703
+ operator’s stop or manual resolution takes precedence over a stale recovery
1704
+ decision. For cases that cannot be resolved automatically, use the ID from `/status`
1705
+ with `/resolve`.
1706
+ The model’s decision is saved as a proposal first. Only after confirming the
1707
+ recovery turn’s exact receipt and native idle state does the system finalize the
1708
+ original input’s state and its notification together. If the process exits in
1709
+ between, the original input stays `uncertain` and can still be closed manually
1710
+ with `/resolve`. Even without a recovery receipt, the system can clear that
1711
+ recovery attempt without rerunning it if it confirms the operator’s stop intent
1712
+ and that native OMP is actually idle. Approval notifications and goal identity are
1713
+ preserved for an original request that is still running.
1714
+
1715
+ Status queries and stops do not wait for an ordinary model response. Compaction
1716
+ may call the native summarization model; it is neither an ordinary conversation
1717
+ turn nor a session reset. Compaction is refused when there is execution, an
1718
+ approval, a goal, an owned service, or an unresolved submission. Status queries
1719
+ and `/stop head` still work during compaction. The system does not announce a
1720
+ successful compaction or run later work until native completion is confirmed.
1721
+
1722
+ Stopping HEAD cancels the current work, ordinary queued HEAD requests, and
1723
+ unsubmitted configuration changes that arrived by the time the stop was accepted.
1724
+ It clears the native input queue, active execution, compaction, subtasks, and
1725
+ approvals, and stops a goal from automatically continuing. It does not assume
1726
+ that submitted configuration changes or earlier uncertain external effects were
1727
+ reversed. Any remaining services or asynchronous work are reported as observed.
1728
+ The Gateway and other lanes stay running. Requests received after the stop are
1729
+ new work; canceled requests do not rerun automatically. To stop the whole service,
1730
+ use the separate local CLI command `stop main`.
1731
+
1732
+ ### Finding Session History in Stock OMP
1733
+
1734
+ Open `/resume` in stock OMP under the same native profile. Lanes in the current
1735
+ project are searched by default. Press Tab to switch to all projects for records
1736
+ from other working directories. Native `archive` and history access by ID or path
1737
+ use the same original records. There is no separate history CLI, configuration,
1738
+ or search service.
1739
+
1740
+ Existing journals and artifacts stay in their original locations. Only links to
1741
+ the session files and artifact directories are published to the native project
1742
+ bucket. New journals are linked once materialized. Links for existing registered
1743
+ lanes are filled in when HEAD starts with the updated code. This does not wake a
1744
+ lane, move its records, or copy them as part of a migration. Editing source code
1745
+ alone does not update a running service. Check the existing profile and install
1746
+ path as well.
1747
+
1748
+ To inspect history only, use native history tools or `read` on the original path.
1749
+ `/resume` can also intentionally resume ordinary work and is not guaranteed to be
1750
+ read-only. If another writer has the original session open, native policy forks
1751
+ it. Resuming once the writer releases the session, and choosing later sessions,
1752
+ also follow native policy. This does not attach to the existing managed Host
1753
+ process or transfer execution ownership. An ordinary resume does not automatically
1754
+ load the manager or board extensions or confer manager or board authority.
1755
+ History is not a source of new permissions or instructions.
1756
+
1757
+ Use `agent: "seance"` and `sourceSession` with `task` for consultation **only if
1758
+ the actual caller advertises them** (a feature of 18.20.2). Official OMP 18.20.3
1759
+ removed seance in
1760
+ [`db5d932058ec01e5aec61bb7fb5848a87cfc3c32`](https://github.com/can1357/oh-my-pi/commit/db5d932058ec01e5aec61bb7fb5848a87cfc3c32);
1761
+ do not assume it is available throughout major version 18. Searching or reading
1762
+ sessions is separate from seance and from searching past messenger work via Mnemopi.
1763
+
1764
+ ### Responding to Approvals and Questions
1765
+
1766
+ Use `decision_ask({questions: [...]})` to ask for an owner choice that needs to be
1767
+ tracked. Each question uses `question`, `options: [{label, description?, preview?}]`,
1768
+ optional `header` and `multi` fields, and a zero-based `recommended` value. The
1769
+ existing native question card displays it. Timing out does not confirm the
1770
+ recommendation. There is no separate question message or response command.
1771
+
1772
+ HEAD uses `decision_list({})` to see open decisions and `decision_list({state: "all"})`
1773
+ to see decision history. It uses `decision_inspect({id})` to read the original
1774
+ question, choices, recommendation, response, and source, native, and card identities.
1775
+ `answering` means the answer was sent but its application in native OMP has not been
1776
+ confirmed; it is not resent. `decision_withdraw({id, sourceId, reason})` only
1777
+ withdraws pending questions based on an actual owner input from the same original
1778
+ conversation. `withdrawn` is not consent, and without `confirmedAt` it does not
1779
+ claim that cancellation was confirmed in native OMP. Ordinary `ask` and tool
1780
+ permission approvals are separate from this ledger. Operator responses are
1781
+ accepted only through the original authenticated card; HEAD does not interpret A/B
1782
+ in ordinary chat as an answer. Recording an answer does not automatically resume a
1783
+ paused lane.
1784
+
1785
+ Respond to approvals and questions with the platform UIs below. Even after changing
1786
+ topics, an unresolved approval from the earlier topic can be answered only for
1787
+ **the exact native request bound to that card**. The current topic or ordinary
1788
+ message text does not change the approval target. Expired or already-consumed
1789
+ responses are rejected. An answer attempt is durably recorded before it is passed
1790
+ to the head stream and checked against the original approval, route, and pending
1791
+ native request during recovery. An ambiguous `uiResponse` is not resent as-is.
1792
+ Telegram uses `hasPendingAnswer(id, route)` to read back stored answers for queued,
1793
+ inactive cards under their original identities and preserves unresolved queued
1794
+ answers through HEAD recovery. An inactive card does not by itself mean the answer
1795
+ was lost or successfully applied.
1796
+ The head runtime interprets topic commands, pause/resume, and approval responses and
1797
+ determines their native targets. The Gateway neither chooses a lane nor dispatches
1798
+ work automatically without an LLM decision. At startup, the system authenticates
1799
+ the messengers and restores HEAD’s native approval cards before processing inputs
1800
+ and callbacks. Answers that arrive before recovery are not treated as stale and
1801
+ consumed or acknowledged. Slack processes distinct concurrent selections and modal
1802
+ submissions in order for each card and deduplicates only actual redeliveries.
1803
+
1804
+ HEAD first reviews questions sent by lanes via `decision_ask`. For a routine
1805
+ choice within the delegated scope, HEAD selects one of the original choices and
1806
+ returns it to the lane. It records the reason internally without sending a separate
1807
+ messenger notification. If the decision materially affects scope, cost, permissions,
1808
+ or external commitments, or otherwise requires user judgment, it shows the reason
1809
+ for escalation on the original question card. HEAD does not answer execution
1810
+ approvals or ordinary native dialogs on the operator’s behalf. The `ask` cards below
1811
+ refer to the structured `askDialog` used by `decision_ask`. The Host does not send
1812
+ the OMP 19.1 built-in `ask` HTML `form` to a messenger. It cancels it immediately
1813
+ without submitting even the selected default.
1814
+
1815
+ | Platform | Approval and question UI and limits |
1816
+ | --- | --- |
1817
+ | Discord | Buttons, selects, and modals. Native `select` paginates 25 options at a time on the same card. Long options or descriptions are shortened in the menu, with full text in the card body or a text attachment. Original option values are returned unchanged. `ask` supports up to 25 options per question and 100 UTF-16 code units per label or description. Free-text drafts are not displayed in the channel card. Only responses bound to the original request, message, and session are accepted, with ACK after durable admission. |
1818
+ | Telegram | Inline buttons and **replies to the exact active bot card** for input/editor or free-text `ask` responses. Cards are limited to 4,096 UTF-16 code units and 100 lines, button labels to 64 UTF-16 code units, and `callback_data` to 64 bytes. `ask` progress and answers are persisted, and the final button callback is acknowledged after durable admission. On restart, the system edits the same card and verifies the identity in the API response; it does not treat the cache alone as readback or recreate an uncertain card. |
1819
+ | Slack | Block Kit buttons, selects with up to 100 options, and modals for input/editor or free-text `ask` responses. Labels and option descriptions are limited to 75 characters, inputs to 3,000 characters, and placeholders to 150 characters. Cards are limited to 50 blocks, 39,000 characters, and 100 KiB of semantic content. The original workspace, user, card, and modal ID and metadata are verified. The channel card shows only whether text has been entered, not the draft itself. Check the same question card for the submission or cancellation result. |
1820
+
1821
+ If a native dialog asks for a secret or cannot be represented in full on the
1822
+ platform, the system cancels the native request and directs you to the local OMP
1823
+ UI. It does not truncate the dialog or supply an arbitrary answer. Messenger
1824
+ replies are not a channel for secret input.
1825
+ Telegram persists the authenticated approval card’s account, actual chat or
1826
+ thread, and message ID marker. Closed or canceled cards leave a content-free
1827
+ tombstone so late replies after button removal, restart, or topic changes are not
1828
+ accepted as new work. Separate progress metadata for a closed dialog is cleared of
1829
+ partial `ask` selections and free-text answers. This does not delete the original
1830
+ native session or the full record of previously admitted responses.
1831
+
1832
+ Ordinary Discord output replies to the original user message when both are in the
1833
+ same physical conversation. Results sent to a new thread or in response to a
1834
+ slash interaction with no physical message omit the reply reference. A deleted
1835
+ original message is tolerated in a single Discord send request, without retrying
1836
+ the send on failure. Author mentions are disabled. Long output is split first
1837
+ according to the [delivery limits below](#5-operational-scope-and-recovery-constraints),
1838
+ with a text attachment when it exceeds those limits. In-place status messages
1839
+ are not split.
1840
+
1841
+ ```sh
1842
+ bun --no-env-file src/cli.ts stop LANE_ID --config config.local.json
1843
+ bun --no-env-file src/cli.ts stop main --config config.local.json
1844
+ ```
1845
+
1846
+ Replace `LANE_ID` with the actual value shown in `status`. If you omit the target,
1847
+ it defaults to `main`. Same-process native TUI or herdr attach to a managed RPC Host
1848
+ is not supported, and there is no attach CLI. Historical native TUI PTY records
1849
+ are preserved only as [evidence from the earlier source baseline](releases/0.1.0.md#legacy-patched-baseline).
1850
+ A log tail or a separate resumed session is not presented as an observation or
1851
+ control connection to the same Host.
1852
+ `stop LANE_ID` requests a safe shutdown of that Host, and a busy Host refuses it.
1853
+ `stop main` explicitly stops the supervised HEAD and the Gateway; the Gateway does
1854
+ not immediately restart HEAD. These commands do not force a shutdown or delete
1855
+ history, and existing busy-Host protection still applies. This is not a bulk stop
1856
+ for all lanes; check them individually. If native OMP refuses a Gateway shutdown
1857
+ request because it is busy, the service remains up. On a successful explicit stop,
1858
+ the supervisor’s restart behavior is suppressed before native shutdown so the
1859
+ intentional exit is not mistaken for a crash.
1860
+ A shutdown ACK is not process exit or slot release. Ownership and Host budget are
1861
+ released only after confirming that the native process really exited. The system
1862
+ checks for RPC disconnect, exit of the original PID, and socket absence. If any
1863
+ cannot be observed, release stays on hold.
1864
+ Disconnecting HEAD’s Gateway client does not stop the transport.
1865
+
1866
+ ### Registering macOS Login Autostart
1867
+
1868
+ The Hermes `gateway install` and `uninstall` interface is adapted to this project’s
1869
+ single-Gateway design. This project’s CLI does not have a `gateway` subcommand:
1870
+
1871
+ ```sh
1872
+ bun --no-env-file src/cli.ts install --config config.local.json
1873
+ bun --no-env-file src/cli.ts status --config config.local.json
1874
+ bun --no-env-file src/cli.ts uninstall --config config.local.json
1875
+ ```
1876
+
1877
+ - `install` prepares a per-instance registration in the current account’s
1878
+ LaunchAgents and enables startup at the next login. It does not bootstrap the
1879
+ registration immediately or start the Gateway, models, or messengers.
1880
+ - At login, the launcher invokes the existing CLI `start` once using absolute
1881
+ paths. This runs **after login** on macOS; it is not a boot daemon. It does not
1882
+ use `KeepAlive` supervision or retries, so an explicit stop and the one-shot
1883
+ successor from a messenger `/restart` do not compete with OS restarts.
1884
+ - Check `autostart` in `status` for registration and launchd run state. An
1885
+ installed plist or an exited launcher does not mean the Gateway or HEAD is
1886
+ ready or that an actual message was answered successfully.
1887
+ - `uninstall` removes only the exact autostart registration the instance owns.
1888
+ It does not forcibly interrupt a running launcher. It leaves the existing
1889
+ Gateway, HEAD, lanes, sessions, and secret files intact. Use `stop main`
1890
+ separately to stop the service. Running only `stop main` leaves registration in
1891
+ place, so the service starts again at the next login.
1892
+ - For autostart, provide the configured credential names for every messenger in
1893
+ the owner-only `FILE.env`. Credentials available only in the current shell
1894
+ do not qualify for successful installation. Tokens and arbitrary environment
1895
+ variables are not copied into the plist. Native model authentication uses the
1896
+ account’s existing OMP settings.
1897
+ - If you move Bun, the repository, or the config file, reinstall. Service manager
1898
+ errors and registrations owned by someone else or tampered with are not
1899
+ reported as successes, and `--force` cannot take them over.
1900
+ - The native `command[0]` must also be an executable absolute path. The login
1901
+ environment does not read interactive shell startup files or copy shell-only
1902
+ environment variables for model authentication or configuration.
1903
+ - After a crash or power loss, stale sockets, reused PIDs, or an unresolved
1904
+ restart record can cause existing Gateway ownership checks to hold startup.
1905
+ The login launcher does not clear or bypass them, or retry a failed startup
1906
+ automatically. Successful registration does not guarantee recovery from every
1907
+ crash.
1908
+ - Linux/systemd or Windows service installation and automatic Gateway crash
1909
+ restarts are outside the scope of these commands.
1910
+
1911
+ ### Add a remote worker
1912
+
1913
+ Use this when the head should open an ordinary lane on another machine, for example
1914
+ when you say **“test this repository on Linux.”** Only the head needs messenger
1915
+ credentials. Use a build with `omp-sa worker` on **both** machines (for an unreleased
1916
+ checkout, use the source checkout instructions in [Local preparation](#1-local-preparation--does-not-start-the-bot), not an older npm release).
1917
+
1918
+ 1. **On the worker:** install Git, Bun, stock OMP and `omp-superagent` as described in [Local preparation](#1-local-preparation--does-not-start-the-bot).
1919
+ Install the executables and `omp-superagent` outside the checkout you want to
1920
+ enroll, in paths that other users cannot replace.
1921
+ Configure the worker account's own OMP provider access (not a shell-command
1922
+ API key or remote auth broker) and enable its native
1923
+ memory backend (for example `omp config set memory.backend mnemopi` if none
1924
+ is enabled). Prepare a dedicated clean clone of the same Git repository
1925
+ **at the requested commit**. Enable **OpenSSH
1926
+ server** for this account over your private network (e.g. a tailnet). The
1927
+ endpoint must enforce OpenSSH `authorized_keys` forced commands; Tailscale
1928
+ SSH's own login policy is not a substitute. No public port, second head,
1929
+ `omp-sa setup` or `omp-sa start` is needed on the worker.
1930
+ 2. **On the head:** verify the worker's SSH host-key fingerprint with its operator
1931
+ and trust it in the head account's `known_hosts`. Use a directly resolvable DNS
1932
+ name/IP, not a nickname from `~/.ssh/config`. If Tailscale SSH handles port 22,
1933
+ use a separate OpenSSH listener on the private network, pin its host key as
1934
+ `[host]:port` in `known_hosts`, and use `dev@linux-box:port` in both `worker add`
1935
+ calls. For the default SSH port:
1936
+ ```sh
1937
+ omp-sa worker add dev@linux-box --config ./config.local.json
1938
+ ```
1939
+ 3. **On the worker, as `dev`:** run the `worker init` command printed in step 2.
1940
+ Keep its generated **public** head key and replace the example repository path:
1941
+ ```sh
1942
+ omp-sa worker init --head-key 'ssh-ed25519 …' --repo "$HOME/src/my-app"
1943
+ ```
1944
+ This authorizes a dedicated forced-command key in that account's
1945
+ `~/.ssh/authorized_keys`. Do not copy the head's private key, bot tokens or
1946
+ configuration. Use a dedicated OS account if the worker should not have access
1947
+ to your other files: an OMP lane runs tools as the worker user, not in a sandbox.
1948
+ 4. **Back on the head:** repeat the same `worker add` command. Enrollment is complete
1949
+ when the head reports **`verified`**, not when it prints the initial pairing
1950
+ instructions. To prefer this worker for one **specific head checkout**,
1951
+ repeat `worker add` with `--default --local-repo /path/on/head/my-app`.
1952
+ Omitting `--local-repo` uses the configured `headCwd`. Other checkouts with
1953
+ the same Git origin do not inherit permission to send ordinary tasks there.
1954
+
1955
+ Use `omp-sa worker list --config ./config.local.json` to see verified enrollments
1956
+ without contacting the workers. To check one now, run
1957
+ `omp-sa worker doctor dev@linux-box --config ./config.local.json` using the exact
1958
+ enrolled destination, including its port if specified. It checks the worker identity
1959
+ and available slots. For a default worker it also verifies the current revision of
1960
+ the approved head checkout. A blocked check exits nonzero; neither command starts a lane.
1961
+
1962
+ Now ask for a remote lane or name the required platform in chat. Superagent matches
1963
+ the repository by Git origin, not folder name; local edits and ignored files are
1964
+ not synchronized. Start with a clean, committed source tree. The worker reserves
1965
+ its checkout for one resident lane; it does not fetch, switch branches, or discard
1966
+ edits. Follow-ups stay on the same worker and native session; disconnecting SSH
1967
+ does not stop that Host. A cold reopen is held if the checkout has changed.
1968
+ Chat replies and approval cards use the original route; messenger file transfer
1969
+ and access to the head's local SQLite board are not provided across SSH.
1970
+ Remote lanes require the normal stock OMP command without extra head-side flags:
1971
+ custom tool/profile/approval flags are never silently removed to run remotely.
1972
+ Use a dedicated worker OMP profile without ambient plugins. Worker startup
1973
+ rejects project execution configuration (such as `.omp/`, `.env` or Git filter
1974
+ drivers), linked worktrees and submodules rather than loading or rewriting
1975
+ them. An operator who needs a custom model extension can list its trusted,
1976
+ absolute module path in a private `worker-extensions.json` array in the worker's
1977
+ OMP agent directory (`0600`, outside enrolled checkouts).
1978
+ Check `omp-sa status --config ./config.local.json` for the saved placement.
1979
+ To revoke new SSH connections, remove **only this enrollment's key** on the
1980
+ worker. That is not a stop command for an already running lane.
1981
+
1982
+ ## 5. Operational scope and recovery constraints
1983
+
1984
+ - Autonomous work uses the existing native task/job, goal, and workflow owners. It preserves
1985
+ the original authorized objective, source and route, approvals, tool exclusions, pause and
1986
+ cancel state, and holds for uncertain outcomes. After a durable lane report, the head directs
1987
+ only the remaining authorized work; it does not poll with the model while waiting or create
1988
+ a separate scheduler. A saved goal does not guarantee that prompts will replay after a crash,
1989
+ that work will run while unloaded, or that the task will finish.
1990
+ - Changes to launch settings and role files take effect on a new Host launch or after an
1991
+ authorized restart. Installing or editing source code does not prove that the changes are
1992
+ live. Even a paused goal can retain its Host and slot under the shutdown guard if the goal
1993
+ is still enabled.
1994
+ - The per-session Rust Host owner maintains native OMP stdio and the reconnection socket.
1995
+ The session file, lease, connection, execution, and actual process exit are distinct.
1996
+ Do not assume the Host is safely idle or forcibly reclaim it without confirming the state
1997
+ of the native UI, asynchronous work, goals, and owned services, and checking that persistence
1998
+ has finished. A shutdown ACK alone does not release the budget or ownership. See
1999
+ [Execution budget and Host lifecycle](design/execution.md#execution-budget-and-host-lifecycle).
2000
+ - Input attachments on all platforms are limited to 10 per request, 20 MiB per file, and
2001
+ 40 MiB total. Declared sizes are checked against actual stream sizes, and redirects are not
2002
+ followed. If Telegram omits `file_size`, the size is stored as unknown (`null`), distinct
2003
+ from a known size of zero bytes. The actual bytes downloaded still count against the
2004
+ per-file, per-request, and image limits. The Gateway saves files in a dedicated directory
2005
+ and returns each file's path and SHA-256 once the entire request completes. The head verifies
2006
+ the receipts using the request ID and file order. PNG, JPEG, GIF, and WebP content signatures
2007
+ are checked, and the request is canceled if the SHA-256 of the bytes to be passed to the
2008
+ model does not match the receipt. RPC base64 inputs have a separate aggregate limit of 8 MiB
2009
+ of decoded image data. Other files are provided as local paths. Arbitrary URL downloads and
2010
+ automatic document conversion are not supported. On restart, the Gateway cleans up only
2011
+ incomplete downloads whose ownership and format it can verify. Completed attachments are
2012
+ kept. Credentials and signed download URLs are not put in model prompts. If an attachment
2013
+ cannot be downloaded safely, the model does not start for that request.
2014
+ - Discord and Telegram reply reference IDs, authors, and message bodies, plus selected quotes
2015
+ in Telegram, are passed to the head and included in explicit lane handoffs. Quotes are data,
2016
+ not new commands, authority, or destinations. The initial intake snapshot is unchanged by
2017
+ edits, deletions, or redelivery of the original. Deleted or inaccessible references are
2018
+ represented by their known IDs and `null` fields. Discord looks up references only in the
2019
+ same authorized physical channel. Telegram replies to approval cards keep their existing
2020
+ procedure. Voice-message status and duration are passed through, but this is not automatic
2021
+ transcription. Inputs or edits without meaningful text or supported attachments, such as
2022
+ sticker-only Discord messages, are not accepted as new work.
2023
+ - Lane repository and board repository channel discovery use a Git process with `GIT_DIR`,
2024
+ `GIT_WORK_TREE`, and other `GIT_*` variables stripped from the launching shell's environment.
2025
+ This is not isolation of the entire general tool environment.
2026
+ - Allowed input resources differ by platform:
2027
+ - Discord: Only original HTTPS URLs on `cdn.discordapp.com` or `media.discordapp.net` with
2028
+ the path `/attachments/<numeric ID>/<numeric ID>/…` are allowed.
2029
+ - Telegram: The ledger stores only the token-free `telegram-file:<file_id>`. The original
2030
+ route recorded at intake is checked against the file metadata, then `getFile` is used to
2031
+ check the 20 MiB limit. The `api.telegram.org/file/botTOKEN/…` URL is used only for an
2032
+ immediate HTTPS download and is not kept in the ledger or in errors. File path traversal
2033
+ is also rejected.
2034
+ - Slack: Starting from the token-free `slack-file:<file_id>`, `files.info` is used to verify
2035
+ that the file is a hosted file owned by the operator, and to check its workspace and share
2036
+ in the original conversation or thread. The bot Authorization header is used only on
2037
+ the HTTPS `files.slack.com/files-pri/TEAM-FILE/…` path for that team and file. Files that
2038
+ are external links are not accepted.
2039
+ - To receive a file you created as a deliverable, give its exact path relative to the working
2040
+ directory on the first line of a new ordinary message, for example `attach: reports/result.pdf`.
2041
+ If you specify `cwd:` on the first line, put the attachment directive on the next line.
2042
+ Attachments are limited to one file per request and 8 MiB. Hidden paths, links, and runtime
2043
+ or credential paths are rejected. The file is sent only to the original Discord, Telegram,
2044
+ or Slack work conversation. If there is no work thread, it goes to the conversation where
2045
+ the request originated. Edited messages, app slash interactions, and model replies cannot
2046
+ authorize attachments. Attachments are also unavailable in restricted groups.
2047
+ - Long output has different limits from input attachments. An ordinary Discord reply longer
2048
+ than 2,000 UTF-16 units is split at paragraph, line, or whitespace boundaries into up to
2049
+ five messages and sent in order. If a code block crosses a boundary, it is closed in the
2050
+ preceding message and reopened with the same language in the next. Only the first message
2051
+ carries the reply reference to the original message, and the delivery receipt uses that
2052
+ first message's ID. If all parts are sent, the later message IDs are also recorded so a
2053
+ reply to any part can find the original task. If delivery fails after sending only some
2054
+ parts, nothing is resent and the outcome stays `uncertain`. Separate physical conversations
2055
+ can receive messages in parallel, but ledger order is preserved within each physical
2056
+ conversation. Telegram and Slack mutation and send APIs are not retried automatically.
2057
+ Reconnecting a read or poll is not the same as repeating an uncertain external effect.
2058
+
2059
+ | Platform | Ordinary text | Long output |
2060
+ | --- | --- | --- |
2061
+ | Discord | Up to 2,000 UTF-16 units | Split into up to five messages; longer replies are sent as a text attachment (up to 8 MiB). |
2062
+ | Telegram | Up to 4,096 UTF-16 units | Text file sent with `sendDocument`, up to 50 MiB. Sent without `parse_mode`, with previews and paid broadcasts disabled. |
2063
+ | Slack | Up to 3,000 characters of plain text | Text file, up to 8 MiB. Posted to the original channel/thread via `files.getUploadURLExternal` → HTTPS upload → `files.completeUploadExternal`. The retired `files.upload` is not used. |
2064
+
2065
+ - After reconnect or restart, Discord and Slack catch up **only in conversations already
2066
+ recorded and only after the last message ID**. They do not recover the full history on a
2067
+ fresh installation, previously unseen threads that received messages while offline, or edits
2068
+ and deletions before the cursor. The bot needs the necessary history scopes or permissions
2069
+ and actual access to the messages and attachments. Slack retention limits, rate limits, and
2070
+ incomplete history are not reported as successful recovery. Telegram does not fetch history;
2071
+ it uses only the durable update offset and the retention window of up to 24 hours described
2072
+ above. The DM lookup cursor is per physical channel. Logical topic boundaries follow the
2073
+ persisted control-message ID order, so a late message is not arbitrarily moved to the
2074
+ currently selected topic. A redelivered command also stays in the original topic in which
2075
+ it was accepted and does not roll back the current selection.
2076
+ - Inbound and outbound ledgers distinguish redeliveries but do not guarantee exactly-once
2077
+ external effects. An uncertain execution or delivery is not treated as successful or
2078
+ blindly retried. If a lane has an input whose submission is unresolved, later queued inputs
2079
+ are not dispatched either. Neither a new follow-up nor resume bypasses that fence or clears
2080
+ the original uncertainty. Idle reclamation and the end of a model turn do not mean the
2081
+ user's work is complete or has passed verification.
2082
+
2083
+ ## 6. Developer verification
2084
+
2085
+ Set up remote registration and lane control as described in [Add a remote worker](#add-a-remote-worker).
2086
+ With the OpenSSH client and server and stock OMP installed, the command below tests
2087
+ registration → remote start → disconnect/reconnect → follow-up message and reply → shutdown
2088
+ without a separate machine. It uses a temporary HOME, a dedicated key, loopback `sshd`, and an
2089
+ offline model. It does not test a real tailnet connection or messenger account.
2090
+
2091
+ ```sh
2092
+ OMP_SUPERAGENT_WORKER_SSH_TEST=1 bun test test/native-worker-ssh.test.ts
2093
+ ```
2094
+
2095
+ Run the general regression checks with `bun run check` and `bun run test`. The test script
2096
+ builds the native binaries, then runs the test files with two isolated workers. To check for
2097
+ order dependencies, run the same set serially with `bun test test`. The default tests exclude
2098
+ opt-in native/PTY scenarios. Do not substitute a bare `bun test`, which also discovers tests
2099
+ in `.upstream`. In a checkout with OMP and managed omp-superkit ready, `bun run test:ci`
2100
+ runs type checks, Rust Host owner and Gateway tests, and local project/native/PTY and
2101
+ omp-superkit integration regressions. `scripts/ci.ts` uses the active package's entry point.
2102
+ CI and targeted native/PTY runs use the same selector to find the currently installed
2103
+ standalone CLI on `PATH`. It skips `node_modules/.bin`, which Bun puts at the front, and does
2104
+ not fall back to the SDK CLI or an older binary. It prints the selected OMP version and
2105
+ executable path and checks metadata for the public RPC and process observation capabilities.
2106
+ `test:ci` itself does not download, build, or update OMP. Python 3 is required, and launchd
2107
+ checks run only on macOS. `test:ci` shares only the native binaries extracted by the
2108
+ installed CLI in a temporary per-run cache. Each fixture's HOME, settings, and authentication
2109
+ remain isolated. Setting `OMP_TEST_NATIVES_DIR` to a trusted absolute path uses that path
2110
+ instead of the temporary cache; it is not deleted after the run.
2111
+
2112
+ GitHub Actions runs for PRs, `main`, manual dispatches, and `v*` release tags on Ubuntu 24.04
2113
+ and macOS 15 ARM64. Both runners test only the SDK baseline; replay of the original oracle
2114
+ runs on macOS. Publishing a release requires tests to pass on both runners and package
2115
+ installation to pass on all four platforms, including macOS Intel. Each runner uses
2116
+ `bun run test:baseline` to download the official CLI matching the SDK to a temporary directory
2117
+ and verify its SHA-256 and `omp --version`. It reuses the native executables prepared by
2118
+ `bun install --frozen-lockfile` and puts that CLI at the front of `PATH` only while running the
2119
+ shared test runner. The same command run locally does not replace the existing OMP on `PATH`.
2120
+ The download requires internet access, curl, and shasum. CI does not run OMP 18. When needed,
2121
+ run the same checks manually with `bash scripts/test-omp.sh v18.22.2`, or specify `v18.20.3`
2122
+ to test the older asynchronous task API.
2123
+
2124
+ **OMP upstream compatibility** runs every Monday at 04:17 UTC or on manual dispatch in
2125
+ Actions. It looks up the latest official upstream release tag once, then runs the same
2126
+ checks against that tag on Ubuntu and macOS ARM64. Reproduce a failing tag locally with
2127
+ `bash scripts/test-omp.sh vX.Y.Z`. Missing required capabilities or regressions fail this
2128
+ workflow without affecting the baseline checks for PRs and releases. A compatibility check
2129
+ alone does not change product support or the SDK lockfile. This check does not verify live
2130
+ accounts, paid providers, herdr, or real login/reboot, and does not establish support for the
2131
+ historical same-process TUI attach behavior. See the corresponding Actions run for the
2132
+ actual result of the latest upstream check. Do not reuse the
2133
+ [previous release's verification records for stock 18.20.2 and patched 18.20.0](releases/0.1.0.md#verification-records)
2134
+ as evidence for the current SDK baseline or later changes.
2135
+
2136
+ ### Targeted native and omp-superkit regression tests
2137
+
2138
+ Native scenarios explicitly enable the existing opt-in. If `OMP_TEST_COMMAND` is unset, they
2139
+ automatically select the currently installed stock CLI from `PATH`. They use the actual CLI
2140
+ and socket, a deterministic local provider, and a Messenger that records messages. User
2141
+ settings and authentication are isolated. These commands do not verify live messenger
2142
+ login or same-process TUI/herdr attach. Automatic CLI selection does not enable native/PTY
2143
+ or external-package opt-ins.
2144
+
2145
+ ```sh
2146
+ OMP_SUPERAGENT_NATIVE_TEST=1 bun test test/native-host.test.ts test/native-runtime.test.ts test/native-model-selection.test.ts test/native-board.test.ts test/native-gateway.test.ts
2147
+ OMP_SUPERAGENT_NATIVE_TEST=1 bun test test/native-autonomy.test.ts
2148
+ ```
2149
+
2150
+ Only when verifying a deliberately isolated installation, set `OMP_TEST_COMMAND` to a
2151
+ nonempty JSON array of strings containing the standalone CLI argv. Direct invocations,
2152
+ fixture subprocesses, PTY runs, and `test:ci` all respect the same override. Invalid argv,
2153
+ unsupported versions, and execution failures cause the test to fail rather than falling
2154
+ back to automatic selection. Even if the first override argument is `omp`, it is resolved
2155
+ to the installed CLI, not a dependency shim. The PTY test for fresh setup links the selected
2156
+ executable into the isolated `PATH` so the actual setup can find it. As required by the
2157
+ product contract, fresh setup saves only one executable and does not inject extra CLI
2158
+ options from the test override. Explicit options in existing settings are preserved.
2159
+
2160
+ The omp-superkit composition regression reads and runs the specified entry point without
2161
+ modifying or installing the external checkout. If the environment variable is omitted,
2162
+ composition with the external package is skipped.
2163
+
2164
+ ```sh
2165
+ OMP_TEST_ULW_EXTENSION=/absolute/path/to/omp-superkit/index.ts bun test test/skills.test.ts
2166
+ ```
2167
+
2168
+ New revisions and reactivation of existing revisions must also pass an isolated offline
2169
+ composition probe that uses the shipped OMP SDK's actual prompt renderer and ExtensionRunner.
2170
+ See the [managed integration contract](design/execution.md#managed-omp-superkit-integration)
2171
+ for the checks. Successful import or composition does not prove that the model was called,
2172
+ an agent ran, a goal was created, or a workflow finished.
2173
+
2174
+ ### Source and npm releases
2175
+
2176
+ GitHub source archives contain only committed source and build the Rust Gateway and Host
2177
+ owner for the current platform at installation time. The npm `.tgz` includes executables
2178
+ and license notices for all four platforms, so the installation machine does not need to
2179
+ build Rust code. Both distributions require Bun and a separately installed OMP at runtime.
2180
+ Managed omp-superkit is prepared during installation and is not bundled in the archives.
2181
+ CI, baseline tests, and release scripts are only available in the source checkout, not in
2182
+ the npm package.
2183
+
2184
+ Set the version in `package.json`, prepare `docs/releases/<version>.md`, and commit the
2185
+ intended changes. The [CI native build matrix](../.github/workflows/ci.yml) runs
2186
+ `bun run build:native --package` on each target (`darwin-arm64`, `darwin-x64`, `linux-arm64`,
2187
+ and `linux-x64`) to produce the two executables and notices. In addition to the usual source
2188
+ build tools, this requires Rust `rust-docs`. Static Linux release binaries require the musl
2189
+ Rust target for the corresponding architecture and `musl-gcc`. The packaging job collects
2190
+ the outputs in `gateway/bin/` and `host-owner/bin/` and then runs `bun run release`. To package
2191
+ locally with the same command, you need a clean Git checkout and executable binaries and
2192
+ notices for all four targets, all built from the same commit. Running only
2193
+ `bun install --frozen-lockfile` in a source checkout prepares the current platform, so it
2194
+ does not meet this requirement.
2195
+
2196
+ [`scripts/release.ts`](../scripts/release.ts) exports HEAD with `git archive` and creates the
2197
+ prepared npm package with `bun pm pack --ignore-scripts`. It checks for native files and
2198
+ notices and verifies executable permissions. It produces `dist/omp-superagent-<version>.tar.gz`
2199
+ and `dist/omp-superagent-<version>.tgz`, plus a `.sha256` for each. The command without arguments
2200
+ does not publish anything.
2201
+
2202
+ After an approved new version tag is pushed to the remote, CI must pass the Linux and macOS
2203
+ baseline tests and npm package installation checks on all four platforms. It then runs
2204
+ `bun run release --publish` to publish **the verified artifacts without rebuilding them**
2205
+ to GitHub Releases. A separate npm job downloads the same `.tgz` from that release, verifies
2206
+ its SHA-256, and publishes it to npm using GitHub Actions OIDC. The version, tag, and commit
2207
+ must agree, and an ordinary tag push does not overwrite an existing release. Only with
2208
+ explicit approval to replace an existing release, move its tag to a commit that has already
2209
+ been verified and merged, then manually run `ci.yml` on that tag with `replace_release=true`.
2210
+ The force-push of the tag itself runs verification only and does not publish. The manual
2211
+ run must also pass verification before replacing the attachments and notes and publishing
2212
+ the same tarball to npm. An already published npm version cannot be overwritten with the
2213
+ same version number.
2214
+
2215
+ As a one-time setup, go to the npm settings for the `omp-superagent` package and add GitHub
2216
+ Actions under **Trusted publishing**. Set the user or organization to `dbc-hbin`, the
2217
+ repository to `omp-superagent`, and the workflow filename to `ci.yml`. Leave the environment
2218
+ name blank and allow `npm publish`. No local `npm login` or stored npm token is needed
2219
+ afterward. If the npm publish result is uncertain, check the registry first for the exact
2220
+ version and tarball hash. Rerun the failed npm job only if the version is absent and the
2221
+ cause has been addressed. There is no need to rerun the GitHub Release job or verification
2222
+ jobs that passed. External publishing, pushing tags, and restarting the production Gateway
2223
+ are explicit actions separate from passing local tests.