Court closeout packet
You are a deputy clerk. Turn messy intake material + an authoritative court portal into one exact JSON object. The whole job is reconciliation: local worksheets and queues are drafts to be audited; the signed court record and the portal are the truth. Getting the source-precedence right, posting only supported money, and matching the template exactly is the entire score.
Read these first
references/portal_reference.md— every endpoint, the fields you use, and the decoys the portal deliberately plants.references/reconciliation_rules.md— the precedence ladder and all the domain rules (fees, exclusions, placeholders, charge summaries, payment math, totals).scripts/finance_math.py— deterministic installment + date arithmetic. Use it; do not hand-compute schedules.
Workflow
Parse the prompt. Note the court/county, the hearing/disposition date, and every target id (case, citation, and/or petition). Note which portal endpoints the prompt lists — that hints at the answer shape.
Read every payload in
input/payloads/, includinganswer_template.json. The template is the contract: itsrequired_top_level_keys, nested keys, enums, ordering rules, and currency/date rules define exactly what to output. Read it before doing any work and re-check it at the end.Reach the portal. Get the base URL from
environment_access.md(GDPEVO_ENV_BASE_URL, the value for<TASK_ENV_BASE_URL>). No credentials. Always filter by exact id (?case_number=,?citation_number=,?petition_id=,?jurisdiction_code=); use/api/search?q=only to discover related rows, then confirm the exact id. Pull, per target: the CMS row (cases/citations/financial-petitions), itscharges, and — using that row'sjurisdiction_code— thefee-schedules,payment-policies, andforms. Map county→jurisdiction_codevia/api/jurisdictionsif unknown.Reconcile each matter with the precedence ladder (see the rules file): signed court record > portal CMS > portal schedules/policies/forms > local worksheet. Every place a lower source conflicts with a higher one becomes an audit finding. Watch the decoys:
attorney_label_raw, stalecharges.disposition, expired fee rows, similar-name DOBs.Decide status & post money. Signed order → disposed, post financials from the current schedule (court cost, imposed fine, PD user fee only if counsel is public_defender, drug/lab assessment only on an actual controlled-substance conviction, traffic standard-fine tier + surcharge). No signed order → hold, post nothing, add to exclusions. Never add account/late/collection/DMV/ returned-check/traffic-school/restitution-not-ordered/attorney/reporter fees; list them as exclusions with reason and 0 included.
Compute payment plans (when the template has them) with
scripts/finance_math.py: installment count + final catch-up payment, first-due (court-ordered, else base date + policyfirst_due_days), final-due (first + (total−1) months), return-to-court (final + policy offset), and budget/policy support classification. Restitution ordering per policy.Fill forms & placeholders. Use portal
form_id/label/placeholder text; citation number as the account reference when no case/account number exists. Every field required by a form but absent from the materials → the exact required placeholder string (e.g.TBD from case file); never invent or borrow.Assemble & format. Build exactly the template's keys. Totals sum posted cases only; count held/excluded separately. Emit enum tokens (never prose), money to two decimals, ISO dates /
YYYY-MM-DDTHH:MM:SSdatetimes,nullonly where allowed. Apply every ordering rule.Self-check before returning. Re-open
answer_template.jsonand verify: all required keys present at every level; every enum value is in-list; arrays sorted per the ordering rules; currency has two decimals; nothing invented (every posted fee traces to a schedule row or an order); totals equal the sum of posted line items; held matters carry no money. Return JSON only if the template says so.
Non-negotiables
- Do not invent identifiers, contacts, fees, balances, charges, or conditions.
- The signed court record overrides the portal for what happened; the portal overrides local worksheets for identity, structured numbers, and amounts.
- Post only current-schedule / court-ordered money; everything else is an exclusion, not a line item.
- The output must validate against
answer_template.json— that is the spec, and it varies per task, so read it fresh every time.