feat(simulation): add knowledge graph system per D-041 (#361, #362, #363, #365)

Implement per-entity KnowledgeGraph component with BTreeMap storage
for deterministic iteration (D-010). StableEntityId + EntityRegistry
for entity identity across save/load. KnowledgeEventQueue + processing
system for decoupled knowledge updates. Decay system runs once per
game-minute. All types conform to D-041 canonical structs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-12 00:48:43 +01:00
co-authored by Claude Opus 4.6
parent a9f1cbd865
commit e733a4c223
6 changed files with 1041 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
//! Knowledge graph module (D-041).
//!
//! Implements information boundaries (D-010 principle 2): every piece of
//! state is tagged with who knows it. Per-entity KnowledgeGraph component
//! tracks what each entity knows about others and the world.
use bevy_app::prelude::*;
use bevy_ecs::prelude::*;
pub mod events;
pub mod graph;
pub mod registry;
pub mod types;
pub use events::{
KnowledgeEvent, KnowledgeEventQueue, KnowledgeEventType,
};
pub use graph::KnowledgeGraph;
pub use registry::{EntityRegistry, StableEntityId};
pub use types::*;
/// Knowledge system plugin.
/// Registers resources and systems for knowledge graph processing.
pub struct KnowledgePlugin;
impl Plugin for KnowledgePlugin {
fn build(&self, app: &mut App) {
app.init_resource::<KnowledgeEventQueue>()
.init_resource::<EntityRegistry>()
.init_resource::<DecayThresholds>()
.add_systems(
Update,
(
events::process_knowledge_events
.after(crate::perception::observer::compute_observer_snapshot),
events::decay_knowledge
.after(events::process_knowledge_events),
),
);
tracing::debug!("KnowledgePlugin initialized");
}
}