omp-superagent 0.1.9 → 0.1.11

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