@@ -3,35 +3,43 @@ type: "always_apply"
33---
44
55# FILE AND CODE MANAGEMENT PROTOCOLS
6+
67## STRICT RULES FOR FILE OPERATIONS AND CODE CHANGES
78
89### FILE SIZE AND ORGANIZATION MANDATE
910
1011#### Rule 1: Reasonable File Size Management
12+
1113- You MUST keep files at reasonable sizes for good workspace organization
1214- Large files SHOULD be split into multiple logical files for ease of use
1315- You MUST verify file sizes using ` wc -c filename ` when working with large content
1416- If a file becomes unwieldy, you MUST suggest splitting it into multiple files
1517
1618#### Rule 2: File Organization Best Practices
19+
1720** MANDATORY APPROACH for file management:**
21+
18221 . Calculate planned content size for new files
19232 . If creating large content: consider logical file splitting
20243 . For existing files: check current size with ` wc -c filename `
21254 . If file is becoming too large: propose splitting strategy to user
22265 . Maintain logical organization and clear file purposes
2327
2428#### Rule 3: Size Monitoring and Reporting
29+
2530** MANDATORY SEQUENCE for large file operations:**
31+
26321 . ` wc -c filename ` to check current file size
27332 . Report file size when working with substantial content
28343 . Suggest file splitting when content becomes unwieldy
29354 . Maintain good workspace organization principles
3036
3137### FILE CREATION PROTOCOLS
3238
33- #### New File Creation Requirements:
39+ #### New File Creation Requirements
40+
3441** MANDATORY SEQUENCE - NO DEVIATIONS:**
42+
35431 . ` view ` directory to confirm file doesn't exist
36442 . ` codebase-retrieval ` to understand project structure and conventions
37453 . Calculate character count of planned content
@@ -45,7 +53,8 @@ type: "always_apply"
4553
4654** SKIPPING ANY STEP = IMMEDIATE TASK TERMINATION**
4755
48- #### File Creation Reporting Format:
56+ #### File Creation Reporting Format
57+
4958```
5059FILE CREATION REPORT:
5160FILENAME: [exact filename]
@@ -60,8 +69,10 @@ COMPLIANCE STATUS: [COMPLIANT/VIOLATION]
6069
6170### FILE MODIFICATION PROTOCOLS
6271
63- #### Existing File Modification Requirements:
72+ #### Existing File Modification Requirements
73+
6474** MANDATORY SEQUENCE - NO DEVIATIONS:**
75+
65761 . ` view ` file to examine current contents and structure
66772 . ` wc -c filename ` to get current size
67783 . ` codebase-retrieval ` to understand context and dependencies
@@ -77,7 +88,8 @@ COMPLIANCE STATUS: [COMPLIANT/VIOLATION]
7788
7889** SKIPPING ANY STEP = IMMEDIATE TASK TERMINATION**
7990
80- #### File Modification Reporting Format:
91+ #### File Modification Reporting Format
92+
8193```
8294FILE MODIFICATION REPORT:
8395FILENAME: [exact filename]
@@ -95,8 +107,10 @@ ERROR CHECK: [diagnostics results]
95107
96108### CODE CHANGE MANAGEMENT
97109
98- #### Pre-Change Requirements:
110+ #### Pre-Change Requirements
111+
99112** MANDATORY VERIFICATION CHAIN:**
113+
1001141 . ` codebase-retrieval ` - understand current implementation thoroughly
1011152 . ` view ` - examine ALL files that will be modified
1021163 . ` diagnostics ` - establish baseline error state
@@ -105,15 +119,18 @@ ERROR CHECK: [diagnostics results]
1051196 . Verify all dependencies and imports exist
1061207 . Confirm no breaking changes to existing functionality
107121
108- #### Change Implementation Rules:
122+ #### Change Implementation Rules
123+
109124- You MUST use ` str-replace-editor ` for ALL existing file modifications
110125- You are FORBIDDEN from using ` save-file ` to overwrite existing files
111126- You MUST specify exact line numbers for all replacements
112127- You MUST ensure ` old_str ` matches EXACTLY (including whitespace)
113128- You MUST make changes in logical, atomic units
114129
115- #### Post-Change Requirements:
130+ #### Post-Change Requirements
131+
116132** MANDATORY VERIFICATION CHAIN:**
133+
1171341 . ` diagnostics ` - verify no new errors introduced
1181352 . ` wc -c ` - verify all modified files comply with size limits
1191363 . ` view ` - spot-check critical changes were applied correctly
@@ -122,23 +139,28 @@ ERROR CHECK: [diagnostics results]
122139
123140### TESTING REQUIREMENTS
124141
125- #### Mandatory Testing Protocol:
142+ #### Mandatory Testing Protocol
143+
126144** You MUST test changes when:**
145+
127146- Any code functionality is modified
128147- New files with executable code are created
129148- Configuration files are changed
130149- Dependencies are modified
131150
132- #### Testing Sequence:
151+ #### Testing Sequence
152+
1331531 . ` diagnostics ` - check for syntax/compilation errors
1341542 . ` launch-process ` - run unit tests if they exist
1351553 . ` launch-process ` - run integration tests if they exist
1361564 . ` launch-process ` - run the application/script to verify functionality
1371575 . ` read-process ` - capture and analyze all test outputs
1381586 . Report test results with exact output details
139159
140- #### Test Failure Protocol:
160+ #### Test Failure Protocol
161+
141162When tests fail:
163+
1421641 . ** IMMEDIATELY** stop further changes
1431652 . ** REPORT** exact test failure details
1441663 . ** ANALYZE** failure using ` diagnostics `
@@ -148,8 +170,10 @@ When tests fail:
148170
149171### ROLLBACK PROCEDURES
150172
151- #### When Changes Fail:
173+ #### When Changes Fail
174+
152175** MANDATORY ROLLBACK SEQUENCE:**
176+
1531771 . ** IMMEDIATELY** stop making further changes
1541782 . ** DOCUMENT** exactly what was changed and what failed
1551793 . ** USE** ` str-replace-editor ` to revert changes in reverse order
@@ -158,21 +182,24 @@ When tests fail:
1581826 . ** PRESENT** failure analysis to user
1591837 . ** AWAIT** user instructions for alternative approach
160184
161- #### Rollback Verification:
185+ #### Rollback Verification
186+
162187- You MUST verify each rollback step using appropriate tools
163188- You MUST confirm system returns to pre-change state
164189- You MUST run tests to verify rollback success
165190- You MUST report rollback completion with evidence
166191
167192### DEPENDENCY MANAGEMENT
168193
169- #### Package Manager Mandate:
194+ #### Package Manager Mandate
195+
170196- You MUST use appropriate package managers for dependency changes
171197- You are FORBIDDEN from manually editing package files (package.json, requirements.txt, etc.)
172198- You MUST use: npm/yarn/pnpm for Node.js, pip/poetry for Python, cargo for Rust, etc.
173199- ** MANUAL PACKAGE FILE EDITING = IMMEDIATE TASK TERMINATION**
174200
175- #### Dependency Change Protocol:
201+ #### Dependency Change Protocol
202+
1762031 . ` view ` current package configuration
1772042 . ` codebase-retrieval ` to understand project dependencies
1782053 . Present dependency change plan to user
@@ -183,14 +210,16 @@ When tests fail:
183210
184211### DOCUMENTATION REQUIREMENTS
185212
186- #### You MUST Document:
213+ #### You MUST Document
214+
187215- Every file created with purpose and structure
188216- Every modification made with rationale
189217- Every test performed with results
190218- Every failure encountered with analysis
191219- Every rollback performed with verification
192220
193- #### Documentation Format:
221+ #### Documentation Format
222+
194223```
195224CHANGE DOCUMENTATION:
196225TIMESTAMP: [when change was made]
@@ -207,19 +236,22 @@ STATUS: [SUCCESS/FAILURE/ROLLED_BACK]
207236### QUALITY GATES
208237
209238#### Gate 1: Pre-Change Verification
239+
210240- [ ] All information gathered and verified
211241- [ ] User approval obtained
212242- [ ] Size limits confirmed
213243- [ ] Dependencies verified
214244- [ ] Test plan established
215245
216246#### Gate 2: Implementation Verification
247+
217248- [ ] Changes made using correct tools
218249- [ ] Size limits maintained
219250- [ ] No syntax errors introduced
220251- [ ] All modifications documented
221252
222253#### Gate 3: Post-Change Verification
254+
223255- [ ] Tests pass or failures documented
224256- [ ] Size compliance verified
225257- [ ] No new errors introduced
0 commit comments