mirror of
https://github.com/bendtherules/opencode-plugin-compaction-prompt.git
synced 2026-08-18 13:42:55 +00:00
fix: skip empty compaction instructions
This commit is contained in:
+9
-1
@@ -28,7 +28,11 @@ function buildInstructions(
|
||||
prompt: string,
|
||||
completionMarker: string,
|
||||
memory: string,
|
||||
): string {
|
||||
): string | undefined {
|
||||
if (!prompt && !memory) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const sections = [
|
||||
"## User Compaction Instructions",
|
||||
`These instructions take precedence over previous instructions if there is conflict. At the very end of the summary, echo exactly: **${completionMarker}**`,
|
||||
@@ -110,6 +114,10 @@ export const CompactionPromptPlugin: Plugin = async (
|
||||
const memory = await readMemory(memoryPath, logError);
|
||||
const instructions = buildInstructions(prompt, completionMarker, memory);
|
||||
|
||||
if (!instructions) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mode === "replace") {
|
||||
output.prompt = instructions;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user