From d3c5813186981ea5e609d24833315aa436cb2cc8 Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Sun, 29 Mar 2026 12:59:16 -0500 Subject: [PATCH 1/2] fix: ensure OPENCODE_DISABLE_CLAUDE_CODE_PROMPT is respected for project lvl CLAUDE.md (#19924) --- packages/opencode/src/session/instruction.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/opencode/src/session/instruction.ts b/packages/opencode/src/session/instruction.ts index 86f73d0fd238..526e3f4b1c00 100644 --- a/packages/opencode/src/session/instruction.ts +++ b/packages/opencode/src/session/instruction.ts @@ -13,7 +13,7 @@ const log = Log.create({ service: "instruction" }) const FILES = [ "AGENTS.md", - "CLAUDE.md", + ...(Flag.OPENCODE_DISABLE_CLAUDE_CODE_PROMPT ? [] : ["CLAUDE.md"]), "CONTEXT.md", // deprecated ] From 8511b169870d2e9adc2e1e63ac9e7fbdd4f8173f Mon Sep 17 00:00:00 2001 From: cl-ment Date: Sun, 29 Mar 2026 20:05:49 +0200 Subject: [PATCH 2/2] feat: handle MCP notifications/message from servers Add a setNotificationHandler for LoggingMessageNotificationSchema that publishes received messages as mcp.message.received bus events. This enables MCP servers (e.g. context-vault) to push notifications to OpenCode agents without requiring polling. The handler extracts level and data from the notification params and publishes them via the existing Bus infrastructure, making them available to any subscriber (TUI, agent context, etc.). --- packages/opencode/src/mcp/index.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/opencode/src/mcp/index.ts b/packages/opencode/src/mcp/index.ts index e3bf4cac0688..011e2951da7f 100644 --- a/packages/opencode/src/mcp/index.ts +++ b/packages/opencode/src/mcp/index.ts @@ -6,6 +6,7 @@ import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js" import { UnauthorizedError } from "@modelcontextprotocol/sdk/client/auth.js" import { CallToolResultSchema, + LoggingMessageNotificationSchema, type Tool as MCPToolDef, ToolListChangedNotificationSchema, } from "@modelcontextprotocol/sdk/types.js" @@ -60,6 +61,15 @@ export namespace MCP { }), ) + export const MessageReceived = BusEvent.define( + "mcp.message.received", + z.object({ + server: z.string(), + level: z.string(), + data: z.string(), + }), + ) + export const Failed = NamedError.create( "MCPFailed", z.object({ @@ -475,6 +485,17 @@ export namespace MCP { s.defs[name] = listed await Effect.runPromise(bus.publish(ToolsChanged, { server: name }).pipe(Effect.ignore)) }) + + client.setNotificationHandler(LoggingMessageNotificationSchema, async (notification) => { + const level = notification.params.level ?? "info" + const data = typeof notification.params.data === "string" + ? notification.params.data + : JSON.stringify(notification.params.data) + log.info("message notification received", { server: name, level, data: data.slice(0, 200) }) + await Effect.runPromise( + bus.publish(MessageReceived, { server: name, level, data }).pipe(Effect.ignore), + ) + }) } const cache = yield* InstanceState.make(