Files
HomeAgent/knowledge/homeagent_architecture/content.md
root dd01388e76 docs: fix documentation-source mismatches across all doc files
- 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
2026-07-16 23:17:55 +08:00

3.1 KiB
Raw Blame History

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 toolchainCGO_ENABLED=1go-sqlite3 依赖)
  • 插件Go -buildmode=plugin
  • LLM 适配Lua 胶水层8 个适配器
  • 搜索:内置 TF-IDF 向量化器