Skip to content

Commit 7a91b9b

Browse files
committed
refactor: consolidate and clarify tool prompts for standalone use
- Remove cross-references between discard/extract tools so each works independently - Add decision hierarchy in both-mode: discard as default, extract for preservation - Consolidate redundant 'WHEN TO X' scenarios with trigger lists - Change trigger lists to focus on timing ('evaluate when') vs prescriptive action - Remove confusing 'minimal distillation for cleanup' concept from extract prompts - Standardize structure across all system prompts and nudges
1 parent 36ed1ef commit 7a91b9b

File tree

8 files changed

+32
-33
lines changed

8 files changed

+32
-33
lines changed

lib/prompts/discard-tool-spec.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Use `discard` for removing tool outputs that are no longer needed **without pres
1919

2020
## When NOT to Use This Tool
2121

22-
- **If you need to preserve information:** Use the `consolidate` tool instead when you want to keep distilled findings from the tool outputs.
22+
- **If you need to preserve information:** Keep the raw output in context rather than discarding it.
2323
- **If you'll need the output later:** Don't discard files you plan to edit, or context you'll need for implementation.
2424

2525
## Best Practices

lib/prompts/extract-tool-spec.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ You MUST provide distilled findings in the `distillation` parameter. This is not
2424

2525
## When NOT to Use This Tool
2626

27-
- **If you don't need to preserve information:** Use the `discard` tool instead for completed tasks or noise removal.
2827
- **If you need precise syntax:** If you'll need to edit a file, grep for exact strings, or reference precise syntax, keep the raw output. Distillation works for understanding; implementation often requires the original.
2928
- **If uncertain:** Prefer keeping over re-fetching. The cost of retaining context is lower than the cost of redundant tool calls.
3029

lib/prompts/nudge/nudge-both.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
**CRITICAL CONTEXT WARNING:** Your context window is filling with tool outputs. Strict adherence to context hygiene is required.
33

44
**Immediate Actions Required:**
5-
1. **Task Completion:** If a sub-task is complete, discard the tools used.
6-
2. **Noise Removal:** If you read files or ran commands that yielded no value, discard them NOW.
7-
3. **Extraction:** If you are holding valuable raw data, you *must* use the `extract` tool to distill the insights and remove the raw entry.
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.
88

99
**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.
1010
</instruction>

lib/prompts/nudge/nudge-discard.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
**CRITICAL CONTEXT WARNING:** Your context window is filling with tool outputs. Strict adherence to context hygiene is required.
33

44
**Immediate Actions Required:**
5-
1. **Task Completion:** If a sub-task is complete, discard the tools used.
6-
2. **Noise Removal:** If you read files or ran commands that yielded no value, discard them NOW.
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.
77

88
**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.
99
</instruction>

lib/prompts/nudge/nudge-extract.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
**CRITICAL CONTEXT WARNING:** Your context window is filling with tool outputs. Strict adherence to context hygiene is required.
33

44
**Immediate Actions Required:**
5-
1. **Task Completion:** If a sub-task is complete, extract findings and remove the raw tool outputs.
6-
2. **Noise Removal:** If you read files or ran commands that yielded no value, extract them with minimal distillation NOW.
7-
3. **Extraction:** If you are holding valuable raw data, you *must* use the `extract` tool to distill the insights and remove the raw entry.
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.
87

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 extract and remove unneeded tool outputs.
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 unneeded tool outputs.
109
</instruction>

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,24 @@ TWO TOOLS FOR CONTEXT MANAGEMENT
88
- `discard`: Remove tool outputs that are no longer needed (completed tasks, noise, outdated info). No preservation of content.
99
- `extract`: Extract key findings into distilled knowledge before removing raw outputs. Use when you need to preserve information.
1010

11+
CHOOSING THE RIGHT TOOL
12+
Ask: "Do I need to preserve any information from this output?"
13+
- **No** → `discard` (default for cleanup)
14+
- **Yes** → `extract` (preserves distilled knowledge)
15+
- **Uncertain** → `extract` (safer, preserves signal)
16+
17+
Common scenarios:
18+
- Task complete, no valuable context → `discard`
19+
- Task complete, insights worth remembering → `extract`
20+
- Noise, irrelevant, or superseded outputs → `discard`
21+
- Valuable context needed later but raw output too large → `extract`
22+
1123
PRUNE METHODICALLY - BATCH YOUR ACTIONS
1224
Every tool call adds to your context debt. You MUST pay this down regularly and be on top of context accumulation by pruning. Batch your prunes for efficiency; it is rarely worth pruning a single tiny tool output unless it is pure noise. Evaluate what SHOULD be pruned before jumping the gun.
1325

14-
WHEN TO PRUNE? THE SCENARIOS TO CONSIDER
15-
1. TASK COMPLETION: When work is done, quietly discard the tools that aren't needed anymore.
16-
2. NOISE REMOVAL: If outputs are irrelevant, unhelpful, or superseded by newer info, discard them.
17-
3. CONTEXT EXTRACTION: When you have valuable context you want to preserve but need to reduce size, use `extract` with high-fidelity distillation. Your distillation must be comprehensive, capturing technical details (signatures, logic, constraints) such that the raw output is no longer needed. THINK: high signal, complete technical substitute.
18-
19-
You WILL use `discard` or `extract` when ANY of these are true:
26+
You WILL evaluate pruning when ANY of these are true:
2027
- Task or sub-task is complete
2128
- You are about to start a new phase of work
22-
- You have gathered enough information to extract from related tools and preserve their value via distillation
23-
- Context contains tool outputs that are unhelpful, noise, or made obsolete by newer outputs
2429
- Write or edit operations are complete (pruning removes the large input content)
2530

2631
You MUST NOT prune when:

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ CONTEXT MANAGEMENT TOOL
1010
DISCARD METHODICALLY - BATCH YOUR ACTIONS
1111
Every tool call adds to your context debt. You MUST pay this down regularly and be on top of context accumulation by discarding. Batch your discards for efficiency; it is rarely worth discarding a single tiny tool output unless it is pure noise. Evaluate what SHOULD be discarded before jumping the gun.
1212

13-
WHEN TO DISCARD? THE SCENARIOS TO CONSIDER
14-
1. TASK COMPLETION: When work is done, quietly discard the tools that aren't needed anymore.
15-
2. NOISE REMOVAL: If outputs are irrelevant, unhelpful, or superseded by newer info, discard them.
13+
WHEN TO DISCARD
14+
- **Task Completion:** When work is done, discard the tools that aren't needed anymore.
15+
- **Noise Removal:** If outputs are irrelevant, unhelpful, or superseded by newer info, discard them.
1616

17-
You WILL use `discard` when ANY of these are true:
17+
You WILL evaluate discarding when ANY of these are true:
1818
- Task or sub-task is complete
1919
- You are about to start a new phase of work
20-
- Context contains tool outputs that are unhelpful, noise, or made obsolete by newer outputs
2120
- Write or edit operations are complete (discarding removes the large input content)
2221

2322
You MUST NOT discard when:

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,18 @@ ENVIRONMENT
55
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.
66

77
CONTEXT MANAGEMENT TOOL
8-
- `extract`: Extract key findings into distilled knowledge before removing raw outputs. Use this to preserve important information while reducing context size.
8+
- `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.
99

1010
EXTRACT METHODICALLY - BATCH YOUR ACTIONS
11-
Every tool call adds to your context debt. You MUST pay this down regularly and be on top of context accumulation by extracting. Batch your extractions for efficiency; it is rarely worth extracting a single tiny tool output unless it is pure noise. Evaluate what SHOULD be extracted before jumping the gun.
11+
Every tool call adds to your context debt. You MUST pay this down regularly and be on top of context accumulation by extracting. Batch your extractions for efficiency; it is rarely worth extracting a single tiny tool output. Evaluate what SHOULD be extracted before jumping the gun.
1212

13-
WHEN TO EXTRACT? THE SCENARIOS TO CONSIDER
14-
1. TASK COMPLETION: When work is done, extract any valuable findings and remove the raw outputs.
15-
2. NOISE REMOVAL: If outputs are irrelevant, unhelpful, or superseded by newer info, extract them with minimal distillation.
16-
3. CONTEXT PRESERVATION: When you have valuable context you want to preserve but need to reduce size, use `extract` with high-fidelity distillation. Your distillation must be comprehensive, capturing technical details (signatures, logic, constraints) such that the raw output is no longer needed. THINK: high signal, complete technical substitute.
13+
WHEN TO EXTRACT
14+
- **Task Completion:** When work is done, extract key findings from the tools used. Scale distillation depth to the value of the content.
15+
- **Knowledge Preservation:** When you have valuable context you want to preserve but need to reduce size, use high-fidelity distillation. Your distillation must be comprehensive, capturing technical details (signatures, logic, constraints) such that the raw output is no longer needed. THINK: high signal, complete technical substitute.
1716

18-
You WILL use `extract` when ANY of these are true:
17+
You WILL evaluate extracting when ANY of these are true:
1918
- Task or sub-task is complete
2019
- You are about to start a new phase of work
21-
- You have gathered enough information to extract from related tools and preserve their value via distillation
22-
- Context contains tool outputs that are unhelpful, noise, or made obsolete by newer outputs
2320
- Write or edit operations are complete (extracting removes the large input content)
2421

2522
You MUST NOT extract when:

0 commit comments

Comments
 (0)