WeaveDocs
Gnosis
Knowledge Graph

Gnosis

Distributed knowledge graph storing (subject, predicate, object) triples on a Strand log.

What Gnosis is

Gnosis is an RDF-style triple store: every fact is a (subject, predicate, object) triple of UTF-8 strings. Triples are appended to a Strand and indexed on each of the three positions for fast pattern matching.

Three DashMap<String, Vec<u64>> indices are maintained in memory — one for subjects, one for predicates, one for objects. A query that fixes any subset of the three positions performs an intersection of the matching sequence number sets, then fetches each triple from the Strand.

Gnosis is the right primitive when:

  • You need durable, replicable facts with a clean query model.
  • Facts are short strings and the graph is read-heavy.
  • You want graph reasoning composable with other Weave primitives (Strand for audit, Basis for semantic recall, Forum for fact pickup).

When to use Gnosis

WorkloadGnosis fit
Agent memory of typed relationships ("Alice trusts Bob")Strong
Local-first knowledge graph for RAGStrong
Lineage/provenance auditStrong
OWL/SPARQL-grade reasoningOut of scope; combine with an external reasoner
Numeric facts (use floats, ranges)Weak — strings only; encode at the caller

Triple model

pub struct Triple {
    pub subject:   String,
    pub predicate: String,
    pub object:    String,
}

All three fields are owned Strings. The Strand block for a triple is the serde_json encoding of this struct.

Query model

pub struct QueryPattern {
    pub subject:   Option<String>,
    pub predicate: Option<String>,
    pub object:    Option<String>,
}

None is a wildcard. Some(s) is an exact match on that position. An all-None pattern returns every triple — useful for diagnostics, not for production.

At a glance

FieldValue
Crate/packageweave-gnosis
Version0.1.0
Sourcemodels/gnosis
Backing logOne strand::Strand
IndicesThree DashMap<String, Vec<u64>> (S, P, O)
Encodingserde_json
Asynctokio

Page map

Source modules

  • src/lib.rs — models/gnosis/src/lib.rs