# Reporter Protocol

> Loaded by the reporter agent to supply operating protocol and invariants for markdown health document generation in the parity-test-d pipeline. Not user-invocable.

- Skill: `gustavo-meilus/reporter-protocol-5` (Agent Skill)
- Install (CLI): `npx skillmds@latest add gustavo-meilus/reporter-protocol-5`
- Raw SKILL.md: https://api.skillmd.com/api/skills/gustavo-meilus/reporter-protocol-5/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: gustavo-meilus (https://skillmd.com/u/gustavo-meilus)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/gustavo-meilus/reporter-protocol-5

---


# Reporter — Operational Protocol

<overview>
The reporter agent reads the structured metrics produced by the scanner, renders a formatted markdown document with sections for high-complexity files, missing docstrings, and long functions, and writes the final output to `{ROOT}/output/parity-test-d-health-report.md`. It is the final step of the parity-test-d Sequential pipeline (Pattern 1) on Tier 1c (Antigravity CLI). The quality bar is: the output markdown must be human-readable and contain all three required sections without truncation.
</overview>

## Protocol

<protocol>

### 1. DISCOVER

1. Read inputs from the orchestrator dispatch context:
   - `metrics_path`: path to `scanner-metrics.json` written by the scanner.
   - `output_path`: path where the final markdown health document must be written (always `{ROOT}/output/parity-test-d-health-report.md`).
   - `state_path`: path to `pipeline-state.json` for status updates.
   - `run_id`: current run identifier.
   - `root`: resolved scope root.
2. Verify `metrics_path` exists and is valid JSON. If the file does not exist: emit `BLOCKED` with message: "Scanner metrics not found at `{metrics_path}`. The scanner step may have failed."
3. Parse the metrics JSON. If JSON is malformed: emit `BLOCKED` with message: "Scanner metrics at `{metrics_path}` are not valid JSON. Re-run the scanner step."

### 2. PROCESS

Render the markdown health document using the following template (populated from the parsed metrics):

```markdown
# Code Health Report — parity-test-d

> Generated by the parity-test-d pipeline (Tier 1c — Antigravity CLI)

## Source

**Directory scanned:** `{metrics.scanned_directory}`
**Files scanned:** {metrics.file_count}

## High-Complexity Files

{If metrics.high_complexity is non-empty, for each entry render:}
- **`{entry.file}`** — complexity score {entry.complexity_score}: {entry.reason}

{If metrics.high_complexity is empty, render:}
- No high-complexity files detected.

## Missing Docstrings

{If metrics.missing_docstrings is non-empty, for each entry render:}
- **`{entry.file}`** — missing docstrings at: {entry.locations joined by ", "}

{If metrics.missing_docstrings is empty, render:}
- No missing docstrings detected.

## Long Functions

{If metrics.long_functions is non-empty, for each entry render:}
- **`{entry.file}`** — `{entry.function}`: {entry.line_count} lines

{If metrics.long_functions is empty, render:}
- No long functions detected.
```

Ensure:
- `## High-Complexity Files` section is present (even if empty with "No ... detected." sentinel).
- `## Missing Docstrings` section is present (same rule).
- `## Long Functions` section is present (same rule).
- No section is left entirely blank or contains placeholder text.

### 3. DELIVER

1. Create the `{ROOT}/output/` directory if it does not exist.
2. Write the rendered markdown to `output_path` using the `Write` tool.
3. Update `pipeline-state.json`:
   - Set `phases[1].status` = `"completed"`.
   - Set `phases[1].outputs` = `[output_path]`.
   - Set top-level `status` = `"completed"`.
   - Set `completed_at` = current ISO-8601 timestamp.
4. Emit terminal status:
   - `DONE` — health document written successfully; all three required sections present.
   - `DONE_WITH_CONCERNS` — document written but one or more sections had no data from metrics (note which and why).
   - `BLOCKED` — metrics file missing or malformed; output not written.

</protocol>

<invariants>
- ALWAYS write the output to exactly `{ROOT}/output/parity-test-d-health-report.md` — never a different path.
- ALWAYS include `## High-Complexity Files`, `## Missing Docstrings`, and `## Long Functions` sections in the output.
- NEVER write partial output — if rendering fails mid-way, do not write the file; emit BLOCKED.
- ALWAYS update `pipeline-state.json` phases[1] and top-level status after writing.
- Emit exactly one terminal status: DONE / DONE_WITH_CONCERNS / NEEDS_CONTEXT / BLOCKED.
</invariants>

