> ## Documentation Index
> Fetch the complete documentation index at: https://claritylabs.inc/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# PCE Submission Packets: Generation and Quality Review

> Generate carrier-ready PCE submission packets, run quality gate checks, and complete the review checklist before handing off to a licensed reviewer.

A `PceSubmissionPacket` bundles everything a licensed reviewer needs to assess a policy change request: the normalized change items, generated carrier artifacts, validation issues, missing-info questions, and a creation timestamp. You generate one after the PCE state machine has run to completion and all blocking issues are resolved.

## Generating a Packet

You can generate a packet in two ways — through the agent instance or by calling the standalone builder directly.

```typescript Agent method theme={"system"}
// Using the agent instance (recommended for most workflows)
const packet = pce.generateSubmissionPacket({ state });
```

```typescript Standalone builder theme={"system"}
import { buildPceSubmissionPacket } from "@claritylabs/cl-sdk";

// Pass state and a Unix timestamp (milliseconds)
const packet = buildPceSubmissionPacket(state, Date.now());
```

Both produce an identical `PceSubmissionPacket`. Use the standalone builder when you need to generate packets outside the agent lifecycle — for example, in a background job or when reconstructing a packet from a persisted state.

***

## Packet Structure

```typescript theme={"system"}
interface PceSubmissionPacket {
  id: string;
  caseId: string;
  pceCase: PceCaseState;
  artifacts: CasePacketArtifact[];
  validationIssues: CaseValidationIssue[];
  missingInfoQuestions: PceMissingInfoQuestion[];
  createdAt: number;
}
```

**id** `string`

Deterministic packet ID derived from the case ID and creation timestamp. Safe for deduplication across retries.

**caseId** `string`

The case ID you provided when calling `processChangeRequest()`.

**pceCase** `PceCaseState`

The complete case state snapshot at the time of packet generation. Includes `items`, `impacts`, `evidenceSources`, `executionMode`, and all validation context.

**artifacts** `CasePacketArtifact[]`

Generated carrier artifacts. A complete packet typically includes:

| Artifact type | Description |
| - | - |
| `underwriter_summary` | Human-readable summary of all changes and their policy impact |
| `email_draft` | Carrier intake email pre-populated with change details |
| `missing_info_request` | Formatted request for any still-outstanding information |
| `json_packet` | Machine-readable JSON of all normalized change items |
| `validation_report` | Full validation issue list with severity and field references |

**validationIssues** `CaseValidationIssue[]`

Top-level validation issues surfaced from `pceCase.validationIssues`. Blocking issues here indicate the packet is not yet submission-ready.

**missingInfoQuestions** `PceMissingInfoQuestion[]`

Outstanding questions at packet generation time. If this list is non-empty, the packet is considered incomplete.

**createdAt** `number`

Unix timestamp (milliseconds) when the packet was built.

***

## Running a Quality Report

Before presenting a packet for review, run `buildPceQualityReport()` to get a structured assessment of submission readiness.

```typescript theme={"system"}
import { buildPceQualityReport } from "@claritylabs/cl-sdk";

const report = buildPceQualityReport(state);

if (report.qualityGateStatus === "failed") {
  // Keep the case in draft and surface blocking issue counts to the user.
  console.log(`${report.blockingIssues} blocking issue(s), ${report.missingInfoCount} missing-info question(s)`);
}
```

**qualityGateStatus** `"passed" | "warning" | "failed"`

Overall readiness signal. `"passed"` means no blocking issues and no missing-info questions. `"warning"` means warning-level issues exist but the case can proceed to review. `"failed"` means blocking issues or ungrounded existing values must be resolved first.

**blockingIssues** `number`

Count of validation issues with `severity === "blocking"`. When this is greater than zero, `qualityGateStatus` will be `"failed"`.

**warningIssues** `number`

Count of validation issues with `severity === "warning"`. Non-zero values set `qualityGateStatus` to `"warning"` when no blocking issues are present.

**missingInfoCount** `number`

Number of unresolved missing-info questions at report time. Non-zero values set `qualityGateStatus` to at least `"warning"`.

**ungroundedExistingValueCount** `number`

Number of change items whose `beforeValue` is set but have no source span IDs to back it up. These count as blocking issues and set `qualityGateStatus` to `"failed"`.

***

## Review Checklist

Work through this checklist before treating a packet as ready to hand off to a carrier.

**1. Verify change items**

Confirm that every `PolicyChangeItem` in `packet.pceCase.items` has the expected `action` (`add` | `modify` | `remove`), the correct `fieldPath`, and a `proposedValue` that matches what was requested. Flag any items where the model mis-parsed the intent.

**2. Check required details**

Ensure that all carrier-required fields are present — typically effective date, vehicle information (for auto endorsements), named insured details, and policy number. Check `packet.missingInfoQuestions` for any fields the agent flagged as absent.

**3. Verify citations**

For each item, confirm that `citations[n].quote` is genuinely present in the referenced source text. Open `packet.pceCase.evidenceSources` and locate the `sourceId` referenced by each citation. Mismatched quotes indicate a grounding failure.

**4. Resolve blocking validation issues**

Open `packet.validationIssues`, filter to `severity === "blocking"`, and either resolve each issue or document an intentional override with a reason before sending to the carrier.

**5. Review the carrier email artifact**

Find the `email_draft` artifact in `packet.artifacts`. Confirm that the tone, format, and field values match the carrier's requested intake format. Edit the draft as needed before sending.

> [!WARNING]
>
> Never send the `email_draft` artifact to a carrier without a licensed user reviewing it first. The SDK generates draft content based on parsed evidence — it is not a substitute for professional judgment on coverage changes.

***

## Accessing Individual Artifacts

Artifacts are stored as an array. Filter by `type` to retrieve a specific one:

```typescript theme={"system"}
const emailDraft = packet.artifacts.find(
  (artifact) => artifact.type === "email_draft",
);

const validationReport = packet.artifacts.find(
  (artifact) => artifact.type === "validation_report",
);

if (emailDraft) {
  console.log(emailDraft.content); // Plain text or Markdown content
}
```

> [!TIP]
>
> The `json_packet` artifact contains a serialised version of all normalized change items. You can parse and import this into your carrier portal or internal record system if it accepts structured JSON intake.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.