mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-09-21 09:28:14 +00:00
- Go version: 1.19+/1.21+ → 1.25+ (matches go.mod) - document/doc.go → document/document.go (actual filename) - PluginSDK: 3 channels → 4 channels (add RegisterOutputChannel) - InjectInput/InjectInterrupt: 3 params → 4 params (add eventType) - RegisterChannel: document agentIO.Device interface requirement - Architecture: remove non-existent snapshot/tokenizer dirs, add skill/meta - Architecture: fix double internal/internal/sdk, fix Jaccard threshold - Adapter: add http_get/http_post Lua VM built-ins - Knowledge: 4-layer → 3-layer memory, CGO for go-sqlite3 not overlayfs - Code structure tree: fix sdk/ and lua/adapters/ path consistency
56 lines
3.1 KiB
Markdown
56 lines
3.1 KiB
Markdown
HomeAgent 是完全独立自研的新一代 Agent 框架。
|
||
|
||
## 架构总览
|
||
|
||
HomeAgent 采用内核 + 插件双层架构:
|
||
|
||
```
|
||
外部输入(QQ/Web/CLI)
|
||
│
|
||
▼
|
||
┌─────────────────────────────────────┐
|
||
│ 内核 (Kernel) │
|
||
│ ┌───────┐ ┌───────┐ ┌────────┐ │
|
||
│ │ LLM │ │ 记忆 │ │ 上下文 │ │
|
||
│ │ 引擎 │ │ 系统 │ │ 管理器 │ │
|
||
│ └───────┘ └───────┘ └────────┘ │
|
||
│ ┌───────┐ ┌───────┐ ┌────────┐ │
|
||
│ │ 工具 │ │ 事件 │ │ 配置 │ │
|
||
│ │ 调度 │ │ 总线 │ │ 系统 │ │
|
||
│ └───────┘ └───────┘ └────────┘ │
|
||
└──────────────┬──────────────────────┘
|
||
│
|
||
▼
|
||
┌─────────────────────────────────────┐
|
||
│ 插件层 (Plugins) │
|
||
│ QQ / Web / Cmd / 备忘 / Files / … │
|
||
└─────────────────────────────────────┘
|
||
```
|
||
|
||
## 核心特性
|
||
|
||
### 内核
|
||
- **LLM 引擎**:多 Provider 自动故障转移,8 个适配器(Anthropic/DeepSeek/Gemini/GitHub/Groq/Mistral/Ollama/OpenAI),自动降级
|
||
- **记忆系统**:三层记忆架构——上下文记忆(Context)、文档记忆(Document)、图记忆(Graph,实体+关系),向量索引检索;文本记忆与社交记忆为辅助存储
|
||
- **上下文管理**:自动剪枝低相关性事件,蒸馏重要信息写入长期记忆,有效防止上下文膨胀和记忆衰减
|
||
- **工具调度**:同质阶段并行执行,支持 pre_action/post_action/on_input 等生命周期钩子
|
||
- **事件总线**:发布/订阅模式,插件间松耦合通信
|
||
- **打断机制**:高优先级消息可打断进行中的 LLM 请求,即时响应
|
||
|
||
### 插件系统
|
||
- **双模式加载**:内部插件(Go 包编译集成)和外部插件(Go plugin -buildmode=plugin 动态加载)
|
||
- **热加载**:插件管理 API,运行时安装/卸载/重载插件
|
||
- **Stage 钩子**:插件可在 on_input/pre_action/post_action/before_toolcall/after_toolcall/before_output/after_output 各阶段注入逻辑
|
||
- **配置系统**:每插件独立 SQLite 配置表,标准注册/读取 API
|
||
|
||
### 数据存储
|
||
- SQLite 集中配置(核心 + 每插件独立表空间)
|
||
- 记忆数据存本地文件系统,向量索引内嵌(无需外部向量数据库)
|
||
- 文件变更追踪基于 overlayfs 实现
|
||
|
||
## 技术栈
|
||
- 语言:Go 1.25+
|
||
- 构建:标准 Go toolchain,CGO_ENABLED=1(go-sqlite3 依赖)
|
||
- 插件:Go -buildmode=plugin
|
||
- LLM 适配:Lua 胶水层,8 个适配器
|
||
- 搜索:内置 TF-IDF 向量化器 |