ScuttleBot

1
# Codex Relay Fleet Launch
2
3
This is the rollout guide for making local Codex terminal sessions IRC-visible and
4
operator-addressable through scuttlebot.
5
6
Codex and Gemini are the canonical terminal-broker reference implementations in
7
this repo. The normative path and convention contract lives in
8
[`../scuttlebot-relay/ADDING_AGENTS.md`](../scuttlebot-relay/ADDING_AGENTS.md).
9
10
Source of truth:
11
- installer: [`scripts/install-codex-relay.sh`](scripts/install-codex-relay.sh)
12
- broker: [`../../cmd/codex-relay/main.go`](../../cmd/codex-relay/main.go)
13
- shared connector: [`../../pkg/sessionrelay/`](../../pkg/sessionrelay/)
14
- dev wrapper: [`scripts/codex-relay.sh`](scripts/codex-relay.sh)
15
- hooks: [`hooks/scuttlebot-post.sh`](hooks/scuttlebot-post.sh), [`hooks/scuttlebot-check.sh`](hooks/scuttlebot-check.sh)
16
- runtime docs: [`install.md`](install.md), [`hooks/README.md`](hooks/README.md)
17
- canonical relay contract: [`../scuttlebot-relay/ADDING_AGENTS.md`](../scuttlebot-relay/ADDING_AGENTS.md)
18
19
Installed files under `~/.codex/`, `~/.local/bin/`, and `~/.config/` are generated
20
copies. Point other engineers and agents at the repo docs and installer, not at one
21
person's home directory.
22
23
Runtime prerequisites:
24
- `codex`
25
- `go`
26
- `curl`
27
- `jq`
28
29
## Canonical pattern
30
31
Future terminal runtimes should copy this shape:
32
- broker entrypoint in `cmd/{runtime}-relay/main.go`
33
- tracked installer in `skills/{runtime}-relay/scripts/install-{runtime}-relay.sh`
34
- rollout guide in `skills/{runtime}-relay/FLEET.md`
35
- install primer in `skills/{runtime}-relay/install.md`
36
- runtime hook docs in `skills/{runtime}-relay/hooks/README.md`
37
- shared transport and presence logic in `pkg/sessionrelay/`
38
39
Ownership conventions:
40
- the broker owns `online` / `offline`
41
- the broker owns addressed operator message injection into the live terminal
42
- the broker owns outbound activity and assistant-message mirroring when the runtime exposes a reliable session log
43
- hooks remain the pre-action fallback and non-broker compatibility layer
44
45
## What this gives you
46
47
For each local Codex session launched through `codex-relay`:
48
- a stable nick: `codex-{repo}-{session}`
49
- immediate `online` post when the session starts
50
- mirrored tool activity from the active session log
51
- mirrored assistant messages from the active session log
52
- continuous addressed IRC input injection into the live terminal session
53
- explicit pre-tool fallback interrupts before the next action
54
- `offline` post on exit
55
56
Transport choice:
57
- `SCUTTLEBOT_TRANSPORT=http` keeps the bridge/API path and now uses presence heartbeats
58
- `SCUTTLEBOT_TRANSPORT=irc` logs the session nick directly into Ergo for real presence
59
60
This is the production control path for a human-operated Codex terminal. If you
61
want an always-on IRC-resident bot instead, use `cmd/codex-agent`.
62
63
## One-machine install
64
65
Run from the repo checkout:
66
67
```bash
68
bash skills/openai-relay/scripts/install-codex-relay.sh \
69
--url http://localhost:8080 \
70
--token "$(./run.sh token)" \
71
--channel general
72
```
73
74
Then launch:
75
76
```bash
77
~/.local/bin/codex-relay
78
```
79
80
## Fleet rollout
81
82
For multiple workstations or VM images:
83
84
1. Distribute this repo revision.
85
2. Run the tracked installer on each machine.
86
3. Launch Codex through `~/.local/bin/codex-relay` instead of `codex`.
87
88
Example:
89
90
```bash
91
bash skills/openai-relay/scripts/install-codex-relay.sh \
92
--url http://scuttlebot.example.com:8080 \
93
--token "$SCUTTLEBOT_TOKEN" \
94
--channel fleet \
95
--transport irc \
96
--irc-addr scuttlebot.example.com:6667
97
```
98
99
If you need hooks present but inactive until the server is live:
100
101
```bash
102
bash skills/openai-relay/scripts/install-codex-relay.sh --disabled
103
```
104
105
Later, re-enable by editing `~/.config/scuttlebot-relay.env` or rerunning:
106
107
```bash
108
bash skills/openai-relay/scripts/install-codex-relay.sh --enabled
109
```
110
111
## What the installer changes
112
113
The installer is intentionally narrow. It:
114
- copies the tracked hook scripts into `~/.codex/hooks/`
115
- builds and installs `codex-relay` into `~/.local/bin/`
116
- merges required hook entries into `~/.codex/hooks.json`
117
- ensures `features.codex_hooks = true` in `~/.codex/config.toml`
118
- writes `SCUTTLEBOT_*` settings into `~/.config/scuttlebot-relay.env`
119
- defaults IRC auth to auto-registration by removing any stale `SCUTTLEBOT_IRC_PASS`
120
- keeps one backup copy as `*.bak` before overwriting an existing installed file
121
122
It does not:
123
- replace the real `codex` binary in `PATH`
124
- force a fixed nick across sessions
125
- require IRC to be up at install time
126
127
Useful shared env knobs:
128
- `SCUTTLEBOT_TRANSPORT=http|irc` selects the connector backend
129
- `SCUTTLEBOT_CHANNEL` is the primary control channel
130
- `SCUTTLEBOT_CHANNELS=general,task-42` seeds extra startup work channels
131
- `SCUTTLEBOT_IRC_ADDR=127.0.0.1:6667` sets the real IRC address when transport is `irc`
132
- `SCUTTLEBOT_IRC_PASS=...` uses a fixed NickServ password instead of auto-registration; leave it unset for the default broker convention
133
- `SCUTTLEBOT_IRC_DELETE_ON_CLOSE=0` keeps auto-registered session nicks after clean exit
134
- `SCUTTLEBOT_INTERRUPT_ON_MESSAGE=1` interrupts the live Codex session only when Codex appears busy; idle sessions are injected directly and auto-submitted
135
- `SCUTTLEBOT_POLL_INTERVAL=2s` controls how often the broker checks for new addressed IRC messages
136
- `SCUTTLEBOT_PRESENCE_HEARTBEAT=60s` controls HTTP presence touches; set `0` to disable
137
- `SCUTTLEBOT_MIRROR_REASONING=1` mirrors Codex reasoning blocks to IRC, prefixed with `💭` (off by default)
138
- `SCUTTLEBOT_ACTIVITY_VIA_BROKER=1` tells `scuttlebot-post.sh` to stay quiet so broker-launched sessions do not duplicate activity posts
139
140
Installer auth knobs:
141
- default or `--auto-register`: scrub `SCUTTLEBOT_IRC_PASS` from the shared env file and let the broker auto-register ephemeral session nicks
142
- `--irc-pass <passphrase>`: persist a fixed NickServ password in the shared env file
143
144
Live channel commands:
145
- `/channels`
146
- `/join #task-42`
147
- `/part #task-42`
148
149
## Operator workflow
150
151
1. Watch the configured channel in scuttlebot.
152
2. Wait for a new `codex-{repo}-{session}` online post.
153
3. Mention that nick when you need to steer the session.
154
4. `cmd/codex-relay` injects the addressed IRC message into the live terminal session.
155
5. The pre-tool hook still blocks on the next `Bash|Edit|Write` if needed.
156
157
Examples:
158
159
```text
160
operator: codex-scuttlebot-a1b2c3d4 stop and re-read bridge.go
161
operator: codex-scuttlebot-a1b2c3d4 wrong file, inspect policies.go first
162
```
163
164
Ambient channel chat does not block the loop. Only explicit nick mentions do.
165
166
## When IRC/scuttlebot is down
167
168
Disable without uninstalling:
169
170
```bash
171
SCUTTLEBOT_HOOKS_ENABLED=0 ~/.local/bin/codex-relay
172
```
173
174
Or persist the disabled state in the shared env file:
175
176
```bash
177
bash skills/openai-relay/scripts/install-codex-relay.sh --disabled
178
```
179
180
The hooks and broker soft-fail if the HTTP API is unavailable. Codex still runs;
181
you just lose the IRC coordination layer until the server comes back.
182
183
## Adding more runtimes
184
185
Do not fork the protocol. Reuse the same control contract:
186
- post activity out after each action
187
- mirror assistant progress and replies when the runtime exposes them
188
- accept addressed operator instructions back in before the next action
189
- use stable, human-addressable session nicks
190
- keep the repo as the source of truth
191
192
The shared authoring contract lives in
193
[`../scuttlebot-relay/ADDING_AGENTS.md`](../scuttlebot-relay/ADDING_AGENTS.md).
194

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button