Repository navigation
Add support for loading CLAUDE.md and GEMINI.md as repo skills - #1280
Conversation
- 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
- 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>
Coverage Report •
|
||||||||||||||||||||
- 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", |
There was a problem hiding this comment.
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? 🤔
There was a problem hiding this comment.
yeah, this is a good point, also for agents.md i guess
There was a problem hiding this comment.
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. 😂
There was a problem hiding this comment.
I'm on it! enyst can track my progress at all-hands.dev
There was a problem hiding this comment.
Summary of work completed
- Reviewed PR Add support for loading CLAUDE.md and GEMINI.md as repo skills #1280 context and diff to understand the current approach (auto-loading CLAUDE.md and GEMINI.md as always-active repo skills, similar to AGENTS.md and .cursorrules).
- Created a tracking issue to capture the suggestion and ensure it’s included in GPT-5.x tuning:
- Issue Model-specific repo instructions #1282: “Model-specific repo instructions: only load CLAUDE.md/GEMINI.md for matching model; consider per-directory AGENTS.md”
- Link: Model-specific repo instructions #1282
- Included proposal details, backward-compatibility notes, references, open questions, and acceptance criteria.
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.
|
Looks like there are a few issues preventing this PR from being merged!
If you'd like me to help, just leave a comment, like 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(): |
There was a problem hiding this comment.
(Just a side note: the tests look correct, just interestingly verbose - this is for “uppercase works” in 60+ lines 😅)
enyst
left a comment
There was a problem hiding this comment.
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.
|
@OpenHands please fix the pre-commit workflows |
|
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>
SummaryI've successfully fixed the pre-commit workflow issues on PR #1280! Issues FixedThe pre-commit checks were failing due to E501 "Line too long" errors (lines exceeding 88 characters):
Changes Made✅ Fixed all E501 line length violations by breaking long lines appropriately
✅ All 18 tests in The PR should now pass CI checks! |
…ands#1280) Co-authored-by: openhands <openhands@all-hands.dev>
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
claude.mdandgemini.mdtoPATH_TO_THIRD_PARTY_SKILL_NAMEin the Skill classload_skills_from_diron.openhands/skillsor.openhands/microagents)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
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
eclipse-temurin:17-jdknikolaik/python-nodejs:python3.12-nodejs22golang:1.21-bookwormPull (multi-arch manifest)
# Each variant is a multi-arch manifest supporting both amd64 and arm64 docker pull ghcr.io/openhands/agent-server:b751c0e-pythonRun
All tags pushed for this build
About Multi-Architecture Support
b751c0e-python) is a multi-arch manifest supporting both amd64 and arm64b751c0e-python-amd64) are also available if needed