ProcureOps Task Group — Solver SOP
1. Environment
- Base URL:
http://34.46.77.124:8006(fromenvironment_access.md). This overrides ANY127.0.0.1:8006or localhost reference in task text. - Available endpoints:
/programs,/suppliers,/items,/contracts,/purchase_requisitions,/purchase_orders,/receipts,/ap/invoices,/ap/payments,/approval_events,/budget_snapshots,/vendor_risk_events. - Always hit these endpoints live; memo/packet files provide context but the API is the authoritative source of record.
2. Source Precedence
- ProcureOps API records — authoritative for all operational data (POs, receipts, invoices, contracts, budgets, approvals, suppliers, risk events).
- Task-local payloads (memos, JSON packets, chargeback registers) — provide target IDs, business rules, and contextual annotations. Use them to scope API queries but never substitute API data.
- Answer template JSON — defines the exact output schema. Every field, type, precision, ordering rule, and enum constraint is mandatory.
Rule: when a memo claim and an API record conflict, the API wins.
3. Field & Format Conventions
Currency
- All amounts in USD, rounded to 2 decimal places (cents) unless noted.
- Ratios like
receipt_completion_ratiouse 4 decimal places.
Dates
- Always
YYYY-MM-DDformat. - "As of" dates act as a cutoff: exclude records dated after the as_of date. Future-dated payments through a specified horizon (e.g., "through 2026-06-30") count as scheduled and reduce balances.
Lists
- Treated as sets (duplicate-free) unless the template explicitly specifies sorting.
- When sorted, use ascending order: lexicographic for strings, numeric for numbers.
- Empty lists use
[], nevernullor omitted keys.
IDs
- Entity IDs follow known prefixes:
PRG-(program),SUP-(supplier),PO-(purchase order),REQ-(requisition),RCV-(receipt),AP-(invoice),CR-(contract),CB-(chargeback),WH-(warehouse),LMP-/DRV-/SKU-(SKUs).
Output Format
- Return only JSON — no prose, no markdown fences, no commentary.
- Every key in the answer template must be present in the output.
4. Reusable Business Rules
Three-Way Match (PO ↔ Receipt ↔ Invoice)
quantity_billedmust not exceedquantity_receivedfor a clean match.quantity_variance = quantity_billed - quantity_received(positive = overbilled).quantity_variance_pct = (variance / PO ordered quantity) * 100, rounded to 1 decimal.short_qty_vs_po = ordered_qty - received_qty.unreceived_billed_qty = billed_qty - received_qty(clamped to ≥ 0).receipt_completion_ratio = received_qty / ordered_qty(4 decimal places).
Contract Ceiling
- Ceiling check uses line subtotal before tax and freight.
- Exclude cancelled POs from existing contract usage.
noncancelled_subtotal+requested_subtotal≤ceiling_amount→ ceiling OK.headroom_before_change = ceiling_amount - noncancelled_subtotal.headroom_after_change = headroom_before_change - requested_subtotal.
Budget Headroom
- Budget exposure includes line subtotal + estimated tax (freight only if the memo provides it).
budget_after_change = remaining_budget - requested_total.- Tax rate from the memo/change payload (e.g., 7.25%). Compute
requested_tax = requested_subtotal * (tax_rate / 100). max_quantity_with_current_budget = floor(remaining_budget / (unit_price * (1 + tax_rate/100))).
Supplier Risk
- Check
/vendor_risk_eventsfor the supplier. Filter to open events. - An open severe event is a blocker →
supplier_risk_ok = false. - Non-severe open events are context only unless the task explicitly says they block.
supplier_risk_ratingcomes from the supplier record, not risk events.supplier_statusis from the supplier record (active,inactive, etc.).
Approval State
- Query
/approval_eventsfor the relevant requisition or PO. - Filter to actions matching the memo's
approval_good_actions(typically"approved"). approval_ok = trueonly if the latest matching event action is in the good-actions set.- A missing approval event or a non-approved latest event →
approval_ok = false.
AP Hold & Release
- Invoice status + receipt status + PO status determine hold codes.
- A scheduled payment (found in
/ap/paymentsthrough the cutoff date) reduces close balance. net_balance_impact = invoice_total - scheduled_payment_amount.- Hold decision:
HOLDif any exception condition exists (no receipt, qty variance, price mismatch, supplier risk);RELEASEonly if all clear.
Supplier Balance Reconciliation
close_balance = opening_balance + invoice_total - scheduled_payments.- Balance status:
FULLY_SCHEDULEDif close_balance ≈ 0 and all invoices are paid/scheduled;OPEN_HELDif any held invoices remain;OPEN_APPROVEDif approved but unscheduled. - Opening balance for a slice:
0.00unless stated otherwise.
Chargeback Netting (AP Release)
net_release_amount = invoice_total - approved_chargeback_amount.pending_chargeback_amountdoes NOT reduce the net release — it remains held.- Chargeback statuses:
approved→ nets out;pending_quality_review→ hold. - Approved chargebacks with reason
Underage QuantityorAP Quantity Variancesupport partial release.
5. Common Exception & Reason Codes
| Code | Meaning |
|---|---|
NO_RECEIPT |
No receipt record exists for the invoice's PO |
QTY_VARIANCE |
Billed quantity ≠ received quantity |
APPROVED_THREE_WAY_MATCH |
PO, receipt, and invoice quantities align |
SCHEDULED_PAYMENT_FOUND |
A payment is already scheduled for this invoice |
INVOICE_QTY_EXCEEDS_RECEIPT |
Billed > received on at least one line |
PARTIAL_RECEIPT |
Received < ordered (not all goods arrived) |
PRICE_MISMATCH |
Invoice unit price ≠ PO or contract unit price |
DAMAGE_REJECTION |
Receipt has rejected/damaged quantity > 0 |
SUPPLIER_WATCH_RISK |
Supplier has open risk events |
NO_EXCEPTION |
No issues found |
missing_contract |
No active contract for the SKU/supplier |
supplier_watch |
Supplier has monitoring-level risk |
open_supplier_risk |
Supplier has an open risk event |
ap_hold |
Invoice is on AP hold |
pending_receipt |
Receipt not yet fully posted |
late_due_date |
Delivery is past the due date |
6. Blocker Codes (Nomination Readiness)
These are the canonical blocker codes from train_001:
missing_contract— no contract found for the line itemsupplier_watch— supplier risk rating is elevatedopen_supplier_risk— open vendor risk events exist (especially severe)ap_hold— associated invoice is on holdpending_receipt— receipt not fully completelate_due_date— PO delivery date has passednone— no blockers
7. Decision Enums
Nomination Decisions
nominate— all clear, proceedconditional_nomination— minor issues, can proceed with caveatshold— blocked, cannot nominate
Readiness Status
ready— no blockersat_risk— non-critical issues existnot_ready— blocked by one or more issues
Change Control Decisions
release_amendment— all checks passhold_for_budget— budget insufficienthold_for_approval— requisition not approvedhold_for_supplier_risk— supplier has open severe riskhold_for_budget_and_approval— both budget and approval failreject_contract_mismatch— contract doesn't cover the SKU/supplier
Batch Disposition (Receiving)
accept_partial_hold_variance— some variance exists but batch is acceptablerelease_full_invoice— everything matches, releasereject_batch— unrecoverable issuesmanual_recount_required— quantities need physical verification
AP Actions
keep_invoice_on_hold,release_invoice,void_invoice
Receiving Actions
record_shortage_follow_up,no_receiving_action,reject_all_units
Supplier Actions
request_credit_or_remaining_delivery,no_supplier_action,supplier_debit_for_damage
8. Cross-Check Rules (Arithmetic Validation)
Before outputting, verify:
- Sum of line items = header totals (invoice subtotals + freight + tax = invoice total).
- Contract headroom:
headroom_before - requested_subtotal = headroom_after. - Budget:
remaining_budget - requested_total = budget_after_change. - Close balance:
opening_balance + invoice_total - scheduled_payments = close_balance, andsum of vendor close_balances = total_close_balance. - Net release:
invoice_total - approved_chargeback_amount = net_release_amount. - Held + Released = Invoice Total in program_summary.
- Hold/Release queues: every invoice appears in exactly one queue (hold or release), and the queues' union equals the invoice_decisions list.
- Quantity:
received + rejected ≤ orderedfor a given PO line.
9. Output Schema Pitfalls
- Do not omit keys — even if a value is
null,[],0.00, orfalse, include the key. - Do not reorder list fields unless the template says to sort; when it does, sort ascending.
- Enum values must match exactly — case-sensitive, underscores, no synonyms.
- Integer vs number:
ordered_qty,received_qty,rejected_qty,billed_qtyare integers; ratios and money are numbers. nullvs"": usenullfor absent single values (e.g., no commercial_basis_id), use""only if the template constrains to string-type and a value is absent (rare).- Booleans: use JSON
true/false, not strings. task_id: must match the exact string the template expects (e.g.,"train_003", not"task_group_006_train_003").
10. Exclusion Rules
- Cancelled POs: excluded from contract ceiling usage calculations. Include them in
excluded_cancelled_po_idsbut NOT inincluded_po_ids. - Future-dated records: receipts, invoices, risk events, and approval events dated after the as_of date are excluded from the review scope.
- Same-PO receipts not in scope: when a task targets specific receipt IDs, receipts on the same PO but with different receipt IDs go in
excluded_same_po_receipt_ids. - Duplicate receipts: if two receipts reference the same PO lines, only the one named in the task scope is authoritative.
11. Entity Relationship Quick Reference
Program (PRG-*)
└── Contract (CR-*) — linked by SKU + supplier + program
└── Purchase Requisition (REQ-*)
└── Purchase Order (PO-*) — references supplier, SKU, contract
├── Receipt (RCV-*) — references PO, warehouse
├── AP Invoice (AP-*) — references PO, supplier
└── AP Payment — references invoice
Supplier (SUP-*)
└── Vendor Risk Event — references supplier
Approval Event — references requisition or PO
Budget Snapshot — references program
12. Execution Checklist
- Read the task prompt. Identify: task type (nomination / receiving / AP close / change control / release), target program/PO/invoice IDs, as_of date.
- Read all payload files in
input/payloads/. Note target IDs and business rules. - Read the answer template. Memorize required keys, types, precision, and enum values.
- Query the API endpoints needed, using filters (e.g.,
?program_id=PRG-AX17,?supplier_id=SUP-LUMA). - Cross-reference API data with memo claims; API wins on conflicts.
- Compute all derived values using the formulas in Section 4.
- Apply the decision logic matching the task type.
- Run the arithmetic cross-checks from Section 8.
- Serialize to JSON matching the template exactly.
- Return only the JSON object.