rust-kgdb 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -31
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,27 @@
|
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
+
## The Problem
|
|
12
|
+
|
|
13
|
+
We asked GPT-4 to write a simple SPARQL query: *"Find all professors."*
|
|
14
|
+
|
|
15
|
+
It returned this:
|
|
16
|
+
|
|
17
|
+
```sparql
|
|
18
|
+
```sparql
|
|
19
|
+
SELECT ?professor WHERE { ?professor a ub:Faculty . }
|
|
20
|
+
```
|
|
21
|
+
This query retrieves faculty members from the knowledge graph.
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Three problems: markdown code fences break the parser, `ub:Faculty` doesn't exist in the schema (it's `ub:Professor`), and the explanation text is mixed with the query. **Result: Parser error. Zero results.**
|
|
25
|
+
|
|
26
|
+
This isn't a cherry-picked failure. When we ran the standard LUBM benchmark (14 queries, 3,272 triples), vanilla LLMs produced valid, correct SPARQL **0% of the time**.
|
|
27
|
+
|
|
28
|
+
We built rust-kgdb to fix this.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
11
32
|
## Architecture: What Powers rust-kgdb
|
|
12
33
|
|
|
13
34
|
```
|
|
@@ -49,7 +70,9 @@
|
|
|
49
70
|
|
|
50
71
|
**Key Insight**: The Rust core provides raw performance (2.78µs lookups). The HyperMind framework adds mathematical guarantees (type safety, composition laws, proof generation) without sacrificing speed.
|
|
51
72
|
|
|
52
|
-
### What's Rust vs
|
|
73
|
+
### What's Rust Core vs SDK Layer?
|
|
74
|
+
|
|
75
|
+
All major capabilities are implemented in **Rust** via the HyperMind SDK crates (`hypermind-types`, `hypermind-runtime`, `hypermind-sdk`). The JavaScript/TypeScript layer is a thin binding that exposes these Rust capabilities for Node.js applications.
|
|
53
76
|
|
|
54
77
|
| Component | Implementation | Performance | Notes |
|
|
55
78
|
|-----------|---------------|-------------|-------|
|
|
@@ -58,37 +81,16 @@
|
|
|
58
81
|
| **EmbeddingService** | Rust via NAPI-RS | Sub-ms search | HNSW index + 1-hop cache |
|
|
59
82
|
| **DatalogProgram** | Rust via NAPI-RS | Semi-naive eval | Rule-based reasoning |
|
|
60
83
|
| **Pregel** | Rust via NAPI-RS | BSP model | Iterative graph algorithms |
|
|
61
|
-
| **TypeId** |
|
|
62
|
-
| **LLMPlanner** | JavaScript + HTTP | LLM latency | Claude/GPT
|
|
63
|
-
| **WasmSandbox** |
|
|
64
|
-
| **AgentBuilder** |
|
|
65
|
-
| **ExecutionWitness** |
|
|
84
|
+
| **TypeId** | Rust via NAPI-RS | N/A | Hindley-Milner type system |
|
|
85
|
+
| **LLMPlanner** | JavaScript + HTTP | LLM latency | Orchestrates Rust tools via Claude/GPT |
|
|
86
|
+
| **WasmSandbox** | Rust via NAPI-RS | Capability check | WASM isolation runtime |
|
|
87
|
+
| **AgentBuilder** | Rust via NAPI-RS | N/A | Fluent tool composition |
|
|
88
|
+
| **ExecutionWitness** | Rust via NAPI-RS | SHA-256 | Cryptographic audit proofs |
|
|
66
89
|
|
|
67
90
|
**Security Model**: All interactions with Rust components flow through NAPI-RS bindings with memory isolation. The WasmSandbox wraps these bindings with capability-based access control, ensuring agents can only invoke tools they're explicitly granted. This provides defense-in-depth: NAPI-RS for memory safety, WasmSandbox for capability control.
|
|
68
91
|
|
|
69
92
|
---
|
|
70
93
|
|
|
71
|
-
## The Problem
|
|
72
|
-
|
|
73
|
-
We asked GPT-4 to write a simple SPARQL query: *"Find all professors."*
|
|
74
|
-
|
|
75
|
-
It returned this:
|
|
76
|
-
|
|
77
|
-
```sparql
|
|
78
|
-
```sparql
|
|
79
|
-
SELECT ?professor WHERE { ?professor a ub:Faculty . }
|
|
80
|
-
```
|
|
81
|
-
This query retrieves faculty members from the knowledge graph.
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
Three problems: markdown code fences break the parser, `ub:Faculty` doesn't exist in the schema (it's `ub:Professor`), and the explanation text is mixed with the query. **Result: Parser error. Zero results.**
|
|
85
|
-
|
|
86
|
-
This isn't a cherry-picked failure. When we ran the standard LUBM benchmark (14 queries, 3,272 triples), vanilla LLMs produced valid, correct SPARQL **0% of the time**.
|
|
87
|
-
|
|
88
|
-
We built rust-kgdb to fix this.
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
94
|
## The Solution
|
|
93
95
|
|
|
94
96
|
rust-kgdb is a knowledge graph database with a neuro-symbolic agent framework called **HyperMind**. Instead of hoping the LLM gets the syntax right, we use mathematical type theory to *guarantee* correctness.
|
|
@@ -266,11 +268,11 @@ Same question = Same answer. Critical for compliance.
|
|
|
266
268
|
```javascript
|
|
267
269
|
// First call: Compute answer, cache result
|
|
268
270
|
const result1 = await agent.call("Analyze claims from Provider P001")
|
|
269
|
-
//
|
|
271
|
+
// Hash: sha256:9f86d081...b0f00a08
|
|
270
272
|
|
|
271
273
|
// Second call (10 minutes later): Return cached result
|
|
272
274
|
const result2 = await agent.call("Analyze claims from Provider P001")
|
|
273
|
-
//
|
|
275
|
+
// Cache HIT - same hash: sha256:9f86d081...b0f00a08
|
|
274
276
|
|
|
275
277
|
// Compliance officer: "Why are these identical?"
|
|
276
278
|
// You: "Idempotent responses - same input, same output, cryptographic proof."
|
|
@@ -2499,7 +2501,7 @@ that appear to be related. There might be collusion with provider PROV001."
|
|
|
2499
2501
|
"output": "collusion(P001,P002,PROV001)",
|
|
2500
2502
|
"derivation": "claim(CLM001,P001,PROV001) ∧ claim(CLM002,P002,PROV001) ∧ related(P001,P002) → collusion(P001,P002,PROV001)",
|
|
2501
2503
|
"timestamp": "2024-12-14T10:30:00Z",
|
|
2502
|
-
"hash": "sha256:
|
|
2504
|
+
"hash": "sha256:9f86d081...b0f00a08"
|
|
2503
2505
|
}
|
|
2504
2506
|
}
|
|
2505
2507
|
```
|
|
@@ -2519,7 +2521,7 @@ that appear to be related. There might be collusion with provider PROV001."
|
|
|
2519
2521
|
5. Unification: `?P1=P001, ?P2=P002, ?Prov=PROV001`
|
|
2520
2522
|
6. Conclusion: `collusion(P001, P002, PROV001)` - QED
|
|
2521
2523
|
|
|
2522
|
-
Here's the SHA-256 hash of this execution: `
|
|
2524
|
+
Here's the SHA-256 hash of this execution: `sha256:9f86d081...b0f00a08`"
|
|
2523
2525
|
|
|
2524
2526
|
**Result:** HyperMind passes audit. DSPy gets you a follow-up meeting with legal.
|
|
2525
2527
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rust-kgdb",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Production-grade Neuro-Symbolic AI Framework with Memory Hypergraph: +86.4% accuracy improvement over vanilla LLMs. High-performance knowledge graph (2.78µs lookups, 35x faster than RDFox). Features Memory Hypergraph (temporal scoring, rolling context window, idempotent responses), fraud detection, underwriting agents, WASM sandbox, type/category/proof theory, and W3C SPARQL 1.1 compliance.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|