mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-09-21 09:28:14 +00:00
- Add files plugin as built-in (internal/plugins/files/) with read/write/edit/ls tools, supporting overwrite/append/insert/create modes and offset/limit segmented reading - Rewrite README.md with core domain separation and three-layer memory highlights - Rewrite docs/OVERVIEW.md with per-subsystem file path references - Rewrite docs/ARCHITECTURE.md (783→~300 lines), merge redundant sections - Clean docs/PLUGIN_DEV.md: remove emoji, simplify SDK examples - Fix provider Model pollution in LuaAdaptedProvider.Chat() - Fix executeToolCall to return actual error vs quiet not-found - Fix plugin.Open path caching with SHA256 temp-path workaround - Add knowledge/homeagent_architecture demo entry - Add config/personal/personal.md identity configuration
3.0 KiB
3.0 KiB
HomeAgent 是完全独立自研的新一代 Agent 框架。
架构总览
HomeAgent 采用内核 + 插件双层架构:
外部输入(QQ/Web/CLI)
│
▼
┌─────────────────────────────────────┐
│ 内核 (Kernel) │
│ ┌───────┐ ┌───────┐ ┌────────┐ │
│ │ LLM │ │ 记忆 │ │ 上下文 │ │
│ │ 引擎 │ │ 系统 │ │ 管理器 │ │
│ └───────┘ └───────┘ └────────┘ │
│ ┌───────┐ ┌───────┐ ┌────────┐ │
│ │ 工具 │ │ 事件 │ │ 配置 │ │
│ │ 调度 │ │ 总线 │ │ 系统 │ │
│ └───────┘ └───────┘ └────────┘ │
└──────────────┬──────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ 插件层 (Plugins) │
│ QQ / Web / Cmd / 备忘 / Files / … │
└─────────────────────────────────────┘
核心特性
内核
- LLM 引擎:多 Provider 自动故障转移,8 个适配器(DeepSeek/Anthropic/Gemini/GitHub/Groq/Mistral/Ollama/OpenAI),自动降级
- 记忆系统:四层记忆架构——图记忆(实体+关系)、文档记忆、文本记忆、社交记忆,向量索引检索
- 上下文管理:自动剪枝低相关性事件,蒸馏重要信息写入长期记忆,有效防止上下文膨胀和记忆衰减
- 工具调度:同质阶段并行执行,支持 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.19+
- 构建:标准 Go toolchain,CGO_ENABLED=1(overlayfs 依赖)
- 插件:Go -buildmode=plugin
- LLM 适配:Lua 胶水层,8 个适配器
- 搜索:内置 TF-IDF 向量化器