Skip to content

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

Closed
kshitijk4poor wants to merge 6 commits into
NousResearch:mainfrom
kshitijk4poor:feat/skill-prerequisites
Closed

feat: secure skill env setup on load (core #688)#723
kshitijk4poor wants to merge 6 commits into
NousResearch:mainfrom
kshitijk4poor:feat/skill-prerequisites

Conversation

@kshitijk4poor

@kshitijk4poor kshitijk4poor commented Mar 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up PR

Test plan

  • python -m pytest tests/tools/test_skills_tool.py tests/agent/test_skill_commands.py tests/test_cli_secret_capture.py tests/agent/test_prompt_builder.py -q
  • python -m pytest tests/hermes_cli/test_config.py tests/test_run_agent.py tests/tools/test_registry.py -q
  • python -m pytest tests/ -q

All commands pass on this branch.

…dependencies

Skills can now declare runtime prerequisites (env vars, CLI binaries) via
YAML frontmatter. Skills with unmet prerequisites are excluded from the
system prompt so the agent never claims capabilities it can't deliver, and
skill_view() warns the agent about what's missing.

Three layers of defense:
- build_skills_system_prompt() filters out unavailable skills
- _find_all_skills() flags unmet prerequisites in metadata
- skill_view() returns prerequisites_warning with actionable details

Tagged 12 bundled skills that have hard runtime dependencies:
gif-search (TENOR_API_KEY), notion (NOTION_API_KEY), himalaya, imessage,
apple-notes, apple-reminders, openhue, duckduckgo-search, codebase-inspection,
blogwatcher, songsee, mcporter.

Closes NousResearch#658
Fixes NousResearch#630
…ills

This update introduces a new `required_environment_variables` field in skill frontmatter, allowing skills to declare necessary environment variables for secure setup. Skills with missing required variables remain discoverable and trigger a secure prompt during loading, enabling users to input secrets without exposing them to the model. The implementation ensures that platform compatibility is the only hard gating rule for skill visibility.

Changes include:
- Updated `AGENTS.md`, `CONTRIBUTING.md`, and `cli.py` to reflect new setup requirements.
- Modified `tools/skills_tool.py` and `agent/prompt_builder.py` to handle the new metadata and maintain backward compatibility with legacy prerequisites.
- Added tests to verify the behavior of skills with missing environment variables and their handling during skill loading.

Closes #XXX (replace with relevant issue number if applicable).
Drop the implementation plan document from this branch so the PR only carries the actual feature changes.

Made-with: Cursor
@kshitijk4poor kshitijk4poor marked this pull request as draft March 8, 2026 23:20
@kshitijk4poor kshitijk4poor marked this pull request as ready for review March 9, 2026 13:47
Resolved conflicts in:
- agent/prompt_builder.py: keep _parse_skill_file (replaces old helpers)
- cli.py: merge secret capture state + spinner_text field, keep secret methods
- hermes_cli/config.py: keep both re+stat imports, merge save_env_value_secure + stat permissions
- tests/hermes_cli/test_config.py: keep both TestSaveEnvValueSecure and TestSaveConfigAtomicity
- tools/skills_tool.py: use specific exception handling with debug logging
@kshitijk4poor kshitijk4poor changed the title feat: restore skill prerequisites and add secure skill env setup feat: secure skill env setup on load (core #688) Mar 11, 2026
teknium1 pushed a commit that referenced this pull request Mar 13, 2026
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

Copy link
Copy Markdown
Contributor

Merged via PR #1153. Your commits were cherry-picked with authorship preserved and rebased onto current main (264 commits ahead, 7 conflicts resolved). Thank you for the excellent implementation — the secure skill env setup feature is now live! 🎉

Minor improvement made on top: the secret display widget now uses dynamic panel sizing (_panel_box_width()) instead of hardcoded width, matching the sudo/approval widget pattern.

@teknium1 teknium1 closed this Mar 13, 2026
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
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 NousResearch#723 by kshitijk4poor, rebased onto current main
with conflict resolution.

Fixes NousResearch#688

Co-authored-by: kshitijk4poor <kshitijk4poor@users.noreply.github.com>
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
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 NousResearch#723 by kshitijk4poor, rebased onto current main
with conflict resolution.

Fixes NousResearch#688

Co-authored-by: kshitijk4poor <kshitijk4poor@users.noreply.github.com>
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
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 NousResearch#723 by kshitijk4poor, rebased onto current main
with conflict resolution.

Fixes NousResearch#688

Co-authored-by: kshitijk4poor <kshitijk4poor@users.noreply.github.com>
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
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 NousResearch#723 by kshitijk4poor, rebased onto current main
with conflict resolution.

Fixes NousResearch#688

Co-authored-by: kshitijk4poor <kshitijk4poor@users.noreply.github.com>
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