Skip to content

Commit dc2e31f

Browse files
WEITE XUclaude
authored andcommitted
fix: unify PLAN↔EXECUTE stage record format (Codex #6)
Add canonical `Files:` field to todo.md stage records: - docs/state-files.md: schema updated with Files field + backward compat note - docs/10plan.md: Phase 4 now writes Files field in stage records - docs/10exec.md: stage loop parses Files field, flags drift, handles legacy - SKILL.md: plan output template includes Files field Also adds lessons #8 (enforce schemas) and #9 (trace across boundaries) discovered during v2.3 integration testing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7f93478 commit dc2e31f

6 files changed

Lines changed: 41 additions & 8 deletions

File tree

SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ MEDIUM: [pattern] — [defense]
141141
1. [foundation] -> 2. [consumer] -> 3. [integration]
142142
143143
## Stages (R4)
144-
- [ ] Stage 1: [name] | Entry: [cond] | Exit: [cond]
144+
- [ ] Stage 1: [name] | Entry: [cond] | Exit: [cond] | Files: [path1, path2]
145145
- [ ] Stage 2: ...
146146
147147
## Failure Paths (R7)

docs/10exec.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,19 @@ C) Defer — mark as tech debt for later
3131
- Run `git diff` to see what changed.
3232
- Self-review the diff against the stage's exit conditions.
3333
- If tests exist, run them.
34-
- If the diff touches files NOT in the stage's predicted file list, flag it.
34+
- Parse the current stage's `Files:` field from `todo.md` (comma-separated paths after `Files:`).
35+
- If `Files:` field exists: compare the diff's changed files against the predicted list. Flag any file NOT in the list:
36+
37+
```
38+
File drift detected: {path} was modified but not in the stage's predicted file list.
39+
Rule 5: is this an intentional scope expansion or accidental coupling?
40+
41+
A) Expected — update the stage's Files field
42+
B) Refactor — move this change to a separate stage
43+
C) Revert — this was accidental
44+
```
45+
46+
- If no `Files:` field (legacy format): skip the file drift check for this stage.
3547

3648
### 4. Verify (Rule 9)
3749

docs/10plan.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,14 @@ C) Show me the existing code for these interfaces
9797
- **Name**
9898
- **Entry condition** (what must be true before starting)
9999
- **Exit condition** (what must be true to call it done)
100-
- **Files to touch** (predicted)
101-
2. Write stages as checkboxes to `todo.md` under `## Stages`.
100+
- **Files to touch** (predicted, comma-separated)
101+
2. Write stages as checkboxes to `todo.md` under `## Stages`, using the canonical format:
102+
103+
```
104+
- [ ] Stage N: {name} | Entry: {cond} | Exit: {cond} | Files: {path1, path2}
105+
```
106+
107+
The `Files:` field is required. EXECUTE uses it to detect file drift (edits outside predicted files).
102108

103109
## Phase 5: Failure Path Audit (Rule 7)
104110

docs/state-files.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ Canonical formats for all state files used by 10devrules. Every reader/writer mu
1212
# Task Plan
1313

1414
## Stages
15-
- [ ] Stage 1: {name} | Entry: {condition} | Exit: {condition}
16-
- [ ] Stage 2: {name} | Entry: {condition} | Exit: {condition}
17-
- [x] Stage 3: {name} | Entry: {condition} | Exit: {condition}
15+
- [ ] Stage 1: {name} | Entry: {condition} | Exit: {condition} | Files: {path1, path2}
16+
- [ ] Stage 2: {name} | Entry: {condition} | Exit: {condition} | Files: {path3}
17+
- [x] Stage 3: {name} | Entry: {condition} | Exit: {condition} | Files: {path4, path5}
1818
```
1919

20+
The `Files:` field lists predicted files to touch (comma-separated). EXECUTE uses this to flag drift when the diff touches unexpected files. If a stage has no `Files:` field (legacy format), EXECUTE skips the file drift check for that stage.
21+
2022
Created by: PLAN Phase 4. Updated by: EXECUTE (checkbox toggling).
2123

2224
### .10dev/boundary.txt

lessons.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ The router table, output templates, and anti-pattern table exist because an LLM
2626
### 7. Version semantics signal intent
2727
v1.0 (passive doc) → v2.0 (active agent) → v2.1 (router + DOCS mode). The jump from 1→2 signaled a breaking paradigm shift. 2.0→2.1 signaled additive capability. Naming versions correctly set expectations for consumers.
2828

29+
### 8. Schema must be enforced, not just documented
30+
State file schemas (docs/state-files.md) defined canonical formats, but another project's agent created developer-profile.md with a completely different format. Documentation alone doesn't prevent drift — the reading agent must validate or normalize on read.
31+
32+
### 9. Contract gaps surface at integration, not in isolation
33+
PLAN wrote "Files to touch" but todo.md had no field for it. EXECUTE needed it but couldn't find it. The gap was invisible until both modes ran in sequence. Always trace data across mode boundaries, not just within a single mode.
34+
2935
---
3036

31-
**Formula:** split the monolith, match the platform, symlink the truth, stage the surface, enforce don't suggest, design for your consumer, version your intent.
37+
**Formula:** split the monolith, match the platform, symlink the truth, stage the surface, enforce don't suggest, design for your consumer, version your intent, enforce the schema, trace across boundaries.

todo.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Task Plan: Unify PLAN↔EXECUTE Stage Record Format
2+
3+
## Stages
4+
- [x] Stage 1: Update state-files.md schema | Entry: current schema read | Exit: Files field in format | Files: docs/state-files.md
5+
- [x] Stage 2: Update 10plan.md Phase 4 | Entry: schema defined | Exit: Phase 4 writes Files field | Files: docs/10plan.md
6+
- [x] Stage 3: Update 10exec.md stage loop | Entry: format defined | Exit: exec reads Files field | Files: docs/10exec.md
7+
- [x] Stage 4: Update SKILL.md template | Entry: format defined | Exit: template includes Files | Files: SKILL.md

0 commit comments

Comments
 (0)