GEO

OpenViking如何解决AI智能体上下文危机?2026年文件系统范式解析

2026/3/27
OpenViking如何解决AI智能体上下文危机?2026年文件系统范式解析
AI Summary (BLUF)

OpenViking is an open-source context database designed specifically for AI agents, addressing the 'context crisis' through an innovative file system paradigm. It unifies memory, knowledge, and skills into a structured, navigable virtual file system, enabling efficient management, retrieval, and evolution of agent context while significantly reducing LLM token costs and improving observability.

原文翻译: OpenViking 是一个专为 AI 智能体设计的开源上下文数据库,通过创新的文件系统范式解决“上下文危机”。它将记忆、知识和技能统一到一个结构化、可导航的虚拟文件系统中,实现对智能体上下文的高效管理、检索和进化,同时显著降低大语言模型(LLM)的 token 成本并提升可观察性。

Introduction: The Rise of AI Agents and the Looming "Context Crisis"

In the rapidly evolving landscape of artificial intelligence, we are witnessing an explosion of AI agent applications. However, as these agents take on increasingly complex tasks, a fundamental challenge has emerged: how to efficiently manage, retrieve, and utilize vast amounts of contextual information. Whether it's a personal assistant, a code generation tool, or an automated decision-making system, each requires access to extensive memory, resources, and skills at runtime. Traditional solutions often lead to fragmented context, poor retrieval performance, high costs, and difficult debugging. Today, we introduce OpenViking, an open-source project specifically designed for AI agents. It redefines context management through an innovative "file system paradigm," enabling developers to construct an agent's "brain" as intuitively as managing local files.

在人工智能快速发展的今天,我们正迎来智能体(Agent)应用的爆发。然而,随着智能体承担越来越复杂的任务,一个根本性的挑战逐渐浮现:如何高效地管理、检索和利用海量的上下文信息?无论是个人助手、代码生成工具还是自动化决策系统,它们都需要在运行时访问大量的记忆、资源和技能。传统的解决方案往往导致上下文碎片化、检索效果不佳、成本高昂且难以调试。今天,我们介绍一个专为AI智能体设计的开源项目——OpenViking,它通过创新的“文件系统范式”重新定义了上下文管理,让开发者能够像管理本地文件一样构建智能体的大脑。

OpenViking Banner

The Overlooked "Context Crisis" in Agent Development

When building an AI agent, you might encounter the following thorny issues:

  • Context Fragmentation: Memory fragments are scattered throughout the code, knowledge documents are stored in vector databases, and tool functions are written in different modules. The agent must handle these heterogeneous pieces of information simultaneously, leading to complex logic and difficult maintenance.
  • Surging Context Demand: An agent may need to run for hours or even days, with each interaction generating new context. Simple truncation or compression can lead to the loss of critical information, affecting task continuity.
  • Poor Retrieval Effectiveness: Traditional RAG (Retrieval-Augmented Generation) systems use flat vector storage, focusing only on semantic similarity while ignoring the structural relationships between pieces of information. This is akin to randomly extracting sentences from a book without knowing which chapter they belong to.
  • Unobservable Context: The retrieval process is a black box. When an agent provides an incorrect answer, it's difficult to determine whether it's a model comprehension issue or inaccurate retrieved context.
  • Limited Memory Iteration: Most systems simplistically define memory as user conversation history, lacking the ability to distill insights from task execution processes and support long-term learning.

The root cause of these problems is the lack of a dedicated, structured context management infrastructure designed for agents. This is precisely the gap OpenViking aims to fill.

当你构建一个AI智能体时,你可能会遇到以下棘手问题:

  • 上下文碎片化:记忆片段散落在代码中,知识文档存储在向量数据库里,工具函数写在不同的模块中。智能体需要同时处理这些异构信息,导致逻辑复杂且难以维护。
  • 上下文需求激增:一个智能体可能需要运行数小时甚至数天,每次交互都会产生新的上下文。简单的截断或压缩会导致重要信息丢失,影响任务连贯性。
  • 检索效果不佳:传统RAG(检索增强生成)系统采用扁平化的向量存储,只关注语义相似性,却忽略了信息之间的结构关联。这就像从一本书中随机抽取句子,而不知道它们属于哪个章节。
  • 上下文不可观察:检索过程是一个黑盒。当智能体给出错误答案时,你很难判断是模型理解问题,还是检索到的上下文不准确。
  • 记忆迭代有限:大多数系统将记忆简单地定义为用户对话历史,缺乏对任务执行过程的提炼和长期学习能力。
    这些问题的根源在于:我们缺乏一个专门为智能体设计的、结构化的上下文管理基础设施。这正是OpenViking试图填补的空白。

OpenViking: Redefining the Context Database

OpenViking is an open-source context database specifically designed for AI agents. Its core philosophy is to organize all the context an agent needs—whether long-term memory, external knowledge bases, or callable skills—into a unified virtual file system. Developers can access and manage this context using standard file operation commands (like ls, find, grep), endowing the agent with a structured, observable, and iterative "brain."

OpenViking是一个开源的上下文数据库,专门为AI智能体设计。它的核心思想是:将智能体所需的所有上下文——无论是长期记忆、外部知识库还是可调用的技能——统一组织成一个虚拟的文件系统。开发者可以通过标准的文件操作命令(如lsfindgrep)来访问和管理这些上下文,让智能体拥有结构化、可观察、可迭代的“大脑”。

Primary Design Goals

  • Unified Management: Replace fragmented storage with a consistent abstraction (the virtual file system).
  • Cost Optimization: Significantly reduce token consumption for Large Language Model (LLM) calls through hierarchical storage and on-demand loading.
  • Precise Retrieval: Combine directory structure and semantic search to implement a recursive retrieval strategy of "locate the directory first, then delve into the content."
  • Full Observability: Record the path of every retrieval, allowing developers to trace the agent's decision-making basis.
  • Self-Evolution: Automatically extract long-term memory from sessions, making the agent smarter with use.
  • 统一管理:用一致的抽象(虚拟文件系统)替代碎片化的存储。
  • 成本优化:通过分层存储和按需加载,大幅降低大语言模型(LLM)调用的token消耗。
  • 精准检索:结合目录结构和语义搜索,实现“先定位目录,再深入内容”的递归检索策略。
  • 完全可观察:记录每一次检索的路径,让开发者可以追溯智能体的决策依据。
  • 自我进化:自动从会话中提取长期记忆,让智能体越用越聪明。

Core Concepts: How the File System Paradigm Solves Agent Challenges

OpenViking's design revolves around five core concepts, each addressing a challenge mentioned earlier.

1. File System Management Paradigm → Solving Fragmentation

OpenViking maps all context to virtual directories under the viking:// protocol. Each context entry has a unique URI, much like a file path. For example:

viking://
├── resources/              # External resources: documents, codebases, web pages, etc.
│   ├── my_project/
│   │   ├── docs/
│   │   └── src/
├── user/                   # User-related memories
│   └── memories/
│       ├── preferences/
│       └── habits/
└── agent/                  # The agent's own skills and experiences
    ├── skills/
    ├── memories/
    └── instructions/

This structure allows the agent to locate information deterministically: to find project documentation, go to viking://resources/my_project/docs/; to recall a user's programming preferences, go to viking://user/memories/preferences/coding_style. Developers can also operate on this context using familiar commands:

ov ls viking://resources/
ov tree viking://resources/my_project -L 2
ov cat viking://user/memories/preferences

This solves the fragmentation problem: memories, resources, and skills are no longer isolated but unified within a navigable file system.

OpenViking将所有上下文映射到viking://协议下的虚拟目录中。每个上下文条目都有一个唯一的URI,就像文件路径一样。
这种结构让智能体能够以确定性的方式定位信息:想要查找项目文档,就去viking://resources/my_project/docs/;想要回忆用户的编程偏好,就去viking://user/memories/preferences/coding_style。开发者也可以通过熟悉的命令来操作这些上下文:
这解决了碎片化问题:记忆、资源和技能不再是孤立的,而是统一在一个可导航的文件系统中。

2. Hierarchical Context Loading → Reducing Token Consumption

To avoid loading large amounts of redundant information all at once during retrieval, OpenViking automatically generates three levels of content when writing context:

  • L0 (Abstract): A one-sentence summary for quick filtering and relevance judgment. For example, the L0 for a document might be "OpenViking Installation Guide."
  • L1 (Overview): Contains core information and usage scenarios, approximately 2K tokens. The agent reads L1 during the planning phase to decide whether deeper exploration is needed.
  • L2 (Details): The complete raw data, including full text, code, or images. L2 is only loaded when the agent explicitly needs to perform a specific operation.

This hierarchical structure is stored within the same virtual directory, represented by special hidden files (e.g., .abstract, .overview). The agent can delve deeper layer by layer based on task requirements, avoiding the token cost of loading the full text for every query.

为了在检索时避免一次性加载大量冗余信息,OpenViking在写入上下文时自动生成三个层次的内容:

  • L0(摘要):一句话摘要,用于快速筛选和相关性判断。例如一个文档的L0可能是“OpenViking安装指南”。
  • L1(概览):包含核心信息和使用场景,约2K token左右。智能体在规划阶段读取L1来决定是否需要深入。
  • L2(详情):完整的原始数据,包括全部文本、代码或图像。只有在智能体明确需要执行具体操作时才会加载L2。
    这种分层结构存储在同一个虚拟目录中,通过特殊的隐藏文件(如.abstract.overview)表示。智能体可以根据任务需求逐层深入,避免为每一次查询都支付加载全文的token成本。

3. Directory Recursive Retrieval → Improving Retrieval Effectiveness

Traditional vector retrieval excels at finding semantically similar snippets but often ignores the contextual structure these snippets belong to. OpenViking designs a Directory Recursive Retrieval Strategy, simulating the human process of finding information: first determine which directory might contain the needed information, then explore deeper within that directory.

The retrieval process is as follows:

  1. Intent Analysis: Parse the user query to generate multiple retrieval conditions (e.g., keywords, entities).
  2. Initial Localization: Use vector retrieval to quickly find the most relevant "chunks" and locate the high-scoring directories they belong to.
  3. Fine-Grained Exploration: Perform a secondary search within these directories and add high-scoring results to the candidate set.
  4. Recursive Deep Dive: If a directory contains subdirectories, repeat the secondary search on them, delving deeper layer by layer.
  5. Result Aggregation: Finally, aggregate and return the most relevant context to the agent.

This method not only finds semantically matching content but also ensures the integrity of information within the overall structure. For example, when an agent asks "How to configure OpenViking's Embedding model," the system might first locate the viking://resources/openviking/docs/configuration/ directory, then search within that directory for content related to "embedding," ultimately returning the entire configuration chapter rather than scattered sentences.

传统的向量检索擅长找到语义相似的片段,但往往忽略了这些片段所在的上下文结构。OpenViking设计了一种目录递归检索策略,模拟人类查找信息的过程:先确定哪个目录可能包含所需信息,再深入目录内部探索。
这种方法不仅找到语义匹配的内容,还确保了信息在整体结构中的完整性。例如,当智能体询问“如何配置OpenViking的Embedding模型”时,系统可能会先定位到viking://resources/openviking/docs/configuration/目录,然后在该目录内检索“embedding”相关的内容,最终返回整个配置章节,而不是零散的句子。

4. Visualized Retrieval Traces → Observable Context

Because the retrieval process is based on directory recursion, the path of each retrieval (e.g., from viking://resources/ to viking://resources/openviking/docs/ to a specific file) is recorded. Developers can view the "trace" of this retrieval via API or CLI to understand how the agent step-by-step located the information. When the agent gives a wrong answer, it's easy to distinguish whether the retrieval path was wrong or the model's understanding was wrong. This observability greatly simplifies the debugging process.

由于检索过程是基于目录递归的,每一次检索的路径(例如:从viking://resources/viking://resources/openviking/docs/再到具体文件)都会被记录下来。开发者可以通过API或CLI查看这次检索的“轨迹”,了解智能体是如何一步步定位信息的。当智能体给出错误答案时,可以清晰地区分是检索路径错了,还是模型理解错了。这种可观察性极大地简化了调试过程。

5. Automatic Session Management → Context Self-Iteration

OpenViking has a built-in memory self-iteration loop. At the end of each session, developers can trigger the memory extraction mechanism. The system asynchronously analyzes information from the session—such as user feedback, task execution results, and tool calls—and automatically updates the user and agent memory directories:

  • User Memory Updates: For example, extracting the user's preferred writing style, commonly used code libraries, etc., making the agent more aligned with user habits in subsequent interactions.
  • Agent Experience Accumulation: Extracting operational techniques from successful or failed tasks to form skill memory, aiding future decision-making.

This means the agent is no longer a one-time entity; it can continuously learn and evolve through interaction with the world.

OpenViking内置了记忆自迭代循环。在每个会话结束时,开发者可以触发记忆提取机制。系统会异步分析本次会话中的用户反馈、任务执行结果、工具调用等信息,并自动更新到用户和智能体记忆目录中:

  • 用户记忆更新:例如提取用户偏好的写作风格、常用的代码库等,使智能体在后续交互中更贴合用户习惯。
  • 智能体经验积累:从成功或失败的任务中提取操作技巧,形成技能记忆,辅助未来决策。
    这意味着智能体不再是一次性的,它可以通过与世界的交互持续学习和进化。

Quick Start: Build Your First Context Database in Ten Minutes

Now let's get hands-on and experience OpenViking's core functionality. We'll go from installation and configuration to running a complete example.

Prerequisites

  • Python 3.10+
  • Go 1.22+ (if you need to build the AGFS component from source)
  • A C++17 compatible compiler (GCC 9+ or Clang 11+)
  • Operating System: Linux, macOS, or Windows
  • Stable network connection (for downloading dependencies and accessing model services)
  • Python 3.10+
  • Go 1.22+(如果需要从源码构建AGFS组件)
  • C++17兼容的编译器(GCC 9+或Clang 11+)
  • 操作系统:Linux、macOS或Windows
  • 稳定的网络连接(用于下载依赖和访问模型服务)

1. Install OpenViking

The easiest way is via pip:

pip install openviking --upgrade

If you also want to install the command-line tool ov (optional), you can install it using the Rust package manager cargo:

cargo install --git https://github.com/volcengine/OpenViking ov_cli

Or via a one-click installation script:

curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/crates/ov_cli/install.sh | bash

2. Model Preparation

OpenViking requires two types of model capabilities:

  • VLM Model: For understanding image and text content (e.g., visual question answering, document parsing).
  • Embedding Model: For generating vector representations to enable semantic retrieval.

Supported VLM Providers

OpenViking supports three VLM providers; you can choose based on your needs:

Provider Description Typical Models
volcengine Volcano Engine's Doubao Model doubao-seed-2-0-pro-260215
openai OpenAI Official API gpt-4-vision-preview, gpt-4o
litellm Unified client for calling various third-party models (Anthropic, DeepSeek, Gemini, vLLM, Ollama, etc.) claude-3-5-sonnet-20240620, deepseek-chat, gemini-pro, ollama/llama3.1

Note: litellm supports calling various models through a unified interface. The model field must follow the LiteLLM format specification. The system automatically detects common models (e.g., claude-*, deepseek-*); for other models, the full LiteLLM format prefix must be provided.

Supported Embedding Providers

Provider Typical Models Dimension
volcengine doubao-embedding-vision-250615 1024
openai text-embedding-3-large 3072
jina To be determined To be determined

3. Environment Configuration

Create the server configuration file ~/.openviking/ov.conf

Below is a complete configuration example using the Volcano Engine Doubao model (please replace the API Key and endpoint according to your actual situation):

{
  "storage": {
    "workspace": "/home/your-name/openviking_workspace"
  },
  "log": {
    "level": "INFO",
    "output": "stdout"
  },
  "embedding": {
    "dense": {
      "api_base": "https://ark.cn-beijing.volces.com/api/v3",
      "api_key": "your-volcengine-api-key",
      "provider": "volcengine",
      "dimension": 1024,
      "model": "doubao-embedding-vision-250615"
    },
    "max_concurrent": 10
  },
  "vlm": {
    "api_base": "https://ark.cn-beijing.volces.com/api/v3",
    "api_key": "your-volcengine-api-key",
    "provider": "volc

## 常见问题(FAQ)

### OpenViking如何解决AI智能体的上下文碎片化问题?

OpenViking通过创新的文件系统范式,将记忆、知识和技能统一到结构化虚拟文件系统中,实现集中管理,彻底解决传统方案中上下文分散在不同模块的问题。

### OpenViking怎样降低LLM的token使用成本?

采用分层上下文加载机制,智能体可根据任务需求按需加载特定目录的上下文,避免一次性传入所有信息,从而显著减少token消耗。

### OpenViking相比传统RAG系统在检索效果上有何改进?

通过目录递归检索技术,不仅考虑语义相似性,更保留信息的结构关联,让检索结果更准确、可解释,解决了传统扁平化向量存储的局限性。
← 返回文章列表
分享到:微博

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

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

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