fix: Python 3.6 compat + allow CURRENT_STATE.md override

- Replace 'Path | None' union syntax with 'Optional[Path]' (typing import)
  so continuity_doctor.py works on Python 3.6+
- Remove message-count guard in agent_end hook that blocked state writes
  when realUserMsgs.length < 2; agents can now update CURRENT_STATE.md
  regardless of conversation length

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-19 07:13:26 +10:00
co-authored by Claude Sonnet 4.6
parent 33c3558625
commit 312d892853
2 changed files with 2 additions and 8 deletions
-7
View File
@@ -258,14 +258,7 @@ const plugin = {
return cleaned.length > 10; return cleaned.length > 10;
}); });
// Don't overwrite meaningful state with trivial conversations
// (e.g., "/new" then "what was my secret?" — only 1 real message)
const existing = readFile(statePath); const existing = readFile(statePath);
if (existing && buildSnapshot(existing) && realUserMsgs.length < 2) {
log.info?.("[memory-continuity] Conversation too short to overwrite existing state (" + realUserMsgs.length + " real msgs)");
return;
}
const newState = extractStateFromMessages(messages); const newState = extractStateFromMessages(messages);
if (!newState) { if (!newState) {
log.info?.("[memory-continuity] No extractable state from conversation"); log.info?.("[memory-continuity] No extractable state from conversation");
+2 -1
View File
@@ -15,6 +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
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@@ -78,7 +79,7 @@ PLACEHOLDER_PATTERNS = [
# Checks # Checks
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
def check_existence(workspace: Path, report: DiagnosticReport) -> Path | None: def check_existence(workspace: Path, report: DiagnosticReport) -> Optional[Path]:
"""Check that memory/CURRENT_STATE.md exists.""" """Check that memory/CURRENT_STATE.md exists."""
state_file = workspace / "memory" / "CURRENT_STATE.md" state_file = workspace / "memory" / "CURRENT_STATE.md"
if not state_file.exists(): if not state_file.exists():