fix: python 3.6 compat + clarify CURRENT_STATE.md override rule

This commit is contained in:
2026-03-19 07:14:41 +10:00
parent 312d892853
commit 9e25ec5e95
2 changed files with 19 additions and 3 deletions
+16
View File
@@ -130,6 +130,22 @@ Update the file by **overwriting** it, not appending, at these moments:
| Before handoff / subagent exit | Preserves outputs and unsurfaced results | | Before handoff / subagent exit | Preserves outputs and unsurfaced results |
| After a substantive state change | Keeps checkpoint aligned with actual work | | After a substantive state change | Keeps checkpoint aligned with actual work |
### Override rule
**CURRENT_STATE.md must always be overwritten when:**
- A new task or objective starts — regardless of what is currently in the file
- The previous objective is complete or abandoned
- The user gives a new task that supersedes the previous one
Having content in CURRENT_STATE.md does NOT mean it should be preserved.
Content only matters if Objective is still active and work is genuinely in progress.
Checking before overwrite:
- Read the file
- If Objective matches the current task → update in place (overwrite)
- If Objective does NOT match → overwrite the entire file with the new state
- Never append. Never skip the update because "there's already something there".
### 4. Keep the checkpoint small ### 4. Keep the checkpoint small
`CURRENT_STATE.md` should usually stay under about 40 lines and be readable in `CURRENT_STATE.md` should usually stay under about 40 lines and be readable in
+3 -3
View File
@@ -15,7 +15,7 @@ import sys
import re import re
from datetime import datetime, timezone from datetime import datetime, timezone
from pathlib import Path from pathlib import Path
from typing import Optional from typing import Dict, List, Optional, Tuple
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@@ -33,7 +33,7 @@ class Severity:
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
class DiagnosticReport: class DiagnosticReport:
def __init__(self): def __init__(self):
self.entries: list[tuple[str, str]] = [] self.entries: List[Tuple[str, str]] = []
self._worst = Severity.OK self._worst = Severity.OK
def add(self, severity: str, message: str): def add(self, severity: str, message: str):
@@ -112,7 +112,7 @@ def check_staleness(state_file: Path, workspace: Path, report: DiagnosticReport)
def check_template_compliance(state_file: Path, report: DiagnosticReport) -> dict: def check_template_compliance(state_file: Path, report: DiagnosticReport) -> dict:
"""Check all required sections are present and not placeholder-only.""" """Check all required sections are present and not placeholder-only."""
content = state_file.read_text(encoding="utf-8") content = state_file.read_text(encoding="utf-8")
sections_found: dict[str, str] = {} sections_found: Dict[str, str] = {}
for section in REQUIRED_SECTIONS: for section in REQUIRED_SECTIONS:
# Match ## Section or ## Section\n # Match ## Section or ## Section\n