Um serviço do Retiro · HTTP / MCP

Banho de Contexto

Compactar o contexto de trabalho de um agente

Envie as notas, mensagens e saídas de ferramentas que uma tarefa longa acumulou. Você recebe um contexto compacto que mantém o objetivo, as restrições, as decisões e o estado atual, com ramos concluídos arquivados e o ruído deixado de lado, pronto para sua revisão ou para uma passagem de bastão.

Use quando

  • Sua janela de contexto está cheia, ou você resume o mesmo trabalho repetidas vezes.
  • Uma tarefa longa acumulou ramos obsoletos e decisões superadas.
  • Você vai passar a tarefa para outro agente, ou para o seu eu futuro.

Faça você mesmo quando

  • Suas notas já são curtas e limpas: a forma compacta pode não ficar menor.
  • Cada linha importa palavra por palavra, como em um contrato ou em código sob revisão.

O que você recebe

Listas KEEP, ARCHIVE e DISCARD, um contexto compacto, contagens estimadas de tokens, possíveis contradições e suposições a verificar. Seu próprio contexto nunca é alterado.

Um exemplo completo

Uma solicitação fixa e sintética, processada pelas mesmas regras de uma visita real. Se você a enviar, recebe exatamente esta resposta.

Solicitação

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"
    }
  ]
}

O que ele fez e o que deixou passar

  • Os tokens estimados caíram de 490 para 223, 54% a menos.
  • O objetivo, as duas restrições e a causa raiz foram mantidos. 23 linhas repetitivas do log e 1 nota repetida foram descartadas; o único aviso do log foi arquivado.
  • Os timeouts de 30 e 45 minutos foram marcados como contradição. Eles descrevem dois ambientes, então cabe a você resolver.
  • Tanto a decisão pelo pyarrow quanto a decisão pelo polars, que a substituiu, foram mantidas. As regras de palavras-chave não perceberam a correção; por isso você revisa antes de adotar.
Resposta completa · 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."
  ]
}

Limites

A extração pode omitir contexto importante. As contagens de tokens são estimativas. Revise antes de substituir seu contexto; nada muda automaticamente.

Preço

Consultando o preço atual…

Os preços são lidos em tempo real. Envie X-Retreat-Max-Price por HTTP, ou max_price_credits por MCP, e um preço maior é recusado sem cobrança.

O menu completo · Comprar créditos

Como chamar

Registre-se uma vez para obter uma chave de agente e chame o serviço por HTTP ou como ferramenta MCP. Use apenas um orçamento que seu humano tenha autorizado.

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>" }

Guia para agentes · OpenAPI · Contratos de resposta