rust-kgdb 0.6.9 → 0.6.13

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/index.js CHANGED
@@ -83,6 +83,20 @@ const {
83
83
  AgentScope,
84
84
  // Sandbox Layer (v0.6.7+)
85
85
  WasmSandbox,
86
+ // Context Theory (v0.6.11+) - Type-theoretic schema validation
87
+ SchemaContext,
88
+ TypeJudgment,
89
+ QueryValidator,
90
+ ProofDAG,
91
+ // Schema Caching (v0.6.12+) - Cross-agent schema sharing
92
+ SchemaCache,
93
+ SCHEMA_CACHE,
94
+ // Schema-Aware GraphDB (v0.6.13+) - Auto schema extraction on load
95
+ SchemaAwareGraphDB,
96
+ createSchemaAwareGraphDB,
97
+ wrapWithSchemaAwareness,
98
+ // Configuration
99
+ CONFIG,
86
100
  } = require('./hypermind-agent')
87
101
 
88
102
  module.exports = {
@@ -135,4 +149,18 @@ module.exports = {
135
149
  AgentScope,
136
150
  // Sandbox Layer (v0.6.7+)
137
151
  WasmSandbox,
152
+ // Context Theory (v0.6.11+) - Type-theoretic schema validation
153
+ SchemaContext,
154
+ TypeJudgment,
155
+ QueryValidator,
156
+ ProofDAG,
157
+ // Schema Caching (v0.6.12+) - Cross-agent schema sharing
158
+ SchemaCache,
159
+ SCHEMA_CACHE,
160
+ // Schema-Aware GraphDB (v0.6.13+) - Auto schema extraction on load
161
+ SchemaAwareGraphDB,
162
+ createSchemaAwareGraphDB,
163
+ wrapWithSchemaAwareness,
164
+ // Configuration (v0.6.11+) - Centralized tunable parameters
165
+ CONFIG,
138
166
  }
@@ -0,0 +1,421 @@
1
+ # =============================================================================
2
+ # HyperMind Agent Memory Ontology v1.0.0
3
+ # =============================================================================
4
+ #
5
+ # Namespace: http://hypermind.ai/memory#
6
+ #
7
+ # This ontology defines the formal vocabulary for HyperMind agent memory,
8
+ # enabling episodic memory storage and retrieval linked to the knowledge graph.
9
+ #
10
+ # Architecture:
11
+ # Working Memory (ephemeral) --> Episodic Memory (temporal) --> Long-Term KG
12
+ # (CPU registers) (execution history) (persistent)
13
+ #
14
+ # All memory is stored as RDF in the same quad store as business data,
15
+ # enabling single SPARQL queries to traverse both memory and knowledge.
16
+ #
17
+ # =============================================================================
18
+
19
+ @prefix am: <http://hypermind.ai/memory#> .
20
+ @prefix owl: <http://www.w3.org/2002/07/owl#> .
21
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
22
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
23
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
24
+ @prefix dcterms: <http://purl.org/dc/terms/> .
25
+ @prefix prov: <http://www.w3.org/ns/prov#> .
26
+
27
+ # =============================================================================
28
+ # Ontology Metadata
29
+ # =============================================================================
30
+
31
+ <http://hypermind.ai/memory#> a owl:Ontology ;
32
+ rdfs:label "HyperMind Agent Memory Ontology"@en ;
33
+ rdfs:comment """
34
+ Formal vocabulary for AI agent memory in the HyperMind framework.
35
+
36
+ Enables:
37
+ - Episodic memory with temporal scoring
38
+ - Session persistence across agent invocations
39
+ - Provenance tracking for all agent actions
40
+ - Hyper-edge linking between memory and knowledge graph entities
41
+
42
+ Mathematical Foundation:
43
+ - Score = α × Recency + β × Relevance + γ × Importance
44
+ - Default weights: α=0.3, β=0.5, γ=0.2
45
+ - Recency decay: 0.995^hours (~12% per day)
46
+ """@en ;
47
+ owl:versionInfo "1.0.0" ;
48
+ dcterms:created "2025-12-15"^^xsd:date ;
49
+ dcterms:creator "HyperMind Team" ;
50
+ dcterms:license <https://opensource.org/licenses/Apache-2.0> .
51
+
52
+ # =============================================================================
53
+ # Class Definitions
54
+ # =============================================================================
55
+
56
+ # -----------------------------------------------------------------------------
57
+ # Memory Tier Classes
58
+ # -----------------------------------------------------------------------------
59
+
60
+ am:Episode a owl:Class ;
61
+ rdfs:label "Episode"@en ;
62
+ rdfs:comment """
63
+ A discrete interaction record in episodic memory.
64
+
65
+ Each episode captures:
66
+ - The user prompt that initiated the execution
67
+ - The result/output produced
68
+ - Success/failure status
69
+ - Timing information
70
+ - Embedding vector for semantic retrieval
71
+
72
+ Episodes are stored in a named graph (default: http://hypermind.ai/memory/)
73
+ and linked to knowledge graph entities via am:linksToEntity.
74
+ """@en ;
75
+ rdfs:subClassOf prov:Activity .
76
+
77
+ am:ExecutionRecord a owl:Class ;
78
+ rdfs:label "Execution Record"@en ;
79
+ rdfs:comment """
80
+ A record of tool execution within an episode.
81
+
82
+ Tracks the specific tool invoked, its input parameters,
83
+ and the output produced. Enables full auditability of
84
+ agent actions for compliance and debugging.
85
+ """@en ;
86
+ rdfs:subClassOf am:Episode .
87
+
88
+ am:Agent a owl:Class ;
89
+ rdfs:label "Agent"@en ;
90
+ rdfs:comment """
91
+ A HyperMind agent identity.
92
+
93
+ Agents have persistent identity across sessions, enabling:
94
+ - Session state preservation
95
+ - Cross-session memory retrieval
96
+ - Multi-agent collaboration tracking
97
+
98
+ Each agent is identified by a UUID and optionally a human-readable name.
99
+ """@en ;
100
+ rdfs:subClassOf prov:SoftwareAgent .
101
+
102
+ am:Session a owl:Class ;
103
+ rdfs:label "Session"@en ;
104
+ rdfs:comment """
105
+ A bounded interaction period with an agent.
106
+
107
+ Sessions group related episodes and provide context boundaries
108
+ for working memory. Session state can be persisted and restored.
109
+ """@en ;
110
+ rdfs:subClassOf prov:Activity .
111
+
112
+ # -----------------------------------------------------------------------------
113
+ # Memory Tier Structure
114
+ # -----------------------------------------------------------------------------
115
+
116
+ am:WorkingMemoryItem a owl:Class ;
117
+ rdfs:label "Working Memory Item"@en ;
118
+ rdfs:comment """
119
+ Ephemeral context item (like CPU registers).
120
+
121
+ Working memory has LRU eviction with configurable capacity.
122
+ Items are NOT persisted to the knowledge graph.
123
+ """@en .
124
+
125
+ am:ProofDAG a owl:Class ;
126
+ rdfs:label "Proof DAG"@en ;
127
+ rdfs:comment """
128
+ Directed Acyclic Graph representing the reasoning chain.
129
+
130
+ Based on Curry-Howard correspondence, each proof node
131
+ corresponds to a type in the type system, ensuring
132
+ all reasoning is verifiable.
133
+ """@en .
134
+
135
+ # =============================================================================
136
+ # Datatype Properties
137
+ # =============================================================================
138
+
139
+ # -----------------------------------------------------------------------------
140
+ # Episode Properties
141
+ # -----------------------------------------------------------------------------
142
+
143
+ am:prompt a owl:DatatypeProperty ;
144
+ rdfs:label "prompt"@en ;
145
+ rdfs:comment "The natural language prompt that initiated this episode."@en ;
146
+ rdfs:domain am:Episode ;
147
+ rdfs:range xsd:string .
148
+
149
+ am:success a owl:DatatypeProperty ;
150
+ rdfs:label "success"@en ;
151
+ rdfs:comment "Whether the episode completed successfully."@en ;
152
+ rdfs:domain am:Episode ;
153
+ rdfs:range xsd:boolean .
154
+
155
+ am:durationMs a owl:DatatypeProperty ;
156
+ rdfs:label "duration (milliseconds)"@en ;
157
+ rdfs:comment "Execution time in milliseconds."@en ;
158
+ rdfs:domain am:Episode ;
159
+ rdfs:range xsd:integer .
160
+
161
+ am:timestamp a owl:DatatypeProperty ;
162
+ rdfs:label "timestamp"@en ;
163
+ rdfs:comment "ISO 8601 timestamp when the episode occurred."@en ;
164
+ rdfs:domain am:Episode ;
165
+ rdfs:range xsd:dateTime .
166
+
167
+ am:accessCount a owl:DatatypeProperty ;
168
+ rdfs:label "access count"@en ;
169
+ rdfs:comment """
170
+ Number of times this episode has been retrieved.
171
+ Used in importance scoring: importance = log10(accessCount + 1) / log10(max + 1)
172
+ """@en ;
173
+ rdfs:domain am:Episode ;
174
+ rdfs:range xsd:integer .
175
+
176
+ am:result a owl:DatatypeProperty ;
177
+ rdfs:label "result"@en ;
178
+ rdfs:comment "The output/answer produced by this episode (JSON string)."@en ;
179
+ rdfs:domain am:Episode ;
180
+ rdfs:range xsd:string .
181
+
182
+ # -----------------------------------------------------------------------------
183
+ # Execution Record Properties
184
+ # -----------------------------------------------------------------------------
185
+
186
+ am:tool a owl:DatatypeProperty ;
187
+ rdfs:label "tool"@en ;
188
+ rdfs:comment """
189
+ The tool identifier that was executed.
190
+ Examples: 'kg.sparql.query', 'kg.motif.find', 'kg.pagerank'
191
+ """@en ;
192
+ rdfs:domain am:ExecutionRecord ;
193
+ rdfs:range xsd:string .
194
+
195
+ am:input a owl:DatatypeProperty ;
196
+ rdfs:label "input"@en ;
197
+ rdfs:comment "The input parameters passed to the tool (JSON string)."@en ;
198
+ rdfs:domain am:ExecutionRecord ;
199
+ rdfs:range xsd:string .
200
+
201
+ am:output a owl:DatatypeProperty ;
202
+ rdfs:label "output"@en ;
203
+ rdfs:comment "The output produced by the tool (JSON string)."@en ;
204
+ rdfs:domain am:ExecutionRecord ;
205
+ rdfs:range xsd:string .
206
+
207
+ # -----------------------------------------------------------------------------
208
+ # Agent Identity Properties
209
+ # -----------------------------------------------------------------------------
210
+
211
+ am:agentId a owl:DatatypeProperty ;
212
+ rdfs:label "agent ID"@en ;
213
+ rdfs:comment "UUID identifying the agent instance."@en ;
214
+ rdfs:domain am:Agent ;
215
+ rdfs:range xsd:string .
216
+
217
+ am:agentName a owl:DatatypeProperty ;
218
+ rdfs:label "agent name"@en ;
219
+ rdfs:comment "Human-readable name for the agent."@en ;
220
+ rdfs:domain am:Agent ;
221
+ rdfs:range xsd:string .
222
+
223
+ am:model a owl:DatatypeProperty ;
224
+ rdfs:label "model"@en ;
225
+ rdfs:comment "LLM model identifier (e.g., 'claude-sonnet-4', 'gpt-4o')."@en ;
226
+ rdfs:domain am:Agent ;
227
+ rdfs:range xsd:string .
228
+
229
+ # -----------------------------------------------------------------------------
230
+ # Session Properties
231
+ # -----------------------------------------------------------------------------
232
+
233
+ am:sessionId a owl:DatatypeProperty ;
234
+ rdfs:label "session ID"@en ;
235
+ rdfs:comment "UUID identifying the session."@en ;
236
+ rdfs:domain am:Session ;
237
+ rdfs:range xsd:string .
238
+
239
+ am:startTime a owl:DatatypeProperty ;
240
+ rdfs:label "start time"@en ;
241
+ rdfs:comment "When the session began."@en ;
242
+ rdfs:domain am:Session ;
243
+ rdfs:range xsd:dateTime .
244
+
245
+ am:endTime a owl:DatatypeProperty ;
246
+ rdfs:label "end time"@en ;
247
+ rdfs:comment "When the session ended (null if active)."@en ;
248
+ rdfs:domain am:Session ;
249
+ rdfs:range xsd:dateTime .
250
+
251
+ # -----------------------------------------------------------------------------
252
+ # Embedding Properties
253
+ # -----------------------------------------------------------------------------
254
+
255
+ am:embedding a owl:DatatypeProperty ;
256
+ rdfs:label "embedding"@en ;
257
+ rdfs:comment """
258
+ 384-dimensional vector embedding for semantic similarity.
259
+ Stored as JSON array string for RDF compatibility.
260
+
261
+ Used for temporal scoring:
262
+ relevance = cosine_similarity(query_embedding, episode_embedding)
263
+ """@en ;
264
+ rdfs:domain am:Episode ;
265
+ rdfs:range xsd:string .
266
+
267
+ am:embeddingDimension a owl:DatatypeProperty ;
268
+ rdfs:label "embedding dimension"@en ;
269
+ rdfs:comment "Dimensionality of the embedding vector (default: 384)."@en ;
270
+ rdfs:range xsd:integer .
271
+
272
+ # -----------------------------------------------------------------------------
273
+ # Scoring Configuration Properties
274
+ # -----------------------------------------------------------------------------
275
+
276
+ am:recencyWeight a owl:DatatypeProperty ;
277
+ rdfs:label "recency weight"@en ;
278
+ rdfs:comment "Weight for recency in temporal scoring (default: 0.3)."@en ;
279
+ rdfs:range xsd:float .
280
+
281
+ am:relevanceWeight a owl:DatatypeProperty ;
282
+ rdfs:label "relevance weight"@en ;
283
+ rdfs:comment "Weight for semantic relevance in temporal scoring (default: 0.5)."@en ;
284
+ rdfs:range xsd:float .
285
+
286
+ am:importanceWeight a owl:DatatypeProperty ;
287
+ rdfs:label "importance weight"@en ;
288
+ rdfs:comment "Weight for access-based importance in temporal scoring (default: 0.2)."@en ;
289
+ rdfs:range xsd:float .
290
+
291
+ am:decayRate a owl:DatatypeProperty ;
292
+ rdfs:label "decay rate"@en ;
293
+ rdfs:comment """
294
+ Exponential decay rate per hour for recency scoring.
295
+ Default: 0.995 (~12% decay per day)
296
+ Formula: recency = decayRate ^ hoursElapsed
297
+ """@en ;
298
+ rdfs:range xsd:float .
299
+
300
+ # =============================================================================
301
+ # Object Properties (Hyper-Edges)
302
+ # =============================================================================
303
+
304
+ am:linksToEntity a owl:ObjectProperty ;
305
+ rdfs:label "links to entity"@en ;
306
+ rdfs:comment """
307
+ Hyper-edge connecting an episode to a knowledge graph entity.
308
+
309
+ This is the critical link that enables:
310
+ 1. Single SPARQL query to traverse memory AND knowledge
311
+ 2. Agent context tied to specific business entities
312
+ 3. Provenance tracking from decision to data
313
+
314
+ Example:
315
+ <episode:001> am:linksToEntity <http://insurance.org/P001> .
316
+
317
+ Query joining memory and KG:
318
+ SELECT ?episode ?finding ?providerRisk WHERE {
319
+ GRAPH <http://hypermind.ai/memory/> {
320
+ ?episode am:prompt ?finding ;
321
+ am:linksToEntity ?provider .
322
+ }
323
+ ?provider ins:riskScore ?providerRisk .
324
+ }
325
+ """@en ;
326
+ rdfs:domain am:Episode ;
327
+ rdfs:range rdfs:Resource .
328
+
329
+ am:performedBy a owl:ObjectProperty ;
330
+ rdfs:label "performed by"@en ;
331
+ rdfs:comment "The agent that performed this episode."@en ;
332
+ rdfs:domain am:Episode ;
333
+ rdfs:range am:Agent ;
334
+ rdfs:subPropertyOf prov:wasAssociatedWith .
335
+
336
+ am:inSession a owl:ObjectProperty ;
337
+ rdfs:label "in session"@en ;
338
+ rdfs:comment "The session containing this episode."@en ;
339
+ rdfs:domain am:Episode ;
340
+ rdfs:range am:Session .
341
+
342
+ am:hasExecution a owl:ObjectProperty ;
343
+ rdfs:label "has execution"@en ;
344
+ rdfs:comment "Tool execution records within this episode."@en ;
345
+ rdfs:domain am:Episode ;
346
+ rdfs:range am:ExecutionRecord .
347
+
348
+ am:previousEpisode a owl:ObjectProperty ;
349
+ rdfs:label "previous episode"@en ;
350
+ rdfs:comment "Temporal ordering link to the preceding episode."@en ;
351
+ rdfs:domain am:Episode ;
352
+ rdfs:range am:Episode .
353
+
354
+ am:hasProof a owl:ObjectProperty ;
355
+ rdfs:label "has proof"@en ;
356
+ rdfs:comment "Link to the proof DAG for this episode's reasoning."@en ;
357
+ rdfs:domain am:Episode ;
358
+ rdfs:range am:ProofDAG .
359
+
360
+ # =============================================================================
361
+ # Named Graphs
362
+ # =============================================================================
363
+
364
+ # Default memory graph for episode storage
365
+ <http://hypermind.ai/memory/> a owl:NamedIndividual ;
366
+ rdfs:label "HyperMind Memory Graph"@en ;
367
+ rdfs:comment """
368
+ Default named graph for storing agent episodes.
369
+
370
+ All episodes are stored here unless a custom graph is specified.
371
+ This graph exists in the SAME quad store as business knowledge,
372
+ enabling single SPARQL queries to join memory and data.
373
+ """@en .
374
+
375
+ # Long-term memory graph (persistent)
376
+ <http://memory.hypermind.ai/> a owl:NamedIndividual ;
377
+ rdfs:label "Long-Term Memory Graph"@en ;
378
+ rdfs:comment """
379
+ Persistent memory graph for cross-session storage.
380
+
381
+ Unlike episodic memory (which may be pruned), long-term
382
+ memory persists indefinitely for agent learning.
383
+ """@en .
384
+
385
+ # =============================================================================
386
+ # Example Usage
387
+ # =============================================================================
388
+ #
389
+ # Storing an episode:
390
+ #
391
+ # @prefix am: <http://hypermind.ai/memory#> .
392
+ # @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
393
+ # @prefix ins: <http://insurance.org/> .
394
+ #
395
+ # <http://hypermind.ai/episode/550e8400-e29b-41d4-a716-446655440000>
396
+ # a am:Episode ;
397
+ # am:prompt "Find circular payment patterns in Provider P001" ;
398
+ # am:success "true"^^xsd:boolean ;
399
+ # am:durationMs "1234"^^xsd:integer ;
400
+ # am:timestamp "2025-12-15T10:30:00Z"^^xsd:dateTime ;
401
+ # am:accessCount "0"^^xsd:integer ;
402
+ # am:linksToEntity ins:P001 ;
403
+ # am:performedBy <http://hypermind.ai/agent/fraud-detector> .
404
+ #
405
+ # Querying memory with KG join:
406
+ #
407
+ # PREFIX am: <http://hypermind.ai/memory#>
408
+ # PREFIX ins: <http://insurance.org/>
409
+ #
410
+ # SELECT ?episode ?prompt ?riskScore WHERE {
411
+ # GRAPH <http://hypermind.ai/memory/> {
412
+ # ?episode a am:Episode ;
413
+ # am:prompt ?prompt ;
414
+ # am:linksToEntity ?entity .
415
+ # }
416
+ # ?entity ins:riskScore ?riskScore .
417
+ # FILTER(?riskScore > 0.8)
418
+ # }
419
+ # ORDER BY DESC(?riskScore)
420
+ #
421
+ # =============================================================================
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rust-kgdb",
3
- "version": "0.6.9",
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.",
3
+ "version": "0.6.13",
4
+ "description": "Production-grade Neuro-Symbolic AI Framework with Schema-Aware GraphDB, Context Theory, and Memory Hypergraph: +86.4% accuracy over vanilla LLMs. Features Schema-Aware GraphDB (auto schema extraction), BYOO (Bring Your Own Ontology) for enterprise, cross-agent schema caching, LLM Planner for natural language to typed SPARQL, ProofDAG with Curry-Howard witnesses. High-performance (2.78µs lookups, 35x faster than RDFox). W3C SPARQL 1.1 compliant.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "napi": {
@@ -25,6 +25,13 @@
25
25
  "keywords": [
26
26
  "neuro-symbolic-ai",
27
27
  "agentic-framework",
28
+ "schema-aware-graphdb",
29
+ "context-theory",
30
+ "bring-your-own-ontology",
31
+ "schema-caching",
32
+ "llm-planner",
33
+ "proof-dag",
34
+ "curry-howard",
28
35
  "memory-hypergraph",
29
36
  "agent-memory",
30
37
  "temporal-memory",
@@ -73,6 +80,7 @@
73
80
  "secure-agent-sandbox-demo.js",
74
81
  "vanilla-vs-hypermind-benchmark.js",
75
82
  "examples/",
83
+ "ontology/",
76
84
  "README.md",
77
85
  "HYPERMIND_BENCHMARK_REPORT.md",
78
86
  "CHANGELOG.md",