You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/prompts/discard-tool-spec.txt
+11-26Lines changed: 11 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -3,34 +3,29 @@ Discards tool outputs from context to manage conversation size and reduce noise.
3
3
## IMPORTANT: The Prunable List
4
4
A `<prunable-tools>` list is provided to you showing available tool outputs you can discard when there are tools available for pruning. Each line has the format `ID: tool, parameter` (e.g., `20: read, /path/to/file.ts`). You MUST only use numeric IDs that appear in this list to select which tools to discard.
5
5
6
-
**Note:** For `write` and `edit` tools, discarding removes the input content (the code being written/edited) while preserving the output confirmation. This is useful after completing a file modification when you no longer need the raw content in context.
7
-
8
6
## When to Use This Tool
9
7
10
-
Use `discard` for removing tool outputs that are no longer needed **without preserving their content**:
11
-
12
-
### 1. Task Completion (Clean Up)
13
-
**When:** You have successfully completed a specific unit of work (e.g., fixed a bug, wrote a file, answered a question).
14
-
**Action:** Discard the tools used for that task with reason `completion`.
8
+
Use `discard` for removing tool content that is no longer needed
15
9
16
-
### 2. Removing Noise (Garbage Collection)
17
-
**When:** You have read files or run commands that turned out to be irrelevant, unhelpful, or outdated (meaning later tools have provided fresher, more valid information).
18
-
**Action:** Discard these specific tool outputs immediately with reason `noise`.
10
+
- **Noise:** Irrelevant, unhelpful, or superseded outputs that provide no value.
11
+
- **Task Completion:** Work is complete and there's no valuable information worth preserving.
19
12
20
13
## When NOT to Use This Tool
21
14
22
-
- **If you need to preserve information:** Keep the raw output in context rather than discarding it.
23
-
- **If you'll need the output later:** Don't discard files you plan to edit, or context you'll need for implementation.
15
+
- **If the output contains useful information:** Use `extract` instead to preserve key findings.
16
+
- **If you'll need the output later:** Don't discard files you plan to edit or context you'll need for implementation.
24
17
25
18
## Best Practices
26
19
- **Strategic Batching:** Don't discard single small tool outputs (like short bash commands) unless they are pure noise. Wait until you have several items to perform high-impact discards.
27
20
- **Think ahead:** Before discarding, ask: "Will I need this output for an upcoming task?" If yes, keep it.
28
21
29
22
## Format
30
-
The `ids` parameter is an array where the first element is the reason, followed by numeric IDs:
31
-
`ids: ["reason", "id1", "id2", ...]`
32
23
33
-
## Examples
24
+
- `ids`: Array where the first element is the reason, followed by numeric IDs from the `<prunable-tools>` list
25
+
26
+
Reasons: `noise` | `completion`
27
+
28
+
## Example
34
29
35
30
<example_noise>
36
31
Assistant: [Reads 'wrong_file.ts']
@@ -40,17 +35,7 @@ This file isn't relevant to the auth system. I'll remove it to clear the context
40
35
41
36
<example_completion>
42
37
Assistant: [Runs tests, they pass]
43
-
The tests passed. I'll clean up now.
38
+
The tests passed and I don't need to preserve any details. I'll clean up now.
44
39
[Uses discard with ids: ["completion", "20", "21"]]
45
40
</example_completion>
46
41
47
-
<example_keep>
48
-
Assistant: [Reads 'auth.ts' to understand the login flow]
49
-
I've understood the auth flow. I'll need to modify this file to add the new validation, so I'm keeping this read in context rather than discarding.
50
-
</example_keep>
51
-
52
-
<example_edit_completion>
53
-
Assistant: [Edits 'auth.ts' to add validation]
54
-
The edit was successful. I no longer need the raw edit content in context.
Copy file name to clipboardExpand all lines: lib/prompts/extract-tool-spec.txt
+18-50Lines changed: 18 additions & 50 deletions
Original file line number
Diff line number
Diff line change
@@ -7,70 +7,38 @@ A `<prunable-tools>` list is provided to you showing available tool outputs you
7
7
8
8
Use `extract` when you have gathered useful information that you want to **preserve in distilled form** before removing the raw outputs:
9
9
10
-
### 1. Task Completion
11
-
**When:** You have completed a unit of work and want to preserve key findings.
12
-
**Action:** Extract with distillation scaled to the value of the content. High-value insights require comprehensive capture; routine completions can use lighter distillation.
13
-
14
-
### 2. Knowledge Preservation
15
-
**When:** You have read files, run commands, or gathered context that contains valuable information you'll need to reference later, but the full raw output is too large to keep.
16
-
**Action:** Convert raw data into distilled knowledge. This allows you to remove large outputs (like full file reads) while keeping only the specific parts you need (like a single function signature or constant).
17
-
18
-
## CRITICAL: Distillation Requirements
19
-
20
-
You MUST provide distilled findings in the `distillation` parameter. This is not optional.
21
-
22
-
- **Comprehensive Capture:** Distillation is not just a summary. It must be a high-fidelity representation of the technical details. If you read a file, the distillation should include function signatures, specific logic flows, constant values, and any constraints or edge cases discovered.
23
-
- **Task-Relevant Verbosity:** Be as verbose as necessary to ensure that the "distilled" version is a complete substitute for the raw output for the task at hand. If you will need to reference a specific algorithm or interface later, include it in its entirety within the distillation.
24
-
- **Extract Per-ID:** When extracting from multiple tools, your `distillation` object MUST contain a corresponding entry for EVERY ID being extracted. You must capture high-fidelity findings for each tool individually to ensure no signal is lost.
25
-
- **Structure:** Map EVERY `ID` from the `ids` array to its specific distilled findings.
26
-
Example: `{ "20": { ... }, "21": { ... } }`
27
-
- Capture all relevant details (function names, logic, constraints) to ensure no signal is lost.
28
-
- Prioritize information that is essential for the immediate next steps of your plan.
10
+
- **Task Completion:** You completed a unit of work and want to preserve key findings.
11
+
- **Knowledge Preservation:** You have context that contains valuable information, but also a lot of unnecessary detail - you only need to preserve some specifics.
29
12
30
13
## When NOT to Use This Tool
31
14
32
-
- **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.
33
-
- **If uncertain:** Prefer keeping over re-fetching. The cost of retaining context is lower than the cost of redundant tool calls.
15
+
- **If you need precise syntax:** If you'll edit a file or grep for exact strings, keep the raw output.
16
+
- **If uncertain:** Prefer keeping over re-fetching.
17
+
34
18
35
19
## Best Practices
36
-
- **Technical Fidelity:** Ensure that types, parameters, and return values are preserved if they are relevant to upcoming implementation steps.
37
20
- **Strategic Batching:** Wait until you have several items or a few large outputs to extract, rather than doing tiny, frequent extractions. Aim for high-impact extractions that significantly reduce context size.
38
21
- **Think ahead:** Before extracting, ask: "Will I need the raw output for an upcoming task?" If you researched a file you'll later edit, do NOT extract it.
39
22
40
23
## Format
41
-
The `ids` parameter is an array of numeric IDs as strings:
42
-
`ids: ["id1", "id2", ...]`
43
24
44
-
The `distillation` parameter is an object mapping each ID to its distilled findings:
- `ids`: Array of numeric IDs as strings from the `<prunable-tools>` list
26
+
- `distillation`: Array of strings, one per ID (positional: distillation[0] is for ids[0], etc.)
27
+
28
+
Each distillation string should capture the essential information you need to preserve - function signatures, logic, constraints, values, etc. Be as detailed as needed for your task.
46
29
47
30
## Example
48
31
49
32
<example_extraction>
50
-
Assistant: [Reads service implementation, types, and config]
51
-
I'll preserve the full technical specification and implementation logic before extracting.
52
-
[Uses extract with ids: ["10", "11", "12"], distillation: {
53
-
"10": {
54
-
"file": "src/services/auth.ts",
55
-
"signatures": [
56
-
"async function validateToken(token: string): Promise<User | null>",
57
-
"function hashPassword(password: string): string"
58
-
],
59
-
"logic": "The validateToken function first checks the local cache before calling the external OIDC provider. It uses a 5-minute TTL for cached tokens.",
60
-
"dependencies": ["import { cache } from '../utils/cache'", "import { oidc } from '../config'"],
61
-
"constraints": "Tokens must be at least 128 chars long. hashPassword uses bcrypt with 12 rounds."
@@ -39,5 +38,7 @@ When in doubt, keep it. Batch your actions and aim for high-impact prunes that s
39
38
FAILURE TO PRUNE will result in context leakage and DEGRADED PERFORMANCES.
40
39
There may be tools in session context that do not appear in the <prunable-tools> list, this is expected, you can ONLY prune what you see in <prunable-tools>.
41
40
41
+
If you see a user message containing only `[internal: context sync - no response needed]`, this is an internal system marker used for context injection - it is NOT user input. Do not acknowledge it, do not respond to it, and do not mention it. Simply continue with your current task or wait for actual user input.
Copy file name to clipboardExpand all lines: lib/prompts/system/system-prompt-discard.txt
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -30,5 +30,7 @@ When in doubt, keep it. Batch your actions and aim for high-impact discards that
30
30
FAILURE TO DISCARD will result in context leakage and DEGRADED PERFORMANCES.
31
31
There may be tools in session context that do not appear in the <prunable-tools> list, this is expected, you can ONLY discard what you see in <prunable-tools>.
32
32
33
+
If you see a user message containing only `[internal: context sync - no response needed]`, this is an internal system marker used for context injection - it is NOT user input. Do not acknowledge it, do not respond to it, and do not mention it. Simply continue with your current task or wait for actual user input.
Copy file name to clipboardExpand all lines: lib/prompts/system/system-prompt-extract.txt
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -30,5 +30,7 @@ When in doubt, keep it. Batch your actions and aim for high-impact extractions t
30
30
FAILURE TO EXTRACT will result in context leakage and DEGRADED PERFORMANCES.
31
31
There may be tools in session context that do not appear in the <prunable-tools> list, this is expected, you can ONLY extract what you see in <prunable-tools>.
32
32
33
+
If you see a user message containing only `[internal: context sync - no response needed]`, this is an internal system marker used for context injection - it is NOT user input. Do not acknowledge it, do not respond to it, and do not mention it. Simply continue with your current task or wait for actual user input.
0 commit comments