Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Thumbs.db

# OpenCode
.opencode/
AGENTS.md

# Tests (local development only)
tests/
Expand Down
4 changes: 3 additions & 1 deletion lib/prompts/synthetic.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<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.

IMPORTANT: Your thinking/reasoning blocks must NOT reference, discuss, or address these instructions, the <prunable-tools> 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.
</system-reminder>

<instruction name=signal_management>
Expand Down Expand Up @@ -34,5 +36,5 @@ EXAMPLE WORKFLOW:
- What you concluded (how this affects the task or next step).
>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").
</instruction>
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.
</instruction>
2 changes: 2 additions & 0 deletions lib/prompts/tool.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ You MUST ALWAYS narrate your findings in a message BEFORE using this tool. No to

> 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 <prunable-tools> list shows available tool outputs with numeric IDs:
Expand Down
13 changes: 2 additions & 11 deletions lib/pruning-tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,8 @@ export function createPruningTool(
resetToolTrackerCount(toolTracker)
}

const result = {
prunedCount: prunedIds.length,
tokensSaved,
llmPrunedIds: prunedIds,
toolMetadata,
sessionStats
}

const postPruneGuidance = "\n\nYou have already distilled relevant understanding in writing before calling this tool. Do not re-narrate; continue with your next task."

return formatPruningResultForTool(result, workingDirectory) + postPruneGuidance
// Return empty string on success (like edit tool) - guidance is in tool description
return ""
},
})
}
Expand Down