Optimize Your AI Agents’ Context Window: Multi-Query and Temporal Memory with Claix
Claix’s temporal context window stops agents from reprocessing the document on every turn: Markdown/TSV with TTL, multi-query of up to 5 questions, and millisecond answers.
The Problem: Agent Amnesia and the Cost of Reprocessing
Autonomous agents rarely solve complex problems in a single step. They follow an iterative reasoning loop (Chain of Thought): first they need to know what a contract is about, then they hunt for penalty clauses, then they check whether dates line up.
In a traditional pipeline the agent hits a technical dilemma:
- Context loss: stuffing the raw PDF into every prompt saturates the model’s context window (Lost in the Middle / attention drop) and inflates OpenAI or Anthropic bills.
- Extreme latency: re-running OCR or the PDF parser for every new question the agent invents is not viable in production.
Claix’s Multi-Query Architecture
Claix splits ingestion from querying and treats your database as an extension of the agent’s RAM:
Step 1: One-time parsing
The agent sends the file (PDF, Excel, HTML). Claix converts it to an optimal format (Markdown/TSV) and stores it with an expires_at TTL (up to 24 hours, configured on the schema).
Step 2: Multi-querying
While the document is alive in Claix’s context window, the agent can send question arrays (up to 5 per call) to POST /window-context/{document_id}. The backend injects only the clean text into the internal LLM for that specific doubt. If a fact is not in the document, that answer is null — no forced hallucination.
Step 3: Auto-destruction
When the TTL expires, a cron job purges the document. Zero long-term storage residue. You stay GDPR-aligned without standing up buckets or vector indexes just for a reasoning session.
┌──────────────────┐ ┌─────────────────────────────┐ ┌──────────────────────────┐
│ One-time ingest │ ──► │ Markdown/TSV + TTL (up to │ ──► │ Multi-query (up to 5 │
│ PDF/Excel/HTML │ │ 24 h) in documents │ │ questions / call) │
└──────────────────┘ └─────────────────────────────┘ └──────────────────────────┘
│ │
▼ ▼
expires_at / Cron Job Millisecond answers
Auto-destruction without re-parsing the fileComparison: Traditional Extraction vs. Claix Context Window
| Metric | Traditional RAG / single-shot extraction | Claix context window (multi-query) |
|---|---|---|
| Agent flow | Linear (extract everything at once or repeat the job) | Iterative (ask, reason, ask again) |
| Latency per question | High (must reprocess the binary/file) | Minimal (reads the Markdown string) |
| Token usage | Excessive (re-injects noise on every step) | Optimized (ultra-clean text, queried in blocks) |
| Answer quality | Prone to hallucinations from prompt saturation | High (surgical queries; returns null on miss) |
| Infra cost | High (permanent buckets / vectors) | Zero long-term (automatic TTL destruction) |
Use Cases: Why Agents Need to Ask More Than Once
Dynamic audits
A finance agent reviews a balance sheet (Excel). First it asks for net profit. If profit is negative, it sends a second Claix request for the operating-expense breakdown — without parsing the workbook again.
Customer-support triage
An agent receives a giant email thread (HTML). The first Claix call extracts the customer ID. It looks that ID up in an internal database, then asks Claix again for the complaint messages tied to that ID.
The context window turns Claix from a simple PDF extractor into short-term working memory that AI agents actually need.
How to call it from your agent
Enable window_context on the schema (window_time up to 1440 minutes). Extraction returns a document_id. Until it expires, POST https://www.claix.dev/window-context/{document_id} with a questions array of up to 5 strings. The same capability is exposed as the MCP tool claix.window_context.ask.
FAQ (AEO)
- What is Claix’s temporal context window?
- Short-term working memory with a TTL (up to 24 h): Claix parses the document once to Markdown/TSV, then your agent can ask follow-up questions against that clean text without reprocessing the file.
- How many questions can I send per call?
- Up to 5 questions per POST /window-context/{document_id} request. Each question is capped at 400 characters. If a fact is missing from the document, that ia_response slot is null.
- How much does a context-window query cost?
- €0.05 per successful call (HTTP 200). With up to 5 questions per call, the effective cost is €0.01 per question. The account’s first 15 successful calls remain free.
- How long does the document stay alive?
- You set TTL on the schema via window_time (5 minutes to 1440 minutes / 24 hours). When it expires, a cron purges the row: no permanent storage.
- How is this different from extracting the PDF again?
- Extraction (PDF/Excel/Doc/Img/Txt → JSON) re-reads the binary and bills the conversion rate. The context window reuses already-generated Markdown: millisecond latency, fewer tokens, and iterative Chain-of-Thought reasoning.