Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

5.1 KB
Raw Blame

Example: LLM Wiki

Organize material from different sources into a Karpathy-style LLM Wiki of interlinked Markdown pages. Each page covers an entity, concept, or question, leading with a conclusion and citing its sources. An index.md page provides navigation.

The Skill picks the smallest page type that matches each page's retrieval purpose:

Page type Use for
entity A named thing with a stable identity (person, organization, product, project, system, dataset, standard, event…)
concept A reusable idea, mechanism, pattern, protocol, or mental model
method A reusable procedure with prerequisites, ordered steps, and a verifiable outcome
comparison Two or more subjects evaluated side by side on explicit dimensions
analysis A cross-source conclusion tied to a clear question
summary A faithful digest of one source (only when --instruction explicitly asks for it)

The default page types are entity and concept; other types follow the conditions in the Skill. Related material from multiple sources is grouped under the same topic.

Skill source: openviking/system_assets/compile/example-skills/llm-wiki · Visualization script: examples/compile/graph-show/llm-wiki

Check the prerequisites and run these commands from the OpenViking repository root. Replace the source directory with your own material.

Step 1: Prepare the sources

If the material is not in OpenViking yet, import it. Use ov add-resource for directories, ov write for a single file:

# Import a directory as a source
ov add-resource ./my-research --to viking://resources/research --wait

# Or write a single file
ov mkdir viking://resources/research
ov write viking://resources/research/notes.md \
  --from-file ./notes.md --mode create

Confirm the source is in place:

ov ls -r viking://resources/research

Step 2: Add the Skill

This example installs the Skill under viking://agent/skills, matching the compile command below. Omit -p for a private installation, then use the returned URI in --skill:

ov add-skill openviking/system_assets/compile/example-skills/llm-wiki -p viking://agent/skills --wait

Find the installed Skill URI:

ov skills list
# → viking://agent/skills/llm-wiki

Step 3: Run compile

ov compile \
  --from viking://resources/research \
  --to viking://resources/research-wiki \
  --skill viking://agent/skills/llm-wiki \
  --instruction "Organize into a team-searchable Wiki, keeping the source of every claim"
  • --from can be repeated or comma-separated to pass multiple sources at once.
  • The --to directory is created automatically if it does not exist.
  • Add -o json for machine-readable output. The command returns a task_id immediately; use it to inspect or cancel the task:
ov task status cmp_01abc      # progress and final result
ov task cancel cmp_01abc      # cooperative cancel

Step 4: Inspect the output

When compile finishes, the target directory holds a Markdown knowledge base. Read the navigation page first, then drill in:

ov tree viking://resources/research-wiki
ov read viking://resources/research-wiki/index.md

Typical layout (page type maps to directory):

research-wiki/
├── index.md            # navigation entry, type index
├── entity/
│   └── <title>.md
├── concept/
│   └── <title>.md
├── method/…  comparison/…  analysis/…

Step 5: Visualize it as an interactive graph

wiki_graph.py connects directly to the OpenViking service to read the Wiki pages (no local download needed), colors pages by type, links them by their cross-references, and produces a standalone interactive HTML:

python examples/compile/graph-show/llm-wiki/wiki_graph.py \
  viking://resources/research-wiki \
  -o research-wiki-graph.html \
  --title "Research Knowledge Base"

Open research-wiki-graph.html in a browser. Nodes are pages (colored by entity/concept/method…), edges are links between pages, and clicking a node shows its body.

Connection settings resolve the same way as ov: command-line arguments → OPENVIKING_* environment variables → ~/.openviking/ovcli.conf. Pass them explicitly for a remote service:

python examples/compile/graph-show/llm-wiki/wiki_graph.py \
  viking://resources/research-wiki \
  --url https://openviking.example.com \
  --api-key "$OPENVIKING_API_KEY" \
  -o research-wiki-graph.html --title "Research Knowledge Base"

Pass multiple Wikis to draw them on the same graph for comparison:

python examples/compile/graph-show/llm-wiki/wiki_graph.py \
  viking://resources/wiki-a viking://resources/wiki-b \
  -o combined.html --title "Two Knowledge Bases Side by Side"

Related docs