Files
settled-reach/docs/diagrams/entity/knowledge-graph.d2
T
jpmschweitzerandClaude Opus 4.6 1e556ccca2 docs(diagrams): add decision diagrams across all domains
16 d2 diagrams covering architecture (IPC bridge, system tiers,
testability, audio bus), data flow (perception, dialogue, eavesdrop
pipelines), entity (knowledge graph, NPC generation, dialogue tags),
state (simulation tiers, movement stances, knowledge confidence), and
UI (HUD layout, interaction flow, fog layers). PNG output for universal
viewer compatibility. Removes test SVG from font debugging.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 11:57:07 +01:00

89 lines
2.4 KiB
Plaintext

# Knowledge Graph Data Model — D-041
# Per-entity bevy_ecs Component with BTreeMap storage.
# Confidence hierarchy, knowledge state, knowledge source, event-driven updates.
vars: {
color-bg: "#2a3040"
color-stroke: "#333340"
color-text: "#c8d0e0"
color-accent: "#c8d8f0"
color-dim: "#1a1e24"
}
KnowledgeGraph: KnowledgeGraph {
shape: sql_table
entity_knowledge: BTreeMap<StableId, EntityKnowledge>
fact_knowledge: BTreeMap<FactId, FactKnowledge>
}
EntityKnowledge: EntityKnowledge {
shape: sql_table
stable_id: StableId(u64) {constraint: foreign_key}
confidence: KnowledgeConfidence
state: KnowledgeState
source: KnowledgeSource
last_observed_tick: u64
}
FactKnowledge: FactKnowledge {
shape: sql_table
fact_id: FactId {constraint: primary_key}
confidence: KnowledgeConfidence
state: KnowledgeState
source: KnowledgeSource
last_observed_tick: u64
}
KnowledgeConfidence: KnowledgeConfidence {
shape: sql_table
direct: Direct — currently in LOS
knows_details: KnowsDetails — actionable (secret tier)
knows_of: KnowsOf — involved in Y (real tier)
suspects: Suspects — something off (surface tier)
}
KnowledgeState: KnowledgeState {
shape: sql_table
active: Active — believed true
contradicted: Contradicted — conflict detected (Sprint 3+)
stale: Stale — aged beyond threshold (Sprint 3+)
}
KnowledgeSource: KnowledgeSource {
shape: sql_table
direct_observation: DirectObservation
heard: Heard
told_by: ToldBy (Sprint 3+)
inferred: Inferred (Sprint 3+)
background: Background
}
EntityRegistry: EntityRegistry {
shape: sql_table
stable_to_entity: BTreeMap<StableId, Entity>
entity_to_stable: BTreeMap<Entity, StableId>
}
KnowledgeEventQueue: KnowledgeEventQueue\n(bevy_ecs Resource) {
shape: queue
style.fill: ${color-dim}
style.stroke: ${color-accent}
style.font-color: ${color-text}
}
KnowledgeGraph -> EntityKnowledge: "contains many"
KnowledgeGraph -> FactKnowledge: "contains many"
EntityKnowledge -> KnowledgeConfidence: "uses"
EntityKnowledge -> KnowledgeState: "uses"
EntityKnowledge -> KnowledgeSource: "uses"
FactKnowledge -> KnowledgeConfidence: "uses"
FactKnowledge -> KnowledgeState: "uses"
FactKnowledge -> KnowledgeSource: "uses"
EntityKnowledge -> EntityRegistry: "StableId lookup" {
style.stroke: ${color-accent}
style.stroke-dash: 4
}
KnowledgeEventQueue -> KnowledgeGraph: "drained each tick\n→ writes components" {
style.stroke: ${color-accent}
}