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)
-
Extend AgentTarget type (line 22):
type AgentTarget = "openclaw" | "claude-code" | "hermes" | "nanoclaw";
-
Extend resolveAgentTarget() (lines 24–28) to map --agent hermes and --agent nanoclaw.
-
Skip usage-mode prompt for hermes/nanoclaw — force usageMode = "tool":
const isToolOnlyAgent = agentTarget === "hermes" || agentTarget === "nanoclaw";
const usageMode = isToolOnlyAgent ? "tool" : await resolveUsageMode({ ...existing args });
-
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.
-
Add NanoClaw branch in runOpenClawCommand() — writes operational skill to <repo>/.claude/skills/openmail/SKILL.md. Credential write order:
- Try
spawnSync("onecli", ["secrets", "create", "--name", "OPENMAIL_API_KEY", "--value", apiKey, "--host-pattern", "api.openmail.sh"]).
- If
onecli is missing (ENOENT) or non-zero, fall back to appending to <repo>/.env (works for users on /use-native-credential-proxy).
- 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({...}).
-
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
Part of tracking issue openmailsh/openmail#90.
Summary
Extend
openmail setupwith 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.mdat 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
Changes
src/commands/openclaw.ts(6 changes)Extend
AgentTargettype (line 22):Extend
resolveAgentTarget()(lines 24–28) to map--agent hermesand--agent nanoclaw.Skip usage-mode prompt for hermes/nanoclaw — force
usageMode = "tool":Add Hermes branch in
runOpenClawCommand()— writes skill to~/.hermes/skills/openmail/SKILL.mdand appendsOPENMAIL_*to~/.hermes/.env(shared multi-provider file, never overwrite). New helperappendOpenMailEnvLines(filePath, vars)does idempotent strip-and-rewrite of priorOPENMAIL_*lines.Add NanoClaw branch in
runOpenClawCommand()— writes operational skill to<repo>/.claude/skills/openmail/SKILL.md. Credential write order:spawnSync("onecli", ["secrets", "create", "--name", "OPENMAIL_API_KEY", "--value", apiKey, "--host-pattern", "api.openmail.sh"]).onecliis missing (ENOENT) or non-zero, fall back to appending to<repo>/.env(works for users on/use-native-credential-proxy).{ method: "onecli" | "envFile" }.New helpers:
maybeWarnNotNanoClawV2Dir(root, ctx)(warn-only sanity check forpackage.jsonwith "nanoclaw" or.claude/settings.jsonreferencingnanoclaw-skills),registerNanoClawCredentials({...}).Extend
buildSkillMarkdown()(line 326): signature becomesagent: "openclaw" | "claude-code" | "hermes" | "nanoclaw". Both new agents reuse the claude-code template body. Differences:metadata.hermes: { category: communication, tags: [email, messaging] }. Setup-check grep path:~/.hermes/.env.onecli secrets list 2>/dev/null | grep -q OPENMAIL_API_KEY), falls back togrep -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):Out of scope
runResetSetup()only knows OpenClaw paths. Extending it to clean hermes/nanoclaw installs is deferred. Docs will list manual cleanup commands.openmail statusonly 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.Test plan
openmail setup --agent hermeswrites~/.hermes/skills/openmail/SKILL.mdand appendsOPENMAIL_*to~/.hermes/.envwithout clobbering existing lines.openmail setup --agent hermesstrips and rewritesOPENMAIL_*lines exactly once (idempotent).openmail setup --agent nanoclawfrom a NanoClaw v2 checkout writes.claude/skills/openmail/SKILL.mdand registers credentials via OneCLI when available.openmail setup --agent nanoclawfalls back to.envand surfacesmethod: "envFile".--nanoclaw-path /abs/pathwrites into that path instead of cwd.--nanoclaw-pathflag.