From 312d8928535366a3d51441e801fc731c0333b261 Mon Sep 17 00:00:00 2001 From: dtzp555 Date: Thu, 19 Mar 2026 07:13:26 +1000 Subject: [PATCH] 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 --- index.js | 7 ------- scripts/continuity_doctor.py | 3 ++- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index e08a2cb..b2f0ef8 100644 --- a/index.js +++ b/index.js @@ -258,14 +258,7 @@ const plugin = { 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); - 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); if (!newState) { log.info?.("[memory-continuity] No extractable state from conversation"); diff --git a/scripts/continuity_doctor.py b/scripts/continuity_doctor.py index 9f0ee91..90c5c88 100644 --- a/scripts/continuity_doctor.py +++ b/scripts/continuity_doctor.py @@ -15,6 +15,7 @@ import sys import re from datetime import datetime, timezone from pathlib import Path +from typing import Optional # --------------------------------------------------------------------------- @@ -78,7 +79,7 @@ PLACEHOLDER_PATTERNS = [ # 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.""" state_file = workspace / "memory" / "CURRENT_STATE.md" if not state_file.exists():