Skip to content

Graph-Native Infrastructure for Context and Accountable AI Systems

fix(plugins): resolve Qodo-flagged bugs in rewritten skill examples

KaifAhmad11928f801040b
diff --git a/plugins/skills/change/SKILL.md b/plugins/skills/change/SKILL.md
index 5c2cdbec..666e40e5 100644
--- a/plugins/skills/change/SKILL.md
+++ b/plugins/skills/change/SKILL.md
@@ -19,20 +19,24 @@ Track what changed. Usage: `/semantica:change <task> [args]`
## `graph-at <timestamp>` — point-in-time graph state
```python
+import os
from semantica.context import ContextGraph
graph = ContextGraph()
-graph.load_from_file("~/.semantica/kg.json")
+graph.load_from_file(os.path.expanduser("~/.semantica/kg.json")) # load_from_file does not expand ~
snapshot = graph.state_at("2026-06-01") # str | int | float | datetime
```
-Diff two moments by taking two snapshots and comparing node/edge sets:
+Diff two moments by comparing node IDs — `state_at()["nodes"]` is a list of
+dicts (unhashable), so compare the `id` fields, not the dicts themselves:
```python
before = graph.state_at("2026-06-01")
after = graph.state_at("2026-09-01")
-added = set(after["nodes"]) - set(before["nodes"])
+before_ids = {n["id"] for n in before["nodes"]}
+after_ids = {n["id"] for n in after["nodes"]}
+added = after_ids - before_ids
```
For richer temporal work (scrubbing, evolution, temporal patterns) use
@@ -45,9 +49,12 @@ For richer temporal work (scrubbing, evolution, temporal patterns) use
Node-level history is provenance, not change management:
```python
+import os
from semantica.provenance import ProvenanceManager
-pm = ProvenanceManager(storage_path="~/.semantica/prov.db")
+db_path = os.path.expanduser("~/.semantica/prov.db") # storage_path is passed to
+os.makedirs(os.path.dirname(db_path), exist_ok=True) # sqlite3.connect() unexpanded
+pm = ProvenanceManager(storage_path=db_path)
history = pm.revision_history(node_id)
log = pm.audit_log(since="2026-01-01")
```
diff --git a/plugins/skills/ontology/SKILL.md b/plugins/skills/ontology/SKILL.md
index 991aed4d..36a1fa5d 100644
--- a/plugins/skills/ontology/SKILL.md
+++ b/plugins/skills/ontology/SKILL.md
@@ -18,8 +18,11 @@ List SKOS concepts in a vocabulary scheme.
```python
from semantica.ontology import OntologyEngine
+from semantica.triplet_store import TripletStore
-engine = OntologyEngine()
+store = TripletStore(backend="oxigraph") # needs semantica[tripletstore-oxigraph]
+engine = OntologyEngine(store=store) # list_concepts/list_vocabularies need a
+ # configured store — raises ProcessingError without one
concepts = engine.list_concepts(scheme_uri)
vocabs = engine.list_vocabularies()
```
@@ -35,7 +38,7 @@ from semantica.ontology import OntologyValidator
validator = OntologyValidator(check_consistency=True, check_satisfiability=True)
result = validator.validate(ontology) # dict or path to an ontology file
-# result.is_valid, result.errors, result.warnings
+# result.valid, result.errors, result.warnings
```
For SHACL shape validation of instance data use `SHACLGenerator` / `SHACLValidationReport`:
diff --git a/plugins/skills/provenance/SKILL.md b/plugins/skills/provenance/SKILL.md
index c4e89ab2..819ca48a 100644
--- a/plugins/skills/provenance/SKILL.md
+++ b/plugins/skills/provenance/SKILL.md
@@ -12,9 +12,12 @@ Lineage and audit trails. Usage: `/semantica:provenance <task> [args]`
## `lineage <entity_id> [--depth N]`
```python
+import os
from semantica.provenance import ProvenanceManager
-pm = ProvenanceManager(storage_path="~/.semantica/prov.db") # SQLite, or omit for in-memory
+db_path = os.path.expanduser("~/.semantica/prov.db") # storage_path is passed to
+os.makedirs(os.path.dirname(db_path), exist_ok=True) # sqlite3.connect() unexpanded
+pm = ProvenanceManager(storage_path=db_path) # SQLite, or omit for in-memory
chain = pm.lineage(entity_id, depth=3)
full = pm.get_lineage(entity_id) # complete ancestry
down = pm.get_descendants(entity_id) # what this entity influenced
diff --git a/plugins/skills/query/SKILL.md b/plugins/skills/query/SKILL.md
index 7ec2fabc..0c6da6ac 100644
--- a/plugins/skills/query/SKILL.md
+++ b/plugins/skills/query/SKILL.md
@@ -16,10 +16,11 @@ Query the graph. Usage: `/semantica:query <task> [args]`
This is the one that works with no external server.
```python
+import os
from semantica.context import ContextGraph
graph = ContextGraph()
-graph.load_from_file("~/.semantica/kg.json")
+graph.load_from_file(os.path.expanduser("~/.semantica/kg.json")) # load_from_file does not expand ~
results = graph.query("vendor selection", skip=0, limit=20)
```
@@ -49,12 +50,16 @@ result = store.execute_query(sparql)
For query planning, optimisation, and caching over a backend:
```python
-from semantica.triplet_store import QueryEngine
+from semantica.triplet_store import QueryEngine, OxigraphStore
+
+# QueryEngine needs an object exposing execute_sparql() — the raw backend,
+# not the TripletStore wrapper above (which only exposes execute_query()).
+backend = OxigraphStore()
qe = QueryEngine()
plan = qe.plan_query(sparql)
tuned = qe.optimize_query(sparql)
-result = qe.execute_query(sparql, store_backend=store)
+result = qe.execute_query(sparql, store_backend=backend)
stats = qe.get_query_statistics()
```
@@ -69,6 +74,7 @@ SPARQL over HTTP using the core `requests` dependency.
from semantica.graph_store import Neo4jStore # needs semantica[graph-neo4j]
store = Neo4jStore(uri=..., user=..., password=...)
+result = store.execute_query(query, parameters={...})
```
Also available: `FalkorDBStore`, `ApacheAgeStore`, `AmazonNeptuneStore`,