Skip to content

Conversation

@enyst
Copy link
Collaborator

@enyst enyst commented Dec 4, 2025

Summary

  • Implement model-specific repository instruction loading. CLAUDE.md is included only when using Anthropic/Claude models; GEMINI.md is included only when using Gemini models.
  • Wire LLM model identifiers into AgentContext rendering so the filter can be applied without breaking backward compatibility.
  • Add focused unit tests validating the behavior for Claude, Gemini, other providers, and canonical-name routing.

Motivation
This change addresses issue #1282 by ensuring provider-specific instruction files are applied only for the relevant model family. This avoids cross-provider bleed of rules and aligns behavior with prior discussions and PR #1280.

What changed

  • openhands-sdk/openhands/sdk/context/agent_context.py
    • get_system_message_suffix now accepts optional llm_model and llm_model_canonical parameters.
    • Applies a simple vendor check to filter out CLAUDE.md/GEMINI.md skills unless the selected model matches Anthropic(Claude)/Gemini respectively.
  • openhands-sdk/openhands/sdk/agent/base.py
    • Pass LLM.model and LLM.model_canonical_name into AgentContext.get_system_message_suffix(), preserving previous behavior for other skills and custom suffixes.
  • tests/sdk/context/test_agent_context_model_specific.py (new)
    • Adds unit tests to confirm only the matching provider's instructions are included.

Design notes

  • Filtering is done at render time (AgentContext) to keep Skill loading simple and preserve existing patterns.
  • Detection is provider-name based and considers both model and model_canonical_name for proxy scenarios.
  • Backward compatibility maintained: if model is not provided, behavior is unchanged.

Testing

  • Added new tests: tests/sdk/context/test_agent_context_model_specific.py
  • Ran the full AgentContext tests to ensure no regressions: all pass locally.

Closes #1282

Co-authored-by: openhands [email protected]

@enyst 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:39e9569-python

Run

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

All tags pushed for this build

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

About Multi-Architecture Support

  • Each variant tag (e.g., 39e9569-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., 39e9569-python-amd64) are also available if needed

@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

Coverage

Coverage Report •
FileStmtsMissCoverMissing
openhands-sdk/openhands/sdk/context/skills
   skill.py25020219%97–98, 100–108, 110, 113, 117–121, 126, 129, 133, 145–146, 151, 158, 171, 174–175, 177, 181, 184–186, 189–191, 193–195, 198, 201, 204–206, 212, 214–220, 223, 231–232, 240–243, 255–262, 268–269, 272–273, 275, 281–282, 284, 292–302, 309–311, 319–321, 343–344, 346–347, 350, 353–354, 357–361, 364–366, 369–370, 372–374, 382, 385, 387, 391–392, 395–396, 398–400, 402–403, 405, 409, 430–431, 433–436, 438–440, 443–447, 449, 453–454, 456, 459, 473–475, 493, 495–499, 506, 513–517, 522–524, 526, 541, 543, 545–549, 552–555, 589, 591, 593–594, 596–598, 601–604, 607, 609, 612–614, 618–624, 626–627, 629, 632
TOTAL12427567054% 

@enyst enyst marked this pull request as draft December 4, 2025 22:02
…/Anthropic, GEMINI.md only for Gemini. Add Skill.should_include_for_model; plumb through load/load_skills_from_dir; update tests to assert gating at loader.

This aligns filtering with the loader that discovers third-party files.

Co-authored-by: openhands <[email protected]>
@openhands-ai
Copy link

openhands-ai bot commented Dec 4, 2025

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 #1328 at branch `openhands/model-specific-repo-instructions-1282`

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

You can manage your notification settings

…e loader signature; gate vendor files in loader; run format.

Co-authored-by: openhands <[email protected]>
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.

Model-specific repo instructions

2 participants