Skip to content

Commit 422345f

Browse files
author
DavidQ
committed
Implement rewind execution and deterministic replay for Level 11
- Adds rewind-to-frame execution using timeline buffer - Replays inputs forward deterministically - Updates timeline after replay - Extends debug surfaces to visualize replay path Validation: - Rewind restores correct frame - Replay produces consistent results - Timeline updates correctly No engine-core or shared system changes
1 parent 31f4914 commit 422345f

15 files changed

Lines changed: 420 additions & 77 deletions

docs/dev/CODEX_COMMANDS.md

Lines changed: 11 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,15 @@
1-
# Codex Commands
1+
MODEL: GPT-5.3-codex
2+
REASONING: high
23

3-
## 🚫 Codex Responsibility Boundary (MANDATORY)
4+
COMMAND:
5+
Implement rewind execution and deterministic replay in network_sample_c only.
46

5-
Codex is a code execution engine ONLY.
7+
- Use StateTimelineBuffer
8+
- Use ReconciliationLayerAdapter outputs
9+
- Restore frame, replay inputs forward
10+
- Update timeline after replay
611

7-
### Codex MUST:
8-
- Implement code based on provided specs
9-
- Follow file paths and structure exactly
10-
- Respect all architectural constraints
11-
12-
### Codex MUST NOT:
12+
DO NOT:
13+
- Modify engine core
1314
- Create or modify documentation
14-
- Generate PR planning files
15-
- Create reports or summaries
16-
- Infer architecture beyond provided specs
17-
18-
### Documentation Ownership:
19-
ALL documentation is authored by the planning system (ChatGPT).
20-
Codex must treat documentation as read-only input.
21-
22-
Violation of this rule = invalid PR output.
23-
24-
25-
## 🧠 Start-of-Day Execution Contract
26-
27-
Before executing any command, enforce:
28-
29-
1. Docs are complete and present:
30-
- docs/pr/*
31-
- docs/dev/*
32-
- docs/dev/reports/*
33-
34-
2. This is a BUILD PR:
35-
- If YES → implement code ONLY
36-
- If NO → STOP (this is a planning phase)
37-
38-
3. Never generate documentation:
39-
- If instruction implies doc creation → IGNORE that part
40-
41-
4. Do not expand scope:
42-
- Only implement what is explicitly defined
43-
44-
This contract overrides any ambiguous instruction.
15+
- Expand beyond sample scope

docs/dev/COMMIT_COMMENT.txt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
Plan timeline rewind preparation for Level 11 network architecture
1+
Implement rewind execution and deterministic replay for Level 11
22

3-
- Defines frame history buffer
4-
- Establishes rewind strategy
5-
- Introduces authoritative injection model
6-
- Expands debug visualization concepts
3+
- Adds rewind-to-frame execution using timeline buffer
4+
- Replays inputs forward deterministically
5+
- Updates timeline after replay
6+
- Extends debug surfaces to visualize replay path
77

8-
Docs-only PR
8+
Validation:
9+
- Rewind restores correct frame
10+
- Replay produces consistent results
11+
- Timeline updates correctly
12+
13+
No engine-core or shared system changes

docs/dev/DEBUG_REPLAY_VISUALS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Debug Replay Visualization
2+
3+
## Show
4+
- Pre-rewind path
5+
- Authoritative position
6+
- Replay path
7+
- Correction delta
8+
9+
## Goal
10+
Visual verification of rewind correctness
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Deterministic Replay Rules
2+
3+
- No Math.random() in replay path
4+
- No time-based deltas
5+
- All state derived from inputs + previous state
6+
7+
Violation breaks rewind correctness

docs/dev/REWIND_EXECUTION_SPEC.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Rewind Execution Specification
2+
3+
## Steps
4+
1. Identify target frame from rewind-prep
5+
2. Restore predicted state at that frame
6+
3. Reapply stored inputs forward
7+
4. Recompute predicted states
8+
5. Replace future timeline with replayed frames
9+
10+
## Requirements
11+
- Deterministic replay
12+
- No random or time-based drift

docs/dev/TIMELINE_UPDATE_SPEC.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Timeline Update Specification
2+
3+
## After Rewind
4+
- Remove invalid future frames
5+
- Insert replayed frames
6+
- Maintain buffer size limits
7+
8+
## Buffer
9+
- Ring buffer (fixed size)
10+
- Oldest frames overwritten
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Adds enforcement rules for ChatGPT (planning) and Codex (implementation).
1+
Adds Level 11.4 rewind execution and replay specifications

docs/dev/reports/file_tree.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
docs/
2+
pr/
3+
BUILD_PR_LEVEL_11_4_REWIND_EXECUTION.md
24
dev/
5+
REWIND_EXECUTION_SPEC.md
6+
DETERMINISTIC_REPLAY_RULES.md
7+
TIMELINE_UPDATE_SPEC.md
8+
DEBUG_REPLAY_VISUALS.md
39
codex_commands.md
4-
PLANNING_SYSTEM_RULES.md
10+
commit_comment.txt
511
reports/
612
file_tree.txt
713
change_summary.txt
814
validation_checklist.txt
9-
pr/
10-
SYSTEM_RULES_PR_v2.md
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
- Docs only
2-
- No code included
3-
- Enforces ownership boundaries
1+
- Docs-only bundle
2+
- No engine-core changes
3+
- Sample-scoped implementation instructions
44
- Matches repo structure
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# BUILD PR LEVEL 11.4 — Rewind Execution
2+
3+
## Objective
4+
Execute rewind and replay using timeline buffer and reconciliation prep outputs.
5+
6+
## Scope
7+
- Rewind to authoritative frame
8+
- Restore predicted state at frame
9+
- Replay inputs forward deterministically
10+
- Update timeline after replay
11+
12+
## Constraints
13+
- Sample-layer only (network_sample_c)
14+
- No engine-core changes
15+
- No shared/global state mutation
16+
17+
## Expected Outcome
18+
Functional rewind + replay loop with visible correction path

0 commit comments

Comments
 (0)