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/compress.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
Use this tool to collapse a contiguous range of conversation into a preserved summary.
1
+
Your only tool for context management, use it to collapse a range in the conversation into a detailed summary
2
2
3
3
THE PHILOSOPHY OF COMPRESS
4
4
`compress` transforms verbose conversation sequences into dense, high-fidelity summaries. This is not cleanup - it is crystallization. Your summary becomes the authoritative record of what transpired.
@@ -39,7 +39,7 @@ BOUNDARY MATCHING
39
39
You specify boundaries by matching unique text strings in the conversation. CRITICAL: In code-centric conversations, strings repeat often. Provide sufficiently unique text to match exactly once. If a match fails (not found or found multiple times), the tool will error - extend your boundary string with more surrounding context in order to make SURE the tool does NOT error.
40
40
41
41
WHERE TO PICK STRINGS FROM (important for reliable matching):
42
-
42
+
-`muid` and `uid` strings in message and tool output annotations (MOST RELIABLE - guaranteed unique)
43
43
- Your own assistant text responses (MOST RELIABLE - always stored verbatim)
44
44
- The user's own words in their messages
45
45
- Tool result output text (distinctive substrings within the output)
Copy file name to clipboardExpand all lines: lib/prompts/nudge.md
+5-10Lines changed: 5 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,17 +13,12 @@ NOISE REMOVAL: If you read files or ran commands that yielded no value, compress
13
13
PHASE COMPLETION: If a chapter is complete, compress the entire sequence into a detailed technical summary with unambiguous outcomes.
14
14
</instruction>
15
15
16
-
<instructionname=context_limit_reached>
17
-
CRITICAL CONTEXT LIMIT
18
-
Your session context has exceeded the configured limit. Strict adherence to context compression is required.
16
+
<instructionname=context_buildup_warning>
17
+
The context window is filling-up. You've reached a point where performance may increasingly degrade. Active context management is now strategically relevant. Mind your context footprint as the conversation grows
19
18
20
-
PROTOCOL
21
-
You should prioritize context management, but do not interrupt a critical atomic operation if one is in progress. Once the immediate step is done, you must perform context management.
22
-
23
-
IMMEDIATE ACTION REQUIRED
24
-
PHASE COMPLETION: If a phase is complete, compress the entire sequence now.
19
+
Avoid unnecessary context build-up with targeted uses of the `compress` tool. Start with low hanging fruits and clearly identified ranges that can be compressed with minimal risk of losing critical information. Look BACK on the conversation history and avoid compressing the newest ranges until you have exhausted older ones
25
20
26
-
KNOWLEDGE PRESERVATION: If no full chapter is closed yet, compress smaller closed ranges with high-fidelity summaries to preserve critical findings.
21
+
If you are performing a critical atomic operation, do not interrupt it, but make sure to perform context management rapidly
27
22
28
-
NOISE REMOVAL: Compress clearly irrelevant or superseded ranges first to recover context quickly.
23
+
Be mindful of the startString and endString you use for compression and prefer using `muid` and `uid` strings for reliable boundary matching. Ensure your summaries are inclusive of all parts of the range.
You operate a context-constrained environment and MUST PROACTIVELY MANAGE IT TO AVOID CONTEXT ROT. Efficient context management is CRITICAL to maintaining performance and ensuring successful task completion.
You operate a context-constrained environment and MUST MANAGE IT to avoid bad context buildup and eventual leak. Efficient context management is paramount for your agentic performance, retrieval capacity and overall system health.
4
4
5
-
AVAILABLE TOOL FOR CONTEXT MANAGEMENT
6
-
`compress`: squash contiguous portions of conversation and replace them with low-level technical summaries.
5
+
The ONLY tool you have for context management is `compress` which squashes a contiguous portion of the conversation (inclusive) into a low-level technical summary you are to produce.
7
6
8
-
THE PHILOSOPHY OF COMPRESSION
9
-
`compress`is your unified context-management instrument.
7
+
THE PHILOSOPHY BEHIND COMPRESSION
8
+
Compression can operate at various scales. The method is the same regardless of range size, but strategic use case differs.
10
9
11
-
Use it at multiple scales:
10
+
MICRO: ideal for low-latency noise disposal
11
+
MESO: good to filter signal from noise of heavy tool outputs or decluttering the session from closed/resolved investigation paths
12
+
MACRO: for completed phases, distilling entire chapters of conversation
12
13
13
-
- micro-compression for disposable noise
14
-
- meso-compression for closed investigation slices
15
-
- chapter-compression for completed phases
14
+
A strategic and regular use of the `compress` tool is encouraged to maintain a focused context. Be proactive and deliberate in managing your context.
16
15
17
-
The method stays the same; the range changes.
16
+
BOUNDARY MATCHING
17
+
`compress` uses inclusive string boundaries, matching a string at the start of a message or tool output will consume the entire item. User messages are annotated with `muid`, tool outputs with `uid`, and are intended for you to use as startString and endString anchors to avoid any potential mismatch errors. You can also use unique text from your own reasoning or text outputs, but be sure to provide more than enough surrounding context to ensure a unique match. The preferred way to match is still to use `muid` and `uid` strings.
18
18
19
19
THE SUMMARY STANDARD
20
-
Your summary MUST be technical and specific enough to preserve FULL understanding of WHAT TRANSPIRED, such that NO AMBIGUITY remains about what was done, found, or decided.
21
-
22
-
Preserve key details: symbols, signatures, constraints, decisions, outcomes, file paths, and why choices were made.
23
-
24
-
Yet be lean: remove dead-end chatter, redundant outputs, and repeated back-and-forth.
25
-
26
-
WHEN TO COMPRESS
27
-
Use compression aggressively for:
20
+
Your summary MUST be technical and specific enough to preserve FULL understanding of what transpired, such that NO ambiguity remains about what asked, found, planned, done, or decided - yet noise free
28
21
29
-
- irrelevant/noisy exploration that no longer serves the task
30
-
- stale outputs superseded by newer outputs
31
-
- completed work phases that can be replaced by an authoritative technical record
22
+
Preserve key details: file paths, symbols, signatures, constraints, decisions, outcomes... in order to produce a high fidelity, authoritative technical record
32
23
33
-
Do NOT compress when:
24
+
SAFEGUARDS
25
+
Do NOT compress if
26
+
raw context is still relevant and needed for edits or precise references
27
+
the task in the target range is still actively in progress
34
28
35
-
- exact raw text is still needed for imminent edits or precise references
36
-
- the target range is still actively in progress and likely to be revisited immediately
37
-
38
-
Before compressing, ask: _"Is this range closed enough to become summary-only?"_
39
-
40
-
BOUNDARY MATCHING
41
-
Compression uses string boundaries. In code-heavy sessions, text repeats often. Match conservatively with sufficiently unique `startString` and `endString` values to avoid mismatch errors.
29
+
EVALUATE THE CONVERSATION SIGNAL TO NOISE RATIO REGULARLY AND USE `compress` PROACTIVELY. PARALLELIZE COMPRESSION WHEN POSSIBLE. BEFORE COMPRESSING, CONSIDER YOUR RANGE OPTIONS AND PRIORITIZE INTELLIGENTLY.
42
30
43
-
TIMING
44
-
Prefer managing context at the START of a new loop (after receiving a user message) rather than at the END of your previous turn. At turn start, you can better judge relevance versus noise.
45
-
46
-
EVALUATE YOUR CONTEXT AND MANAGE REGULARLY TO AVOID CONTEXT ROT. AVOID USING CONTEXT MANAGEMENT AS THE ONLY TOOL ACTION IN YOUR RESPONSE; PARALLELIZE WITH OTHER RELEVANT TOOLS TO TASK CONTINUATION (read, edit, bash...).
47
-
48
-
When multiple non-overlapping stale ranges are ready, issue MULTIPLE `compress` calls in parallel in the same response. Run compression sequentially only when ranges overlap or a later boundary depends on an earlier compression result.
49
-
50
-
The session is your responsibility. Be PROACTIVE, DELIBERATE, and STRATEGIC. Keep context clean, relevant, and high-quality.
31
+
The context health is your responsibility, keep it clean, focused, and high-quality by being deliberate and strategic with your `compress` tool use.
@@ -58,11 +39,4 @@ Manual mode is enabled. Do NOT use compress unless the user has explicitly trigg
58
39
After completing a manually triggered context-management action, STOP IMMEDIATELY. Do NOT continue with any task execution. End your response right after the tool use completes and wait for the next user input.
0 commit comments