Skip to content

feat(container): add agent profile abstraction for Hermes support#36

Merged
nnemirovsky merged 2 commits intomainfrom
agent-profile-hermes
May 7, 2026
Merged

feat(container): add agent profile abstraction for Hermes support#36
nnemirovsky merged 2 commits intomainfrom
agent-profile-hermes

Conversation

@nnemirovsky
Copy link
Copy Markdown
Owner

Summary

Sluice's container managers (Docker, Apple Container, tart) had ~/.openclaw/.env, secrets.reload, and wire-mcp hardcoded. This PR introduces an AgentProfile so the same managers can target other agents.

Two profiles ship in this PR:

  • openclaw (default) keeps existing behavior. Env file stays at ~/.openclaw/.env. Reload and MCP wiring still go through the openclaw gateway WebSocket RPC.
  • hermes targets nousresearch/hermes-agent. Env file is ~/.hermes/.env. MCP wiring patches mcp_servers.<name>.url in ~/.hermes/config.yaml via a small embedded python3 + pyyaml script. Hermes has no documented in-place secret reload, so ReloadCmd is nil and ReloadSecrets logs a notice and returns without erroring.

Selectable via --agent <name> (or SLUICE_AGENT_PROFILE). Default is openclaw, so existing setups need no changes.

Adding a third profile is a single edit to internal/container/agent_profile.go.

Caveats for the Hermes profile

  • Sluice cannot trigger Hermes' /reload-mcp slash command after wiring. The operator restarts Hermes once after sluice first writes the config, or runs /reload-mcp from the chat session.
  • Hermes' Modal, Daytona, and Vercel Sandbox terminal backends run code on third-party infrastructure that sluice cannot intercept. The local and Docker Hermes backends are the supported targets.

Test plan

  • go build ./...
  • go test ./... (2431 passed across 13 packages)
  • gofumpt -l clean
  • go vet ./... clean
  • golangci-lint run ./internal/container/ ./cmd/sluice/ clean
  • New unit tests cover ProfileFromName, the Hermes env script path, and the Docker manager under both profiles
  • CI: test, e2e-linux, e2e-macos, gofumpt, golangci-lint, openapi

Introduce AgentProfile so container managers (Docker, Apple Container,
tart) stay agent-agnostic. Each profile carries the env file path,
secrets-reload command, and MCP wiring command for one agent runtime.

OpenclawProfile preserves existing behavior (default). HermesProfile
targets nousresearch/hermes-agent: writes phantom tokens to
~/.hermes/.env and patches mcp_servers in ~/.hermes/config.yaml via a
small embedded python+pyyaml script. Hermes has no in-place reload;
ReloadCmd is nil and ReloadSecrets logs a notice.

Selectable via --agent (or SLUICE_AGENT_PROFILE).
@nnemirovsky nnemirovsky requested a review from Copilot May 7, 2026 04:12
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Introduces an AgentProfile abstraction so container managers can target multiple agents (default openclaw, plus new hermes) without hardcoded env/reload/MCP wiring behavior.

Changes:

  • Add AgentProfile registry with OpenClaw + Hermes implementations (env path, reload, MCP wiring).
  • Thread the selected profile through Docker/Apple/tart managers and CLI via --agent / SLUICE_AGENT_PROFILE.
  • Expand docs and add unit tests covering profile resolution, Hermes wiring, and Docker behavior per profile.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/container/types.go Generalize env injection script to be profile-driven (env file path).
internal/container/tart.go Add profile plumbing; make reload + MCP wiring profile-specific.
internal/container/docker.go Add profile plumbing; make env/reload/wire behavior profile-specific.
internal/container/apple.go Add profile plumbing; make env/reload/wire behavior profile-specific.
internal/container/agent_profile.go Introduce AgentProfile, built-in OpenClaw/Hermes profiles, and Hermes YAML wiring script.
internal/container/agent_profile_test.go Add tests for profile resolution and profile command/script expectations.
internal/container/docker_test.go Add Docker manager tests validating Hermes-specific env path + MCP wiring behavior.
cmd/sluice/main.go Add --agent flag, resolve profile early, and pass it into managers/VM setup.
README.md Update positioning to “AI Agents” and document agent profiles table + Hermes caveats.
CLAUDE.md Document --agent and the Agent Profiles abstraction + Hermes caveats.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/container/docker.go Outdated
Comment thread internal/container/types.go Outdated
Comment thread internal/container/agent_profile.go
…rmat

- Sort known profiles in ProfileFromName error message for stable output.
- Validate AgentProfile.EnvFileRelPath before interpolating into the
  shell snippet to block command injection via dynamic profiles.
- Gate the exit-137 swallow in DockerManager.WireMCPGateway to the
  openclaw profile so a real OOM under hermes is not masked.
- gofumpt -w across files unchanged on main; CI pinned to gofumpt@latest
  pulled in v0.10.0 with stricter rules.
@nnemirovsky nnemirovsky merged commit 9cd1a3e into main May 7, 2026
6 checks passed
@nnemirovsky nnemirovsky deleted the agent-profile-hermes branch May 7, 2026 04:22
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.

2 participants