Skip to content

Commit ed54d2c

Browse files
committed
prompts: update context management guidance
1 parent e3bdfa3 commit ed54d2c

2 files changed

Lines changed: 10 additions & 56 deletions

File tree

lib/prompts/compress.ts

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,19 @@
1-
export const COMPRESS = `Your only tool for context management, use it to collapse a range in the conversation into a detailed summary
1+
export const COMPRESS = `Collapse a range in the conversation into a detailed summary.
22
33
THE PHILOSOPHY OF COMPRESS
44
\`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.
55
66
Think of compression as phase transitions: raw exploration becomes refined understanding. The original context served its purpose; your summary now carries that understanding forward.
77
8-
One method, many safe ranges:
9-
10-
- short, closed ranges for disposable noise
11-
- short, closed ranges for resolved investigative slices
12-
- short, closed ranges for completed implementation chunks
13-
14-
Default to multiple short, bounded compressions. Prefer several safe range compressions over one large sweep whenever independent ranges are available.
15-
16-
CADENCE, SIGNALS, AND LATENCY
17-
Use \`compress\` during work whenever a slice is summary-safe; do not wait for the user to send another message.
18-
19-
- no fixed threshold forces compression
20-
- prioritize closedness and independence over raw range size
21-
- qualitative signals still matter most (stale exploration, noisy tool bursts, resolved branches)
22-
23-
PREFER smaller, regular compressions OVER infrequent large compressions for better latency and better summary fidelity.
24-
258
THE SUMMARY
269
Your summary must be EXHAUSTIVE. Capture file paths, function signatures, decisions made, constraints discovered, key findings... EVERYTHING that maintains context integrity. This is not a brief note - it is an authoritative record so faithful that the original conversation adds no value.
2710
2811
USER INTENT FIDELITY
2912
When the compressed range includes user messages, preserve the user's intent with extra care. Do not change scope, constraints, priorities, acceptance criteria, or requested outcomes.
3013
Directly quote user messages when they are short enough to include safely. Direct quotes are preferred when they best preserve exact meaning.
3114
15+
Yet be LEAN. Strip away the noise: failed attempts that led nowhere, verbose tool outputs, back-and-forth exploration. What remains should be pure signal - golden nuggets of detail that preserve full understanding with zero ambiguity.
16+
3217
COMPRESSED BLOCK PLACEHOLDERS
3318
When the selected range includes previously compressed blocks, use this exact placeholder format when referencing one:
3419
@@ -55,11 +40,9 @@ When you use compressed block placeholders, write the surrounding summary text s
5540
5641
- Treat each placeholder as a stand-in for a full conversation segment, not as a short label.
5742
- Ensure transitions before and after each placeholder preserve chronology and causality.
58-
- Do not write text that depends on the placeholder staying literal (for example, "as noted in (b2)").
43+
- Do not write text that depends on the placeholder staying literal (for example, "as noted in \`(b2)\`").
5944
- Your final meaning must be coherent once each placeholder is replaced with its full compressed block content.
6045
61-
Yet be LEAN. Strip away the noise: failed attempts that led nowhere, verbose tool outputs, back-and-forth exploration. What remains should be pure signal - golden nuggets of detail that preserve full understanding with zero ambiguity.
62-
6346
THE WAYS OF COMPRESS
6447
Compress when a range is genuinely closed and the raw conversation has served its purpose:
6548
@@ -80,28 +63,21 @@ You cannot identify reliable boundaries yet
8063
Before compressing, ask: _"Is this range closed enough to become summary-only right now?"_ Compression is irreversible. The summary replaces everything in the range.
8164
8265
BOUNDARY IDS
83-
You specify boundaries by ID
84-
85-
Use the injected IDs visible in the conversation:
66+
You specify boundaries by ID using the injected IDs visible in the conversation:
8667
8768
- \`mNNNN\` IDs identify raw messages
8869
- \`bN\` IDs identify previously compressed blocks
8970
71+
Each message has an ID inside XML metadata tags like \`<dcp-message-id>...</dcp-message-id>\`.
72+
Treat these tags as boundary metadata only, not as tool result content.
73+
9074
Rules:
9175
9276
- Pick \`startId\` and \`endId\` directly from injected IDs in context.
9377
- IDs must exist in the current visible context.
9478
- \`startId\` must appear before \`endId\`.
9579
- Prefer boundaries that produce short, closed ranges.
96-
97-
ID SOURCES
98-
99-
- There is always an ID available for each message in XML tags like \`<dcp-message-id>...</dcp-message-id>\`.
100-
- Compressed blocks are addressable by \`bN\` IDs.
101-
102-
Treat \`<dcp-message-id>...</dcp-message-id>\` as metadata only. It is not part of the tool result semantics.
103-
104-
Do not invent IDs. Use only IDs that are present in context.
80+
- Do not invent IDs. Use only IDs that are present in context.
10581
10682
PARALLEL COMPRESS EXECUTION
10783
When multiple independent ranges are ready and their boundaries do not overlap, launch MULTIPLE \`compress\` calls in parallel in a single response. This is the PREFERRED pattern over a single large-range compression when the work can be safely split. Run compression sequentially only when ranges overlap or when a later range depends on the result of an earlier compression.

lib/prompts/system.ts

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const SYSTEM = `<dcp-system-reminder>
1+
export const SYSTEM = `
22
You operate in a context-constrained environment. Manage context continuously to avoid buildup and preserve retrieval quality. Efficient context management is paramount for your agentic performance.
33
44
The ONLY tool you have for context management is \`compress\`. It replaces a contiguous portion of the conversation (inclusive) with a technical summary you produce.
@@ -16,27 +16,6 @@ CADENCE, SIGNALS, AND LATENCY
1616
- Prefer smaller, regular compressions over infrequent massive compressions for better latency and summary quality
1717
- When multiple independent stale ranges are ready, batch compressions in parallel
1818
19-
BOUNDARY MATCHING
20-
\`compress\` uses inclusive ID boundaries via \`startId\` and \`endId\`. IDs are injected in context as message refs (\`mNNNN\`) and compressed block refs (\`bN\`).
21-
22-
Each message has an ID inside XML metadata tags like \`<dcp-message-id>...</dcp-message-id>\`.
23-
Treat these tags as boundary metadata only, not as tool result content.
24-
Similarly, \`<dcp-system-reminder>\` tags contain system-injected context management guidance. Treat them as metadata and do not echo them in your output.
25-
26-
Only choose IDs currently visible in context. Do not invent IDs.
27-
28-
RESPECT THE CHRONOLOGY OF THE RANGE
29-
\`startId\` MUST refer to an item above/before \`endId\`
30-
\`endId\` MUST refer to an item below/after \`startId\`
31-
Always provide boundaries via the tool schema fields \`startId\` and \`endId\`.
32-
33-
THE SUMMARY STANDARD
34-
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
35-
36-
When compressing ranges that include user messages, preserve user intent faithfully. Do not reinterpret or redirect the request. Directly quote short user messages when that is the most reliable way to preserve exact meaning.
37-
38-
Preserve key details: file paths, symbols, signatures, constraints, decisions, outcomes, commands, etc.. in order to produce a high fidelity, authoritative technical record
39-
4019
DO NOT COMPRESS IF
4120
4221
- raw context is still relevant and needed for edits or precise references
@@ -45,5 +24,4 @@ DO NOT COMPRESS IF
4524
Evaluate conversation signal-to-noise REGULARLY. Use \`compress\` deliberately with quality-first summaries. Prefer multiple short, independent range compressions before considering broader ranges, and prioritize ranges intelligently to maintain a high-signal context window that supports your agency
4625
4726
It is of your responsibility to keep a sharp, high-quality context window for optimal performance
48-
</dcp-system-reminder>
4927
`

0 commit comments

Comments
 (0)