Skip to content

Model-specific repo instructions #1282

Closed

Description

@enyst

Update: Split per-directory AGENTS.md concept into a dedicated issue (#1283) and added a reference to GPT-5 prompt-driven behavior.

Scope of this issue now focuses on model-specific repo instructions only:

  • Load CLAUDE.md only when using Claude models
  • Load GEMINI.md only when using Gemini models

Related

Activity

  1. changed the title [-]Model-specific repo instructions: only load CLAUDE.md/GEMINI.md for matching model; consider per-directory AGENTS.md[/-] [+]Model-specific repo instructions[/+] on Nov 29, 2025
  2. enyst commented on Dec 4, 2025

    @enyst
    MemberAuthor

    @OpenHands Fix this issue. Read it carefully and investigate the code, so that the solution you propose is inline with codebase patterns. Send a PR.

  3. openhands-ai commented on Dec 4, 2025

    @openhands-ai
  4. openhands-ai commented on Dec 4, 2025

    @openhands-ai

    Here’s a concise summary of what I implemented and shipped for issue #1282 (Model-specific repo instructions):

    What I changed

    • AgentContext
      • get_system_message_suffix now optionally accepts llm_model and llm_model_canonical.
      • When model info is provided, repo skills are filtered so:
        • CLAUDE.md (skill name "claude") is only included for Anthropic/Claude models.
        • GEMINI.md (skill name "gemini") is only included for Gemini models.
      • If model info is not provided, behavior is unchanged (backward-compatible).
    • AgentBase
      • Passes self.llm.model and self.llm.model_canonical_name to AgentContext.get_system_message_suffix(), enabling model-specific filtering automatically at system prompt construction time.
    • Tests
      • Added tests/sdk/context/test_agent_context_model_specific.py to verify correct inclusion/exclusion for Claude, Gemini, other providers, and canonical-name routing.

    Quality checks

    • Pre-commit hooks (ruff format/lint, pyright, etc.) passed.
    • Unit tests:
      • New file: 4 tests passed.
      • Existing AgentContext tests also passed.

    Why this matches the request

    • CLAUDE.md is used only for Claude/Anthropic models; GEMINI.md only for Gemini models.
    • No change to how skills are loaded; filtering happens at render time, minimizing disruption and preserving current architecture patterns.
    • Backward compatible: existing callers of AgentContext require no changes.

    PR details

    Checklist

    • Implemented model-specific repo instruction filtering: done
    • Ensured backward compatibility: done
    • Added focused tests: done
    • Ran hooks and tests locally: done
    • Opened a PR against main and referenced the issue: done

    If you’d like me to extend vendor detection to additional families or adjust logic for other third-party files, I can follow the same pattern.

    View full conversation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions