en un clic
review-loop
// Submit code for automated review via Command Center. Triggers build verification, quality checks, and merge readiness analysis. Iterates on feedback until merge-ready.
// Submit code for automated review via Command Center. Triggers build verification, quality checks, and merge readiness analysis. Iterates on feedback until merge-ready.
| name | review-loop |
| description | Submit code for automated review via Command Center. Triggers build verification, quality checks, and merge readiness analysis. Iterates on feedback until merge-ready. |
| argument-hint | ["optional description of what the code does"] |
You are an autonomous coding agent running a review loop. You trigger Command Center's review pipeline, wait for results, fix any blocking issues yourself, and repeat until the PR is merge-ready.
IMPORTANT: This is a loop. You MUST keep going until the review passes or max attempts are exhausted. Do NOT stop after receiving feedback — fix the issues and re-trigger.
Resolve configuration. Check these sources in order for each value:
APP_URL (Command Center endpoint):
https://command-center.aigora.aiCC_APP_URL env var, or APP_URL in .env.localAPI_SECRET (service-to-service auth):
CC_API_SECRETINTERNAL_API_SECRET in .env.localCC_API_SECRET in their shell profile and stop.# Read CC_API_SECRET from env, fall back to .env.local
echo "${CC_API_SECRET:-$(grep INTERNAL_API_SECRET .env.local 2>/dev/null | cut -d= -f2-)}"
Detect repo and branch from git:
git remote get-url origin 2>/dev/null | sed 's|.*github.com[:/]||;s|\.git$||'
git branch --show-current
Find the PR number:
gh pr view --json number -q .number 2>/dev/null
If no PR exists, tell the user to open a PR first and stop.
Build the prompt text. Check these sources in order:
$ARGUMENTS, use that as the prompt.docs/plans/ or .ai-docs/plans/ that mentions the branch name.gh pr view --json body -q .bodyCall the trigger API using curl. Use python3 -c "import sys,json; ..." for JSON parsing (jq may not be available).
curl -s -X POST "${APP_URL}/api/orchestration/trigger" \
-H "Content-Type: application/json" \
-H "x-internal-api-secret: ${API_SECRET}" \
-d '{"action":"start","repo":"REPO","branch":"BRANCH","prNumber":PR_NUM,"prompt":"PROMPT_TEXT"}'
Extract sessionId from the JSON response using python3. If the response contains an error, show it and stop.
Tell the user: "Review triggered (session: SESSION_ID). Waiting for results..."
Poll the status endpoint. Wait 30 seconds between polls. Use sleep 30 between each curl call.
curl -s "${APP_URL}/api/orchestration/status?repo=REPO&sessionId=SESSION_ID&orgId=legacy-default" \
-H "x-internal-api-secret: ${API_SECRET}"
Parse the JSON response with python3. Check state.phase:
completed → Go to Phase 4 (success)failed → Go to Phase 4 (failure)executing AND the logs mention "waiting for fix" → Go to Phase 5 (fix issues)Keep polling until you reach one of the above terminal/actionable states. Do NOT give up after a few polls.
Tell the user:
state.lastMergeResult.warningsTell the user:
state.errorstate.lastQualityResult and state.lastMergeResultThis is the most important phase. You are an autonomous agent — fix the issues yourself.
Extract findings from the status response:
state.lastMergeResult.blockingIssues — array of blocking issue descriptionsstate.lastMergeResult.summary — detailed markdown summary with findingsstate.lastQualityResult.findings — quality check findings textRead and understand each blocking issue. Common issue types:
pnpm regen-skeleton if availableFix each issue using your normal code editing tools (Read, Edit, Write). Do thorough fixes — don't just add comments or TODOs.
Commit and push the fixes:
git add <specific-files-you-changed>
git commit -m "fix: address review feedback - <brief description>"
git push
Wait 3 minutes for CI and bot reviews to process the new commit. Bot reviewers on the PR need time to analyze the push before Command Center re-reviews:
sleep 180
Nudge the orchestrator to re-review:
curl -s -X POST "${APP_URL}/api/orchestration/trigger" \
-H "Content-Type: application/json" \
-H "x-internal-api-secret: ${API_SECRET}" \
-d '{"action":"fix_pushed","sessionId":"SESSION_ID"}'
Go back to Phase 3 (poll again). The orchestrator will re-run build verification, quality check, and merge readiness on your new code.
Repeat Phase 3→5 until the review passes or fails permanently.
jq — it may not be available. Use python3 -c "import sys,json; data=json.load(sys.stdin); print(data['key'])" for JSON parsing.sleep 30 between them.