Skip to content

Storage Architecture

OpenViking uses a dual-layer storage architecture that separates content storage from index storage.

Overview

┌─────────────────────────────────────────┐
│          VikingFS (URI Abstraction)      │
│    URI Mapping · Hierarchical Access     │
│           · Relation Management          │
└────────────────┬────────────────────────┘
        ┌────────┴────────┐
        │                 │
┌───────▼────────┐  ┌─────▼───────────┐
│  Vector Index  │  │      AGFS       │
│ (Semantic      │  │ (Content        │
│  Search)       │  │  Storage)       │
└────────────────┘  └─────────────────┘

Dual-Layer Storage

LayerResponsibilityContent
AGFSContent storageL0/L1/L2 full content, multimedia files, relations
Vector IndexIndex storageURIs, vectors, metadata (no file content)

Design Benefits

  1. Clear responsibilities: Vector index handles retrieval, AGFS handles storage
  2. Memory optimization: Vector index doesn't store file content, saving memory
  3. Single data source: All content read from AGFS; vector index only stores references
  4. Independent scaling: Vector index and AGFS can scale separately Note: AGFS has been rewritten as a Rust implementation (RAGFS)

VikingFS Virtual Filesystem

VikingFS is the unified URI abstraction layer that hides underlying storage details.

URI Mapping

viking://resources/docs/auth  →  /local/resources/docs/auth
viking://user/memories        →  /local/user/memories
viking://agent/skills         →  /local/agent/skills

Core API

MethodDescription
read(uri)Read file content
write(uri, data)Write file
mkdir(uri)Create directory
rm(uri)Delete file/directory (syncs vector deletion)
mv(old, new)Move/rename (syncs vector URI update)
abstract(uri)Read L0 abstract
overview(uri)Read L1 overview
relations(uri)Get relation list
find(query, uri)Semantic search

Relation Management

VikingFS manages resource relations through .relations.json:

python
# Create relation
viking_fs.link(
    from_uri="viking://resources/docs/auth",
    uris=["viking://resources/docs/security"],
    reason="Related security docs"
)

# Get relations
relations = viking_fs.relations("viking://resources/docs/auth")

AGFS Backend Storage

AGFS provides POSIX-style file operations with multiple backend support.

Backend Types

BackendDescriptionConfig
localfsLocal filesystempath
s3fsS3-compatible storagebucket, endpoint
memoryMemory storage (for testing)-

Directory Structure

Each context directory follows a unified structure:

viking://resources/docs/auth/
├── .abstract.md          # L0 abstract
├── .overview.md          # L1 overview
├── .relations.json       # Relations table
└── *.md                  # L2 detailed content

Vector Index

The vector index stores semantic indices, supporting vector search and scalar filtering.

Context Collection Schema

FieldTypeDescription
idstringPrimary key
uristringResource URI
parent_uristringParent directory URI
context_typestringresource/memory/skill
is_leafboolWhether leaf node
vectorvectorDense vector
sparse_vectorsparse_vectorSparse vector
abstractstringL0 abstract text
namestringName
descriptionstringDescription
created_atstringCreation time
active_countint64Usage count

Index Strategy

python
index_meta = {
    "IndexType": "flat_hybrid",  # Hybrid index
    "Distance": "cosine",        # Cosine distance
    "Quant": "int8",             # Quantization
}

Backend Support

BackendDescription
localLocal persistence
httpHTTP remote service
volcengineVolcengine VikingDB

Vector Synchronization

VikingFS automatically maintains consistency between vector index and AGFS.

Delete Sync

python
viking_fs.rm("viking://resources/docs/auth", recursive=True)
# Automatically deletes all records with this URI prefix from vector index

Move Sync

python
viking_fs.mv(
    "viking://resources/docs/auth",
    "viking://resources/docs/authentication"
)
# Automatically updates uri and parent_uri fields in vector index

Released under the Apache-2.0 License.