Feature: Support structured JSON output for Codex reviews
Summary
Investigate integrating codex-plugin-cc into Koan so review results
can be consumed programmatically instead of parsing Markdown.
Findings
/codex:review --json
Although the companion script accepts a --json flag, the actual review
findings are not returned as structured JSON.
The JSON envelope looks roughly like:
{
"review": "Review",
"threadId": "...",
"codex": {
"status": 0,
"stdout": "### Findings\n- [P1] ...",
"stderr": "",
"reasoning": "..."
}
}
The review itself is still Markdown contained in codex.stdout.
Implication for Koan
Koan can reliably parse the outer JSON envelope but would still need to
parse Markdown or free-form text to extract findings.
This is brittle and provider-specific.
Better alternative
The plugin already provides an adversarial-review mode which uses a
JSON Schema.
Example schema:
{
"verdict": "approve | needs-attention",
"summary": "...",
"findings": [
{
"severity": "critical | high | medium | low",
"title": "...",
"body": "...",
"file": "...",
"line_start": 10,
"line_end": 15,
"confidence": 0.95,
"recommendation": "..."
}
],
"next_steps": [
"..."
]
}
This format is much better suited for Koan.
Recommendation
Instead of consuming /codex:review --json, Koan should:
- Prefer
adversarial-review --json.
- Convert the structured output into an internal provider-independent
review model.
- Keep the raw provider output for debugging.
Example:
ReviewResult
├── verdict
├── summary
├── findings[]
├── next_steps[]
├── provider
└── raw_output
Proposed Koan model
@dataclass
class ReviewFinding:
severity: str
title: str
body: str
file: str
line_start: int
line_end: int
confidence: float
recommendation: str
@dataclass
class ReviewResult:
verdict: str
summary: str
findings: list[ReviewFinding]
next_steps: list[str]
provider: str
raw_output: str | None = None
Possible future improvement
If Koan still wants to use the standard review command, consider
extending codex-plugin-cc with a dedicated structured mode that emits
the same JSON schema as adversarial-review.
That would allow all review commands to expose a stable machine-readable
API.
Benefits
- No Markdown parsing
- Stable integration
- Provider-independent architecture
- Easier Slack/GitHub/Telegram formatting
- Easier analytics and severity filtering
- Future support for Claude, Copilot and other review providers
Acceptance Criteria
References
Feature: Support structured JSON output for Codex reviews
Summary
Investigate integrating
codex-plugin-ccinto Koan so review resultscan be consumed programmatically instead of parsing Markdown.
Findings
/codex:review --jsonAlthough the companion script accepts a
--jsonflag, the actual reviewfindings are not returned as structured JSON.
The JSON envelope looks roughly like:
{ "review": "Review", "threadId": "...", "codex": { "status": 0, "stdout": "### Findings\n- [P1] ...", "stderr": "", "reasoning": "..." } }The review itself is still Markdown contained in
codex.stdout.Implication for Koan
Koan can reliably parse the outer JSON envelope but would still need to
parse Markdown or free-form text to extract findings.
This is brittle and provider-specific.
Better alternative
The plugin already provides an adversarial-review mode which uses a
JSON Schema.
Example schema:
{ "verdict": "approve | needs-attention", "summary": "...", "findings": [ { "severity": "critical | high | medium | low", "title": "...", "body": "...", "file": "...", "line_start": 10, "line_end": 15, "confidence": 0.95, "recommendation": "..." } ], "next_steps": [ "..." ] }This format is much better suited for Koan.
Recommendation
Instead of consuming
/codex:review --json, Koan should:adversarial-review --json.review model.
Example:
Proposed Koan model
Possible future improvement
If Koan still wants to use the standard
reviewcommand, considerextending
codex-plugin-ccwith a dedicated structured mode that emitsthe same JSON schema as
adversarial-review.That would allow all review commands to expose a stable machine-readable
API.
Benefits
Acceptance Criteria
JSON.
ReviewResult.References