# 第六章 上下文压缩与优化

即使经过精选和检索，需要放入上下文的信息量仍可能很大。**压缩策略** 旨在提高信息密度，用更少的 Token 传达更多的有效内容。

本章将介绍信息压缩的基本原理、摘要与提取技术、对话历史管理，以及上下文窗口优化的系统策略。这些技术对于控制成本、降低延迟、提高模型处理效率都至关重要。

## 本章内容

* [6.1 信息密度与压缩原理](/context_engineering_guide/di-er-bu-fen-he-xin-ji-shu-yu-ce-le/06_compress/6.1_compression_principles.md)
* [6.2 摘要与信息提取](/context_engineering_guide/di-er-bu-fen-he-xin-ji-shu-yu-ce-le/06_compress/6.2_summarization.md)
* [6.3 对话历史管理](/context_engineering_guide/di-er-bu-fen-he-xin-ji-shu-yu-ce-le/06_compress/6.3_conversation_history.md)
* [6.4 上下文窗口优化策略](/context_engineering_guide/di-er-bu-fen-he-xin-ji-shu-yu-ce-le/06_compress/6.4_window_optimization.md)
* [6.5 压缩策略案例分析](/context_engineering_guide/di-er-bu-fen-he-xin-ji-shu-yu-ce-le/06_compress/6.5_compression_cases.md)
* [本章小结](/context_engineering_guide/di-er-bu-fen-he-xin-ji-shu-yu-ce-le/06_compress/summary.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yeasy.gitbook.io/context_engineering_guide/di-er-bu-fen-he-xin-ji-shu-yu-ce-le/06_compress.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
