- monologue.rs: tracing::warn on unrecognized trigger in fallback arm - disclosure.rs: borrow-sequencing comment, first() simplification note - trait_modifiers.rs: delegate parse_confidence to KnowledgeConfidence::try_from - npc_knowledge_transfer.rs: fix misleading "draw randomly" comment, document one-directional transfer behavior - graph.rs: document intentional no-retrigger after contradiction - dialogue.rs: explain entity grant guardrail asymmetry (D-079) - knowledge/mod.rs: document one-tick monologue lag from system ordering - poi_discovery.rs: document D-079 carve-out for direct KG write Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
52 lines
1.9 KiB
Rust
52 lines
1.9 KiB
Rust
//! 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 content_registry;
|
|
pub mod events;
|
|
pub mod graph;
|
|
pub mod registry;
|
|
pub mod types;
|
|
|
|
pub use content_registry::ContentEntityRegistry;
|
|
pub use events::{
|
|
ContradictionDetectedEvent, ContradictionDetectedQueue, InteractionType, KnowledgeEvent,
|
|
KnowledgeEventQueue, KnowledgeEventType, ProcessedEntityGrant, ProcessedFactGrant,
|
|
ProcessedKnowledgeGrant,
|
|
};
|
|
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::<ContradictionDetectedQueue>()
|
|
.init_resource::<EntityRegistry>()
|
|
.init_resource::<ContentEntityRegistry>()
|
|
.init_resource::<DecayThresholds>()
|
|
.add_systems(
|
|
Update,
|
|
(
|
|
// Runs after snapshot: contradiction monologue and relationship
|
|
// shifts from KnowledgeGranted events lag by one tick (~0.1s).
|
|
// Acceptable — the player perceives the contradiction on the
|
|
// next snapshot, which reads as a natural reaction delay.
|
|
events::process_knowledge_events
|
|
.after(crate::perception::observer::compute_observer_snapshot),
|
|
events::decay_knowledge.after(events::process_knowledge_events),
|
|
),
|
|
);
|
|
tracing::debug!("KnowledgePlugin initialized");
|
|
}
|
|
}
|