Skip to content

Conversation

@whywaita
Copy link

@whywaita whywaita commented Oct 29, 2025

Summary

This PR implements automatic loading of user skills from the user's home directory, allowing users to define custom skills that are automatically available across all agents without explicit configuration.

Changes

Core Implementation

  • ✅ Added load_user_skills() function that loads skills from:
    • ~/.openhands/skills/ (primary location)
    • ~/.openhands/microagents/ (legacy support for backward compatibility)
  • ✅ Added load_user_skills field to AgentContext (default: True)
  • ✅ Implemented automatic merging of user skills with explicitly provided skills
  • ✅ Explicit skills take precedence over user skills when names conflict
  • ✅ Skills from ~/.openhands/skills/ take precedence over ~/.openhands/microagents/

API Updates

  • ✅ Exported load_user_skills function from openhands.sdk.context module
  • ✅ Added model validator to AgentContext for automatic user skills loading

Testing

  • ✅ Added comprehensive test suite (tests/sdk/context/skill/test_load_user_skills.py)
    • Tests for loading from both directories
    • Tests for priority and precedence rules
    • Tests for duplicate handling
    • Tests for error handling
    • Tests for AgentContext integration
  • ✅ Updated existing tests to disable user skills loading where appropriate

Behavior

When enabled (default)

  • User skills are automatically loaded from home directory
  • Merged with any explicitly provided skills
  • Duplicate names are handled gracefully (explicit skills take precedence)

When disabled (load_user_skills=False)

  • Only explicitly provided skills are used
  • No automatic loading occurs

Testing

  • All new tests pass
  • Existing tests updated and passing
  • Error handling tested (invalid skills, missing directories)
  • Priority and precedence rules verified

Related

fixes: OpenHands/OpenHands#11483

@blacksmith-sh blacksmith-sh bot requested a review from xingyaoww October 31, 2025 13:00
@blacksmith-sh
Copy link
Contributor

blacksmith-sh bot commented Oct 31, 2025

[Automatic Post]: I have assigned @xingyaoww as a reviewer based on git blame information. Thanks in advance for the help!

all_skills.append(skill)
seen_names.add(name)
else:
logger.debug(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
logger.debug(
logger.warning(

default=None, description="Optional suffix to append to the user's message."
)
load_user_skills: bool = Field(
default=True,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's keep the default to false since we are building a library and we probably don't want to create any surprises for users

Suggested change
default=True,
default=False,

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.

[Bug]: [CLI V1]: User microagents from ~/.openhands/microagents/ not loaded in openhands-cli

2 participants