Strategies for maintaining review context across delegated tasks and ensuring no information is lost during the orchestration process. Central tracking file for the entire review process .roo/temp/pr-[PR_NUMBER]/review-context.json { "prNumber": "string", "repository": "string", "reviewStartTime": "ISO timestamp", "calledByMode": "string or null", "prMetadata": { "title": "string", "author": "string", "state": "string", "baseRefName": "string", "headRefName": "string", "additions": "number", "deletions": "number", "changedFiles": "number" }, "linkedIssue": { "number": "number", "title": "string", "body": "string" }, "existingComments": [], "existingReviews": [], "filesChanged": [], "delegatedTasks": [ { "mode": "string", "status": "pending|completed|failed", "outputFile": "string", "startTime": "ISO timestamp", "endTime": "ISO timestamp" } ], "findings": { "critical": [], "patterns": [], "redundancy": [], "architecture": [], "tests": [] }, "reviewStatus": "initialized|analyzing|synthesizing|completed" } Raw PR data from GitHub .roo/temp/pr-[PR_NUMBER]/pr-metadata.json All existing comments and reviews .roo/temp/pr-[PR_NUMBER]/existing-feedback.json Output from code mode delegation .roo/temp/pr-[PR_NUMBER]/pattern-analysis.md Output from architect mode delegation .roo/temp/pr-[PR_NUMBER]/architecture-review.md Output from test mode delegation .roo/temp/pr-[PR_NUMBER]/test-analysis.md Synthesized review ready for posting .roo/temp/pr-[PR_NUMBER]/final-review.md Update review-context.json with PR metadata .roo/temp/pr-123/review-context.json .roo/temp/pr-123/review-context.json { ...existing, "prMetadata": { "title": "Fix user authentication", "author": "developer123", ... }, "filesChanged": ["src/auth.ts", "tests/auth.test.ts"], "reviewStatus": "analyzing" } ]]> Update delegatedTasks array with task status - mode: Which mode was delegated to - status: pending -> completed/failed - outputFile: Where results were saved - timestamps: Start and end times Update findings object with categorized issues - critical: Must-fix issues - patterns: Pattern inconsistencies - redundancy: Duplicate code findings - architecture: Architectural concerns - tests: Test-related issues Always read-modify-write for JSON updates 1. Read current context file 2. Parse JSON 3. Update specific fields 4. Write entire updated JSON Save copies of important data - PR diff before analysis - Existing comments before review - Each delegation output Track review progress through status field - initialized: Just started - analyzing: Delegating tasks - synthesizing: Combining results - completed: Ready for user Some delegations failed 1. Mark failed tasks in context 2. Continue with available data 3. Note limitations in final review JSON file becomes invalid 1. Try to recover from backups 2. Reconstruct from individual files 3. Start fresh if necessary Review process interrupted 1. Check reviewStatus field 2. Resume from last completed step 3. Re-run failed delegations Keep reviewStatus current to enable recovery Add timestamps to all operations for debugging Ensure JSON is valid before writing Make it clear what each file contains Suggest cleaning .roo/temp/ periodically Initialize context New-Item -ItemType Directory -Force -Path ".roo/temp/pr-123" .roo/temp/pr-123/review-context.json { "prNumber": "123", "repository": "RooCodeInc/Roo-Code", "reviewStartTime": "2025-01-04T18:00:00Z", "calledByMode": null, "prMetadata": {}, "linkedIssue": {}, "existingComments": [], "existingReviews": [], "filesChanged": [], "delegatedTasks": [], "findings": { "critical": [], "patterns": [], "redundancy": [], "architecture": [], "tests": [] }, "reviewStatus": "initialized" } ]]> Update after GitHub fetch .roo/temp/pr-123/review-context.json .roo/temp/pr-123/review-context.json { ...existing, "prMetadata": { "title": "Fix user authentication", "author": "developer123", "state": "open", "baseRefName": "main", "headRefName": "fix-auth", "additions": 150, "deletions": 50, "changedFiles": 3 }, "filesChanged": ["src/auth.ts", "tests/auth.test.ts", "docs/auth.md"], "reviewStatus": "analyzing" } ]]> Track delegation .roo/temp/pr-123/review-context.json .roo/temp/pr-123/review-context.json { ...existing, "delegatedTasks": [ ...existing, { "mode": "code", "status": "pending", "outputFile": "pattern-analysis.md", "startTime": "2025-01-04T18:05:00Z", "endTime": null } ] } ]]> Synthesize results .roo/temp/pr-123/pattern-analysis.md .roo/temp/pr-123/architecture-review.md .roo/temp/pr-123/test-analysis.md .roo/temp/pr-123/review-context.json { ...existing, "findings": { "critical": ["Missing error handling in auth.ts"], "patterns": ["Inconsistent naming convention"], "redundancy": ["Duplicate validation logic"], "architecture": [], "tests": ["Missing test for edge case"] }, "reviewStatus": "completed" } ]]>