# /etc/systemd/system/xdc-autoresearch.service # Pair with xdc-autoresearch.timer for the every-3-hours schedule. [Unit] Description=XDPoS autoresearch tick (one iteration of measure + claude -p) After=network-online.target Wants=network-online.target [Service] Type=oneshot # Adjust to the user that owns the patient checkout on xdc07 User=xdc Group=xdc # Working directory WorkingDirectory=/opt/xdc/xdpos-autoresearch # Environment Environment=PATIENT=/opt/xdc/XDC-Geth Environment=REFERENCE=/opt/xdc/XDPoSChain Environment=CLAUDE_MODEL=claude-opus-4-7 Environment=MAX_TURNS=30 # Anthropic API key — install via systemctl edit and paste: # [Service] # Environment=ANTHROPIC_API_KEY=sk-ant-... # DO NOT paste the key in this file directly; it gets committed. ExecStart=/opt/xdc/xdpos-autoresearch/tick.sh StandardOutput=append:/var/log/xdc-autoresearch.log StandardError=append:/var/log/xdc-autoresearch.log # Resource controls — autoresearch should be background-priority Nice=10 IOSchedulingClass=best-effort IOSchedulingPriority=7 # Tighter sandboxing — only the patient working tree is writable ProtectSystem=strict ReadWritePaths=/opt/xdc/XDC-Geth /opt/xdc/xdpos-autoresearch /var/log/xdc-autoresearch.log ProtectHome=true NoNewPrivileges=true PrivateTmp=true # Timeout — claude -p with max-turns=30 should finish well under this TimeoutStartSec=1800 [Install] WantedBy=multi-user.target