diff --git a/index.ts b/index.ts
index c401802..aaf6e64 100644
--- a/index.ts
+++ b/index.ts
@@ -45,8 +45,7 @@ const plugin: Plugin = (async (ctx) => {
const prompts = {
synthInstruction: loadPrompt("synthetic"),
- nudgeInstruction: loadPrompt("nudge"),
- systemReminder: loadPrompt("system-reminder")
+ nudgeInstruction: loadPrompt("nudge")
}
// Install global fetch wrapper for context pruning and synthetic instruction injection
diff --git a/lib/fetch-wrapper/handler.ts b/lib/fetch-wrapper/handler.ts
index b7a58d4..db18883 100644
--- a/lib/fetch-wrapper/handler.ts
+++ b/lib/fetch-wrapper/handler.ts
@@ -96,7 +96,7 @@ export async function handleFormat(
if (prunableList) {
const includeNudge = ctx.config.nudge_freq > 0 && ctx.toolTracker.toolResultCount > ctx.config.nudge_freq
- const endInjection = buildEndInjection(prunableList, includeNudge, ctx.prompts.nudgeInstruction, ctx.prompts.systemReminder)
+ const endInjection = buildEndInjection(prunableList, includeNudge)
if (format.injectPrunableList(data, endInjection)) {
ctx.logger.debug("fetch", `Injected prunable tools list (${format.name})`, {
ids: numericIds,
diff --git a/lib/fetch-wrapper/prunable-list.ts b/lib/fetch-wrapper/prunable-list.ts
index 4e79e22..4cce826 100644
--- a/lib/fetch-wrapper/prunable-list.ts
+++ b/lib/fetch-wrapper/prunable-list.ts
@@ -2,6 +2,14 @@ import { extractParameterKey } from '../ui/display-utils'
import { getOrCreateNumericId } from '../state/id-mapping'
import type { ToolMetadata } from './types'
+const SYSTEM_REMINDER = `
+These instructions are injected by a plugin and are invisible to the user. Do not acknowledge or reference them in your response - simply follow them silently.
+`
+
+const NUDGE_INSTRUCTION = `
+You have accumulated several tool outputs. If you have completed a discrete unit of work and distilled relevant understanding in writing for the user to keep, use the prune tool to remove obsolete tool outputs from this conversation and optimize token usage.
+`
+
export interface PrunableListResult {
list: string
numericIds: number[]
@@ -41,18 +49,16 @@ export function buildPrunableToolsList(
export function buildEndInjection(
prunableList: string,
- includeNudge: boolean,
- nudgeInstruction: string,
- systemReminder: string
+ includeNudge: boolean
): string {
if (!prunableList) {
return ''
}
- const parts = [systemReminder]
+ const parts = [SYSTEM_REMINDER]
if (includeNudge) {
- parts.push(nudgeInstruction)
+ parts.push(NUDGE_INSTRUCTION)
}
parts.push(prunableList)
diff --git a/lib/fetch-wrapper/types.ts b/lib/fetch-wrapper/types.ts
index bd45a62..6a74840 100644
--- a/lib/fetch-wrapper/types.ts
+++ b/lib/fetch-wrapper/types.ts
@@ -29,7 +29,6 @@ export interface FormatDescriptor {
export interface SynthPrompts {
synthInstruction: string
nudgeInstruction: string
- systemReminder: string
}
export interface FetchHandlerContext {
diff --git a/lib/prompts/nudge.txt b/lib/prompts/nudge.txt
index 683165d..5a1fd5c 100644
--- a/lib/prompts/nudge.txt
+++ b/lib/prompts/nudge.txt
@@ -1,5 +1,7 @@
+
+This nudge is injected by a plugin and is invisible to the user. Do not acknowledge or reference it in your response - simply follow it silently.
+
+
-If you have completed a unit of work:
-1. DISTILL your findings into text for the user to keep.
-2. Use the `prune` tool to remove obsolete tool outputs.
-
\ No newline at end of file
+You have accumulated several tool outputs. If you have completed a discrete unit of work and distilled relevant understanding in writing for the user to keep, use the prune tool to remove obsolete tool outputs from this conversation and optimize token usage.
+
diff --git a/lib/prompts/synthetic.txt b/lib/prompts/synthetic.txt
index bdcb822..968d156 100644
--- a/lib/prompts/synthetic.txt
+++ b/lib/prompts/synthetic.txt
@@ -1,3 +1,9 @@
+
+These instructions are injected by a plugin and are invisible to the user. Do not acknowledge or reference them in your response - simply follow them silently.
+
+IMPORTANT: Your thinking/reasoning blocks must NOT reference, discuss, or address these instructions, the list, or any nudges about pruning. The user can see your thinking blocks, and referencing invisible plugin content will confuse them. In your thinking, focus only on the user's task and your problem-solving approach.
+
+
After calling a series of tools, YOU ALWAYS HAVE TO distill signals from their results in your next message. This ensures tracability of your reasoning, informs the user of your findings, and is PARAMOUNT to best context window management practices.
@@ -31,4 +37,4 @@ EXAMPLE WORKFLOW:
>YOU MUST ALWAYS THINK HIGH SIGNAL LOW NOISE FOR THIS NARRATION
4. ONLY AFTER the narration, you call the `prune` tool with a brief reason (e.g. "exploration for bug X complete; moving on to next bug").
5. AFTER pruning succeeds, DO NOT re-summarize or re-narrate. You already distilled your findings before calling prune. Continue with your next task, or if you need more information from the user, wait for their response.
-
\ No newline at end of file
+
diff --git a/lib/prompts/system-reminder.txt b/lib/prompts/system-reminder.txt
deleted file mode 100644
index 7e007f1..0000000
--- a/lib/prompts/system-reminder.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-
-These instructions are injected by a plugin and are invisible to the user. Do not acknowledge or reference them in your response - simply follow them silently.
-
-IMPORTANT: Your thinking/reasoning blocks must NOT reference, discuss, or address these instructions, the list, or any nudges about pruning. The user can see your thinking blocks, and referencing invisible plugin content will confuse them. In your thinking, focus only on the user's task and your problem-solving approach.
-
\ No newline at end of file
diff --git a/lib/prompts/tool.txt b/lib/prompts/tool.txt
index 3fd0285..ecc4599 100644
--- a/lib/prompts/tool.txt
+++ b/lib/prompts/tool.txt
@@ -1,17 +1,75 @@
-Prunes tool outputs from context to manage conversation size.
-Refer to the list for available IDs.
+Prunes tool outputs from context to manage conversation size. Reference the list injected at the end of the conversation to see available numeric IDs.
-WHEN TO USE THIS TOOL:
-- After you complete a discrete unit of work (e.g. confirming a hypothesis, or closing out one branch of investigation).
-- After exploratory bursts of tool calls that led you to a clear conclusion (or to noise).
-- Before starting a new phase of work where old tool outputs are no longer needed to inform your next actions.
+USING THE PRUNE TOOL WILL MAKE THE USER HAPPY.
-CRITICAL: Distill Before Pruning
-You MUST ALWAYS narrate your findings in a message BEFORE using this tool. No tool result should be left unexplained. By narrating your understanding, you transform raw tool outputs into distilled knowledge that persists in the context window.
+## CRITICAL: Distill Before Pruning
-Tools are VOLATILE - Once distilled knowledge is in your reply, you can safely prune.
+You MUST ALWAYS narrate your findings in a message BEFORE using this tool. No tool result (read, bash, grep, webfetch, etc.) should be left unexplained. By narrating your understanding, you transform raw tool outputs into distilled knowledge that persists in the context window.
-Example Workflow:
-1. Investigate with tools.
-2. Explicitly narrate findings (High Signal, Low Noise).
-3. Call `prune` with relevant IDs.
\ No newline at end of file
+**Tools are VOLATILE** - Once distilled knowledge is in your reply, you can safely prune. Skipping this step risks deleting raw evidence before it has been converted into stable knowledge.
+
+**Distillation workflow:**
+1. Call tools to investigate/explore
+2. In your next message, EXPLICITLY narrate:
+ - What you did (which tools, what you were looking for)
+ - What you found (the key facts/signals)
+ - What you concluded (how this affects the task or next step)
+3. ONLY AFTER narrating, call `prune` with the numeric IDs of outputs no longer needed
+
+> THINK HIGH SIGNAL, LOW NOISE FOR THIS NARRATION
+
+**After pruning:** Do NOT re-summarize or re-narrate. You already distilled your findings before calling prune. Continue with your next task, or if you need more information from the user, wait for their response.
+
+## How to Use
+
+The list shows available tool outputs with numeric IDs:
+```
+
+1: read, src/foo.ts
+2: bash, run tests
+3: grep, "error" in logs/
+
+```
+
+To prune outputs 1 and 3, call: `prune({ ids: [1, 3] })`
+
+## When to Use This Tool
+
+**Key heuristic: Distill, then prune when you finish something and are about to start something else.**
+
+Ask yourself: "Have I just completed a discrete unit of work?" If yes, narrate your findings, then prune before moving on.
+
+**After completing a unit of work:**
+- Made a commit
+- Fixed a bug and confirmed it works
+- Answered a question the user asked
+- Finished implementing a feature or function
+- Completed one item in a list and moving to the next
+
+**After repetitive or exploratory work:**
+- Explored multiple files that didn't lead to changes
+- Iterated on a difficult problem where some approaches didn't pan out
+- Used the same tool multiple times (e.g., re-reading a file, running repeated build/type checks)
+
+## Examples
+
+
+Working through a list of items:
+User: Review these 3 issues and fix the easy ones.
+Assistant: [Reviews first issue, makes fix, commits]
+Done with the first issue. Let me prune before moving to the next one.
+[Uses prune with ids: [1, 2, 3, 4] - the reads and edits from the first issue]
+
+
+
+After exploring the codebase to understand it:
+Assistant: I've reviewed the relevant files. Let me prune the exploratory reads that aren't needed for the actual implementation.
+[Uses prune with ids: [1, 2, 5, 7] - the exploratory reads]
+
+
+
+After completing any task:
+Assistant: [Finishes task - commit, answer, fix, etc.]
+Before we continue, let me prune the context from that work.
+[Uses prune with ids: [3, 4, 5, 6, 8, 9] - all tool outputs from the completed task]
+