Cubicloop
Iteratively run cubic review, fix actionable issues, and rerun until the review is clean.
Inputs
- Review target:
- Current branch against
main:cubic review --base main - Uncommitted changes:
cubic review - Specific commit:
cubic review --commit <ref>
- Current branch against
- Custom focus (optional):
cubic review --prompt "<instructions>" - Max iterations (optional): default
5
Workflow
1. Preflight
-
Confirm
cubicis available and authenticated. -
Confirm current workspace is a git repo.
-
If the user did not specify a review target, ask a simple choice question:
Do you want to:
- review the current branch against
main - review uncommitted changes
- review a specific commit
- focus on a specific area or problem
- review the current branch against
-
Pick a single review mode based on the user's answer.
Use exactly one of:
--base mainor another explicit base branch- uncommitted changes
--commit <ref>--prompt "<instructions>"
--base, --commit, and --prompt are mutually exclusive. See CLI JSON reference.
2. Iteration Loop (Max 5)
For iteration N from 1 to max:
- Run review and store JSON output:
If using a mode, include it beforemkdir -p .cubicloop cubic review --json > ".cubicloop/iteration-${N}.json"--json(for examplecubic review --base main --json). - Parse issue totals and priority counts directly from the JSON output.
jqis optional; use it only if available. See CLI JSON reference. - Exit early if issue count is
0. - Fix actionable issues in priority order:
P0,P1, then the rest. - For each issue:
- Read the file and line context.
- Decide if actionable or likely false positive.
- Apply a fix for actionable items.
- Record non-actionable items in the report with rationale.
- Run relevant validation (tests/lint/typecheck) when available.
- Continue to next iteration.
3. Exit Conditions
Stop when either condition is true:
- No remaining actionable issues in Cubic output.
- Max iterations reached.
4. Report
After exiting, summarize:
| Field | Value |
|---|---|
| Iterations | N |
| Target mode | uncommitted / base / commit / prompt |
| Issues fixed | N |
| Remaining issues | N |
| Highest remaining priority | P0/P1/P2/P3 or none |
If max iterations are reached, include a short list of remaining issues with file and line.
Output Format
If fully resolved:
Cubicloop complete.
Iterations: 2
Target: --base main
Fixed: 6 issues
Remaining: 0
If not fully resolved:
Cubicloop stopped after 5 iterations.
Target: uncommitted
Fixed: 11 issues
Remaining: 2
Highest left: P1
Remaining issues:
- src/auth.ts:45 [P1] SQL injection vulnerability in user lookup
- src/db.ts:112 [P2] Missing index on user_id column