Purpose: Restructure flat context files into function-based folder structure
Last Updated: 2026-01-06
Action: Scan category for all files and detect structure
Output: List of files with current structure type (flat vs organized)
Action: Categorize each file by function
Categorization Rules:
concepts/examples/guides/lookup/errors/Output: Categorization plan with flagged ambiguous files
Action: Present categorization plan and handle conflicts
Format:
Organizing {category}/ (23 files, flat structure)
Clear categorization (18 files):
concepts/ (8):
✓ authentication.md → concepts/authentication.md
examples/ (5):
✓ jwt-example.md → examples/jwt-example.md
Ambiguous files (5 - need your input):
[?] api-design.md (contains concepts AND steps)
→ [A] Split: concepts/api-design.md + guides/api-design-guide.md
→ [B] Keep as concepts/api-design.md
→ [C] Keep as guides/api-design.md
Conflicts (2):
[!] authentication.md → concepts/auth.md
Target already exists (120 lines)
→ [J] Merge into existing
→ [K] Rename to concepts/authentication-v2.md
→ [L] Skip (keep flat)
Select resolutions (A J or 'auto'):
Validation: MUST wait for user input
Action: Show preview of all changes
Format:
Preview changes:
CREATE directories:
{category}/concepts/
{category}/examples/
{category}/guides/
{category}/lookup/
{category}/errors/
MOVE files (18):
authentication.md → concepts/authentication.md
... (17 more)
SPLIT files (3):
api-design.md → concepts/api-design.md + guides/api-design-guide.md
MERGE files (2):
authentication.md → concepts/auth.md (merge content)
UPDATE:
{category}/README.md
Fix 47 internal references
Dry-run? (yes/no/show-diff):
Dry-run: Simulates changes without executing
Validation: MUST get approval before proceeding
Action: Create backup before making changes
Location: .tmp/backup/organize-{category}-{timestamp}/
Purpose: Enable rollback if needed
Action: Perform the reorganization
Process:
Action: Update navigation and fix references
Process:
Action: Show comprehensive results
Format:
✅ Organized X files into function folders
📁 Created Y new folders
🔀 Split Z ambiguous files
🔗 Fixed N references
💾 Backup: .tmp/backup/organize-{category}-{timestamp}/
Rollback available if needed.
File fits multiple categories (e.g., has concepts AND steps)
Options:
Target file already exists
Options:
Agent suggests best option based on:
/context organize development/
/context organize development/ --dry-run
/context organize development/
/context organize core/