Skip to content

Commit 1a46dc9

Browse files
committed
fix: ensure /init command checks for and updates existing AGENTS.md files
- Check for existing AGENTS.md in root directory - Check for existing AGENTS.md in all .roo/rules-*/ directories - Read and improve existing files rather than replacing them - Update discovery phase to explicitly look for these files
1 parent 9847080 commit 1a46dc9

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/services/command/built-in-commands.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ Please analyze this codebase and create an AGENTS.md file containing:
4141
4242
1. Quick scan for existing docs
4343
- AI assistant rules (.cursorrules, CLAUDE.md, AGENTS.md, .roorules)
44+
- Check for existing AGENTS.md in root directory
45+
- Check for existing AGENTS.md in .roo/rules-code/, .roo/rules-debug/, .roo/rules-ask/, .roo/rules-architect/
4446
- README and key documentation
4547
4648
2. Identify stack
@@ -87,6 +89,9 @@ Please analyze this codebase and create an AGENTS.md file containing:
8789
Follow the comprehensive analysis workflow to:
8890
8991
1. **Discovery Phase**: Find existing documentation and AI assistant rules
92+
- Check for existing AGENTS.md in root directory
93+
- Check for existing AGENTS.md files in .roo/rules-*/ directories
94+
- If found, read and improve them rather than replacing
9095
2. **Project Identification**: Identify language, stack, and build system
9196
3. **Command Extraction**: Extract and verify essential commands
9297
4. **Architecture Mapping**: Create visual flow diagrams of core processes
@@ -100,7 +105,8 @@ Please analyze this codebase and create an AGENTS.md file containing:
100105
101106
<output_structure>
102107
<main_file>
103-
Create AGENTS.md with ONLY non-obvious information:
108+
Create or update AGENTS.md with ONLY non-obvious information:
109+
- If AGENTS.md exists, read it first and improve/update it
104110
- Header: "# AGENTS.md\\n\\nThis file provides guidance to agents when working with code in this repository."
105111
- Build/lint/test commands - ONLY if they differ from standard package.json scripts
106112
- Code style - ONLY project-specific rules not covered by linter configs
@@ -138,9 +144,11 @@ Please analyze this codebase and create an AGENTS.md file containing:
138144
└── AGENTS.md # Architect mode specific instructions
139145
\`\`\`
140146
141-
Create mode-specific AGENTS.md files in:
147+
Create or update mode-specific AGENTS.md files in:
142148
143149
.roo/rules-code/AGENTS.md - ONLY non-obvious coding rules discovered by reading files:
150+
- Check if this file already exists and read it first
151+
- Improve and update existing content rather than replacing
144152
- Custom utilities that replace standard approaches
145153
- Non-standard patterns unique to this project
146154
- Hidden dependencies or coupling between components
@@ -157,6 +165,8 @@ Please analyze this codebase and create an AGENTS.md file containing:
157165
\`\`\`
158166
159167
.roo/rules-debug/AGENTS.md - ONLY non-obvious debugging discoveries:
168+
- Check if this file already exists and read it first
169+
- Improve and update existing content rather than replacing
160170
- Hidden log locations not mentioned in docs
161171
- Non-standard debugging tools or flags
162172
- Gotchas that cause silent failures
@@ -173,6 +183,8 @@ Please analyze this codebase and create an AGENTS.md file containing:
173183
\`\`\`
174184
175185
.roo/rules-ask/AGENTS.md - ONLY non-obvious documentation context:
186+
- Check if this file already exists and read it first
187+
- Improve and update existing content rather than replacing
176188
- Hidden or misnamed documentation
177189
- Counterintuitive code organization
178190
- Misleading folder names or structures
@@ -189,6 +201,8 @@ Please analyze this codebase and create an AGENTS.md file containing:
189201
\`\`\`
190202
191203
.roo/rules-architect/AGENTS.md - ONLY non-obvious architectural constraints:
204+
- Check if this file already exists and read it first
205+
- Improve and update existing content rather than replacing
192206
- Hidden coupling between components
193207
- Undocumented architectural decisions
194208
- Non-standard patterns that must be followed

0 commit comments

Comments
 (0)