Skip to content

opencode

meshpoint connect opencode

links ~/.config/opencode/plugins/meshpoint.js to the CLI’s built plugin and writes ~/.config/opencode/skills/meshpoint/SKILL.md. XDG_CONFIG_HOME is honoured; --config-dir <dir> targets another directory. Restart opencode to load it.

The plugin file is a symlink. opencode’s runtime follows the link’s real path, so the plugin’s own imports resolve from the CLI install; re-run connect after moving or reinstalling the CLI. The file has exactly one export because opencode calls every export as a plugin.

opencode hook What happens
event: session.created Opens a tap for the session; subagent sessions (those with a parent) are ignored.
experimental.chat.system.transform Appends recall and presence to the system prompt of every model request in the session. Waits up to 4 s for the fetch on the first request. Keeping the inject in the system prompt keeps it stable across turns and cache-friendly.
chat.message Spools the prompt.
experimental.text.complete Spools the reply.
tool.execute.after Collects the paths passed to edit and write.
event: session.idle Sends a due spool. When a checkpoint is due, sends the nudge as a follow-up prompt through client.session.promptAsync; the model runs the skill in that turn.
event: session.compacted Fetches recall again.
event: session.deleted Sends the spool.

opencode run "..." exits about 20 ms after session.idle, without waiting for event handlers. Two consequences:

  • The last turn of a one-shot run stays in the spool until that session continues (opencode run -c, or -s <id>) or another session flushes.
  • The nudge turn never happens in a one-shot run. It does happen in the TUI and against opencode serve (opencode run --attach <url> -s <id>), where the process outlives the idle event.

Interactive use is unaffected.