Event Emitting Proposition Repository
Decorator that emits lifecycle events at the persistence boundary.
Wraps any PropositionRepository via by delegate. All read methods forward untouched. Only the write path is instrumented:
save persists via the delegate first, then emits exactly one event carrying the saved instance. The event type depends on whether a status transition occurred:
PropositionStatusChanged when a prior entry exists with a different status (e.g. ACTIVE → CONTRADICTED), so consumers can distinguish transitions from plain inserts.
PropositionPersisted for fresh inserts and non-status updates.
saveAll is explicitly overridden to call this decorator's own save per proposition, so one event fires per proposition. The default interface
saveAllwould bypass the decorator's save and emit nothing.
To keep fresh ACTIVE inserts read-free, the prior-status lookup is skipped when the incoming status is already ACTIVE. The tradeoff isn't only performance: it loses a real signal. A revival STALE → ACTIVE (reinforcement — arguably the most interesting lifecycle transition for a downstream index) is reported as a plain PropositionPersisted, not a PropositionStatusChanged. A consumer that needs the reinforcement signal should observe it at its origin — the reviser, which knows it is reinforcing — rather than infer it here on the hot path.
Throw isolation is the listener's responsibility — wrap the listener in SafeDiceEventListener if you need graceful degradation.
This class carries capabilities only when its delegate does. The wrapping factory method picks the right shape for whatever delegate you hand it, so a caller's as? SourceRevisionQueryCapable or as? ProvenanceSubtractionCapable probe on the wrapper answers the same way it would on the delegate.
Example usage:
val repo = EventEmittingPropositionRepository.wrapping(
delegate = inMemoryRepository,
listener = SafeDiceEventListener(myListener),
)Inheritors
Properties
Which backend provides this repository. Implementations override to advertise their kind; used to select/flip between in-memory and persistent backends.
Whether this particular instance can actually run vector search. Implementing the interface is a type-level promise; this is the runtime truth. A store that can be wired without an embedder (so it satisfies the type but has nothing to embed with) should override this to report whether it was given one. Lets a caller — e.g. PropositionStoreTemplate.supportsVector — distinguish "configured for vectors" from "vector search will quietly return empty".
Functions
Append provenance to a proposition (deduplicated); never removes existing entries.
Delete all propositions in the given context.
Delete all propositions whose context id starts with the given prefix.
Remove all provenance from a proposition.
Get the total count of propositions.
Count the propositions matching query. The default materialises query's results and counts them; a backend that can count server-side (e.g. the graph store) overrides to avoid loading the rows just to size them.
Find propositions that were abstracted from the given proposition. Searches for propositions that cite the given ID in their Proposition.sourceIds.
Get all propositions, optionally guaranteeing loaded provenance. With withProvenance = true every result has its Proposition.provenanceEntries populated (at extra read cost); the default delegates to the lean findAll — fine for backends that always carry provenance (e.g. in-memory).
Get all propositions.
Find all propositions ordered by effective confidence (highest first). Applies time-based decay to confidence scores.
Find propositions in the given context.
Java-friendly variant of findByContextId that accepts a plain string.
Find propositions created within a time range.
Find propositions from a time range, ordered by effective confidence as of a point in time. Useful for temporal analysis: "What was most confidently true during Q1?"
Find propositions with effective confidence above a threshold.
Find all propositions that mention a specific entity.
Find all propositions grounded by a specific chunk.
Find a proposition by its ID.
Find propositions at or above the specified abstraction level. Level 0 = raw observations, 1+ = abstractions.
Find propositions last touched within a time range. "Touched" means any update — content or administrative — so this anchors on Proposition.lastTouched (the later of contentRevised/metadataRevised), not the decay anchor alone.
Find all propositions with the given status.
Find clusters of similar propositions.
All pinned propositions in contextId.
Find propositions similar to the given text using vector similarity.
Find propositions similar to the given text with similarity scores.
Vector similarity search with an additional PropositionQuery filter applied to results.
Find the source propositions that a given proposition was abstracted from. Resolves the proposition's Proposition.sourceIds to actual propositions.
Find propositions in base's scope whose text contains at least one of tokens (case-insensitive), ranked by how many distinct tokens each contains (descending), ties broken by base's ordering. At most limit results; empty tokens or non-positive limit returns nothing.
Pin a proposition so it resists reclamation: pinned propositions are skipped by the decay collector and the sweep policy, are decay-exempt in the default status policy, and are not auto-retired by contradiction resolution.
The provenance entries of a proposition, or an empty list if it has none or does not exist.
Resolves the diamond: both PropositionStore and VectorSearchCapable declare query. This explicitly routes to the base store's implementation; concrete stores can still override for backend-level filtering.
Query propositions, optionally guaranteeing loaded provenance. With withProvenance = true every result has its Proposition.provenanceEntries populated (at extra read cost); the default delegates to the lean query. See the provenance read contract on PropositionStore.findAll.
Re-embed every stored proposition with the currently-configured embedding service.
Persists via the delegate, then emits one lifecycle event carrying the saved instance.
Authoritatively set a proposition's provenance to exactly entries, removing any not listed.
Refresh Proposition.lastAccessed to now for ids — the read-side reinforcement that lets a DECAYING proposition's decay anchor (see Proposition.effectiveConfidenceAt) track actual use rather than only content edits. Best-effort and silent about unknown ids (a stale eager id that has since been deleted is not an error).
Clear a proposition's pin, returning it to normal reclamation.