Skip to content

Add --agent hermes and --agent nanoclaw targets to openmail setup #12

Description

@armandokun

Part of tracking issue openmailsh/openmail#90.

Summary

Extend openmail setup with two new agent targets so users can install OpenMail into Hermes Agent and NanoClaw v2 checkouts with a single command. Both new agents are tool-mode only — no WebSocket bridge — and rely on each framework's existing skill auto-discovery contract.

The mechanism: NanoClaw v2 (and Claude Code generally) auto-discovers any .claude/skills/<name>/SKILL.md at the project root. Hermes auto-discovers ~/.hermes/skills/<name>/SKILL.md. Our CLI just writes the file in the right place and registers credentials. No marketplace or plugin install required for the skills to function.

Install UX

# Hermes
npm install -g @openmail/cli
openmail setup --agent hermes

# NanoClaw v2
npm install -g @openmail/cli
cd /path/to/nanoclaw
openmail setup --agent nanoclaw

Changes

src/commands/openclaw.ts (6 changes)

  1. Extend AgentTarget type (line 22):

    type AgentTarget = "openclaw" | "claude-code" | "hermes" | "nanoclaw";
  2. Extend resolveAgentTarget() (lines 24–28) to map --agent hermes and --agent nanoclaw.

  3. Skip usage-mode prompt for hermes/nanoclaw — force usageMode = "tool":

    const isToolOnlyAgent = agentTarget === "hermes" || agentTarget === "nanoclaw";
    const usageMode = isToolOnlyAgent ? "tool" : await resolveUsageMode({ ...existing args });
  4. Add Hermes branch in runOpenClawCommand() — writes skill to ~/.hermes/skills/openmail/SKILL.md and appends OPENMAIL_* to ~/.hermes/.env (shared multi-provider file, never overwrite). New helper appendOpenMailEnvLines(filePath, vars) does idempotent strip-and-rewrite of prior OPENMAIL_* lines.

  5. Add NanoClaw branch in runOpenClawCommand() — writes operational skill to <repo>/.claude/skills/openmail/SKILL.md. Credential write order:

    1. Try spawnSync("onecli", ["secrets", "create", "--name", "OPENMAIL_API_KEY", "--value", apiKey, "--host-pattern", "api.openmail.sh"]).
    2. If onecli is missing (ENOENT) or non-zero, fall back to appending to <repo>/.env (works for users on /use-native-credential-proxy).
    3. Return { method: "onecli" | "envFile" }.

    New helpers: maybeWarnNotNanoClawV2Dir(root, ctx) (warn-only sanity check for package.json with "nanoclaw" or .claude/settings.json referencing nanoclaw-skills), registerNanoClawCredentials({...}).

  6. Extend buildSkillMarkdown() (line 326): signature becomes agent: "openclaw" | "claude-code" | "hermes" | "nanoclaw". Both new agents reuse the claude-code template body. Differences:

    • Hermes: frontmatter adds metadata.hermes: { category: communication, tags: [email, messaging] }. Setup-check grep path: ~/.hermes/.env.
    • NanoClaw: same frontmatter as claude-code. Setup-check tries OneCLI first (onecli secrets list 2>/dev/null | grep -q OPENMAIL_API_KEY), falls back to grep -s OPENMAIL_API_KEY .env. Body explains both credential modes.

src/index.ts (1 change)

Update setup help text (lines 293–323) to document the new agents and add the --nanoclaw-path <path> flag (nanoclaw only, defaults to cwd):

"Usage:",
"  setup [--agent openclaw|claude-code|hermes|nanoclaw]",
"  setup [--nanoclaw-path <path>]  (nanoclaw only — defaults to cwd)",
...
"Agents:",
"  openclaw     OpenClaw integration — skill + env + WebSocket bridge (default)",
"  claude-code  Claude Code integration — skill + env to ~/.claude/",
"  hermes       Hermes integration — skill to ~/.hermes/skills/, env appended to ~/.hermes/.env",
"  nanoclaw     NanoClaw v2 integration — skill to <cwd>/.claude/skills/, credentials via OneCLI vault",

Out of scope

  • runResetSetup() only knows OpenClaw paths. Extending it to clean hermes/nanoclaw installs is deferred. Docs will list manual cleanup commands.
  • openmail status only reads OpenClaw/Claude Code paths. It will report "not configured" for hermes/nanoclaw users until status is extended — openmail setup --agent <name> re-run is the truth source.
  • NanoClaw v1 forks. We commit fully to v2 conventions (operational skills, OneCLI Agent Vault).

Test plan

  • openmail setup --agent hermes writes ~/.hermes/skills/openmail/SKILL.md and appends OPENMAIL_* to ~/.hermes/.env without clobbering existing lines.
  • Re-running openmail setup --agent hermes strips and rewrites OPENMAIL_* lines exactly once (idempotent).
  • openmail setup --agent nanoclaw from a NanoClaw v2 checkout writes .claude/skills/openmail/SKILL.md and registers credentials via OneCLI when available.
  • When OneCLI is not installed, openmail setup --agent nanoclaw falls back to .env and surfaces method: "envFile".
  • --nanoclaw-path /abs/path writes into that path instead of cwd.
  • Setup help text includes both new agents and the --nanoclaw-path flag.
  • No usage-mode prompt fires for hermes/nanoclaw.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions