ProcureOps Exception Review Skill
Overview
Tasks in this group require querying a local ProcureOps API and synthesizing structured JSON exception-review files. There are multiple review types (nomination, receiving inspection, AP close, change exception, AP release). Each task provides an input/payloads/answer_template.json that dictates the required output schema. Always read the template and the prompt first to determine which review type is needed.
Initial Setup
- Read
input/prompt.txtto identify the review type and target program/PO/receipt/invoice. - Read
input/payloads/answer_template.jsonto know the exact output schema, required keys, sort orders, and precision rules. - Read any memo/packet/JSON payload files in
input/payloads/for task-specific parameters (target IDs, chargeback registers, change details, etc.).
ProcureOps API Conventions
- Base URL:
http://127.0.0.1:8006 - Endpoints are RESTful and return JSON.
- Common resource paths (try plural first, then singular):
/programsor/programs/{program_id}/poor/po/{po_id}or/pos/{po_id}/suppliersor/suppliers/{supplier_id}/contractsor/contracts/{contract_id}— also used for SKU lookups/receiptsor/receipts/{receipt_id}/apor/ap/{invoice_id}or/invoices/{invoice_id}/warehousesor/warehouse/{warehouse_id}/suppliers/{supplier_id}/risk
- When an exact ID is unknown, list the collection and filter locally by
program_id,po_id,supplier_id, etc. - Record every unique ID fetched from the API in
evidence.endpoint_record_ids(or the task-specific evidence field). - Record every payload file read in
evidence.task_payloads_reviewed.
Data Model Relationships
- Program (
PRG-*) owns multiple POs (PO-*). - PO has lines, each with a
skuandordered_qty. - SKU is linked to a Contract (
CON-*) and a Supplier (SUP-*). - Receipt (
RCV-*) references a PO and recordsreceived_qtyper line. - Invoice (
AP-*) references a PO and a supplier; hasbilled_qty,invoice_subtotal,freight,tax. - Supplier has a
risk_rating(e.g.,watch,approved) and may have open risk events (VRE-*). - Warehouse (
WH-*) is referenced by receipts.
Calculation Rules (apply across review types)
- Shortage:
short_qty_vs_po = ordered_qty - received_qty - Unreceived billed:
unreceived_billed_qty = billed_qty - received_qty - Completion ratio:
receipt_completion_ratio = received_qty / ordered_qty— round to 4 decimal places. - Received value:
received_goods_value = received_qty * contract_unit_price - Unreceived value:
unreceived_goods_value = short_qty_vs_po * contract_unit_price - Invoice total:
invoice_total = invoice_subtotal + invoice_freight + invoice_tax— round to 2 decimals. - Quantity variance:
quantity_variance = quantity_billed - quantity_received— round to 2 decimals. - Variance percent:
quantity_variance_pct = (quantity_variance / ordered_qty) * 100— round to 1 decimal. - Net release:
net_release_amount = invoice_total - approved_chargeback_amount— round to 2 decimals. - Close balance:
close_balance = opening_balance + invoice_total - scheduled_payments— round to 2 decimals. - Net balance impact:
net_balance_impact = invoice_total - scheduled_payment_amount— round to 2 decimals. - Unpaid balance:
unpaid_balance = total_invoice_amount - paid_amount— round to 2 decimals. - Overdue percent:
overdue_pct = (overdue_invoice_amount / total_unpaid_amount) * 100— round to 2 decimals. - Total contract value:
sum(unit_price * estimated_qty)for all contract lines — round to 2 decimals.
Review-Type-Specific Guidance
1. Nomination Review
- Purpose: Evaluate whether nominated suppliers for a program are ready for committee approval.
- Key inputs: nomination memo (lists program, SKUs, suppliers, POs).
- Fetch: program, all POs for the program, suppliers, contracts for each SKU, supplier risk data, receipt and invoice status.
- For each SKU line:
readiness_statusisreadyif no blockers;at_riskif conditional;not_readyif blocked.blocker_codes(sorted): derive from missing contracts, supplier watch status, open risk events, AP holds, pending receipts, late due dates. Usenoneonly when truly empty.nomination_decision:nominateif ready,conditional_nominationif at risk,holdif not ready.package_po_idsandreceipt_evidence_idsandinvoice_exception_idsmust be sorted ascending.
committee_action:- Group suppliers by their worst nomination_decision across SKUs.
send_to_committeeis usuallyyesif any supplier is nominated.next_ownerdepends on where blockers reside (buyer,finance_ops,quality_ops,program_owner,ap_team).
2. Receiving Inspection Review
- Purpose: Reconcile a single receipt against its PO and invoice.
- Key inputs: receiving memo (lists batch_id, PO, receipt, invoice, receiver, packing slip).
- Fetch: receipt record, PO record, invoice record, contract/SKU record, supplier record, supplier risk.
line_reconciliation: one entry per PO line, sorted bypo_line_idascending.contract_price_match: true ifpo_unit_price == contract_unit_price == invoice_unit_price.
invoice_review.exception_codes(evaluator sorts these):INVOICE_QTY_EXCEEDS_RECEIPTwhenbilled_qty > received_qty.PARTIAL_RECEIPTwhen receipt is incomplete.SUPPLIER_WATCH_RISKwhen supplier haswatchrating or open risk.PRICE_MISMATCHwhen unit prices differ.DAMAGE_REJECTIONwhenrejected_qty > 0.NO_EXCEPTIONonly when none of the above apply.
decision:batch_disposition:accept_partial_hold_variancewhen shortage exists and invoice is on hold;release_full_invoicewhen exact match;manual_recount_requiredwhen data is ambiguous.ap_action:keep_invoice_on_holdwhen variance exists;release_invoicewhen matched.receiving_action:record_shortage_follow_upwhenshort_qty_vs_po > 0.supplier_action:request_credit_or_remaining_deliverywhen shortage exists.
3. AP Close Review
- Purpose: Generate an AP close summary for a program, deciding which invoices to hold or release.
- Key inputs: AP close memo (lists program, close date, invoices).
- Fetch: all invoices for the program, PO records, receipt records, supplier records.
invoice_decisions(sorted byinvoice_idascending):hold_decision:HOLDif any reason code applies;RELEASEfor clean three-way matches.release_to_payment: true only for clean releases.reason_codes(alphabetical):NO_RECEIPTwhen no receipt exists;QTY_VARIANCEwhen billed ≠ received;SCHEDULED_PAYMENT_FOUNDwhen a scheduled payment exists;APPROVED_THREE_WAY_MATCHwhen all clear.quantity_received: use0.00when no receipt exists.
vendor_balances(sorted bysupplier_idascending):- Aggregate invoices per supplier.
held_invoice_total: sum of invoices withhold_decision == HOLD.releasable_invoice_total: sum of invoices withhold_decision == RELEASE.balance_status:OPEN_HELDif held invoices remain;OPEN_APPROVEDif only releasable remain;FULLY_SCHEDULEDif fully paid/scheduled.
program_summary(sorted byprogram_idascending): one row per program, aggregating invoice counts and totals.payment_hold_queue/payment_release_queue: lists ofinvoice_id, each sorted ascending.total_close_balance: sum of allclose_balancevalues across vendors, rounded to 2 decimals.
4. Change Exception Review
- Purpose: Evaluate impact of a proposed contract change.
- Key inputs: change memo JSON (includes change type, effective date, affected SKUs, new prices/quantities).
- Fetch: program, POs, suppliers, contracts for affected SKUs, supplier risk.
change_impact_description: copy or paraphrase from memo.requested_change_date: from memo.price_impact: fetch from contract endpoint for the affected SKU.supplier_risk_ratingandwatch_list_statusandopen_risk_event_ids: from supplier risk endpoint.has_open_risk_events: true ifopen_risk_event_idsis non-empty.affected_skus: list from contract endpoint; each entry needssku,contract_id,effective_date,price_impact.recommendation:approve_with_monitoringwhen risk is low.escalate_to_risk_committeewhen supplier is on watch or has open risk events.reject_changewhen impact is severe.
overall_impact:low,medium, orhighbased on price delta and risk.
5. AP Release Review
- Purpose: Multi-invoice release decision using a chargeback register.
- Key inputs:
ap_release_packet.json(includes target POs, receipts, invoices, chargeback register, and apo73xx_alias_notemapping stale PO-73xx IDs to real PO IDs). - Important: The
po73xx_alias_notemaps legacy PO-73xx identifiers to actual PO IDs. Use the mapped IDs when querying the API. - Fetch: all invoices, POs, receipts in the packet, plus any additional receipts linked to those POs (to populate
excluded_same_po_receipt_ids). release_decisions(one per invoice):- Match invoice to its PO and receipts via the packet or API.
receipt_ids_in_scope: receipts explicitly tied to this invoice in the packet.excluded_same_po_receipt_ids: other receipts on the same PO not tied to this invoice.decision:release_net_after_approved_chargebackwhen chargeback is approved and receipt exists.hold_pending_quality_chargebackwhen chargeback is pending and quality-related.hold_missing_receiptwhen no receipt exists for the PO.
primary_reason: mirror the decision (approved_ap_quantity_variance,approved_qty_chargeback,inspection_hold_pending_chargeback,no_receipt_on_po).approved_chargeback_amountandpending_chargeback_amountfrom chargeback register.net_release_amount = invoice_total - approved_chargeback_amount.
receiving_exceptions(one per receipt, plus aMISSING:{po_id}entry for POs with no receipt):exception_codes: from receipt or chargeback data (e.g.,Inspection Hold,Severe Unmatched Quantity,Underage Quantity,AP Quantity Variance).chargeback_status:approved,pending_quality_review, ornot_applicable.resolution_status:net_release_ready,hold_for_quality_review,missing_receipt.
summary:release_invoice_idsandhold_invoice_idssorted ascending.approved_chargeback_total,pending_chargeback_total,net_release_total— all rounded to 2 decimals.authoritative_sources: includelocal_chargeback_register,procureops_ap_records,procureops_po_records,procureops_receipt_records.supporting_only_sources: includeap_release_request_note,stale_po73xx_alias_notewhen present.followup_actions: derive from edge cases (missing receipts, pending quality reviews, duplicate receipts).
Common Pitfalls
- Sorting: Many arrays must be sorted ascending. The evaluator sorts some fields itself (e.g., exception codes, endpoint IDs), but others must be pre-sorted (e.g., PO IDs, invoice IDs, SKUs). Check the template comments carefully.
- Rounding: Use standard rounding (round half up) to the specified decimal places. Currency = 2 decimals, ratios = 4 decimals, percentages = 1 or 2 decimals as specified.
- Nulls vs. zero: Distinguish between
nulland0.00. For example,quantity_receivedis0.00when no receipt exists, notnull. - Supplier risk: Always fetch
/suppliers/{id}/risk. A supplier may have awatchrating even when its base record looks clean. Open risk events (VRE-*) affect nomination and release decisions. - Three-way match: For AP decisions, the three-way match compares PO qty → receipt qty → invoice billed qty. If any differ, it is a variance.
- Evidence completeness: Missing an
endpoint_record_idortask_payloads_reviewedentry can cause validation failures. Include every API ID and every file read. - Alias notes: In AP release tasks, legacy PO-73xx aliases in memos/packets must be resolved to real PO IDs before querying the API.
- PO status: A PO can be
partial_receipteven when a receipt is fully accepted, if ordered > received. - Invoice hold codes: Common codes include
QTY_VARIANCE,PRICE_MISMATCH,INSPECTION_HOLD. Use the exact code from the API record when available.
Execution Order
- Parse prompt and payload files.
- Resolve any ID aliases (e.g., PO-73xx → real PO ID).
- Query the API for the primary records (program, PO, receipt, invoice, supplier).
- Query related records (contracts, risk events, other POs/receipts on same supplier).
- Perform all calculations using the formulas above.
- Populate the answer template, ensuring correct sorting, rounding, and enum values.
- Validate that every required key from the template is present.
- Write the final JSON to the required output path.