Skip to content

feat(sleep): add Hermes Agent as a first-class backend and transcript source#1

Merged
stanvx merged 3 commits into
mainfrom
feat/hermes-first-class-sleep
Jul 19, 2026
Merged

feat(sleep): add Hermes Agent as a first-class backend and transcript source#1
stanvx merged 3 commits into
mainfrom
feat/hermes-first-class-sleep

Conversation

@stanvx

@stanvx stanvx commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Makes the Hermes Agent CLI a first-class citizen of the skillopt_sleep engine — same tier as claude/codex, not a bolt-on wrapper — plus a plugins/hermes/ folder for parity with the other harness integrations.

Core

  • HermesBackend(CliBackend) driving hermes --profile <name> chat -Q -q, with boilerplate/traceback stripping (_strip_hermes_boilerplate) and error capture; registered in get_backend() for hermes/hermes_chat/hermes_cli.
  • skillopt_sleep/harvest_hermes.py — reads ~/.hermes/state.db, redacts secrets (reusing shared staging._SECRET_PATTERNS), filters meta prompts, and skips the engine's own throwaway sessions.
  • harvest_sources.py, config.py (hermes_home), and CLI --source/--backend choices gain hermes.

Plugin

  • plugins/hermes/: MCP server (hermes defaults), config example, rules snippet, README, SKILL.md.
  • Integration tables in plugins/README.md and docs/sleep/README.md updated; Hermes listed wherever the other harnesses are.

Provenance / optimisations

Ported and slimmed from upstream microsoft#114. Drops the broad, reviewer-blocked training-core model backend and its double-counted token tracker; keeps the redacting harvester variant and the corrected output filter. Reuses shared secret patterns and _project_matches instead of the branch's hand-rolled copies.

Tests

10 new tests (harvest DB queries, engine-session filter, tool inclusion, feedback detection, secret redaction, limits, source routing, backend dispatch, output filtering). Full suite: 80/80 pass.

🤖 Generated with Claude Code

stanvx and others added 3 commits July 19, 2026 20:55
… source

Wires the Hermes Agent CLI into the core skillopt_sleep engine at the same
tier as claude/codex, plus a plugins/hermes/ folder for parity with the other
harness integrations.

Core:
- HermesBackend(CliBackend) driving `hermes --profile <name> chat -Q -q`, with
  boilerplate/traceback stripping and error capture; registered in get_backend
  for hermes/hermes_chat/hermes_cli.
- harvest_hermes.py reads ~/.hermes/state.db, redacts secrets (reusing the
  shared staging._SECRET_PATTERNS), filters meta prompts, and skips the engine's
  own throwaway sessions.
- harvest_sources.py, config.py (hermes_home), and the CLI --source/--backend
  choices gain hermes.

Plugin:
- plugins/hermes/ with an MCP server (hermes defaults), config example, rules
  snippet, README, and SKILL.md; integration tables in plugins/README.md and
  docs/sleep/README.md updated.

Ported and slimmed from upstream PR microsoft#114: drops the broad,
reviewer-blocked training-core model backend and its double-counted token
tracker; keeps the redacting harvester variant and the corrected output filter.

Tests: 10 new (harvest DB queries, engine-session filter, tool inclusion,
feedback detection, secret redaction, limits, source routing, backend dispatch,
output filtering). 80/80 pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… state.db

Reworks the Hermes harvester after validating against a real Hermes Agent
v0.18.2 install: the ported raw-sqlite reader returned nothing because the
current state.db has null cwd on sessions and keeps message content behind the
export/FTS layer (schema drift from the version PR microsoft#114 was written against).

- harvest_hermes now shells out to `hermes sessions export --format jsonl
  --redact` (stable public interface, WAL-safe, self-redacting) and parses the
  per-session JSONL, with content-part normalization matching Hermes's own
  serializer. Filters: --after <since>, --cwd <project> for invoked scope,
  --min-messages 1 to drop empty ACP/editor shells.
- Warns loudly to stderr and returns [] on missing binary / export failure /
  zero matches, instead of a silent no-op.
- Layers our own sanitization + meta-prompt filtering on top of --redact, and
  guards against harvesting the optimizer's own skillopt_sleep_hermes_ tempdirs.
- Tests rewritten to mock the export seam (no hermes binary or sqlite needed);
  84/84 pass. Verified end-to-end against the live hermes CLI.
- Plugin README/SKILL updated to describe the export-based approach.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Makes SkillOpt-Sleep evolve the artifact Hermes actually consumes, and stop
short of the one it doesn't:

- Hermes plugin now defaults --target-skill-path to
  $HERMES_HOME/skills/skillopt-sleep-learned/SKILL.md — where Hermes discovers
  global skills — via the existing managed_skill_path/target_skill_path seam
  (no core change to skill targeting).
- Adds a generic `--no-evolve-memory` CLI flag (exposes the existing
  evolve_memory config bool). The Hermes MCP server passes it for cycle actions:
  the engine's memory doc is a project CLAUDE.md, which Hermes ignores (it owns
  memory via SOUL.md/MEMORY.md + curator), so skill-only avoids staging a doc
  that has no effect.
- Deliberately does NOT add an AGENTS.md/memory_filename core change: it's
  cross-cutting (cycle/staging manifest/memory/adopt), shared by all backends,
  and the wrong surface for Hermes. Deferred as a separate upstream concern.
- Docs updated; new test for the flag. 85/85 pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@stanvx
stanvx merged commit 062809b into main Jul 19, 2026
@stanvx
stanvx deleted the feat/hermes-first-class-sleep branch July 19, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant