Hermes source: agent/turn_tool_round.py, agent/turn_context.py, agent/turn_retry_state.py, agent/turn_truncation.py, agent/error_classifier.py.
Mechanics to implement in crates/aien-cli (interactive loop):
- The assistant message that requests tools is written durably to the session store before any tool runs; if that write fails the turn ends with a named reason.
- The exact wire bytes of any injected message are kept as a sidecar so later turns replay byte-identical prompts.
- Failure classification with one-shot recovery flags per attempt (each recovery fires at most once), so no recovery can loop.
- A tool call truncated by the output cap is retried with a raised cap and is never executed with incomplete arguments.
- Credential or provider pool tried before the fallback model chain.
Same idea as AIENOS continuity commits (advance the record, then act), applied to the chat loop.
Acceptance: kill the process between persist and tool run and show the session resumes with the request recorded and no tool side effect lost or doubled; a forced classifier loop terminates in one attempt.
Parent: aien-dev/aien-architecture#267. Research note: aien-architecture docs/research/hermes-agent-prior-art.md. Prior art: Hermes Agent, Nous Research, MIT, commit 5480918 (2026-10-18). No Hermes code is copied; the mechanism is re-implemented from reading. The module header credits Hermes Agent, Nous Research, the MIT licence and the commit. Rust now, pure part effect-free and content-addressed so it can move to Omega (ADR 0024). No Python.
🤖 Generated with Claude Code