@@ -5,12 +5,13 @@ Standalone Rust CLI for autonomous coding loops.
55## Prerequisites
66
77- Rust stable toolchain
8- - Codex CLI installed and available in ` PATH `
8+ - Codex CLI or OpenCode CLI installed and available in ` PATH `
99
10- Check your Codex installation:
10+ Check your installation:
1111
1212``` bash
13- codex --version
13+ codex --version # for Codex engine
14+ opencode --version # for OpenCode engine
1415```
1516
1617## Why
@@ -21,13 +22,34 @@ codex --version
21222 . Write plan/spec artifacts.
22233 . Execute implementation loop with guarded completion.
2324
25+ ## Engines
26+
27+ Forge supports multiple AI coding engines:
28+
29+ - ** Codex** (default) - OpenAI's Codex CLI
30+ - ** OpenCode** - Open source AI coding agent
31+
32+ Select the engine via CLI flag:
33+
34+ ``` bash
35+ forge run --engine codex # default
36+ forge run --engine opencode # use OpenCode
37+ ```
38+
39+ Or configure in ` .forgerc ` :
40+
41+ ``` toml
42+ engine = " opencode"
43+ ```
44+
2445## Commands
2546
2647- ` forge ` (interactive assistant mode: asks SDD questions, writes plan/specs, then runs loop)
27- - ` forge run [--full-access] [--thinking off|summary|raw] [--max-loops N] [--timeout-minutes N] `
28- - ` forge analyze --modified-only `
48+ - ` forge run [--engine codex|opencode] [-- full-access] [--thinking off|summary|raw] [--max-loops N] [--timeout-minutes N] `
49+ - ` forge analyze [--engine codex|opencode] --modified-only `
2950- ` forge status `
3051- ` forge monitor [--refresh-ms N] [--stall-threshold-secs N] `
52+ - ` forge doctor `
3153- ` forge sdd list `
3254- ` forge sdd load <id> `
3355
@@ -81,26 +103,21 @@ The runtime state is stored in `.forge/`:
81103- ` .circuit_breaker_history `
82104- ` .runner_pid `
83105
84- ## Live visibility (Ralph-style)
106+ ## Live visibility
85107
86- ` forge monitor ` now shows, in real time:
108+ ` forge monitor ` shows, in real time:
87109
88110- current loop
89111- run timer and current command timer (` HH:MM:SS ` )
90- - current Codex activity extracted from ` .forge/live.log `
112+ - current engine activity extracted from ` .forge/live.log `
91113- stalled detection based on heartbeat (` last_heartbeat_at_epoch ` )
92114- alert when heartbeat is stale (red status panel border and alert line)
93115- alert when runner process is missing but status says ` running ` (stale status)
94- - suppressed noise for repeated ` codex_core::state_db record_discrepancy ` warnings
95116
96117` forge status ` prints ` run_timer ` and ` command_timer ` .
97118
98119` forge run ` updates heartbeat (` last_heartbeat_at_epoch ` ) from real stream events during loop execution.
99- If Codex emits no output for 120s, Forge triggers a no-output watchdog and kills that iteration to avoid permanent hangs.
100-
101- ### Monitor screenshot
102-
103- ![ Forge monitor live view] ( docs/assets/forge-monitor-live.png )
120+ If the engine emits no output for 120s, Forge triggers a no-output watchdog and kills that iteration to avoid permanent hangs.
104121
105122## Config precedence
106123
@@ -139,12 +156,18 @@ To run against a different folder without changing directories:
139156cargo run -p forge -- --cwd /absolute/path/to/project
140157```
141158
142- To pass native ` codex ` global flags through ` forge run ` :
159+ To use OpenCode instead of Codex:
160+
161+ ``` bash
162+ forge --cwd /absolute/path/to/project run --engine opencode
163+ ```
164+
165+ To pass native engine flags through ` forge run ` :
143166
144167``` bash
145168forge --cwd /absolute/path/to/project run \
146- --codex -arg=--sandbox \
147- --codex -arg=danger-full-access
169+ --engine -arg=--sandbox \
170+ --engine -arg=danger-full-access
148171```
149172
150173Shortcut for full sandbox permissions:
@@ -153,7 +176,7 @@ Shortcut for full sandbox permissions:
153176forge --cwd /absolute/path/to/project run --full-access
154177```
155178
156- Control thinking verbosity presets (mapped to Codex ` --config ` flags) :
179+ Control thinking verbosity presets:
157180
158181``` bash
159182forge --cwd /absolute/path/to/project run --thinking off
@@ -170,8 +193,9 @@ forge --cwd /absolute/path/to/project monitor --stall-threshold-secs 20
170193You can also persist these args in ` .forgerc ` :
171194
172195``` toml
173- codex_pre_args = [" --sandbox" , " danger-full-access" ]
174- thinking_mode = " summary" # off | summary | raw
196+ engine = " codex"
197+ engine_pre_args = [" --sandbox" , " danger-full-access" ]
198+ thinking_mode = " summary"
175199```
176200
177201To force a new clean loop session (ignore previous runtime/session artifacts):
@@ -180,7 +204,7 @@ To force a new clean loop session (ignore previous runtime/session artifacts):
180204forge --cwd /absolute/path/to/project run --fresh
181205```
182206
183- ` --fresh ` clears runtime state files in ` .forge/ ` and adds ` --ephemeral ` to Codex execution to avoid reusing old sessions.
207+ ` --fresh ` clears runtime state files in ` .forge/ ` and adds ` --ephemeral ` to engine execution to avoid reusing old sessions.
184208
185209## Analyze modified files
186210
@@ -229,6 +253,19 @@ Fail if any operational warning remains:
229253forge --cwd /absolute/path/to/project doctor --strict
230254```
231255
256+ ## Environment Variables
257+
258+ | Variable | Description |
259+ | ----------| -------------|
260+ | ` FORGE_ENGINE ` | Engine to use (` codex ` or ` opencode ` ) |
261+ | ` FORGE_ENGINE_CMD ` | Path to engine binary |
262+ | ` FORGE_ENGINE_PRE_ARGS ` | Pre-args for engine |
263+ | ` FORGE_ENGINE_EXEC_ARGS ` | Exec args for engine |
264+ | ` FORGE_THINKING_MODE ` | Thinking mode (` off ` , ` summary ` , ` raw ` ) |
265+ | ` FORGE_MAX_CALLS_PER_HOUR ` | Rate limit (default: 100) |
266+ | ` FORGE_TIMEOUT_MINUTES ` | Timeout per iteration (default: 15) |
267+ | ` FORGE_RUNTIME_DIR ` | Runtime directory (default: ` .forge ` ) |
268+
232269## License
233270
234271MIT. See ` LICENSE ` .
0 commit comments