5 Commits
Author SHA1 Message Date
bendtherules edb5bb47f4 chore: release v0.2.4 2026-08-01 19:11:14 +05:30
bendtherules 57c96fcd3b docs: prepare release notes 2026-08-01 19:11:06 +05:30
bendtherules 2fe522b99e chore: normalize package metadata 2026-08-01 19:10:44 +05:30
bendtherules 3d26f61a2b chore: release v0.2.3 2026-08-01 19:09:16 +05:30
bendtherules 55db9835a2 feat: always report compaction status 2026-08-01 19:09:10 +05:30
5 changed files with 25 additions and 29 deletions
+8
View File
@@ -1,5 +1,13 @@
# Changelog # Changelog
## 0.2.4
- Normalize npm package repository metadata.
## 0.2.3
- Always ask the model to report whether custom compaction instructions were applied.
## 0.2.2 ## 0.2.2
- Add explicit markers for applied and skipped custom compaction instructions. - Add explicit markers for applied and skipped custom compaction instructions.
+1 -1
View File
@@ -47,7 +47,7 @@ Create `.opencode/compaction.md` in the project when you have project-specific c
Append mode is the recommended default because it preserves OpenCode's built-in compaction behavior. Replace mode is available when the complete prompt needs to be controlled by this plugin. Append mode is the recommended default because it preserves OpenCode's built-in compaction behavior. Replace mode is available when the complete prompt needs to be controlled by this plugin.
When neither a prompt nor a memory file is available, the plugin adds `opencode-plugin-compaction-prompt: No custom compaction applied.` instead. When neither a prompt nor a memory file is available, the plugin asks the model to echo `opencode-plugin-compaction-prompt: No custom compaction applied.` instead.
## Development ## Development
+2 -2
View File
@@ -1,13 +1,13 @@
{ {
"name": "opencode-plugin-compaction-prompt", "name": "opencode-plugin-compaction-prompt",
"version": "0.2.2", "version": "0.2.4",
"description": "Customize OpenCode's compaction prompt to preserve important context and omit unnecessary details.", "description": "Customize OpenCode's compaction prompt to preserve important context and omit unnecessary details.",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/bendtherules/opencode-plugin-compaction-prompt.git" "url": "git+https://github.com/bendtherules/opencode-plugin-compaction-prompt.git"
}, },
"homepage": "https://github.com/bendtherules/opencode-plugin-compaction-prompt#readme", "homepage": "https://github.com/bendtherules/opencode-plugin-compaction-prompt#readme",
"bugs": { "bugs": {
+4 -16
View File
@@ -31,11 +31,7 @@ function buildInstructions(
prompt: string, prompt: string,
completionMarker: string, completionMarker: string,
memory: string, memory: string,
): string | undefined { ): string {
if (!prompt && !memory) {
return undefined;
}
const sections = [ const sections = [
"## User Compaction Instructions", "## User Compaction Instructions",
`These instructions take precedence over previous instructions if there is conflict. At the very end of the summary, echo exactly: **${completionMarker}**`, `These instructions take precedence over previous instructions if there is conflict. At the very end of the summary, echo exactly: **${completionMarker}**`,
@@ -115,17 +111,9 @@ export const CompactionPromptPlugin: Plugin = async (
output, output,
): Promise<void> => { ): Promise<void> => {
const memory = await readMemory(memoryPath, logError); const memory = await readMemory(memoryPath, logError);
const instructions = buildInstructions(prompt, completionMarker, memory); const marker =
prompt || memory ? completionMarker : skippedCompactionMarker;
if (!instructions) { const instructions = buildInstructions(prompt, marker, memory);
if (mode === "replace") {
output.prompt = skippedCompactionMarker;
} else {
output.context.push(skippedCompactionMarker);
}
return;
}
if (mode === "replace") { if (mode === "replace") {
output.prompt = instructions; output.prompt = instructions;
+10 -10
View File
@@ -116,9 +116,9 @@ describe("CompactionPromptPlugin", () => {
); );
expect(context.logs).toHaveLength(0); expect(context.logs).toHaveLength(0);
expect(output.context).toEqual([ expect(output.context[0]).toContain(
"opencode-plugin-compaction-prompt: No custom compaction applied.", "echo exactly: **opencode-plugin-compaction-prompt: No custom compaction applied.**",
]); );
}); });
test("adds a skipped marker when no instructions are provided", async () => { test("adds a skipped marker when no instructions are provided", async () => {
@@ -133,10 +133,10 @@ describe("CompactionPromptPlugin", () => {
output, output,
); );
expect(output.context).toEqual([ expect(output.context[0]).toBe("Existing context");
"Existing context", expect(output.context[1]).toContain(
"opencode-plugin-compaction-prompt: No custom compaction applied.", "echo exactly: **opencode-plugin-compaction-prompt: No custom compaction applied.**",
]); );
expect(output.prompt).toBeUndefined(); expect(output.prompt).toBeUndefined();
}); });
@@ -154,8 +154,8 @@ describe("CompactionPromptPlugin", () => {
); );
expect(context.logs).toHaveLength(1); expect(context.logs).toHaveLength(1);
expect(output.context).toEqual([ expect(output.context[0]).toContain(
"opencode-plugin-compaction-prompt: No custom compaction applied.", "echo exactly: **opencode-plugin-compaction-prompt: No custom compaction applied.**",
]); );
}); });
}); });