1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! DAG-based state management for episode context (WG-134).
//!
//! Inspired by arXiv:2602.22398: DAG-based state management achieves 86% token
//! reduction by deduplicating shared context between episodes.
//!
//! ## Key Concepts
//!
//! Instead of storing full context for each episode, we:
//! 1. Create DAG nodes for shared context attributes (language, domain, task_type)
//! 2. Episodes reference nodes by ID instead of storing full context strings
//! 3. Context assembly traverses DAG to deduplicate shared attributes
//!
//! ## Architecture
//!
//! ```text
//! Episodes ──► StateDag ──► Deduplicated Context
//! │ │ │
//! │ │ │
//! └──► StateNode (shared) ──► Shared attribute once
//! │ - language="rust"
//! │ - domain="web-api"
//! │ - task_type="Debugging"
//! │
//! └──► Episode-unique state stored separately
//! ```
//!
//! ## Token Reduction
//!
//! For N episodes sharing the same language/domain/task_type:
//! - Old: N × (language + domain + task_type) tokens
//! - New: 1 × (language + domain + task_type) + N × node_id refs
//! - Reduction: ~86% when N > 5 and shared context is large
pub use ;
pub use ;
pub use ;
pub use ;