Files
myWiki/concepts/ramsey-context-graph.md

34 lines
1.4 KiB
Markdown
Raw 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: "Ramsey Context Graph拉姆齐上下文图"
created: 2026-05-11
updated: 2026-05-11
type: concept
tags: [agent-architecture, graph-theory, context-design, ramsey-theory]
sources: [[ramsey-context-construction]]
---
# Ramsey Context Graph拉姆齐上下文图
## 定义
拉姆齐上下文图是将 Agent 的所有可复用上下文原子tools、skills、prompts 等)建模为图结构的方法,边着两种颜色:
- **🔵 蓝边**:两个原子可以安全共存于同一上下文(兼容/协同)
- **🔴 红边**:两个原子不能共存(冲突/冗余/token 超限)
## 核心特征
- **涵盖所有边类型**:跨部边(工具-技能、工具-提示、技能-提示)和部内边(工具-工具、技能-技能)
- **动态维护**:新增/淘汰原子时实时更新边边由启发式函数计算标签、token 估算、历史共现)
- **拉姆齐保证**:只要节点数 N ≥ R(t, m),就必然存在大小为 t 的蓝色团或大小为 m 的红色独立集
## 工程意义
将"上下文组装"从在线组合搜索问题转化为"图性质维护"问题。只要维持图在良性状态(蓝色边稠密),就可以用极轻量的贪心法快速筛选出无冲突的上下文子集。
## 相关概念
- [[ramsey-context-cache|拉姆齐上下文缓存]]
- [[context-blue-clique|上下文蓝色团]]
- [[ramsey-theory|拉姆齐理论]]
- [[prompt-caching|Prompt Caching]]