Licensing Review Skill
Solve structured licensing-board review tasks. The task prompt identifies the
task variant, the target application/license IDs, and the answer_template.json
in input/payloads/. Use the environment's business-record APIs to pull the
records, apply the rules distilled below, and return one JSON object that
exactly matches the template.
The three task families
| Family |
Typical prompt cues |
API surface |
| Contractor batch eligibility |
"Senior Licensing Examiner", "contractor", application batch like C-xxxx-xxx, answer_template.json with application_decisions / summary |
/api/policies, /api/contractor/*, /api/sql |
| Restricted liquor license transfer |
"staff review package", "restricted liquor license transfer", single L-xxxx-xxx, location LOC-xxxx, recommended_posture |
/api/policies, /api/liquor/*, /api/sql when listed |
| Alcohol renewal manual-review queue |
"Alcohol Renewal Unit", "ranked manual-review queue", AL-xxxx-xxx, release boundary date, queue / summary |
/api/alcohol/licensees, /api/alcohol/violations, /api/renewal/rules, /api/sql |
Identify the family from the prompt before pulling records.
General workflow (every task)
- Read the prompt to find the task family, target IDs, answer-template path,
and any special instructions (review date, boundary date, domain focus).
- Read the
answer_template.json from input/payloads/ to understand the
required output shape, allowed enum values, and ordering rules.
- Call
GET /api/policies first. Policies define current standards that affect
deficiency detection and policy_impacted decisions.
- Call every relevant API endpoint listed in the prompt. Use
POST /api/sql
with header X-Task-Token: licensing-review-019 only when relationships
cannot be resolved from the REST endpoints or the prompt explicitly lists it.
- Cross-reference records: match applications/licensees to bonds, insurance,
violations, inspections, incidents, site-evidence, privileges, settlements,
correspondence, and license-history by shared identifiers.
- Apply the family-specific decision rules (below).
- Build the JSON output. Use the enum values from the answer template exactly.
Sort arrays as the template directs. Use empty arrays (
[]) when no codes
apply. Do not add prose, markdown, citations, or extra keys.
Contractor batch eligibility rules
Contractor tasks use the endpoints under /api/contractor/ plus /api/policies
and optionally /api/sql.
Reading the records
Pull and cross-reference these per application:
| Endpoint |
What to look for |
/api/contractor/applications |
Application status, endorsement requirements, experience claims |
/api/contractor/bonds |
Bond amount, status (active/cancelled), effective dates |
/api/contractor/insurance |
Coverage amount, status (current/expired/pending), expiry dates |
/api/contractor/license-history |
Active suspensions, prior license statuses |
/api/contractor/violations |
Open violations, severity (minor/serious), status |
/api/contractor/correspondence |
Stale or unverified items (status = unverified, or dates outside expected windows) |
/api/contractor/inspections |
Documentation gaps, safety recheck status |
Determination logic
DENY when any of these is present:
active_suspension in license-history
open_serious_violation or unresolved_serious_complaint in violations
- Multiple high-severity deficiencies that the policy treats as disqualifying
HOLD when deficiencies exist but none of the DENY triggers apply:
- Bond issues (cancelled, shortfall, missing)
- Insurance issues (expired, not current, pending, shortfall)
- Endorsement issues (missing, pending, not verified)
- Experience shortfall
- Inspection gaps (doc gap, safety recheck needed)
- Open minor violations
APPROVE when no deficiencies are found across all record checks.
Deficiency code matching
Map record conditions to deficiency codes using the answer template's
allowed_values. Common mappings:
| Record condition |
Typical deficiency code |
| Bond cancelled or absent |
bond_cancelled / no_active_bond |
| Bond amount < policy minimum |
bond_shortfall |
| Insurance expired |
insurance_expired |
| Insurance not current (lapsed, no record) |
insurance_not_current |
| Insurance binding pending |
insurance_pending |
| Insurance amount < minimum |
insurance_shortfall |
| Required endorsement not on file |
endorsement_missing / endorsement_not_verified |
| Endorsement in process, not confirmed |
endorsement_pending |
| Documented experience < threshold |
experience_shortfall |
| Inspection has doc gap |
inspection_doc_gap |
| Safety recheck not completed |
inspection_safety_recheck |
| Open minor violation |
open_minor_violation |
| Open serious violation |
open_serious_violation / unresolved_serious_complaint |
| Active suspension in history |
active_suspension |
Required action mapping
Each deficiency maps to one or more actions. Use the answer template's
allowed_values for required_actions. Common mappings:
- Bond cancelled ->
obtain_current_bond / file_active_bond
- Bond shortfall ->
increase_bond_amount / increase_bond
- Insurance expired/not current ->
provide_current_insurance
- Insurance pending ->
verify_insurance_binding
- Insurance shortfall ->
increase_insurance_amount / increase_insurance
- Endorsement missing ->
obtain_required_endorsement / verify_endorsement
- Endorsement pending ->
verify_pending_endorsement
- Experience shortfall ->
submit_experience_evidence / document_experience
- Inspection doc gap ->
clear_document_gap
- Safety recheck ->
complete_safety_recheck
- Open minor violation ->
resolve_minor_violation_review
- Open serious violation ->
resolve_serious_violation / resolve_complaint
- Active suspension ->
board_review_suspension / clear_suspension + board_review
Always include board_review as an action when the determination is DENY or
when the deficiency involves suspension or serious violations.
Risk tier
high: Active suspension, open serious violation, unresolved serious
complaint, or three or more serious deficiencies.
medium: One or more deficiencies but no DENY-level triggers.
low: No deficiencies (APPROVE).
Policy impact
policy_impacted is true when the current policy baseline (read from
/api/policies) creates or changes a deficiency that would not have existed
under a prior baseline. Compare policy effective dates against application
timelines. A policy change that introduces a new minimum bond amount or new
endorsement requirement mid-cycle is the canonical case.
Summary
approve_count, hold_count, deny_count: count determinations.
high_risk_application_ids: application IDs with risk_tier: "high".
policy_impacted_application_ids: IDs where policy_impacted is true.
stale_or_unverified_correspondence_ids: correspondence IDs with status
unverified or dates indicating staleness.
Restricted liquor license transfer rules
Liquor tasks use /api/liquor/* plus /api/policies and optionally /api/sql.
Reading the records
| Endpoint |
What to look for |
/api/liquor/applications |
Application details, license class, premises |
/api/liquor/settlements |
Any settlement agreements or tax holds |
/api/liquor/privileges |
Current privileges tied to the license |
/api/liquor/incidents |
Reported incidents, follow-ups needed |
/api/liquor/site-evidence |
Photos, floor plans, control signage, police memos, neighbor notices |
recommended_posture
issue_restricted: All evidence verified, risks covered, obligations clear.
request_follow_up: Verification gaps remain; license can proceed after
follow-up items are cleared.
deny: Unresolvable issues (e.g., serious incidents, unresolvable tax holds,
police memo conflicts that cannot be cleared).
same_premises_basis_applies
Check the policies for same-premises rules. This is true when the application
operates at the same premises as a prior license and the policy treats that
as relevant (which it does in the training examples).
covered_risk_codes
Risks from incidents or site evidence that are addressed by existing controls.
For example, if a noise risk exists and the location has noise controls or patio
controls, list the risk code. Use the template's allowed values.
verification_gap_codes
Evidence items that are missing, conflicting, or stale. Map from site-evidence
records:
- Missing signage ->
CONTROL_SIGNAGE_CURRENT_MISSING / control_signage_missing
- Conflicting signage ->
CONTROL_SIGNAGE_CONFLICTING
- Stale/conflicting floor plan ->
FLOOR_PLAN_STALE / FLOOR_PLAN_CONFLICTING / floor_plan_conflicting
- Missing neighbor notice ->
NEIGHBOR_NOTICE_MISSING / neighbor_notice_missing
- Open incident follow-up ->
OPEN_INCIDENT_FOLLOW_UP
- Police memo conflict ->
POLICE_MEMO_CONFLICTING / police_memo_identity_note
- Missing site photo ->
SITE_PHOTO_MISSING / site_photo_missing
- Missing tax clearance ->
TAX_CLEARANCE_MISSING / tax_hold_unresolved
- Missing camera evidence ->
camera_evidence_missing
- Missing food service evidence ->
food_service_evidence_missing
- Late night monitoring needed ->
late_night_monitoring_needed
standard_obligation_codes
Standard license-class obligations from policies. Common examples:
ID_CHECK, HOURS, FOOD_SERVICE, CCTV, SECURITY, NOISE, PATIO,
DELIVERY. Include only what the policy requires for the license class.
location_specific_control_codes
Controls that are active at this specific location (from site-evidence,
privileges, or application records). These overlap with obligation codes but
represent location-specific active controls rather than class-wide requirements.
Use the same code vocabulary.
first_90_day_plan
Build monitoring check items from verification gaps and risks. Each item has
a check_code and a timing (one of first_30_days, days_31_60,
days_61_90). Map gaps to checks:
- Signage gaps ->
control_signage_recheck / control_signage_review (first_30_days)
- ID check risks ->
id_check_observation (first_30_days)
- Police memo issues ->
police_memo_follow_up (first_30_days)
- Camera/security gaps ->
security_cctv_walkthrough / camera_export_test (first_30_days)
- After-hours risk ->
after_hours_visit / late_night_closing_visit (days_31_60)
- Food service gaps ->
food_service_check / food_service_service_area_check (first_30_days)
- Noise/patio issues ->
noise_patio_boundary_check (days_61_90)
- Tax clearance ->
tax_clearance_check / tax_clearance_review (first_30_days)
- Incident log ->
incident_log_review (first_30_days)
- Noise log ->
noise_log_review (days_31_60)
- Patio boundary ->
patio_boundary_check (days_61_90)
Order checks in operational sequence: urgent verification first (30 days),
observation checks next (31-60), follow-up reviews last (61-90).
escalation_trigger_codes
Conditions that should trigger escalation. Derived from the risks and gaps:
- After-hours risk ->
AFTER_HOURS_VIOLATION / after_hours_service
- Signage not verified ->
CONTROL_SIGNAGE_NOT_VERIFIED
- Major incident ->
MAJOR_INCIDENT_REPORTED / unreported_violent_incident
- Minor sale unresolved ->
REFERRED_MINOR_SALE_UNRESOLVED / minor_sale
- CCTV failure ->
SECURITY_CCTV_CONTROL_FAILURE / missing_camera_coverage / footage_not_produced
- Tax hold reopened ->
TAX_HOLD_REOPENED / open_tax_hold_uncleared
- Food service not available ->
food_service_not_available
- Noise/patio breach ->
noise_or_patio_breach
- ID check failure ->
id_check_failure
- Board order conflict ->
BOARD_ORDER_CONFLICT
- Patio boundary failure ->
patio_boundary_failure
Alcohol renewal queue rules
Reading the records
| Endpoint |
What to look for |
/api/alcohol/licensees |
All license records with facility names, addresses, statuses |
/api/alcohol/violations |
All violations with dates, license references, severity |
/api/renewal/rules |
Renewal criteria, ranking rules, boundary date handling |
/api/sql |
Use when cross-referencing requires complex joins |
Queue construction
- Read all licensees for the target IDs.
- Read all violations.
- Apply the boundary date: only violations on or before the boundary date
count for the queue. Exclude violations after the boundary date and collect
their IDs for
post_boundary_violation_ids_excluded.
- Match violations to licensees. Primary match is by license number (exact).
If a violation references a prior/old license number or similar address, use
close_address. If the match is ambiguous, use uncertain.
- Rank licensees. The dominant factors in the training data:
- Violation count (more violations -> higher rank)
- Most recent violation date (more recent -> higher rank)
- Match confidence (exact -> higher than close_address)
- Violation severity matters for risk tier and next_step_label
- Assign
risk_tier:
high: Multiple (3+) violations or recent serious violations
medium: Fewer violations, less recent
low: No or very old violations
- Assign
next_step_label:
board_review: Licensees with serious patterns, many violations, or
close_address matches that need board judgment.
manual_fine_check: Licensees with several violations that may involve
fines requiring manual calculation.
manual_ALERT_check: Licensees with alert-triggering violation patterns.
additional_record_check: Licensees needing further record pull.
- Sort
matched_violation_ids by violation date ascending, then ID ascending.
- Build the summary:
queue_size: 10 (or as specified)
boundary_date: from the prompt
post_boundary_violation_ids_excluded: all violation IDs after the
boundary date
close_or_uncertain_match_license_numbers: licenses with non-exact matches
board_review_license_numbers: licenses with next_step_label: board_review
Ranking tiebreakers
When violation counts are equal, the more recent violation date wins the higher
rank. When both are equal, exact matches rank above close_address, which ranks
above uncertain.
SQL usage
When POST /api/sql is available, use it only for queries that cannot be
answered by the REST endpoints. Always include the header
X-Task-Token: licensing-review-019. Use SELECT only. Set limit to 1000 or
less. Typical uses: joining violations to licensees when the REST endpoints
return separate collections without shared keys, or filtering records by
complex date ranges.
Output discipline
- Return only the JSON object matching the answer template. No prose, markdown,
citations, or extra keys.
- Sort arrays as the template specifies (usually ascending lexical order for
codes and IDs).
- Use empty arrays (
[]) when no codes apply.
- Use the exact enum strings from the template's
allowed_values. Do not invent
new codes.
- For dates, use
YYYY-MM-DD format.
- For the contractor family,
stale_or_unverified_correspondence_ids collects
correspondence record IDs (not application IDs).
- For the renewal family,
most_recent_violation_date is the latest violation
date used; matched_violation_ids sorts by date ascending then ID ascending.
Edge cases
- If a record endpoint returns an empty array or 404, treat that record type as
absent for all target IDs (no deficiencies from that source).
- If an application/licensee has no violations, violation_count is 0 and
matched_violation_ids is
[]. It should still be included if the task
requires a fixed-length queue (use remaining slots).
- If the policy endpoint returns multiple policy versions, use the most recent
effective policy for the review date.
policy_impacted compares the current policy against the prior baseline
mentioned in the policy records. If policies show a recent change in required
minimums, applications that fall below the new minimum but were above the old
minimum are policy_impacted: true.
1---2name: licensing-review-173description: Solve state licensing board review tasks by calling business-record APIs, applying policy rules, and producing structured JSON decisions for contractor eligibility batches, restricted liquor license transfers, and alcohol license renewal queues.4metadata:5 source: https://skillmd.com/skills/prism-shadow/licensing-review-176---78# Licensing Review Skill910Solve structured licensing-board review tasks. The task prompt identifies the11task variant, the target application/license IDs, and the `answer_template.json`12in `input/payloads/`. Use the environment's business-record APIs to pull the13records, apply the rules distilled below, and return one JSON object that14exactly matches the template.1516## The three task families1718| Family | Typical prompt cues | API surface |19|---|---|---|20| Contractor batch eligibility | "Senior Licensing Examiner", "contractor", application batch like `C-xxxx-xxx`, `answer_template.json` with `application_decisions` / `summary` | `/api/policies`, `/api/contractor/*`, `/api/sql` |21| Restricted liquor license transfer | "staff review package", "restricted liquor license transfer", single `L-xxxx-xxx`, location `LOC-xxxx`, `recommended_posture` | `/api/policies`, `/api/liquor/*`, `/api/sql` when listed |22| Alcohol renewal manual-review queue | "Alcohol Renewal Unit", "ranked manual-review queue", `AL-xxxx-xxx`, release boundary date, `queue` / `summary` | `/api/alcohol/licensees`, `/api/alcohol/violations`, `/api/renewal/rules`, `/api/sql` |2324Identify the family from the prompt before pulling records.2526## General workflow (every task)27281. Read the prompt to find the task family, target IDs, answer-template path,29 and any special instructions (review date, boundary date, domain focus).302. Read the `answer_template.json` from `input/payloads/` to understand the31 required output shape, allowed enum values, and ordering rules.323. Call `GET /api/policies` first. Policies define current standards that affect33 deficiency detection and `policy_impacted` decisions.344. Call every relevant API endpoint listed in the prompt. Use `POST /api/sql`35 with header `X-Task-Token: licensing-review-019` only when relationships36 cannot be resolved from the REST endpoints or the prompt explicitly lists it.375. Cross-reference records: match applications/licensees to bonds, insurance,38 violations, inspections, incidents, site-evidence, privileges, settlements,39 correspondence, and license-history by shared identifiers.406. Apply the family-specific decision rules (below).417. Build the JSON output. Use the enum values from the answer template exactly.42 Sort arrays as the template directs. Use empty arrays (`[]`) when no codes43 apply. Do not add prose, markdown, citations, or extra keys.4445## Contractor batch eligibility rules4647Contractor tasks use the endpoints under `/api/contractor/` plus `/api/policies`48and optionally `/api/sql`.4950### Reading the records5152Pull and cross-reference these per application:5354| Endpoint | What to look for |55|---|---|56| `/api/contractor/applications` | Application status, endorsement requirements, experience claims |57| `/api/contractor/bonds` | Bond amount, status (active/cancelled), effective dates |58| `/api/contractor/insurance` | Coverage amount, status (current/expired/pending), expiry dates |59| `/api/contractor/license-history` | Active suspensions, prior license statuses |60| `/api/contractor/violations` | Open violations, severity (minor/serious), status |61| `/api/contractor/correspondence` | Stale or unverified items (status = `unverified`, or dates outside expected windows) |62| `/api/contractor/inspections` | Documentation gaps, safety recheck status |6364### Determination logic6566**DENY** when any of these is present:67- `active_suspension` in license-history68- `open_serious_violation` or `unresolved_serious_complaint` in violations69- Multiple high-severity deficiencies that the policy treats as disqualifying7071**HOLD** when deficiencies exist but none of the DENY triggers apply:72- Bond issues (cancelled, shortfall, missing)73- Insurance issues (expired, not current, pending, shortfall)74- Endorsement issues (missing, pending, not verified)75- Experience shortfall76- Inspection gaps (doc gap, safety recheck needed)77- Open minor violations7879**APPROVE** when no deficiencies are found across all record checks.8081### Deficiency code matching8283Map record conditions to deficiency codes using the answer template's84`allowed_values`. Common mappings:8586| Record condition | Typical deficiency code |87|---|---|88| Bond cancelled or absent | `bond_cancelled` / `no_active_bond` |89| Bond amount < policy minimum | `bond_shortfall` |90| Insurance expired | `insurance_expired` |91| Insurance not current (lapsed, no record) | `insurance_not_current` |92| Insurance binding pending | `insurance_pending` |93| Insurance amount < minimum | `insurance_shortfall` |94| Required endorsement not on file | `endorsement_missing` / `endorsement_not_verified` |95| Endorsement in process, not confirmed | `endorsement_pending` |96| Documented experience < threshold | `experience_shortfall` |97| Inspection has doc gap | `inspection_doc_gap` |98| Safety recheck not completed | `inspection_safety_recheck` |99| Open minor violation | `open_minor_violation` |100| Open serious violation | `open_serious_violation` / `unresolved_serious_complaint` |101| Active suspension in history | `active_suspension` |102103### Required action mapping104105Each deficiency maps to one or more actions. Use the answer template's106`allowed_values` for `required_actions`. Common mappings:107108- Bond cancelled -> `obtain_current_bond` / `file_active_bond`109- Bond shortfall -> `increase_bond_amount` / `increase_bond`110- Insurance expired/not current -> `provide_current_insurance`111- Insurance pending -> `verify_insurance_binding`112- Insurance shortfall -> `increase_insurance_amount` / `increase_insurance`113- Endorsement missing -> `obtain_required_endorsement` / `verify_endorsement`114- Endorsement pending -> `verify_pending_endorsement`115- Experience shortfall -> `submit_experience_evidence` / `document_experience`116- Inspection doc gap -> `clear_document_gap`117- Safety recheck -> `complete_safety_recheck`118- Open minor violation -> `resolve_minor_violation_review`119- Open serious violation -> `resolve_serious_violation` / `resolve_complaint`120- Active suspension -> `board_review_suspension` / `clear_suspension` + `board_review`121122Always include `board_review` as an action when the determination is DENY or123when the deficiency involves suspension or serious violations.124125### Risk tier126127- `high`: Active suspension, open serious violation, unresolved serious128 complaint, or three or more serious deficiencies.129- `medium`: One or more deficiencies but no DENY-level triggers.130- `low`: No deficiencies (APPROVE).131132### Policy impact133134`policy_impacted` is `true` when the current policy baseline (read from135`/api/policies`) creates or changes a deficiency that would not have existed136under a prior baseline. Compare policy effective dates against application137timelines. A policy change that introduces a new minimum bond amount or new138endorsement requirement mid-cycle is the canonical case.139140### Summary141142- `approve_count`, `hold_count`, `deny_count`: count determinations.143- `high_risk_application_ids`: application IDs with `risk_tier: "high"`.144- `policy_impacted_application_ids`: IDs where `policy_impacted` is true.145- `stale_or_unverified_correspondence_ids`: correspondence IDs with status146 `unverified` or dates indicating staleness.147148## Restricted liquor license transfer rules149150Liquor tasks use `/api/liquor/*` plus `/api/policies` and optionally `/api/sql`.151152### Reading the records153154| Endpoint | What to look for |155|---|---|156| `/api/liquor/applications` | Application details, license class, premises |157| `/api/liquor/settlements` | Any settlement agreements or tax holds |158| `/api/liquor/privileges` | Current privileges tied to the license |159| `/api/liquor/incidents` | Reported incidents, follow-ups needed |160| `/api/liquor/site-evidence` | Photos, floor plans, control signage, police memos, neighbor notices |161162### recommended_posture163164- `issue_restricted`: All evidence verified, risks covered, obligations clear.165- `request_follow_up`: Verification gaps remain; license can proceed after166 follow-up items are cleared.167- `deny`: Unresolvable issues (e.g., serious incidents, unresolvable tax holds,168 police memo conflicts that cannot be cleared).169170### same_premises_basis_applies171172Check the policies for same-premises rules. This is `true` when the application173operates at the same premises as a prior license and the policy treats that174as relevant (which it does in the training examples).175176### covered_risk_codes177178Risks from incidents or site evidence that are addressed by existing controls.179For example, if a noise risk exists and the location has noise controls or patio180controls, list the risk code. Use the template's allowed values.181182### verification_gap_codes183184Evidence items that are missing, conflicting, or stale. Map from site-evidence185records:186187- Missing signage -> `CONTROL_SIGNAGE_CURRENT_MISSING` / `control_signage_missing`188- Conflicting signage -> `CONTROL_SIGNAGE_CONFLICTING`189- Stale/conflicting floor plan -> `FLOOR_PLAN_STALE` / `FLOOR_PLAN_CONFLICTING` / `floor_plan_conflicting`190- Missing neighbor notice -> `NEIGHBOR_NOTICE_MISSING` / `neighbor_notice_missing`191- Open incident follow-up -> `OPEN_INCIDENT_FOLLOW_UP`192- Police memo conflict -> `POLICE_MEMO_CONFLICTING` / `police_memo_identity_note`193- Missing site photo -> `SITE_PHOTO_MISSING` / `site_photo_missing`194- Missing tax clearance -> `TAX_CLEARANCE_MISSING` / `tax_hold_unresolved`195- Missing camera evidence -> `camera_evidence_missing`196- Missing food service evidence -> `food_service_evidence_missing`197- Late night monitoring needed -> `late_night_monitoring_needed`198199### standard_obligation_codes200201Standard license-class obligations from policies. Common examples:202`ID_CHECK`, `HOURS`, `FOOD_SERVICE`, `CCTV`, `SECURITY`, `NOISE`, `PATIO`,203`DELIVERY`. Include only what the policy requires for the license class.204205### location_specific_control_codes206207Controls that are active at this specific location (from site-evidence,208privileges, or application records). These overlap with obligation codes but209represent location-specific active controls rather than class-wide requirements.210Use the same code vocabulary.211212### first_90_day_plan213214Build monitoring check items from verification gaps and risks. Each item has215a `check_code` and a `timing` (one of `first_30_days`, `days_31_60`,216`days_61_90`). Map gaps to checks:217218- Signage gaps -> `control_signage_recheck` / `control_signage_review` (first_30_days)219- ID check risks -> `id_check_observation` (first_30_days)220- Police memo issues -> `police_memo_follow_up` (first_30_days)221- Camera/security gaps -> `security_cctv_walkthrough` / `camera_export_test` (first_30_days)222- After-hours risk -> `after_hours_visit` / `late_night_closing_visit` (days_31_60)223- Food service gaps -> `food_service_check` / `food_service_service_area_check` (first_30_days)224- Noise/patio issues -> `noise_patio_boundary_check` (days_61_90)225- Tax clearance -> `tax_clearance_check` / `tax_clearance_review` (first_30_days)226- Incident log -> `incident_log_review` (first_30_days)227- Noise log -> `noise_log_review` (days_31_60)228- Patio boundary -> `patio_boundary_check` (days_61_90)229230Order checks in operational sequence: urgent verification first (30 days),231observation checks next (31-60), follow-up reviews last (61-90).232233### escalation_trigger_codes234235Conditions that should trigger escalation. Derived from the risks and gaps:236237- After-hours risk -> `AFTER_HOURS_VIOLATION` / `after_hours_service`238- Signage not verified -> `CONTROL_SIGNAGE_NOT_VERIFIED`239- Major incident -> `MAJOR_INCIDENT_REPORTED` / `unreported_violent_incident`240- Minor sale unresolved -> `REFERRED_MINOR_SALE_UNRESOLVED` / `minor_sale`241- CCTV failure -> `SECURITY_CCTV_CONTROL_FAILURE` / `missing_camera_coverage` / `footage_not_produced`242- Tax hold reopened -> `TAX_HOLD_REOPENED` / `open_tax_hold_uncleared`243- Food service not available -> `food_service_not_available`244- Noise/patio breach -> `noise_or_patio_breach`245- ID check failure -> `id_check_failure`246- Board order conflict -> `BOARD_ORDER_CONFLICT`247- Patio boundary failure -> `patio_boundary_failure`248249## Alcohol renewal queue rules250251### Reading the records252253| Endpoint | What to look for |254|---|---|255| `/api/alcohol/licensees` | All license records with facility names, addresses, statuses |256| `/api/alcohol/violations` | All violations with dates, license references, severity |257| `/api/renewal/rules` | Renewal criteria, ranking rules, boundary date handling |258| `/api/sql` | Use when cross-referencing requires complex joins |259260### Queue construction2612621. Read all licensees for the target IDs.2632. Read all violations.2643. Apply the boundary date: only violations on or before the boundary date265 count for the queue. Exclude violations after the boundary date and collect266 their IDs for `post_boundary_violation_ids_excluded`.2674. Match violations to licensees. Primary match is by license number (exact).268 If a violation references a prior/old license number or similar address, use269 `close_address`. If the match is ambiguous, use `uncertain`.2705. Rank licensees. The dominant factors in the training data:271 - Violation count (more violations -> higher rank)272 - Most recent violation date (more recent -> higher rank)273 - Match confidence (exact -> higher than close_address)274 - Violation severity matters for risk tier and next_step_label2756. Assign `risk_tier`:276 - `high`: Multiple (3+) violations or recent serious violations277 - `medium`: Fewer violations, less recent278 - `low`: No or very old violations2797. Assign `next_step_label`:280 - `board_review`: Licensees with serious patterns, many violations, or281 close_address matches that need board judgment.282 - `manual_fine_check`: Licensees with several violations that may involve283 fines requiring manual calculation.284 - `manual_ALERT_check`: Licensees with alert-triggering violation patterns.285 - `additional_record_check`: Licensees needing further record pull.2868. Sort `matched_violation_ids` by violation date ascending, then ID ascending.2879. Build the summary:288 - `queue_size`: 10 (or as specified)289 - `boundary_date`: from the prompt290 - `post_boundary_violation_ids_excluded`: all violation IDs after the291 boundary date292 - `close_or_uncertain_match_license_numbers`: licenses with non-exact matches293 - `board_review_license_numbers`: licenses with `next_step_label: board_review`294295### Ranking tiebreakers296297When violation counts are equal, the more recent violation date wins the higher298rank. When both are equal, exact matches rank above close_address, which ranks299above uncertain.300301## SQL usage302303When `POST /api/sql` is available, use it only for queries that cannot be304answered by the REST endpoints. Always include the header305`X-Task-Token: licensing-review-019`. Use `SELECT` only. Set `limit` to 1000 or306less. Typical uses: joining violations to licensees when the REST endpoints307return separate collections without shared keys, or filtering records by308complex date ranges.309310## Output discipline311312- Return only the JSON object matching the answer template. No prose, markdown,313 citations, or extra keys.314- Sort arrays as the template specifies (usually ascending lexical order for315 codes and IDs).316- Use empty arrays (`[]`) when no codes apply.317- Use the exact enum strings from the template's `allowed_values`. Do not invent318 new codes.319- For dates, use `YYYY-MM-DD` format.320- For the contractor family, `stale_or_unverified_correspondence_ids` collects321 correspondence record IDs (not application IDs).322- For the renewal family, `most_recent_violation_date` is the latest violation323 date used; `matched_violation_ids` sorts by date ascending then ID ascending.324325## Edge cases326327- If a record endpoint returns an empty array or 404, treat that record type as328 absent for all target IDs (no deficiencies from that source).329- If an application/licensee has no violations, violation_count is 0 and330 matched_violation_ids is `[]`. It should still be included if the task331 requires a fixed-length queue (use remaining slots).332- If the policy endpoint returns multiple policy versions, use the most recent333 effective policy for the review date.334- `policy_impacted` compares the current policy against the prior baseline335 mentioned in the policy records. If policies show a recent change in required336 minimums, applications that fall below the new minimum but were above the old337 minimum are `policy_impacted: true`.