Conflux Docs
API and CLI

Context optimization

How Conflux keeps long CLI/API work usable without corrupting the user's prompt.

Context optimization diagramClick to enlarge

Why it exists

CLI and API clients can send very large histories with tool results, diffs, test output, logs, and generated artifacts. Sending everything unchanged is safest but can exceed model context limits. Blindly compacting the whole payload is dangerous because it can damage the user's current instruction or the CLI's own working memory.

Safe optimization order

Shadow observationMeasure potential savings and reducer behavior without changing model payloads.
Evidence-only viewsStore compacted evidence for inspection and memory support after compliance scanning.
Provider payload optimizationOnly when explicitly enabled, reduce eligible intermediate tool outputs before upstream execution.
Context-error recoveryIf an upstream model rejects a request as too large, retry with audited optimization.

What it does not change

Context optimization does not rewrite the user's latest prompt as a routing trick, does not replace the client conversation history on the first attempt, and does not promote compacted evidence into durable memory by itself. It preserves high-signal evidence and lets memory cite it as supporting context.