Skip to content

Make CLAUDE.md point to AGENTS.md instead of duplicating content#40

Merged
lmajano merged 2 commits intodevelopmentfrom
copilot/update-claude-md-references
Mar 27, 2026
Merged

Make CLAUDE.md point to AGENTS.md instead of duplicating content#40
lmajano merged 2 commits intodevelopmentfrom
copilot/update-claude-md-references

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 27, 2026

When coldbox ai install configured the Claude agent, CLAUDE.md and AGENTS.md were generated with identical content. Claude Code supports the @AGENTS.md import directive, so CLAUDE.md can simply delegate to the shared file.

Changes

  • models/AgentRegistry.cfc — In configureAgent(), when agent is claude:

    • Full content is written to AGENTS.md (shared with Codex/OpenCode)
    • CLAUDE.md is written with just @AGENTS.md
    • AGENTS.md path is derived from the already-normalized configPath via getDirectoryFromPath() to avoid trailing-slash edge cases
  • AI_INTEGRATION.md / README.md — Updated supported agents table and descriptions to reflect CLAUDE.md → AGENTS.md

  • changelog.md — Added unreleased entry

Result

# CLAUDE.md (generated)
@AGENTS.md

All configuration content lives in AGENTS.md; users switching between Claude and Codex/OpenCode share a single source of truth.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Update CLAUDE.md to point to AGENTS.md Make CLAUDE.md point to AGENTS.md instead of duplicating content Mar 27, 2026
Copilot AI requested a review from lmajano March 27, 2026 10:28
@lmajano lmajano marked this pull request as ready for review March 27, 2026 10:31
Copilot AI review requested due to automatic review settings March 27, 2026 10:31
@lmajano lmajano merged commit 0706c63 into development Mar 27, 2026
5 checks passed
@lmajano lmajano deleted the copilot/update-claude-md-references branch March 27, 2026 10:31
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR reduces duplicated AI agent configuration by generating a single shared AGENTS.md file and making Claude’s CLAUDE.md delegate to it via Claude Code’s @AGENTS.md import directive.

Changes:

  • Update AgentRegistry.configureAgent() so claude writes full config to AGENTS.md and writes CLAUDE.md as @AGENTS.md.
  • Update documentation to reflect CLAUDE.md → AGENTS.md behavior.
  • Add an Unreleased changelog entry describing the change.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
models/AgentRegistry.cfc Generates shared AGENTS.md for Claude and writes a delegating CLAUDE.md.
AI_INTEGRATION.md Updates agent file descriptions and the supported agents table to reflect delegation.
README.md Updates supported agents description to note CLAUDE.md → AGENTS.md.
changelog.md Adds an Unreleased note about the new delegation behavior.

Comment on lines +156 to +161
// For Claude, write the full content to AGENTS.md and make CLAUDE.md point to it
if ( arguments.agent == "claude" ) {
var agentsFilePath = getDirectoryFromPath( configPath ) & "AGENTS.md"
fileWrite( agentsFilePath, content )
fileWrite( configPath, "@AGENTS.md" )
return
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

configureAgent() now makes Claude depend on a shared AGENTS.md, but the rest of the system still treats Claude as having only CLAUDE.md. This can leave the install in a broken state without detection (e.g., ai doctor/AgentRegistry.diagnose() won’t warn if AGENTS.md is missing, and removing codex/opencode will delete AGENTS.md even if claude is still configured, leaving CLAUDE.md pointing at a non-existent file). Update the agent health/removal logic to model AGENTS.md as a shared dependency and only delete it when no configured agents require it, and ensure diagnostics validate both files for Claude.

Copilot uses AI. Check for mistakes.
Comment on lines +156 to +160
// For Claude, write the full content to AGENTS.md and make CLAUDE.md point to it
if ( arguments.agent == "claude" ) {
var agentsFilePath = getDirectoryFromPath( configPath ) & "AGENTS.md"
fileWrite( agentsFilePath, content )
fileWrite( configPath, "@AGENTS.md" )
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

This block hardcodes both the shared filename (AGENTS.md) and recomputes the directory via getDirectoryFromPath( configPath ) even though configDir is already available. Consider deriving the shared path from the existing agent-path mapping (e.g., via getAgentConfigPath(directory, "codex") or static.AGENT_FILES) and using configDir to avoid future divergence if agent filenames/locations change.

Suggested change
// For Claude, write the full content to AGENTS.md and make CLAUDE.md point to it
if ( arguments.agent == "claude" ) {
var agentsFilePath = getDirectoryFromPath( configPath ) & "AGENTS.md"
fileWrite( agentsFilePath, content )
fileWrite( configPath, "@AGENTS.md" )
// For Claude, write the full content to the shared agent file (e.g. AGENTS.md)
if ( arguments.agent == "claude" ) {
var sharedAgentFileName = static.AGENT_FILES[ "codex" ]
var agentsFilePath = configDir & sharedAgentFileName
fileWrite( agentsFilePath, content )
fileWrite( configPath, "@" & sharedAgentFileName )

Copilot uses AI. Check for mistakes.
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