Skip to main content

do_memory_core/episode/
mod.rs

1//! Episode management for tracking task execution.
2//!
3//! This module provides the core types for tracking and learning from task
4//! executions, including episodes, execution steps, and pattern applications.
5//!
6//! # Examples
7//!
8//! ```
9//! use do_memory_core::{Episode, TaskContext, TaskType, TaskOutcome, ExecutionStep};
10//! use do_memory_core::ExecutionResult;
11//!
12//! // Create a new episode
13//! let mut episode = Episode::new(
14//!     "Implement user authentication".to_string(),
15//!     TaskContext::default(),
16//!     TaskType::CodeGeneration,
17//! );
18//!
19//! // Add execution steps
20//! let mut step = ExecutionStep::new(1, "planner".to_string(), "Plan implementation".to_string());
21//! step.result = Some(ExecutionResult::Success {
22//!     output: "Plan created".to_string(),
23//! });
24//! episode.add_step(step);
25//!
26//! // Complete the episode
27//! episode.complete(TaskOutcome::Success {
28//!     verdict: "Authentication implemented successfully".to_string(),
29//!     artifacts: vec!["auth.rs".to_string()],
30//! });
31//!
32//! assert!(episode.is_complete());
33//! ```
34
35pub mod graph_algorithms;
36pub mod relationship_errors;
37pub mod relationship_manager;
38#[cfg(test)]
39mod relationship_manager_tests;
40pub mod relationships;
41pub mod retention;
42pub mod structs;
43pub mod validation;
44
45pub use graph_algorithms::{
46    find_all_cycles_from_node, find_path_dfs, get_ancestors, get_transitive_closure, has_cycle,
47    has_path_dfs, topological_sort,
48};
49pub use relationship_errors::{GraphError, RemovalError, ValidationError};
50pub use relationship_manager::RelationshipManager;
51pub use relationships::{Direction, EpisodeRelationship, RelationshipMetadata, RelationshipType};
52pub use retention::{
53    CleanupResult, DEFAULT_CLEANUP_BATCH_SIZE, DEFAULT_CLEANUP_INTERVAL, DEFAULT_MAX_AGE_DAYS,
54    DEFAULT_MAX_EPISODES, DEFAULT_MIN_REWARD_THRESHOLD, EpisodeRetentionPolicy, RetentionCriterion,
55    RetentionPolicyError, RetentionTrigger,
56};
57pub use structs::{ApplicationOutcome, Episode, ExecutionStep, PatternApplication, PatternId};