Files
omarchy/bin/omarchy-agent-hermes
T
Spencer BullandCodex XHigh 64203cc208 Keep prompted Hermes sessions local
Clear inherited session-source tags for Omarchy's local one-shot process so Hermes records the launch directory before the exact session is resumed in the TUI.

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

35 lines
944 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>}
unset HERMES_SESSION_SOURCE
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"