] [--dry-run] --json` 3. Parse JSON output 4. Return results ## Step 4: Process CLI Response The CLI returns JSON like: **Dry-Run**: ```json { "status": "success", "operation": "cache-clear", "dry_run": true, "would_delete": { "count": 4, "size_bytes": 8483, "entries": [ { "uri": "codex://fractary/old-service/README.md", "size_bytes": 5242, "reason": "Expired 5 days ago" } ] } } ``` **Actual Deletion**: ```json { "status": "success", "operation": "cache-clear", "dry_run": false, "deleted": { "count": 4, "size_bytes": 8483, "entries": [...] }, "cache_stats": { "before": {"total_entries": 42, "total_size_bytes": 3355443}, "after": {"total_entries": 38, "total_size_bytes": 3347960} } } ``` IF status == "success" AND dry_run == true: - Display preview (see OUTPUTS section) - IF scope == "all": Ask for confirmation - STOP (wait for user action) IF status == "success" AND dry_run == false: - Display deletion results (see OUTPUTS section) - DONE ✅ IF status == "failure": - Extract error message from CLI - Return error to caller - DONE (with error) ## Step 5: Handle Confirmation (scope=all only) IF scope == "all" AND dry_run preview shown: - Ask user: "Delete entire cache? This will remove {count} entries ({size})" - Options: - "Yes, delete all" → Retry with confirmed=true, dry_run=false - "Cancel" → STOP - STOP (wait for user choice) ## Step 6: Return Results Display formatted output to user. COMPLETION: Operation complete when results shown.