The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(footguns): quote encoding= utf-8-sig values; fix f-string nesting
ethernet9b8637a71e64
diff --git a/agent/session_persistence.py b/agent/session_persistence.pyindex eb11f2b6603..5173f2c902d 100644--- a/agent/session_persistence.py+++ b/agent/session_persistence.py@@ -278,7 +278,7 @@ def _existing_log_is_larger(log_file, count: int) -> bool:if not log_file.exists():return Falsetry:- existing = json.loads(log_file.read_text(encoding=utf-8-sig))+ existing = json.loads(log_file.read_text(encoding="utf-8-sig"))existing_count = existing.get("message_count", len(existing.get("messages", [])))except Exception:return Falsediff --git a/cron/scheduler_prompt.py b/cron/scheduler_prompt.pyindex 28f54390af0..7cfb5463fa0 100644--- a/cron/scheduler_prompt.py+++ b/cron/scheduler_prompt.py@@ -93,7 +93,7 @@ def _inject_context_from(job: dict, prompt: str) -> tuple[str, bool]:)if not output_files:continue # silent skip — no output yet- latest_output = output_files[0].read_text(encoding=utf-8-sig).strip()+ latest_output = output_files[0].read_text(encoding="utf-8-sig").strip()if len(latest_output) > _MAX_CONTEXT_CHARS:latest_output = (latest_output[:_MAX_CONTEXT_CHARS] + "\n\n[... output truncated ...]")diff --git a/gateway/platforms/helpers.py b/gateway/platforms/helpers.pyindex 224773ecd6a..0a709b4769c 100644--- a/gateway/platforms/helpers.py+++ b/gateway/platforms/helpers.py@@ -96,7 +96,7 @@ class ThreadParticipationTracker:def _load(self) -> list[str]:try:- data = json.loads(self._state_path().read_text(encoding=utf-8-sig))+ data = json.loads(self._state_path().read_text(encoding="utf-8-sig"))except Exception:return []return [str(thread_id) for thread_id in data] if isinstance(data, list) else []diff --git a/gateway/run_config_loaders.py b/gateway/run_config_loaders.pyindex 3e49ff6072e..19b829b99b8 100644--- a/gateway/run_config_loaders.py+++ b/gateway/run_config_loaders.py@@ -76,7 +76,7 @@ class GatewayConfigLoadersMixin:logger.warning("Prefill messages file not found: %s", path)return []try:- with open(path, "r", encoding=utf-8-sig) as f:+ with open(path, "r", encoding="utf-8-sig") as f:data = json.load(f)if not isinstance(data, list):logger.warning("Prefill messages file must contain a JSON array: %s", path)diff --git a/gateway/run_voice.py b/gateway/run_voice.pyindex b1fdad2e148..5b413ed381d 100644--- a/gateway/run_voice.py+++ b/gateway/run_voice.py@@ -55,7 +55,7 @@ class GatewayVoiceMixin:def _load_voice_modes(self) -> Dict[str, str]:try:- data = json.loads(self._VOICE_MODE_PATH.read_text(encoding=utf-8-sig))+ data = json.loads(self._VOICE_MODE_PATH.read_text(encoding="utf-8-sig"))except (FileNotFoundError, json.JSONDecodeError, OSError):return {}if not isinstance(data, dict):diff --git a/hermes_cli/auth.py b/hermes_cli/auth.pyindex 5a44fbf702e..683f0d9801b 100644--- a/hermes_cli/auth.py+++ b/hermes_cli/auth.py@@ -576,7 +576,7 @@ def _file_lock(lock_path.write_text(" ", encoding="utf-8")except (OSError, PermissionError):pass- lock_file = stack.enter_context(lock_path.open("r+" if msvcrt else "a+", encoding=utf-8-sig))+ lock_file = stack.enter_context(lock_path.open("r+" if msvcrt else "a+", encoding="utf-8-sig"))deadline = time.monotonic() + max(1.0, timeout_seconds)while True:try:@@ -1820,7 +1820,7 @@ def _external_process_auth_evidence(provider_id: str) -> tuple[bool, Optional[sttry:cli_config = os.path.expanduser("~/.copilot/config.json")if os.path.isfile(cli_config):- with open(cli_config, "r", encoding=utf-8-sig, errors="ignore") as fh:+ with open(cli_config, "r", encoding="utf-8-sig", errors="ignore") as fh:raw = "\n".join(line for line in fh.read().splitlines() if not line.lstrip().startswith("//"))tokens = (json.loads(raw) if raw.strip() else {}).get("copilotTokens")diff --git a/hermes_cli/banner.py b/hermes_cli/banner.pyindex f448df17e42..fe79038d9be 100644--- a/hermes_cli/banner.py+++ b/hermes_cli/banner.py@@ -317,7 +317,7 @@ def _check_via_local_git(repo_dir: Path) -> Optional[int]:def _read_json(path: Path) -> Optional[dict]:"""Parse ``path`` as a JSON object; None when missing, unreadable, or not a dict."""- blob = _quiet(lambda: json.loads(path.read_text(encoding=utf-8-sig)))+ blob = _quiet(lambda: json.loads(path.read_text(encoding="utf-8-sig")))return blob if isinstance(blob, dict) else Nonediff --git a/hermes_cli/config.py b/hermes_cli/config.pyindex 194cc85dfd1..fa04264b5ef 100644--- a/hermes_cli/config.py+++ b/hermes_cli/config.py@@ -281,7 +281,7 @@ def get_managed_system() -> Optional[str]:managed_marker = get_hermes_home() / ".managed"if marker is None and managed_marker.exists():try:- marker = managed_marker.read_text(encoding=utf-8-sig, errors="replace").strip().lower()+ marker = managed_marker.read_text(encoding="utf-8-sig", errors="replace").strip().lower()except OSError:marker = ""if marker is None or marker in _IGNORED_MANAGED_VALUES:@@ -317,7 +317,7 @@ _SUPPORTED_INSTALL_METHODS = frozenset({"apt", "docker", "nix", "nixos", "home-mdef _install_method_stamp(path: Path) -> Optional[str]:try:- method = path.read_text(encoding=utf-8-sig).strip().lower()+ method = path.read_text(encoding="utf-8-sig").strip().lower()except OSError:return Nonereturn method if method in _SUPPORTED_INSTALL_METHODS else None@@ -364,7 +364,7 @@ def detect_install_method(project_root: Optional[Path] = None) -> str:# A .git directory, or a ``gitdir:`` pointer file for worktrees.git_path = root / ".git"try:- if git_path.is_dir() or git_path.read_text(encoding=utf-8-sig).strip().startswith("gitdir:"):+ if git_path.is_dir() or git_path.read_text(encoding="utf-8-sig").strip().startswith("gitdir:"):return "git"except OSError:pass@@ -504,7 +504,7 @@ def require_parseable_user_config(*, ignore_user_config: bool = False) -> None:config_path = get_config_path()try:- with open(config_path, encoding=utf-8-sig) as f:+ with open(config_path, encoding="utf-8-sig") as f:data = fast_safe_load(f)except FileNotFoundError:return@@ -602,7 +602,7 @@ def _is_container() -> bool:or os.path.exists("/.dockerenv")):return Truetry:- with open("/proc/1/cgroup", "r", encoding=utf-8-sig) as f:+ with open("/proc/1/cgroup", "r", encoding="utf-8-sig") as f:cgroup_content = f.read()return any(marker in cgroup_content for marker in ("docker", "lxc", "kubepods"))except (OSError, IOError):@@ -627,7 +627,7 @@ def _ensure_default_soul_md(home: Path) -> None:soul_path = home / "SOUL.md"if soul_path.exists():try:- existing = soul_path.read_text(encoding=utf-8-sig)+ existing = soul_path.read_text(encoding="utf-8-sig")except (OSError, UnicodeDecodeError):returnif not is_legacy_template_soul(existing):@@ -1042,7 +1042,7 @@ def check_config_version(*, raise_on_parse_error: bool = False) -> Tuple[int, inreturn latest, latesttry:- with open(config_path, encoding=utf-8-sig) as f:+ with open(config_path, encoding="utf-8-sig") as f:config = fast_safe_load(f)except Exception as e:_warn_config_parse_failure(config_path, e)@@ -1918,7 +1918,7 @@ def _read_raw_config_impl(*, want_deepcopy: bool) -> Dict[str, Any]:return copy.deepcopy(cached[2]) if want_deepcopy else cached[2]try:- with open(config_path, encoding=utf-8-sig) as f:+ with open(config_path, encoding="utf-8-sig") as f:data = fast_safe_load(f) or {}except Exception as e:_warn_config_parse_failure(config_path, e)@@ -1946,7 +1946,7 @@ def read_user_config_raw(config_path: Optional[Path] = None) -> Dict[str, Any]:if config_path is None:config_path = get_config_path()try:- with open(config_path, encoding=utf-8-sig) as f:+ with open(config_path, encoding="utf-8-sig") as f:data = fast_safe_load(f) or {}except FileNotFoundError:return {}@@ -1984,7 +1984,7 @@ def require_readable_config_before_write(config_path: Optional[Path] = None) ->raise _refuse_overwrite(config_path, "cannot be accessed", exc, _FIX_PERMS) from exctry:- with open(config_path, encoding=utf-8-sig) as f:+ with open(config_path, encoding="utf-8-sig") as f:loaded = fast_safe_load(f)except OSError as exc:raise _refuse_overwrite(config_path, "cannot be read", exc, _FIX_PERMS) from exc@@ -2219,7 +2219,7 @@ def _load_config_impl(*, want_deepcopy: bool) -> Dict[str, Any]:if user_sig is not None:try:- with open(config_path, encoding=utf-8-sig) as f:+ with open(config_path, encoding="utf-8-sig") as f:user_config = fast_safe_load(f) or {}if "max_turns" in user_config:@@ -3817,7 +3817,7 @@ def _platform_plugin_manifests():if manifest_path is None:continuetry:- with open(manifest_path, "r", encoding=utf-8-sig) as f:+ with open(manifest_path, "r", encoding="utf-8-sig") as f:manifest = fast_safe_load(f) or {}except Exception:continuediff --git a/hermes_cli/gateway.py b/hermes_cli/gateway.pyindex 73ba95b272b..2211b3ea161 100644--- a/hermes_cli/gateway.py+++ b/hermes_cli/gateway.py@@ -442,7 +442,7 @@ def probe_gateway_loop_liveness(from gateway.shutdown_watchdog import get_loop_heartbeat_pathpath = get_loop_heartbeat_path(home)mtime = path.stat().st_mtime- payload = json.loads(path.read_text(encoding=utf-8-sig))+ payload = json.loads(path.read_text(encoding="utf-8-sig"))heartbeat_pid = int(payload.get("pid", 0))except Exception:return GATEWAY_LOOP_UNKNOWN@@ -1101,7 +1101,7 @@ def _hermes_home_from_systemd_unit_file(system: bool = False) -> str | None:if not unit_path.exists():return Nonetry:- text = unit_path.read_text(encoding=utf-8-sig)+ text = unit_path.read_text(encoding="utf-8-sig")except OSError:return Nonefor line in text.splitlines():@@ -2229,7 +2229,7 @@ def _find_legacy_hermes_units() -> list[tuple[str, Path, bool]]:try:if not unit_path.exists():continue- text = unit_path.read_text(encoding=utf-8-sig, errors="ignore")+ text = unit_path.read_text(encoding="utf-8-sig", errors="ignore")except (OSError, PermissionError):continueif any(marker in text for marker in _LEGACY_UNIT_EXECSTART_MARKERS):@@ -2365,7 +2365,7 @@ def _system_service_identity(run_as_user: str | None = None) -> tuple[str, str,def _read_systemd_user_from_unit(unit_path: Path) -> str | None:if not unit_path.exists():return None- for line in unit_path.read_text(encoding=utf-8-sig).splitlines():+ for line in unit_path.read_text(encoding="utf-8-sig").splitlines():if line.startswith("User="):return line.split("=", 1)[1].strip() or Nonereturn None@@ -2870,7 +2870,7 @@ def systemd_unit_is_current(system: bool = False) -> bool:if not unit_path.exists():return False- installed = unit_path.read_text(encoding=utf-8-sig)+ installed = unit_path.read_text(encoding="utf-8-sig")expected_user = _read_systemd_user_from_unit(unit_path) if system else Noneexpected = generate_systemd_unit(system=system, run_as_user=expected_user)# Ignore directives older systemd drops (RestartMaxDelaySec, RestartSteps) to avoid a perpetual "outdated" flag.@@ -3482,7 +3482,7 @@ def _append_launchd_reload_log(message: str) -> None:path.parent.mkdir(parents=True, exist_ok=True)from datetime import datetime as _dtstamp = _dt.now().astimezone().strftime("%Y-%m-%d %H:%M:%S %z")- with path.open("a", encoding=utf-8-sig) as fh:+ with path.open("a", encoding="utf-8-sig") as fh:fh.write(f"[{stamp}] {message}\n")except OSError:pass@@ -3735,7 +3735,7 @@ def launchd_plist_is_current() -> bool:plist_path = get_launchd_plist_path()if not plist_path.exists():return False- installed = plist_path.read_text(encoding=utf-8-sig)+ installed = plist_path.read_text(encoding="utf-8-sig")norm = _normalize_launchd_plist_for_comparisonreturn norm(installed) == norm(generate_launchd_plist())diff --git a/hermes_cli/main.py b/hermes_cli/main.pyindex 59bf3d4668d..4667fb5c0f4 100644--- a/hermes_cli/main.py+++ b/hermes_cli/main.py@@ -231,7 +231,7 @@ def _config_default_interface_early() -> str:if os.path.exists(cfg_path):import yaml as _yaml_iface- with open(cfg_path, encoding=utf-8-sig) as _f:+ with open(cfg_path, encoding="utf-8-sig") as _f:raw = _yaml_iface.load(_f, Loader=getattr(_yaml_iface, "CSafeLoader", None) or _yaml_iface.SafeLoader) or {}@@ -512,7 +512,7 @@ def _apply_profile_override() -> None:active_path = get_default_hermes_root() / "active_profile"if active_path.exists():- name = active_path.read_text(encoding=utf-8-sig).strip()+ name = active_path.read_text(encoding="utf-8-sig").strip()if name and name != "default":profile_name = name # consume stays 0: nothing to stripexcept (UnicodeDecodeError, OSError):@@ -782,7 +782,7 @@ def _read_packed_ref(common_dir: Path, ref: str) -> str | None:peel lines and ``#``-prefixed comments / ``# pack-refs with:`` header."""try:- text = (common_dir / "packed-refs").read_text(encoding=utf-8-sig, errors="replace")+ text = (common_dir / "packed-refs").read_text(encoding="utf-8-sig", errors="replace")except OSError:return Nonefor line in text.splitlines():@@ -799,7 +799,7 @@ def _read_git_revision_fingerprint(repo_root: Path) -> str | None:git_dir = repo_root / ".git"try:if git_dir.is_file():- for line in git_dir.read_text(encoding=utf-8-sig, errors="replace").splitlines():+ for line in git_dir.read_text(encoding="utf-8-sig", errors="replace").splitlines():key, _, value = line.partition(":")if key.strip() == "gitdir" and value.strip():git_dir = (repo_root / value.strip()).resolve()@@ -811,12 +811,12 @@ def _read_git_revision_fingerprint(repo_root: Path) -> str | None:commondir_file = git_dir / "commondir"if commondir_file.exists():try:- rel = commondir_file.read_text(encoding=utf-8-sig, errors="replace").strip()+ rel = commondir_file.read_text(encoding="utf-8-sig", errors="replace").strip()if rel:common_dir = (git_dir / rel).resolve()except OSError:pass- head = (git_dir / "HEAD").read_text(encoding=utf-8-sig, errors="replace").strip()+ head = (git_dir / "HEAD").read_text(encoding="utf-8-sig", errors="replace").strip()if head.startswith("ref:"):ref = head.split(":", 1)[1].strip()# Loose refs may live in the worktree gitdir OR the common dir@@ -825,7 +825,7 @@ def _read_git_revision_fingerprint(repo_root: Path) -> str | None:for candidate in (git_dir, common_dir):ref_file = candidate / refif ref_file.exists():- return f"git:{ref}:{ref_file.read_text(encoding=utf-8-sig, errors='replace').strip()}"+ return f"git:{ref}:{ref_file.read_text(encoding='utf-8-sig', errors='replace').strip()}"packed_sha = _read_packed_ref(common_dir, ref)if packed_sha:return f"git:{ref}:{packed_sha}"@@ -862,7 +862,7 @@ def _termux_bundled_skills_sync_needed() -> bool:return Truetry:stamp = _termux_bundled_skills_stamp_path()- return stamp.read_text(encoding=utf-8-sig).strip() != _termux_bundled_skills_fingerprint()+ return stamp.read_text(encoding="utf-8-sig").strip() != _termux_bundled_skills_fingerprint()except OSError:return True@@ -906,7 +906,7 @@ def _dotenv_has_provider_key(env_file: Path, provider_env_vars: set) -> bool:if not env_file.exists():return Falsetry:- for line in env_file.read_text(encoding=utf-8-sig).splitlines():+ for line in env_file.read_text(encoding="utf-8-sig").splitlines():line = line.strip()if line.startswith("#") or "=" not in line:continue@@ -1632,7 +1632,7 @@ def _read_query_file(args) -> None:if _qfile == "-":args.query = sys.stdin.read()else:- with open(_qfile, "r", encoding=utf-8-sig, errors="replace") as _fh:+ with open(_qfile, "r", encoding="utf-8-sig", errors="replace") as _fh:args.query = _fh.read()except OSError as _e:print(f"Error: cannot read --query-file {_qfile}: {_e}", file=sys.stderr)diff --git a/hermes_cli/main_web_build.py b/hermes_cli/main_web_build.pyindex 0d0e810d1bb..4d957139aae 100644--- a/hermes_cli/main_web_build.py+++ b/hermes_cli/main_web_build.py@@ -64,7 +64,7 @@ def _sweep_stale_bytecode_if_checkout_changed() -> None:return # non-git install — the ZIP update path clears explicitlystamp_path = PROJECT_ROOT / _BYTECODE_FINGERPRINT_FILEtry:- recorded = stamp_path.read_text(encoding=utf-8-sig).strip()+ recorded = stamp_path.read_text(encoding="utf-8-sig").strip()except OSError:recorded = ""if recorded == fingerprint:@@ -110,7 +110,7 @@ def _hash_source_tree(project_root: Path, tree_dir: Path) -> str:from pathspec import PathSpecgitignore = project_root / ".gitignore"- lines = gitignore.read_text(encoding=utf-8-sig).splitlines() if gitignore.is_file() else []+ lines = gitignore.read_text(encoding="utf-8-sig").splitlines() if gitignore.is_file() else []spec = PathSpec.from_lines("gitignore", lines)def _ignored(path: Path) -> bool:@@ -141,7 +141,7 @@ def _stamp_is_current(stamp_file: Path, current_hash: Callable[[], str], **expecif not stamp_file.is_file():return Falsetry:- stamp_data = json.loads(stamp_file.read_text(encoding=utf-8-sig))+ stamp_data = json.loads(stamp_file.read_text(encoding="utf-8-sig"))except (OSError, json.JSONDecodeError):return Falseif not isinstance(stamp_data, dict):@@ -285,7 +285,7 @@ def _nixos_build_env() -> dict[str, str] | None:from hermes_cli.main import PROJECT_ROOTimport retry:- os_release = Path("/etc/os-release").read_text(encoding=utf-8-sig)+ os_release = Path("/etc/os-release").read_text(encoding="utf-8-sig")except OSError:return Noneif not re.search(r"^ID=nixos$", os_release, re.M) or shutil.which("python3"):diff --git a/hermes_cli/plugins_state.py b/hermes_cli/plugins_state.pyindex 946334c7561..0089ebd348a 100644--- a/hermes_cli/plugins_state.py+++ b/hermes_cli/plugins_state.py@@ -133,7 +133,7 @@ class PluginState:def _read_unlocked(self) -> dict[str, Any]:try:- with open(self.path, encoding=utf-8-sig) as handle:+ with open(self.path, encoding="utf-8-sig") as handle:data = json.load(handle)except FileNotFoundError:return {}diff --git a/hermes_cli/update_cmd_maint.py b/hermes_cli/update_cmd_maint.pyindex c07ec0a6e88..2068d3cc36d 100644--- a/hermes_cli/update_cmd_maint.py+++ b/hermes_cli/update_cmd_maint.py@@ -636,7 +636,7 @@ def _ensure_fhs_path_guard() -> None:):continuetry:- with cfg.open("a", encoding=utf-8-sig) as f:+ with cfg.open("a", encoding="utf-8-sig") as f:f.write("\n" + path_comment + "\n" + path_line + "\n")except OSError as e:print(f" ⚠ Could not update {cfg}: {e}")diff --git a/hermes_cli/web_routers/memory_providers.py b/hermes_cli/web_routers/memory_providers.pyindex 80c63e1c9cb..c1da206ac21 100644--- a/hermes_cli/web_routers/memory_providers.py+++ b/hermes_cli/web_routers/memory_providers.py@@ -108,7 +108,7 @@ def _read_json_dict(path: Path, what: str) -> Dict[str, Any]:if not path.exists():return {}try:- data = json.loads(path.read_text(encoding=utf-8-sig))+ data = json.loads(path.read_text(encoding="utf-8-sig"))except Exception:_log.warning("Failed to read %s from %s", what, path, exc_info=True)return {}diff --git a/hermes_cli/web_server_lifecycle.py b/hermes_cli/web_server_lifecycle.pyindex 0c19e6eeea0..280d2ba8a76 100644--- a/hermes_cli/web_server_lifecycle.py+++ b/hermes_cli/web_server_lifecycle.py@@ -28,7 +28,7 @@ def _process_start_marker(pid: int) -> str:"""if sys.platform == "linux":try:- stat_line = Path(f"/proc/{pid}/stat").read_text(encoding=utf-8-sig)+ stat_line = Path(f"/proc/{pid}/stat").read_text(encoding="utf-8-sig")except FileNotFoundError as exc:raise ProcessLookupError(pid) from excdiff --git a/plugins/memory/hindsight/setup.py b/plugins/memory/hindsight/setup.pyindex 8da84f58618..e6fdbac3515 100644--- a/plugins/memory/hindsight/setup.py+++ b/plugins/memory/hindsight/setup.py@@ -168,7 +168,7 @@ def run_setup(provider, hermes_home: str, config: dict) -> None:materialized_config = dict(provider_config)with contextlib.suppress(Exception):materialized_config = json.loads(- (Path(hermes_home) / "hindsight" / "config.json").read_text(encoding=utf-8-sig)+ (Path(hermes_home) / "hindsight" / "config.json").read_text(encoding="utf-8-sig"))llm_api_key = (env_writes.get("HINDSIGHT_LLM_API_KEY", "")diff --git a/plugins/memory/honcho/session_migration.py b/plugins/memory/honcho/session_migration.pyindex 2c1e2d1caf5..139e5f25f38 100644--- a/plugins/memory/honcho/session_migration.py+++ b/plugins/memory/honcho/session_migration.py@@ -49,7 +49,7 @@ class SessionMigrationMixin:uploaded = Falsefor filename, upload_name, description, target_kind in _MEMORY_FILES:filepath = memory_path / filename- content = filepath.read_text(encoding=utf-8-sig).strip() if filepath.exists() else ""+ content = filepath.read_text(encoding="utf-8-sig").strip() if filepath.exists() else ""if not content:continuetarget_peer_id = session.user_peer_id if target_kind == "user" else session.assistant_peer_iddiff --git a/plugins/platforms/a2a/protocol.py b/plugins/platforms/a2a/protocol.pyindex c3ab04a3b21..c8cf8642929 100644--- a/plugins/platforms/a2a/protocol.py+++ b/plugins/platforms/a2a/protocol.py@@ -445,7 +445,7 @@ def persist_message(context_id: str, role: str, text: str, task_id: str = "") ->try:path = _conv_path(context_id)path.parent.mkdir(parents=True, exist_ok=True)- with path.open("a", encoding=utf-8-sig) as fh:+ with path.open("a", encoding="utf-8-sig") as fh:fh.write(json.dumps({"ts": time.time(), "role": role, "text": text, "task_id": task_id}, ensure_ascii=False) + "\n")except Exception:pass@@ -454,7 +454,7 @@ def persist_message(context_id: str, role: str, text: str, task_id: str = "") ->def load_conversation(context_id: str, limit: int = 50) -> list[dict]:"""Last *limit* messages for a context (empty list if none / unreadable)."""try:- lines = _conv_path(context_id).read_text(encoding=utf-8-sig).splitlines()+ lines = _conv_path(context_id).read_text(encoding="utf-8-sig").splitlines()except Exception:return []out: list[dict] = []diff --git a/scripts/check_compat_pointers.py b/scripts/check_compat_pointers.pyindex d3572a104dc..6ac79d4c3dc 100644--- a/scripts/check_compat_pointers.py+++ b/scripts/check_compat_pointers.py@@ -41,7 +41,7 @@ def main() -> int:if not MANIFEST.exists():print("compat_manifest.json missing — nothing to check (compat layer already reverted?)")return 0- entries = json.loads(MANIFEST.read_text(encoding=utf-8-sig))["entries"]+ entries = json.loads(MANIFEST.read_text(encoding="utf-8-sig"))["entries"]compat: dict[str, set[str]] = {}for e in entries:compat.setdefault(e["facade"], set()).add(e["name"])@@ -51,7 +51,7 @@ def main() -> int:for path in _py_files():rel = path.relative_to(ROOT)try:- src = path.read_text(encoding=utf-8-sig, errors="ignore")+ src = path.read_text(encoding="utf-8-sig", errors="ignore")tree = ast.parse(src)except SyntaxError:continuediff --git a/tools/mcp_tool_lifecycle.py b/tools/mcp_tool_lifecycle.pyindex fd9519ed657..1410c693308 100644--- a/tools/mcp_tool_lifecycle.py+++ b/tools/mcp_tool_lifecycle.py@@ -40,7 +40,7 @@ def _snapshot_child_pids() -> set:found: set = set()for tid in os.listdir(task_dir):try:- with open(f"{task_dir}/{tid}/children", encoding=utf-8-sig) as f:+ with open(f"{task_dir}/{tid}/children", encoding="utf-8-sig") as f:found.update(int(p) for p in f.read().split() if p.strip())except (FileNotFoundError, OSError, ValueError):continue # thread exited between listdir and opendiff --git a/tools/skills_hub_github.py b/tools/skills_hub_github.pyindex 92d7e617a6f..afb7a2c8eae 100644--- a/tools/skills_hub_github.py+++ b/tools/skills_hub_github.py@@ -130,7 +130,7 @@ class GitHubAuth:now = int(time.time())encoded_jwt = jwt.encode({"iat": now - 60, "exp": now + (10 * 60), "iss": app_id},- key_file.read_text(encoding=utf-8-sig), algorithm="RS256",+ key_file.read_text(encoding="utf-8-sig"), algorithm="RS256",)resp = httpx.post(f"https://api.github.com/app/installations/{installation_id}/access_tokens",diff --git a/tools/skills_sync_optional.py b/tools/skills_sync_optional.pyindex dd7d8626d11..5b665ad98c6 100644--- a/tools/skills_sync_optional.py+++ b/tools/skills_sync_optional.py@@ -46,7 +46,7 @@ def _skill_file_list(skill_dir: Path) -> List[str]:def _load_hub_lock() -> Optional[dict]:"""Parse the skills-hub lock; None when missing or unreadable."""try:- return json.loads((_ss()._skills_dir() / ".hub" / "lock.json").read_text(encoding=utf-8-sig))+ return json.loads((_ss()._skills_dir() / ".hub" / "lock.json").read_text(encoding="utf-8-sig"))except (FileNotFoundError, json.JSONDecodeError, OSError):return Nonediff --git a/tools/write_approval.py b/tools/write_approval.pyindex 000ef2eea68..3acddad122d 100644--- a/tools/write_approval.py+++ b/tools/write_approval.py@@ -270,7 +270,7 @@ def skill_pending_diff(record: Dict[str, Any]) -> str:target_label = payload.get("file_path") or "SKILL.md"with suppress(Exception):p = skill_dir / target_label- current = p.read_text(encoding=utf-8-sig) if p.exists() else ""+ current = p.read_text(encoding="utf-8-sig") if p.exists() else ""if action == "patch":old_s, new_s = payload.get("old_string") or "", payload.get("new_string") or ""