diff --git a/opencode/AGENTS.md b/opencode/AGENTS.md index 46ded57..e80c27b 100644 --- a/opencode/AGENTS.md +++ b/opencode/AGENTS.md @@ -7,7 +7,8 @@ ## Work Summary - `set_work_summary` is mandatory protocol, not a suggestion. -- Call `set_work_summary` at least once at the start of every busy turn before any substantive tool call, code change, research step, or substantive user-facing response. +- It is fine to inspect first. You may use exploratory tools like search, read, task, web, or read-only shell commands before calling `set_work_summary`. +- Call `set_work_summary` once you have enough context to label the work accurately, and always before edits, patches, or other committed actions. - Prefer calling it with both fields: `set_work_summary({ theme: "...", now: "..." })`. - `theme` answers: what is this pane about overall? Keep it stable across many turns. - `now` answers: what are you about to do next? Update it whenever the next concrete step changes. diff --git a/opencode/plugins/require_work_summary.ts b/opencode/plugins/require_work_summary.ts index d9f53f9..cb5e667 100644 --- a/opencode/plugins/require_work_summary.ts +++ b/opencode/plugins/require_work_summary.ts @@ -5,6 +5,21 @@ type TurnState = { } const states = new Map() +const exploratoryTools = new Set([ + "bash", + "read", + "glob", + "grep", + "task", + "question", + "webfetch", + "web_google_search", + "web_website_fetch", + "web_website_search", + "web_website_outline", + "web_website_extract_section", + "web_website_extract_pricing", +]) function sessionState(sessionID: string) { let state = states.get(sessionID) @@ -24,6 +39,10 @@ function eventSessionID(event: any) { ).trim() } +function isExploratoryTool(tool: string) { + return exploratoryTools.has(tool) +} + export const RequireWorkSummaryPlugin: Plugin = async () => { return { "chat.message": async (input: any) => { @@ -34,14 +53,6 @@ export const RequireWorkSummaryPlugin: Plugin = async () => { sessionState(sessionID).summaryCalled = false }, - "command.execute.before": async (input: any) => { - const sessionID = String(input?.sessionID || "").trim() - if (!sessionID) { - return - } - sessionState(sessionID).summaryCalled = false - }, - "tool.execute.before": async (input: any) => { const sessionID = String(input?.sessionID || "").trim() if (!sessionID) { @@ -58,9 +69,13 @@ export const RequireWorkSummaryPlugin: Plugin = async () => { return } + if (isExploratoryTool(tool)) { + return + } + if (!state.summaryCalled) { throw new Error( - "Call set_work_summary first with a specific theme and next-step now label before using other tools.", + "Exploration tools can run first, but call set_work_summary before edits or other committed actions.", ) } },