Skip to content

Aggregate Roots

Target Architecture — Final-State Design

This page is the final-state domain model of the Knowledge Platform. It defines 32 aggregate roots grouped by their owning bounded context. Every aggregate carries the cross-cutting metadata fields (tenantId, projectId, moduleId, traceId, correlationId, agentId, skillId, artifactId, environment, version, createdAt, updatedAt, status) in addition to the fields listed below.

Aggregates follow the naming conventions: singular PascalCase roots, {Root}Repository repositories, persisted via ConnectSoft.Extensions.PersistenceModel.NHibernate for relational stores and dedicated adapters for vector/blob/git stores.


Knowledge Graph

KnowledgeNode

  • Purpose — a typed vertex in the knowledge graph representing any factory entity (tenant, project, blueprint, module, artifact, contract, event, agent, skill, commit, deployment, runtime signal, etc.).
  • Key fieldsnodeId, nodeType, ref (external id), title, properties, tenantId.
  • EntitiesNodeProperty (typed key/value).
  • Value objectsNodeType, NodeRef, GraphScope.
  • Invariants(tenantId, nodeType, ref) is unique; nodeType is from the closed ontology; nodes are never cross-tenant.
  • Domain eventsKnowledgeNodeUpserted.
  • RepositoryKnowledgeNodeRepository.
  • Store — PostgreSQL / Azure SQL.

KnowledgeEdge

  • Purpose — a typed, directed relationship between two KnowledgeNodes (e.g. DERIVED_FROM, DEPENDS_ON, EMITS, PRODUCED_BY).
  • Key fieldsedgeId, from, to, edgeType, weight, properties.
  • Entities — none (edge is atomic).
  • Value objectsEdgeType, EdgeDirection.
  • Invariants — both endpoints exist and share tenantId; (from, to, edgeType) unique; no dangling edges.
  • Domain eventsKnowledgeEdgeUpserted.
  • RepositoryKnowledgeEdgeRepository.
  • Store — PostgreSQL / Azure SQL.

GraphProjection

  • Purpose — a materialised neighbourhood/subgraph computed for a query or context build, cached for reuse.
  • Key fieldsgraphProjectionId, scope, rootRef, nodeIds, edgeIds, computedAt, ttlSeconds.
  • EntitiesProjectionNodeRef, ProjectionEdgeRef.
  • Value objectsTraversalSpec (edge types, direction, depth).
  • Invariants — references only existing nodes/edges; expires after ttlSeconds.
  • Domain eventsGraphProjectionUpdated.
  • RepositoryGraphProjectionRepository.
  • Store — PostgreSQL / Azure SQL (+ Redis cache).

Vector & Semantic Memory

VectorDocument

  • Purpose — the indexed embedding representation of a memory record (artifact, doc, code symbol) in a Qdrant collection.
  • Key fieldsvectorDocumentId, memoryRecordId, collection, kind, modelVersion, chunkCount, contentHash.
  • EntitiesVectorChunk (see below).
  • Value objectsCollectionName, EmbeddingModelVersion, DistanceMetric.
  • Invariants — one live document per (memoryRecordId, modelVersion); contentHash ties vectors to source content.
  • Domain eventsVectorDocumentUpserted, VectorDocumentDeleted.
  • RepositoryVectorDocumentRepository (Qdrant adapter).
  • Store — Qdrant (Azure AI Search alternative).

VectorChunk

  • Purpose — a single embedded chunk of content with its vector and positional metadata.
  • Key fieldsvectorChunkId, vectorDocumentId, ordinal, text, vector, tokenCount, span.
  • Entities — none.
  • Value objectsChunkSpan (start/end), Embedding (float[]).
  • Invariantsordinal unique within document; vector dimensionality matches collection.
  • Domain events — covered by VectorDocumentUpserted.
  • RepositoryVectorChunkRepository (Qdrant adapter).
  • Store — Qdrant.

EmbeddingJob

  • Purpose — the unit of work that embeds chunks and tracks lifecycle/retry.
  • Key fieldsembeddingJobId, memoryRecordId, chunkRefs, modelVersion, attempt, status.
  • EntitiesChunkEmbeddingResult.
  • Value objectsRetryPolicy, JobStatus.
  • Invariants — terminal once Completed/Failed; attempts bounded by RetryPolicy.
  • Domain eventsEmbeddingCompleted, EmbeddingFailed, EmbeddingRefreshed.
  • RepositoryEmbeddingJobRepository.
  • Store — PostgreSQL / Azure SQL (+ Qdrant for output).

Artifact Memory

ArtifactMemory

  • Purpose — the durable memory of a factory artifact, linking metadata to its stored body and versions.
  • Key fieldsartifactMemoryId, artifactId, artifactType, currentVersion, classification, storageRef.
  • EntitiesArtifactVersion, ArtifactSnapshot.
  • Value objectsArtifactReference, ContentHash, Classification.
  • InvariantscurrentVersion points to an existing ArtifactVersion; classification set before serving.
  • Domain eventsArtifactIngested.
  • RepositoryArtifactMemoryRepository.
  • Store — Azure Blob (body) + PostgreSQL / Azure SQL (metadata).

ArtifactVersion

  • Purpose — an immutable version of an artifact body.
  • Key fieldsartifactVersionId, artifactId, version (semver), contentHash, storageRef, supersedes.
  • Entities — none.
  • Value objectsSemVer, ContentHash.
  • Invariants — immutable once published; version unique per artifact; supersedes chains to prior.
  • Domain eventsArtifactVersionCreated.
  • RepositoryArtifactVersionRepository.
  • Store — Azure Blob + SQL.

ArtifactSnapshot

  • Purpose — a point-in-time capture of an artifact's state tied to a trace (for replay/diff).
  • Key fieldsartifactSnapshotId, artifactId, version, atTraceId, capturedAt.
  • Entities — none.
  • Value objectsSnapshotReason.
  • Invariants — references an existing ArtifactVersion; immutable.
  • Domain eventsArtifactSnapshotCaptured.
  • RepositoryArtifactSnapshotRepository.
  • Store — Azure Blob + SQL.

Code Knowledge

CodeRepository

  • Purpose — a registered source repository indexed for code knowledge.
  • Key fieldscodeRepositoryId, ref (Azure DevOps Git url), branch, lastIndexedCommit, language.
  • EntitiesIndexedFile.
  • Value objectsGitRef, CommitSha.
  • Invariants — unique per (tenantId, ref, branch); index advances monotonically by commit.
  • Domain eventsRepositoryIndexed.
  • RepositoryCodeRepositoryRepository.
  • Store — PostgreSQL / Azure SQL.

CodeSymbol

  • Purpose — an extracted code symbol (type, method, interface, contract) for code-aware retrieval.
  • Key fieldscodeSymbolId, codeRepositoryId, kind, fqName, filePath, signature, span.
  • EntitiesSymbolReference.
  • Value objectsSymbolKind, SourceSpan, FullyQualifiedName.
  • InvariantsfqName unique within repository+commit; span within file.
  • Domain eventsCodeSymbolExtracted.
  • RepositoryCodeSymbolRepository.
  • Store — PostgreSQL / Azure SQL (+ Qdrant for embeddings).

CodeIndexJob

  • Purpose — tracks a repository indexing run across symbol, dependency, and embedding stages.
  • Key fieldscodeIndexJobId, codeRepositoryId, commit, stages, progress, status.
  • EntitiesIndexStageResult.
  • Value objectsIndexStage, JobStatus.
  • Invariants — resumable by stage; terminal once all stages complete or fail.
  • Domain eventsCodeDependencyGraphBuilt, RepositoryIndexed.
  • RepositoryCodeIndexJobRepository.
  • Store — PostgreSQL / Azure SQL.

Documentation Knowledge

Documentation Knowledge does not own a dedicated aggregate; it operates on shared MemoryRecord and VectorDocument aggregates, producing heading-aware chunks via the MarkdownChunkingWorker. Documentation provenance (source site, section path) is stored as MemoryRecord properties and projected as KnowledgeNodes of type Documentation.


Prompt & Decision Memory

PromptTemplate

  • Purpose — a reusable, version-controlled prompt bound to a skill.
  • Key fieldspromptTemplateId, name, linkedSkillId, currentVersion, gitRef.
  • EntitiesPromptVersion.
  • Value objectsTemplateName, GitRef.
  • InvariantscurrentVersion exists; templates are source-controlled in Git.
  • Domain eventsPromptTemplateRegistered.
  • RepositoryPromptTemplateRepository.
  • Store — Azure DevOps Git + SQL.

PromptVersion

  • Purpose — an immutable version of a prompt body.
  • Key fieldspromptVersionId, promptTemplateId, version, body, variables, commit.
  • Entities — none.
  • Value objectsSemVer, PromptVariable.
  • Invariants — immutable once published; declared variables resolvable at run time.
  • Domain eventsPromptVersionPublished.
  • RepositoryPromptVersionRepository.
  • Store — Azure DevOps Git + SQL.

PromptRun

  • Purpose — a recorded execution of a prompt version (inputs, model, outcome) for learning.
  • Key fieldspromptRunId, promptVersionId, taskId, modelInvocationId, outcome, tokensUsed.
  • EntitiesRunInput, RunOutput.
  • Value objectsRunOutcome, ModelRef.
  • Invariants — links to an existing PromptVersion; immutable after record.
  • Domain eventsPromptRunRecorded.
  • RepositoryPromptRunRepository.
  • Store — PostgreSQL / Azure SQL.

DecisionRecord

  • Purpose — an architectural decision record (ADR) capturing context, choice, and consequences.
  • Key fieldsdecisionRecordId, title, context, decision, consequences, status.
  • EntitiesDecisionAlternative.
  • Value objectsDecisionStatus (Proposed/Accepted/Superseded/Rejected).
  • Invariants — exactly one chosen alternative when Accepted; supersedes chain is acyclic.
  • Domain eventsDecisionRecorded.
  • RepositoryDecisionRecordRepository.
  • Store — Azure DevOps Git + SQL.

DecisionAlternative

  • Purpose — a considered option for a decision, with pros/cons and a chosen flag.
  • Key fieldsdecisionAlternativeId, decisionRecordId, title, pros, cons, chosen.
  • Entities — none.
  • Value objectsTradeOff.
  • Invariants — belongs to one DecisionRecord; at most one chosen=true per record.
  • Domain eventsDecisionAlternativeAdded.
  • RepositoryDecisionAlternativeRepository.
  • Store — Azure DevOps Git + SQL.

Runtime Memory & Feedback

RuntimeSignal

  • Purpose — a runtime observation (latency, error, saturation, cost) ingested from Observability and linked to producing artifacts.
  • Key fieldsruntimeSignalId, kind, metric, value, unit, environment, linkedArtifactId.
  • EntitiesSignalDimension.
  • Value objectsSignalKind, MetricRef, Environment.
  • Invariants — immutable; environment valid; linked artifact exists when provided.
  • Domain eventsRuntimeSignalRecorded.
  • RepositoryRuntimeSignalRepository.
  • Store — App Insights / OTEL (telemetry) + SQL (index).

IncidentMemory

  • Purpose — a captured production incident with timeline, root cause, and resolution for future grounding.
  • Key fieldsincidentMemoryId, severity, summary, rootCause, resolution, linkedSignals.
  • EntitiesIncidentTimelineEntry.
  • Value objectsSeverity, IncidentStatus.
  • Invariants — at least one linked RuntimeSignal; timeline ordered.
  • Domain eventsIncidentMemoryCaptured.
  • RepositoryIncidentMemoryRepository.
  • Store — PostgreSQL / Azure SQL.

FeedbackItem

  • Purpose — explicit human or automated feedback about an artifact, agent output, or decision.
  • Key fieldsfeedbackItemId, source, targetRef, sentiment, comment, rating.
  • Entities — none.
  • Value objectsFeedbackSource, Sentiment, Rating.
  • InvariantstargetRef resolvable; rating within range.
  • Domain eventsFeedbackItemRecorded.
  • RepositoryFeedbackItemRepository.
  • Store — PostgreSQL / Azure SQL.

Pattern Catalog

KnowledgePattern

  • Purpose — a reusable, recurring solution discovered across projects and promoted for reuse.
  • Key fieldsknowledgePatternId, name, category, description, occurrences, confidence, currentVersion.
  • EntitiesPatternVersion, PatternOccurrence.
  • Value objectsPatternCategory, Confidence.
  • Invariants — promoted only above a confidence/occurrence threshold; currentVersion exists.
  • Domain eventsKnowledgePatternDiscovered.
  • RepositoryKnowledgePatternRepository.
  • Store — Azure DevOps Git + SQL.

PatternVersion

  • Purpose — an immutable version of a pattern's canonical form and exemplar.
  • Key fieldspatternVersionId, knowledgePatternId, version, exemplarRef, applicability.
  • Entities — none.
  • Value objectsSemVer, Applicability.
  • Invariants — immutable once published; references a real exemplar artifact.
  • Domain eventsPatternVersionPublished.
  • RepositoryPatternVersionRepository.
  • Store — Azure DevOps Git + SQL.

Knowledge Governance

MemoryAccessPolicy

  • Purpose — a declarative rule set governing who may access which memory under which conditions.
  • Key fieldsmemoryAccessPolicyId, name, rules, appliesTo, effectDefault.
  • EntitiesPolicyRule.
  • Value objectsPolicyEffect (Allow/Deny/RedactRequired), PolicyScope.
  • Invariants — deterministic evaluation; explicit deny wins; tenant-scoped.
  • Domain eventsMemoryAccessPolicyUpdated.
  • RepositoryMemoryAccessPolicyRepository.
  • Store — PostgreSQL / Azure SQL.

MemoryAccessDecision

  • Purpose — the evaluated outcome of applying policy to a request over a set of resources.
  • Key fieldspolicyDecisionId, subject, resources, effects, purpose, evaluatedAt.
  • EntitiesResourceEffect.
  • Value objectsSubject, PolicyEffect.
  • Invariants — every requested resource has an effect; immutable record.
  • Domain eventsMemoryAccessEvaluated.
  • RepositoryMemoryAccessDecisionRepository.
  • Store — PostgreSQL / Azure SQL.

MemoryAccessAudit

  • Purpose — the immutable audit trail of access decisions for compliance.
  • Key fieldsmemoryAccessAuditId, policyDecisionId, subject, resources, traceId, recordedAt.
  • Entities — none.
  • Value objectsAuditOutcome.
  • Invariants — append-only; never deleted before retention; linked to a decision.
  • Domain eventsMemoryAccessAudited.
  • RepositoryMemoryAccessAuditRepository.
  • Store — PostgreSQL / Azure SQL.

MemoryClassification

  • Purpose — the assigned sensitivity and labels of a memory record.
  • Key fieldsmemoryClassificationId, memoryRecordId, classification, labels, confidence, classifierVersion.
  • Entities — none.
  • Value objectsClassification (Public/Internal/Confidential/Secret), Label.
  • Invariants — one live classification per record; Secret content never stored as artifact body.
  • Domain eventsMemoryClassified.
  • RepositoryMemoryClassificationRepository.
  • Store — PostgreSQL / Azure SQL.

KnowledgeQualityAssessment

  • Purpose — the scored evaluation of a memory record against quality rules.
  • Key fieldsassessmentId, memoryRecordId, score, violations, ruleSetVersion.
  • EntitiesRuleViolation.
  • Value objectsQualityScore, Severity.
  • Invariants — score within [0,1]; references existing QualityRules.
  • Domain eventsKnowledgeQualityAssessed.
  • RepositoryKnowledgeQualityAssessmentRepository.
  • Store — PostgreSQL / Azure SQL.

QualityRule

  • Purpose — a configurable rule defining a knowledge-quality expectation (completeness, freshness, consistency, lineage).
  • Key fieldsqualityRuleId, name, dimension, expression, severity, enabled.
  • Entities — none.
  • Value objectsQualityDimension, RuleExpression.
  • Invariants — expression compiles; severity valid; versioned as a rule set.
  • Domain eventsQualityRuleUpdated.
  • RepositoryQualityRuleRepository.
  • Store — PostgreSQL / Azure SQL.

Context Building

ContextBuildRequest

  • Purpose — the captured request to assemble a Context Package for an agent task.
  • Key fieldscontextBuildRequestId, taskId, agentId, skillId, intent, scope, retrieval.
  • EntitiesRetrievalSpec.
  • Value objectsTokenBudget, Scope, Intent.
  • InvariantstokenBudget > 0; scope tenant-consistent; one package per successful request.
  • Domain eventsContextBuildRequested.
  • RepositoryContextBuildRequestRepository.
  • Store — PostgreSQL / Azure SQL.

ContextPackage

  • Purpose — the assembled, governed, budgeted bundle of knowledge delivered to an agent (see schema).
  • Key fieldscontextPackageId, contextBuildRequestId, sources, tokenBudget, tokensUsed, ttlSeconds, policyDecisionId, graphProjectionId.
  • EntitiesContextSource.
  • Value objectsTokenBudget, Ttl.
  • InvariantstokensUsed <= tokenBudget; every source access-checked; linked to a MemoryAccessDecision.
  • Domain eventsContextPackageBuilt.
  • RepositoryContextPackageRepository.
  • Store — Redis (hot) + PostgreSQL / Azure SQL (durable record).

ContextSource

  • Purpose — a single ranked, access-checked knowledge item included in a Context Package.
  • Key fieldscontextSourceId, kind, ref, title, score, classification, tokens, origin.
  • Entities — none.
  • Value objectsSourceKind, RetrievalOrigin (graph/semantic/metadata/pinned), RelevanceScore.
  • Invariants — classification allows inclusion (or redacted form); tokens counted toward budget.
  • Domain events — covered by ContextPackageBuilt.
  • RepositoryContextSourceRepository.
  • Store — Redis + SQL.

Ingestion

MemoryRecord

  • Purpose — the canonical unit of memory: the normalised, deduplicated record created for every artifact, doc, prompt, decision, code symbol, or signal that enters the platform. It is the anchor every other context references.
  • Key fieldsmemoryRecordId, kind, sourceRef, artifactId, contentHash, classification, qualityScore, lineage.
  • EntitiesLineageLink, IngestionStageResult.
  • Value objectsMemoryKind, ContentHash, Lineage.
  • InvariantscontentHash unique per tenant (dedup); classification assigned before any read serves it; lineage links resolvable.
  • Domain eventsMemoryRecordCreated, ArtifactIngested, MemoryMarkedStale.
  • RepositoryMemoryRecordRepository.
  • Store — PostgreSQL / Azure SQL (with pointers to Blob/Qdrant/Git).

Aggregate-to-Context Summary

Bounded Context Aggregate Roots Count
Knowledge Graph KnowledgeNode, KnowledgeEdge, GraphProjection 3
Vector & Semantic Memory VectorDocument, VectorChunk, EmbeddingJob 3
Artifact Memory ArtifactMemory, ArtifactVersion, ArtifactSnapshot 3
Code Knowledge CodeRepository, CodeSymbol, CodeIndexJob 3
Documentation Knowledge (shared MemoryRecord / VectorDocument) 0
Prompt & Decision Memory PromptTemplate, PromptVersion, PromptRun, DecisionRecord, DecisionAlternative 5
Runtime Memory & Feedback RuntimeSignal, IncidentMemory, FeedbackItem 3
Pattern Catalog KnowledgePattern, PatternVersion 2
Knowledge Governance MemoryAccessPolicy, MemoryAccessDecision, MemoryAccessAudit, MemoryClassification, KnowledgeQualityAssessment, QualityRule 6
Context Building ContextBuildRequest, ContextPackage, ContextSource 3
Ingestion MemoryRecord 1
Total 32