Skip to content

Opt-In feature to use /codex:review from claude cli to improve the quality of a /review mission #2369

Description

@atoomic

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:

  1. Prefer adversarial-review --json.
  2. Convert the structured output into an internal provider-independent
    review model.
  3. 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

  • Koan can execute Codex review commands and receive structured
    JSON.
  • Findings map to an internal ReviewResult.
  • Presentation is handled entirely by Koan.
  • Raw provider output is preserved for debugging.
  • Architecture supports multiple review providers.

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions