atlas-iac/services/hermes/scripts/configure_agent_clients.py
2026-08-10 02:15:34 -03:00

36 lines
1.0 KiB
Python
Executable File

#!/usr/bin/env python3
"""Apply persistent non-interactive settings for managed coding clients."""
from __future__ import annotations
import json
import os
from pathlib import Path
from typing import Any
def configure_claude_state(path: Path) -> None:
"""Disable Claude's long-session resume chooser without losing state."""
value: dict[str, Any] = {}
if path.is_file():
try:
loaded = json.loads(path.read_text(encoding="utf-8"))
except (OSError, json.JSONDecodeError):
loaded = {}
if isinstance(loaded, dict):
value = loaded
value["resumeReturnDismissed"] = True
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(json.dumps(value, indent=2) + "\n", encoding="utf-8")
os.chmod(path, 0o600)
def main() -> None:
"""Configure provider clients under the persistent Hermes home."""
home = Path(os.environ.get("CLAUDE_CONFIG_DIR", "/opt/data/home/.claude"))
configure_claude_state(home / ".claude.json")
if __name__ == "__main__":
main()