Skip to content

feat: secure skill env setup on load (core #688)#1153

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-42bc21fb
Mar 13, 2026
Merged

feat: secure skill env setup on load (core #688)#1153
teknium1 merged 1 commit into
mainfrom
hermes/hermes-42bc21fb

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Merges PR #723 by @kshitijk4poor — rebased onto current main with conflict resolution and minor fixes.

When a skill declares required_environment_variables in its YAML frontmatter, missing env vars trigger a secure TUI prompt (identical to the sudo password widget) when the skill is loaded. Secrets flow directly to ~/.hermes/.env, never entering LLM context.

Key Changes

Core feature (tools/skills_tool.py):

  • New required_environment_variables frontmatter field
  • SkillReadinessStatus enum (AVAILABLE, SETUP_NEEDED, UNSUPPORTED)
  • _capture_required_environment_variables() — orchestrates secure prompting
  • set_secret_capture_callback() — callback pattern (same as sudo)
  • Env var name validation via regex, newline stripping
  • Remote backend handling: conservative setup_needed=True for docker/ssh/modal/etc.
  • Gateway surface detection: never collects secrets in-band

CLI integration (cli.py, hermes_cli/callbacks.py):

  • prompt_for_secret() — 120s TUI prompt with masked input (🔑 icon)
  • Non-TUI fallback via getpass.getpass()
  • Dynamic panel widget sizing using _panel_box_width() (improved over original PR)
  • Key bindings: Enter submits, Ctrl-C/Escape cancels

Skill slash commands (agent/skill_commands.py):

  • build_skill_invocation_message() now routes through skill_view() for env setup
  • Setup status notes added to skill invocation messages

Config (hermes_cli/config.py):

  • save_env_value_secure() — writes to .env with 0o600 permissions
  • Env var name validation, newline stripping, os.environ update

12 skills updated with prerequisites:
gif-search, himalaya, notion, apple-notes/reminders/imessage, codebase-inspection, mcporter, songsee, blogwatcher, duckduckgo-search, openhue

Security: Secrets never enter LLM context. The callback result contains only metadata (stored_as, skipped, validated) — never the secret value.

Merge Details

Original PR #723 was 264 commits behind main with 7 merge conflicts. All conflicts resolved:

  • CONTRIBUTING.md — kept both conditional activation + setup metadata sections
  • cli.py — merged command_running state + secret state, hint height, honcho flush
  • skills/research/duckduckgo-search/SKILL.md — kept both fallback_for_toolsets + prerequisites
  • tests/agent/test_prompt_builder.py — updated imports for renamed function
  • tests/test_run_agent.py — kept current call_llm mock (not stale get_text_auxiliary_client)
  • tools/skills_tool.py — preserved disabled skill filtering + platform check ordering
  • website/docs/user-guide/features/skills.md — kept both conditional activation + secure setup sections

Minor Fix

  • Secret display widget now uses _panel_box_width() for dynamic sizing instead of hardcoded width (matches sudo/approval widget pattern)

Test Plan

  • 3424 tests pass (6 pre-existing failures unrelated to this PR)
  • ~48 new tests covering: skip/cancel, timeout, gateway fallback, legacy prerequisites, 5 remote backends (ssh/docker/modal/singularity/daytona), security (no stdout leak, file perms, redaction, payload sanitization)

Closes #688

Co-authored-by: kshitijk4poor kshitijk4poor@users.noreply.github.com

When a skill declares required_environment_variables in its YAML
frontmatter, missing env vars trigger a secure TUI prompt (identical
to the sudo password widget) when the skill is loaded. Secrets flow
directly to ~/.hermes/.env, never entering LLM context.

Key changes:
- New required_environment_variables frontmatter field for skills
- Secure TUI widget (masked input, 120s timeout)
- Gateway safety: messaging platforms show local setup guidance
- Legacy prerequisites.env_vars normalized into new format
- Remote backend handling: conservative setup_needed=True
- Env var name validation, file permissions hardened to 0o600
- Redact patterns extended for secret-related JSON fields
- 12 existing skills updated with prerequisites declarations
- ~48 new tests covering skip, timeout, gateway, remote backends
- Dynamic panel widget sizing (fixes hardcoded width from original PR)

Cherry-picked from PR #723 by kshitijk4poor, rebased onto current main
with conflict resolution.

Fixes #688

Co-authored-by: kshitijk4poor <kshitijk4poor@users.noreply.github.com>
@teknium1 teknium1 force-pushed the hermes/hermes-42bc21fb branch from 05332b2 to ccfbf42 Compare March 13, 2026 10:14
@teknium1 teknium1 merged commit 98b5536 into main Mar 13, 2026
1 check failed
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…42bc21fb

feat: secure skill env setup on load (core NousResearch#688)
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…42bc21fb

feat: secure skill env setup on load (core NousResearch#688)
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
…42bc21fb

feat: secure skill env setup on load (core NousResearch#688)
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…42bc21fb

feat: secure skill env setup on load (core NousResearch#688)
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.

Feature: Skill Requirements Declaration — Auto-Configure API Keys & MCP Servers on Install

2 participants