You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: clean up /init command to properly handle existing AGENTS.md files
- Consolidate all AGENTS.md path checking into step 1 with CRITICAL emphasis
- Add explicit instructions for deep dive improvement of existing files
- Remove redundant mentions throughout the workflow
- Emphasize iterating and enhancing existing files, not just appending
- Add clear guidance on cleaning up outdated info and reorganizing
- Make discovery phase the single source of truth for file checking
Copy file name to clipboardExpand all lines: src/services/command/built-in-commands.ts
+66-34Lines changed: 66 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -39,11 +39,23 @@ Please analyze this codebase and create an AGENTS.md file containing:
39
39
<todo_list_creation>
40
40
If the update_todo_list tool is available, create a todo list with these focused analysis steps:
41
41
42
-
1. Quick scan for existing docs
43
-
- 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/
46
-
- README and key documentation
42
+
1. Check for existing AGENTS.md files
43
+
CRITICAL - Check these EXACT paths:
44
+
- ./AGENTS.md (root directory)
45
+
- ./.roo/rules-code/AGENTS.md
46
+
- ./.roo/rules-debug/AGENTS.md
47
+
- ./.roo/rules-ask/AGENTS.md
48
+
- ./.roo/rules-architect/AGENTS.md
49
+
50
+
If ANY of these exist:
51
+
- Read them thoroughly
52
+
- Analyze what's already documented
53
+
- Plan improvements: what to add, update, or clean up
54
+
- Focus on iterating and enhancing, not replacing
55
+
56
+
Also check for other AI assistant rules:
57
+
- .cursorrules, CLAUDE.md, .roorules
58
+
- .cursor/rules/, .github/copilot-instructions.md
47
59
48
60
2. Identify stack
49
61
- Language, framework, build tools
@@ -70,16 +82,14 @@ Please analyze this codebase and create an AGENTS.md file containing:
70
82
- Framework and run commands
71
83
- Directory requirements
72
84
73
-
8. Compile concise AGENTS.md
74
-
- Essential sections only
75
-
- Brief, scannable format
76
-
- Project-specific focus
77
-
78
-
9. Create mode-specific rule directories
79
-
- Create directory structures for the four core modes: .roo/rules-code/, .roo/rules-ask/, .roo/rules-architect/, .roo/rules-debug/
80
-
- Create mode-specific AGENTS.md files with rules specific to that mode's purpose and capabilities
81
-
- These rules should provide additive context and not just repeat the mode definitions
82
-
- Only include rules that you have high confidence are accurate, valuable, and non-obvious
85
+
8. Compile/Update AGENTS.md files
86
+
- If files exist: Deep dive into improving them
87
+
* Clean up outdated information
88
+
* Add newly discovered non-obvious patterns
89
+
* Reorganize for better clarity
90
+
* Ensure consistency across all files
91
+
- If creating new: Follow the non-obvious-only principle
92
+
- Create mode-specific files in .roo/rules-*/ directories
83
93
84
94
Note: If update_todo_list is not available, proceed with the analysis workflow directly without creating a todo list.
85
95
</todo_list_creation>
@@ -88,10 +98,22 @@ Please analyze this codebase and create an AGENTS.md file containing:
88
98
<analysis_workflow>
89
99
Follow the comprehensive analysis workflow to:
90
100
91
-
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
101
+
1. **Discovery Phase**:
102
+
CRITICAL - First check for existing AGENTS.md files at these EXACT locations:
103
+
- ./AGENTS.md (root)
104
+
- ./.roo/rules-code/AGENTS.md
105
+
- ./.roo/rules-debug/AGENTS.md
106
+
- ./.roo/rules-ask/AGENTS.md
107
+
- ./.roo/rules-architect/AGENTS.md
108
+
109
+
If found, perform deep analysis:
110
+
- What information is already captured?
111
+
- What's outdated or incorrect?
112
+
- What non-obvious patterns are missing?
113
+
- How can the organization be improved?
114
+
115
+
Also find other AI assistant rules and documentation
116
+
95
117
2. **Project Identification**: Identify language, stack, and build system
96
118
3. **Command Extraction**: Extract and verify essential commands
97
119
4. **Architecture Mapping**: Create visual flow diagrams of core processes
@@ -105,8 +127,16 @@ Please analyze this codebase and create an AGENTS.md file containing:
105
127
106
128
<output_structure>
107
129
<main_file>
108
-
Create or update AGENTS.md with ONLY non-obvious information:
109
-
- If AGENTS.md exists, read it first and improve/update it
130
+
Create or deeply improve AGENTS.md with ONLY non-obvious information:
131
+
132
+
If AGENTS.md exists:
133
+
- Perform thorough review and enhancement
134
+
- Clean up any outdated or obvious information
135
+
- Add newly discovered non-obvious patterns
136
+
- Improve organization and clarity
137
+
- Ensure it follows the non-obvious-only principle
138
+
139
+
Content should include:
110
140
- Header: "# AGENTS.md\\n\\nThis file provides guidance to agents when working with code in this repository."
111
141
- Build/lint/test commands - ONLY if they differ from standard package.json scripts
112
142
- Code style - ONLY project-specific rules not covered by linter configs
@@ -126,9 +156,20 @@ Please analyze this codebase and create an AGENTS.md file containing:
126
156
</main_file>
127
157
128
158
<mode_specific_files>
129
-
Additionally, create mode-specific rule directories and AGENTS.md files.
130
-
For the complete list of available modes with detailed descriptions, refer to the system prompt.
131
-
The system prompt contains comprehensive information about each mode's purpose, when to use it, and its specific capabilities.
159
+
Create or deeply improve mode-specific AGENTS.md files.
160
+
161
+
CRITICAL: For each of these paths, check if the file exists FIRST:
162
+
- ./.roo/rules-code/AGENTS.md
163
+
- ./.roo/rules-debug/AGENTS.md
164
+
- ./.roo/rules-ask/AGENTS.md
165
+
- ./.roo/rules-architect/AGENTS.md
166
+
167
+
If files exist:
168
+
- Perform deep analysis and improvement
169
+
- Clean up redundant or obvious information
170
+
- Add new non-obvious discoveries
171
+
- Ensure consistency with main AGENTS.md
172
+
- Reorganize for better clarity
132
173
133
174
Example structure:
134
175
\`\`\`
@@ -144,11 +185,7 @@ Please analyze this codebase and create an AGENTS.md file containing:
144
185
└── AGENTS.md # Architect mode specific instructions
145
186
\`\`\`
146
187
147
-
Create or update mode-specific AGENTS.md files in:
148
-
149
188
.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
152
189
- Custom utilities that replace standard approaches
153
190
- Non-standard patterns unique to this project
154
191
- Hidden dependencies or coupling between components
@@ -165,8 +202,6 @@ Please analyze this codebase and create an AGENTS.md file containing:
165
202
\`\`\`
166
203
167
204
.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
170
205
- Hidden log locations not mentioned in docs
171
206
- Non-standard debugging tools or flags
172
207
- Gotchas that cause silent failures
@@ -183,8 +218,6 @@ Please analyze this codebase and create an AGENTS.md file containing:
183
218
\`\`\`
184
219
185
220
.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
188
221
- Hidden or misnamed documentation
189
222
- Counterintuitive code organization
190
223
- Misleading folder names or structures
@@ -201,8 +234,6 @@ Please analyze this codebase and create an AGENTS.md file containing:
201
234
\`\`\`
202
235
203
236
.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
206
237
- Hidden coupling between components
207
238
- Undocumented architectural decisions
208
239
- Non-standard patterns that must be followed
@@ -228,6 +259,7 @@ Please analyze this codebase and create an AGENTS.md file containing:
228
259
- Be extremely concise - if it's obvious, don't include it
229
260
- Every line should prevent a potential mistake or confusion
230
261
- Test: Would an experienced developer be surprised by this information?
262
+
- If updating existing files: Ensure deep improvement, not just appending
231
263
</quality_criteria>
232
264
233
265
Remember: The goal is to create documentation that enables AI assistants to be immediately productive in this codebase, focusing on project-specific knowledge that isn't obvious from the code structure alone.`,
0 commit comments