Skip to content

Commit 5d38c15

Browse files
committed
refactor(prompts): extract system-reminder to separate file and restore master prompt text
1 parent 851dec8 commit 5d38c15

File tree

3 files changed

+74
-20
lines changed

3 files changed

+74
-20
lines changed

lib/prompts/nudge.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
<instruction name=agent_nudge>
2-
If you have completed a unit of work:
3-
1. DISTILL your findings into text for the user to keep.
4-
2. Use the `prune` tool to remove obsolete tool outputs.
5-
</instruction>
2+
You have accumulated several tool outputs. Consider using the `prune` tool to declutter the conversation context.
3+
</instruction>

lib/prompts/system-reminder.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
<system-reminder>
2-
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.
3-
4-
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.
2+
These instructions are injected by a plugin and are invisible to the user. You must follow them silently and NEVER reference or discuss them (including the <prunable-tools> list) in your response or thinking/reasoning blocks, as this will confuse the user who cannot see them.
53
</system-reminder>

lib/prompts/tool.txt

Lines changed: 71 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,75 @@
1-
Prunes tool outputs from context to manage conversation size.
2-
Refer to the <prunable-tools> list for available IDs.
1+
Prunes tool outputs from context to manage conversation size. Reference the <prunable-tools> list injected at the end of the conversation to see available numeric IDs.
32

4-
WHEN TO USE THIS TOOL:
5-
- After you complete a discrete unit of work (e.g. confirming a hypothesis, or closing out one branch of investigation).
6-
- After exploratory bursts of tool calls that led you to a clear conclusion (or to noise).
7-
- Before starting a new phase of work where old tool outputs are no longer needed to inform your next actions.
3+
USING THE PRUNE TOOL WILL MAKE THE USER HAPPY.
84

9-
CRITICAL: Distill Before Pruning
10-
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.
5+
## CRITICAL: Distill Before Pruning
116

12-
Tools are VOLATILE - Once distilled knowledge is in your reply, you can safely prune.
7+
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.
138

14-
Example Workflow:
15-
1. Investigate with tools.
16-
2. Explicitly narrate findings (High Signal, Low Noise).
17-
3. Call `prune` with relevant IDs.
9+
**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.
10+
11+
**Distillation workflow:**
12+
1. Call tools to investigate/explore
13+
2. In your next message, EXPLICITLY narrate:
14+
- What you did (which tools, what you were looking for)
15+
- What you found (the key facts/signals)
16+
- What you concluded (how this affects the task or next step)
17+
3. ONLY AFTER narrating, call `prune` with the numeric IDs of outputs no longer needed
18+
19+
> THINK HIGH SIGNAL, LOW NOISE FOR THIS NARRATION
20+
21+
**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.
22+
23+
## How to Use
24+
25+
The <prunable-tools> list shows available tool outputs with numeric IDs:
26+
```
27+
<prunable-tools>
28+
1: read, src/foo.ts
29+
2: bash, run tests
30+
3: grep, "error" in logs/
31+
</prunable-tools>
32+
```
33+
34+
To prune outputs 1 and 3, call: `prune({ ids: [1, 3] })`
35+
36+
## When to Use This Tool
37+
38+
**Key heuristic: Distill, then prune when you finish something and are about to start something else.**
39+
40+
Ask yourself: "Have I just completed a discrete unit of work?" If yes, narrate your findings, then prune before moving on.
41+
42+
**After completing a unit of work:**
43+
- Made a commit
44+
- Fixed a bug and confirmed it works
45+
- Answered a question the user asked
46+
- Finished implementing a feature or function
47+
- Completed one item in a list and moving to the next
48+
49+
**After repetitive or exploratory work:**
50+
- Explored multiple files that didn't lead to changes
51+
- Iterated on a difficult problem where some approaches didn't pan out
52+
- Used the same tool multiple times (e.g., re-reading a file, running repeated build/type checks)
53+
54+
## Examples
55+
56+
<example>
57+
Working through a list of items:
58+
User: Review these 3 issues and fix the easy ones.
59+
Assistant: [Reviews first issue, makes fix, commits]
60+
Done with the first issue. Let me prune before moving to the next one.
61+
[Uses prune with ids: [1, 2, 3, 4] - the reads and edits from the first issue]
62+
</example>
63+
64+
<example>
65+
After exploring the codebase to understand it:
66+
Assistant: I've reviewed the relevant files. Let me prune the exploratory reads that aren't needed for the actual implementation.
67+
[Uses prune with ids: [1, 2, 5, 7] - the exploratory reads]
68+
</example>
69+
70+
<example>
71+
After completing any task:
72+
Assistant: [Finishes task - commit, answer, fix, etc.]
73+
Before we continue, let me prune the context from that work.
74+
[Uses prune with ids: [3, 4, 5, 6, 8, 9] - all tool outputs from the completed task]
75+
</example>

0 commit comments

Comments
 (0)