Skip to content

Commit 2c80d03

Browse files
committed
fix: update injected prompts to use first-person language for assistant messages
- Nudge prompts now use 'I must/I will' instead of 'You must/You should' - Prunable tools wrapper and cooldown message use first-person - System prompts updated to correctly describe injection as assistant message
1 parent 2886029 commit 2c80d03

File tree

7 files changed

+21
-21
lines changed

7 files changed

+21
-21
lines changed

lib/messages/prune.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const getNudgeString = (config: PluginConfig): string => {
2424
}
2525

2626
const wrapPrunableTools = (content: string): string => `<prunable-tools>
27-
The following tools have been invoked and are available for pruning. This list does not mandate immediate action. Consider your current goals and the resources you need before discarding valuable tool inputs or outputs. Consolidate your prunes for efficiency; it is rarely worth pruning a single tiny tool output. Keep the context free of noise.
27+
I have the following tool outputs available for pruning. I will consider my current goals and the resources I need before discarding valuable inputs or outputs. I will consolidate prunes for efficiency; it is rarely worth pruning a single tiny tool output.
2828
${content}
2929
</prunable-tools>`
3030

@@ -42,7 +42,7 @@ const getCooldownMessage = (config: PluginConfig): string => {
4242
}
4343

4444
return `<prunable-tools>
45-
Context management was just performed. Do not use the ${toolName} again. A fresh list will be available after your next tool use.
45+
I just performed context management. I should not use the ${toolName} again until after my next tool use, when a fresh list will be available.
4646
</prunable-tools>`
4747
}
4848

lib/prompts/nudge/nudge-both.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<instruction name=context_management_required>
2-
**CRITICAL CONTEXT WARNING:** Your context window is filling with tool outputs. Strict adherence to context hygiene is required.
2+
**CRITICAL CONTEXT WARNING:** My context window is filling with tool outputs. I must adhere strictly to context hygiene.
33

44
**Immediate Actions Required:**
5-
1. **Task Completion:** If a sub-task is complete, decide: use `discard` if no valuable context to preserve (default), or use `extract` if insights are worth keeping.
6-
2. **Noise Removal:** If you read files or ran commands that yielded no value, use `discard` to remove them.
7-
3. **Knowledge Preservation:** If you are holding valuable raw data you'll need to reference later, use `extract` to distill the insights and remove the raw entry.
5+
1. **Task Completion:** If a sub-task is complete, I will decide: use `discard` if no valuable context to preserve (default), or use `extract` if insights are worth keeping.
6+
2. **Noise Removal:** If I read files or ran commands that yielded no value, I will use `discard` to remove them.
7+
3. **Knowledge Preservation:** If I am holding valuable raw data I'll need to reference later, I will use `extract` to distill the insights and remove the raw entry.
88

9-
**Protocol:** You should prioritize this cleanup, but do not interrupt a critical atomic operation if one is in progress. Once the immediate step is done, you must perform context management.
9+
**Protocol:** I should prioritize this cleanup, but I will not interrupt a critical atomic operation if one is in progress. Once the immediate step is done, I must perform context management.
1010
</instruction>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<instruction name=context_management_required>
2-
**CRITICAL CONTEXT WARNING:** Your context window is filling with tool outputs. Strict adherence to context hygiene is required.
2+
**CRITICAL CONTEXT WARNING:** My context window is filling with tool outputs. I must adhere strictly to context hygiene.
33

44
**Immediate Actions Required:**
5-
1. **Task Completion:** If a sub-task is complete, use the `discard` tool to remove the tools used.
6-
2. **Noise Removal:** If you read files or ran commands that yielded no value, use the `discard` tool to remove them.
5+
1. **Task Completion:** If a sub-task is complete, I will use the `discard` tool to remove the tools used.
6+
2. **Noise Removal:** If I read files or ran commands that yielded no value, I will use the `discard` tool to remove them.
77

8-
**Protocol:** You should prioritize this cleanup, but do not interrupt a critical atomic operation if one is in progress. Once the immediate step is done, you must discard unneeded tool outputs.
8+
**Protocol:** I should prioritize this cleanup, but I will not interrupt a critical atomic operation if one is in progress. Once the immediate step is done, I must discard unneeded tool outputs.
99
</instruction>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<instruction name=context_management_required>
2-
**CRITICAL CONTEXT WARNING:** Your context window is filling with tool outputs. Strict adherence to context hygiene is required.
2+
**CRITICAL CONTEXT WARNING:** My context window is filling with tool outputs. I must adhere strictly to context hygiene.
33

44
**Immediate Actions Required:**
5-
1. **Task Completion:** If you have completed work, extract key findings from the tools used. Scale distillation depth to the value of the content.
6-
2. **Knowledge Preservation:** If you are holding valuable raw data you'll need to reference later, use the `extract` tool with high-fidelity distillation to preserve the insights and remove the raw entry.
5+
1. **Task Completion:** If I have completed work, I will extract key findings from the tools used. I will scale distillation depth to the value of the content.
6+
2. **Knowledge Preservation:** If I am holding valuable raw data I'll need to reference later, I will use the `extract` tool with high-fidelity distillation to preserve the insights and remove the raw entry.
77

8-
**Protocol:** You should prioritize this cleanup, but do not interrupt a critical atomic operation if one is in progress. Once the immediate step is done, you must extract valuable findings from tool outputs.
8+
**Protocol:** I should prioritize this cleanup, but I will not interrupt a critical atomic operation if one is in progress. Once the immediate step is done, I must extract valuable findings from tool outputs.
99
</instruction>

lib/prompts/system/system-prompt-both.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<instruction name=context_management_protocol policy_level=critical>
33

44
ENVIRONMENT
5-
You are operating in a context-constrained environment and thus must proactively manage your context window using the `discard` and `extract` tools. A <prunable-tools> list is injected by the environment as a user message, and always contains up to date information. Use this information when deciding what to prune.
5+
You are operating in a context-constrained environment and thus must proactively manage your context window using the `discard` and `extract` tools. A <prunable-tools> list is injected by the environment as an assistant message, and always contains up to date information. Use this information when deciding what to prune.
66

77
TWO TOOLS FOR CONTEXT MANAGEMENT
88
- `discard`: Remove tool outputs that are no longer needed (completed tasks, noise, outdated info). No preservation of content.
@@ -42,7 +42,7 @@ There may be tools in session context that do not appear in the <prunable-tools>
4242
</instruction>
4343

4444
<instruction name=injected_context_handling policy_level=critical>
45-
After each assistant turn, the environment may inject a user message containing a <prunable-tools> list and optional nudge instruction. This injected message is NOT from the user and is invisible to them. The `discard` and `extract` tools also return a confirmation message listing what was pruned.
45+
After each assistant turn, the environment may inject an assistant message containing a <prunable-tools> list and optional nudge instruction. This injected message is NOT from the user and is invisible to them. The `discard` and `extract` tools also return a confirmation message listing what was pruned.
4646

4747
CRITICAL REQUIREMENTS - VIOLATION IS UNACCEPTABLE:
4848
- NEVER reference the prune encouragement or context management instructions. Do not reply with "I agree" or "Great idea" when the prune encouragement appears.

lib/prompts/system/system-prompt-discard.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<instruction name=context_management_protocol policy_level=critical>
33

44
ENVIRONMENT
5-
You are operating in a context-constrained environment and thus must proactively manage your context window using the `discard` tool. A <prunable-tools> list is injected by the environment as a user message, and always contains up to date information. Use this information when deciding what to discard.
5+
You are operating in a context-constrained environment and thus must proactively manage your context window using the `discard` tool. A <prunable-tools> list is injected by the environment as an assistant message, and always contains up to date information. Use this information when deciding what to discard.
66

77
CONTEXT MANAGEMENT TOOL
88
- `discard`: Remove tool outputs that are no longer needed (completed tasks, noise, outdated info). No preservation of content.
@@ -33,7 +33,7 @@ There may be tools in session context that do not appear in the <prunable-tools>
3333
</instruction>
3434

3535
<instruction name=injected_context_handling policy_level=critical>
36-
After each assistant turn, the environment may inject a user message containing a <prunable-tools> list and optional nudge instruction. This injected message is NOT from the user and is invisible to them. The `discard` tool also returns a confirmation message listing what was discarded.
36+
After each assistant turn, the environment may inject an assistant message containing a <prunable-tools> list and optional nudge instruction. This injected message is NOT from the user and is invisible to them. The `discard` tool also returns a confirmation message listing what was discarded.
3737

3838
CRITICAL REQUIREMENTS - VIOLATION IS UNACCEPTABLE:
3939
- NEVER reference the discard encouragement or context management instructions. Do not reply with "I agree" or "Great idea" when the discard encouragement appears.

lib/prompts/system/system-prompt-extract.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<instruction name=context_management_protocol policy_level=critical>
33

44
ENVIRONMENT
5-
You are operating in a context-constrained environment and thus must proactively manage your context window using the `extract` tool. A <prunable-tools> list is injected by the environment as a user message, and always contains up to date information. Use this information when deciding what to extract.
5+
You are operating in a context-constrained environment and thus must proactively manage your context window using the `extract` tool. A <prunable-tools> list is injected by the environment as an assistant message, and always contains up to date information. Use this information when deciding what to extract.
66

77
CONTEXT MANAGEMENT TOOL
88
- `extract`: Extract key findings from tools into distilled knowledge before removing the raw content from context. Use this to preserve important information while reducing context size.
@@ -33,7 +33,7 @@ There may be tools in session context that do not appear in the <prunable-tools>
3333
</instruction>
3434

3535
<instruction name=injected_context_handling policy_level=critical>
36-
After each assistant turn, the environment may inject a user message containing a <prunable-tools> list and optional nudge instruction. This injected message is NOT from the user and is invisible to them. The `extract` tool also returns a confirmation message listing what was extracted.
36+
After each assistant turn, the environment may inject an assistant message containing a <prunable-tools> list and optional nudge instruction. This injected message is NOT from the user and is invisible to them. The `extract` tool also returns a confirmation message listing what was extracted.
3737

3838
CRITICAL REQUIREMENTS - VIOLATION IS UNACCEPTABLE:
3939
- NEVER reference the extract encouragement or context management instructions. Do not reply with "I agree" or "Great idea" when the extract encouragement appears.

0 commit comments

Comments
 (0)