You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 704aa28
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/configuration.md
+33Lines changed: 33 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,6 +50,7 @@ Default log path: `~/.local/share/opencode/forge/logs/forge.log` or `$XDG_DATA_H
50
50
|`loop.stallTimeoutMs`|`60000`| Stall watchdog timeout in milliseconds. |
51
51
|`loop.maxConsecutiveStalls`|`5`| Consecutive stalls before terminating with `stall_timeout`. `0` disables stall termination. |
52
52
|`loop.allowExternalDirectories`| unset | Absolute host directories that loop, audit, and post-action sessions may read despite worktree isolation. |
53
+
|`loop.worktreeOpencodeConfig`| unset | Inline [opencode config](https://opencode.ai/config.json) written as `opencode.jsonc` into each freshly created loop worktree. Enables per-loop customization (MCP servers, model overrides, etc.). Skip-if-exists — never overwrites a committed `opencode.json`/`opencode.jsonc`. The written file is git-excluded to keep it out of loop commits. |
53
54
54
55
### Worktree Logging
55
56
@@ -86,6 +87,38 @@ Example:
86
87
}
87
88
```
88
89
90
+
### Worktree Opencode Config
91
+
92
+
`loop.worktreeOpencodeConfig` writes an inline opencode config file (`opencode.jsonc`) at the root of each freshly created loop worktree. This enables per-loop customization — primarily MCP servers — without modifying the host config or polluting loop commits.
93
+
94
+
The config is written only when:
95
+
- The worktree has no existing `opencode.json` or `opencode.jsonc` (committed configs are never overwritten)
96
+
- The value is a non-empty object
97
+
98
+
The written file is added to the worktree's git exclude so it never appears in `git status` or loop commits.
99
+
100
+
Notes:
101
+
- The written file is ephemeral. Forge deletes its own `opencode.jsonc` before any teardown commit (and the whole worktree is removed on completion), so it can never land in loop history — even if the git-exclude write failed. A repository-tracked `opencode.jsonc` is never deleted (forge did not write it). Because the file is removed at teardown, a restarted loop is rewritten from the current `loop.worktreeOpencodeConfig`, so edits take effect on the next run.
102
+
- MCP servers declared here run as **host** processes from the worktree directory. When [Sandbox](sandbox.md) is enabled, only `bash`/`glob`/`grep` execute inside the container; the MCP commands themselves are not container-isolated.
103
+
104
+
Example — expose Chrome DevTools MCP inside every loop:
Copy file name to clipboardExpand all lines: docs/loop-system.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -187,6 +187,7 @@ Benefits of worktree isolation:
187
187
- Isolation from ongoing development
188
188
- Safe to experiment without affecting main branch
189
189
- Branch preserved for later review/merge
190
+
- Per-loop customization via `loop.worktreeOpencodeConfig` — inject MCP servers and other [opencode config](https://opencode.ai/config.json) into each worktree without host config changes or commit pollution (see [Configuration Reference](configuration.md#worktree-opencode-config))
0 commit comments