11 · Knowledge graph

Gnosis

Subject–predicate–object triples appended to a Strand and indexed three ways. Pattern queries with wildcards, neighbor traversal, and provenance baked in. Build social graphs, ontologies, and reasoning surfaces that stay verifiable end-to-end.

Concepts

What you’re working with.

  • 01Subject–predicate–object triples appended to a Strand.
  • 02Three-way indexing: by subject, by predicate, by object.
  • 03Pattern queries with wildcards across any position.
  • 04Neighbor traversal, multi-hop walks, provenance preserved per triple.
  • 05Social graphs, ontologies, reasoning — one substrate.
Code

A handful of lines.

use gnosis::{Node, Triple, Pattern};

let node = Node::open(".weave/gnosis").await?;

// Append a fact.
node.add_triple(Triple::new(
    "did:weave:alice", "follows", "did:weave:bob",
)).await?;

// Pattern query — who does alice follow?
let pat = Pattern::new("did:weave:alice", "follows", Pattern::wildcard());
for t in node.query_pattern(&pat).await? {
    println!("{} → {}", t.predicate, t.object);
}

// Two-hop neighborhood.
let near = node.get_neighbors("did:weave:alice", /* depth */ 2).await?;

Ready to build?

Start with the SDK or load the agent context. Every library is independently documented and versioned.