diff --git a/go/internal/api/server.go b/go/internal/api/server.go index 42c4674..26f3022 100644 --- a/go/internal/api/server.go +++ b/go/internal/api/server.go @@ -552,6 +552,10 @@ func NewServer() http.Handler { var paths []map[string]interface{} mode := "none" var usedEntities []string + // 响应体积上限:调用方(hermes 插件 / openclaw 客户端 / dashboard)都只读 notes, + // 不读 graph_paths(2026-09-27 全仓核对 3 处调用点)。而单实体 2 跳可爆到 1.9 万条 + // ≈1.7MB/次 → 截断,仅作可观测样本。 + const maxGraphPaths = 50 if entity != "" { norm := routes.NormalizeEntity(entity) p, err := graphStore.Navigate(norm, maxHops, "", nil) @@ -569,6 +573,10 @@ func NewServer() http.Handler { if obsidian != nil { noteResults = obsidian.SearchNotesByEntities(entities, maxNotes) } + // 笔记匹配已用完完整路径集 → 响应只留样本(见上方 maxGraphPaths 说明) + if len(paths) > maxGraphPaths { + paths = paths[:maxGraphPaths] + } } if len(noteResults) > 0 { mode = "direct"