# T006: Add Echo Landmarks and Deviation Tracking ## Goal Formalize how echoes know whether they are still following their original timeline, how they locally correct, and when they become independent emergent actors. ## Context Echoes are not meant to be brittle recordings. They should mostly repeat the original run, but the live world may interfere: an echo can be blocked, displaced, attacked, saved, delayed, or pulled into a different fight. Under small divergence, the echo should try to recover toward its original fate. Past a threshold, the echo should become severed from replay and continue as an independent AI timeline. This ticket introduces the data model and first heuristic. It does not need to make the heuristic perfect. ## Requirements - Add sparse guide data derived from a run history, such as actor position/facing every N ticks. - Add semantic landmarks derived from simulation events, such as room entry, attack, damage, item use, enemy engagement, death point, or other locally meaningful milestones. - Track each echo's replay mode: following, correcting, severed, and resolved or equivalent. - Compute a deterministic deviation score for an echo. - Allow small deviation to enter local correction instead of immediately abandoning replay. - Allow large deviation to sever the echo from its original command stream. - Keep deviation scoring deterministic and testable without rendering. - Emit transcript/debug facts for replay mode, current landmark, and deviation score. ## Suggested Deviation Inputs - Spatial distance from expected guide position. - Tick delay or lead relative to expected timeline. - Missed or reordered semantic landmarks. - Unexpected displacement or blocked duration. - Unexpected damage, death, or target changes. - Distance from original death/fate path. The first implementation can use only a subset. Prefer one understandable score over several half-built systems. ## Suggested Implementation Direction - Generate guide samples after a run completes, not during every echo tick, unless it is simpler to do both together. - Keep guide samples sparse so long runs do not become expensive to store. - Start with correction toward the next guide sample or landmark before introducing full pathfinding. - Use deterministic thresholds configured in `src/sim/config.odin` or nearby simulation config. - Make severing explicit. Once severed, an echo should stop consuming replay commands unless a later design intentionally supports reattachment. ## Acceptance Criteria - Echoes have an explicit replay/deviation mode in simulation state. - A deterministic deviation score can be inspected in headless transcript output. - A mildly displaced echo can correct toward its timeline. - A heavily displaced echo can become severed and stop acting as a strict replay. - Re-running the same scripted scenario produces the same mode transitions and final digest. - `just check` passes. ## Notes - This is the foundation for emergent echo behavior. Keep it small but make the state model durable. - Do not tune for final game feel yet. Tune for legibility, determinism, and debuggability.