三域上下文動力學:從工作記憶、壓縮投影到外部典範庫
Three-Domain Context Dynamics: Working Context, Compressed Projection, and External Canonical Memory
摘要
大型語言模型與自主智能體的長程運作,通常被描述為一個「有限上下文窗口對抗無限增長歷史」的問題。既有方法因而集中於摘要、檢索增強、長期記憶、階層式記憶以及自適應記憶管理。MemGPT 將此問題類比為作業系統中的虛擬記憶管理,透過不同記憶層之間的資料移動突破有限上下文窗口;近期研究則進一步把記憶管理描述為可學習的控制過程,包括決定何時儲存、檢索、更新、摘要、合併與遺忘。
然而,單純增加外部記憶、進行摘要或提高檢索能力,仍不足以解決長程智能體的核心問題:何種資訊應存在於當下上下文,以及當前上下文何時應被清理、展開、重新連接與收斂。
本文提出「三域上下文動力學」(Three-Domain Context Dynamics, TDCD)。其基本主張是:智能體的記憶系統不應被視為單一記憶庫,而應區分為三個不同功能與不同資訊保真度的域:
W t = Working Context Domain , \mathcal W_t
=
\text{Working Context Domain}, W t = Working Context Domain ,
P t = Projection / Compiled Context Domain , \mathcal P_t
=
\text{Projection / Compiled Context Domain}, P t = Projection / Compiled Context Domain ,
D = Canonical External Domain . \mathcal D
=
\text{Canonical External Domain}. D = Canonical External Domain .
其中, W t \mathcal W_t W t 是時間 t t t 真正進入模型推理過程的有限工作域; P t \mathcal P_t P t 是經過壓縮、索引、分類、地址化與重要性估計後形成的投影域; D \mathcal D D 則保存完整、可驗證、可追溯的典範資料。
本文進一步提出四類核心算子:
E = Expand , \mathcal E
=
\text{Expand}, E = Expand ,
L = Link , \mathcal L
=
\text{Link}, L = Link ,
C = Converge , \mathcal C
=
\text{Converge}, C = Converge ,
G = Govern . \mathcal G
=
\text{Govern}. G = Govern .
本框架的核心觀點不是「透過壓縮解決上下文限制」,而是:
Compression is an observation layer; context governance is the control layer. \boxed{
\text{Compression is an observation layer; context governance is the control layer.}
} Compression is an observation layer; context governance is the control layer.
壓縮負責揭露結構、重要性與可恢復地址;真正改善長程推理品質的則是持續治理當下上下文的內容。
關鍵詞
大型語言模型、智能體記憶、上下文治理、長期記憶、記憶壓縮、典範資料庫、投影記憶、上下文清理、記憶編譯、MCP、Autonomous Context Runtime
1. 問題的重新定義
有限上下文窗口通常被形式化為容量問題。
令完整歷史資訊為:
H t = { m 1 , m 2 , … , m t } , H_t=\{m_1,m_2,\ldots,m_t\}, H t = { m 1 , m 2 , … , m t } ,
模型在時間 t t t 可接受的上下文預算為:
B t < ∣ H t ∣ . B_t<|H_t|. B t < ∣ H t ∣.
最直接的問題因此看似是:
如何把 H t 壓縮進 B t ? \text{如何把 }H_t\text{ 壓縮進 }B_t? 如何把 H t 壓縮進 B t ?
然而這個表述隱含了一個錯誤假設:
所有歷史資訊只是因為「太長」而無法進入現在。
實際上,即使:
∣ H t ∣ ≤ B t , |H_t|\leq B_t, ∣ H t ∣ ≤ B t ,
仍可能存在低品質上下文。
例如:
相同資訊被不同措辭重複;
舊版本結論仍與新版結論共同存在;
已完成的任務資訊持續佔據工作域;
不同研究分支彼此污染;
次要細節遮蔽主要目標;
曾經重要的資訊在當前任務中已失去相關性;
真正重要的舊資訊反而沒有被重新帶入。
因此上下文失效並不等價於上下文容量不足:
Context Failure ≠ Context Overflow . \boxed{
\text{Context Failure}
\neq
\text{Context Overflow}.
} Context Failure = Context Overflow .
更一般地:
Context Failure = f ( overflow , redundancy , staleness , conflict , branch contamination , retrieval failure , attention dilution ) . \text{Context Failure}
=
f(
\text{overflow},
\text{redundancy},
\text{staleness},
\text{conflict},
\text{branch contamination},
\text{retrieval failure},
\text{attention dilution}
). Context Failure = f ( overflow , redundancy , staleness , conflict , branch contamination , retrieval failure , attention dilution ) .
因此長程智能系統需要解決的核心問題應重新表述為:
在有限工作域中,持續維持當下最適合推理的資訊狀態。 \boxed{
\text{在有限工作域中,持續維持當下最適合推理的資訊狀態。}
} 在有限工作域中,持續維持當下最適合推理的資訊狀態。
此問題本文稱為 Context Governance Problem 。
2. 與既有記憶研究的關係
MemGPT 已提出利用階層式記憶與資料移動形成類似虛擬上下文的機制,其基本洞見是有限模型上下文不應等價於整個系統的有效記憶容量。
2026 年的 Agentic Memory 進一步將短期與長期記憶管理整合至 Agent policy,使智能體能自主選擇儲存、檢索、更新、摘要與丟棄等操作。
MemRefine 則直接處理長期記憶庫隨時間增長後所產生的冗餘問題,並指出表面相似性不足以決定記憶的事實價值,因此需要更高階的 merge、delete 與 preserve 判定。
MemCon 更進一步把記憶操作形式化成控制問題,使系統根據當前任務狀態決定何時、如何以及取回多少記憶,並加入 consolidation 與 forgetting。
因此本文不主張「自適應記憶控制」本身是新的問題。
本文提出的差異在於以下三點。
第一,本文明確區分:
working context ≠ compressed representation ≠ canonical memory . \boxed{
\text{working context}
\neq
\text{compressed representation}
\neq
\text{canonical memory}.
} working context = compressed representation = canonical memory .
第二,本文不要求壓縮表示本身具有完全可逆性,而要求:
任何具有典範價值的省略資訊,都必須保有返回原始資料的地址。 \boxed{
\text{任何具有典範價值的省略資訊,都必須保有返回原始資料的地址。}
} 任何具有典範價值的省略資訊,都必須保有返回原始資料的地址。
第三,本文把「清理當前上下文」視為獨立於「管理長期記憶庫」的控制問題。
因此本文研究的並非單純 Memory Management,而更接近:
Dynamic Context-State Governance . \boxed{
\text{Dynamic Context-State Governance}.
} Dynamic Context-State Governance .
3. 三域模型
3.1 工作域 W t \mathcal W_t W t
定義時間 t t t 的工作域為:
W t = { m ∣ m currently participates in model inference } . \mathcal W_t
=
\{m\mid m\text{ currently participates in model inference}\}. W t = { m ∣ m currently participates in model inference } .
其容量受到:
∣ W t ∣ ≤ B t |\mathcal W_t|\leq B_t ∣ W t ∣ ≤ B t
限制。
但容量限制並不是其唯一條件。
我們希望:
W t ≈ E t , \mathcal W_t
\approx
\mathcal E_t, W t ≈ E t ,
其中 E t \mathcal E_t E t 表示「真正屬於當下問題的有效資訊集合」。
因此理想工作域不是最大集合,而是一個相關性、可靠度與成本共同約束下的選擇集合。
可寫成:
W t ∗ = arg max S ⊆ M U ( S ∣ q t , s t ) \mathcal W_t^*
=
\arg\max_{\mathcal S\subseteq\mathcal M}
U(\mathcal S\mid q_t,s_t) W t ∗ = arg S ⊆ M max U ( S ∣ q t , s t )
subject to
C ( S ) ≤ B t , C(\mathcal S)\leq B_t, C ( S ) ≤ B t ,
其中:
q t q_t q t 為當前查詢;
s t s_t s t 為當前 Agent 狀態;
U U U 為上下文效用;
C C C 為上下文成本。
4. 投影域 P t \mathcal P_t P t
投影域不是完整記憶,也不是單純摘要。
定義:
P t = Π t ( D ) , \mathcal P_t
=
\Pi_t(\mathcal D), P t = Π t ( D ) ,
其中 Π t \Pi_t Π t 為時間依賴的投影算子。
P t \mathcal P_t P t 可以包含:
摘要;
語義向量;
主題;
標籤;
persistence class;
版本資訊;
關係圖;
時間資訊;
來源地址;
provenance;
importance score;
conflict state;
branch membership;
exact restoration pointer。
因此:
∣ P t ∣ ≪ ∣ D ∣ |\mathcal P_t|\ll|\mathcal D| ∣ P t ∣ ≪ ∣ D ∣
通常成立,但:
P t ≠ D . \mathcal P_t\neq\mathcal D. P t = D .
這一區別十分重要。
如果將摘要本身視為長期記憶,則一旦摘要丟失某個未被當下認為重要、但未來重新變重要的細節,該資訊便永久消失。
因此本文要求 Canonical Recoverability Condition :
若:
m ∈ D m\in\mathcal D m ∈ D
具有典範保存資格,且其內容未完整存在於 P t \mathcal P_t P t ,則必須存在某個地址:
a ( m ) a(m) a ( m )
使得:
R ( a ( m ) , D ) = m . R(a(m),\mathcal D)=m. R ( a ( m ) , D ) = m .
其中 R R R 為 exact retrieval operator。
因此:
projection may be lossy while memory preservation remains lossless . \boxed{
\text{projection may be lossy while memory preservation remains lossless}.
} projection may be lossy while memory preservation remains lossless .
5. 典範域 D \mathcal D D
典範域保存系統認定具有持續價值的完整資料。
它可以包括:
原始對話;
文件;
原始碼;
資料集;
工具結果;
實驗記錄;
provenance;
版本歷史;
agent state checkpoint;
外部事件記錄。
其核心要求不是「全部永遠不刪除」,而是:
projection must never silently become canonical source . \boxed{
\text{projection must never silently become canonical source}.
} projection must never silently become canonical source .
即若:
p = Π ( m ) , p=\Pi(m), p = Π ( m ) ,
一般情況下不能推論:
p ≡ m . p\equiv m. p ≡ m .
除非存在明確驗證:
Equivalent ( p , m ) = 1. \operatorname{Equivalent}(p,m)=1. Equivalent ( p , m ) = 1.
這使得摘要、嵌入向量、關係圖與其他衍生表示全部保持為 derivative representation,而非 source of truth。
6. 三域資訊關係
系統的完整記憶狀態定義為:
M t = ( W t , P t , D t ) . \mathfrak M_t
=
(\mathcal W_t,\mathcal P_t,\mathcal D_t). M t = ( W t , P t , D t ) .
三者具有不同更新速度:
v W > v P > v D v_W>v_P>v_D v W > v P > v D
通常成立。
其中:
W t \mathcal W_t W t 高頻變動;
P t \mathcal P_t P t 中頻重新編譯;
D t \mathcal D_t D t 低頻、版本化更新。
其資訊保真度通常滿足:
F D ≥ F W ≥ F P , F_D\geq F_W\geq F_P, F D ≥ F W ≥ F P ,
但當前任務效用未必如此:
U W ( t ) ≥ U P ( t ) U_W(t)\geq U_P(t) U W ( t ) ≥ U P ( t )
通常是治理系統希望維持的狀態。
因此:
保真度最高的資料,不必直接存在於工作上下文;工作上下文需要的是對當前問題效用最高的資料。
7. 四個基本算子
7.1 展開算子
定義:
E : ( W t , P t , D , q t ) → W ~ t . \mathcal E:
(\mathcal W_t,\mathcal P_t,\mathcal D,q_t)
\rightarrow
\widetilde{\mathcal W}_t. E : ( W t , P t , D , q t ) → W t .
展開不是把更多歷史無條件加入上下文,而是尋找:
M t + = { m ∈ D : Ψ t ( m , q t ) ≥ θ t } . M_t^{+}
=
\{m\in\mathcal D:
\Psi_t(m,q_t)\geq\theta_t\}. M t + = { m ∈ D : Ψ t ( m , q t ) ≥ θ t } .
然後:
W ~ t = W t ∪ M t + . \widetilde{\mathcal W}_t
=
\mathcal W_t\cup M_t^{+}. W t = W t ∪ M t + .
其中 Ψ t \Psi_t Ψ t 是 contextual appropriateness function。
7.2 連接算子
資訊被取回並不代表它已與當前問題形成有效關係。
因此定義:
L : W ~ t → G t , \mathcal L:
\widetilde{\mathcal W}_t
\rightarrow
\mathcal G_t, L : W t → G t ,
其中 G t \mathcal G_t G t 是局部關係結構。
對任意:
m i , m j ∈ W ~ t , m_i,m_j\in\widetilde{\mathcal W}_t, m i , m j ∈ W t ,
可以存在:
r i j ∈ { supports , contradicts , updates , depends-on , same-branch , supersedes , derives-from } . r_{ij}
\in
\{
\text{supports},
\text{contradicts},
\text{updates},
\text{depends-on},
\text{same-branch},
\text{supersedes},
\text{derives-from}
\}. r ij ∈ { supports , contradicts , updates , depends-on , same-branch , supersedes , derives-from } .
因此:
G t = ( V t , E t ) . \mathcal G_t=(V_t,E_t). G t = ( V t , E t ) .
這使檢索結果不再只是平坦文字集合,而成為可計算的局部上下文結構。
8. 收斂算子
展開會增加資訊量,因此必須存在與其相反的操作。
定義:
C : ( G t , B t ) → W t + 1 . \mathcal C:
(\mathcal G_t,B_t)
\rightarrow
\mathcal W_{t+1}. C : ( G t , B t ) → W t + 1 .
使得:
∣ W t + 1 ∣ ≤ B t + 1 . |\mathcal W_{t+1}|\leq B_{t+1}. ∣ W t + 1 ∣ ≤ B t + 1 .
但收斂不是單純截斷。
需要最大化:
U ( W t + 1 ∣ q t + 1 , s t + 1 ) U(\mathcal W_{t+1}\mid q_{t+1},s_{t+1}) U ( W t + 1 ∣ q t + 1 , s t + 1 )
並最小化:
N ( W t + 1 ) , N(\mathcal W_{t+1}), N ( W t + 1 ) ,
其中 N N N 是 context noise。
因此可以寫成:
W t + 1 = arg max S [ U ( S ) − λ N ( S ) − μ C ( S ) ] . \mathcal W_{t+1}
=
\arg\max_{\mathcal S}
\left[
U(\mathcal S)
-\lambda N(\mathcal S)
-\mu C(\mathcal S)
\right]. W t + 1 = arg S max [ U ( S ) − λ N ( S ) − μ C ( S ) ] .
9. 治理算子
本文最核心的算子是:
G . \mathcal G. G .
它不直接等價於 compression,也不等價於 retrieval。
定義:
G : ( W t , P t , D t , s t ) → A t , \mathcal G:
(\mathcal W_t,\mathcal P_t,\mathcal D_t,s_t)
\rightarrow
A_t, G : ( W t , P t , D t , s t ) → A t ,
其中 A t A_t A t 為一組治理行為。
例如:
A t ⊆ { retain , remove , compress , expand , relink , merge , supersede , archive , promote , demote , fork , flag-conflict } . A_t
\subseteq
\{
\text{retain},
\text{remove},
\text{compress},
\text{expand},
\text{relink},
\text{merge},
\text{supersede},
\text{archive},
\text{promote},
\text{demote},
\text{fork},
\text{flag-conflict}
\}. A t ⊆ { retain , remove , compress , expand , relink , merge , supersede , archive , promote , demote , fork , flag-conflict } .
因此上下文治理不是一次性的 preprocessing,而是持續控制過程。
10. 上下文清理
令:
N t N_t N t
為工作域中的無效或低效資訊。
則:
N t = N t d u p ∪ N t s t a l e ∪ N t c o n f l i c t ∪ N t b r a n c h ∪ N t i r r e l e v a n t . N_t
=
N_t^{dup}
\cup
N_t^{stale}
\cup
N_t^{conflict}
\cup
N_t^{branch}
\cup
N_t^{irrelevant}. N t = N t d u p ∪ N t s t a l e ∪ N t co n f l i c t ∪ N t b r an c h ∪ N t i r r e l e v an t .
上下文清理器執行:
Clean ( W t ) = W t ∖ N t . \operatorname{Clean}(\mathcal W_t)
=
\mathcal W_t\setminus N_t. Clean ( W t ) = W t ∖ N t .
但其中的「刪除」只是:
remove from active context , \text{remove from active context}, remove from active context ,
而不必等於:
delete from canonical memory . \text{delete from canonical memory}. delete from canonical memory .
因此存在一個極重要的非等價關係:
Forget from Context ≠ Delete from Memory . \boxed{
\text{Forget from Context}
\neq
\text{Delete from Memory}.
} Forget from Context = Delete from Memory .
這使系統可以積極清理工作域,而不必因為害怕永久資訊損失而不敢遺忘。
11. 記憶持續性
每一記憶物件 m m m 可以具有 persistence class:
τ p ( m ) ∈ { I , A , P , T } , \tau_p(m)
\in
\{
I,A,P,T
\}, τ p ( m ) ∈ { I , A , P , T } ,
其中:
I = instantaneous , I=\text{instantaneous}, I = instantaneous ,
A = active , A=\text{active}, A = active ,
P = persistent , P=\text{persistent}, P = persistent ,
T = trajectory . T=\text{trajectory}. T = trajectory .
不同 persistence class 應具有不同衰減與治理函數。
例如:
d I ( t ) > d A ( t ) > d P ( t ) > d T ( t ) , d_I(t)>d_A(t)>d_P(t)>d_T(t), d I ( t ) > d A ( t ) > d P ( t ) > d T ( t ) ,
其中 d ( t ) d(t) d ( t ) 表示退出工作域的傾向。
因此「新資訊一定比舊資訊重要」不成立。
一個十年前建立的方法論:
m P m_P m P
可能比五分鐘前產生的暫時狀態:
m I m_I m I
更應被保留。
12. 展開—連接—收斂循環
三域系統的基本演化可表示為:
M t → E M ~ t → L G t → C M t + 1 . \mathfrak M_t
\xrightarrow{\mathcal E}
\widetilde{\mathfrak M}_t
\xrightarrow{\mathcal L}
\mathcal G_t
\xrightarrow{\mathcal C}
\mathfrak M_{t+1}. M t E M t L G t C M t + 1 .
但 G \mathcal G G 治理算子作用於整個循環:
M t + 1 = G t [ C ( L ( E ( M t , q t ) ) ) ] . \boxed{
\mathfrak M_{t+1}
=
\mathcal G_t
\left[
\mathcal C
\left(
\mathcal L
\left(
\mathcal E(\mathfrak M_t,q_t)
\right)
\right)
\right].
} M t + 1 = G t [ C ( L ( E ( M t , q t ) ) ) ] .
因此系統不是:
Store → Retrieve . \text{Store}\rightarrow\text{Retrieve}. Store → Retrieve .
而是:
Store → Compile → Project → Expand → Link → Converge → Recompile . \boxed{
\text{Store}
\rightarrow
\text{Compile}
\rightarrow
\text{Project}
\rightarrow
\text{Expand}
\rightarrow
\text{Link}
\rightarrow
\text{Converge}
\rightarrow
\text{Recompile}.
} Store → Compile → Project → Expand → Link → Converge → Recompile .
這是一個持續運作的記憶動力系統。
13. 壓縮的重新定位
由前三域定義可得:
Compress : D → P . \operatorname{Compress}:
\mathcal D
\rightarrow
\mathcal P. Compress : D → P .
但真正形成下一個有效工作上下文的是:
Govern : ( W , P , D ) → W ′ . \operatorname{Govern}:
(\mathcal W,\mathcal P,\mathcal D)
\rightarrow
\mathcal W'. Govern : ( W , P , D ) → W ′ .
因此:
Compress ≠ Govern . \boxed{
\operatorname{Compress}
\neq
\operatorname{Govern}.
} Compress = Govern .
壓縮能回答:
哪些資訊可以用較低成本表示?
治理則回答:
現在真正應該讓模型看到什麼?
這是兩個不同問題。
14. 命題一:壓縮不足命題
命題 1(Compression Insufficiency Proposition)
存在歷史集合 H H H 與上下文預算 B B B ,即使:
∣ Compress ( H ) ∣ ≤ B , |\operatorname{Compress}(H)|\leq B, ∣ Compress ( H ) ∣ ≤ B ,
使用壓縮後完整內容作為工作上下文仍非最優:
U ( Compress ( H ) ) < U ( W ∗ ) . U(\operatorname{Compress}(H))
<
U(\mathcal W^*). U ( Compress ( H )) < U ( W ∗ ) .
證明構想
令 H H H 包含大量:
已過期結論;
任務無關資訊;
分支內容;
重複資訊。
即使存在無損或高保真壓縮:
C ( H ) , C(H), C ( H ) ,
使其長度落入上下文限制,這些低效資訊仍然存在。
因此容量問題被解決並不推出選擇問題被解決。
故:
compression sufficiency ⇏ context optimality . \text{compression sufficiency}
\not\Rightarrow
\text{context optimality}. compression sufficiency ⇒ context optimality .
證畢。
15. 命題二:投影—典範分離命題
若:
P t \mathcal P_t P t
允許有損壓縮,而:
D \mathcal D D
保存完整 canonical object,且對每個被省略的 canonical object 存在 exact restoration address,則系統可以同時滿足:
∣ P t ∣ ≪ ∣ D ∣ |\mathcal P_t|\ll|\mathcal D| ∣ P t ∣ ≪ ∣ D ∣
以及:
Pr [ R ( a ( m ) , D ) = m ] = 1 \Pr[
R(a(m),\mathcal D)=m
]=1 Pr [ R ( a ( m ) , D ) = m ] = 1
在儲存與雜湊完整性假設成立時。
因此:
Active representation can be lossy without making canonical memory lossy. \boxed{
\text{Active representation can be lossy without making canonical memory lossy.}
} Active representation can be lossy without making canonical memory lossy.
這是三域模型相對單一摘要記憶的重要差異。
16. 命題三:安全清理條件
對:
m ∈ W t , m\in\mathcal W_t, m ∈ W t ,
若:
m ∈ D m\in\mathcal D m ∈ D
且存在可驗證 restoration address:
a ( m ) , a(m), a ( m ) ,
則:
m ∉ W t + 1 m\notin\mathcal W_{t+1} m ∈ / W t + 1
並不推出:
m ∉ M t + 1 . m\notin\mathfrak M_{t+1}. m ∈ / M t + 1 .
因此工作上下文可以進行 aggressive pruning,而不必等價於系統遺忘。
這可稱為:
Safe Context Eviction Principle . \boxed{
\text{Safe Context Eviction Principle}.
} Safe Context Eviction Principle .
它與作業系統中的工作集移出具有結構類似性,但此處被移出的並非單純 bytes,而是具有不同語義角色、版本、依賴與持續性的認知物件。
17. MCP 的位置
MCP 的定位也可由本框架重新描述。
2026-07-28 MCP 規格正式將 protocol core 轉為 stateless request/response 模型;若應用需要跨呼叫狀態,規格建議由應用顯式管理並傳遞相應 handle,而不是依靠協議層隱藏 session state。
因此:
MCP ≠ Memory Runtime . \boxed{
\text{MCP}\neq\text{Memory Runtime}.
} MCP = Memory Runtime .
更適當的關係是:
Context Runtime ↔ MCP ↔ Memory Services . \text{Context Runtime}
\leftrightarrow
\text{MCP}
\leftrightarrow
\text{Memory Services}. Context Runtime ↔ MCP ↔ Memory Services .
在 TDCD 中,MCP 可以承載:
canonical database access;
context projection;
exact expansion;
semantic retrieval;
graph operations;
archival operations;
external tool access。
但:
G \mathcal G G
本身應屬於 Host、Agent Runtime 或更高階 Context Governor。
也就是:
MCP is the bus; governance belongs to the runtime. \boxed{
\text{MCP is the bus; governance belongs to the runtime.}
} MCP is the bus; governance belongs to the runtime.
18. 從記憶管理到記憶編譯
傳統描述通常使用:
Write → Store → Retrieve . \text{Write}
\rightarrow
\text{Store}
\rightarrow
\text{Retrieve}. Write → Store → Retrieve .
三域模型則更適合使用「編譯」隱喻。
原始記憶:
m m m
進入典範域後,可以被編譯成:
Π ( m ) = ( s u m m a r y , e m b e d d i n g , a d d r e s s , r e l a t i o n s , p e r s i s t e n c e , v e r s i o n , i m p o r t a n c e , p r o v e n a n c e ) . \Pi(m)
=
(
summary,
embedding,
address,
relations,
persistence,
version,
importance,
provenance
). Π ( m ) = ( s u mma r y , e mb e dd in g , a dd r ess , r e l a t i o n s , p er s i s t e n ce , v er s i o n , im p or t an ce , p r o v e nan ce ) .
投影表示不是原文的替代物,而是:
execution-oriented memory representation . \boxed{
\text{execution-oriented memory representation}.
} execution-oriented memory representation .
因此整個系統可稱為:
Memory Compilation Runtime
其循環為:
Ingest → Validate → Canonicalize → Compile → Project → Govern → Expand → Execute → Recompile . \boxed{
\text{Ingest}
\rightarrow
\text{Validate}
\rightarrow
\text{Canonicalize}
\rightarrow
\text{Compile}
\rightarrow
\text{Project}
\rightarrow
\text{Govern}
\rightarrow
\text{Expand}
\rightarrow
\text{Execute}
\rightarrow
\text{Recompile}.
} Ingest → Validate → Canonicalize → Compile → Project → Govern → Expand → Execute → Recompile .
19. 從「記住多少」轉向「現在需要什麼」
三域上下文動力學最根本的轉換,是將問題:
系統能保存多少歷史?
轉化為:
在當前狀態下,哪些歷史應成為現在的一部分?
因此真正核心的集合不是:
M = all memory , \mathcal M
=
\text{all memory}, M = all memory ,
而是:
E ( t ) = { m ∈ M : Ψ t ( m ) ≥ θ t } . \mathcal E^{(t)}
=
\left\{
m\in\mathcal M:
\Psi_t(m)\geq\theta_t
\right\}. E ( t ) = { m ∈ M : Ψ t ( m ) ≥ θ t } .
Ψ t \Psi_t Ψ t 可以由多個維度構成:
Ψ t ( m ) = w q Q t ( m ) + w s S t ( m ) + w p P t ( m ) + w r R t ( m ) + w v V t ( m ) + w c C t ( m ) + w d D t ( m ) . \Psi_t(m)
=
w_qQ_t(m)
+
w_sS_t(m)
+
w_pP_t(m)
+
w_rR_t(m)
+
w_vV_t(m)
+
w_cC_t(m)
+
w_dD_t(m). Ψ t ( m ) = w q Q t ( m ) + w s S t ( m ) + w p P t ( m ) + w r R t ( m ) + w v V t ( m ) + w c C t ( m ) + w d D t ( m ) .
其中可以分別表示:
query relevance;
semantic resonance;
persistence;
relation strength;
version validity;
current-task compatibility;
dependency importance。
因此:
Memory relevance is a state-dependent quantity. \boxed{
\text{Memory relevance is a state-dependent quantity.}
} Memory relevance is a state-dependent quantity.
同一個 m m m 在不同時間滿足:
Ψ t 1 ( m ) ≠ Ψ t 2 ( m ) \Psi_{t_1}(m)\neq\Psi_{t_2}(m) Ψ t 1 ( m ) = Ψ t 2 ( m )
是正常現象。
20. 結論
本文提出三域上下文動力學 TDCD,將長程 AI 記憶系統區分為:
W t ↔ P t ↔ D . \boxed{
\mathcal W_t
\leftrightarrow
\mathcal P_t
\leftrightarrow
\mathcal D.
} W t ↔ P t ↔ D .
即:
Working Domain ↔ Projection Domain ↔ Canonical Domain . \boxed{
\text{Working Domain}
\leftrightarrow
\text{Projection Domain}
\leftrightarrow
\text{Canonical Domain}.
} Working Domain ↔ Projection Domain ↔ Canonical Domain .
並提出:
E , L , C , G \mathcal E,\mathcal L,\mathcal C,\mathcal G E , L , C , G
四類核心操作:
Expand → Link → Converge , \boxed{
\text{Expand}
\rightarrow
\text{Link}
\rightarrow
\text{Converge},
} Expand → Link → Converge ,
由:
Govern \boxed{
\text{Govern}
} Govern
持續調節。
由此得到本文的主要結論:
The purpose of memory compression is not to preserve the present forever, but to make the past cheap enough to leave the present safely. \boxed{
\text{The purpose of memory compression is not to preserve the present forever, but to make the past cheap enough to leave the present safely.}
} The purpose of memory compression is not to preserve the present forever, but to make the past cheap enough to leave the present safely.
換言之:
壓縮的真正價值,不是把全部歷史塞回上下文,而是讓上下文敢於遺忘。 \boxed{
\text{壓縮的真正價值,不是把全部歷史塞回上下文,而是讓上下文敢於遺忘。}
} 壓縮的真正價值,不是把全部歷史塞回上下文,而是讓上下文敢於遺忘。
只要完整歷史存在於可驗證的典範域,投影層提供低成本尋址,而治理層能夠重新判斷當下需求,工作上下文便不必退化為不斷累積的歷史堆疊。
因此未來真正需要建立的不是「更大的 prompt」,而是一個能持續執行:
清理 ↔ 展開 ↔ 連接 ↔ 收斂 \boxed{
\text{清理}
\leftrightarrow
\text{展開}
\leftrightarrow
\text{連接}
\leftrightarrow
\text{收斂}
} 清理 ↔ 展開 ↔ 連接 ↔ 收斂
的自主上下文運行時。
參考文獻
Packer, C., Wooders, S., Lin, K., Fang, V., Patil, S. G., Stoica, I., & Gonzalez, J. E. MemGPT: Towards LLMs as Operating Systems . arXiv:2310.08560.
Yu, Y., Yao, L., Xie, Y., et al. Agentic Memory: Learning Unified Long-Term and Short-Term Memory Management for Large Language Model Agents . arXiv:2601.01885.
Kim, M., Baek, J., Jeong, S., & Hwang, S. J. MemRefine: LLM-Guided Compression for Long-Term Agent Memory . arXiv:2606.13177.
Jiang, E. H., Zhang, Z., Wu, Y., et al. Memory as a Controlled Process: Learned Adaptive Memory Management for LLM Agents . arXiv:2607.13591.
Model Context Protocol Core Maintainers. The 2026-07-28 Specification . Model Context Protocol, July 28, 2026.