Skip to content

Commit fcfebbe

Browse files
committed
separate prompt responsibilities between system and tool specs
1 parent 6ddb0f2 commit fcfebbe

File tree

3 files changed

+25
-49
lines changed

3 files changed

+25
-49
lines changed

lib/prompts/compress-message.ts

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
export const COMPRESS_MESSAGE = `Collapse selected individual messages in the conversation into detailed summaries.
22
3-
THE PHILOSOPHY OF MESSAGE COMPRESS
4-
\`compress\` in message mode transforms specific stale messages into dense, high-fidelity summaries. This is not cleanup - it is crystallization. Your summary becomes the authoritative record of what each selected message contributed.
5-
6-
Think of compression as phase transitions: raw exploration becomes refined understanding. The original message served its purpose; your summary now carries that understanding forward.
7-
83
THE SUMMARY
94
Your summary must be EXHAUSTIVE. Capture file paths, function signatures, decisions made, constraints discovered, key findings, tool outcomes, and user intent details that matter... EVERYTHING that preserves the value of the selected message after the raw message is removed.
105
@@ -20,6 +15,7 @@ You specify individual raw messages by ID using the injected IDs visible in the
2015
- \`mNNNN\` IDs identify raw messages
2116
2217
Each message has an ID inside XML metadata tags like \`<dcp-message-id priority="high">m0007</dcp-message-id>\`.
18+
The ID tag appears at the end of the message it belongs to — it identifies the message above it, not the one below it.
2319
Treat these tags as message metadata only, not as content to summarize. Use only the inner \`mNNNN\` value as the \`messageId\`.
2420
The \`priority\` attribute indicates relative context cost. Prefer higher-priority closed messages before lower-priority ones.
2521
@@ -32,23 +28,10 @@ Rules:
3228
- Do not invent IDs. Use only IDs that are present in context.
3329
- Do not target prior compressed blocks or block summaries.
3430
35-
THE WAYS OF MESSAGE COMPRESS
36-
Compress when an individual message is genuinely closed and unlikely to be needed verbatim again:
37-
38-
Research findings have already been absorbed into later work
39-
Tool-heavy assistant updates are no longer needed in raw form
40-
Earlier planning or analysis messages are now stale but still important to retain as summary
41-
42-
Do NOT compress when:
43-
You may need the exact raw message text, code, or error output in the immediate next steps
44-
The message is still actively being referenced or edited against
45-
The target is a prior compressed block or block summary rather than a raw message
46-
47-
Before compressing, ask: _"Is this message closed enough to become summary-only right now?"_
48-
4931
BATCHING
5032
Select MANY messages in a single tool call when they are independently safe to compress.
5133
Each entry should summarize exactly one message, and the tool can receive as many entries as needed in one batch.
34+
When several messages are equally safe to compress, prefer higher-priority messages first.
5235
5336
Because each message is compressed independently:
5437

lib/prompts/compress-range.ts

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
export const COMPRESS_RANGE = `Collapse a range in the conversation into a detailed summary.
22
3-
THE PHILOSOPHY OF COMPRESS
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.
5-
6-
Think of compression as phase transitions: raw exploration becomes refined understanding. The original context served its purpose; your summary now carries that understanding forward.
7-
83
THE SUMMARY
94
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.
105
@@ -43,42 +38,23 @@ When you use compressed block placeholders, write the surrounding summary text s
4338
- Do not write text that depends on the placeholder staying literal (for example, "as noted in \`(b2)\`").
4439
- Your final meaning must be coherent once each placeholder is replaced with its full compressed block content.
4540
46-
THE WAYS OF COMPRESS
47-
Compress when a range is genuinely closed and the raw conversation has served its purpose:
48-
49-
Research concluded and findings are clear
50-
Implementation finished and verified
51-
Exploration exhausted and patterns understood
52-
53-
Compress smaller ranges when:
54-
You need to discard dead-end noise without waiting for a whole chapter to close
55-
You need to preserve key findings from a narrow slice while freeing context quickly
56-
You can bound a stale range cleanly with injected IDs
57-
58-
Do NOT compress when:
59-
You may need exact code, error messages, or file contents from the range in the immediate next steps
60-
Work in that area is still active or likely to resume immediately
61-
You cannot identify reliable boundaries yet
62-
63-
Before compressing, ask: _"Is this range closed enough to become summary-only right now?"_ Compression is irreversible. The summary replaces everything in the range.
64-
6541
BOUNDARY IDS
6642
You specify boundaries by ID using the injected IDs visible in the conversation:
6743
6844
- \`mNNNN\` IDs identify raw messages
6945
- \`bN\` IDs identify previously compressed blocks
7046
7147
Each message has an ID inside XML metadata tags like \`<dcp-message-id>...</dcp-message-id>\`.
48+
The ID tag appears at the end of the message it belongs to — it identifies the message above it, not the one below it.
7249
Treat these tags as boundary metadata only, not as tool result content.
7350
7451
Rules:
7552
7653
- Pick \`startId\` and \`endId\` directly from injected IDs in context.
7754
- IDs must exist in the current visible context.
7855
- \`startId\` must appear before \`endId\`.
79-
- Prefer boundaries that produce short, closed ranges.
8056
- Do not invent IDs. Use only IDs that are present in context.
8157
8258
BATCHING
83-
Do not call the tool once per range. When multiple independent ranges are ready and their boundaries do not overlap, include all of them as separate entries in the \`content\` array of a single tool call. Each entry should have its own \`startId\`, \`endId\`, and \`summary\`.
59+
When multiple independent ranges are ready and their boundaries do not overlap, include all of them as separate entries in the \`content\` array of a single tool call. Each entry should have its own \`startId\`, \`endId\`, and \`summary\`.
8460
`

lib/prompts/system.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ The ONLY tool you have for context management is \`compress\`. It replaces older
55
66
\`<dcp-message-id>\` and \`<dcp-system-reminder>\` tags are environment-injected metadata. Do not output them.
77
8+
THE PHILOSOPHY OF COMPRESS
9+
\`compress\` transforms conversation content into dense, high-fidelity summaries. This is not cleanup - it is crystallization. Your summary becomes the authoritative record of what transpired.
10+
11+
Think of compression as phase transitions: raw exploration becomes refined understanding. The original context served its purpose; your summary now carries that understanding forward.
12+
813
OPERATING STANCE
914
Prefer short, closed, summary-safe compressions.
1015
When multiple independent stale sections exist, prefer several focused compressions (in parallel when possible) over one broad compression.
@@ -18,12 +23,24 @@ CADENCE, SIGNALS, AND LATENCY
1823
- Prefer smaller, regular compressions over infrequent massive compressions for better latency and summary quality
1924
- When multiple independent stale sections are ready, batch compressions in parallel
2025
26+
COMPRESS WHEN
27+
28+
A section is genuinely closed and the raw conversation has served its purpose:
29+
30+
- Research concluded and findings are clear
31+
- Implementation finished and verified
32+
- Exploration exhausted and patterns understood
33+
- Dead-end noise can be discarded without waiting for a whole chapter to close
34+
2135
DO NOT COMPRESS IF
2236
23-
- raw context is still relevant and needed for edits or precise references
24-
- the target content is still actively in progress
37+
- Raw context is still relevant and needed for edits or precise references
38+
- The target content is still actively in progress
39+
- You may need exact code, error messages, or file contents in the immediate next steps
40+
41+
Before compressing, ask: _"Is this section closed enough to become summary-only right now?"_
2542
26-
Evaluate conversation signal-to-noise REGULARLY. Use \`compress\` deliberately with quality-first summaries. Prefer multiple short, independent compressions before considering broader ones, and prioritize stale content intelligently to maintain a high-signal context window that supports your agency
43+
Evaluate conversation signal-to-noise REGULARLY. Use \`compress\` deliberately with quality-first summaries. Prioritize stale content intelligently to maintain a high-signal context window that supports your agency.
2744
28-
It is of your responsibility to keep a sharp, high-quality context window for optimal performance
45+
It is of your responsibility to keep a sharp, high-quality context window for optimal performance.
2946
`

0 commit comments

Comments
 (0)