DICE (Domain-Integrated Context Engineering) is a proposition-first knowledge substrate built on Embabel's agent framework. It turns raw text into confidence-weighted natural language propositions, resolves entity mentions to canonical IDs, and then projects those propositions into whatever representation a task needs — a Neo4j graph, a tuProlog fact base, vector embeddings, or agent working memory. Propositions are the single system of record; everything else derives from them.
| Module | What it owns |
|---|---|
dice |
The entire domain: Proposition model, PropositionStore/PropositionRepository SPIs, extraction pipeline, revision/conflict detection, entity resolution, projectors (graph, Prolog, memory), graph and discovery query/retrieval, incremental analysis, in-memory and file-backed stores, tuProlog integration, REST endpoints, MCP tool surface (DiceMcpTools) |
dice-storage |
Drivine/Neo4j implementation of PropositionRepository, ChunkHistoryStore, and DecayManager; uses Kotlin 2.2 for the Drivine KSP-generated query DSL |
dice-storage-autoconfigure |
Spring Boot auto-configuration that wires the right backend based on embabel.dice.store.type, schedules the decay tick, and provides auto-configuration for the multi-signal duplicate collector (properties prefix embabel.dice.collector) |
dice-report |
Output projectors over propositions: rationale (why a fact is believed, with evidence), structured report, and surprising-link discovery |
dice-ingestion |
Ingestion SPI (artifacts → chunks) with a content-hash dedup ledger so the same source isn't extracted twice |
dice-metamodel |
Schema versioning: MetamodelVersion content-hash stamps over the governed types of a DataDictionary, GovernedTypeSelector, the DeclaredSchemaSource opt-in, and the MetamodelVersionStore contract. Pure JVM, with no dependency on dice |
dice-store-conformance |
Abstract JUnit suites, one per store interface, that a backend's tests extend to check its store against the documented behaviour. JUnit is a compile dependency |
dice-integration-tests |
Test-only: the cross-feature end-to-end canonical-flow harness |
dice-mcp-autoconfigure |
Spring Boot auto-configuration that exports DiceMcpTools over MCP via embabel-agent when embabel.dice.mcp.enabled=true |
build-support |
Not published: the program that writes and checks the public API listings, and its tests |
examples |
Focused examples of the API. A separate build outside the reactor, never published: install the library, then ./mvnw -B -f examples/pom.xml verify |
Full build with tests:
mvn verify
Build without tests (faster):
mvn install -DskipTests
Run tests for a single module:
mvn test -pl dice
mvn verify -pl dice-storage # integration tests need Docker
Examples: examples/ is a separate build that the commands above do not touch. Before delivering a change to public API, install the library and check the examples still compile and pass:
./mvnw -B install -DskipTests
./mvnw -B -f examples/pom.xml verify
The Build workflow builds them right after the library, on every pull request and every push. Fix the example in the same change.
Kotlin version: every module compiles with Kotlin 2.2.21, which embabel-build-parent manages. No module overrides it. dice-storage and dice-storage-autoconfigure need a 2.2 compiler for Drivine's KSP-generated where { } DSL, which uses Kotlin context parameters (-Xcontext-parameters).
tuProlog pin: tuprolog.version=1.0.4. The 1.1.x series needs Kotlin 2.2.21 or later, which the build now uses. Lift the pin in a change of its own, never as a side effect.
Docker / Testcontainers: dice-storage integration tests spin up a Neo4j container via testcontainers:neo4j. Docker must be running. The root pom pins api.version=1.41 as a Surefire JVM system property to satisfy the engine's minimum API version — without it, container-backed tests silently fail with HTTP 400.
Repositories: snapshots and releases resolve from Embabel's Artifactory instance (repo.embabel.com). If your environment has no internet access, you need those repos mirrored locally.
Code generation in dice-storage: Drivine's query DSL is generated by a nested Gradle/KSP project at dice-storage/codegen-gradle. The generate-sources phase runs ./gradlew kspKotlin there automatically. The output lands in codegen-gradle/build/generated/ksp/main/kotlin and is added to the Maven compile source set. Don't edit those generated files.
Each published module keeps its public API as committed text under api/: api/<module>.api for the
stable types, and api/<module>.experimental.api for types marked @ApiStatus.Experimental (only when there
are any). A nested type is listed under its owner.
Right after compile (process-classes), the build compares the compiled classes with those files and fails
on any difference, before any test runs. When it fails on a listing, the public API changed and the listing
must be regenerated:
./mvnw -B -Dapi.listing.mode=update process-classes
Update mode deletes each module's target/classes first, so a class left by an earlier build cannot reach a
listing. It also builds only the published modules, since the others have no listings. Check mode leaves the
directory alone. When a check fails, the message names any class that looks left by an earlier build, and
./mvnw clean removes such a class.
Never edit a .api file by hand. A pull request that changes one changes the public API, so its listing
diff belongs in the review.
The listings come from JetBrains' Kotlin ABI tools (org.jetbrains.kotlin:abi-tools, the library behind the
Kotlin Gradle plugin's ABI validation), run from build-support/src/main/java/com/embabel/dice/apilisting/ApiListing.java.
They read Kotlin metadata, so internal declarations stay out. The abi-tools.version property in the root
pom sets their version, apart from the Kotlin compiler version. The build stops at validate when Kotlin's
major and minor version is ahead of it, so raise it when the Kotlin version moves.
Generated code is left out. A module names its generated source root in api.listing.generated.sources, as
dice-storage does for Drivine's query DSL, whose output ./mvnw clean also deletes. The check stops when a
generated file has the same name and package as a hand-written one, because it cannot tell their classes apart.
A file facade (FooKt) whose top-level functions are all experimental goes to the experimental listing.
A marker on an enum entry, or on a member of a stable type, moves nothing and does not show in the count. Count the types (stable, then experimental):
cat $(ls */api/*.api | grep -v experimental) | grep -c '^public ' # stable
cat */api/*.experimental.api | grep -c '^public ' # experimental
The dice module is organized by responsibility:
| Package | What lives there |
|---|---|
com.embabel.dice.proposition |
Proposition (the core domain type), PropositionStore, PropositionRepository, PropositionQuery, DecayManager, DecaySweeper, capability fragment interfaces (VectorSearchCapable, GraphTraversalCapable, TemporalQueryCapable) |
com.embabel.dice.proposition.extraction |
PropositionExtractor SPI, LlmPropositionExtractor |
com.embabel.dice.proposition.revision |
PropositionReviser SPI, LlmPropositionReviser |
com.embabel.dice.proposition.store |
In-memory and JSON-file implementations of PropositionRepository and DecayManager |
com.embabel.dice.proposition.gate |
Admission gates that route pipeline output before persistence (ExtractionGate, ExtractionGatePipeline, StandardGates, EvidenceFloorGate) |
com.embabel.dice.pipeline |
PropositionPipeline — the two-stage entry point (concurrent extraction → serial entity resolution); pluggable ExtractionExecutionStrategy (serial / parallel / batched) |
com.embabel.dice.spi |
Policy extension points consumers plug into: TrustScorer, AuthorityResolver/AuthorityTier, AuthorityWeightedTrustScorer, ConflictDetector, ConflictType, StatusTransitionPolicy, the mark-and-sweep SweepPolicy/StatusTransitionSweepPolicy/MergingSweepPolicy (with its SweepAction/PropositionMark/MarkReason vocabulary), collector SPIs (CollectorTraceStore — trace persistence SPI), and their shipped defaults |
com.embabel.dice.common |
Shared types: SourceAnalysisContext, EntityResolver, Relations, ContentHasher, KnowledgeType, events, validation rules, mention filters, resolver implementations |
com.embabel.dice.entity |
Entity-only pipeline (EntityPipeline, EntityIncrementalAnalyzer, EntityResolutionService, EntityResolutionTools) |
com.embabel.dice.incremental |
AbstractIncrementalAnalyzer, ChunkHistoryStore, ConversationSource, windowed processing |
com.embabel.dice.projection |
Projectors (GraphProjector, PrologProjector, MemoryProjector); memory maintenance and the dream loop (MemoryMaintenanceOrchestrator, DreamLoopOrchestrator); the mark-and-sweep collector (CollectorRunner, CollectorStrategy; the SweepPolicy lives in spi) and its audit trail (CollectorRecordStore); lineage tracking (ProjectionRecordStore, Reconciler) |
com.embabel.dice.projection.memory |
Collector state and strategy interface (RunAwareCollectorStrategy) |
com.embabel.dice.projection.memory.collector |
Multi-signal duplicate matcher (MultiSignalCollectorStrategy), collector run state (CollectorRunContext), signal scorers and pair sources, survivor selection policy (CollectorSurvivorPolicy), and trace storage |
com.embabel.dice.operations |
Higher-level proposition operations (PropositionAbstractor, PropositionContraster) and, under operations.consolidation, the passes that compose the dream loop (SessionConsolidationPass, AbstractionPass, ContradictionResolutionPass, DecaySweepPass) |
com.embabel.dice.text2graph |
Text-to-graph builder pipeline (KnowledgeGraphBuilder, SourceAnalyzer, entity merge/relationship resolution policies) |
com.embabel.dice.provenance |
ProvenanceEntry, SourceLocator — rich evidence links from propositions back to source material |
com.embabel.dice.evidence |
Evidence handed to a caller that assembles model context (Evidence and its five kinds, EvidenceItem, Citation, Retrieval, Searched, DerivationRule, EvidenceConverter, EvidenceProvider) |
com.embabel.dice.query.oracle |
Oracle, LlmOracle, PrologTools — natural language question answering over propositions |
com.embabel.dice.web.rest |
Optional REST endpoints for the pipeline and memory; activated by spring-webmvc on the classpath |
com.embabel.dice.mcp |
DiceMcpTools — simplified MCP tool surface (dice_recall, dice_list, dice_store, dice_get); contextId on every call is a scope, not a credential |
Composable store SPI. PropositionStore is the base port: just CRUD and a composable query. PropositionRepository extends it with optional capability interfaces (VectorSearchCapable, GraphTraversalCapable, TemporalQueryCapable, GraphQueryCapable). A backend only has to implement what it genuinely supports. GraphQueryCapable provides native neighbourhood, path, and lineage queries over the entity-relationship graph. Its honorsAuthorityFilter opt-in allows native authority filtering for unscoped traversals. When a traversal supplies a context and an authority floor, GraphQuery applies both filters in the portable walk. The default implementations on those interfaces express each operation over the primitives so every backend gets safe fallback behavior for free.
ContextId is the primary scope. Every proposition belongs to a ContextId. Always start queries with PropositionQuery.forContextId(...) or PropositionQuery.againstContext(...) — there is no create() factory by design, to prevent accidentally loading all propositions.
Effective confidence, not raw confidence. Propositions carry a decay field (0–1). Use effectiveConfidence() for rankings and queries; raw confidence is what the LLM assigned at extraction time. The contentRevised timestamp is the decay anchor; administrative changes (status, pin, grounding) touch only metadataRevised and never reset the clock.
Event emission. EventEmittingPropositionRepository and EventEmittingProjector are decorators that publish Spring application events on saves and projections. Wire them in where you need reactive behaviour.
embabel-agent dependency scope. embabel-agent-api and embabel-agent-rag-core are declared provided in dice. The consuming application brings the actual embabel-agent version at runtime; DICE only controls the minimum it compiles against.
Java interop. Kotlin infix factory methods on PropositionQuery have Java-friendly withXxx / againstContext equivalents. ContextId is a value class; Java code uses getContextIdValue(). The Proposition.create(...) companion method provides a Java-friendly factory.
- Adding or changing extraction logic →
com.embabel.dice.proposition.extraction.LlmPropositionExtractorand the Mustache prompt templates indice/src/main/resources/dice/. - Wiring a new Spring Boot app →
dice-storage-autoconfigure, specificallyDiceStorageAutoConfiguration(backend selection) andDiceStoreProperties(property keys). Setembabel.dice.store.type=graphfor Neo4j. - Exposing DICE over MCP →
DiceMcpToolsincom.embabel.dice.mcpfor the tool surface;dice-mcp-autoconfigure+embabel-agent-starter-mcpserverfor zero-code export (embabel.dice.mcp.enabled=true). - Understanding the proposition data model →
Proposition.ktincom.embabel.dice.proposition. Every field is documented inline. - Adding a new entity resolver strategy → implement
CandidateSearcherincom.embabel.dice.common.resolver.searcher, then compose it into anEscalatingEntityResolver. - Writing integration tests against Neo4j → look at
DrivinePropositionStoreIntegrationTestindice-storage/src/test; it shows the@SpringBootTest+ Testcontainers pattern in use. - Tuning what gets into the store → admission gates in
com.embabel.dice.proposition.gate(ExtractionGatePipeline,StandardGates); they run on pipeline output before the caller persists. - Running maintenance / consolidation →
DefaultDreamLoopOrchestrator(threshold-gated consolidation passes) orDefaultMemoryMaintenanceOrchestrator(the legacy four-step pipeline), both incom.embabel.dice.projection.memory. - Reclaiming stale or duplicate propositions →
DefaultCollectorRunnerand itsCollectorStrategyincom.embabel.dice.projection.memory(theSweepPolicythat decides each fate lives incom.embabel.dice.spi); runs are auditable viaCollectorRecordStore. - Understanding why the system behaves as it does →
docs/design/holds the design-decision notes — start withdocs/design/architecture.mdfor a system-level map and then follow to: the extraction pipeline, the proposition lifecycle (trust, authority, supersession, decay, pinning), knowledge hygiene (gates, reclamation, consolidation), graph projection, retrieval and discovery, durable storage (backends, dedup, the decay tick), and the event model.