Skip to content

Context Types

Based on a simplified mapping of human cognitive patterns and engineering considerations, OpenViking abstracts context into three basic types: Resource, Memory, and Skill, each serving different purposes in Agent applications.

Overview

TypePurposeLifecycleInitiative
ResourceKnowledge and rulesLong-term, relatively staticUser adds
MemoryAgent's cognitionLong-term, dynamically updatedAgent records
SkillCallable capabilitiesLong-term, staticAgent invokes

Resource

Resources are external knowledge that Agents can reference.

Characteristics

  • User-driven: Resource information actively added by users to supplement LLM knowledge, such as product manuals and code repositories
  • Static content: Content rarely changes after addition, usually modified by users
  • Structured storage: Organized by project or topic in directory hierarchy, with multi-layer information extraction

Examples

  • API docs, product manuals
  • FAQ databases, code repositories
  • Research papers, technical specs

Usage

python
# Add resource
client.add_resource(
    "https://docs.example.com/api.pdf",
    reason="API documentation"
)

# Search resources
results = client.find(
    "authentication methods",
    target_uri="viking://resources/"
)

Memory

Memories are divided into user memories and Agent memories, representing learned knowledge about users and the world.

Characteristics

  • Agent-driven: Memory information actively extracted and recorded by Agent
  • Dynamic updates: Continuously updated from interactions by Agent
  • Personalized: Learned for specific users or specific Agents

8 Categories

CategoryLocationDescriptionUpdate Strategy
profileuser/memories/profile.mdUser basic info✅ Merge into one file
preferencesuser/memories/preferences/User preferences by topic✅ Appendable
entitiesuser/memories/entities/Entity memories (people, projects)✅ Appendable
eventsuser/memories/events/Event records (decisions, milestones)❌ No update
casesagent/memories/cases/Learned cases❌ No update
patternsagent/memories/patterns/Learned patterns✅ Mergeable
toolsagent/memories/tools/Tool usage knowledge and best practices✅ Mergeable
skillsagent/memories/skills/Skill execution knowledge and workflow strategies✅ Mergeable

Usage

python
# Memories are auto-extracted from sessions
session = client.session()
await session.add_message("user", [{"type": "text", "text": "I prefer dark mode"}])
commit = await session.commit()  # Starts background memory extraction
task = await client.get_task(commit["task_id"])  # Poll until task["status"] == "completed"

# Search memories
results = await client.find(
    "UI preferences",
    target_uri="viking://user/memories/"
)

Skill

Skills are capabilities that Agents can invoke, such as current Skills, MCP, etc.

Characteristics

  • Defined capabilities: Tool definitions for completing specific tasks
  • Relatively static: Skill definitions don't change at runtime, but usage memories related to tools are updated in memory
  • Callable: Agent decides when to use which skill

Storage Location

viking://agent/skills/{skill-name}/
├── .abstract.md          # L0: Short description
├── SKILL.md              # L1: Detailed overview
└── scripts               # L2: Full definition

Usage

python
# Add skill
await client.add_skill({
    "name": "search-web",
    "description": "Search the web for information",
    "content": "# search-web\n..."
})

# Search skills
results = await client.find(
    "web search",
    target_uri="viking://agent/skills/"
)

Based on Agent's needs, supports unified search across all three context types, providing comprehensive information:

python
# Search across all context types
results = await client.find("user authentication")

for ctx in results.memories:
    print(f"Memory: {ctx.uri}")
for ctx in results.resources:
    print(f"Resource: {ctx.uri}")
for ctx in results.skills:
    print(f"Skill: {ctx.uri}")

Released under the Apache-2.0 License.