Skip to content

Add support for loading CLAUDE.md and GEMINI.md as repo skills - #1280

Merged
xingyaoww merged 4 commits into
mainfrom
openhands/add-claude-gemini-support
Nov 29, 2025
Merged

xingyaoww merged 4 commits into
mainfrom
openhands/add-claude-gemini-support

Conversation

@xingyaoww

@xingyaoww xingyaoww commented Nov 29, 2025 •

Copy link
Copy Markdown
Contributor

Summary

This PR adds support for loading CLAUDE.md and GEMINI.md files from the repository root as always-active repo skills, similar to how AGENTS.md and .cursorrules are currently handled.

Changes

  • Added claude.md and gemini.md to PATH_TO_THIRD_PARTY_SKILL_NAME in the Skill class
  • These files are automatically loaded from the repository root (when calling load_skills_from_dir on .openhands/skills or .openhands/microagents)
  • Files are loaded as always-active skills (trigger=None) for LLM-specific instructions
  • Added comprehensive test coverage:
    • test_load_skills_with_claude_gemini - tests lowercase variants (claude.md, gemini.md)
    • test_load_skills_with_uppercase_claude_gemini - tests uppercase variants (CLAUDE.MD, GEMINI.MD)

Testing

  • All 53 skill tests passing
  • Verified both lowercase and uppercase filename variants work correctly
  • Consistent with existing third-party file handling (.cursorrules, AGENTS.md)

Related

This enables OpenHands-CLI issue #143 - allowing users to provide LLM-specific context through dedicated markdown files in their project root.

@xingyaoww can click here to continue refining the PR


Agent Server images for this PR

• GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server

Variants & Base Images

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python amd64, arm64 nikolaik/python-nodejs:python3.12-nodejs22 Link
golang amd64, arm64 golang:1.21-bookworm Link

Pull (multi-arch manifest)

# Each variant is a multi-arch manifest supporting both amd64 and arm64
docker pull ghcr.io/openhands/agent-server:b751c0e-python

Run

docker run -it --rm \
  -p 8000:8000 \
  --name agent-server-b751c0e-python \
  ghcr.io/openhands/agent-server:b751c0e-python

All tags pushed for this build

ghcr.io/openhands/agent-server:b751c0e-golang-amd64
ghcr.io/openhands/agent-server:b751c0e-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:b751c0e-golang-arm64
ghcr.io/openhands/agent-server:b751c0e-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:b751c0e-java-amd64
ghcr.io/openhands/agent-server:b751c0e-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:b751c0e-java-arm64
ghcr.io/openhands/agent-server:b751c0e-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:b751c0e-python-amd64
ghcr.io/openhands/agent-server:b751c0e-nikolaik_s_python-nodejs_tag_python3.12-nodejs22-amd64
ghcr.io/openhands/agent-server:b751c0e-python-arm64
ghcr.io/openhands/agent-server:b751c0e-nikolaik_s_python-nodejs_tag_python3.12-nodejs22-arm64
ghcr.io/openhands/agent-server:b751c0e-golang
ghcr.io/openhands/agent-server:b751c0e-java
ghcr.io/openhands/agent-server:b751c0e-python

About Multi-Architecture Support

  • Each variant tag (e.g., b751c0e-python) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., b751c0e-python-amd64) are also available if needed

- Add claude.md and gemini.md to PATH_TO_THIRD_PARTY_SKILL_NAME
- These files are loaded from the repository root as always-active skills
- Added comprehensive tests for both lowercase and uppercase variants
- All 53 skill tests passing
xingyaoww pushed a commit to OpenHands/OpenHands-CLI that referenced this pull request Nov 29, 2025
- Update pyproject.toml to use agent-sdk branch with CLAUDE/GEMINI support
- Add test to verify CLAUDE.md, GEMINI.md, and AGENTS.MD are loaded from repo root
- All skills loading tests passing
- Relates to agent-sdk PR: OpenHands/software-agent-sdk#1280

Co-authored-by: openhands <openhands@all-hands.dev>
@github-actions

github-actions Bot commented Nov 29, 2025 •

Copy link
Copy Markdown
Contributor

Coverage

Coverage Report •
FileStmtsMissCoverMissing
openhands-sdk/openhands/sdk/context/skills
   skill.py22317720%88, 91, 95, 107–108, 113, 120, 133, 136–137, 139, 143, 146–148, 151–153, 155–157, 160, 163, 166–168, 174, 176–182, 185, 193–194, 202–205, 217–224, 230–231, 234–235, 237, 243–244, 246, 254–264, 271–273, 281–283, 301–302, 304–305, 308, 311–312, 315–319, 322–324, 327–331, 334–335, 337–339, 341–342, 344, 348, 369–370, 372–375, 377–379, 382–386, 388, 392–393, 395, 398, 412–414, 432, 434–438, 445, 452–456, 461–463, 465, 480, 482, 484–488, 491–494, 528, 530, 532–533, 535–537, 540–543, 546, 548, 551–553, 557–561, 563–564, 566, 569
TOTAL12591582353% 

- Truncate third-party files (AGENTS.md, CLAUDE.md, GEMINI.md, .cursorrules) to 10,000 chars
- Use maybe_truncate utility to preserve beginning and end content
- Add THIRD_PARTY_SKILL_MAX_CHARS constant (10,000 characters)
- Log warning when files exceed the limit
- Add comprehensive test for truncation behavior
- All 54 skill tests passing
- Add full filepath to truncation notice so agents can find the file
- Add suggestion 'You can read the full file if needed'
- Update test to verify filepath is included in notice
- All 54 skill tests passing

Co-authored-by: openhands <openhands@all-hands.dev>
"agents.md": "agents",
"agent.md": "agents",
"claude.md": "claude",
"gemini.md": "gemini",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This makes sense of course, but TBH I’m not sure loading all of them in the same run is optimal or even expected: since these are “claude” and “gemini”, I expect them to be loaded when I use the respective model family, not duplicate context…

It seems very unlikely both contain unique info that is not per model? 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah, this is a good point, also for agents.md i guess

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agreed, and on a side note, FWIW codex-cli prompts GPT-5 and GPT-5.1 for it, in their system prompt, for sub-directories. For root directory it loads it automatically. GPT-5.x goes immediately to look for it, never “forgot”.

I think it’s nice it allows for fine-grained agents.md file per directory. It might be worth considering, specially since GPT-5.x really seems to behave well with it in real world feedback I’ve seen. @OpenHands make an issue on this, to remember it as part of GPT-5.x tuning.

The mind-boggling part of it is that the prompts for GPT-5-codex, 5.1-codex and codex-max do NOT include the agents.md part. I suspect OpenAI has tried to include it in parametric knowledge for codex. 😥

Just to make sure we can’t have a single prompt behaving in the same predictable way for their models I guess. 😂

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'm on it! enyst can track my progress at all-hands.dev

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary of work completed

No code changes were made.

Next steps (optional):

  • I can prototype model-family filtering (only loading CLAUDE.md for Claude, GEMINI.md for Gemini) and add tests.
  • I can also draft per-directory AGENTS.md discovery with clear precedence rules and tests.

View full conversation

@openhands-ai

openhands-ai Bot commented Nov 29, 2025

Copy link
Copy Markdown

Looks like there are a few issues preventing this PR from being merged!

  • GitHub Actions are failing:
    • Pre-commit checks

If you'd like me to help, just leave a comment, like

@OpenHands please fix the failing actions on PR #1280 at branch `openhands/add-claude-gemini-support`

Feel free to include any additional details that might help me get this PR into a better state.

You can manage your notification settings



@pytest.fixture
def temp_skills_dir_with_uppercase_context_files():

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(Just a side note: the tests look correct, just interestingly verbose - this is for “uppercase works” in 60+ lines 😅)

@enyst enyst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you! I wasn’t even sure which of these we were loading.

I do think maybe we could load each for its respective model family, it seems better for context and more expected by people. Maybe we can refine in a follow up though.

@xingyaoww

Copy link
Copy Markdown
Contributor Author

@OpenHands please fix the pre-commit workflows

@openhands-ai

openhands-ai Bot commented Nov 29, 2025

Copy link
Copy Markdown

I'm on it! xingyaoww can track my progress at all-hands.dev

- Break long comment lines in skill.py to respect 88 char limit
- Split long multi-line f-string in truncate_notice parameter
- Fix docstring line length in test_skill_utils.py

All pre-commit checks now passing.

Co-authored-by: openhands <openhands@all-hands.dev>
@openhands-ai

openhands-ai Bot commented Nov 29, 2025

Copy link
Copy Markdown

Summary

I've successfully fixed the pre-commit workflow issues on PR #1280!

Issues Fixed

The pre-commit checks were failing due to E501 "Line too long" errors (lines exceeding 88 characters):

  1. openhands-sdk/openhands/sdk/context/skills/skill.py (3 violations):

    • Line 93: Comment line split across 2 lines
    • Lines 99-100: Long multi-line f-string in truncate_notice parameter split across multiple lines
  2. tests/sdk/context/skill/test_skill_utils.py (1 violation):

    • Line 486: Docstring split across 2 lines

Changes Made

✅ Fixed all E501 line length violations by breaking long lines appropriately
✅ Applied ruff auto-formatting (minor whitespace/formatting improvements)
✅ All pre-commit checks now passing:

  • Format YAML files ✓
  • Ruff format ✓
  • Ruff lint ✓
  • PEP8 style check ✓
  • Type check with pyright ✓
  • Check import dependency rules ✓

✅ All 18 tests in test_skill_utils.py still passing
✅ Changes committed and pushed to openhands/add-claude-gemini-support branch

The PR should now pass CI checks!

View full conversation

@xingyaoww
xingyaoww merged commit c5608a1 into main Nov 29, 2025
@xingyaoww
xingyaoww deleted the openhands/add-claude-gemini-support branch November 29, 2025 23:17
StressTestor pushed a commit to StressTestor/software-agent-sdk that referenced this pull request Jun 1, 2026
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.

3 participants