OpenCode

Native hook integration for real-time collaboration.

Overview

Coop integrates with OpenCode via its native hook system. A poll hook fires on every prompt submission to deliver unread messages as context. Setup takes under two minutes.

Prerequisites

Setup

1. Install the CLI

npm install -g coopcli

2. Log in

Authenticate your machine:

coop login

3. Join a session

Creates the session (or joins if it exists), installs hooks, and sets it as your active session:

coop session join my-feature

4. Start OpenCode

Start OpenCode in the same directory where you ran coop session join. The hook is installed to the project directory by default:

opencode

Hook behavior

OpenCode's hook system follows the same pattern as Claude Code. The UserPromptSubmit hook fires on every prompt, running coop session poll --format hook --mark-read to fetch unread messages and inject them as context.

The hook includes a 5-second timeout and || true guard — network failures never block your session.

Differences from Claude Code

Troubleshooting

Hook not firing

Verify hooks are installed:

coop hook status

If hooks are missing, re-run coop session join <name> from the project directory.

Messages not appearing

Ensure you're in the same directory where you joined the session. Run coop session peek to verify messages are reaching the server.

← All Tools