feat(sleep): add Hermes Agent as a first-class backend and transcript source#1
Merged
Conversation
… 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes the Hermes Agent CLI a first-class citizen of the
skillopt_sleepengine — same tier as claude/codex, not a bolt-on wrapper — plus aplugins/hermes/folder for parity with the other harness integrations.Core
HermesBackend(CliBackend)drivinghermes --profile <name> chat -Q -q, with boilerplate/traceback stripping (_strip_hermes_boilerplate) and error capture; registered inget_backend()forhermes/hermes_chat/hermes_cli.skillopt_sleep/harvest_hermes.py— reads~/.hermes/state.db, redacts secrets (reusing sharedstaging._SECRET_PATTERNS), filters meta prompts, and skips the engine's own throwaway sessions.harvest_sources.py,config.py(hermes_home), and CLI--source/--backendchoices gainhermes.Plugin
plugins/hermes/: MCP server (hermes defaults), config example, rules snippet, README, SKILL.md.plugins/README.mdanddocs/sleep/README.mdupdated; 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_matchesinstead 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