From 659545069a4980d6d51b5ba81f22964da06abd0d Mon Sep 17 00:00:00 2001 From: root Date: Wed, 22 Jul 2026 17:34:35 +0800 Subject: [PATCH] docs: update file references after agent.go split (process.go, eventloop.go, distill.go) --- docs/en/ARCHITECTURE.md | 6 +++--- docs/en/OVERVIEW.md | 9 +++++---- docs/zh/ARCHITECTURE.md | 6 +++--- docs/zh/OVERVIEW.md | 9 +++++---- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/docs/en/ARCHITECTURE.md b/docs/en/ARCHITECTURE.md index 9fe73b8..209facb 100644 --- a/docs/en/ARCHITECTURE.md +++ b/docs/en/ARCHITECTURE.md @@ -41,7 +41,7 @@ eventLoop() → processTextInput() └── after_output stage Read-only, cleanup ``` -Code: `internal/agent/core/agent.go` — `process()` is the main tool loop +Code: `internal/agent/core/process.go` — `process()` is the main tool loop ### 7 Stage Hooks @@ -141,7 +141,7 @@ All vectorization unified under `StaticEmbedder` (`internal/memory/static_embedd | Context Prune | `context.go:155` | Trim low-relevance context events | VectorizeClean → CosineSimilarity(queryVec, evt.Vector) | | DocStore Query | `document.go:206` | Recall from document memory | TF-IDF Vectorize → vec.Search | | Indexer Entity Search | `indexer.go:96+111` | Recall from Graph | vector entity search + jieba keywords → SQLite LIKE + BFS | -| Entity Similarity Detection | `agent.go` | Detect similar entities in Graph | Bigram Jaccard (>0.75 → consolidation) | +| Entity Similarity Detection | `distill.go` | Detect similar entities in Graph | Bigram Jaccard (>0.75 → consolidation) | ### Context Layer @@ -365,7 +365,7 @@ Three delivery paths: | interceptCh | Insert `[interrupt message]` in process() | Before each LLM call | | InjectInput | Trigger new processing when eventLoop is idle | No ongoing request | -Code: `internal/agent/core/agent.go` — `interceptLoop` / `drainInterrupt` +Code: `internal/agent/core/eventloop.go` — `interceptLoop` / `drainInterrupts` : diff --git a/docs/en/OVERVIEW.md b/docs/en/OVERVIEW.md index 87a1279..0583f1e 100644 --- a/docs/en/OVERVIEW.md +++ b/docs/en/OVERVIEW.md @@ -33,11 +33,12 @@ Three progressive layers: context → cold archive → long-term graph memory, e Code is in the project root, implemented in Go. -**Kernel** (`internal/agent/core/agent.go`): -- Maintains a message loop (`eventLoop`), queuing input from the IO layer -- Each input goes through the full processing pipeline: memory recall → persona injection → LLM call → tool execution → output delivery +**Kernel** (`internal/agent/core/`): +- `eventloop.go` — Message loop (`eventLoop`), queuing input from the IO layer +- `process.go` / `stages.go` — Processing pipeline: memory recall → persona injection → LLM call → tool execution → output delivery, 7 stage hooks +- `toolcall.go` — Tool scheduling and execution +- `context.go` — Context management (pretrained word embedding scoring StaticEmbedder → CosineSimilarity, TF-IDF fallback), automatic pruning of low-relevance events - LLM calls abstracted through Provider interface, supports 8 LLM sources with automatic fallback -- Context management (`context.go`) based on pretrained word embedding scoring (StaticEmbedder → CosineSimilarity, TF-IDF fallback), automatic pruning of low-relevance events **Memory System** (`internal/memory/`): - **GraphDB** (`graph.go`) — SQLite, entities + relations tables, BFS traversal diff --git a/docs/zh/ARCHITECTURE.md b/docs/zh/ARCHITECTURE.md index f4c3285..e604e2b 100644 --- a/docs/zh/ARCHITECTURE.md +++ b/docs/zh/ARCHITECTURE.md @@ -41,7 +41,7 @@ eventLoop() → processTextInput() └── after_output stage 插件只读,收尾 ``` -代码:`internal/agent/core/agent.go` — `process()` 是工具循环主体 +代码:`internal/agent/core/process.go` — `process()` 是工具循环主体 ### 7 个阶段钩子 @@ -141,7 +141,7 @@ eventLoop() → processTextInput() | Context Prune | `context.go:155` | 裁剪低相关性上下文事件 | VectorizeClean → CosineSimilarity(queryVec, evt.Vector) | | DocStore Query | `document.go:206` | 文档记忆召回 | TF-IDF Vectorize → vec.Search | | Indexer 实体搜索 | `indexer.go:96+111` | Graph实体召回 | 向量实体搜索 + jieba关键词 → SQLite LIKE + BFS | -| 实体相似度检测 | `agent.go` | Graph中相似实体 | Bigram Jaccard (>0.75 → consolidation) | +| 实体相似度检测 | `distill.go` | Graph中相似实体 | Bigram Jaccard (>0.75 → consolidation) | ### Context 层 @@ -365,7 +365,7 @@ interceptLoop (goroutine) | interceptCh | process() 中插入 `[打断消息]` | 每个 LLM call 前 | | InjectInput | eventLoop 空闲时触发新处理 | 无进行中请求 | -代码:`internal/agent/core/agent.go` — `interceptLoop` / `drainInterrupt` +代码:`internal/agent/core/eventloop.go` — `interceptLoop` / `drainInterrupts` : diff --git a/docs/zh/OVERVIEW.md b/docs/zh/OVERVIEW.md index 2cac65a..32c5009 100644 --- a/docs/zh/OVERVIEW.md +++ b/docs/zh/OVERVIEW.md @@ -33,11 +33,12 @@ HomeAgent 是一个持续运行的个人智能 Agent 框架。 代码位于项目仓库根目录,Go 语言实现。 -**内核** (`internal/agent/core/agent.go`): -- 维护一个消息循环(`eventLoop`),从 IO 层排队接收输入 -- 每次输入走完整的处理管道:记忆召回 → 人格注入 → LLM 调用 → 工具执行 → 输出发送 +**内核** (`internal/agent/core/`): +- `eventloop.go` — 消息循环(`eventLoop`),从 IO 层排队接收输入 +- `process.go` / `stages.go` — 处理管道:记忆召回 → 人格注入 → LLM 调用 → 工具执行 → 输出发送,7 阶段钩子 +- `toolcall.go` — 工具调度与执行 +- `context.go` — 上下文管理(预训练词嵌入评分 StaticEmbedder → CosineSimilarity,TF-IDF 回退),自动剪枝低相关性事件 - LLM 调用通过 Provider 接口抽象,支持 8 个 LLM 源自动降级 -- 上下文管理(`context.go`)基于预训练词嵌入评分(StaticEmbedder → CosineSimilarity,TF-IDF回退),自动剪枝低相关性事件 **记忆系统** (`internal/memory/`): - **GraphDB** (`graph.go`) — SQLite,entities + relations 表,BFS 遍历