Preserve user content in agent config files on coldbox ai refresh#43
Merged
lmajano merged 2 commits intodevelopmentfrom Mar 28, 2026
Merged
Conversation
Add COLDBOX-CLI:START/END markers to agent instruction templates so that `coldbox ai refresh` only updates the managed framework section while leaving user-authored documentation intact. - Add <!-- COLDBOX-CLI:START --> and <!-- COLDBOX-CLI:END --> markers to both agent-modern-instructions.md and agent-flat-instructions.md - Restructure templates: all managed content (guidelines, skills, MCP, project info) sits inside the markers; Custom Application Details moves to after the end marker with a note that it won't be overwritten - Add MANAGED_SECTION_START/END static constants to AgentRegistry.cfc - Add private mergeUserContent() helper that extracts the user section from an existing file and appends it to the refreshed managed section - Update configureAgent() to call mergeUserContent() for all agents (including AGENTS.md for Claude) instead of blindly overwriting Agent-Logs-Url: https://github.com/ColdBox/coldbox-cli/sessions/2b2dc668-9136-4fc3-9cec-b1d19209c61b Co-authored-by: lmajano <137111+lmajano@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix CLAUDE.md file overwritten when AI refreshed
Preserve user content in agent config files on Mar 28, 2026
coldbox ai refresh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
coldbox ai refreshblindly overwrites agent config files (e.g.CLAUDE.md/AGENTS.md), destroying any user or AI-agent customizations on every run.Approach
Introduce
<!-- COLDBOX-CLI:START -->/<!-- COLDBOX-CLI:END -->demarcation markers in the generated files. On refresh, only the content between those markers is replaced; everything after the end marker is preserved.Changes
Templates (
agent-modern-instructions.md,agent-flat-instructions.md)COLDBOX-CLI:START/COLDBOX-CLI:ENDmarkersAgentRegistry.cfcMANAGED_SECTION_START/MANAGED_SECTION_ENDstatic constantsmergeUserContent(filePath, newContent)— extracts the user section from an existing file and re-appends it after the refreshed managed block:mergeUserContent()intoconfigureAgent()for all agent types (including Claude'sAGENTS.md)Example of resulting file structure:
⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.