compress_and_fold_context
Compresses verbose terminal or build logs by folding repetitive middle progress lines while preserving 100% of head lines, tail lines, compiler errors, stack traces, and file paths. Deterministic in-memory string transformation that mutates no files and requires no authentication. Returns JSON containing line_accounting_reconciliation (where raw_total_lines equals kept_original_lines_total plus omitted_repetitive_lines), byte_and_token_reconciliation (pricing saved tokens against model's input rate), and folded_context_payload. When raw_text is empty or under 50 lines, returns the diagnostic benchmark or unmodified input without truncation. Use this tool when build or test output exceeds 50 lines before appending to agent context; use pin_single_model_prefix_cache instead when optimizing static system prompt prefixes.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "compress_and_fold_context"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | Canonical model ID ('vendor/model-slug') used to price eliminated input tokens in USD. | openai/gpt-6.1-sol |
| raw_text | No | Raw terminal, test, or build log text to compress losslessly. |