mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-11-03 07:47:45 +00:00
merge: README 写真正的独到设计
This commit is contained in:
42
README.md
42
README.md
@ -4,42 +4,40 @@
|
||||
|
||||
> **English**: [README_EN.md](./README_EN.md)
|
||||
|
||||
自托管 Agent 内核。接上 QQ、WebUI、命令行、文件、浏览器,跑几个月不用重启,还记得住事。
|
||||
自托管 Agent 内核。[文档](assets/docs/zh/ARCHITECTURE.md) · [English](README_EN.md)
|
||||
|
||||
**启动顺序是编译期算出来的,不是运行期猜的。** 20 个内核模块各自声明 `Requires`/`Provides`,
|
||||
构建时算出 6 层依赖图写进 `depgraph.bin`,并把图的 digest 用 `-ldflags` 注入二进制。
|
||||
运行期只读图,不重算。图与二进制不配套就拒绝启动,不猜哪边对。
|
||||
|
||||
```bash
|
||||
make build build-cli
|
||||
./build/homed -data /tmp/ha
|
||||
./build/waiter
|
||||
```
|
||||
|
||||
API 密钥在 WebUI(`http://localhost:8080`)里填。需要 Linux。
|
||||
**插件按设施就绪时刻启动,不等内核全装完。** 插件声明 `requires_facilities: [config]`,
|
||||
config 层(第 1 层)完成时它就起来了,不必等 agent 层。实测省掉 35 秒:agent 层要做
|
||||
context dense backfill 750 条事件、重建文档与知识库索引。
|
||||
|
||||
## 能做什么
|
||||
**输入分两类,中断分四级。** 排队输入没有级别,任何中断都能打断它。中断带 L1–L4,
|
||||
高抢占低,被抢占的现场压栈待恢复。同级不互相抢占。L4 归内核独占(panic、内核事件),
|
||||
插件声明 L4 会被夹到 L3。抢占计数能提级,但最多两档(`preemptPromotionCap = 2`),
|
||||
防低优先级任务被无限饿死。
|
||||
|
||||
**记忆按场面分,不按会话。** 场面指纹由通道、对话对象、工具、话题、时段构成,
|
||||
权重依次 1.0 / 1.0 / 0.8 / 0.4 / 0.2。重复出现到第 2 次才长成场面
|
||||
(`minSceneEvidence = 2`),只发生一次的不算。归属阈值 0.5,唤起阈值 0.35,
|
||||
唤起比归属宽松——想不起来是损失,多想一条只是多几行上下文。
|
||||
|
||||
## 其余
|
||||
|
||||
- **通道**:WebUI、命令行、QQ 群与私聊、A2A、IDE 里的 ACP
|
||||
- **工具**:文件、命令、代码、浏览器(真实 Chrome)、日程、备忘、RSS、音乐
|
||||
- **模态**:图片、视频、语音、截图、网页
|
||||
- **记忆**:三层(上下文 → 文档 → 图)+ 知识库,按场面召回
|
||||
- **调度**:并行子 agent、中断抢占、可恢复的现场
|
||||
- **内核零 IO**:不发 HTTP、不读文件,全部能力在插件里
|
||||
|
||||
28 个内置插件、89 个模型可调工具。外部插件一插件一仓,见 [github.com/HologramAgent](https://github.com/HologramAgent)。
|
||||
|
||||
## 架构
|
||||
|
||||
```go
|
||||
homed(内核:LLM 编排、记忆、检索)
|
||||
↑ PluginSDK
|
||||
插件(全部 IO:WebUI、QQ、命令行、文件、网络)
|
||||
```
|
||||
|
||||
内核不发任何 IO 调用。插件跑在独立进程里,与内核之间三条通道:stdio 上的 JSON-RPC 管控制,
|
||||
共享内存管大块数据,事件环管通知。插件 panic 不会带崩内核。
|
||||
|
||||
记忆随时间下沉。最近几轮留在上下文,旧一点转成文档,再旧蒸馏成图里的三元组。
|
||||
|
||||
这里记忆按场面划分,不按会话。场面由通道、对话对象、用到的工具和时段构成,
|
||||
回到同一个话题时上次的结论会被召回。
|
||||
|
||||
## 下载
|
||||
|
||||
[Releases](https://github.com/JianFeeeee/HologramAgent/releases) 提供三种变体:
|
||||
|
||||
58
README_EN.md
58
README_EN.md
@ -4,68 +4,30 @@
|
||||
|
||||
> **中文**: [README.md](./README.md)
|
||||
|
||||
Self-hosted agent kernel. Connects to QQ, a web UI, your shell, files, and a browser. Runs for months without a restart and keeps what it learned.
|
||||
Self-hosted agent kernel. [Docs](assets/docs/en/ARCHITECTURE.md) · [中文](README.md)
|
||||
|
||||
**Startup order is computed at build time, not guessed at runtime.** Twenty kernel modules each declare `Requires`/`Provides`. The build resolves a 6-layer dependency graph into `depgraph.bin` and injects the graph digest into the binary via `-ldflags`. At runtime the kernel reads the graph and does not recompute it. If the graph and the binary don't match, startup is refused rather than guessing which one is right.
|
||||
|
||||
```bash
|
||||
make build build-cli
|
||||
./build/homed -data /tmp/ha
|
||||
./build/waiter
|
||||
```
|
||||
|
||||
API keys go in the web UI at `http://localhost:8080`. Requires Linux.
|
||||
**Plugins start when their facilities are ready, not when the kernel finishes.** A plugin declaring `requires_facilities: [config]` launches as layer 1 completes instead of waiting for the agent layer. Measured saving: 35 seconds, which is how long the agent layer spends on dense backfill of 750 events plus rebuilding document and knowledge indexes.
|
||||
|
||||
## What it does
|
||||
**Two input classes, four interrupt levels.** Queued input carries no level, so any interrupt can preempt it. Interrupts carry L1–L4; higher preempts lower and the preempted state is pushed onto a stack for later resume. Same level never preempts. L4 belongs to the kernel alone (panics, kernel events); a plugin declaring L4 gets clamped to L3. Preemption count can raise a task's level, but by at most two steps (`preemptPromotionCap = 2`), so low-priority work can't starve indefinitely.
|
||||
|
||||
**Memory is partitioned by scene, not by session.** A scene fingerprint is built from channel, conversation partner, tools, topic, and time of day, weighted 1.0 / 1.0 / 0.8 / 0.4 / 0.2. A scene only comes into being on the second occurrence (`minSceneEvidence = 2`); one-off interactions don't count. Join threshold is 0.5, recall threshold 0.35. Recall is looser than join on purpose: failing to recall is a loss, while recalling one extra scene costs a few lines of context.
|
||||
|
||||
## Everything else
|
||||
|
||||
- **Channels**: web UI, CLI, QQ groups and DMs, A2A, ACP in your IDE
|
||||
- **Tools**: files, shell, code, browser (real Chrome), calendar, notes, RSS, music
|
||||
- **Modalities**: images, video, voice, screenshots, web pages
|
||||
- **Memory**: three layers (context → document → graph) plus a knowledge base, recalled by scene
|
||||
- **Scheduling**: parallel sub-agents, interrupt preemption, resumable state
|
||||
- **Zero-IO kernel**: no HTTP calls, no file reads; every capability lives in a plugin
|
||||
|
||||
28 built-in plugins, 89 model-callable tools. External plugins live one per repo under [github.com/HologramAgent](https://github.com/HologramAgent).
|
||||
|
||||
## Architecture
|
||||
|
||||
```go
|
||||
homed (kernel: LLM orchestration, memory, retrieval)
|
||||
↑ PluginSDK
|
||||
plugins (all IO: web UI, QQ, CLI, files, network)
|
||||
```
|
||||
|
||||
The kernel makes no IO calls. Plugins run as separate processes and talk to it over three channels: JSON-RPC on stdio for control, shared memory for bulk data, an event ring for notifications. A plugin panic doesn't take the kernel down.
|
||||
|
||||
Memory sinks over time. Recent turns stay in context, older ones become documents, oldest get distilled into graph triples.
|
||||
|
||||
Memory is partitioned by scene rather than by session. A scene is made of channel, conversation partner, tools used, and time of day, so returning to a topic recalls what was concluded last time.
|
||||
|
||||
## Documentation
|
||||
|
||||
- [Architecture](assets/docs/en/ARCHITECTURE.md) ([中文](assets/docs/zh/ARCHITECTURE.md))
|
||||
- [Plugin development](assets/docs/en/PLUGIN_DEV.md)
|
||||
- [SDK docs](https://sdk.homeagent.jianfgit.xyz/) · [llms.txt](https://sdk.homeagent.jianfgit.xyz/llms.txt)
|
||||
- [Changelog](CHANGELOG_EN.md) · [Design docs](docs/zh/README.md) · [Future plan](docs/zh/future-plan.md)
|
||||
|
||||
## Code Structure
|
||||
|
||||
```
|
||||
cmd/homed/ Daemon entry, assembles all subsystems
|
||||
cmd/waiter/ CLI client (Unix socket)
|
||||
internal/
|
||||
├── agent/core/ Agent core: input scheduler (2 classes + 4 levels), event loop, LLM tool loop, 7-stage pipeline, residents
|
||||
├── agent/api/ LLM Provider (Lua adapter layer: provider.go drives the vm)
|
||||
├── memory/ Three-layer memory: Graph(SQLite) / Document(JSON+TF-IDF) / Text(JSONL) + StaticEmbedder(pretrained word embedding/TF-IDF fallback) + CleanTemplateText(de-template)
|
||||
├── knowledge/ Knowledge base (filesystem + TF-IDF)
|
||||
├── plugin/ Plugin registry + subprocess loader (stdio RPC + shared memory segment + event ring)
|
||||
├── plugins/ built-in plugins (webui / cli / files / cmd / mcp / kbtree / seq / skillmgr …)
|
||||
├── sdk/ PluginSDK (Tool/Stage/Event three channels)
|
||||
├── config/ SQLite config center
|
||||
├── events/ Event bus
|
||||
└── internal/lua/adapters/ 10 LLM protocol adapter scripts
|
||||
External plugin development: see the [hologramagentsdk](https://github.com/JianFeeeee/hologramagentsdk)
|
||||
repo with the `hmapdev` toolchain. Each plugin has its own repo under
|
||||
[github.com/HologramAgent](https://github.com/HologramAgent).
|
||||
```
|
||||
|
||||
## Downloads
|
||||
|
||||
[Releases](https://github.com/JianFeeeee/HologramAgent/releases) ship three variants:
|
||||
|
||||
Reference in New Issue
Block a user