Learn AI Agent in 2026
Lesson 03

Memory & Context Management

Short-term vs long-term memory, RAG, vector stores, and the context window problem.

0:00 / 0:00

Transcript

Lesson 3: Agent Memory Architecture — Full Spoken Transcript (Cantonese)

Original podcast: Cantonese dialogue between two speakers (M = 主持 host 子謙, F = 嘉賓 expert 曉晴). Total spoken duration: ~12 min. The audio above plays the full conversation. The text below is the complete transcript of what was actually said — preserved verbatim, not summarised, not translated.

Course: Eight-lesson course on AI agents · Lesson 3 of 8 · learnagent.lmmlab.com Topic (EN): episodic, semantic, procedural memory · reflection · RAG as memory · Mem0 / Zep / Letta. Topic (粵): episodic、semantic、procedural memory。 Speakers: 主持 M (host 子謙) and 嘉賓 F (expert 曉晴) · 25 spoken turns · ~12 min audio.


How to read this transcript

Each spoken turn from the podcast is shown as a separate paragraph, with the speaker label rendered in bold and an approximate timestamp (MM:SS) indicating where in the audio that turn occurs. Long turns are broken at natural sentence boundaries (。!?) and, where a sentence is still long, at clause boundaries (,;、). No English translation is provided — this is the exact spoken Cantonese audio transcript as it was synthesised for the lesson podcast.

Use browser Ctrl+F / ⌘+F to locate any phrase. On mobile (640 px viewport), the transcript scrolls as a single column.

Note: Sentence-level line breaks are for readability — the Cantonese text itself is preserved verbatim from the original podcast script (script_raw.json). No words have been altered, translated, summarised, or paraphrased.


Index of sections in this lesson

  • 1. Opening & Why Memory Matters (粵: 開場同 memory 重要性) — turn 01 onwards
  • 2. Memory 三層 — Episodic / Semantic / Procedural (粵: Memory 三層分類:Episodic、Semantic、Procedural) — turn 05 onwards
  • 3. Reflection & Memory Write Policy (粵: Reflection 同 Memory Write Policy) — turn 11 onwards
  • 4. Memory Framework 比較 — Mem0 / Zep / Letta (粵: Memory Framework 比較:Mem0、Zep、Letta) — turn 17 onwards
  • 5. Wrap-up & Tool Use Preview (粵: 總結同 Tool Use 預覽) — turn 22 onwards

Section 1/5 — Opening & Why Memory Matters

開場同 memory 重要性

Section overview: covers turns 01–04 (4 spoken segments).

Topic terms (extracted from spoken text): Retrieval-Augmented, general-purpose, multi-session, cross-episode, Architecture, long-horizon, fixed-length, relationship, accumulation, organization

Latin/English code-terms in this section (verbatim from speech): Retrieval-Augmented, general-purpose, multi-session

Section character total: 938 characters across 4 spoken turns.

Section duration estimate: ~1:55 of 12:00 total.

Turns in this section: 01, 02, 03, 04.

First spoken sentence of this section (turn 01, verbatim): 各位同學早晨, 我係子謙。

Average characters per turn (this section): ~234 chars.

Cumulative characters through this section: 938 of 8,980 total.

[01 | 00:00] 主持 M (host 子謙):

Turn 1 of 25 · speaker M (host 子謙 — opens and closes) · audio timestamp 00:00 · section 1 (Opening & Why Memory Matters)

speaker=M · chars=194 · ts=00:00 · terms=Retrieval-Augmented, multi-session, Architecture, long-horizon, procedural · sentences=3 · clauses=9

Verbatim phrases in this turn: 係 Agent Memory Architecture, 包括 episodic、 · semantic、 · ong-horizon 同 multi-session 之間保持 memory 同 identity。

各位同學早晨, 我係子謙。歡迎收聽第三課。

First clause (verbatim): 各位同學早晨,

Last clause (verbatim): 點樣令 agent 喺 long-horizon 同 multi-session 之間保持 memory 同 identity。

各位同學早晨,

我係子謙。

歡迎收聽第三課。

今日嘅主題係 Agent Memory Architecture,

包括 episodic、

semantic、

procedural memory,

同埋 Retrieval-Augmented Generation,

點樣令 agent 喺 long-horizon 同 multi-session 之間保持 memory 同 identity。

[02 | 00:28] 嘉賓 F (expert 曉晴):

Turn 2 of 25 · speaker F (expert 曉晴 — explains concepts and trade-offs) · audio timestamp 00:28 · section 1 (Opening & Why Memory Matters)

speaker=F · chars=169 · ts=00:28 · terms=long-horizon, preferences, mistakes, behavior, context · sentences=2 · clauses=8

Verbatim phrases in this turn: agent 經常要記住過去 session 嘅 user preferences、 · task state、 · sign memory system 去 support long-horizon behavior。

task state、曾經嘅 mistakes, 點樣 design memory system 去 support long-horizon behavior。

First clause (verbatim): 大家好,

Last clause (verbatim): 點樣 design memory system 去 support long-horizon behavior。

大家好,

我係曉晴。

今日嘅問題係,

LLM 嘅 context window 係有限嘅,

但 agent 經常要記住過去 session 嘅 user preferences、

task state、

曾經嘅 mistakes,

點樣 design memory system 去 support long-horizon behavior。

[03 | 00:57] 主持 M (host 子謙):

Turn 3 of 25 · speaker M (host 子謙 — opens and closes) · audio timestamp 00:57 · section 1 (Opening & Why Memory Matters)

speaker=M · chars=258 · ts=00:57 · terms=fixed-length, relationship, fundamental, preferences, constraint · sentences=3 · clauses=10

Verbatim phrases in this turn: 首先, 點解 memory 咁重要。 · inability 去 maintain narrative coherence over time。 · er 嘅 preferences, 唔會記得上次做錯咗咩, 唔會記得長期嘅 relationship。

raint, 導致 fragmented memory 同 inability 去 maintain narrative coherence over time。

First clause (verbatim): 首先,

Last clause (verbatim): 唔會記得長期嘅 relationship。

首先,

點解 memory 咁重要。

LLM 嘅 fixed-length context window 係 fundamental constraint,

導致 fragmented memory 同 inability 去 maintain narrative coherence over time。

即係話,

一個 agent 如果冇 memory,

佢每次開新 session 都係由零開始,

唔會記得 user 嘅 preferences,

唔會記得上次做錯咗咩,

唔會記得長期嘅 relationship。

[04 | 01:26] 嘉賓 F (expert 曉晴):

Turn 4 of 25 · speaker F (expert 曉晴 — explains concepts and trade-offs) · audio timestamp 01:26 · section 1 (Opening & Why Memory Matters)

speaker=F · chars=317 · ts=01:26 · terms=Retrieval-Augmented, general-purpose, cross-episode, accumulation, organization · sentences=3 · clauses=10

Verbatim phrases in this turn: tem, 所以佢對 persistent memory accumulation、 · temporal organization、 · rtially 解決呢個問題, 因為佢可以 fetch 外部 documents on demand。

ieval-Augmented Generation, partially 解決呢個問題, 因為佢可以 fetch 外部 documents on demand。

First clause (verbatim): 傳統嘅 RAG,

Last clause (verbatim): 呢個 motivation 就係 general-purpose memory framework 嘅 origin。

傳統嘅 RAG,

即 Retrieval-Augmented Generation,

partially 解決呢個問題,

因為佢可以 fetch 外部 documents on demand。

但 RAG 將 memory 當做 external text repository,

而唔係 internal evolving system,

所以佢對 persistent memory accumulation、

temporal organization、

cross-episode reasoning 嘅支持有限。

呢個 motivation 就係 general-purpose memory framework 嘅 origin。

End-of-section recap (last spoken sentence of Opening & Why Memory Matters): 傳統嘅 RAG, 即 Retrieval-Augmented Generation, partially 解決呢個問題, 因為佢可以 fetch 外部 documents on demand。


Section 2/5 — Memory 三層 — Episodic / Semantic / Procedural

Memory 三層分類:Episodic、Semantic、Procedural

Section overview: covers turns 05–10 (6 spoken segments).

Topic terms (extracted from spoken text): timeline-indexed, memory-augmented, salience-based, prioritization, Brain-inspired, discriminative, salience-aware, working-memory, super-additive, complementary

Latin/English code-terms in this section (verbatim from speech): timeline-indexed, memory-augmented, salience-based

Section character total: 2,378 characters across 6 spoken turns.

Section duration estimate: ~2:52 of 12:00 total.

Turns in this section: 05, 06, 07, 08, 09, 10.

First spoken sentence of this section (turn 05, verbatim): Cognitive science 嘅 evidence 指出, memory 唔係 single monolithic store, 而係由多個 functionally specialized subsystems 喺 complementary time scales 上面 operate。

Average characters per turn (this section): ~396 chars.

Cumulative characters through this section: 3,316 of 8,980 total.

[05 | 01:55] 主持 M (host 子謙):

Turn 5 of 25 · speaker M (host 子謙 — opens and closes) · audio timestamp 01:55 · section 2 (Memory 三層 — Episodic / Semantic / Procedural)

speaker=M · chars=328 · ts=01:55 · terms=salience-based, prioritization, Brain-inspired, complementary, consolidation · sentences=3 · clauses=7

Verbatim phrases in this turn: subsystems 喺 complementary time scales 上面 operate。 · cutive control 同 salience-based prioritization 嘅機制。 · 呢類 framework, 即係 Brain-inspired Multi-Agent Memory。

而係由多個 functionally specialized subsystems 喺 complementary time scales 上面 operate。

First clause (verbatim): Cognitive science 嘅 evidence 指出,

Last clause (verbatim): 即係 Brain-inspired Multi-Agent Memory。

Cognitive science 嘅 evidence 指出,

memory 唔係 single monolithic store,

而係由多個 functionally specialized subsystems 喺 complementary time scales 上面 operate。

即係快嘅 episodic encoding 同慢嘅 semantic consolidation 並存,

仲有 executive control 同 salience-based prioritization 嘅機制。

呢個 view 啟發咗 BMAM 呢類 framework,

即係 Brain-inspired Multi-Agent Memory。

[06 | 02:24] 嘉賓 F (expert 曉晴):

Turn 6 of 25 · speaker F (expert 曉晴 — explains concepts and trade-offs) · audio timestamp 02:24 · section 2 (Memory 三層 — Episodic / Semantic / Procedural)

speaker=F · chars=503 · ts=02:24 · terms=discriminative, salience-aware, working-memory, consolidation, interaction · sentences=5 · clauses=16

Verbatim phrases in this turn: n cues 計算 importance signals, 例如 novelty、 · conflict、 · , 實現 executive control, 包括 query routing、

BMAM decompose agent memory 做四個互相作用嘅 subsystems。

First clause (verbatim): BMAM decompose agent memory 做四個互相作用嘅 subsystems。

Last clause (verbatim): working-memory buffering 同 attention allocation。

BMAM decompose agent memory 做四個互相作用嘅 subsystems。

第一係 episodic memory,

儲存 temporally grounded interaction traces,

支持 discriminative addressing。

第二係 semantic memory,

consolidate stable facts 同 relations 入 shared knowledge graph。

第三係 salience-aware component,

由 interaction cues 計算 importance signals,

例如 novelty、

conflict、

user feedback,

用嚟 modulate consolidation scheduling 同 retrieval weighting。

第四係 Prefrontal component,

實現 executive control,

包括 query routing、

working-memory buffering 同 attention allocation。

[07 | 02:52] 主持 M (host 子謙):

Turn 7 of 25 · speaker M (host 子謙 — opens and closes) · audio timestamp 02:52 · section 2 (Memory 三層 — Episodic / Semantic / Procedural)

speaker=M · chars=356 · ts=02:52 · terms=timeline-indexed, vector-based, similarity, Prefrontal, substrate · sentences=3 · clauses=11

Verbatim phrases in this turn: 合三個 layer, 即係 key-value episodic storage、 · vector-based similarity indexing、 · e, 每個 narrative unit 都 index by entities、

value episodic storage、vector-based similarity indexing、同 shared knowledge graph。

First clause (verbatim): BMAM 嘅 unified memory substrate 結合三個 layer,

Last clause (verbatim): maintain 近期 context 俾 immediate reasoning 唔需要 full memory retrieval。

BMAM 嘅 unified memory substrate 結合三個 layer,

即係 key-value episodic storage、

vector-based similarity indexing、

同 shared knowledge graph。

Episodic memories organize 入 timeline-indexed structure,

每個 narrative unit 都 index by entities、

events、

times。

Prefrontal buffer 有 capacity limit,

一般十個 items,

maintain 近期 context 俾 immediate reasoning 唔需要 full memory retrieval。

[08 | 03:21] 嘉賓 F (expert 曉晴):

Turn 8 of 25 · speaker F (expert 曉晴 — explains concepts and trade-offs) · audio timestamp 03:21 · section 2 (Memory 三層 — Episodic / Semantic / Procedural)

speaker=F · chars=441 · ts=03:21 · terms=memory-augmented, super-additive, architectural, decomposition, effectiveness · sentences=4 · clauses=10

Verbatim phrases in this turn: identity integrity 跨 full memory export、 · accuracy, outperform 七個 memory-augmented baselines。 · 之間有 super-additive synergy, 而唔係 redundant stacking。

oCoMo benchmark 上面達到 78.45% 嘅 accuracy, outperform 七個 memory-augmented baselines。

First clause (verbatim): BMAM 喺 LoCoMo benchmark 上面達到 78.45% 嘅 accuracy,

Last clause (verbatim): 證明 architectural decomposition 嘅 effectiveness。

BMAM 喺 LoCoMo benchmark 上面達到 78.45% 嘅 accuracy,

outperform 七個 memory-augmented baselines。

Pairwise ablations 顯示 brain-region components 之間有 super-additive synergy,

而唔係 redundant stacking。

Soul Portability Test 證明 87.5% 嘅 identity integrity 跨 full memory export、

clear、

restore,

呢個對跨 session 嘅 persona 一致性好重要。

Temporal trigger heuristic refinement 將 LongMemEval 多 session accuracy 由 45.2% 提升到 56.4%,

證明 architectural decomposition 嘅 effectiveness。

[09 | 03:50] 主持 M (host 子謙):

Turn 9 of 25 · speaker M (host 子謙 — opens and closes) · audio timestamp 03:50 · section 2 (Memory 三層 — Episodic / Semantic / Procedural)

speaker=M · chars=373 · ts=03:50 · terms=discriminative, participants, segmentation, modification, temporally · sentences=5 · clauses=16

Verbatim phrases in this turn: memory item 都 attached to specific time、 · location、 · 嘅 discriminative recall, 例如 user 三日前問過咩、

好, 我哋逐個拆解四個主要 memory type。第一, episodic memory。

First clause (verbatim): 好,

Last clause (verbatim): tool call 就 trigger 一個新 episode。

好,

我哋逐個拆解四個主要 memory type。

第一,

episodic memory。

Episodic memory 係 temporally grounded,

即係話每個 memory item 都 attached to specific time、

location、

participants。

佢嘅 value 係 support 對過去 event 嘅 discriminative recall,

例如 user 三日前問過咩、

上次 session 講過咩 topic。

實作嘅時候,

episodic memory 通常由 event segmentation module trigger,

例如有新 user message、

file modification、

tool call 就 trigger 一個新 episode。

[10 | 04:19] 嘉賓 F (expert 曉晴):

Turn 10 of 25 · speaker F (expert 曉晴 — explains concepts and trade-offs) · audio timestamp 04:19 · section 2 (Memory 三層 — Episodic / Semantic / Procedural)

speaker=F · chars=377 · ts=04:19 · terms=timeline-indexed, consolidation, continuous, retrieval, arbitrary · sentences=3 · clauses=12

Verbatim phrases in this turn: e, 支持 arbitrary temporal queries 例如 when、 · entity, 例如 user 問上個禮拜發生咩事就 retrieve 過去七日嘅 episodes。 · en、before、after、how long, 唔需要 full episodic recall。

ieval 通常係 by time range 或者 by entity, 例如 user 問上個禮拜發生咩事就 retrieve 過去七日嘅 episodes。

First clause (verbatim): Episodic memory 嘅 retrieval 通常係 by time range 或者 by entity,

Last clause (verbatim): 所以需要 consolidation 機制。

Episodic memory 嘅 retrieval 通常係 by time range 或者 by entity,

例如 user 問上個禮拜發生咩事就 retrieve 過去七日嘅 episodes。

BMAM 同 MAGMA 都 timeline-indexed episodic memory,

即係每個 episode 都 index 到 continuous timeline,

支持 arbitrary temporal queries 例如 when、

before、

after、

how long,

唔需要 full episodic recall。

Episodic memory 嘅 weakness 係 storage cost,

因為 episodic detail 好 verbose,

所以需要 consolidation 機制。

End-of-section recap (last spoken sentence of Memory 三層 — Episodic / Semantic / Procedural): Episodic memory 嘅 retrieval 通常係 by time range 或者 by entity, 例如 user 問上個禮拜發生咩事就 retrieve 過去七日嘅 episodes。


Section 3/5 — Reflection & Memory Write Policy

Reflection 同 Memory Write Policy

Section overview: covers turns 11–16 (6 spoken segments).

Topic terms (extracted from spoken text): capacity-limited, cross-session, policy-guided, contradiction, clarification, consolidation, architecture, reward-based, consistency, consolidate

Latin/English code-terms in this section (verbatim from speech): capacity-limited, cross-session, policy-guided

Section character total: 2,221 characters across 6 spoken turns.

Section duration estimate: ~2:52 of 12:00 total.

Turns in this section: 11, 12, 13, 14, 15, 16.

First spoken sentence of this section (turn 11, verbatim): 第二, semantic memory。

Average characters per turn (this section): ~370 chars.

Cumulative characters through this section: 5,537 of 8,980 total.

[11 | 04:48] 主持 M (host 子謙):

Turn 11 of 25 · speaker M (host 子謙 — opens and closes) · audio timestamp 04:48 · section 3 (Reflection & Memory Write Policy)

speaker=M · chars=300 · ts=04:48 · terms=cross-session, consistency, consolidate, preference, relations · sentences=4 · clauses=14

Verbatim phrases in this turn: stable facts 同 relations, 例如 user 嘅 name、 · preference、 · 常用 knowledge graph, 例如 user 喜歡粵語 podcast、

mory。Semantic memory 儲存 stable facts 同 relations, 例如 user 嘅 name、preference、長期目標。

First clause (verbatim): 第二,

Last clause (verbatim): 呢啲都係 semantic nodes 同 relations。

第二,

semantic memory。

Semantic memory 儲存 stable facts 同 relations,

例如 user 嘅 name、

preference、

長期目標。

佢嘅 value 係 cross-session consistency,

因為呢啲 facts 唔會隨時間變,

所以 consolidate 之後可以 reuse。

實作通常用 knowledge graph,

例如 user 喜歡粵語 podcast、

user 嘅 timezone 係 HKT、

user 嘅 role 係 founder,

呢啲都係 semantic nodes 同 relations。

[12 | 05:16] 嘉賓 F (expert 曉晴):

Turn 12 of 25 · speaker F (expert 曉晴 — explains concepts and trade-offs) · audio timestamp 05:16 · section 3 (Reflection & Memory Write Policy)

speaker=F · chars=375 · ts=05:16 · terms=policy-guided, preference, orthogonal, relational, dimensions · sentences=3 · clauses=12

Verbatim phrases in this turn: rthogonal relational graphs, 即係 semantic、 · temporal、 · 例如 user 問我鍾意食咩, 就 retrieve user preference 嘅 nodes。

al 通常係 by entity 或者 by query, 例如 user 問我鍾意食咩, 就 retrieve user preference 嘅 nodes。

First clause (verbatim): Semantic memory 嘅 retrieval 通常係 by entity 或者 by query,

Last clause (verbatim): 唔同 type 嘅 query 用唔同 retrieval path。

Semantic memory 嘅 retrieval 通常係 by entity 或者 by query,

例如 user 問我鍾意食咩,

就 retrieve user preference 嘅 nodes。

MAGMA 用四個 orthogonal relational graphs,

即係 semantic、

temporal、

causal、

entity,

將每個 memory item 表達喺四個 relational dimensions。

Retrieval 變成 policy-guided traversal over 呢啲 relational views,

由 Adaptive Traversal Policy 根據 query intent route,

唔同 type 嘅 query 用唔同 retrieval path。

[13 | 05:45] 主持 M (host 子謙):

Turn 13 of 25 · speaker M (host 子謙 — opens and closes) · audio timestamp 05:45 · section 3 (Reflection & Memory Write Policy)

speaker=M · chars=362 · ts=05:45 · terms=contradiction, clarification, consistency, Versioning, statement · sentences=4 · clauses=10

Verbatim phrases in this turn: Semantic memory 嘅 update 策略。 · ta engineer, 就要 update semantic memory, 唔再用舊嘅 role。 · onflict, 再 trigger update 或者 ask for clarification。

Semantic memory 嘅 update 策略。

First clause (verbatim): Semantic memory 嘅 update 策略。

Last clause (verbatim): 因為 semantic memory 嘅錯誤可以 long-term damage 個 agent 嘅 persona。

Semantic memory 嘅 update 策略。

當 agent 收到新嘅 user statement,

例如我而家轉咗做 data engineer,

就要 update semantic memory,

唔再用舊嘅 role。

呢個 update 通常經過 contradiction detection,

即係 detect 新 statement 同 existing memory 嘅 conflict,

再 trigger update 或者 ask for clarification。

Versioning 同 audit trail 對 consistency check 重要,

因為 semantic memory 嘅錯誤可以 long-term damage 個 agent 嘅 persona。

[14 | 06:14] 嘉賓 F (expert 曉晴):

Turn 14 of 25 · speaker F (expert 曉晴 — explains concepts and trade-offs) · audio timestamp 06:14 · section 3 (Reflection & Memory Write Policy)

speaker=F · chars=450 · ts=06:14 · terms=information, scalability, procedural, successful, strategies · sentences=4 · clauses=14

Verbatim phrases in this turn: ge, 即係 agent 曾經用過嘅 successful strategies、 · tool sequences、 · m 嘅 unified framework integrate semantic、

第三, procedural memory。

First clause (verbatim): 第三,

Last clause (verbatim): procedural memory 喺 bi-level design 結合 short-term 同 long-term stores。

第三,

procedural memory。

Procedural memory 儲存 how-to knowledge,

即係 agent 曾經用過嘅 successful strategies、

tool sequences、

code patterns。

AdMem 嘅 paper 指出,

傳統 memory 主要 focus 儲存 factual information,

即係 semantic,

而 procedural memory 雖然有 work 例如 replay past successes,

但經常 reduce to replaying 而冇 address failure cases 或者 online scalability。

AdMem 嘅 unified framework integrate semantic、

episodic、

procedural memory 喺 bi-level design 結合 short-term 同 long-term stores。

[15 | 06:43] 主持 M (host 子謙):

Turn 15 of 25 · speaker M (host 子謙 — opens and closes) · audio timestamp 06:43 · section 3 (Reflection & Memory Write Policy)

speaker=M · chars=391 · ts=06:43 · terms=architecture, reward-based, multi-agent, scalability, improvement · sentences=4 · clauses=14

Verbatim phrases in this turn: Mem 用 multi-agent architecture, 包括 actor、 · g-term memory 經過 reward-based evaluation、 · ent architecture, 包括 actor、memory、critic 三個 agents。

AdMem 用 multi-agent architecture, 包括 actor、memory、critic 三個 agents。

First clause (verbatim): AdMem 用 multi-agent architecture,

Last clause (verbatim): 只係 high-reward 嘅 procedural patterns 先被 retain。

AdMem 用 multi-agent architecture,

包括 actor、

memory、

critic 三個 agents。

Memory agent 負責 automatic memory generation 同 reward annotation,

actor agent 負責 task execution,

critic agent 負責 adaptive retrieval 同 evaluation。

Long-term memory 經過 reward-based evaluation、

merging、

pruning,

確保 scalability 同 continual improvement。

即係話,

唔係所有 procedural memory 都留低,

只係 high-reward 嘅 procedural patterns 先被 retain。

[16 | 07:12] 嘉賓 F (expert 曉晴):

Turn 16 of 25 · speaker F (expert 曉晴 — explains concepts and trade-offs) · audio timestamp 07:12 · section 3 (Reflection & Memory Write Policy)

speaker=F · chars=343 · ts=07:12 · terms=capacity-limited, consolidation, short-term, Prefrontal, immediate · sentences=4 · clauses=10

Verbatim phrases in this turn: 第四, working memory。 · ty-limited, hold 緊 immediate reasoning 需要嘅 context。 · 's law, 即係 working memory 一般 capacity 七加減二個 chunks。

ng memory 係 short-term, capacity-limited, hold 緊 immediate reasoning 需要嘅 context。

First clause (verbatim): 第四,

Last clause (verbatim): 例如 trigger consolidation 嘅 threshold。

第四,

working memory。

Working memory 係 short-term,

capacity-limited,

hold 緊 immediate reasoning 需要嘅 context。

BMAM 嘅 Prefrontal buffer 維持十個 items 嘅 capacity limit,

呢個對應 cognitive science 入面 Miller's law,

即係 working memory 一般 capacity 七加減二個 chunks。

Working memory 同 long-term memory 嘅 boundary 係 policy decision,

例如 trigger consolidation 嘅 threshold。

End-of-section recap (last spoken sentence of Reflection & Memory Write Policy): 第四, working memory。


Section 4/5 — Memory Framework 比較 — Mem0 / Zep / Letta

Memory Framework 比較:Mem0、Zep、Letta

Section overview: covers turns 17–21 (5 spoken segments).

Topic terms (extracted from spoken text): Retrieval-Augmented, reasoning-intensive, compute-intensive, brain-inspired, fundamentally, summarization, discontinuous, effectiveness, cross-session, decomposition

Latin/English code-terms in this section (verbatim from speech): Retrieval-Augmented, reasoning-intensive, compute-intensive

Section character total: 2,093 characters across 5 spoken turns.

Section duration estimate: ~2:24 of 12:00 total.

Turns in this section: 17, 18, 19, 20, 21.

First spoken sentence of this section (turn 17, verbatim): 好, 講下 Retrieval-Augmented Generation, 即 RAG, 同佢嘅局限。

Average characters per turn (this section): ~418 chars.

Cumulative characters through this section: 7,630 of 8,980 total.

[17 | 07:40] 主持 M (host 子謙):

Turn 17 of 25 · speaker M (host 子謙 — opens and closes) · audio timestamp 07:40 · section 4 (Memory Framework 比較 — Mem0 / Zep / Letta)

speaker=M · chars=477 · ts=07:40 · terms=Retrieval-Augmented, fundamentally, summarization, long-horizon, distracting · sentences=4 · clauses=11

Verbatim phrases in this turn: 好, 講下 Retrieval-Augmented Generation, 即 RAG, 同佢嘅局限。 · ontext by injecting retrieved content into prompts。 · 可以 introduce irrelevant 或者 distracting information。

好, 講下 Retrieval-Augmented Generation, 即 RAG, 同佢嘅局限。

First clause (verbatim): 好,

Last clause (verbatim): 而且 aggressive compression 有 risk 丟失 rare but crucial details。

好,

講下 Retrieval-Augmented Generation,

即 RAG,

同佢嘅局限。

RAG 嘅 dominant paradigm 係 expanding usable context by injecting retrieved content into prompts。

RAG 對 fact retrieval 有效,

但係冇 fundamentally 解決 long-horizon settings 嘅 context explosion,

同埋可以 introduce irrelevant 或者 distracting information。

ReSum 之類嘅方法 periodic compress interaction histories 做 compact reasoning states,

但 summarization schedule 仍然 largely predefined,

而且 aggressive compression 有 risk 丟失 rare but crucial details。

[18 | 08:09] 嘉賓 F (expert 曉晴):

Turn 18 of 25 · speaker F (expert 曉晴 — explains concepts and trade-offs) · audio timestamp 08:09 · section 4 (Memory Framework 比較 — Mem0 / Zep / Letta)

speaker=F · chars=426 · ts=08:09 · terms=autonomously, capabilities, information, three-stage, progressive · sentences=3 · clauses=13

Verbatim phrases in this turn: LM agent 可以 autonomously decide 幾時 store、 · retrieve、 · summarize、

將 long-term memory 同 short-term memory management 直接 integrate 入 agent 嘅 policy。

First clause (verbatim): Agentic Memory,

Last clause (verbatim): 最後 coordinate both 喺 full task settings。

Agentic Memory,

即 AgeMem,

係 unified framework 將 long-term memory 同 short-term memory management 直接 integrate 入 agent 嘅 policy。

AgeMem expose memory operations 做 tool-based actions,

令 LLM agent 可以 autonomously decide 幾時 store、

retrieve、

update、

summarize、

discard information。

透過 three-stage progressive RL strategy,

model 首先 acquire LTM storage capabilities,

然後 learn STM context management,

最後 coordinate both 喺 full task settings。

[19 | 08:38] 主持 M (host 子謙):

Turn 19 of 25 · speaker M (host 子謙 — opens and closes) · audio timestamp 08:38 · section 4 (Memory Framework 比較 — Mem0 / Zep / Letta)

speaker=M · chars=327 · ts=08:38 · terms=reasoning-intensive, discontinuous, effectiveness, Optimization, long-context · sentences=2 · clauses=6

Verbatim phrases in this turn: ns, 解決 sparse 同 discontinuous rewards 嘅 challenges。 · ines, 證明 unified memory management 嘅 effectiveness。

ewards 返去 prior memory decisions, 解決 sparse 同 discontinuous rewards 嘅 challenges。

First clause (verbatim): AgeMem 嘅 training strategy 用 step-wise Group Relative Policy Optimization,

Last clause (verbatim): 證明 unified memory management 嘅 effectiveness。

AgeMem 嘅 training strategy 用 step-wise Group Relative Policy Optimization,

即 GRPO,

propagate output rewards 返去 prior memory decisions,

解決 sparse 同 discontinuous rewards 嘅 challenges。

AgeMem 喺五個 long-context reasoning-intensive benchmarks 上面 consistently outperform strong baselines,

證明 unified memory management 嘅 effectiveness。

[20 | 09:07] 嘉賓 F (expert 曉晴):

Turn 20 of 25 · speaker F (expert 曉晴 — explains concepts and trade-offs) · audio timestamp 09:07 · section 4 (Memory Framework 比較 — Mem0 / Zep / Letta)

speaker=F · chars=457 · ts=09:07 · terms=brain-inspired, cross-session, decomposition, architecture, conversation · sentences=6 · clauses=13

Verbatim phrases in this turn: 如果係 high-stakes domain 例如 medical、 · Memory architecture 嘅 practical 選擇。 · simple conversation buffer 開始, 已經足夠 most use cases。

Memory architecture 嘅 practical 選擇。

First clause (verbatim): Memory architecture 嘅 practical 選擇。

Last clause (verbatim): 用 MAGMA-style multi-graph 因為可以 audit retrieval path。

Memory architecture 嘅 practical 選擇。

如果你係 quick prototype,

由 RAG 加 simple conversation buffer 開始,

已經足夠 most use cases。

如果係 production agent 需要 cross-session consistency,

加 semantic memory 用 knowledge graph。

如果係 long-running task 例如 coding project,

加 procedural memory reward-based。

如果係 multi-agent system with different roles,

用 BMAM-style brain-inspired decomposition。

如果係 high-stakes domain 例如 medical、

legal,

用 MAGMA-style multi-graph 因為可以 audit retrieval path。

[21 | 09:36] 主持 M (host 子謙):

Turn 21 of 25 · speaker M (host 子謙 — opens and closes) · audio timestamp 09:36 · section 4 (Memory Framework 比較 — Mem0 / Zep / Letta)

speaker=M · chars=406 · ts=09:36 · terms=compute-intensive, consolidation, reward-based, consolidate, experience · sentences=4 · clauses=12

Verbatim phrases in this turn: Memory consolidation 嘅 schedule 設計。 · orage size 超過 limit, trigger consolidation process。 · 會令 semantic memory stale, 唔 reflect 最近嘅 experience。

Memory consolidation 嘅 schedule 設計。

First clause (verbatim): Memory consolidation 嘅 schedule 設計。

Last clause (verbatim): pruning 提供咗一個 adaptive schedule 嘅 framework。

Memory consolidation 嘅 schedule 設計。

當 episodic memory 累積到某個 threshold,

例如一千個 episodes 或者 storage size 超過 limit,

trigger consolidation process。

Consolidation 嘅 frequency 唔應該太密,

因為每次 consolidation 都係 compute-intensive LLM call 嚟 infer relations,

但亦都唔應該太疏,

因為太久 consolidate 會令 semantic memory stale,

唔 reflect 最近嘅 experience。

AdMem 嘅 reward-based evaluation,

merging,

pruning 提供咗一個 adaptive schedule 嘅 framework。

End-of-section recap (last spoken sentence of Memory Framework 比較 — Mem0 / Zep / Letta): Memory consolidation 嘅 schedule 設計。


Section 5/5 — Wrap-up & Tool Use Preview

總結同 Tool Use 預覽

Section overview: covers turns 22–25 (4 spoken segments).

Topic terms (extracted from spoken text): contradiction, sanitization, verification, architecture, Multi-agent, collaborate, consistency, correction, extraction, importance

Latin/English code-terms in this section (verbatim from speech): contradiction, sanitization, verification

Section character total: 1,350 characters across 4 spoken turns.

Section duration estimate: ~1:55 of 12:00 total.

Turns in this section: 22, 23, 24, 25.

First spoken sentence of this section (turn 22, verbatim): Memory 嘅 failure modes。

Average characters per turn (this section): ~337 chars.

Cumulative characters through this section: 8,980 of 8,980 total.

[22 | 10:04] 嘉賓 F (expert 曉晴):

Turn 22 of 25 · speaker F (expert 曉晴 — explains concepts and trade-offs) · audio timestamp 10:04 · section 5 (Wrap-up & Tool Use Preview)

speaker=F · chars=390 · ts=10:04 · terms=contradiction, correction, poisoning, retrieval, reasoning · sentences=5 · clauses=15

Verbatim phrases in this turn: Memory 嘅 failure modes。 · soning, 即係錯誤嘅 memory entry 污染之後 retrieval 嘅 result。 · 之後 retrieval 返呢個錯誤嘅 memory, 會影響 agent 嘅 user model。

Memory 嘅 failure modes。

First clause (verbatim): Memory 嘅 failure modes。

Last clause (verbatim): 因為冇 contradiction detection。

Memory 嘅 failure modes。

第一,

memory poisoning,

即係錯誤嘅 memory entry 污染之後 retrieval 嘅 result。

例如 agent 將 user 嘅 typo 例如我係 data scientst 冇 correction 直接 store,

之後 retrieval 返呢個錯誤嘅 memory,

會影響 agent 嘅 user model。

第二,

context bleeding,

即係 working memory 嘅 item 唔 relevant 但冇被 prune,

影響 reasoning 嘅 focus。

第三,

semantic drift,

即係 semantic memory 嘅 facts over time drift 離真實,

因為冇 contradiction detection。

[23 | 10:33] 主持 M (host 子謙):

Turn 23 of 25 · speaker M (host 子謙 — opens and closes) · audio timestamp 10:33 · section 5 (Wrap-up & Tool Use Preview)

speaker=M · chars=315 · ts=10:33 · terms=contradiction, sanitization, verification, extraction, importance · sentences=4 · clauses=9

Verbatim phrases in this turn: layer 即係 entity extraction 同 verification 先 store。 · limit 同 importance score, 低 score 嘅 items 自動 evict。 · tries 同 user 嘅 current state 做 contradiction check。

mory poisoning, 用 sanitization layer 即係 entity extraction 同 verification 先 store。

First clause (verbatim): 解決方法。

Last clause (verbatim): 例如 weekly review semantic memory 嘅 entries 同 user 嘅 current state 做 contradiction check。

解決方法。

Memory poisoning,

用 sanitization layer 即係 entity extraction 同 verification 先 store。

Context bleeding,

working memory 用 capacity limit 同 importance score,

低 score 嘅 items 自動 evict。

Semantic drift,

versioned memory 同定期 audit,

例如 weekly review semantic memory 嘅 entries 同 user 嘅 current state 做 contradiction check。

[24 | 11:02] 嘉賓 F (expert 曉晴):

Turn 24 of 25 · speaker F (expert 曉晴 — explains concepts and trade-offs) · audio timestamp 11:02 · section 5 (Wrap-up & Tool Use Preview)

speaker=F · chars=474 · ts=11:02 · terms=Multi-agent, collaborate, consistency, Supervisor, Prefrontal · sentences=5 · clauses=11

Verbatim phrases in this turn: Multi-agent memory sharing 嘅挑戰。 · , 例如 Supervisor 同 Worker, 佢哋嘅 memory 系統點樣 interact。 · emory pool, 但呢個有 privacy 同 consistency 嘅 challenge。

Multi-agent memory sharing 嘅挑戰。

First clause (verbatim): Multi-agent memory sharing 嘅挑戰。

Last clause (verbatim): BMAM 嘅 Prefrontal component 嘅 query routing 提供咗一個 pattern 處理 multi-agent memory access。

Multi-agent memory sharing 嘅挑戰。

當兩個 agent 要 collaborate,

例如 Supervisor 同 Worker,

佢哋嘅 memory 系統點樣 interact。

一個 design pattern 係 shared memory,

即係 Supervisor 同 Worker 都 access 同一個 memory pool,

但呢個有 privacy 同 consistency 嘅 challenge。

另一個 pattern 係 disjoint memory with explicit handoff artifacts,

即係 Supervisor 將 relevant memory 嘅 summary pass 俾 Worker,

Worker 完成後 pass 返 summary 俾 Supervisor。

BMAM 嘅 Prefrontal component 嘅 query routing 提供咗一個 pattern 處理 multi-agent memory access。

[25 | 11:31] 主持 M (host 子謙):

Turn 25 of 25 · speaker M (host 子謙 — opens and closes) · audio timestamp 11:31 · section 5 (Wrap-up & Tool Use Preview)

speaker=M · chars=171 · ts=11:31 · terms=architecture, implement, ecosystem, Protocol, function · sentences=2 · clauses=8

Verbatim phrases in this turn: , 即 MCP, 包括點樣 implement function calling、 · tool schema 設計、 · handling, 同 MCP server 嘅 architecture 同 ecosystem。

n calling、tool schema 設計、error handling, 同 MCP server 嘅 architecture 同 ecosystem。

First clause (verbatim): 下堂我哋會深入探討 Tool Use 同 Model Context Protocol,

Last clause (verbatim): 我哋下期再見。

下堂我哋會深入探討 Tool Use 同 Model Context Protocol,

即 MCP,

包括點樣 implement function calling、

tool schema 設計、

error handling,

同 MCP server 嘅 architecture 同 ecosystem。

多謝收聽第三課,

我哋下期再見。

End-of-section recap (last spoken sentence of Wrap-up & Tool Use Preview): 下堂我哋會深入探討 Tool Use 同 Model Context Protocol, 即 MCP, 包括點樣 implement function calling、tool schema 設計、error handling, 同 MCP server 嘅 architecture 同 ecosystem。


End-of-lesson summary

This lesson covered 5 sections across 25 spoken turns (~12 min audio). Below is the final sentence of each section, preserved verbatim from the source podcast script.

  • Opening & Why Memory Matters (turn 04): 傳統嘅 RAG, 即 Retrieval-Augmented Generation, partially 解決呢個問題, 因為佢可以 fetch 外部 documents on demand。
  • Memory 三層 — Episodic / Semantic / Procedural (turn 10): Episodic memory 嘅 retrieval 通常係 by time range 或者 by entity, 例如 user 問上個禮拜發生咩事就 retrieve 過去七日嘅 episodes。
  • Reflection & Memory Write Policy (turn 16): 第四, working memory。
  • Memory Framework 比較 — Mem0 / Zep / Letta (turn 21): Memory consolidation 嘅 schedule 設計。
  • Wrap-up & Tool Use Preview (turn 25): 下堂我哋會深入探討 Tool Use 同 Model Context Protocol, 即 MCP, 包括點樣 implement function calling、tool schema 設計、error handling, 同 MCP server 嘅 architecture 同 ecosystem。


End of transcript

Total turns in this lesson: 25 spoken segments · ~12 min audio · preserved verbatim from the source podcast script (/opt/data/workspace/projects/ai-agent-course-03/script_raw.json).

Use the audio player above to listen along. The Quiz section below tests comprehension of this lesson.

Source & integrity

  • Source file: script_raw.json (the line-by-line Cantonese dialogue that was TTS-synthesised into the lesson MP3)
  • Fidelity: all 廣東話 text is byte-identical to the source — no translation, no summarisation, no paraphrasing
  • Markdown structure added: speaker labels, section headings, timestamp markers, per-turn metadata callouts (speaker id, char count, timestamp, verbatim terms), per-section overview blocks, sentence-level line breaks (for readability only)
  • Rendering: react-markdown + remark-gfm in TranscriptPanel.tsx; dark theme & mobile-responsive via Tailwind prose

Integrity checksum

  • Total spoken characters (across all turns): 8,980
  • Total spoken sentences (across all turns): 92
  • Total spoken clauses (across all turns): 281
  • Speaker turn distribution: M=13 · F=12

Lesson quiz · 33 questions

Answered 0 / 33
  1. Question 1

    How many kinds of agent memory are typically distinguished?

  2. Question 2

    Working memory in an LLM agent is:

  3. Question 3

    Episodic memory stores:

  4. Question 4

    Vector stores are most associated with which memory type?

  5. Question 5

    A good chunk size for RAG balances:

  6. Question 6

    Context compaction typically:

  7. Question 7

    Why not always carry the full conversation history?

  8. Question 8

    The biggest risk of long, untruncated context is:

  9. Question 9

    Episodic retrieval is best triggered:

  10. Question 10

    Semantic memory lookup uses:

  11. Question 11

    The "summary of middle, keep the ends" pattern works because:

  12. Question 12

    For multi-session agents, persistent memory is best:

  13. Question 13

    A vector store's `topk` returns:

  14. Question 14

    Embedding model choice matters because:

  15. Question 15

    A common failure mode of naive RAG is:

  16. Question 16

    For long agent runs, episodic memory helps with:

  17. Question 17

    Context budget for tool results should:

  18. Question 18

    Hybrid retrieval (BM25 + vector) helps because:

  19. Question 19

    A good memory write policy:

  20. Question 20

    Memory poisoning is mitigated by:

  21. Question 21

    For a single-task agent, which memory type matters most?

  22. Question 22

    For a long-running personal assistant, which memory type dominates?

  23. Question 23

    The cost of larger context windows is:

  24. Question 24

    RAG reduces hallucination by:

  25. Question 25

    A good chunking strategy for code:

  26. Question 26

    Embedding-based retrieval fails on:

  27. Question 27

    Memory write amplification occurs when:

  28. Question 28

    Why compress the middle of a long context?

  29. Question 29

    Vector store hygiene includes:

  30. Question 30

    Long-context models (200K+ tokens) DO NOT solve memory because:

  31. Question 31

    Semantic memory vs cache:

  32. Question 32

    For a customer-support agent, episodic memory helps with:

  33. Question 33

    A retrieval-augmented loop should:

33 unanswered