|
| 1 | +# SkillOpt-Sleep — Hermes Agent integration |
| 2 | + |
| 3 | +First-class integration of the [Hermes Agent](https://github.com/NousResearch/Hermes) |
| 4 | +CLI with the shared `skillopt_sleep` engine. Unlike the reference OpenClaw adapter, |
| 5 | +Hermes is wired directly into core: `--source hermes` and `--backend hermes` work from |
| 6 | +the shared CLI, alongside `claude` and `codex`. |
| 7 | + |
| 8 | +## What you get |
| 9 | + |
| 10 | +- **Harvester** (`skillopt_sleep/harvest_hermes.py`) — shells out to the stable |
| 11 | + `hermes sessions export --format jsonl --redact` interface (schema-drift-proof, |
| 12 | + WAL-safe, self-redacting), normalizes sessions into `SessionDigest` records, |
| 13 | + layers its own sanitization, and skips the engine's own throwaway sessions. |
| 14 | + Warns loudly (never silently) when nothing is harvestable. |
| 15 | +- **Backend** (`HermesBackend` in `skillopt_sleep/backend.py`) — drives |
| 16 | + `hermes --profile <name> chat -Q -q "<prompt>"` for the replay/reflect phases. |
| 17 | +- **MCP server** (`mcp_server.py`) — exposes the cycle as MCP tools with Hermes |
| 18 | + defaults, so any MCP client can run it. |
| 19 | + |
| 20 | +## Requirements |
| 21 | + |
| 22 | +- Python 3.10+ |
| 23 | +- The `hermes` CLI installed and authenticated, with at least one profile. |
| 24 | +- Past Hermes **CLI** sessions with message content (`hermes sessions list` should |
| 25 | + show non-empty sessions; ACP/editor-bridge sessions carry no harvestable turns). |
| 26 | + Override the home with `HERMES_HOME`. |
| 27 | + |
| 28 | +## Quick start |
| 29 | + |
| 30 | +```bash |
| 31 | +# 1. Preview — no API spend, no writes: |
| 32 | +python -m skillopt_sleep dry-run --backend mock --source hermes --scope all |
| 33 | + |
| 34 | +# 2. Real cycle through the Hermes CLI, stages a proposal (nothing live changes): |
| 35 | +SKILLOPT_SLEEP_HERMES_PROFILE=default \ |
| 36 | + python -m skillopt_sleep run --backend hermes --source hermes |
| 37 | + |
| 38 | +# 3. Review, then adopt: |
| 39 | +python -m skillopt_sleep status |
| 40 | +python -m skillopt_sleep adopt |
| 41 | +``` |
| 42 | + |
| 43 | +## MCP setup |
| 44 | + |
| 45 | +Copy `mcp-config.example.json` into your client's MCP config (adjust the path), or run |
| 46 | +the server directly: `python plugins/hermes/mcp_server.py`. Cycle actions default to |
| 47 | +`backend=hermes` / `source=hermes`; pass `backend=mock` for a dry, free run. |
| 48 | + |
| 49 | +## Environment |
| 50 | + |
| 51 | +| Variable | Purpose | Default | |
| 52 | +|---|---|---| |
| 53 | +| `HERMES_HOME` | Directory holding `state.db` | `~/.hermes` | |
| 54 | +| `HERMES_BIN` | Path to the hermes binary | `hermes` | |
| 55 | +| `SKILLOPT_SLEEP_HERMES_PROFILE` | Hermes profile for cycle calls | `default` | |
| 56 | +| `SKILLOPT_SLEEP_HERMES_MODEL` | Optional model hint | (unset) | |
| 57 | + |
| 58 | +## What gets evolved (and why) |
| 59 | + |
| 60 | +The Hermes integration evolves **the skill only**, written to where Hermes actually |
| 61 | +discovers global skills: |
| 62 | + |
| 63 | +``` |
| 64 | +~/.hermes/skills/skillopt-sleep-learned/SKILL.md |
| 65 | +``` |
| 66 | + |
| 67 | +The MCP server sets `--target-skill-path` there by default. Run it manually with: |
| 68 | + |
| 69 | +```bash |
| 70 | +python -m skillopt_sleep run --backend hermes --source hermes --no-evolve-memory \ |
| 71 | + --target-skill-path ~/.hermes/skills/skillopt-sleep-learned/SKILL.md |
| 72 | +``` |
| 73 | + |
| 74 | +**Memory is left to Hermes.** The shared engine's memory evolution targets a project |
| 75 | +`CLAUDE.md`, which Hermes does not read — Hermes manages its own memory via `SOUL.md` |
| 76 | +/ `MEMORY.md` and its `curator`/`learning` subsystems. So the Hermes path defaults to |
| 77 | +`--no-evolve-memory` (skill-only) rather than staging a doc Hermes would ignore. Proper |
| 78 | +`AGENTS.md` memory support depends on a future engine `memory_filename` option and is |
| 79 | +intentionally out of scope here. |
| 80 | + |
| 81 | +## Safety |
| 82 | + |
| 83 | +Sessions are harvested read-only and secrets are redacted before anything is persisted. |
| 84 | +The cycle stages proposals; `adopt` is required to change any live file and always backs |
| 85 | +it up first. Harvested text is untrusted — keep tools/plugins disabled when replaying it. |
0 commit comments