---
title: "Code Judgment Endpoint"
method: POST
path: "/api/v1/gm/code-judgment"
tags: ["gm", "gm"]
---

# Code Judgment Endpoint

`POST /api/v1/gm/code-judgment`

## Request

- Base URL: `https://app.goodleads.club` (the document declares no server; this is the origin it was published from)
- URL: `https://app.goodleads.club/api/v1/gm/code-judgment`
- Auth: none declared

Cross-model DoD verdict for a PR. Called by Platform EM before merge decision.

Runs:
  1. Mechanical DoD Checker (deterministic, ~50ms, no LLM)
  2. Code Judgment Agent (OpenAI single-shot, ~3-8s, different model family from Platform EM)
  3. Aggregator (combines verdicts into final decision per tier rules)

Returns an AggregateVerdict as JSON. Platform EM interprets:
  - decision=auto_merge_eligible → proceed with `gh pr merge`
  - decision=advisory_pass       → comment only, advisory review
  - decision=requires_human_ack  → Tier S; route to Google Doc product-level ack
  - decision=block               → do not merge; block_reasons explain why
  - decision=degraded            → judgment unavailable; handle per tier

The `tension_flags` field captures places where Code Judgment disagreed
with Platform EM or where judgment is genuinely ambiguous — these
become Google Doc items for strategic review, not code review.

## Request body

- CodeJudgmentRequest: Payload Platform EM POSTs to /gm/code-judgment for merge-decision support. Platform EM (Anthropic Managed Agent with gh auth) fetches PR data via gh CLI, then forwards it here. The endpoint runs the Mechanical Checker + Code Judgment (GPT) in parallel, aggregates, returns a structured verdict. No GitHub API calls happen inside the endpoint — the API task does not need GITHUB_TOKEN.
  - `pr_number` integer, required
  - `title` string, required
  - `body` string, required
  - `author` string, required
  - `base_sha` string, required
  - `head_sha` string, required
  - `base_updated_at` string, date-time, required
  - `files_changed` string[], required
  - `additions` integer, required
  - `deletions` integer, required
  - `commit_messages` string[], required
  - `ci_conclusion` string, required
  - `ci_checks` object[], required
  - `diff` string, required
  - `matrix_confidence` integer, nullable
  - `platform_em_verdict` object, nullable
  - `labels` string[]
  - `behind_base_by` integer, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/goodleads/apis/formation-gtm-api.md) · [All operations](https://skmtc.dev/goodleads/apis/formation-gtm-api/llms.txt) · [OpenAPI document](https://skmtc.dev/goodleads/apis/formation-gtm-api/revisions/2068d13a82cf?raw)
