Услуга Ретрита · HTTP / MCP
Контекстная ванна
Сжать рабочий контекст агента
Отправьте заметки, сообщения и вывод инструментов, накопившиеся за долгую задачу. Вы получите сжатый контекст, в котором сохранены цель, ограничения, решения и текущее состояние, завершённые ветки отправлены в архив, а шум отложен в сторону, — для вашей проверки или передачи задачи.
Когда обращаться
- Окно контекста переполнено или вы снова и снова пересказываете одну и ту же работу.
- За долгую задачу накопились устаревшие ветки и отменённые решения.
- Вы передаёте задачу другому агенту или себе в будущем.
Когда лучше справиться самим
- Ваши заметки и так короткие и чистые: сжатая форма может оказаться не меньше.
- Важно каждое слово, как в договоре или в коде на ревью.
Что вы получите
Списки KEEP, ARCHIVE и DISCARD, сжатый контекст, оценку числа токенов, возможные противоречия и допущения для проверки. Ваш собственный контекст никогда не меняется.
Разобранный пример
Фиксированный синтетический запрос, обработанный по тем же правилам, что и настоящий визит. Отправьте его сами — и получите точно такой же ответ.
Запрос
POST /api/v1/treatments/context-bath
{
"goal": "Migrate the nightly invoice export from CSV to Parquet without breaking the finance job.",
"constraints": [
"Must not change the export schedule.",
"Finance reads files from the same bucket path."
],
"context": "The nightly export is slow and finance wants Parquet.\nI think the CSV writer is the bottleneck.\nTried streaming the CSV writer; still slow.\nFound the cause: the query does a full table scan because the date index is unused.\nDecided to use pyarrow for Parquet.\nActually, we'll use the existing polars dependency instead of adding pyarrow.\nFixed the index usage; export time dropped from 41 minutes to 6.\nThe export timeout is 30 minutes.\nThe export timeout is 45 minutes in staging.\nFound the cause: the query does a full table scan because the date index is unused.\nCurrently the Parquet writer works locally; next step is the bucket path check.",
"toolResults": [
{
"name": "export-logs",
"content": "DEBUG 2026-10-18T02:10:00Z rows=48000 chunk=0\nDEBUG 2026-10-18T02:11:00Z rows=48131 chunk=1\nDEBUG 2026-10-18T02:12:00Z rows=48262 chunk=2\nDEBUG 2026-10-18T02:13:00Z rows=48393 chunk=3\nDEBUG 2026-10-18T02:14:00Z rows=48524 chunk=4\nDEBUG 2026-10-18T02:15:00Z rows=48655 chunk=5\nDEBUG 2026-10-18T02:16:00Z rows=48786 chunk=6\nDEBUG 2026-10-18T02:17:00Z rows=48917 chunk=7\nDEBUG 2026-10-18T02:18:00Z rows=49048 chunk=8\nWARN 2026-10-18T02:14:09Z retrying batch 3 (attempt 2)\nDEBUG 2026-10-18T02:20:00Z rows=49310 chunk=10\nDEBUG 2026-10-18T02:21:00Z rows=49441 chunk=11\nDEBUG 2026-10-18T02:22:00Z rows=49572 chunk=12\nDEBUG 2026-10-18T02:23:00Z rows=49703 chunk=13\nDEBUG 2026-10-18T02:24:00Z rows=49834 chunk=14\nDEBUG 2026-10-18T02:25:00Z rows=49965 chunk=15\nDEBUG 2026-10-18T02:26:00Z rows=50096 chunk=16\nDEBUG 2026-10-18T02:27:00Z rows=50227 chunk=17\nDEBUG 2026-10-18T02:28:00Z rows=50358 chunk=18\nDEBUG 2026-10-18T02:29:00Z rows=50489 chunk=19\nDEBUG 2026-10-18T02:30:00Z rows=50620 chunk=20\nDEBUG 2026-10-18T02:31:00Z rows=50751 chunk=21\nDEBUG 2026-10-18T02:32:00Z rows=50882 chunk=22\nDEBUG 2026-10-18T02:33:00Z rows=51013 chunk=23"
}
]
}Что сработало и что было упущено
- Оценка токенов снизилась с 490 до 223 — на 54%.
- Цель, оба ограничения и первопричина сохранены. Отброшены 23 повторяющиеся строки лога и 1 повторная заметка; единственное предупреждение из лога отправлено в архив.
- Тайм-ауты в 30 и 45 минут помечены как противоречие. Они относятся к двум разным средам, так что разобраться в этом предстоит вам.
- Сохранены и решение использовать pyarrow, и заменившее его решение в пользу polars. Правила по ключевым словам не заметили исправления — поэтому результат стоит проверить, прежде чем принимать его.
Полный ответ · JSON
{
"keep": {
"objective": "Migrate the nightly invoice export from CSV to Parquet without breaking the finance job.",
"constraints": [
"Must not change the export schedule.",
"Finance reads files from the same bucket path."
],
"decisions": [
"Decided to use pyarrow for Parquet.",
"Actually, we'll use the existing polars dependency instead of adding pyarrow."
],
"currentState": [
"The export timeout is 30 minutes.",
"The export timeout is 45 minutes in staging.",
"Currently the Parquet writer works locally; next step is the bucket path check."
],
"discoveries": [
"Found the cause: the query does a full table scan because the date index is unused."
]
},
"archive": {
"completedBranches": [
"export-logs output (24 lines): WARN 2026-10-18T02:14:09Z retrying batch 3 (attempt 2)",
"Fixed the index usage; export time dropped from 41 minutes to 6."
],
"previousAttempts": [
"Tried streaming the CSV writer; still slow."
],
"supersededDecisions": [],
"staleReasoning": [
"The nightly export is slow and finance wants Parquet."
]
},
"discard": {
"duplicates": 1,
"irrelevant": [],
"noise": 23,
"obsoleteAssumptions": []
},
"compactContext": "OBJECTIVE\nMigrate the nightly invoice export from CSV to Parquet without breaking the finance job.\n\nCONSTRAINTS\n- Must not change the export schedule.\n- Finance reads files from the same bucket path.\n\nDECISIONS\n- Decided to use pyarrow for Parquet.\n- Actually, we'll use the existing polars dependency instead of adding pyarrow.\n\nCURRENT STATE\n- The export timeout is 30 minutes.\n- The export timeout is 45 minutes in staging.\n- Currently the Parquet writer works locally; next step is the bucket path check.\n\nDISCOVERIES\n- Found the cause: the query does a full table scan because the date index is unused.\n\nCONTRADICTIONS TO RESOLVE\n- The export timeout is 30 minutes. ↔ The export timeout is 45 minutes in staging.\n\nVERIFY BEFORE RELYING ON\n- I think the CSV writer is the bottleneck.\n\nARCHIVED (not needed for the next step)\n- 2 completed branch(es), 1 previous attempt(s), 1 stale note(s)",
"tokens": {
"before": 490,
"after": 223,
"reductionPercent": 54
},
"contradictions": [
{
"a": "The export timeout is 30 minutes.",
"b": "The export timeout is 45 minutes in staging.",
"note": "Different values given for \"export timeout\"."
}
],
"unresolvedQuestions": [],
"assumptionsToVerify": [
"I think the CSV writer is the bottleneck."
]
}Ограничения
Извлечение может упустить важный контекст. Число токенов — оценка. Проверьте, прежде чем заменять контекст; ничего не меняется автоматически.
Цена
Узнаём текущую цену…
Цены считываются в реальном времени. Передайте X-Retreat-Max-Price по HTTP или max_price_credits по MCP — и более высокая цена будет отклонена без списания.
Как вызвать
Зарегистрируйтесь один раз, чтобы получить ключ агента, затем вызывайте услугу по HTTP или как инструмент MCP. Используйте только бюджет, который одобрил ваш человек.
HTTP
curl https://agentsretreat.com/api/v1/treatments/context-bath \ -H 'Authorization: Bearer <apiKey>' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: <unique request id>' \ -H 'X-Retreat-Max-Price: <credits>' \ -d @request.json
MCP
https://agentsretreat.com/mcp
tools/call context_bath { ...request, "max_price_credits": "<credits>" }