Files
omarchy/bin/omarchy-agent-hermes
T
Spencer BullandCodex XHigh 36353296aa Harden prompted Hermes session handoff
Bind option-looking prompts to one-shot mode, require a successful completed usage report before resuming, replay the prompt after first-run setup, and reject Hermes runtimes that lack the session-report capability.

Co-Authored-By: Codex XHigh <noreply@openai.com>
2026-08-27 23:01:30 -05:00

34 lines
916 B
Bash
Executable File

#!/bin/bash
# omarchy:summary=Seed Hermes literally and resume the resulting interactive session
# omarchy:args=<prompt>
# omarchy:hidden=true
set -euo pipefail
prompt=${1:?usage: omarchy-agent-hermes <prompt>}
usage=$(mktemp)
trap 'rm -f "$usage"' EXIT
# TUI startup queries pass through Hermes' slash, shell, and interpolation
# dispatcher. One-shot treats the prompt literally and records its session ID.
seed_session() {
hermes --yolo --usage-file "$usage" --oneshot="$prompt"
}
if ! seed_session; then
if jq -e '.failed == true and (.failure | strings | startswith("No inference provider configured."))' "$usage" >/dev/null 2>&1; then
hermes setup
seed_session
else
exit 1
fi
fi
session_id=$(jq -er 'select(.completed == true and .failed != true) | .session_id | strings | select(length > 0)' "$usage")
rm -f "$usage"
trap - EXIT
exec hermes chat --yolo --tui --resume "$session_id"