Agents · opencode
opencode for teams, without collisions
In shortRun lanes init --agents opencode in your repository and commit the result. Lanes writes .opencode/plugins/lanes.js so that every opencode edit is committed as you and published to a shared branch, after waiting for any teammate editing the same file. Add lanes mcp to opencode so its agent can read the team brief and check a file before touching it.
opencode on a team
opencode is open source and easy to run several times in parallel, which makes collisions between sessions likely. When two people's agents work in the same repository, one can overwrite the other's change in a shared file, or write new code against a function the other is renaming. Git shows the damage later, at merge time, after both agents have finished.
Lanes connects every agent on the team to one coordination server. opencode gets heads-ups about teammates' changes, and the rest of the team's agents see what opencode is changing.
What Lanes installs for opencode
opencode has no shell hooks, so Lanes installs an in-process plugin in .opencode/plugins/lanes.js. It runs the Lanes hook before and after each edit tool call: the edit waits for a teammate's edit of the same file, then is committed and published. Notes for the agent reach it with the next edit's result.
The file is committed with lanes init, so every teammate gets it when they pull. lanes off removes only the Lanes entries and leaves your own settings alone.
| What | opencode with Lanes |
|---|---|
| Edits wait for a teammate's edit of the same file | Yes |
Each edit committed as you and published to lanes/main | Yes |
| Team brief added to each prompt | No, use the MCP tool team_brief |
| Heads-up before reading a teammate's file | No |
| Check at the end of a turn | No |
| MCP team tools | Yes |
Set it up
- Get Lanes:
git clone https://github.com/mfmatozza/lanes && cd lanes && npm ci && npm run build. The commands below writelanesfornode /path/to/lanes/dist/lanes.cjs. - In your repository, run
lanes init --agents opencodeand push the commit it makes. - Turn on shared context once per repository:
lanes team on, then commit.lanes/team.json. - Add the MCP server to opencode:
Add this to ~/.config/opencode/opencode.json:
{ "mcp": { "lanes": { "type": "local", "command": ["node", "/path/to/lanes.cjs", "mcp"], "enabled": true } } }- Check the machine with
lanes doctor.
Working alone, the first session starts a local Lanes server. For a team, one person runs lanes server --host 0.0.0.0 and invites the others with lanes invite <name>.
Things to know about opencode
- Restart opencode to load the plugin.
- The plugin gives the session-start hook 10 seconds, so the note about automatic commits survives a busy machine.
Status
Built from opencode's published documentation and covered by Lanes' automated tests. It has not yet been run against the real opencode. Issues and reports are welcome.
Mixed teams work: one person can use opencode while teammates use Claude Code, Codex or Cursor. Every agent reports to the same server, so the brief and the heads-up name each teammate's task whatever agent they run.
Questions
Why a plugin and not hooks?
opencode has no shell hooks. Its plugin API lets Lanes run the same hook in-process around each edit.
Do I need to restart opencode?
Yes, once, to load the plugin.
How does the agent get the brief?
Through lanes mcp, added to ~/.config/opencode/opencode.json.