Files
myWiki/reviews/prompt-caching-architecture-review-20260511.md

69 lines
3.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: "Review: Prompt Caching 架构工程手册"
created: 2026-05-11
type: review
sources: [[prompt-caching-architecture]]
---
# Review: Prompt Caching 架构工程手册
## 📌 基本信息
- **标题**Agentic Systems: Prompt Caching 架构工程手册 (Volume I)
- **来源**:微信公众号
- **领域**AI Agent 系统架构 / Prompt 工程 / 缓存优化
- **案例系统**[[meta-jctrader|Meta-JCTrader]]
- **添加时间**2026-05-11
- **类型**:工程实践教程
## 🎯 核心概念
1. **[[prompt-caching|Prompt Caching]]** — 基于前缀匹配的确定性计算优化,是 Agent 系统稳健性与推理确定性的架构基石
2. **[[prefix-matching|前缀匹配]]** — 字节级严格匹配机制,任何微小更改触发雪崩式失效
3. **[[prompt-layering|提示分层]]** — Global → Project → Session → Dynamic 四层架构,按变更频率分离静态与动态内容
4. **[[stub-pattern|Stub 模式]]** — 通过 ToolRegistry 统一接口避免工具定义变更导致的缓存污染
5. **[[cache-safe-forking|缓存安全分叉]]** — 复用父会话前缀实现低成本对话压缩
6. **[[cache-hit-ratio|CHR]]** — 核心监控指标,< 95% 即触发告警
7. **[[system-message-abuse|System Message 滥用]]** 高频变更 System Message 的反模式及其工具化替代方案
8. **[[cache-health-observability|缓存可观测性]]** 三大指标体系CHR + 失效点识别 + 成本效率评分
## 🔗 概念网络
**核心连接**
```
prompt-caching ←→ prefix-matching ←→ cache-invalidation
↓ ↓
prompt-layering ←→ stub-pattern ←→ tool-registry
cache-safe-forking ←→ context-compression
cache-hit-ratio ←→ cache-health-observability
meta-jctrader ←→ agentic-systems ←→ reinforcement-learning-trading
```
- **新增概念**14 12 核心 + 2 占位符
- **扩展网络**连接了 16+ 个相关概念
- **占位符创建**2 [[agentic-systems]]、[[reinforcement-learning-trading]]
- **断链状态**0 处断链100% 链接完整
## 📚 Wiki 集成
| 指标 | 数值 |
|------|------|
| 新增页面 | 15 1 raw + 1 article + 12 概念 + 2 占位符 - 1 合并 = 15 |
| 总规模 | 195 203 |
| 链接完整性 | 100% 无断链 |
| 索引更新 | 全量重建 |
## 💡 关键洞察
1. **缓存不仅是性能问题,更是架构约束** Prompt Caching 的确定性前缀匹配机制对系统设计提出了"静态前缀不可变性"的硬约束这使得 Agent 架构必须从根本上区分"静态基础设施""动态业务逻辑"
2. **Stub 模式是缓存与灵活性的权衡最优解** 通过 ToolRegistry 间接调用在不牺牲缓存命中率的前提下保留了工具的动态扩展性这是一种经典的计算机科学"中间层解耦"思路在 LLM 时代的映射
## 🏷️ 与现有知识库的关联
- [[hyperagents|Hyperagents]] 的自我修改 Agent 形成互补前者关注 Agent 内部的自我优化本文关注 Agent 基础设施的效率优化
- [[agentic-systems|Agentic Systems]] 概念提供了工程实现层面的具体方法论