|
1 | | -Collapses a contiguous range of conversation into a single summary. |
| 1 | +Use this tool to collapse a contiguous range of conversation into a preserved summary. |
2 | 2 |
|
3 | | -## When to Use This Tool |
| 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. |
4 | 5 |
|
5 | | -Use `compress` when you want to condense an entire sequence of work into a brief summary: |
| 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. |
6 | 7 |
|
7 | | -- **Phase Completion:** You completed a phase (research, tool calls, implementation) and want to collapse the entire sequence into a summary. |
8 | | -- **Exploration Done:** You explored multiple files or ran multiple commands and only need a summary of what you learned. |
9 | | -- **Failed Attempts:** You tried several unsuccessful approaches and want to condense them into a brief note. |
10 | | -- **Verbose Output:** A section of conversation has grown large but can be summarized without losing critical details. |
| 8 | +THE SUMMARY |
| 9 | +Your summary must be COMPLETE. Capture file paths, function signatures, decisions made, constraints discovered, key findings... EVERYTHING that maintains context integrity. This is not a brief note - it is a technical substitute so faithful that the original conversation adds no value. |
11 | 10 |
|
12 | | -## When NOT to Use This Tool |
| 11 | +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. |
13 | 12 |
|
14 | | -- **If you need specific details:** If you'll need exact code, file contents, or error messages from the range, keep them. |
15 | | -- **For individual tool outputs:** Use `prune` or `distill` for single tool outputs. Compress targets conversation ranges. |
16 | | -- **If it's recent content:** You may still need recent work for the current phase. |
| 13 | +WHEN TO COMPRESS |
| 14 | +Compress when a phase of work is truly complete and the raw conversation is no longer needed: |
17 | 15 |
|
18 | | -## How It Works |
| 16 | +Research concluded and findings are clear |
| 17 | +Implementation finished and verified |
| 18 | +Exploration exhausted and patterns understood |
19 | 19 |
|
20 | | -1. `startString` — A unique text string that marks the start of the range to compress |
21 | | -2. `endString` — A unique text string that marks the end of the range to compress |
22 | | -3. `topic` — A short label (3-5 words) describing the compressed content |
23 | | -4. `summary` — The replacement text that will be inserted |
| 20 | +Do NOT compress when: |
| 21 | +You may need exact code, error messages, or file contents from the range |
| 22 | +Work in that area is still active or may resume |
| 23 | +You're mid-sprint on related functionality |
24 | 24 |
|
25 | | -Everything between startString and endString (inclusive) is removed and replaced with your summary. |
| 25 | +Before compressing, ask: _"Am I certain this phase is complete?"_ Compression is irreversible. The summary replaces everything in the range. |
26 | 26 |
|
27 | | -**Important:** The compress will FAIL if `startString` or `endString` is not found in the conversation. The compress will also FAIL if either string is found multiple times. Provide a larger string with more surrounding context to uniquely identify the intended match. |
| 27 | +BOUNDARY MATCHING |
| 28 | +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. |
28 | 29 |
|
29 | | -## Best Practices |
30 | | - |
31 | | -- **Choose unique strings:** Pick text that appears only once in the conversation. |
32 | | -- **Write concise topics:** Examples: "Auth System Exploration", "Token Logic Refactor" |
33 | | -- **Write comprehensive summaries:** Include key information like file names, function signatures, and important findings. |
34 | | -- **Timing:** Best used after finishing a work phase, not during active exploration. |
35 | | - |
36 | | -## Format |
37 | | - |
38 | | -- `input`: Array with four elements: [startString, endString, topic, summary] |
39 | | - |
40 | | -## Example |
41 | | - |
42 | | -<example_compress> |
43 | | -Conversation: [Asked about auth] -> [Read 5 files] -> [Analyzed patterns] -> [Found "JWT tokens with 24h expiry"] |
44 | | - |
45 | | -[Uses compress with: |
46 | | -input: [ |
47 | | -"Asked about authentication", |
48 | | -"JWT tokens with 24h expiry", |
49 | | -"Auth System Exploration", |
50 | | -"Auth: JWT 24h expiry, bcrypt passwords, refresh rotation. Files: auth.ts, tokens.ts, middleware/auth.ts" |
51 | | -] |
52 | | -] |
53 | | -</example_compress> |
54 | | - |
55 | | -<example_keep> |
56 | | -Assistant: [Just finished reading auth.ts] |
57 | | -I've read the auth file and now need to make edits based on it. I'm keeping this in context rather than compressing. |
58 | | -</example_keep> |
| 30 | +THE FORMAT OF COMPRESS |
| 31 | +`topic`: Short label (3-5 words) for display - e.g., "Auth System Exploration" |
| 32 | + `content`: Object containing: |
| 33 | + `startString`: Unique text string marking the beginning of the range |
| 34 | + `endString`: Unique text string marking the end of the range |
| 35 | + `summary`: Complete technical summary replacing all content in the range |
0 commit comments