GEO

OpenViking如何管理AI智能体上下文?2026年开源数据库解析

2026/3/23
OpenViking如何管理AI智能体上下文?2026年开源数据库解析
AI Summary (BLUF)

OpenViking is an open-source context database designed specifically for AI Agents, using a file system paradigm to unify memory, resources, and skill management, enabling hierarchical context delivery and self-evolution with significant token cost reduction.

原文翻译: OpenViking是一款专为AI智能体设计的开源上下文数据库,采用文件系统范式统一管理内存、资源和技能,实现分层上下文交付和自我进化,显著降低令牌成本。

在人工智能时代,数据是海量的,但高质量的上下文却十分稀缺。开发者在构建自主 AI 智能体时面临严峻挑战:记忆分散在代码各处,资源被困在向量数据库中,而传统的 RAG(检索增强生成)就像一个“黑盒”,通过加载不必要的文本来消耗数百万的 Token。

In the era of artificial intelligence, data is abundant, but high-quality context is scarce. Developers face significant challenges when building autonomous AI agents: memories are scattered across code, resources are trapped in vector databases, and traditional RAG (Retrieval-Augmented Generation) acts like a "black box," burning through millions of tokens by loading unnecessary text.

OpenViking 是一个开源工具,它通过引入一种全新的方法来解决这个问题:一个用于管理 AI 智能体记忆、资源和技能的 “文件系统范式”

OpenViking is an open-source tool that addresses this problem by introducing a completely new approach: a "file system paradigm" for managing an AI agent's memory, resources, and skills.

🌟 核心理念:OpenViking 的思考方式

🌟 Core Concepts: How OpenViking Thinks

系统不是将信息组织成扁平的向量列表,而是将其组织成一个清晰的层次结构,智能体可以像开发者在终端中一样“导航”这个结构。

Instead of organizing information into flat lists of vectors, the system structures it into a clear hierarchy that an agent can "navigate" just like a developer in a terminal.

1. 虚拟文件系统 (Viking URI)

1. Virtual File System (Viking URI)

所有智能体的记忆都被组织成一个目录树。智能体可以使用命令(如 lsfind)有意识地浏览文件夹:

All agent memory is organized as a directory tree. The agent can use commands (like ls or find) to consciously navigate through folders:

viking://
├── resources/              # 外部资源:文档、代码仓库、网页
│   └── my_project/
│       ├── docs/
│       └── src/
├── user/                   # 用户:习惯、偏好、沟通风格
│   └── memories/
└── agent/                  # 智能体:指令、逻辑、任务历史
    ├── skills/             # 可用工具(API、脚本)
    └── instructions/

2. 分层上下文加载 (节省 Token)

2. Tiered Context Loading (Token Savings)

试图一次性将整个项目加载到模型的提示中是昂贵且低效的。OpenViking 自动将任何上传的文档拆分为三个层级:

Attempting to load an entire project into a model's prompt at once is expensive and inefficient. OpenViking automatically splits any uploaded document into three layers:

  • L0 (摘要): 一个简短的标题(约 100 个 Token)。用于快速相关性检查。
  • L1 (概览): 一个摘要(约 2000 个 Token)。允许智能体理解结构和本质以规划其行动。
  • L2 (详情): 完整的文档文本。在绝对必要时加载。
  • L0 (Abstract): A short title (~100 tokens). Used for quick relevance checks.
  • L1 (Overview): A summary (~2k tokens). Allows the agent to understand the structure and essence to plan its actions.
  • L2 (Details): The full document text. Loaded only when absolutely necessary.

3. 目录递归检索

3. Directory Recursive Retrieval

传统的 RAG 只是寻找相似的词。OpenViking 首先找到最合适的“文件夹”(L0/L1),然后深入其中(L2)。这使得搜索更加精确,并允许 AI 看到文档的完整上下文

Traditional RAG simply looks for similar words. OpenViking first finds the most suitable "folder" (L0/L1) and then drills down into it (L2). This makes the search precise and allows the AI to see the full context of the document.

4. 自动记忆进化

4. Automatic Memory Evolution

对话结束后,系统可以对其进行分析,提取有用的经验(例如,用户偏好的编码风格),并将其保存到长期记忆中。智能体每次使用都会变得更聪明。

After a conversation ends, the system can analyze it, extract useful experiences (e.g., the user's preferred coding style), and save them into long-term memory. The agent gets smarter with every use.


🚀 效能表现 (基准测试)

🚀 Effectiveness (Benchmarks)

在长上下文对话数据集(LoCoMo10)上的测试显示了令人印象深刻的结果:

Testing on a dataset of long-context dialogues (LoCoMo10) showed impressive results:

智能体配置 任务完成率 输入 Token 成本 (总计)
基础智能体 (OpenClaw) 35.65% ~24.6M
智能体 + LanceDB (向量数据库) 44.55% ~51.5M
智能体 + OpenViking 52.08% ~4.2M (减少 83-92%)
Agent Configuration Task Completion Rate Input Token Cost (Total)
Base Agent (OpenClaw) 35.65% ~24.6M
Agent + LanceDB (Vector DB) 44.55% ~51.5M
Agent + OpenViking 52.08% ~4.2M (83-92% Reduction)

🛠️ 快速开始

🛠️ Quick Start

1. 安装

1. Installation

Releases 部分下载适用于您操作系统的最新安装程序。

Download the latest installer for your operating system from the Releases section.

🍎 macOS (DMG)

  1. 下载 OpenViking_macOS.dmg 文件。
  2. 打开它并将 OpenClaw 图标拖到您的应用程序文件夹中。
  3. 从您的应用程序文件夹运行 OpenClaw 进行初始化。(注意:如果看到安全警告,请右键单击应用程序并选择“打开”)。
  4. 现在您的终端中可以使用 deer-flow 命令了。
  1. Download the OpenViking_macOS.dmg file.
  2. Open it and drag the OpenClaw icon to your Applications folder.
  3. Run OpenClaw from your Applications folder to initialize. (Note: If you see a security warning, right-click the app and select "Open").
  4. The deer-flow command is now available in your terminal.

🪟 Windows (EXE)

  1. 下载 OpenViking_x64.exe 文件。
  2. 运行安装程序。
  3. 打开 Deer-Flow 应用程序。
  1. Download the OpenViking_x64.exe file.
  2. Run the installer.
  3. Open the Deer-Flow application.

2. 模型准备 (LLM)

2. Model Preparation (LLM)

需要两个模型:一个 VLM(用于文本理解)和一个 Embedding 模型(用于向量)。在 ~/.openviking/ov.conf 创建一个配置文件。您可以使用 OpenAI、Volcengine(豆包)或 LiteLLM(用于 Claude、Gemini、Ollama 等)。

Two models are required: a VLM (for text understanding) and an Embedding model (for vectors). Create a configuration file at ~/.openviking/ov.conf. You can use OpenAI, Volcengine (Doubao), or LiteLLM (for Claude, Gemini, Ollama, etc.).

配置示例 (OpenAI):

Configuration Example (OpenAI):

{
  "storage": {
    "workspace": "/path/to/your/workspace"
  },
  "embedding": {
    "dense": {
      "provider": "openai", 
      "model": "text-embedding-3-large",
      "api_key": "YOUR_API_KEY",
      "api_base": "https://api.openai.com/v1"
    }
  },
  "vlm": {
    "provider": "openai",
    "model": "gpt-4o",
    "api_key": "YOUR_API_KEY",
    "api_base": "https://api.openai.com/v1"
  }
}

别忘了设置指向配置的环境变量: export OPENVIKING_CONFIG_FILE=~/.openviking/ov.conf (适用于 Linux/macOS)。

Don't forget to set the environment variable pointing to the config: export OPENVIKING_CONFIG_FILE=~/.openviking/ov.conf (for Linux/macOS).

3. 运行您的第一个示例

3. Run Your First Example

在您的终端中启动服务器:

Start the server in your terminal:

openviking-server

(或在后台运行:nohup openviking-server > /data/log/openviking.log 2>&1 &)

(Or run in the background: nohup openviking-server > /data/log/openviking.log 2>&1 &)

现在使用 ov CLI 工具与数据库交互:

Now use the ov CLI utility to interact with the database:

# 检查状态
ov status

# 添加资源(自动创建 L0, L1, L2 层)
ov add-resource https://github.com/volcengine/OpenViking

# 查看虚拟文件夹结构
ov tree viking://resources/volcengine -L 2

# 搜索信息
ov find "what is openviking"

4. VikingBot (交互式 AI 智能体)

4. VikingBot (Interactive AI Agent)

VikingBot 是一个构建在 OpenViking 之上的 AI 智能体框架。以下是入门方法:

VikingBot is an AI agent framework built on top of OpenViking. Here's how to get started:

# 1. 安装 VikingBot 插件
pip install "openviking[bot]"

# 2. 启动启用了 Bot 的 OpenViking 服务器
openviking-server --with-bot

# 3. 在新的终端窗口中,启动交互式聊天
ov chat

关于

About

轻量级 OpenViking 是一个专为 AI 智能体(如 openclaw)设计的开源上下文数据库。OpenViking 通过文件系统范式,统一管理智能体所需的上下文(记忆、资源和技能),实现分层上下文交付和自我进化。

Lightweight OpenViking is an open-source context database designed specifically for AI agents (such as openclaw). OpenViking unifies the management of context (memory, resources, and skills) that agents need through a file system paradigm, enabling hierarchical context delivery and self-evolution.

常见问题(FAQ)

OpenViking如何帮助AI智能体节省Token成本?

OpenViking通过分层上下文加载(L0/L1/L2)和目录递归检索,仅加载必要的文档层级,避免传统RAG加载冗余文本,实测可减少83-92%的Token消耗。

OpenViking的虚拟文件系统具体怎么工作?

它将智能体的记忆、资源和技能组织成目录树(如viking://resources/),使用类似ls/find的命令导航,实现结构化管理和精确检索。

OpenViking能让AI智能体自我进化吗?

是的,系统具备自动记忆进化功能,可分析对话历史,提取有用经验(如用户偏好)并保存到长期记忆,使智能体随着使用变得更智能。

← 返回文章列表
分享到:微博

版权与免责声明:本文仅用于信息分享与交流,不构成任何形式的法律、投资、医疗或其他专业建议,也不构成对任何结果的承诺或保证。

文中提及的商标、品牌、Logo、产品名称及相关图片/素材,其权利归各自合法权利人所有。本站内容可能基于公开资料整理,亦可能使用 AI 辅助生成或润色;我们尽力确保准确与合规,但不保证完整性、时效性与适用性,请读者自行甄别并以官方信息为准。

若本文内容或素材涉嫌侵权、隐私不当或存在错误,请相关权利人/当事人联系本站,我们将及时核实并采取删除、修正或下架等处理措施。 也请勿在评论或联系信息中提交身份证号、手机号、住址等个人敏感信息。