上下文工程:历史压缩、记忆管理、上下文窗口规划(2.1)

下列材料覆盖「历史压缩 / 记忆管理 / 上下文窗口规划」。

系统教程(三块都覆盖)

材料链接覆盖点
大模型上下文工程权威指南(yeasy)https://yeasy.gitbook.io/context_engineering_guide/第 4 章记忆架构;第 6 章压缩与窗口
6.3 对话历史管理https://yeasy.gitbook.io/context_engineering_guide/di-er-bu-fen-he-xin-ji-shu-yu-ce-le/06_compress/6.3_conversation_history滑动窗口、对话压缩、分层管理
6.4 上下文窗口优化策略https://yeasy.gitbook.io/context_engineering_guide/di-er-bu-fen-he-xin-ji-shu-yu-ce-le/06_compress/6.4_window_optimizationCompaction、记忆刷写、检查点
指南目录(GitHub)https://github.com/yeasy/context_engineering_guide/blob/main/SUMMARY.md全书目录
第 3 章 上下文工程https://juejin.cn/post/76778657357219758173.1 Token 预算;3.2 历史管理;3.4 记忆分层
上下文工程生产落地指南https://juejin.cn/post/76336332447084380503.1 窗口容量规划;压缩摘要代码
M09 Context Engineering(李文周)https://liwenzhou.com/courses/ai-agent/09-context-engineering/Token 预算门控、历史压缩、结构化笔记

官方与白皮书

材料链接覆盖点
Anthropic · Effective context engineering for AI agentshttps://www.anthropic.com/engineering/effective-context-engineering-for-ai-agentscompaction、structured note-taking、sub-agent
Claude · Compactionhttps://platform.claude.com/docs/en/build-with-claude/compaction服务端自动压缩 API
Google · Context Engineering: Sessions & Memoryhttps://www.kaggle.com/whitepaper-context-engineering-sessions-and-memorySession 压缩、记忆生命周期、历史裁剪
Google ADK · Context Compactionhttps://google.github.io/adk-docs/context/compaction/滑动窗口摘要、interval / overlap
Lance Martin · Context Engineering for Agentshttp://rlancemartin.github.io/2025/06/23/context_engineering/Write / Select / Compress / Isolate
上下文工程(LangChain 博客中文整理)https://juejin.cn/post/7602850166731292681四大策略中文版
上下文工程(lidaxia 译文)https://blog.lidaxia.io/2025/07/07/context-engineering-from-langchain/LangChain 原文翻译

历史压缩

材料链接
历史压缩的艺术https://juejin.cn/post/7669646561668284450
第 7 章:上下文压缩与优化技术https://juejin.cn/post/7667537840745709610
第 7 章:上下文工程(Write / Select / Compress / Isolate)https://waylandz.com/ai-agent-book/%E7%AC%AC07%E7%AB%A0-%E4%B8%8A%E4%B8%8B%E6%96%87%E5%B7%A5%E7%A8%8B/
6.1 信息密度与压缩原理https://yeasy.gitbook.io/context_engineering_guide/di-er-bu-fen-he-xin-ji-shu-yu-ce-le/06_compress/6.1_compression_principles
Codex:从 Compaction 到硬切窗口https://juejin.cn/post/7680581898923491370

记忆管理

材料链接
LLM 记忆管理三剑客:截断、总结、检索https://juejin.cn/post/7680552737289715731
走进 AI Agent 第三篇:让 Agent 记住你https://juejin.cn/post/7682394398210932763
智能体 AI 权威指南 · 3.2 短期记忆管理https://yeasy.gitbook.io/agentic_ai_guide/di-yi-bu-fen-dan-ti-zhi-neng-jia-gou/03_memory/3.2_short_term_memory
3.6 上下文工程(记忆与调度)https://yeasy.gitbook.io/zhi-neng-ti-ai-quan-wei-zhi-nan-agenticaiguide/di-yi-bu-fen-dan-ti-zhi-neng-jia-gou/03_memory/3.6_context_engineering
Agent 上下文爆炸:从全量塞入到智能记忆管理https://openeuler.csdn.net/6a1c2e6210ee7a33f2768a96.html

上下文窗口规划

材料链接
从零开始理解大模型(八):上下文窗口https://bbs.huaweicloud.com/blogs/476789
有效的 Context 工程(少数派)https://sspai.com/post/103243
上下文工程是什么?https://juejin.cn/post/7674095753217572900
上下文越大,AI 越容易忘事https://juejin.cn/post/7679716885453815818

带代码的实现材料

材料链接覆盖点
baby-agent 第 5 章https://github.com/baby-llm/baby-agent/blob/main/ch05/README.mdTruncate / Offload / Summarize;含 2.1 截断策略
HelloAgents 上下文工程指南https://github.com/jjyaoao/HelloAgents/blob/main/docs/context-engineering-guide.mdHistoryManager、压缩阈值、保留最近 N 轮
原生 NodeJS 维护 Agent Memoryhttps://juejin.cn/post/7681142626944761910滑动窗口 + 摘要压缩双阈值
how-claude-code-works · 五级压缩管线https://github.com/Windy3f3f3f3f/how-claude-code-works/blob/main/en/docs/03-context-engineering.mdTool Result 裁剪 → Autocompact
Claude Code vs OpenCode · 四种记忆策略https://github.com/0xtresser/Claude-Code-VS-OpenCode/blob/main/ZH/%E7%AC%AC20%E7%AB%A0_%E4%B8%8A%E4%B8%8B%E6%96%87%E5%B7%A5%E7%A8%8B/20.2_%E5%9B%9B%E7%A7%8D%E8%AE%B0%E5%BF%86%E7%AD%96%E7%95%A5.mdJIT / compaction / notes / sub-agents

建议阅读顺序

  1. Anthropic 长文(原理)
  2. yeasy 指南第 4 / 6 章(系统)
  3. 掘金第 3 章(窗口预算数字)
  4. baby-agent ch05 或李文周 M09(实现)