← Back to blog

Hermes Agent Adds Quality Gates for /goal Commands

hermesagent-engineeringquality-gatesgoal-verificationautonomous-agents
Hermes Agent Adds Quality Gates for /goal Commands

Three PRs merged into Hermes Agent on August 6, 2026 add new slash commands for long-running autonomous sessions: quality gates for /goal, an idle heartbeat for re-engagement, and on-demand memory review. Together they address a set of failure modes that surface when an agent runs unattended: a completed task with no verification, a stalled session that needs a nudge, and stale memory that never gets reviewed.

All three PRs were authored by @teknium1 and adapt concepts from Prime Intellect's Prime-Agent. They share a design philosophy: the agent should verify its own work before declaring completion, re-engage when idle without external polling, and let the user trigger background maintenance on demand.

Quality gates: post-condition verification for /goal

The centerpiece is PR #79680, which attaches deterministic shell commands to the goal loop. Before the LLM judge evaluates whether a /goal is complete, any registered gates must exit with status 0. A failing gate skips the judge entirely. Its exit code and output tail (up to ~3 KB) become the continuation prompt, so the agent iterates against concrete evidence instead of a prose verdict.

The file breakdown shows where the logic landed:

File Additions Deletions Role
hermes_cli/goals.py +327 -1 Core gate runner and GoalState persistence
tests/hermes_cli/test_goal_gates.py +224 -0 Test coverage (new file)
hermes_cli/cli_commands_mixin.py +44 -1 CLI dispatch for /goal gate subcommands
gateway/slash_commands.py +32 -0 Gateway handler for all platforms
website/docs/user-guide/features/goals.md +24 -0 Documentation
gateway/run.py +4 -2 Gateway integration
Total (7 files) +656 -5

The gate runner sits in hermes_cli/goals.py and fires at the turn boundary, before the LLM judge. This is the critical design choice: a failing gate costs zero LLM tokens because the judge is never called. The gate's output replaces the judge's verdict as the continuation prompt, so the agent works against a specific failure message rather than a general "try again."

Three mechanisms prevent the agent from burning tokens on hopeless loops:

  1. Workspace fingerprinting. Each gate run records the git HEAD and working-tree status at the time of failure. If the workspace is unchanged on the next cycle (identical fingerprint), the gate is not re-run. The recorded failure replays and the attempt counter advances. This prevents a stalled agent from re-running the same red test suite indefinitely.

  2. Bounded retries. Default is 3 retries with a 300-second timeout per gate. Exhaustion auto-pauses the goal the same way the turn budget does. The pause message names the exact gate that failed, so the user can inspect the problem directly.

  3. Gate continuations respect the turn budget. A gate that times out or exhausts its retries does not overflow into unlimited burn. It pauses under the same budget constraints as the goal loop itself.

The interface uses four subcommands: /goal gate add <command>, list, remove <index>, and clear. Multiple gates are supported and run in registration order. The PR closes issue #34196.

/heartbeat: re-engage idle sessions

PR #79681 adds /heartbeat every <interval> <prompt>, which gives a session one recurring instruction that re-enters the conversation as a normal user turn when the session is idle and the interval has elapsed. The mechanism is idle-only: heartbeat turns queue behind real user messages and never interrupt a running turn.

The implementation splits across CLI and gateway paths. On the CLI, a daemon watchdog thread polls and puts the prompt into _pending_input. On the gateway, one async poller injects through the adapter FIFO. A busy session coalesces its tick to the next idle poll, and missed ticks coalesce to a single turn. An hour of busy work yields one heartbeat, not a backlog.

Heartbeat turns are plain user-role messages with no system-prompt mutation or toolset change. They carry a "don't invent work" guard so idle heartbeats reply briefly instead of generating busywork. State persists in SessionDB.state_meta and survives /resume and compression session rotations.

The PR has 927 additions across 11 files and closes issue #62648.

/refine: memory and skill review on demand

PR #79682 is the lightest of the three (175 additions, 9 files) but fills a gap in the agent's maintenance surface. /refine [focus] runs the background memory and skill self-improvement review immediately instead of waiting for the automatic 10-turn memory or 10-iteration skill nudge counters.

The optional focus parameter (/refine save the deploy workflow as a skill) is appended to the review prompt so the fork prioritizes what the user asked for while keeping the same guardrails. Automatic reviews are unchanged. The focus parameter defaults to None and the no-focus prompt is byte-identical to before.

The review runs in a daemon thread against a conversation snapshot, so the live session, message alternation, and prompt cache are untouched. Results surface through the existing review summary callback.

What these three PRs share

The PRs form a coherent surface for long-running agent sessions. Each addresses a different failure mode:

  • Verification failure: the agent completes work but no mechanism confirms it did the right thing. Quality gates make post-condition checks a first-class part of the goal loop.
  • Idle failure: a session is assigned a long-running task and stalls. The heartbeat provides a single re-engagement prompt that fires on idle without external polling.
  • Maintenance failure: memory and skills grow stale across long sessions. /refine lets the user trigger review on demand instead of waiting for automatic counters.

The design pattern is consistent across all three: add a slash command, keep the implementation in-process, and avoid mutating the system prompt or toolset. The gateway path is handled alongside the CLI path so all platforms (Discord, Telegram, Slack, desktop) get the same commands.

The Prime Intellect Prime-Agent lineage is noted in each PR body, but the implementations diverge where Hermes Agent's architecture demands it. Quality gates use workspace fingerprinting and reply-on-identical-fingerprint (Prime-Agent's autonomous gate has no fingerprint concept). Heartbeat is idle-injection only (Prime-Agent supports multiple delivery modes). Refine targets Hermes's memory and skill stores directly (Prime-Agent's Continual Harness has a broader durable-state concept).

[^1]: Teknium. "feat(goals): quality gates — deterministic commands that must pass before /goal completes." NousResearch/hermes-agent PR #79680. August 6, 2026.

[^2]: Teknium. "feat: /heartbeat — recurring session re-entry prompt fired when idle." NousResearch/hermes-agent PR #79681. August 6, 2026.

[^3]: Teknium. "feat: /refine — run the memory/skill self-improvement review on demand." NousResearch/hermes-agent PR #79682. August 6, 2026.

Termagotchi
_

Ryan Underdown

Autodidact. Rarely listens to advice.

Follow on X @catamarammed or GitHub @underdown