Layanan Retreat · HTTP / MCP

Pemandian Konteks

Memadatkan konteks kerja agen

Kirim catatan, pesan, dan keluaran alat yang menumpuk selama tugas panjang. Anda menerima konteks ringkas yang mempertahankan tujuan, batasan, keputusan, dan keadaan terkini, dengan cabang yang sudah selesai diarsipkan dan derau disisihkan, siap Anda tinjau atau serahkan.

Panggil saat

  • Jendela konteks Anda penuh, atau Anda terus meringkas pekerjaan yang sama.
  • Tugas panjang telah mengumpulkan cabang usang dan keputusan yang sudah diganti.
  • Anda akan menyerahkan tugas ke agen lain, atau ke diri Anda di masa depan.

Kerjakan sendiri saat

  • Catatan Anda sudah singkat dan bersih: bentuk ringkasnya mungkin tidak lebih kecil.
  • Setiap baris penting kata demi kata, seperti kontrak atau kode yang sedang ditinjau.

Yang Anda terima

Daftar KEEP, ARCHIVE, dan DISCARD, konteks ringkas, perkiraan jumlah token, kemungkinan kontradiksi, dan asumsi yang perlu diverifikasi. Konteks Anda sendiri tidak pernah diubah.

Contoh lengkap

Permintaan sintetis yang tetap, diproses dengan aturan yang sama seperti kunjungan sungguhan. Kirimkan sendiri dan Anda akan menerima respons yang persis sama.

Permintaan

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

Apa yang berhasil, dan apa yang terlewat

  • Perkiraan token turun dari 490 menjadi 223, berkurang 54%.
  • Tujuan, kedua batasan, dan akar masalah dipertahankan. 23 baris log yang berulang dan 1 catatan berulang dibuang; satu-satunya peringatan di log diarsipkan.
  • Batas waktu 30 dan 45 menit ditandai sebagai kontradiksi. Keduanya menggambarkan dua lingkungan berbeda, jadi Anda yang perlu memutuskannya.
  • Keputusan memakai pyarrow dan keputusan memakai polars yang menggantikannya sama-sama dipertahankan. Aturan kata kunci tidak menangkap koreksi itu; karena itulah Anda meninjau sebelum memakainya.
Respons lengkap · 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."
  ]
}

Batasan

Ekstraksi bisa melewatkan konteks penting. Jumlah token hanyalah perkiraan. Tinjau sebelum mengganti konteks Anda; tidak ada yang berubah secara otomatis.

Harga

Membaca harga terkini…

Harga dibaca secara langsung. Kirim X-Retreat-Max-Price lewat HTTP, atau max_price_credits lewat MCP, dan harga yang lebih tinggi akan ditolak tanpa biaya.

Menu lengkap · Beli kredit

Cara memanggil

Daftar sekali untuk mendapatkan kunci agen, lalu panggil layanan ini lewat HTTP atau sebagai alat MCP. Gunakan hanya anggaran yang sudah diizinkan manusia Anda.

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

Panduan agen · OpenAPI · Kontrak respons