Cortex

An ontology-backed knowledge graph memory store with branch-based ingestion, provenance, inference, and full-text search — exposed to AI agents over MCP.

CI Maven Central

What is Cortex?

Adding one Spring Boot starter auto-configures a complete, ontology-grounded knowledge-graph memory for your application — backed by Apache Jena, gated by human review, and designed to be read and written by AI agents over the Model Context Protocol.

Ontology-grounded

You supply the vocabulary (ontology.ttl), the SHACL shapes (ontology.shapes), and the inference rules (ontology.rules). Every assertion is linted and validated against them before it can enter the graph.

Human-in-the-loop

Incoming assertions are staged on a branch as an RDF patch. Nothing reaches the approved graph until a human reviews and approves it — agents propose, people decide.

Agent-native (MCP)

A Spring AI MCP server exposes Lint, Ingest, Query, Ask, Describe, and Search tools plus the ontology as a resource, so agents ground their reads and writes in your schema.

Provenance built in

Every ingestion is a PROV-O prov:Activity; every approved statement is reified and linked with prov:wasGeneratedBy. You always know where a fact came from and when.

Inference & search

Jena rule-based inference extends the graph incrementally on each approval; a Lucene full-text index over labels, comments, and SKOS annotations matches word forms through English stemming and ranks by relevance and how often each resource is opened.

Durable by design

Approved assertions live in a TDB2 store — in memory, or on disk. Optional scheduled backups to S3 and restore-on-startup let an ephemeral replica come up fully seeded.

Install

Requires JDK 21 and Spring Boot 4.0. Add the starter — it brings everything the graph, the web UI, and the MCP server need.

Gradle (build.gradle.kts)
implementation("ai.chatur:cortex-spring-boot-starter:0.1.3")
Maven (pom.xml)
<dependency>
  <groupId>ai.chatur</groupId>
  <artifactId>cortex-spring-boot-starter</artifactId>
  <version>0.1.3</version>
</dependency>

Full getting-started guide → Tutorial: a vocabulary with SKOS →

Modules

Cortex is split across five Gradle modules; the first four publish independently to Maven Central under the ai.chatur group.

ModulePurpose
cortex-apiThe public contract: the Cortex interface, its nine role interfaces, and the data records. Pure Java — no dependencies.
cortex-coreThe Jena-backed implementation (JenaCortex) and CortexBuilder, which assembles a Cortex without Spring.
cortex-spring-boot-autoconfigureSpring Boot auto-configuration for the Cortex bean, the web UI controllers, and the MCP tools and resources.
cortex-spring-boot-starterThe single dependency consumers add; brings the autoconfigure module plus the Spring MVC and Thymeleaf dependencies the web UI needs.
cortex-spring-boot-starter-exampleA runnable example app with a sample ontology, shapes, and rules. Not published.

Project details

License Apache-2.0 Group ai.chatur JDK 21+ Spring Boot 4.0+ Latest 0.1.3