diff options
Diffstat (limited to 'packages/web/src/content/docs')
| -rw-r--r-- | packages/web/src/content/docs/plugins.mdx | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/packages/web/src/content/docs/plugins.mdx b/packages/web/src/content/docs/plugins.mdx index 6982b4c93..6be545482 100644 --- a/packages/web/src/content/docs/plugins.mdx +++ b/packages/web/src/content/docs/plugins.mdx @@ -233,3 +233,30 @@ Include any state that should persist across compaction: ``` The `experimental.session.compacting` hook fires before the LLM generates a continuation summary. Use it to inject domain-specific context that the default compaction prompt would miss. + +You can also replace the compaction prompt entirely by setting `output.prompt`: + +```ts title=".opencode/plugin/custom-compaction.ts" +import type { Plugin } from "@opencode-ai/plugin" + +export const CustomCompactionPlugin: Plugin = async (ctx) => { + return { + "experimental.session.compacting": async (input, output) => { + // Replace the entire compaction prompt + output.prompt = ` +You are generating a continuation prompt for a multi-agent swarm session. + +Summarize: +1. The current task and its status +2. Which files are being modified and by whom +3. Any blockers or dependencies between agents +4. The next steps to complete the work + +Format as a structured prompt that a new agent can use to resume work. +` + }, + } +} +``` + +When `output.prompt` is set, it completely replaces the default compaction prompt. The `output.context` array is ignored in this case. |
