项目简介
OpenViking 以 viking:// 虚拟文件系统统一存储记忆、资源与技能,将内容划分为 L0/L1/L2 三层并按需加载。支持可观测的检索轨迹,帮助 AI 智能体高效管理长期记忆与知识。
README 预览
\n\n\n \n \n \n\n\n### OpenViking: The Context Database for AI Agents\n\nEnglish / [中文](README_CN.md) / [日本語](README_JA.md)\n\nWebsite · Live Demo · GitHub · Issues · Docs\n\n[](https://github.com/volcengine/OpenViking/releases)\n[](https://github.com/volcengine/OpenViking)\n[](https://github.com/volcengine/OpenViking/issues)\n[](https://github.com/volcengine/OpenViking/graphs/contributors)\n[](https://github.com/volcengine/OpenViking/blob/main/LICENSE)\n[](https://github.com/volcengine/OpenViking/commits/main)\n\n👋 Join our Community\n\n📱 Lark Group · WeChat · Discord · X\n\n\n\n\n\n***\n\n## What is OpenViking\n\nOpenViking is an open-source context database for AI agents. It stores memories, resources, and skills as one virtual filesystem under the `viking://` protocol, so an agent browses its own context with `ls`, `tree`, and `find` instead of querying a black-box vector store. Content is processed into three tiers — L0 abstract, L1 overview, L2 details — and loaded on demand. Every retrieval leaves a trajectory you can watch and debug. Full introduction: [Getting started](https://docs.openviking.ai/en/getting-started/01-introduction).\n\n[](https://openviking.ai/studio)\n\n*The [OpenViking Studio](https://openviking.ai/studio) playground — a live demo you can open in the browser, no installation required.*\n\n## Why OpenViking\n\n- **One filesystem for all context.** Memories, resources, and skills each get a `viking://` URI. Agents locate and manipulate context deterministically, like a developer working with files. → [Viking URI](https://docs.openviking.ai/en/concepts/04-viking-uri) · [Context types](https://docs.openviking.ai/en/concepts/02-context-types)\n- **Tiered loading cuts token spend.** Every entry is processed into L0 (abstract), L1 (overview), and L2 (details) on write, then loaded only as deep as the task requires. → [Context layers](https://docs.openviking.ai/en/concepts/03-context-layers)\n- **Directory recursive retrieval.** Vector sear
常见问题 (5)
故障排除如何修复 OpenViking ov compile 中出现的 "complete_tool_result() got an unexpected keyword argument 'preserve_complete'" 错误?
此错误发生在 OpenViking main 分支(提交 54d4c0fac,v0.5.2.1+38 / 0.5.3.dev40)上,表现为 ov compile 静默跳过最终审查阶段,并在 result.warnings 中报告警告 "Final review incomplete; publishing original artifacts"。
**根本原因:** PR #6364 更新了 bot/vikingbot/agent/loop.py 中的 AgentLoop,使其在调用预览钩子(preview hook)时传入新的关键字参数 preserve_complete,但 Compile 流水线在 bot/vikingbot/compile/pipeline_agent.py(约第 55 行)中的自定义钩子仍使用旧的双参数签名,因此每次预览调用都会抛出 TypeError,而该异常被流水线吞没。
**修复方法:** 编辑 bot/vikingbot/compile/pipeline_agent.py,更新钩子签名以接受新标志(Compile 无条件保留子工具结果的完整性,因此该标志可忽略):
async def complete_tool_result(result, session_key, preserve_complete: bool = False):
"""Compile keeps child tool results complete unconditionally; the flag is
accepted for signature parity with the AgentLoop preview hook."""
return result
然后重启 openviking-server 并重新运行 ov compile。已验证结果:任务完成时 warnings: [],且最终审查阶段正常执行。
故障排除如何修复 DSH memory 插件 commit_count 显示为 0 且从不归档短会话的问题?
插件会发送共享默认值 keep_recent_count: 10,因此消息数少于 10 条的会话在最终 dispose() 提交时会在最近尾部保留全部消息,并且永远不会被归档。对于自行管理上下文的宿主框架(如 DSH),请在会话结束提交时将该值设置为 0。临时解决方法:以 OPENVIKING_COMMIT_KEEP_RECENT_COUNT=0 运行。在代码中,将 examples/dsh-memory-plugin/runtime.mjs 中 DSH 的最终提交改为发送 keep_recent_count: 0;同样的修复也适用于 Claude Code 和 Codex auto-capture.mjs 中的 token 阈值提交。由 OpenViking 管理上下文的插件应保留可配置的尾部。请更新到包含 PR "fix(plugins): archive every message on session commit." 的版本。
故障排除如何修复 Web Studio Compile 页面崩溃问题:"Cannot read properties of undefined (reading 'length')"?
这会影响 OpenViking 0.4.23:当编译任务在未使用可选的 --from 标志的情况下创建时。Studio 的行渲染器会检查 r?.from.length,但没有对 from 进行防护,因此缺少 meta.request.from 的任务会导致整个 /studio/compile 路由崩溃。
临时解决方法:使用能排除出问题任务的过滤器打开 Compile 页面,例如:
/studio/compile?status=completed
如果出问题的任务本身就是 completed 状态,请改用其他状态过滤器,或使用不匹配任何内容的查询:
/studio/compile?q=__no_match__
任务 API 运行正常;故障仅发生在 Studio 渲染中。
永久修复:升级到包含 PR fix(studio): normalize missing compile sources 的版本,或在 Studio API 边界处对缺失/null 的来源列表进行规范化处理:
const from = r?.from ?? [];
from.length ? from.map(/* 渲染来源 */) : "—";
最小化的前端安全防护措施是:
r?.from?.length ? r.from.map(/* 渲染来源 */) : "—"故障排除如何修复 OpenViking Hermes 插件的 "declared `on_session_end` hook is not registered" 警告?
这是一个误报:当 OpenViking 通过 Hermes 的 MemoryProvider 生命周期而非通用 hook 注册表进行注册时,就会出现这种情况。在 OpenViking 的 Hermes 插件清单(manifest)中,从声明的 hooks 列表里移除 on_session_end。不要移除 OpenVikingMemoryProvider.on_session_end(),也不要更改 ctx.register_memory_provider(OpenVikingMemoryProvider());Hermes 仍会通过 MemoryProvider 生命周期调用会话结束时的提交。重新加载/重新安装该插件,然后再次运行 hermes plugins doctor openviking。如果在使用 OpenViking 插件 2.0.1 搭配 Hermes 0.21.5 时会话提交成功,那么在安装清单修复之前,可以安全地忽略此警告。
故障排除如何修复 OpenViking 插件的 HTTP 客户端在响应体超时或连接重置时返回 HTTP 200 和空结果而不重试的问题?
升级到包含插件 PR #5661 的源码修订版或发布版本,该 PR 修复了 examples/memory-plugin-shared/lib/ov-http.mjs,并包含针对 openclaw 和 pi-experimental 客户端的配套修复。如果已固定到提交 d9352f2a8bac78cbf4ed08b26543d22adcdd4c93,请 cherry-pick 这些更改。
缺陷位于包裹 response.json() 的宽泛 catch 中:它把读取响应体时的传输层失败转换成了无效/空 JSON 的处理逻辑。修复必须重新抛出 abort/network/stream 错误,以便现有的外层处理器返回:
{ ok: false, status: 0, result: null }
并且 isRetryableFailure(result) 返回 true。对于自身持有的超时,原始错误必须保持 error.name === "AbortError" 且 error.aborted === true。
使用概念上类似如下的守卫逻辑:
try {
result = await response.json();
} catch (err) {
if (
err?.name === "AbortError" ||
err?.aborted === true ||
err?.cause?.code === "UND_ERR_SOCKET"
) {
throw err; // Let the outer transport handler classify and retry it.
}
// Keep existing handling only for a complete, malformed, or empty JSON body.
}
不要使用 requireJsonBody: true 作为变通方案:严格模式会把症状变成不可重试的 HTTP 200 empty or invalid JSON response 失败。打补丁后,正常的成功响应、HTTP 错误以及完整的畸形/空 JSON 响应体保持原有行为不变;只有在读取响应体期间发生的停滞、连接重置、中止和流中断,才会变成可重试的 status-0 传输层失败。