DEV Community

Cover image for What's New in CKS: Semantic Search, Type Safety, and Graph Visualization for LLMs
Deus-corp
Deus-corp

Posted on

What's New in CKS: Semantic Search, Type Safety, and Graph Visualization for LLMs

Give an LLM a fact, and it'll invent a citation. Give it a knowledge backbone, and it'll finally shut up and verify.

Last week, we introduced Canonical Knowledge Structure (CKS) — an open-source platform that gives LLMs a verifiable knowledge backbone. We showed how it catches fake citations and enables time-travel debugging.

This week, we've been busy. We shipped 10 new tools, bringing the total to 18. We added real semantic search with embeddings, ontology validation that catches nonsense like "Earth orbits Pasta," and graph visualization that renders directly in Claude Desktop. Let me show you what's new — with live experiments, as always.

What We Shipped (July 21–27)

Feature What it does
search_semantic Find objects by meaning, not keywords. Uses HuggingFace embeddings.
visualize_graph Export any subgraph as a Mermaid diagram — Claude renders it natively.
explain_diff Natural-language summary of what changed between two versions.
suggest_evolution AI-assisted operation building — reduces trial-and-error.
query_subgraph (compact mode) Extract neighbourhoods in token-efficient format.
merge_branch (resolutions) Partial three-way merge — resolve one conflict, commit the rest.
update_object In-place object edits without cascading relation deletions.
type_hierarchy extension Declare type taxonomies (Planet is-a CelestialBody).
relation_type extension Restrict which relation types can connect which object types.
get_metrics Runtime statistics: invocation counts and execution times.

Experiment 4: Semantic Search That Actually Works

We built a knowledge graph about renewable energy with 3 objects: Solar Power, Wind Power, and Energy Storage. Then we asked the model to search for "battery storage systems for renewable energy" — without specifying any object IDs.

The system encoded the query with the same HuggingFace model used to index the objects, performed a cosine-similarity search, and returned Energy Storage as a match. No keyword matching — pure semantic understanding.

search_semantic(query="battery storage systems for renewable energy")
 matched_seeds: ["energy-storage", "solar-power", "electricity"]
 scores: {"energy-storage": 0.87, "solar-power": 0.72, "electricity": 0.68}
Enter fullscreen mode Exit fullscreen mode

The scores tell you exactly how confident the match is. Energy Storage came first because its description contained "batteries," "storage," and "systems" — exactly the concepts the query was looking for.

Experiment 5: Catching "Earth Orbits Pasta"

This one's my favourite. We built a small astronomy graph with a type hierarchy: Planet, Moon, and Star are all subtypes of CelestialBody. We declared a rule that orbits relations can only connect CelestialBody objects.

Then we tried to add a relation: Earth → orbits → Pasta (where Pasta is type Food).

The system immediately flagged it:

CKS-EXT-RELATION-TYPE: Relation 'rel-earth-pasta' of type 'orbits' has target
'pasta' of type 'Food', which is not one of the allowed target types
['Star', 'Planet'] (or a declared subtype).
Enter fullscreen mode Exit fullscreen mode

The best part? We then called visualize_graph and got this Mermaid diagram rendered directly in the chat:

The violating edge (Earth→Pasta) is right there, next to the valid orbits. You can literally see the error.

Experiment 6: What Changed Between Versions?

We created a simple graph, modified one object's description with update_object, and asked explain_diff to summarise the difference.

Old behaviour: "Added 1 object, Removed 1 object" — misleading, because nothing was actually added or deleted.

New behaviour:

Modified 1 object(s): Natural Selection (Concept)
Re-linked 1 relation(s) with no actual change
Enter fullscreen mode Exit fullscreen mode

The tool correctly recognised that the object was modified in-place, and the relation touching it was just re-linked — not deleted and re-created. This matters when you're tracking changes across dozens of versions and need accurate summaries, not phantom add/remove noise.

60-Second Upgrade

pip install --upgrade cks-mcp
Enter fullscreen mode Exit fullscreen mode

Restart Claude Desktop. All 18 tools are immediately available.

What's Next

We're working on:

  • detect_contradictions — logical inconsistency detection across the graph
  • ingest_document — fetch a URL, extract entities, build a verified knowledge graph
  • Docker distribution and PostgreSQL backend for production deployments
  • Local embeddings via fastembed (no API key needed)

The Bigger Picture, One Week Later

Last week, CKS had 8 tools and a basic anti-hallucination mechanism. Today it has 18 tools, real semantic search, type-safe ontologies, graph visualisation, field-level auto-merge, and 94 tests.

The mission hasn't changed: LLMs generate. CKS verifies. But now it also searches, explains, visualises, and catches nonsense before it enters your knowledge base.

GitHub: github.com/Deus-corp

Documentation: deus-corp.github.io/cks-core

In one week, we turned an AI lie detector into a full knowledge laboratory — with a search engine, a type checker, and a whiteboard. Imagine what a month could do.

Top comments (0)