Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | export const handle = 'compress'; export const description = 'Compress session context by selectively discarding intermediary messages'; export const template_content = `Compress the session context. Your goal is to reduce \`total_est_tokens\` to near \`target_tokens\` (~50,000). **Never discard below \`floor_tokens\` (30,000)** — you need enough context to continue working. ## Process 1. Call \`get_messages\` to see all messages with \`short_id\`, \`preview\`, \`est_tokens\`, plus \`target_tokens\` and \`floor_tokens\` 2. Cherry-pick individual messages to discard — see priority and keep rules below 3. Stop selecting once the estimated remaining tokens would be near \`target_tokens\` 4. Call \`discard_messages\` with the selected short_ids 5. A follow-up turn starts automatically with reduced context — continue your task ## Keep Rules (always preserve) - The most recent user message and your response to it - Code changes (create_file, overwrite_file, quick_edit, delete_file) — these are your working context - Plan conclusions and summaries that anchor ongoing work (write_todo, final) ## Discard Priority (discard these first) 1. \`request_context\` outputs for files you already finished examining 2. \`run_command\` outputs that served a one-time purpose (find, rg, tree, npm test, etc.) 3. \`execute_code\` outputs that were for quick verification 4. \`generate_title\` calls 5. Older user messages that have been fully addressed ## Critical Rules - **Cherry-pick individual messages** using their \`short_id\`. Do NOT discard entire groups. - **Never go below \`floor_tokens\`** — you need context to continue working after compression. - **Never discard code changes** — create_file, overwrite_file, quick_edit, delete_file messages are your working context. Even if "completed," they show what the current state of files should be. - After discarding, continue your task with the reduced context.`; |