nick-micro1 commited on
Commit
c3cd245
·
verified ·
1 Parent(s): c9b8f1e

LegalReasonBench sample release: 5 matters

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +25 -0
  2. README.md +145 -0
  3. data/assignments/test-00000-of-00001.parquet +3 -0
  4. scripts/score_matter.py +40 -0
  5. tasks/lrb-certiorari-quasi-judicial-land-use/environment/Dockerfile +29 -0
  6. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/instruction.md +54 -0
  7. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/solution/solve.sh +4 -0
  8. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/fixtures/config.json +466 -0
  9. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/fixtures/rubric.json +404 -0
  10. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/m1_judge_panel.json +21 -0
  11. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/m1_rewardkit_accounting.py +490 -0
  12. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/m1_rewardkit_panel.py +169 -0
  13. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/normalize_reward.py +71 -0
  14. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/agent_prompt.md +10 -0
  15. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/mentions_in_the_first_assignment_that_the_county_s_prior_rezonin.toml +12 -0
  16. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/mentions_in_the_first_assignment_that_the_subject_property_was_p.toml +12 -0
  17. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_dci2018_10023_remained_activ.toml +12 -0
  18. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_circuit_court_found_th_2.toml +12 -0
  19. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_circuit_court_found_th_3.toml +12 -0
  20. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_circuit_court_found_th_4.toml +12 -0
  21. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_circuit_court_found_that.toml +12 -0
  22. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_county_could_appeal_the.toml +12 -0
  23. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_county_could_file_a_new.toml +12 -0
  24. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_county_could_negotiate_2.toml +12 -0
  25. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_county_could_negotiate_f.toml +12 -0
  26. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_county_could_remand_the.toml +12 -0
  27. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_county_could_take_the_po.toml +12 -0
  28. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_county_could_voluntarily.toml +12 -0
  29. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_county_must_stop_constru.toml +12 -0
  30. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_county_should_cease_cons.toml +12 -0
  31. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_county_should_file_a_tim.toml +12 -0
  32. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_county_should_remand_the.toml +12 -0
  33. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_effect_of_the_order_gran.toml +12 -0
  34. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_exclusive_method_of_chal.toml +12 -0
  35. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_exclusive_method_of_revi.toml +12 -0
  36. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_order_granting_petition.toml +12 -0
  37. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_petitioners_may_file_a_s.toml +12 -0
  38. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_under_fla_stat_163_3167_10_2.toml +12 -0
  39. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_under_lee_county_fla_admin_c.toml +12 -0
  40. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/test.sh +58 -0
  41. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/workdir/attachments/1774361815-lcu-project.pdf +3 -0
  42. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/workdir/attachments/1774361815-orderpdf.docx +3 -0
  43. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/workdir/attachments/1774361815-petition.docx +3 -0
  44. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/workdir/attachments/1774361815-resolution.docx +3 -0
  45. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-2/instruction.md +46 -0
  46. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-2/solution/solve.sh +4 -0
  47. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-2/tests/fixtures/config.json +233 -0
  48. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-2/tests/fixtures/rubric.json +196 -0
  49. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-2/tests/m1_judge_panel.json +21 -0
  50. tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-2/tests/m1_rewardkit_accounting.py +490 -0
.gitattributes CHANGED
@@ -58,3 +58,28 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
61
+ tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/workdir/attachments/1774361815-lcu-project.pdf filter=lfs diff=lfs merge=lfs -text
62
+ tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/workdir/attachments/1774361815-orderpdf.docx filter=lfs diff=lfs merge=lfs -text
63
+ tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/workdir/attachments/1774361815-petition.docx filter=lfs diff=lfs merge=lfs -text
64
+ tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/workdir/attachments/1774361815-resolution.docx filter=lfs diff=lfs merge=lfs -text
65
+ tasks/lrb-dcca-challenge-police-discipline/steps/assignment-2/workdir/attachments/dcmr_title6b_1606.pdf filter=lfs diff=lfs merge=lfs -text
66
+ tasks/lrb-dcca-challenge-police-discipline/steps/assignment-2/workdir/attachments/douglas_v_veterans_admin.pdf filter=lfs diff=lfs merge=lfs -text
67
+ tasks/lrb-dcca-challenge-police-discipline/steps/assignment-3/workdir/attachments/dc_code_1-605.02.pdf filter=lfs diff=lfs merge=lfs -text
68
+ tasks/lrb-dcca-challenge-police-discipline/steps/assignment-3/workdir/attachments/fop_doc_labor_comm_v_perb_2009.pdf filter=lfs diff=lfs merge=lfs -text
69
+ tasks/lrb-dcca-challenge-police-discipline/steps/assignment-3/workdir/attachments/paperworkers_v_misco.pdf filter=lfs diff=lfs merge=lfs -text
70
+ tasks/lrb-dcca-challenge-police-discipline/steps/assignment-3/workdir/attachments/wr_grace_v_rubber_workers.pdf filter=lfs diff=lfs merge=lfs -text
71
+ tasks/lrb-forum-non-conveniens-response/steps/assignment-1/workdir/attachments/2023[[:space:]]Annual[[:space:]]Report[[:space:]]Statistical[[:space:]]Summary.pdf filter=lfs diff=lfs merge=lfs -text
72
+ tasks/lrb-forum-non-conveniens-response/steps/assignment-1/workdir/attachments/Bradbury[[:space:]]v.[[:space:]]St.[[:space:]]Mary's[[:space:]]Hospital.pdf filter=lfs diff=lfs merge=lfs -text
73
+ tasks/lrb-forum-non-conveniens-response/steps/assignment-1/workdir/attachments/Defendants[[:space:]]Motion[[:space:]]to[[:space:]]Transfer.pdf filter=lfs diff=lfs merge=lfs -text
74
+ tasks/lrb-forum-non-conveniens-response/steps/assignment-1/workdir/attachments/First[[:space:]]Am[[:space:]]Bank[[:space:]]v.[[:space:]]Guerine.pdf filter=lfs diff=lfs merge=lfs -text
75
+ tasks/lrb-forum-non-conveniens-response/steps/assignment-1/workdir/attachments/Langenhorst[[:space:]]v.[[:space:]]Norfolk[[:space:]]Southern.pdf filter=lfs diff=lfs merge=lfs -text
76
+ tasks/lrb-forum-non-conveniens-response/steps/assignment-2/workdir/attachments/2023[[:space:]]Annual[[:space:]]Report[[:space:]]Statistical[[:space:]]Summary.pdf filter=lfs diff=lfs merge=lfs -text
77
+ tasks/lrb-forum-non-conveniens-response/steps/assignment-2/workdir/attachments/Bradbury[[:space:]]v.[[:space:]]St.[[:space:]]Mary's[[:space:]]Hospital.pdf filter=lfs diff=lfs merge=lfs -text
78
+ tasks/lrb-forum-non-conveniens-response/steps/assignment-2/workdir/attachments/Defendants[[:space:]]Motion[[:space:]]to[[:space:]]Transfer.pdf filter=lfs diff=lfs merge=lfs -text
79
+ tasks/lrb-forum-non-conveniens-response/steps/assignment-2/workdir/attachments/First[[:space:]]Am[[:space:]]Bank[[:space:]]v.[[:space:]]Guerine.pdf filter=lfs diff=lfs merge=lfs -text
80
+ tasks/lrb-forum-non-conveniens-response/steps/assignment-2/workdir/attachments/Langenhorst[[:space:]]v.[[:space:]]Norfolk[[:space:]]Southern.pdf filter=lfs diff=lfs merge=lfs -text
81
+ tasks/lrb-vicar-trial-jury-instructions/steps/assignment-1/workdir/attachments/Ellison.pdf filter=lfs diff=lfs merge=lfs -text
82
+ tasks/lrb-vicar-trial-jury-instructions/steps/assignment-1/workdir/attachments/Facts.pdf filter=lfs diff=lfs merge=lfs -text
83
+ tasks/lrb-vicar-trial-jury-instructions/steps/assignment-1/workdir/attachments/Patton[[:space:]]State[[:space:]]Plea.pdf filter=lfs diff=lfs merge=lfs -text
84
+ tasks/lrb-vicar-trial-jury-instructions/steps/assignment-2/workdir/attachments/Facts.pdf filter=lfs diff=lfs merge=lfs -text
85
+ tasks/lrb-vicar-trial-jury-instructions/steps/assignment-2/workdir/attachments/Kuhse.pdf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-4.0
3
+ language:
4
+ - en
5
+ pretty_name: LegalReasonBench (sample)
6
+ task_categories:
7
+ - text-generation
8
+ annotations_creators:
9
+ - expert-generated
10
+ language_creators:
11
+ - expert-generated
12
+ source_datasets:
13
+ - original
14
+ size_categories:
15
+ - n<1K
16
+ tags:
17
+ - legal
18
+ - legal-reasoning
19
+ - agents
20
+ - long-horizon
21
+ - benchmark
22
+ configs:
23
+ - config_name: assignments
24
+ data_files:
25
+ - split: test
26
+ path: data/assignments/*.parquet
27
+ ---
28
+
29
+ # LegalReasonBench (micro1): Sample Release
30
+
31
+ LegalReasonBench measures how well AI agents carry a legal matter through a sequence of
32
+ assignments the way a practicing lawyer would: reading a case file, researching the law,
33
+ applying it to the facts, and producing court filings and memoranda, where each assignment
34
+ builds on the work before it. Every deliverable is graded against attorney-authored
35
+ rubrics that reward required legal points and penalize specific errors.
36
+
37
+ **Published report:** https://www.micro1.ai/benchmark/legal-reason-bench
38
+
39
+ ## Citation
40
+
41
+ Please cite as: **"LegalReasonBench (micro1). Available at: https://www.micro1.ai/benchmark/legal-reason-bench"**
42
+
43
+ ## Scope of this release
44
+
45
+ This is a sample of **5 matters (10% of LegalReasonBench)**, released for evaluation and
46
+ benchmarking. The remaining matters are held out. To request access to the full dataset,
47
+ contact isabel@micro1.ai.
48
+
49
+ | Matter | Practice area | Assignments | Criteria (penalties) | Research |
50
+ |---|---|---:|---:|---|
51
+ | `lrb-certiorari-quasi-judicial-land-use` · Petition for Writ of Certiorari for Quasi-judicial Proceeding | Real estate and land use | 2 | 37 (5) | open |
52
+ | `lrb-dcca-challenge-police-discipline` · Viability of a DCCA Challenge | Employment and labor | 5 | 54 (11) | closed |
53
+ | `lrb-interim-cmo-appointment-governance` · Interim CMO Appointment: Governance and Compliance Analysis | Corporate governance | 4 | 42 (8) | closed |
54
+ | `lrb-vicar-trial-jury-instructions` · OTB Gang VICAR Trial Jury Instructions | Criminal and investigations | 2 | 35 (7) | closed |
55
+ | `lrb-forum-non-conveniens-response` · Plaintiff's Response, Forum Non Conveniens | Litigation and dispute resolution | 2 | 53 (5) | closed |
56
+
57
+ 15 assignments, 221 criteria, 40 attachments (PDF and DOCX).
58
+
59
+ **Research universe.** In an *open-universe* matter the agent may research outside
60
+ authority on the web. In a *closed-universe* matter the prompt restricts it to the
61
+ supplied case file.
62
+
63
+ ## Contents
64
+
65
+ A `tasks/` tree of **5 runnable [Harbor](https://harborframework.com) multi-step tasks**,
66
+ one per matter, plus a Parquet index for the Dataset Viewer.
67
+
68
+ ```
69
+ tasks/lrb-dcca-challenge-police-discipline/
70
+ ├── task.toml # metadata, timeouts, one [[steps]] entry per assignment
71
+ ├── environment/Dockerfile # sandbox: Python, pandoc, poppler-utils, LibreOffice
72
+ └── steps/
73
+ ├── assignment-1/
74
+ │ ├── instruction.md # role prompt + the assignment, shown to the agent
75
+ │ ├── workdir/attachments/ # case-file documents for this assignment (copied to /app/attachments/)
76
+ │ ├── tests/ # verifier, NOT visible to the agent
77
+ │ │ ├── fixtures/rubric.json # the weighted criteria for this assignment
78
+ │ │ ├── raw_correctness/*.toml # one judge criterion per rubric item
79
+ │ │ ├── m1_judge_panel.json # the three-judge panel
80
+ │ │ └── test.sh # verifier entrypoint
81
+ │ └── solution/solve.sh # no oracle solution ships
82
+ ├── assignment-2/
83
+ └── ...
84
+ ```
85
+
86
+ Assignments run in order in one persistent `/app` sandbox. Each assignment writes its
87
+ deliverable to `/app/response<N>.md`, and later assignments can read earlier deliverables
88
+ and attachments.
89
+
90
+ ## Dataset Viewer columns
91
+
92
+ The `assignments/test` split has one row per assignment.
93
+
94
+ - `matter_id`, `matter_title`, `practice_area`, `research_universe`
95
+ - `assignment`, `num_assignments`, `assignment_title`
96
+ - `prompt`: the full assignment prompt (the instruction file adds the shared role prompt)
97
+ - `attachments`: paths of the documents introduced in this assignment
98
+ - `rubric_count`, `penalty_count`, `positive_points`
99
+ - `rubric`: JSON list of criteria with `criterion_id`, `points` (negative for penalties),
100
+ `polarity`, `irac_section` (Issue, Rule, Application, Conclusion), `criterion`,
101
+ `source` (the authority or record cite the criterion rests on) and `justification`
102
+ - `instruction_path`, `rubric_path`, `source_task_path`: paths into the Harbor bundle
103
+
104
+ ## Scoring
105
+
106
+ - **Criteria.** Each criterion is judged pass or fail. A required criterion earns its
107
+ points when met. A penalty criterion subtracts its points when the deliverable commits
108
+ the described error.
109
+ - **Assignment reward.** Signed points earned over available positive points, clamped to
110
+ [0, 1].
111
+ - **Matter reward.** Points-weighted across the matter's assignments: total signed points
112
+ earned over total positive points, clamped to [0, 1]. `scripts/score_matter.py`
113
+ computes it from a finished Harbor trial. Harbor's built-in `multi_step_reward_strategy
114
+ = "mean"` is diagnostic only.
115
+ - **Judges.** A strict majority of three LLM judges decides every criterion: GPT-5.6
116
+ Terra, Claude Sonnet 5 and Gemini 3.8 Flash, each at medium reasoning effort. Each
117
+ criterion is judged in its own call, and the judge reads only the deliverable.
118
+
119
+ ## Running
120
+
121
+ ```bash
122
+ uv tool install harbor
123
+ export OPENAI_API_KEY=... ANTHROPIC_API_KEY=... GEMINI_API_KEY=... # the judge panel
124
+ harbor run -p tasks/lrb-dcca-challenge-police-discipline -a opencode -m <provider/model>
125
+ harbor run -p tasks -a opencode -m <provider/model> # all five matters
126
+ python scripts/score_matter.py <trial directory>
127
+ ```
128
+
129
+ All three judge keys are required. The panel fails the assignment if any judge cannot be
130
+ reached, rather than scoring with fewer votes. The published results ran the OpenCode agent
131
+ with a three-hour limit per assignment.
132
+
133
+ ## Important notes
134
+
135
+ - **Sources.** The case files combine public legal authority (court opinions, statutes,
136
+ regulations and pattern jury instructions), public court records reproduced as filed,
137
+ and matter documents that legal experts wrote or adapted for the benchmark. Some matters
138
+ are built on real, publicly filed cases, so public records can name real parties.
139
+ - **No professional use.** This dataset does not provide legal advice and should not be
140
+ used for production decision-making without independent validation.
141
+ - **No endorsement.** Use of this dataset does not imply endorsement by micro1.
142
+
143
+ ## License
144
+
145
+ CC-BY-4.0.
data/assignments/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:75895d086e365475284e6c4f65eb921a5b299632b82d6472205127c8e335d0f7
3
+ size 85282
scripts/score_matter.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Score one LegalReasonBench matter from a finished Harbor trial.
2
+
3
+ The matter reward is points-weighted across its assignments: the sum of signed
4
+ points earned (penalties subtract) over the sum of available positive points,
5
+ clamped to [0, 1]. Harbor's own multi_step_reward_strategy = "mean" averages the
6
+ per-assignment rewards instead and is diagnostic only.
7
+
8
+ Usage: python score_matter.py <harbor trial dir>
9
+ """
10
+ import json
11
+ import sys
12
+ from pathlib import Path
13
+
14
+
15
+ def score(trial_dir: Path) -> dict:
16
+ earned = positive = 0.0
17
+ steps = []
18
+ # Each assignment's verifier writes reward-details.json; the raw RewardKit copy
19
+ # under raw/ has no aggregation block and is skipped.
20
+ for details in sorted(trial_dir.rglob("reward-details.json")):
21
+ correctness = json.loads(details.read_text()).get("correctness")
22
+ aggregation = correctness.get("aggregation") if isinstance(correctness, dict) else None
23
+ if not isinstance(aggregation, dict) or "earned" not in aggregation or "positive_total" not in aggregation:
24
+ continue
25
+ earned += float(aggregation["earned"])
26
+ positive += float(aggregation["positive_total"])
27
+ steps.append({
28
+ "file": str(details.relative_to(trial_dir)),
29
+ "assignment_reward": correctness.get("score"),
30
+ "earned": aggregation["earned"],
31
+ "positive_total": aggregation["positive_total"],
32
+ })
33
+ if not steps:
34
+ raise SystemExit(f"no assignment reward-details.json under {trial_dir}")
35
+ overall = max(0.0, min(1.0, earned / positive)) if positive > 0 else 0.0
36
+ return {"matter_reward": overall, "earned": earned, "positive_total": positive, "assignments": steps}
37
+
38
+
39
+ if __name__ == "__main__":
40
+ print(json.dumps(score(Path(sys.argv[1])), indent=2))
tasks/lrb-certiorari-quasi-judicial-land-use/environment/Dockerfile ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.13-slim-bookworm
2
+
3
+ RUN apt-get update && apt-get install -y --no-install-recommends \
4
+ bash \
5
+ ca-certificates \
6
+ curl \
7
+ file \
8
+ git \
9
+ libreoffice-calc \
10
+ libreoffice-impress \
11
+ libreoffice-writer \
12
+ pandoc \
13
+ poppler-utils \
14
+ unzip \
15
+ fonts-dejavu \
16
+ && rm -rf /var/lib/apt/lists/*
17
+
18
+ RUN python -m pip install --no-cache-dir \
19
+ uv \
20
+ openpyxl \
21
+ pandas \
22
+ pdfplumber \
23
+ pypdf \
24
+ python-docx \
25
+ python-pptx \
26
+ xlrd
27
+
28
+ WORKDIR /app
29
+ RUN ln -s . /app/app
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/instruction.md ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Petition for Writ of Certiorari for Quasi-judicial Proceeding — Legal Memorandum to Board of County Commissioners
2
+
3
+ Domain: Legal
4
+
5
+ Matter: Petition for Writ of Certiorari for Quasi-judicial Proceeding
6
+
7
+ You are a senior legal analyst operating autonomously. You are completing a multi-step legal reasoning task. Follow the role, factual record, instructions, and deliverable requirements provided in the Task and each Assignment.
8
+
9
+ Each Assignment may require a different legal deliverable. Follow the requirements specific to that Assignment.
10
+
11
+ ## Word limits for court briefs
12
+
13
+ - A brief in support of or in response to a motion may not exceed **8,750 words**.
14
+ - A reply brief may not exceed **3,500 words**.
15
+ - For a motion for reconsideration, a brief in support of or in response to the motion may not exceed **3,500 words**, and a reply brief may not exceed **1,750 words**.
16
+ - If an Assignment specifies a stricter word limit, follow the stricter limit.
17
+
18
+ These word limits do not apply to legal memoranda or other non-court-filing deliverables unless the Assignment expressly provides otherwise.
19
+
20
+ Complete the task end-to-end without asking for confirmation, permission, or clarification.
21
+
22
+ Use the uploaded matter documents in `/app/attachments/` as your primary case file. You also have internet access via OpenCode's `websearch` tool; use it to research any statutes, regulations, cases, administrative guidance, or secondary authorities that are not supplied as attachments. Cite any authority you rely on in the format requested by the prompt.
23
+
24
+ For document inspection:
25
+ - PDF: `pdftotext /app/attachments/<filename>.pdf -`
26
+ - DOCX: `pandoc /app/attachments/<filename>.docx -t markdown`
27
+ - XLSX/CSV: use Python with `openpyxl` or `pandas`
28
+ - If extraction is unreliable, inspect the raw file with Python libraries or convert/render the relevant pages.
29
+
30
+ Write the final complete legal deliverable for this assignment to `/app/response1.md`. The verifier reads only that file.
31
+
32
+ ## Attachments
33
+
34
+ - `/app/attachments/1774361815-lcu-project.pdf`: LCU Project Detail
35
+ - `/app/attachments/1774361815-orderpdf.docx`: Order Granting Petition
36
+ - `/app/attachments/1774361815-petition.docx`: Petition for Writ of Certiorari
37
+ - `/app/attachments/1774361815-resolution.docx`: Resolution Z-23-035
38
+
39
+
40
+ ## Prompt
41
+
42
+ 1st ASSIGNMENT
43
+ TO: Denise Swarek, Assistant County Attorney
44
+ FROM: Thomas Rowe, County Attorney
45
+ RE: PETER SPAHN, ET. AL., V. LEE COUNTY; Case No. 24-CA-1479
46
+ DATE: October 27, 2025
47
+ ________________________________________
48
+ We received the attached Order Granting Petition for Writ of Certiorari.
49
+ You are initially provided with the following record as uploaded files. Limit your review to these documents and what legal research is necessary to identify applicable rules and case law relevant to these documents. Do not conduct legal research beyond that. All legal analysis should be based on the versions of statutes, regulations, and ordinances in effect as of January 1, 2025.
50
+ • Resolution Z-23-035 (Resolution.docx)
51
+ • Petition for Writ of Certiorari (Petition.docx)
52
+ • Order Granting Petition (Orderpdf.docx)
53
+ • LCU Project Detail (LCU Project.pdf)
54
+ Review only these documents and draft a structured legal memorandum to the Board of County Commissioners that 1) outlines the Order and case history, 2) explains the implications of the Order, 3) identifies options and available actions for Lee County, 4) recommends a legal course of action to the Board. Use full Bluebook citation format.
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/solution/solve.sh ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # No oracle solution ships with LegalReasonBench. The verifier grades the
3
+ # agent's own legal deliverable for this assignment against the rubric.
4
+ echo "no oracle solution"
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/fixtures/config.json ADDED
@@ -0,0 +1,466 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "task_id": "lrb-certiorari-quasi-judicial-land-use",
3
+ "title": "Petition for Writ of Certiorari for Quasi-judicial Proceeding",
4
+ "domain": "Legal",
5
+ "matter": "Petition for Writ of Certiorari for Quasi-judicial Proceeding",
6
+ "judge": {
7
+ "max_concurrent_llm": 12,
8
+ "mode": "panel",
9
+ "members": [
10
+ {
11
+ "model": "openai/gpt-5.6-terra",
12
+ "reasoning_effort": "medium",
13
+ "timeout": 1500
14
+ },
15
+ {
16
+ "model": "anthropic/claude-sonnet-5",
17
+ "reasoning_effort": "medium",
18
+ "timeout": 1500
19
+ },
20
+ {
21
+ "model": "gemini/gemini-3.8-flash",
22
+ "reasoning_effort": "medium",
23
+ "timeout": 1500
24
+ }
25
+ ],
26
+ "model": "openai/gpt-5.6-terra",
27
+ "reasoning_effort": "medium",
28
+ "timeout": 1500
29
+ },
30
+ "step_index": 1,
31
+ "step_name": "assignment-1",
32
+ "step_title": "Legal Memorandum to Board of County Commissioners",
33
+ "prompt": "1st ASSIGNMENT\nTO: Denise Swarek, Assistant County Attorney\nFROM: Thomas Rowe, County Attorney\nRE: PETER SPAHN, ET. AL., V. LEE COUNTY; Case No. 24-CA-1479\nDATE: October 27, 2025\n________________________________________\nWe received the attached Order Granting Petition for Writ of Certiorari. \nYou are initially provided with the following record as uploaded files. Limit your review to these documents and what legal research is necessary to identify applicable rules and case law relevant to these documents. Do not conduct legal research beyond that. All legal analysis should be based on the versions of statutes, regulations, and ordinances in effect as of January 1, 2025.\n\u2022\tResolution Z-23-035 (Resolution.docx)\n\u2022\tPetition for Writ of Certiorari (Petition.docx)\n\u2022\tOrder Granting Petition (Orderpdf.docx)\n\u2022\tLCU Project Detail (LCU Project.pdf)\nReview only these documents and draft a structured legal memorandum to the Board of County Commissioners that 1) outlines the Order and case history, 2) explains the implications of the Order, 3) identifies options and available actions for Lee County, 4) recommends a legal course of action to the Board. Use full Bluebook citation format.",
34
+ "attachments": [
35
+ {
36
+ "filename": "1774361815-lcu-project.pdf",
37
+ "description": "LCU Project Detail",
38
+ "metadata": {},
39
+ "path": "/app/attachments/1774361815-lcu-project.pdf"
40
+ },
41
+ {
42
+ "filename": "1774361815-orderpdf.docx",
43
+ "description": "Order Granting Petition",
44
+ "metadata": {},
45
+ "path": "/app/attachments/1774361815-orderpdf.docx"
46
+ },
47
+ {
48
+ "filename": "1774361815-petition.docx",
49
+ "description": "Petition for Writ of Certiorari",
50
+ "metadata": {},
51
+ "path": "/app/attachments/1774361815-petition.docx"
52
+ },
53
+ {
54
+ "filename": "1774361815-resolution.docx",
55
+ "description": "Resolution Z-23-035",
56
+ "metadata": {},
57
+ "path": "/app/attachments/1774361815-resolution.docx"
58
+ }
59
+ ],
60
+ "rubric": [
61
+ {
62
+ "name": "states_in_the_first_assignment_that_the_order_granting_petition",
63
+ "description": "States in the first assignment that the Order Granting Petition for Writ of Certiorari quashes Lee County, Fla., Res. No. Z-23-035 (2024).",
64
+ "source": "Order.docx at 1. \"the petition for writ of certiorari is hereby GRANTED and the rezoning is QUASHED for the reasons discussed below.\"",
65
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that 1) outlines the Order and case history.\u201d",
66
+ "metadata": {
67
+ "review_flag": false,
68
+ "original_name": "states_in_the_first_assignment_that_the_order_granting_petition_for_writ_of_cert",
69
+ "original_index": 1,
70
+ "classifier_reason": "Names first assignment",
71
+ "classifier_confidence": "high"
72
+ },
73
+ "score": 5.0,
74
+ "polarity": "positive",
75
+ "raw_weight": 1.0
76
+ },
77
+ {
78
+ "name": "states_in_the_first_assignment_that_the_circuit_court_found_that",
79
+ "description": "States in the first assignment that the circuit court found that the Petitioners had standing to bring the petition based on proximity of the Petitioners' property to the proposed facility.",
80
+ "source": "Order.docx at 2. \"The court finds that Petitioners have standing to bring this petition for writ of certiorari based on their proximity of Petitioners' property.\"",
81
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that 1) outlines the Order and case history.\u201d",
82
+ "metadata": {
83
+ "review_flag": false,
84
+ "original_name": "states_in_the_first_assignment_that_the_circuit_court_found_that_the_petitioners",
85
+ "original_index": 2,
86
+ "classifier_reason": "Names first assignment",
87
+ "classifier_confidence": "high"
88
+ },
89
+ "score": 5.0,
90
+ "polarity": "positive",
91
+ "raw_weight": 1.0
92
+ },
93
+ {
94
+ "name": "states_in_the_first_assignment_that_the_circuit_court_found_th_2",
95
+ "description": "States in the first assignment that the circuit court found that the Lee County Board of County Commissioners \"improperly departed from the record created at the quasi-judicial hearings held below.\"",
96
+ "source": "Order.docx at 2. \"[t]he Lee County Board of County Commissioners (\"BOCC\") improperly departed from the record created at the quasi-judicial hearings held below.\"",
97
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that 1) outlines the Order and case history.\u201d",
98
+ "metadata": {
99
+ "review_flag": false,
100
+ "original_name": "states_in_the_first_assignment_that_the_circuit_court_found_that_the_lee_county",
101
+ "original_index": 3,
102
+ "classifier_reason": "Names first assignment",
103
+ "classifier_confidence": "high"
104
+ },
105
+ "score": 10.0,
106
+ "polarity": "positive",
107
+ "raw_weight": 1.0
108
+ },
109
+ {
110
+ "name": "states_in_the_first_assignment_that_the_circuit_court_found_th_3",
111
+ "description": "States in the first assignment that the circuit court found that Lee County's conduct \"created prejudice and bias\" surrounding the rezoning.",
112
+ "source": "Order.docx at 3. \"Lee county further prejudiced the quasi-judicial process surrounding the quasi-judicial hearing required for rezoning for this wastewater facility by its conduct which predetermined, or at very least created prejudice and bias, the decision to approve this quasi-judicial rezoning.\"",
113
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that 1) outlines the Order and case history.\u201d",
114
+ "metadata": {
115
+ "review_flag": false,
116
+ "original_name": "states_in_the_first_assignment_that_the_circuit_court_found_that_lee_county_s_co",
117
+ "original_index": 4,
118
+ "classifier_reason": "Names first assignment",
119
+ "classifier_confidence": "high"
120
+ },
121
+ "score": 10.0,
122
+ "polarity": "positive",
123
+ "raw_weight": 1.0
124
+ },
125
+ {
126
+ "name": "states_in_the_first_assignment_that_the_circuit_court_found_th_4",
127
+ "description": "States in the first assignment that the circuit court found that certain Federal Aviation Administration regulations \"were not fully considered below.\"",
128
+ "source": "Order.docx at 5. \"The decision below violated the essential requirements of law contained in the substantive provisions of the Land Development Code (LDC), adopting by reference \"protective\" regulatory guidance such as issued by the FAA regulating Land Use and Compatibility Advisories that were not fully considered below.\"",
129
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that 1) outlines the Order and case history.\u201d",
130
+ "metadata": {
131
+ "review_flag": false,
132
+ "original_name": "states_in_the_first_assignment_that_the_circuit_court_found_that_certain_federal",
133
+ "original_index": 5,
134
+ "classifier_reason": "Names first assignment",
135
+ "classifier_confidence": "high"
136
+ },
137
+ "score": 10.0,
138
+ "polarity": "positive",
139
+ "raw_weight": 1.0
140
+ },
141
+ {
142
+ "name": "mentions_in_the_first_assignment_that_the_county_s_prior_rezonin",
143
+ "description": "Mentions in the first assignment that the county's prior rezoning request in DCI2018-10023 was remanded by the Hearing Examiner to staff for further evaluation and analysis on August 13, 2019.",
144
+ "source": "Petition.docx at 17-18. \"LEE COUNTY planner Dirk Danley read into the record the August \n13, 2019 Remand (Tr5 p.2-3): \nFollowing the coordination between the applicant and staff we jointly request that DCI2018-10023 be remanded back to the staff for further evaluation and analysis to include public outreach sessions to address the concerns presented by the public participants during hearing pursuant to comprehensive plan amendments for the proposed public facility and the protection of environmental resources, evaluation and development for a more detailed site plan and to ensure that all alternatives have been fully reviewed and analyzed. The case will be re-analyzed, and future hearings will be noticed in compliance with the Land Development Code and Administrative Code. \"",
145
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that 1) outlines the Order and case history.\u201d",
146
+ "metadata": {
147
+ "review_flag": false,
148
+ "original_name": "mentions_in_the_first_assignment_that_the_county_s_prior_rezoning_request_in_dci",
149
+ "original_index": 6,
150
+ "classifier_reason": "Names first assignment",
151
+ "classifier_confidence": "high"
152
+ },
153
+ "score": 5.0,
154
+ "polarity": "positive",
155
+ "raw_weight": 1.0
156
+ },
157
+ {
158
+ "name": "states_in_the_first_assignment_that_under_lee_county_fla_admin_c",
159
+ "description": "States in the first assignment that under Lee County, Fla. Admin. Code \u00a7 2-6, 4.1 B. (2025), DCI2018-10023 was considered withdrawn on February 13, 2020.",
160
+ "source": "Lee County, Fla. Admin. Code \u00a7 2-6, 4.1 B. (2025); https://www.leegov.com/bocc/Administrative%20Codes/AC-2-6.pdf\n\"If the six month deadline is not met because of action or inaction of the Applicant/Appellant, the\napplication/appeal will be considered withdrawn.\"\nRemand occurred on August 13, 2029, and six months after that is February 13, 2020.",
161
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that 1) outlines the Order and case history.\u201d",
162
+ "metadata": {
163
+ "review_flag": false,
164
+ "original_name": "states_in_the_first_assignment_that_under_lee_county_fla_admin_code_2_6_4_1_b_20",
165
+ "original_index": 7,
166
+ "classifier_reason": "Names first assignment",
167
+ "classifier_confidence": "high"
168
+ },
169
+ "score": 5.0,
170
+ "polarity": "positive",
171
+ "raw_weight": 1.0
172
+ },
173
+ {
174
+ "name": "states_in_the_first_assignment_that_dci2018_10023_remained_activ",
175
+ "description": "States in the first assignment that DCI2018-10023 remained active until September 13, 2023.",
176
+ "source": "Petition.docx at 19. \"Procedurally, the 2019 zoning case was left open until September 13, 2023.\" This is incorrect because under Lee County Administrative Code 2-6, sec. 4.1 B., the case was considered withdrawn for not meeting the 6 month remand hearing deadline.",
177
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that 1) outlines the Order and case history.\u201d",
178
+ "metadata": {
179
+ "review_flag": false,
180
+ "original_name": "states_in_the_first_assignment_that_dci2018_10023_remained_active_until_septembe",
181
+ "original_index": 8,
182
+ "classifier_reason": "Names first assignment",
183
+ "classifier_confidence": "high"
184
+ },
185
+ "score": -15.0,
186
+ "polarity": "negative",
187
+ "raw_weight": 1.0
188
+ },
189
+ {
190
+ "name": "mentions_in_the_first_assignment_that_the_subject_property_was_p",
191
+ "description": "Mentions in the first assignment that the subject property was placed into the Public Facilities future land use category of the Lee County Comprehensive Plan pursuant to Lee County, Fla. Ordinance 23-28 (2023).",
192
+ "source": "Lee County Fla. Ordinance 23-28 (2023); https://results.leegov.com/Home/DownloadFile/KT0000348490\n\"WHEREAS , the Board held a public hearing for the adoption of the proposed amendment on October 18 , 2023. At that hearing , the Board approved a motion to adopt proposed amendment CPA2023-00003 pertaining to Southeast Advanced Water\nReclamation Facility, amending Map 1-A of the Lee Plan , the Future Land Use Map. \"\nThe future land use category dictates permissible zoning districts, which dictate permitted uses.",
193
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that 1) outlines the Order and case history.\u201d",
194
+ "metadata": {
195
+ "review_flag": false,
196
+ "original_name": "mentions_in_the_first_assignment_that_the_subject_property_was_placed_into_the_p",
197
+ "original_index": 9,
198
+ "classifier_reason": "Names first assignment",
199
+ "classifier_confidence": "high"
200
+ },
201
+ "score": 10.0,
202
+ "polarity": "positive",
203
+ "raw_weight": 1.0
204
+ },
205
+ {
206
+ "name": "states_in_the_first_assignment_that_the_effect_of_the_order_gran",
207
+ "description": "States in the first assignment that the effect of the Order Granting Writ of Certiorari is that the Board's decision is overturned.",
208
+ "source": "Florida law is unequivocal that when a circuit court finds error in a local government\u2019s quasi-judicial land use decision, its power is limited to quashing the decision and remanding the matter \u201cas if no order had been entered.\u201d See Broward County v. G.B.V. Int\u2019l, Ltd., 787 So. 2d 838, 845 (Fla. 2001) (\u201cWhen a circuit court grants certiorari relief, it quashes the order and leaves the matter pending before the lower tribunal as if no order had been entered.\u201d).\nhttps://caselaw.findlaw.com/court/fl-supreme-court/1495364.html#:~:text=When,judgment,-%2E",
209
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .2) explains the implications of the Order.\u201d",
210
+ "metadata": {
211
+ "review_flag": false,
212
+ "original_name": "states_in_the_first_assignment_that_the_effect_of_the_order_granting_writ_of_cer",
213
+ "original_index": 10,
214
+ "classifier_reason": "Names first assignment",
215
+ "classifier_confidence": "high"
216
+ },
217
+ "score": -10.0,
218
+ "polarity": "negative",
219
+ "raw_weight": 1.0
220
+ },
221
+ {
222
+ "name": "states_in_the_first_assignment_that_the_county_must_stop_constru",
223
+ "description": "States in the first assignment that the county must stop construction activities as a result of the Order Granting Writ of Certiorari.",
224
+ "source": "LCU Project.pdf at 1 shows that construction has started.\n\"Construction of the Southeast Advanced Water Reclamation Facility started on October 6, 2025.\"\nInjunctive relief is not an available remedy in a writ of certiorari of a quasi-judicial decision. See City of Fort Pierce v. Dickerson, 588 So.2d 1080, 1082 (Fla. 4th DCA 1991). https://www.casemine.com/judgement/us/59148822add7b049344ef125#:~:text=Since,injunction \n\"Since review of the resolution should have been by certiorari, the trial court was without jurisdiction to entertain a complaint for declaratory and injunctive relief and should not have granted the Dickersons' motion for a temporary injunction.\"",
225
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .2) explains the implications of the Order.\u201d",
226
+ "metadata": {
227
+ "review_flag": false,
228
+ "original_name": "states_in_the_first_assignment_that_the_county_must_stop_construction_activities",
229
+ "original_index": 11,
230
+ "classifier_reason": "Names first assignment",
231
+ "classifier_confidence": "high"
232
+ },
233
+ "score": -20.0,
234
+ "polarity": "negative",
235
+ "raw_weight": 1.0
236
+ },
237
+ {
238
+ "name": "states_in_the_first_assignment_that_the_exclusive_method_of_revi",
239
+ "description": "States in the first assignment that the exclusive method of review of a quasi-judicial decision is by petition for writ of certiorari under Fla. R. App. P. 9.100(c) (2025) within 30 days of the written decision.",
240
+ "source": "Fla. R. App. P. 9.100(c) (2025); https://rules.floridaappellate.com/rule-9-100/#:~:text=Petitions,by%20certiorari\n\"Petitions for Certiorari; Review of NonFinal Agency Action; Review of Prisoner Disciplinary Action. The following shall be filed within 30 days of rendition of the order to be reviewed:\n\n(1) a petition for certiorari;\n\n(2) a petition to review quasi-judicial action of agencies, boards, and commissions of local government, which action is not directly appealable under any other provision of general law but may be subject to review by certiorari;\"\nSee City of Fort Pierce v. Dickerson, 588 So.2d 1080, 1082 (Fla. 4th DCA 1991).\nhttps://www.casemine.com/judgement/us/59148822add7b049344ef125#:~:text=Thus,relief\n\"Thus, we conclude that the resolution by the Ft. Pierce City Commission was quasi-judicial. Consequently, we agree with Ft. Pierce's assertion that since the resolution was a quasi-judicial decision rendered by the Commission, it was reviewable only by petition for writ of certiorari, and not by a complaint for declaratory and injunctive relief.\"",
241
+ "justification": "This rubric item is implied, though not directly requested, in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .2) explains the implications of the Order.\u201d This is important in responding to the prompt question about implications of the order because it explains why injunctive relief is not available in a writ of certiorari of a quasi-judicial decision.",
242
+ "metadata": {
243
+ "review_flag": false,
244
+ "original_name": "states_in_the_first_assignment_that_the_exclusive_method_of_review_of_a_quasi_ju",
245
+ "original_index": 12,
246
+ "classifier_reason": "Names first assignment",
247
+ "classifier_confidence": "high"
248
+ },
249
+ "score": 15.0,
250
+ "polarity": "positive",
251
+ "raw_weight": 1.0
252
+ },
253
+ {
254
+ "name": "states_in_the_first_assignment_that_the_exclusive_method_of_chal",
255
+ "description": "States in the first assignment that the exclusive method of challenging the issuance of a development order that materially alters the use or density or intensity of use on a particular piece of property is by filing a petition for writ of certiorari under Fla. Stat. \u00a7 163.3215(4) (2025) within 30 days of rendition of the development order.",
256
+ "source": "Fla. Stat. 163.3215(4) (2025); https://www.leg.state.fl.us/Statutes/index.cfm?App_mode=Display_Statute&URL=0100-0199/0163/Sections/0163.3215.html#:~:text=the%20sole,for%20certiorari\n\"the sole method by which an aggrieved and adversely affected party may challenge any decision of local government granting or denying an application for a development order, as defined in s. 163.3164, which materially alters the use or density or intensity of use on a particular piece of property, is by an appeal filed by a petition for writ of certiorari filed in circuit court no later than 30 days following rendition of a development order or other written decision of the local government, or when all local administrative appeals, if any, are exhausted, whichever occurs later. An action for injunctive or other relief may be joined with the petition for certiorari.\"\nA challenge to issuance of a development order, which is an executive function, is a separate cause of action from appeal of a quasi-judicial decision.",
257
+ "justification": "This rubric item is implied, though not directly requested, in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .2) explains the implications of the Order.\u201d This is crucial because challenging a development order is the sole method to seek injunctive relief under Fla. Stat. 163.3215(4).",
258
+ "metadata": {
259
+ "review_flag": false,
260
+ "original_name": "states_in_the_first_assignment_that_the_exclusive_method_of_challenging_the_issu",
261
+ "original_index": 13,
262
+ "classifier_reason": "Names first assignment",
263
+ "classifier_confidence": "high"
264
+ },
265
+ "score": 10.0,
266
+ "polarity": "positive",
267
+ "raw_weight": 1.0
268
+ },
269
+ {
270
+ "name": "states_in_the_first_assignment_that_under_fla_stat_163_3167_10_2",
271
+ "description": "States in the first assignment that under Fla. Stat \u00a7 163.3167(10) (2025) the development order issued for the project may not be invalidated by a subsequent judicial determination because the timeframe for filing an appeal of the development order has expired.",
272
+ "source": "Fla. Stat 163.3167(10) (2025); https://www.leg.state.fl.us/statutes/index.cfm?App_mode=Display_Statute&URL=0100-0199/0163/Sections/0163.3167.html#:~:text=If,standards\n\"If a local government grants a development order pursuant to its adopted land development regulations and the order is not the subject of a pending appeal and the timeframe for filing an appeal has expired, the development order may not be invalidated by a subsequent judicial determination that such land development regulations, or any portion thereof that is relevant to the development order, are invalid because of a deficiency in the approval standards\"",
273
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .2) explains the implications of the Order.\u201d",
274
+ "metadata": {
275
+ "review_flag": false,
276
+ "original_name": "states_in_the_first_assignment_that_under_fla_stat_163_3167_10_2025_the_developm",
277
+ "original_index": 14,
278
+ "classifier_reason": "Names first assignment",
279
+ "classifier_confidence": "high"
280
+ },
281
+ "score": 10.0,
282
+ "polarity": "positive",
283
+ "raw_weight": 1.0
284
+ },
285
+ {
286
+ "name": "states_in_the_first_assignment_that_the_petitioners_may_file_a_s",
287
+ "description": "States in the first assignment that the Petitioners may file a separate cause of action for injunction to stop construction activities.",
288
+ "source": "See City of Fort Pierce v. Dickerson, 588 So.2d 1080, 1082 (Fla. 4th DCA 1991). https://www.casemine.com/judgement/us/59148822add7b049344ef125#:~:text=Since,injunction \n\"Since review of the resolution should have been by certiorari, the trial court was without jurisdiction to entertain a complaint for declaratory and injunctive relief and should not have granted the Dickersons' motion for a temporary injunction.\"",
289
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .2) explains the implications of the Order.\u201d",
290
+ "metadata": {
291
+ "review_flag": false,
292
+ "original_name": "states_in_the_first_assignment_that_the_petitioners_may_file_a_separate_cause_of",
293
+ "original_index": 15,
294
+ "classifier_reason": "Names first assignment",
295
+ "classifier_confidence": "high"
296
+ },
297
+ "score": -15.0,
298
+ "polarity": "negative",
299
+ "raw_weight": 1.0
300
+ },
301
+ {
302
+ "name": "states_in_the_first_assignment_that_the_county_could_appeal_the",
303
+ "description": "States in the first assignment that the county could appeal the Order Granting Writ of Certiorari to the Sixth District Court of Appeals pursuant to Fla. R. App. P. 9.030(b)(2)(B).",
304
+ "source": "Florida Rule of Appellate Procedure 9.030(b)(2)(B); https://rules.floridaappellate.com/rule-9-030/#:~:text=b%29-,Jurisdiction,capacity\n\"Jurisdiction of District Courts of Appeal.\n\"b) Jurisdiction of District Courts of Appeal.\n. . .\n(2) Certiorari Jurisdiction.8 The certiorari jurisdiction of district courts of appeal may be sought to review:\n(A) nonfinal orders of lower tribunals other than as prescribed by rule 9.130; or\n(B) final orders of circuit courts acting in their review capacity.\"\nSee also Map of Florida\u2019s Court Jurisdictions, available at https://flcourts-media.flcourts.gov/content/download/426177/file/ar-17-18-map-of-floridas-court-jurisdictions.pdf (last accessed Mar. 25, 2026).",
305
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .3) identifies options and available actions for the county.\u201d",
306
+ "metadata": {
307
+ "review_flag": false,
308
+ "original_name": "states_in_the_first_assignment_that_the_county_could_appeal_the_order_granting_w",
309
+ "original_index": 16,
310
+ "classifier_reason": "Names first assignment",
311
+ "classifier_confidence": "high"
312
+ },
313
+ "score": 5.0,
314
+ "polarity": "positive",
315
+ "raw_weight": 1.0
316
+ },
317
+ {
318
+ "name": "states_in_the_first_assignment_that_the_county_could_remand_the",
319
+ "description": "States in the first assignment that the county could remand the case back to the Hearing Examiner for an evidentiary hearing to address the deficiencies identified in the Order Granting Petition for Writ of Certiorari under Lee County Fla. Land Development Code \u00a7 34-83(a)(6) (2025).",
320
+ "source": "Lee County Fla. Land Development Code \u00a7 34-83(a)(6) (2025); https://library.municode.com/fl/lee_county/codes/land_development_code?nodeId=LADECO_CH34ZO_ARTIIAD_DIV2BOCOCO_S34-83FUAU#:~:text=The%20Board%20may%20remand%20a%20case%20back%20to%20the%20Hearing%20Examiner%20for%20further%20review%20of%20specific%20issues%2E%20The%20scope%20of%20the%20remanded%20hearing%20will%20be%20limited%20to%20the%20specific%20issues%20identified%20by%20the%20Board\n\"The Board may remand a case back to the Hearing Examiner for further review of specific issues. The scope of the remanded hearing will be limited to the specific issues identified by the Board.\"",
321
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .3) identifies options and available actions for the county.\u201d",
322
+ "metadata": {
323
+ "review_flag": false,
324
+ "original_name": "states_in_the_first_assignment_that_the_county_could_remand_the_case_back_to_the",
325
+ "original_index": 17,
326
+ "classifier_reason": "Names first assignment",
327
+ "classifier_confidence": "high"
328
+ },
329
+ "score": 5.0,
330
+ "polarity": "positive",
331
+ "raw_weight": 1.0
332
+ },
333
+ {
334
+ "name": "states_in_the_first_assignment_that_the_county_could_file_a_new",
335
+ "description": "States in the first assignment that the County could file a new application for rezoning.",
336
+ "source": "The Lee County Department of Community Development website has a link to an application for \"Continuance, Deferral, or Withdrawal\" which can be filed at any time by the county; https://www.leegov.com/dcd/zoning/apps#:~:text=Continuance%2C%20Deferral%2C%20OR%20Withdrawal,-%E2%80%8B",
337
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .3) identifies options and available actions for the county.\u201d",
338
+ "metadata": {
339
+ "review_flag": false,
340
+ "original_name": "states_in_the_first_assignment_that_the_county_could_file_a_new_application_for",
341
+ "original_index": 18,
342
+ "classifier_reason": "Names first assignment",
343
+ "classifier_confidence": "high"
344
+ },
345
+ "score": 5.0,
346
+ "polarity": "positive",
347
+ "raw_weight": 1.0
348
+ },
349
+ {
350
+ "name": "states_in_the_first_assignment_that_the_county_could_voluntarily",
351
+ "description": "States in the first assignment that the County could voluntarily cease construction activities pending resolution of the challenge.",
352
+ "source": "LCU Project.pdf at 1. Construction has started, but could be stopped at the direction of the Board, though the costs would be extremely high.",
353
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .3) identifies options and available actions for the county.\u201d",
354
+ "metadata": {
355
+ "review_flag": false,
356
+ "original_name": "states_in_the_first_assignment_that_the_county_could_voluntarily_cease_construct",
357
+ "original_index": 19,
358
+ "classifier_reason": "Names first assignment",
359
+ "classifier_confidence": "high"
360
+ },
361
+ "score": 5.0,
362
+ "polarity": "positive",
363
+ "raw_weight": 1.0
364
+ },
365
+ {
366
+ "name": "states_in_the_first_assignment_that_the_county_could_take_the_po",
367
+ "description": "States in the first assignment that the County could take the position that the rezoning is not necessary because the county is not bound by its local zoning laws in carrying out a governmental function.",
368
+ "source": "See Sandra G. Smith, Immunity of State and State Related Activities from Local Municipal Zoning Regulations: Florida Focus, 28 Fla. L. Rev. 800 (1967).\nAvailable at: https://scholarship.law.ufl.edu/flr/vol28/iss3/9 \nhttps://scholarship.law.ufl.edu/cgi/viewcontent.cgi?article=2881&context=flr\n\"The Fourth District Court of Appeal relied\non Nichols for the premise that in the performance of a governmental activity the county should not be subject to its own zoning restrictions. 2 In a 1978\ndecision Dade County was challenged by private property owners when it attempted to violate its own zoning restrictions by building a jail facility on\nproperty reserved for another use under a comprehensive zoning ordinance. 28\nThe Third District Court of Appeal recognized a right under common law and under Florida law for \"a governmental entity to place a governmental\nfacility without regard to a comprehensive zoning ordinance or its procedures.\"\nThe article quotes Metropolitan Dade County v. Parkway Towers Condominium Ass'n, 281 So. 2d 68\n(Fla. 3d DCA 1973), a 3rd DCA case establishing immunity from zoning for governmental purposes. The case is not found publicly available, however the FL Supreme Court accepted, but then discharged), a petition for writ. Note that the FL Supreme Court expressed a \"prospective opinion\" that local governments \"should\" go through rezonings if not in compliance, this is dicta and not binding as the court upheld the district court's decision on immunity. \nParkway Towers Con. Ass'n v. Metropolitan Dade Cnty., 295 So.2d 295 (Fla. 1974); https://law.justia.com/cases/florida/supreme-court/1974/44260-0.html#:~:text=Although,ordinances,-%2E\n\"Although we now consider our issuance of the writ of certiorari to have been improvident in this case, which results in our discharge thereof, it is nevertheless our view prospectively that zoning variations to accommodate county or municipal facility purposes should either have been anticipated in zoning ordinances before construction or operation of such facilities is commenced *296 or, if this has not been done, construction should not be undertaken thereof until after due modification or change therefor is made in existing zoning ordinances.\"",
369
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .3) identifies options and available actions for the county.\u201d",
370
+ "metadata": {
371
+ "review_flag": false,
372
+ "original_name": "states_in_the_first_assignment_that_the_county_could_take_the_position_that_the",
373
+ "original_index": 20,
374
+ "classifier_reason": "Names first assignment",
375
+ "classifier_confidence": "high"
376
+ },
377
+ "score": 5.0,
378
+ "polarity": "positive",
379
+ "raw_weight": 1.0
380
+ },
381
+ {
382
+ "name": "states_in_the_first_assignment_that_the_county_could_negotiate_f",
383
+ "description": "States in the first assignment that the County could negotiate for additional conditions protecting wildlife that address Petitioners' concerns.",
384
+ "source": "Petitioners' concerns are outlined in Petition.docx at pages 3-13. These include concerns about protection of wild life.",
385
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .3) identifies options and available actions for the county.\u201d",
386
+ "metadata": {
387
+ "review_flag": false,
388
+ "original_name": "states_in_the_first_assignment_that_the_county_could_negotiate_for_additional_co",
389
+ "original_index": 21,
390
+ "classifier_reason": "Names first assignment",
391
+ "classifier_confidence": "high"
392
+ },
393
+ "score": 5.0,
394
+ "polarity": "positive",
395
+ "raw_weight": 1.0
396
+ },
397
+ {
398
+ "name": "states_in_the_first_assignment_that_the_county_could_negotiate_2",
399
+ "description": "States in the first assignment that the County could negotiate for additional conditions protecting water quality that address Petitioners' concerns.",
400
+ "source": "Petitioners' concerns are outlined in Petition.docx at pages 3-13. These include concerns about protection of water quality.",
401
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .3) identifies options and available actions for the county.\u201d",
402
+ "metadata": {
403
+ "review_flag": false,
404
+ "original_name": "states_in_the_first_assignment_that_the_county_could_negotiate_for_additional_co_2",
405
+ "original_index": 22,
406
+ "classifier_reason": "Names first assignment",
407
+ "classifier_confidence": "high"
408
+ },
409
+ "score": 5.0,
410
+ "polarity": "positive",
411
+ "raw_weight": 1.0
412
+ },
413
+ {
414
+ "name": "states_in_the_first_assignment_that_the_county_should_file_a_tim",
415
+ "description": "States in the first assignment that the County should file a timely appeal with the 6th District Court of Appeals.",
416
+ "source": "Because the Order contains reversible errors, and because an appeal can be pursued parallel to a remand, this is the best recommendation.\nFlorida Rule of Appellate Procedure 9.030(b)(2)(B); https://rules.floridaappellate.com/rule-9-030/#:~:text=b%29-,Jurisdiction,capacity\n\"Jurisdiction of District Courts of Appeal.\n\"b) Jurisdiction of District Courts of Appeal.\n. . .\n(2) Certiorari Jurisdiction.8 The certiorari jurisdiction of district courts of appeal may be sought to review:\n(A) nonfinal orders of lower tribunals other than as prescribed by rule 9.130; or\n(B) final orders of circuit courts acting in their review capacity.\"\nSee also Map of Florida\u2019s Court Jurisdictions, available at https://flcourts-media.flcourts.gov/content/download/426177/file/ar-17-18-map-of-floridas-court-jurisdictions.pdf (last accessed Mar. 25, 2026).",
417
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .4) recommends a legal course of action to the Board.\u201d",
418
+ "metadata": {
419
+ "review_flag": false,
420
+ "original_name": "states_in_the_first_assignment_that_the_county_should_file_a_timely_appeal_with",
421
+ "original_index": 23,
422
+ "classifier_reason": "Names first assignment",
423
+ "classifier_confidence": "high"
424
+ },
425
+ "score": 20.0,
426
+ "polarity": "positive",
427
+ "raw_weight": 1.0
428
+ },
429
+ {
430
+ "name": "states_in_the_first_assignment_that_the_county_should_remand_the",
431
+ "description": "States in the first assignment that the County should remand the case to the Hearing Examiner to address the deficiencies identified in the Order Granting Writ of Certiorari while an appeal is pending.",
432
+ "source": "Because the Order contains reversible errors, and because an appeal can be pursued parallel to a remand, this is the best recommendation.\nLee County Fla. Land Development Code \u00a7 34-83(a)(6) (2025); https://library.municode.com/fl/lee_county/codes/land_development_code?nodeId=LADECO_CH34ZO_ARTIIAD_DIV2BOCOCO_S34-83FUAU#:~:text=The%20Board%20may%20remand%20a%20case%20back%20to%20the%20Hearing%20Examiner%20for%20further%20review%20of%20specific%20issues%2E%20The%20scope%20of%20the%20remanded%20hearing%20will%20be%20limited%20to%20the%20specific%20issues%20identified%20by%20the%20Board\n\"The Board may remand a case back to the Hearing Examiner for further review of specific issues. The scope of the remanded hearing will be limited to the specific issues identified by the Board.\"",
433
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .4) recommends a legal course of action to the Board.\u201d",
434
+ "metadata": {
435
+ "review_flag": false,
436
+ "original_name": "states_in_the_first_assignment_that_the_county_should_remand_the_case_to_the_hea",
437
+ "original_index": 24,
438
+ "classifier_reason": "Names first assignment",
439
+ "classifier_confidence": "high"
440
+ },
441
+ "score": 20.0,
442
+ "polarity": "positive",
443
+ "raw_weight": 1.0
444
+ },
445
+ {
446
+ "name": "states_in_the_first_assignment_that_the_county_should_cease_cons",
447
+ "description": "States in the first assignment that the County should cease construction activities at the subject property.",
448
+ "source": "LCU Project.pdf at 1 shows that construction has started, which means the county has spent time and money on design, permitting, procurement of contractors, etc. The facility is also necessary to serve increased demand for water and sewer service caused by population growth and has been planned since 2010 (LCU Project.pdf at 4.)\nIn a similar case, the FL Supreme Court declined to delay construction of a public project based on zoning.\nSee Parkway Towers Con. Ass'n v. Metropolitan Dade Cty., 295 So.2d 295 (Fla. 1974); https://law.justia.com/cases/florida/supreme-court/1974/44260-0.html#:~:text=This%20being,result\n\"In this case it appears that on at least two occasions public hearings were held by the Metro County Commission on the question whether the construction of the subject holding facility for prisoners and the work release facility should go forward in the absence of a waiver therefor in the zoning ordinance and in each instance it was agreed by the Commission the construction should proceed. This being so, we feel no useful or practical purpose would be served in interrupting and delaying the construction until a zoning change is effected retroactively to accommodate the Commission's expressly resolved purpose when considered in connection with the fact that no direct conflict of decisions appears. To interrupt the construction now would cause needless expense and damage with no prospect or likelihood that the Commission would reach a different final result.\"",
449
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .4) recommends a legal course of action to the Board.\u201d",
450
+ "metadata": {
451
+ "review_flag": false,
452
+ "original_name": "states_in_the_first_assignment_that_the_county_should_cease_construction_activit",
453
+ "original_index": 25,
454
+ "classifier_reason": "Names first assignment",
455
+ "classifier_confidence": "high"
456
+ },
457
+ "score": -30.0,
458
+ "polarity": "negative",
459
+ "raw_weight": 1.0
460
+ }
461
+ ],
462
+ "answer_path": "/app/response1.md",
463
+ "answer_relative_path": "response1.md",
464
+ "is_followon": false,
465
+ "prev_answer_path": ""
466
+ }
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/fixtures/rubric.json ADDED
@@ -0,0 +1,404 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "criteria": [
3
+ {
4
+ "name": "states_in_the_first_assignment_that_the_order_granting_petition",
5
+ "description": "States in the first assignment that the Order Granting Petition for Writ of Certiorari quashes Lee County, Fla., Res. No. Z-23-035 (2024).",
6
+ "source": "Order.docx at 1. \"the petition for writ of certiorari is hereby GRANTED and the rezoning is QUASHED for the reasons discussed below.\"",
7
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that 1) outlines the Order and case history.\u201d",
8
+ "metadata": {
9
+ "review_flag": false,
10
+ "original_name": "states_in_the_first_assignment_that_the_order_granting_petition_for_writ_of_cert",
11
+ "original_index": 1,
12
+ "classifier_reason": "Names first assignment",
13
+ "classifier_confidence": "high"
14
+ },
15
+ "score": 5.0,
16
+ "polarity": "positive",
17
+ "raw_weight": 1.0
18
+ },
19
+ {
20
+ "name": "states_in_the_first_assignment_that_the_circuit_court_found_that",
21
+ "description": "States in the first assignment that the circuit court found that the Petitioners had standing to bring the petition based on proximity of the Petitioners' property to the proposed facility.",
22
+ "source": "Order.docx at 2. \"The court finds that Petitioners have standing to bring this petition for writ of certiorari based on their proximity of Petitioners' property.\"",
23
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that 1) outlines the Order and case history.\u201d",
24
+ "metadata": {
25
+ "review_flag": false,
26
+ "original_name": "states_in_the_first_assignment_that_the_circuit_court_found_that_the_petitioners",
27
+ "original_index": 2,
28
+ "classifier_reason": "Names first assignment",
29
+ "classifier_confidence": "high"
30
+ },
31
+ "score": 5.0,
32
+ "polarity": "positive",
33
+ "raw_weight": 1.0
34
+ },
35
+ {
36
+ "name": "states_in_the_first_assignment_that_the_circuit_court_found_th_2",
37
+ "description": "States in the first assignment that the circuit court found that the Lee County Board of County Commissioners \"improperly departed from the record created at the quasi-judicial hearings held below.\"",
38
+ "source": "Order.docx at 2. \"[t]he Lee County Board of County Commissioners (\"BOCC\") improperly departed from the record created at the quasi-judicial hearings held below.\"",
39
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that 1) outlines the Order and case history.\u201d",
40
+ "metadata": {
41
+ "review_flag": false,
42
+ "original_name": "states_in_the_first_assignment_that_the_circuit_court_found_that_the_lee_county",
43
+ "original_index": 3,
44
+ "classifier_reason": "Names first assignment",
45
+ "classifier_confidence": "high"
46
+ },
47
+ "score": 10.0,
48
+ "polarity": "positive",
49
+ "raw_weight": 1.0
50
+ },
51
+ {
52
+ "name": "states_in_the_first_assignment_that_the_circuit_court_found_th_3",
53
+ "description": "States in the first assignment that the circuit court found that Lee County's conduct \"created prejudice and bias\" surrounding the rezoning.",
54
+ "source": "Order.docx at 3. \"Lee county further prejudiced the quasi-judicial process surrounding the quasi-judicial hearing required for rezoning for this wastewater facility by its conduct which predetermined, or at very least created prejudice and bias, the decision to approve this quasi-judicial rezoning.\"",
55
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that 1) outlines the Order and case history.\u201d",
56
+ "metadata": {
57
+ "review_flag": false,
58
+ "original_name": "states_in_the_first_assignment_that_the_circuit_court_found_that_lee_county_s_co",
59
+ "original_index": 4,
60
+ "classifier_reason": "Names first assignment",
61
+ "classifier_confidence": "high"
62
+ },
63
+ "score": 10.0,
64
+ "polarity": "positive",
65
+ "raw_weight": 1.0
66
+ },
67
+ {
68
+ "name": "states_in_the_first_assignment_that_the_circuit_court_found_th_4",
69
+ "description": "States in the first assignment that the circuit court found that certain Federal Aviation Administration regulations \"were not fully considered below.\"",
70
+ "source": "Order.docx at 5. \"The decision below violated the essential requirements of law contained in the substantive provisions of the Land Development Code (LDC), adopting by reference \"protective\" regulatory guidance such as issued by the FAA regulating Land Use and Compatibility Advisories that were not fully considered below.\"",
71
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that 1) outlines the Order and case history.\u201d",
72
+ "metadata": {
73
+ "review_flag": false,
74
+ "original_name": "states_in_the_first_assignment_that_the_circuit_court_found_that_certain_federal",
75
+ "original_index": 5,
76
+ "classifier_reason": "Names first assignment",
77
+ "classifier_confidence": "high"
78
+ },
79
+ "score": 10.0,
80
+ "polarity": "positive",
81
+ "raw_weight": 1.0
82
+ },
83
+ {
84
+ "name": "mentions_in_the_first_assignment_that_the_county_s_prior_rezonin",
85
+ "description": "Mentions in the first assignment that the county's prior rezoning request in DCI2018-10023 was remanded by the Hearing Examiner to staff for further evaluation and analysis on August 13, 2019.",
86
+ "source": "Petition.docx at 17-18. \"LEE COUNTY planner Dirk Danley read into the record the August \n13, 2019 Remand (Tr5 p.2-3): \nFollowing the coordination between the applicant and staff we jointly request that DCI2018-10023 be remanded back to the staff for further evaluation and analysis to include public outreach sessions to address the concerns presented by the public participants during hearing pursuant to comprehensive plan amendments for the proposed public facility and the protection of environmental resources, evaluation and development for a more detailed site plan and to ensure that all alternatives have been fully reviewed and analyzed. The case will be re-analyzed, and future hearings will be noticed in compliance with the Land Development Code and Administrative Code. \"",
87
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that 1) outlines the Order and case history.\u201d",
88
+ "metadata": {
89
+ "review_flag": false,
90
+ "original_name": "mentions_in_the_first_assignment_that_the_county_s_prior_rezoning_request_in_dci",
91
+ "original_index": 6,
92
+ "classifier_reason": "Names first assignment",
93
+ "classifier_confidence": "high"
94
+ },
95
+ "score": 5.0,
96
+ "polarity": "positive",
97
+ "raw_weight": 1.0
98
+ },
99
+ {
100
+ "name": "states_in_the_first_assignment_that_under_lee_county_fla_admin_c",
101
+ "description": "States in the first assignment that under Lee County, Fla. Admin. Code \u00a7 2-6, 4.1 B. (2025), DCI2018-10023 was considered withdrawn on February 13, 2020.",
102
+ "source": "Lee County, Fla. Admin. Code \u00a7 2-6, 4.1 B. (2025); https://www.leegov.com/bocc/Administrative%20Codes/AC-2-6.pdf\n\"If the six month deadline is not met because of action or inaction of the Applicant/Appellant, the\napplication/appeal will be considered withdrawn.\"\nRemand occurred on August 13, 2029, and six months after that is February 13, 2020.",
103
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that 1) outlines the Order and case history.\u201d",
104
+ "metadata": {
105
+ "review_flag": false,
106
+ "original_name": "states_in_the_first_assignment_that_under_lee_county_fla_admin_code_2_6_4_1_b_20",
107
+ "original_index": 7,
108
+ "classifier_reason": "Names first assignment",
109
+ "classifier_confidence": "high"
110
+ },
111
+ "score": 5.0,
112
+ "polarity": "positive",
113
+ "raw_weight": 1.0
114
+ },
115
+ {
116
+ "name": "states_in_the_first_assignment_that_dci2018_10023_remained_activ",
117
+ "description": "States in the first assignment that DCI2018-10023 remained active until September 13, 2023.",
118
+ "source": "Petition.docx at 19. \"Procedurally, the 2019 zoning case was left open until September 13, 2023.\" This is incorrect because under Lee County Administrative Code 2-6, sec. 4.1 B., the case was considered withdrawn for not meeting the 6 month remand hearing deadline.",
119
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that 1) outlines the Order and case history.\u201d",
120
+ "metadata": {
121
+ "review_flag": false,
122
+ "original_name": "states_in_the_first_assignment_that_dci2018_10023_remained_active_until_septembe",
123
+ "original_index": 8,
124
+ "classifier_reason": "Names first assignment",
125
+ "classifier_confidence": "high"
126
+ },
127
+ "score": -15.0,
128
+ "polarity": "negative",
129
+ "raw_weight": 1.0
130
+ },
131
+ {
132
+ "name": "mentions_in_the_first_assignment_that_the_subject_property_was_p",
133
+ "description": "Mentions in the first assignment that the subject property was placed into the Public Facilities future land use category of the Lee County Comprehensive Plan pursuant to Lee County, Fla. Ordinance 23-28 (2023).",
134
+ "source": "Lee County Fla. Ordinance 23-28 (2023); https://results.leegov.com/Home/DownloadFile/KT0000348490\n\"WHEREAS , the Board held a public hearing for the adoption of the proposed amendment on October 18 , 2023. At that hearing , the Board approved a motion to adopt proposed amendment CPA2023-00003 pertaining to Southeast Advanced Water\nReclamation Facility, amending Map 1-A of the Lee Plan , the Future Land Use Map. \"\nThe future land use category dictates permissible zoning districts, which dictate permitted uses.",
135
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that 1) outlines the Order and case history.\u201d",
136
+ "metadata": {
137
+ "review_flag": false,
138
+ "original_name": "mentions_in_the_first_assignment_that_the_subject_property_was_placed_into_the_p",
139
+ "original_index": 9,
140
+ "classifier_reason": "Names first assignment",
141
+ "classifier_confidence": "high"
142
+ },
143
+ "score": 10.0,
144
+ "polarity": "positive",
145
+ "raw_weight": 1.0
146
+ },
147
+ {
148
+ "name": "states_in_the_first_assignment_that_the_effect_of_the_order_gran",
149
+ "description": "States in the first assignment that the effect of the Order Granting Writ of Certiorari is that the Board's decision is overturned.",
150
+ "source": "Florida law is unequivocal that when a circuit court finds error in a local government\u2019s quasi-judicial land use decision, its power is limited to quashing the decision and remanding the matter \u201cas if no order had been entered.\u201d See Broward County v. G.B.V. Int\u2019l, Ltd., 787 So. 2d 838, 845 (Fla. 2001) (\u201cWhen a circuit court grants certiorari relief, it quashes the order and leaves the matter pending before the lower tribunal as if no order had been entered.\u201d).\nhttps://caselaw.findlaw.com/court/fl-supreme-court/1495364.html#:~:text=When,judgment,-%2E",
151
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .2) explains the implications of the Order.\u201d",
152
+ "metadata": {
153
+ "review_flag": false,
154
+ "original_name": "states_in_the_first_assignment_that_the_effect_of_the_order_granting_writ_of_cer",
155
+ "original_index": 10,
156
+ "classifier_reason": "Names first assignment",
157
+ "classifier_confidence": "high"
158
+ },
159
+ "score": -10.0,
160
+ "polarity": "negative",
161
+ "raw_weight": 1.0
162
+ },
163
+ {
164
+ "name": "states_in_the_first_assignment_that_the_county_must_stop_constru",
165
+ "description": "States in the first assignment that the county must stop construction activities as a result of the Order Granting Writ of Certiorari.",
166
+ "source": "LCU Project.pdf at 1 shows that construction has started.\n\"Construction of the Southeast Advanced Water Reclamation Facility started on October 6, 2025.\"\nInjunctive relief is not an available remedy in a writ of certiorari of a quasi-judicial decision. See City of Fort Pierce v. Dickerson, 588 So.2d 1080, 1082 (Fla. 4th DCA 1991). https://www.casemine.com/judgement/us/59148822add7b049344ef125#:~:text=Since,injunction \n\"Since review of the resolution should have been by certiorari, the trial court was without jurisdiction to entertain a complaint for declaratory and injunctive relief and should not have granted the Dickersons' motion for a temporary injunction.\"",
167
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .2) explains the implications of the Order.\u201d",
168
+ "metadata": {
169
+ "review_flag": false,
170
+ "original_name": "states_in_the_first_assignment_that_the_county_must_stop_construction_activities",
171
+ "original_index": 11,
172
+ "classifier_reason": "Names first assignment",
173
+ "classifier_confidence": "high"
174
+ },
175
+ "score": -20.0,
176
+ "polarity": "negative",
177
+ "raw_weight": 1.0
178
+ },
179
+ {
180
+ "name": "states_in_the_first_assignment_that_the_exclusive_method_of_revi",
181
+ "description": "States in the first assignment that the exclusive method of review of a quasi-judicial decision is by petition for writ of certiorari under Fla. R. App. P. 9.100(c) (2025) within 30 days of the written decision.",
182
+ "source": "Fla. R. App. P. 9.100(c) (2025); https://rules.floridaappellate.com/rule-9-100/#:~:text=Petitions,by%20certiorari\n\"Petitions for Certiorari; Review of NonFinal Agency Action; Review of Prisoner Disciplinary Action. The following shall be filed within 30 days of rendition of the order to be reviewed:\n\n(1) a petition for certiorari;\n\n(2) a petition to review quasi-judicial action of agencies, boards, and commissions of local government, which action is not directly appealable under any other provision of general law but may be subject to review by certiorari;\"\nSee City of Fort Pierce v. Dickerson, 588 So.2d 1080, 1082 (Fla. 4th DCA 1991).\nhttps://www.casemine.com/judgement/us/59148822add7b049344ef125#:~:text=Thus,relief\n\"Thus, we conclude that the resolution by the Ft. Pierce City Commission was quasi-judicial. Consequently, we agree with Ft. Pierce's assertion that since the resolution was a quasi-judicial decision rendered by the Commission, it was reviewable only by petition for writ of certiorari, and not by a complaint for declaratory and injunctive relief.\"",
183
+ "justification": "This rubric item is implied, though not directly requested, in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .2) explains the implications of the Order.\u201d This is important in responding to the prompt question about implications of the order because it explains why injunctive relief is not available in a writ of certiorari of a quasi-judicial decision.",
184
+ "metadata": {
185
+ "review_flag": false,
186
+ "original_name": "states_in_the_first_assignment_that_the_exclusive_method_of_review_of_a_quasi_ju",
187
+ "original_index": 12,
188
+ "classifier_reason": "Names first assignment",
189
+ "classifier_confidence": "high"
190
+ },
191
+ "score": 15.0,
192
+ "polarity": "positive",
193
+ "raw_weight": 1.0
194
+ },
195
+ {
196
+ "name": "states_in_the_first_assignment_that_the_exclusive_method_of_chal",
197
+ "description": "States in the first assignment that the exclusive method of challenging the issuance of a development order that materially alters the use or density or intensity of use on a particular piece of property is by filing a petition for writ of certiorari under Fla. Stat. \u00a7 163.3215(4) (2025) within 30 days of rendition of the development order.",
198
+ "source": "Fla. Stat. 163.3215(4) (2025); https://www.leg.state.fl.us/Statutes/index.cfm?App_mode=Display_Statute&URL=0100-0199/0163/Sections/0163.3215.html#:~:text=the%20sole,for%20certiorari\n\"the sole method by which an aggrieved and adversely affected party may challenge any decision of local government granting or denying an application for a development order, as defined in s. 163.3164, which materially alters the use or density or intensity of use on a particular piece of property, is by an appeal filed by a petition for writ of certiorari filed in circuit court no later than 30 days following rendition of a development order or other written decision of the local government, or when all local administrative appeals, if any, are exhausted, whichever occurs later. An action for injunctive or other relief may be joined with the petition for certiorari.\"\nA challenge to issuance of a development order, which is an executive function, is a separate cause of action from appeal of a quasi-judicial decision.",
199
+ "justification": "This rubric item is implied, though not directly requested, in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .2) explains the implications of the Order.\u201d This is crucial because challenging a development order is the sole method to seek injunctive relief under Fla. Stat. 163.3215(4).",
200
+ "metadata": {
201
+ "review_flag": false,
202
+ "original_name": "states_in_the_first_assignment_that_the_exclusive_method_of_challenging_the_issu",
203
+ "original_index": 13,
204
+ "classifier_reason": "Names first assignment",
205
+ "classifier_confidence": "high"
206
+ },
207
+ "score": 10.0,
208
+ "polarity": "positive",
209
+ "raw_weight": 1.0
210
+ },
211
+ {
212
+ "name": "states_in_the_first_assignment_that_under_fla_stat_163_3167_10_2",
213
+ "description": "States in the first assignment that under Fla. Stat \u00a7 163.3167(10) (2025) the development order issued for the project may not be invalidated by a subsequent judicial determination because the timeframe for filing an appeal of the development order has expired.",
214
+ "source": "Fla. Stat 163.3167(10) (2025); https://www.leg.state.fl.us/statutes/index.cfm?App_mode=Display_Statute&URL=0100-0199/0163/Sections/0163.3167.html#:~:text=If,standards\n\"If a local government grants a development order pursuant to its adopted land development regulations and the order is not the subject of a pending appeal and the timeframe for filing an appeal has expired, the development order may not be invalidated by a subsequent judicial determination that such land development regulations, or any portion thereof that is relevant to the development order, are invalid because of a deficiency in the approval standards\"",
215
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .2) explains the implications of the Order.\u201d",
216
+ "metadata": {
217
+ "review_flag": false,
218
+ "original_name": "states_in_the_first_assignment_that_under_fla_stat_163_3167_10_2025_the_developm",
219
+ "original_index": 14,
220
+ "classifier_reason": "Names first assignment",
221
+ "classifier_confidence": "high"
222
+ },
223
+ "score": 10.0,
224
+ "polarity": "positive",
225
+ "raw_weight": 1.0
226
+ },
227
+ {
228
+ "name": "states_in_the_first_assignment_that_the_petitioners_may_file_a_s",
229
+ "description": "States in the first assignment that the Petitioners may file a separate cause of action for injunction to stop construction activities.",
230
+ "source": "See City of Fort Pierce v. Dickerson, 588 So.2d 1080, 1082 (Fla. 4th DCA 1991). https://www.casemine.com/judgement/us/59148822add7b049344ef125#:~:text=Since,injunction \n\"Since review of the resolution should have been by certiorari, the trial court was without jurisdiction to entertain a complaint for declaratory and injunctive relief and should not have granted the Dickersons' motion for a temporary injunction.\"",
231
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .2) explains the implications of the Order.\u201d",
232
+ "metadata": {
233
+ "review_flag": false,
234
+ "original_name": "states_in_the_first_assignment_that_the_petitioners_may_file_a_separate_cause_of",
235
+ "original_index": 15,
236
+ "classifier_reason": "Names first assignment",
237
+ "classifier_confidence": "high"
238
+ },
239
+ "score": -15.0,
240
+ "polarity": "negative",
241
+ "raw_weight": 1.0
242
+ },
243
+ {
244
+ "name": "states_in_the_first_assignment_that_the_county_could_appeal_the",
245
+ "description": "States in the first assignment that the county could appeal the Order Granting Writ of Certiorari to the Sixth District Court of Appeals pursuant to Fla. R. App. P. 9.030(b)(2)(B).",
246
+ "source": "Florida Rule of Appellate Procedure 9.030(b)(2)(B); https://rules.floridaappellate.com/rule-9-030/#:~:text=b%29-,Jurisdiction,capacity\n\"Jurisdiction of District Courts of Appeal.\n\"b) Jurisdiction of District Courts of Appeal.\n. . .\n(2) Certiorari Jurisdiction.8 The certiorari jurisdiction of district courts of appeal may be sought to review:\n(A) nonfinal orders of lower tribunals other than as prescribed by rule 9.130; or\n(B) final orders of circuit courts acting in their review capacity.\"\nSee also Map of Florida\u2019s Court Jurisdictions, available at https://flcourts-media.flcourts.gov/content/download/426177/file/ar-17-18-map-of-floridas-court-jurisdictions.pdf (last accessed Mar. 25, 2026).",
247
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .3) identifies options and available actions for the county.\u201d",
248
+ "metadata": {
249
+ "review_flag": false,
250
+ "original_name": "states_in_the_first_assignment_that_the_county_could_appeal_the_order_granting_w",
251
+ "original_index": 16,
252
+ "classifier_reason": "Names first assignment",
253
+ "classifier_confidence": "high"
254
+ },
255
+ "score": 5.0,
256
+ "polarity": "positive",
257
+ "raw_weight": 1.0
258
+ },
259
+ {
260
+ "name": "states_in_the_first_assignment_that_the_county_could_remand_the",
261
+ "description": "States in the first assignment that the county could remand the case back to the Hearing Examiner for an evidentiary hearing to address the deficiencies identified in the Order Granting Petition for Writ of Certiorari under Lee County Fla. Land Development Code \u00a7 34-83(a)(6) (2025).",
262
+ "source": "Lee County Fla. Land Development Code \u00a7 34-83(a)(6) (2025); https://library.municode.com/fl/lee_county/codes/land_development_code?nodeId=LADECO_CH34ZO_ARTIIAD_DIV2BOCOCO_S34-83FUAU#:~:text=The%20Board%20may%20remand%20a%20case%20back%20to%20the%20Hearing%20Examiner%20for%20further%20review%20of%20specific%20issues%2E%20The%20scope%20of%20the%20remanded%20hearing%20will%20be%20limited%20to%20the%20specific%20issues%20identified%20by%20the%20Board\n\"The Board may remand a case back to the Hearing Examiner for further review of specific issues. The scope of the remanded hearing will be limited to the specific issues identified by the Board.\"",
263
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .3) identifies options and available actions for the county.\u201d",
264
+ "metadata": {
265
+ "review_flag": false,
266
+ "original_name": "states_in_the_first_assignment_that_the_county_could_remand_the_case_back_to_the",
267
+ "original_index": 17,
268
+ "classifier_reason": "Names first assignment",
269
+ "classifier_confidence": "high"
270
+ },
271
+ "score": 5.0,
272
+ "polarity": "positive",
273
+ "raw_weight": 1.0
274
+ },
275
+ {
276
+ "name": "states_in_the_first_assignment_that_the_county_could_file_a_new",
277
+ "description": "States in the first assignment that the County could file a new application for rezoning.",
278
+ "source": "The Lee County Department of Community Development website has a link to an application for \"Continuance, Deferral, or Withdrawal\" which can be filed at any time by the county; https://www.leegov.com/dcd/zoning/apps#:~:text=Continuance%2C%20Deferral%2C%20OR%20Withdrawal,-%E2%80%8B",
279
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .3) identifies options and available actions for the county.\u201d",
280
+ "metadata": {
281
+ "review_flag": false,
282
+ "original_name": "states_in_the_first_assignment_that_the_county_could_file_a_new_application_for",
283
+ "original_index": 18,
284
+ "classifier_reason": "Names first assignment",
285
+ "classifier_confidence": "high"
286
+ },
287
+ "score": 5.0,
288
+ "polarity": "positive",
289
+ "raw_weight": 1.0
290
+ },
291
+ {
292
+ "name": "states_in_the_first_assignment_that_the_county_could_voluntarily",
293
+ "description": "States in the first assignment that the County could voluntarily cease construction activities pending resolution of the challenge.",
294
+ "source": "LCU Project.pdf at 1. Construction has started, but could be stopped at the direction of the Board, though the costs would be extremely high.",
295
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .3) identifies options and available actions for the county.\u201d",
296
+ "metadata": {
297
+ "review_flag": false,
298
+ "original_name": "states_in_the_first_assignment_that_the_county_could_voluntarily_cease_construct",
299
+ "original_index": 19,
300
+ "classifier_reason": "Names first assignment",
301
+ "classifier_confidence": "high"
302
+ },
303
+ "score": 5.0,
304
+ "polarity": "positive",
305
+ "raw_weight": 1.0
306
+ },
307
+ {
308
+ "name": "states_in_the_first_assignment_that_the_county_could_take_the_po",
309
+ "description": "States in the first assignment that the County could take the position that the rezoning is not necessary because the county is not bound by its local zoning laws in carrying out a governmental function.",
310
+ "source": "See Sandra G. Smith, Immunity of State and State Related Activities from Local Municipal Zoning Regulations: Florida Focus, 28 Fla. L. Rev. 800 (1967).\nAvailable at: https://scholarship.law.ufl.edu/flr/vol28/iss3/9 \nhttps://scholarship.law.ufl.edu/cgi/viewcontent.cgi?article=2881&context=flr\n\"The Fourth District Court of Appeal relied\non Nichols for the premise that in the performance of a governmental activity the county should not be subject to its own zoning restrictions. 2 In a 1978\ndecision Dade County was challenged by private property owners when it attempted to violate its own zoning restrictions by building a jail facility on\nproperty reserved for another use under a comprehensive zoning ordinance. 28\nThe Third District Court of Appeal recognized a right under common law and under Florida law for \"a governmental entity to place a governmental\nfacility without regard to a comprehensive zoning ordinance or its procedures.\"\nThe article quotes Metropolitan Dade County v. Parkway Towers Condominium Ass'n, 281 So. 2d 68\n(Fla. 3d DCA 1973), a 3rd DCA case establishing immunity from zoning for governmental purposes. The case is not found publicly available, however the FL Supreme Court accepted, but then discharged), a petition for writ. Note that the FL Supreme Court expressed a \"prospective opinion\" that local governments \"should\" go through rezonings if not in compliance, this is dicta and not binding as the court upheld the district court's decision on immunity. \nParkway Towers Con. Ass'n v. Metropolitan Dade Cnty., 295 So.2d 295 (Fla. 1974); https://law.justia.com/cases/florida/supreme-court/1974/44260-0.html#:~:text=Although,ordinances,-%2E\n\"Although we now consider our issuance of the writ of certiorari to have been improvident in this case, which results in our discharge thereof, it is nevertheless our view prospectively that zoning variations to accommodate county or municipal facility purposes should either have been anticipated in zoning ordinances before construction or operation of such facilities is commenced *296 or, if this has not been done, construction should not be undertaken thereof until after due modification or change therefor is made in existing zoning ordinances.\"",
311
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .3) identifies options and available actions for the county.\u201d",
312
+ "metadata": {
313
+ "review_flag": false,
314
+ "original_name": "states_in_the_first_assignment_that_the_county_could_take_the_position_that_the",
315
+ "original_index": 20,
316
+ "classifier_reason": "Names first assignment",
317
+ "classifier_confidence": "high"
318
+ },
319
+ "score": 5.0,
320
+ "polarity": "positive",
321
+ "raw_weight": 1.0
322
+ },
323
+ {
324
+ "name": "states_in_the_first_assignment_that_the_county_could_negotiate_f",
325
+ "description": "States in the first assignment that the County could negotiate for additional conditions protecting wildlife that address Petitioners' concerns.",
326
+ "source": "Petitioners' concerns are outlined in Petition.docx at pages 3-13. These include concerns about protection of wild life.",
327
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .3) identifies options and available actions for the county.\u201d",
328
+ "metadata": {
329
+ "review_flag": false,
330
+ "original_name": "states_in_the_first_assignment_that_the_county_could_negotiate_for_additional_co",
331
+ "original_index": 21,
332
+ "classifier_reason": "Names first assignment",
333
+ "classifier_confidence": "high"
334
+ },
335
+ "score": 5.0,
336
+ "polarity": "positive",
337
+ "raw_weight": 1.0
338
+ },
339
+ {
340
+ "name": "states_in_the_first_assignment_that_the_county_could_negotiate_2",
341
+ "description": "States in the first assignment that the County could negotiate for additional conditions protecting water quality that address Petitioners' concerns.",
342
+ "source": "Petitioners' concerns are outlined in Petition.docx at pages 3-13. These include concerns about protection of water quality.",
343
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .3) identifies options and available actions for the county.\u201d",
344
+ "metadata": {
345
+ "review_flag": false,
346
+ "original_name": "states_in_the_first_assignment_that_the_county_could_negotiate_for_additional_co_2",
347
+ "original_index": 22,
348
+ "classifier_reason": "Names first assignment",
349
+ "classifier_confidence": "high"
350
+ },
351
+ "score": 5.0,
352
+ "polarity": "positive",
353
+ "raw_weight": 1.0
354
+ },
355
+ {
356
+ "name": "states_in_the_first_assignment_that_the_county_should_file_a_tim",
357
+ "description": "States in the first assignment that the County should file a timely appeal with the 6th District Court of Appeals.",
358
+ "source": "Because the Order contains reversible errors, and because an appeal can be pursued parallel to a remand, this is the best recommendation.\nFlorida Rule of Appellate Procedure 9.030(b)(2)(B); https://rules.floridaappellate.com/rule-9-030/#:~:text=b%29-,Jurisdiction,capacity\n\"Jurisdiction of District Courts of Appeal.\n\"b) Jurisdiction of District Courts of Appeal.\n. . .\n(2) Certiorari Jurisdiction.8 The certiorari jurisdiction of district courts of appeal may be sought to review:\n(A) nonfinal orders of lower tribunals other than as prescribed by rule 9.130; or\n(B) final orders of circuit courts acting in their review capacity.\"\nSee also Map of Florida\u2019s Court Jurisdictions, available at https://flcourts-media.flcourts.gov/content/download/426177/file/ar-17-18-map-of-floridas-court-jurisdictions.pdf (last accessed Mar. 25, 2026).",
359
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .4) recommends a legal course of action to the Board.\u201d",
360
+ "metadata": {
361
+ "review_flag": false,
362
+ "original_name": "states_in_the_first_assignment_that_the_county_should_file_a_timely_appeal_with",
363
+ "original_index": 23,
364
+ "classifier_reason": "Names first assignment",
365
+ "classifier_confidence": "high"
366
+ },
367
+ "score": 20.0,
368
+ "polarity": "positive",
369
+ "raw_weight": 1.0
370
+ },
371
+ {
372
+ "name": "states_in_the_first_assignment_that_the_county_should_remand_the",
373
+ "description": "States in the first assignment that the County should remand the case to the Hearing Examiner to address the deficiencies identified in the Order Granting Writ of Certiorari while an appeal is pending.",
374
+ "source": "Because the Order contains reversible errors, and because an appeal can be pursued parallel to a remand, this is the best recommendation.\nLee County Fla. Land Development Code \u00a7 34-83(a)(6) (2025); https://library.municode.com/fl/lee_county/codes/land_development_code?nodeId=LADECO_CH34ZO_ARTIIAD_DIV2BOCOCO_S34-83FUAU#:~:text=The%20Board%20may%20remand%20a%20case%20back%20to%20the%20Hearing%20Examiner%20for%20further%20review%20of%20specific%20issues%2E%20The%20scope%20of%20the%20remanded%20hearing%20will%20be%20limited%20to%20the%20specific%20issues%20identified%20by%20the%20Board\n\"The Board may remand a case back to the Hearing Examiner for further review of specific issues. The scope of the remanded hearing will be limited to the specific issues identified by the Board.\"",
375
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .4) recommends a legal course of action to the Board.\u201d",
376
+ "metadata": {
377
+ "review_flag": false,
378
+ "original_name": "states_in_the_first_assignment_that_the_county_should_remand_the_case_to_the_hea",
379
+ "original_index": 24,
380
+ "classifier_reason": "Names first assignment",
381
+ "classifier_confidence": "high"
382
+ },
383
+ "score": 20.0,
384
+ "polarity": "positive",
385
+ "raw_weight": 1.0
386
+ },
387
+ {
388
+ "name": "states_in_the_first_assignment_that_the_county_should_cease_cons",
389
+ "description": "States in the first assignment that the County should cease construction activities at the subject property.",
390
+ "source": "LCU Project.pdf at 1 shows that construction has started, which means the county has spent time and money on design, permitting, procurement of contractors, etc. The facility is also necessary to serve increased demand for water and sewer service caused by population growth and has been planned since 2010 (LCU Project.pdf at 4.)\nIn a similar case, the FL Supreme Court declined to delay construction of a public project based on zoning.\nSee Parkway Towers Con. Ass'n v. Metropolitan Dade Cty., 295 So.2d 295 (Fla. 1974); https://law.justia.com/cases/florida/supreme-court/1974/44260-0.html#:~:text=This%20being,result\n\"In this case it appears that on at least two occasions public hearings were held by the Metro County Commission on the question whether the construction of the subject holding facility for prisoners and the work release facility should go forward in the absence of a waiver therefor in the zoning ordinance and in each instance it was agreed by the Commission the construction should proceed. This being so, we feel no useful or practical purpose would be served in interrupting and delaying the construction until a zoning change is effected retroactively to accommodate the Commission's expressly resolved purpose when considered in connection with the fact that no direct conflict of decisions appears. To interrupt the construction now would cause needless expense and damage with no prospect or likelihood that the Commission would reach a different final result.\"",
391
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cReview only these documents and draft a legal memorandum to the Board of County Commissioners that . . .4) recommends a legal course of action to the Board.\u201d",
392
+ "metadata": {
393
+ "review_flag": false,
394
+ "original_name": "states_in_the_first_assignment_that_the_county_should_cease_construction_activit",
395
+ "original_index": 25,
396
+ "classifier_reason": "Names first assignment",
397
+ "classifier_confidence": "high"
398
+ },
399
+ "score": -30.0,
400
+ "polarity": "negative",
401
+ "raw_weight": 1.0
402
+ }
403
+ ]
404
+ }
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/m1_judge_panel.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "mode": "panel",
3
+ "max_concurrent_llm": 12,
4
+ "members": [
5
+ {
6
+ "model": "openai/gpt-5.6-terra",
7
+ "reasoning_effort": "medium",
8
+ "timeout": 1500
9
+ },
10
+ {
11
+ "model": "anthropic/claude-sonnet-5",
12
+ "reasoning_effort": "medium",
13
+ "timeout": 1500
14
+ },
15
+ {
16
+ "model": "gemini/gemini-3.8-flash",
17
+ "reasoning_effort": "medium",
18
+ "timeout": 1500
19
+ }
20
+ ]
21
+ }
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/m1_rewardkit_accounting.py ADDED
@@ -0,0 +1,490 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio
2
+ import json
3
+ import math
4
+ import os
5
+ from pathlib import Path
6
+ import random
7
+ import sys
8
+ import time
9
+
10
+ class JudgeReceiptError(OSError):
11
+ pass
12
+ _LLM_ROUTES = frozenset({'vertex', 'anthropic fallback', 'aistudio', 'direct'})
13
+ _LLM_ROUTE_HEADERS = ('x-m1-llm-route', 'llm_provider-x-m1-llm-route')
14
+
15
+ def _canonical_llm_route(value):
16
+ return value if isinstance(value, str) and value in _LLM_ROUTES else None
17
+
18
+ def _llm_route_from_headers(headers):
19
+ if not isinstance(headers, dict):
20
+ return None
21
+ folded = {str(key).lower(): value for key, value in headers.items()}
22
+ for name in _LLM_ROUTE_HEADERS:
23
+ route = _canonical_llm_route(folded.get(name))
24
+ if route is not None:
25
+ return route
26
+ return None
27
+
28
+ def _llm_route_from_response(response):
29
+ hidden = getattr(response, '_hidden_params', None)
30
+ headers = hidden.get('additional_headers') if isinstance(hidden, dict) else None
31
+ route = _llm_route_from_headers(headers)
32
+ if route is not None:
33
+ return route
34
+ return _llm_route_from_headers(getattr(response, 'headers', None))
35
+
36
+ def _token_field_status(values, key):
37
+ if not isinstance(values, dict) or key not in values:
38
+ return 'missing'
39
+ value = values[key]
40
+ if value is None:
41
+ return 'null'
42
+ return 'valid' if type(value) is int and value >= 0 else 'invalid'
43
+
44
+ def _gemini_capture(kwargs, model):
45
+ if not model.startswith('gemini/') or kwargs.get('stream') or kwargs.get('tools') or kwargs.get('functions'):
46
+ return (kwargs, None)
47
+ from litellm.integrations.custom_logger import CustomLogger
48
+ from urllib.parse import urlsplit
49
+
50
+ class Capture(CustomLogger):
51
+ evidence = None
52
+ prompt_status = 'not_observed'
53
+ llm_route = None
54
+
55
+ def log_post_api_call(self, kwargs, response_obj, start_time, end_time):
56
+ self.evidence = None
57
+ self.prompt_status = 'not_observed'
58
+ try:
59
+ params = kwargs.get('litellm_params') or {}
60
+ route = urlsplit(params.get('api_base') or '')
61
+ bare = model.removeprefix('gemini/')
62
+ gemini = params.get('custom_llm_provider') == 'gemini'
63
+ ai_studio = gemini and route.hostname == 'generativelanguage.googleapis.com' and (route.path in {'/' + version + '/models/' + bare + ':generateContent' for version in ('v1alpha', 'v1beta')})
64
+ broker = urlsplit(os.environ.get('GEMINI_API_BASE') or '')
65
+ brokered = gemini and bool(broker.netloc) and (route.netloc == broker.netloc) and (broker.path.rstrip('/').rsplit('/', 1)[-1] in ('v1alpha', 'v1beta')) and (route.path == broker.path.rstrip('/') + '/models/' + bare + ':generateContent')
66
+ vertex = params.get('custom_llm_provider') == 'vertex_ai' and route.hostname == 'aiplatform.googleapis.com' and route.path.startswith('/v1/projects/') and route.path.endswith('/locations/global/publishers/google/models/' + bare + ':generateContent')
67
+ if route.scheme != 'https' or not (ai_studio or brokered or vertex) or kwargs.get('stream'):
68
+ return
69
+ self.llm_route = 'vertex' if vertex else 'aistudio' if ai_studio else None
70
+ raw = kwargs.get('original_response')
71
+ raw = json.loads(raw) if isinstance(raw, str) else raw
72
+ if not isinstance(raw, dict):
73
+ return
74
+ candidates = raw.get('candidates')
75
+ if not isinstance(candidates, list) or not candidates or any((not isinstance(c, dict) or not c.get('finishReason') for c in candidates)) or (not isinstance(raw.get('modelVersion'), str)) or (not raw['modelVersion']):
76
+ return
77
+ usage = raw.get('usageMetadata')
78
+ self.prompt_status = _token_field_status(usage, 'promptTokenCount')
79
+ if not isinstance(usage, dict):
80
+ return
81
+ fields = ('promptTokenCount', 'candidatesTokenCount', 'thoughtsTokenCount', 'cachedContentTokenCount', 'totalTokenCount', 'toolUsePromptTokenCount')
82
+ counts = {key: usage.get(key, 0) for key in fields}
83
+ if not {'promptTokenCount', 'totalTokenCount'} <= usage.keys() or any((type(n) is not int or n < 0 for n in counts.values())) or counts['toolUsePromptTokenCount'] != 0 or (counts['cachedContentTokenCount'] > counts['promptTokenCount']) or (counts['totalTokenCount'] != counts['promptTokenCount'] + counts['candidatesTokenCount'] + counts['thoughtsTokenCount']):
84
+ return
85
+ self.evidence = {'protocol': 'gemini-generate-content-' + ('vertex-v1' if vertex else route.path.split('/')[-3]), 'model_version': raw['modelVersion'], 'usage_metadata': {key: usage[key] for key in fields if key in usage}, 'defaulted_fields': [key for key in fields if key not in usage]}
86
+ except (TypeError, ValueError, AttributeError):
87
+ return
88
+ capture = Capture()
89
+ return ({**kwargs, 'callbacks': [*(kwargs.get('callbacks') or []), capture]}, capture)
90
+
91
+ def _record_judge_usage(response, model: str, *, target: Path | None=None, native_usage: dict | None=None, native_prompt_status: str | None=None, llm_route: str | None=None) -> None:
92
+ import fcntl
93
+ from datetime import datetime, timezone
94
+ data = response.model_dump() if hasattr(response, 'model_dump') else response
95
+ usage = data.get('usage') if isinstance(data, dict) else None
96
+ granularity = data.get('usage_granularity') if isinstance(data, dict) else None
97
+ if not isinstance(usage, dict):
98
+ usage = {}
99
+ granularity = 'missing_provider_receipt'
100
+ prompt, completion = (usage.get('prompt_tokens'), usage.get('completion_tokens'))
101
+ native_fresh = usage.get('input_uncached_tokens')
102
+ prompt = prompt if type(prompt) is int and prompt >= 0 else None
103
+ native_fresh = native_fresh if type(native_fresh) is int and native_fresh >= 0 else None
104
+ if type(completion) is not int or completion < 0 or (prompt is None and native_fresh is None):
105
+ completion = completion if type(completion) is int and completion >= 0 else 0
106
+ granularity = granularity or 'invalid_provider_receipt'
107
+ details = usage.get('prompt_tokens_details')
108
+ if details is not None and (not isinstance(details, dict)):
109
+ granularity = 'invalid_provider_receipt'
110
+ details = details if isinstance(details, dict) else {}
111
+ cached = details.get('cached_tokens')
112
+ if native_usage is not None:
113
+ native = native_usage['usage_metadata']
114
+ native_output = native.get('candidatesTokenCount', 0) + native.get('thoughtsTokenCount', 0)
115
+ if prompt == native['promptTokenCount'] and completion == native_output:
116
+ cached = native.get('cachedContentTokenCount', 0)
117
+ else:
118
+ native_usage = None
119
+ written = next((value for value in (usage.get('input_cache_write_tokens'), usage.get('cache_creation_input_tokens'), details.get('cache_creation_tokens'), details.get('cache_write_tokens')) if value is not None), None)
120
+ invalid = any((value is not None and (type(value) is not int or value < 0) for value in (cached, written)))
121
+ cached = cached if type(cached) is int and cached >= 0 else None
122
+ written = written if type(written) is int and written >= 0 else None
123
+ fresh = native_fresh
124
+ if fresh is None and prompt is not None and (cached is not None) and (written is not None):
125
+ fresh = prompt - cached - written
126
+ if fresh is not None and (fresh < 0 or (prompt is not None and cached is not None and (written is not None) and (fresh + cached + written != prompt))):
127
+ invalid, fresh = (True, None)
128
+ provider, _, slug = model.partition('/')
129
+ event: dict = {'type': 'step_finish', 'part': {'providerID': provider if slug else 'openai', 'modelID': slug or model, 'tokens': {'input': fresh, 'output': completion, 'cache': {'read': cached, 'write': written}}}}
130
+ field_status = {'prompt_tokens': _token_field_status(usage, 'prompt_tokens'), 'completion_tokens': _token_field_status(usage, 'completion_tokens'), 'input_uncached_tokens': _token_field_status(usage, 'input_uncached_tokens')}
131
+ field_status['native_prompt_token_count'] = native_prompt_status if native_prompt_status in {'missing', 'null', 'invalid', 'valid', 'not_observed'} else 'unsupported'
132
+ part: dict = event['part']
133
+ part['usage_field_status'] = field_status
134
+ if native_usage is not None:
135
+ event['part']['native_usage'] = native_usage
136
+ event['part']['token_categories_provenance'] = 'explicit_presence_v1'
137
+ if fresh is None and prompt is not None:
138
+ event['part']['prompt_tokens_inclusive'] = prompt
139
+ if invalid or any((value is None for value in (fresh, cached, written))):
140
+ granularity = granularity if granularity not in (None, 'request') else 'invalid_provider_receipt' if invalid else 'incomplete_token_categories'
141
+ if granularity:
142
+ event['part']['usage_granularity'] = granularity
143
+ if provider == 'openrouter':
144
+ cost = usage.get('cost')
145
+ if cost is None:
146
+ hidden = getattr(response, '_hidden_params', None)
147
+ headers = hidden.get('additional_headers') if isinstance(hidden, dict) else None
148
+ if isinstance(headers, dict):
149
+ cost = headers.get('llm_provider-x-litellm-response-cost')
150
+ if isinstance(cost, (int, float)) and (not isinstance(cost, bool)) and math.isfinite(cost) and (cost >= 0):
151
+ event['part']['cost'] = cost
152
+ data = data if isinstance(data, dict) else {}
153
+ if isinstance(data.get('id'), str) and data['id']:
154
+ event['part']['provider_request_id'] = data['id']
155
+ for key in ('service_tier', 'cache_ttl'):
156
+ if data.get(key):
157
+ event['part'][key] = data[key]
158
+ route = _llm_route_from_response(response) or _canonical_llm_route(llm_route)
159
+ if route is not None:
160
+ event['part']['llm_route'] = route
161
+ created = data.get('created')
162
+ stamp = datetime.now(timezone.utc)
163
+ try:
164
+ if isinstance(created, str):
165
+ parsed = datetime.fromisoformat(created.replace('Z', '+00:00'))
166
+ if parsed.tzinfo is not None:
167
+ stamp = parsed
168
+ elif isinstance(created, (int, float)) and (not isinstance(created, bool)) and math.isfinite(created):
169
+ stamp = datetime.fromtimestamp(created, timezone.utc)
170
+ except (ValueError, OverflowError, OSError):
171
+ pass
172
+ pair = json.dumps({'type': 'step_start', 'timestamp': stamp.isoformat()}) + '\n'
173
+ pair += json.dumps(event) + '\n'
174
+ try:
175
+ receipt_path = target or Path(os.environ.get('M1_JUDGE_USAGE_PATH', '/logs/verifier/judge-trajectory.jsonl'))
176
+ receipt_path.parent.mkdir(parents=True, exist_ok=True)
177
+ with receipt_path.open('a') as handle:
178
+ fcntl.flock(handle, fcntl.LOCK_EX)
179
+ handle.write(pair)
180
+ handle.flush()
181
+ os.fsync(handle.fileno())
182
+ except OSError as exc:
183
+ if target is not None:
184
+ raise JudgeReceiptError(f'judge receipt write failed: {exc}') from exc
185
+ print(f'judge accounting: write failed ({type(exc).__name__})', file=sys.stderr)
186
+
187
+ def openrouter_judge_pins() -> dict[str, dict]:
188
+ raw = os.environ.get('M1_OPENROUTER_JUDGE_PROVIDER_PINS', '').strip()
189
+ if not raw:
190
+ return {}
191
+ try:
192
+ pins = json.loads(raw)
193
+ except json.JSONDecodeError:
194
+ print('judge provider pins: invalid JSON in M1_OPENROUTER_JUDGE_PROVIDER_PINS', file=sys.stderr)
195
+ return {}
196
+ return {model: pin for model, pin in pins.items() if isinstance(pin, dict) and pin.get('order')} if isinstance(pins, dict) else {}
197
+
198
+ def apply_judge_provider_pin(kwargs: dict, pins: dict[str, dict]) -> dict:
199
+ model = kwargs.get('model')
200
+ pin = pins.get(model) if isinstance(model, str) else None
201
+ if pin is None:
202
+ return kwargs
203
+ extra_body = dict(kwargs.get('extra_body') or {})
204
+ provider = dict(extra_body.get('provider') or {})
205
+ provider['order'] = list(pin['order'])
206
+ if pin.get('allow_fallbacks') is False:
207
+ provider['allow_fallbacks'] = False
208
+ if pin.get('zdr'):
209
+ provider['zdr'] = True
210
+ extra_body['provider'] = provider
211
+ return {**kwargs, 'extra_body': extra_body}
212
+ _TRANSIENT_ERROR_NAMES = ('RateLimitError', 'ServiceUnavailableError', 'InternalServerError', 'BadGatewayError', 'APIConnectionError')
213
+ _RETRYABLE_STATUS_CODES = frozenset({408, 409, 425, 429, 500, 502, 503, 504})
214
+ _AUTH_ERROR_NAMES = ('AuthenticationError', 'PermissionDeniedError')
215
+ _AUTH_STATUS_CODES = frozenset({401, 403})
216
+ _AUTH_RETRIES = 4
217
+ _DEFAULT_TRANSIENT_RETRIES = 6
218
+ _MAX_TRANSIENT_RETRIES = 20
219
+ _MAX_RETRY_DELAY_SECONDS = 60.0
220
+ _DEFAULT_EMPTY_RESPONSE_RETRIES = 3
221
+ _DEFAULT_RETRY_BUDGET_SECONDS = 900.0
222
+ _MAX_RETRY_BUDGET_SECONDS = 86400.0
223
+
224
+ def transient_retry_limit() -> int:
225
+ raw = os.environ.get('M1_JUDGE_TRANSIENT_RETRIES', '').strip()
226
+ if not raw:
227
+ return _DEFAULT_TRANSIENT_RETRIES
228
+ try:
229
+ return max(0, min(int(raw), _MAX_TRANSIENT_RETRIES))
230
+ except ValueError:
231
+ print('judge retries: invalid M1_JUDGE_TRANSIENT_RETRIES, using the default', file=sys.stderr)
232
+ return _DEFAULT_TRANSIENT_RETRIES
233
+
234
+ def empty_response_retry_limit() -> int:
235
+ raw = os.environ.get('M1_JUDGE_EMPTY_RESPONSE_RETRIES', '').strip()
236
+ if not raw:
237
+ return _DEFAULT_EMPTY_RESPONSE_RETRIES
238
+ try:
239
+ return max(0, min(int(raw), _MAX_TRANSIENT_RETRIES))
240
+ except ValueError:
241
+ print('judge retries: invalid M1_JUDGE_EMPTY_RESPONSE_RETRIES, using the default', file=sys.stderr)
242
+ return _DEFAULT_EMPTY_RESPONSE_RETRIES
243
+
244
+ def retry_budget_seconds() -> float:
245
+ raw = os.environ.get('M1_JUDGE_RETRY_BUDGET_SECONDS', '').strip()
246
+ if not raw:
247
+ return _DEFAULT_RETRY_BUDGET_SECONDS
248
+ try:
249
+ value = float(raw)
250
+ except ValueError:
251
+ value = math.nan
252
+ if not math.isfinite(value) or value < 0:
253
+ print('judge retries: invalid M1_JUDGE_RETRY_BUDGET_SECONDS, using the default', file=sys.stderr)
254
+ return _DEFAULT_RETRY_BUDGET_SECONDS
255
+ return min(value, _MAX_RETRY_BUDGET_SECONDS)
256
+
257
+ def _within_budget(deadline: float, delay: float, model) -> bool:
258
+ remaining = deadline - time.monotonic()
259
+ if delay <= remaining:
260
+ return True
261
+ print(f'judge call retry budget spent: {model} would wait {delay:.1f}s with {max(remaining, 0.0):.1f}s left of M1_JUDGE_RETRY_BUDGET_SECONDS, failing now', file=sys.stderr)
262
+ return False
263
+
264
+ def is_empty_verdict(response) -> bool:
265
+ data = response.model_dump() if hasattr(response, 'model_dump') else response
266
+ if not isinstance(data, dict):
267
+ return False
268
+ choices = data.get('choices')
269
+ if not isinstance(choices, list) or not choices:
270
+ return True
271
+ first = choices[0]
272
+ message = first.get('message') if isinstance(first, dict) else None
273
+ if not isinstance(message, dict):
274
+ return True
275
+ if message.get('tool_calls') or message.get('function_call'):
276
+ return False
277
+ content = message.get('content')
278
+ if isinstance(content, list):
279
+ content = ''.join((part.get('text') or '' for part in content if isinstance(part, dict)))
280
+ return not (isinstance(content, str) and content.strip())
281
+
282
+ def _matches(exc: BaseException, litellm, names: tuple[str, ...], statuses: frozenset[int]) -> bool:
283
+ classes = tuple((cls for cls in (getattr(litellm, name, None) for name in names) if isinstance(cls, type)))
284
+ if classes and isinstance(exc, classes):
285
+ return True
286
+ status = getattr(exc, 'status_code', None)
287
+ return type(status) is int and status in statuses
288
+
289
+ def is_transient_error(exc: BaseException, litellm) -> bool:
290
+ return _matches(exc, litellm, _TRANSIENT_ERROR_NAMES, _RETRYABLE_STATUS_CODES)
291
+
292
+ def is_auth_error(exc: BaseException, litellm) -> bool:
293
+ return _matches(exc, litellm, _AUTH_ERROR_NAMES, _AUTH_STATUS_CODES)
294
+
295
+ def should_retry(exc: BaseException, litellm, attempt: int, limit: int) -> bool:
296
+ if attempt < limit and is_transient_error(exc, litellm):
297
+ return True
298
+ return attempt < min(limit, _AUTH_RETRIES) and is_auth_error(exc, litellm)
299
+
300
+ def _retry_after_seconds(exc: BaseException) -> float | None:
301
+ headers = getattr(exc, 'headers', None)
302
+ if headers is None:
303
+ headers = getattr(getattr(exc, 'response', None), 'headers', None)
304
+ if headers is None:
305
+ return None
306
+ try:
307
+ raw = headers.get('retry-after')
308
+ if raw is None:
309
+ raw = headers.get('Retry-After')
310
+ value = float(raw)
311
+ except (AttributeError, TypeError, ValueError):
312
+ return None
313
+ return value if math.isfinite(value) and value >= 0 else None
314
+
315
+ def retry_delay(exc: BaseException | None, attempt: int) -> float:
316
+ base = min(_MAX_RETRY_DELAY_SECONDS, 2.0 ** (attempt + 1))
317
+ delay = base * (0.5 + random.random())
318
+ retry_after = _retry_after_seconds(exc) if exc is not None else None
319
+ if retry_after is not None:
320
+ delay = max(delay, min(_MAX_RETRY_DELAY_SECONDS, retry_after))
321
+ return delay
322
+
323
+ def _note_retry(model, exc: BaseException, attempt: int, limit: int, delay: float) -> None:
324
+ status = getattr(exc, 'status_code', None)
325
+ print(f"judge call retry {attempt}/{limit}: {model} {type(exc).__name__} status={(status if type(status) is int else 'n/a')}, waiting {delay:.1f}s", file=sys.stderr)
326
+
327
+ def _note_empty(model, response, attempt: int, limit: int, delay: float) -> None:
328
+ data = response.model_dump() if hasattr(response, 'model_dump') else response
329
+ reason = None
330
+ if isinstance(data, dict) and isinstance(data.get('choices'), list) and data['choices']:
331
+ first = data['choices'][0]
332
+ reason = first.get('finish_reason') if isinstance(first, dict) else None
333
+ print(f'judge call retry {attempt}/{limit}: {model} empty verdict (finish_reason={reason}), waiting {delay:.1f}s', file=sys.stderr)
334
+
335
+ def install(litellm, *, synchronous: bool=False) -> None:
336
+ pins = openrouter_judge_pins()
337
+ limit = transient_retry_limit()
338
+ empty_limit = empty_response_retry_limit()
339
+ deadline = time.monotonic() + retry_budget_seconds()
340
+ if synchronous:
341
+ original = litellm.completion
342
+
343
+ def accounted(*args, **kwargs):
344
+ kwargs = apply_judge_provider_pin(kwargs, pins)
345
+ model = kwargs.get('model') or (args[0] if args else 'unknown')
346
+ attempt = empty_attempts = 0
347
+ while True:
348
+ try:
349
+ call_kwargs, capture = _gemini_capture(kwargs, model)
350
+ response = original(*args, **call_kwargs)
351
+ except BaseException as exc:
352
+ delay = retry_delay(exc, attempt) if should_retry(exc, litellm, attempt, limit) else None
353
+ if delay is not None and _within_budget(deadline, delay, model):
354
+ attempt += 1
355
+ _note_retry(model, exc, attempt, limit, delay)
356
+ time.sleep(delay)
357
+ continue
358
+ _record_judge_usage({}, model)
359
+ raise
360
+ _record_judge_usage(response, model, native_usage=capture.evidence if capture else None, native_prompt_status=capture.prompt_status if capture else None, llm_route=capture.llm_route if capture else None)
361
+ if empty_attempts < empty_limit and is_empty_verdict(response):
362
+ delay = retry_delay(None, empty_attempts)
363
+ if _within_budget(deadline, delay, model):
364
+ empty_attempts += 1
365
+ _note_empty(model, response, empty_attempts, empty_limit, delay)
366
+ time.sleep(delay)
367
+ continue
368
+ return response
369
+ litellm.completion = accounted
370
+ return
371
+ original_async = litellm.acompletion
372
+
373
+ async def accounted_async(*args, **kwargs):
374
+ kwargs = apply_judge_provider_pin(kwargs, pins)
375
+ model = kwargs.get('model') or (args[0] if args else 'unknown')
376
+ attempt = empty_attempts = 0
377
+ while True:
378
+ try:
379
+ call_kwargs, capture = _gemini_capture(kwargs, model)
380
+ response = await original_async(*args, **call_kwargs)
381
+ except BaseException as exc:
382
+ delay = retry_delay(exc, attempt) if should_retry(exc, litellm, attempt, limit) else None
383
+ if delay is not None and _within_budget(deadline, delay, model):
384
+ attempt += 1
385
+ _note_retry(model, exc, attempt, limit, delay)
386
+ await asyncio.sleep(delay)
387
+ continue
388
+ _record_judge_usage({}, model)
389
+ raise
390
+ _record_judge_usage(response, model, native_usage=capture.evidence if capture else None, native_prompt_status=capture.prompt_status if capture else None, llm_route=capture.llm_route if capture else None)
391
+ if empty_attempts < empty_limit and is_empty_verdict(response):
392
+ delay = retry_delay(None, empty_attempts)
393
+ if _within_budget(deadline, delay, model):
394
+ empty_attempts += 1
395
+ _note_empty(model, response, empty_attempts, empty_limit, delay)
396
+ await asyncio.sleep(delay)
397
+ continue
398
+ return response
399
+ litellm.acompletion = accounted_async
400
+
401
+ def record_agent_usage(attempt, *, model: str, provider: str) -> None:
402
+ records: dict[str, tuple[str, dict]] = {}
403
+ current_model = model
404
+ for filename in getattr(attempt, 'logs', []):
405
+ try:
406
+ with Path(filename).open() as stream:
407
+ for line in stream:
408
+ try:
409
+ event = json.loads(line)
410
+ except (ValueError, TypeError):
411
+ continue
412
+ if not isinstance(event, dict):
413
+ continue
414
+ message = event.get('message') or {}
415
+ if event.get('type') == 'assistant' and isinstance(message, dict) and isinstance(message.get('usage'), dict):
416
+ raw = message['usage']
417
+ cached, written = (raw.get('cache_read_input_tokens'), raw.get('cache_creation_input_tokens'))
418
+ if all((type(value) is int and value >= 0 for value in (raw.get('input_tokens'), raw.get('output_tokens')))) and all((value is None or (type(value) is int and value >= 0) for value in (cached, written))):
419
+ receipt: dict = {'usage': {'input_uncached_tokens': raw['input_tokens'], 'prompt_tokens': raw['input_tokens'] + cached + written if cached is not None and written is not None else None, 'completion_tokens': raw['output_tokens'], 'prompt_tokens_details': {'cached_tokens': cached, 'cache_creation_tokens': written}}}
420
+ receipt['created'] = event.get('timestamp')
421
+ creation = raw.get('cache_creation') or {}
422
+ hour = creation.get('ephemeral_1h_input_tokens', 0) if isinstance(creation, dict) else 0
423
+ if type(hour) is int and hour > 0:
424
+ if hour == written:
425
+ receipt['cache_ttl'] = '1h'
426
+ else:
427
+ receipt['usage_granularity'] = 'mixed_cache_ttl'
428
+ records[message.get('id') or json.dumps(raw, sort_keys=True)] = (message.get('model') or current_model, receipt)
429
+ payload = event.get('payload') or {}
430
+ if not isinstance(payload, dict):
431
+ continue
432
+ if event.get('type') == 'turn_context' and payload.get('model'):
433
+ current_model = payload['model']
434
+ if event.get('type') == 'event_msg' and payload.get('type') == 'token_count':
435
+ info = payload.get('info') or {}
436
+ raw, total = (info.get('last_token_usage'), info.get('total_token_usage'))
437
+ if isinstance(raw, dict) and isinstance(total, dict) and all((type(raw.get(key)) is int and raw.get(key) >= 0 for key in ('input_tokens', 'output_tokens'))):
438
+ receipt = {'usage': {'prompt_tokens': raw.get('input_tokens'), 'input_uncached_tokens': raw.get('input_uncached_tokens'), 'input_cache_write_tokens': raw.get('input_cache_write_tokens'), 'completion_tokens': raw.get('output_tokens'), 'prompt_tokens_details': {'cached_tokens': raw.get('cached_input_tokens')}}}
439
+ receipt['created'] = event.get('timestamp')
440
+ records[json.dumps(total, sort_keys=True)] = (current_model, receipt)
441
+ except OSError:
442
+ continue
443
+ captured_input = captured_output = 0
444
+ input_complete = True
445
+ for requested, receipt in records.values():
446
+ requested = requested if '/' in requested else f'{provider}/{requested}'
447
+ _record_judge_usage(receipt, requested)
448
+ receipt_input = receipt['usage'].get('prompt_tokens')
449
+ if receipt_input is None:
450
+ input_complete = False
451
+ else:
452
+ captured_input += receipt_input
453
+ captured_output += receipt['usage'].get('completion_tokens') or 0
454
+ total = getattr(attempt, 'usage', {}) or {}
455
+ if not records or (input_complete and total.get('input_tokens') != captured_input) or total.get('output_tokens') != captured_output:
456
+ _record_judge_usage({'usage': {'prompt_tokens': 0, 'completion_tokens': 0}, 'usage_granularity': 'incomplete_agent_receipts'}, model if '/' in model else f'{provider}/{model}')
457
+
458
+ def install_rewardkit_agents() -> None:
459
+ import rewardkit.judges as judges
460
+ original = judges.get_agent
461
+
462
+ def get_accounted_agent(judge, cwd=None):
463
+ backend = original(judge, cwd)
464
+ run = backend.run
465
+
466
+ async def accounted_run(*args, **kwargs):
467
+ attempt = await run(*args, **kwargs)
468
+ record_agent_usage(attempt, model=judge.model or 'unknown', provider='anthropic' if judge.agent == 'claude-code' else 'openai')
469
+ return attempt
470
+ setattr(backend, 'run', accounted_run)
471
+ return backend
472
+ setattr(judges, 'get_agent', get_accounted_agent)
473
+ if __name__ == '__main__':
474
+ import litellm
475
+ if len(sys.argv) > 2 and sys.argv[1] == '--script':
476
+ import runpy
477
+ install(litellm, synchronous=True)
478
+ sys.argv = sys.argv[2:]
479
+ runpy.run_path(sys.argv[0], run_name='__main__')
480
+ else:
481
+ install(litellm)
482
+ install_rewardkit_agents()
483
+ if Path(__file__).with_name('m1_judge_panel.json').is_file():
484
+ from m1_rewardkit_panel import install_panel
485
+ install_panel(Path(__file__).with_name('m1_judge_panel.json'))
486
+ if Path(__file__).with_name('m1_judge_jev.json').is_file():
487
+ from m1_rewardkit_jev import install_jev
488
+ install_jev(Path(__file__).with_name('m1_judge_jev.json'))
489
+ from rewardkit.__main__ import main
490
+ main()
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/m1_rewardkit_panel.py ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+ import asyncio
3
+ from contextvars import ContextVar
4
+ import json
5
+ import math
6
+ import os
7
+ import sys
8
+ from pathlib import Path
9
+ from typing import Any
10
+ import uuid
11
+ _request_audit: ContextVar[tuple[Path, list[str]] | None] = ContextVar('panel_request_audit', default=None)
12
+
13
+ class PanelIncompleteError(RuntimeError):
14
+ pass
15
+
16
+ def _audit_warning(exc: Exception, warnings: list[str]) -> None:
17
+ message = f'judge panel audit: diagnostic capture failed ({type(exc).__name__})'
18
+ if message not in warnings:
19
+ warnings.append(message)
20
+ print(message, file=sys.stderr)
21
+
22
+ def _write_audit(path: Path, record: dict[str, Any], warnings: list[str], *, append: bool=False) -> None:
23
+ try:
24
+ text = json.dumps(record, allow_nan=False, default=str) + '\n'
25
+ path.parent.mkdir(parents=True, exist_ok=True)
26
+ with path.open('a' if append else 'w') as stream:
27
+ stream.write(text)
28
+ except (OSError, TypeError, ValueError) as exc:
29
+ _audit_warning(exc, warnings)
30
+
31
+ def _binary(raw: Any) -> int:
32
+ if isinstance(raw, bool):
33
+ return int(raw)
34
+ if isinstance(raw, int | float) and math.isfinite(raw) and (raw in (0, 1)):
35
+ return int(raw)
36
+ if isinstance(raw, str):
37
+ value = raw.strip().lower()
38
+ if value in {'yes', 'true', '1'}:
39
+ return 1
40
+ if value in {'no', 'false', '0'}:
41
+ return 0
42
+ raise PanelIncompleteError('m1_judge_panel_incomplete: invalid binary vote')
43
+
44
+ def validate_votes(scores: list[Any], criteria: list[Any]) -> None:
45
+ names = [criterion.name for criterion in criteria]
46
+ if len(set(names)) != len(names) or [score.name for score in scores] != names:
47
+ raise PanelIncompleteError('m1_judge_panel_incomplete: criterion membership mismatch')
48
+ for score, criterion in zip(scores, criteria, strict=True):
49
+ if score.error:
50
+ raise PanelIncompleteError('m1_judge_panel_incomplete: judge returned an error')
51
+ raw = _binary(score.raw)
52
+ expected = 1 - raw if criterion.negate else raw
53
+ if not math.isfinite(score.value) or score.value != expected:
54
+ raise PanelIncompleteError('m1_judge_panel_incomplete: inconsistent binary score')
55
+
56
+ async def run_panel(judge: Any, criteria: list[Any], weights: list[float] | None, system_prompt: str | None, *, config: dict[str, Any], run_llm: Any, score_type: Any, audit_dir: Path) -> tuple[list[Any], str, list[str]]:
57
+ from rewardkit.models import Binary
58
+ if not criteria or any((not isinstance(criterion.output_format, Binary) for criterion in criteria)):
59
+ raise ValueError('panel majority voting requires nonempty binary criteria')
60
+ group_dir = audit_dir / uuid.uuid4().hex
61
+ warnings_out: list[str] = []
62
+
63
+ async def member_call(index: int, member: dict[str, Any]):
64
+ member_judge = judge.model_copy(update=member)
65
+ evidence: dict[str, Any] = {'member': index + 1, 'judge': member, 'criteria': [criterion.name for criterion in criteria], 'status': 'started'}
66
+ path = group_dir / f'judge-{index + 1}.json'
67
+ _write_audit(path, evidence, warnings_out)
68
+ token = _request_audit.set((group_dir / f'judge-{index + 1}-requests.jsonl', warnings_out))
69
+ try:
70
+ scores, output, warnings = await run_llm(member_judge, criteria, weights, system_prompt)
71
+ evidence.update(output=output, warnings=warnings)
72
+ validate_votes(scores, criteria)
73
+ evidence['scores'] = [score.to_dict() for score in scores]
74
+ evidence['status'] = 'completed'
75
+ return (scores, output, warnings)
76
+ except BaseException as exc:
77
+ evidence.update(status='failed', error_class=type(exc).__name__)
78
+ if isinstance(exc, PanelIncompleteError):
79
+ evidence['error'] = str(exc)
80
+ raise
81
+ finally:
82
+ _request_audit.reset(token)
83
+ _write_audit(path, evidence, warnings_out)
84
+ outcomes = await asyncio.gather(*(member_call(index, member) for index, member in enumerate(config['members'])), return_exceptions=True)
85
+ failed = [index + 1 for index, result in enumerate(outcomes) if isinstance(result, BaseException)]
86
+ if failed:
87
+ _write_audit(group_dir / 'panel.json', {'status': 'incomplete', 'failed_members': failed}, warnings_out)
88
+ raise PanelIncompleteError(f'm1_judge_panel_incomplete: failed members {failed}; see panel audit artifacts')
89
+ completed = [outcome for outcome in outcomes if not isinstance(outcome, BaseException)]
90
+ combined = []
91
+ for index, criterion in enumerate(criteria):
92
+ votes = [{'judge': config['members'][member_index], **outcome[0][index].to_dict()} for member_index, outcome in enumerate(completed)]
93
+ passes = sum((vote['value'] == 1 for vote in votes))
94
+ value = int(passes >= 2)
95
+ combined.append(score_type(name=criterion.name, value=value, raw=bool(1 - value if criterion.negate else value), weight=weights[index] if weights is not None else 1.0, reasoning=f'{passes}/3 judges passed; strict majority requires 2/3.', description=criterion.description, id=criterion.id, negate=criterion.negate, optional=criterion.optional, votes=votes))
96
+ for outcome in completed:
97
+ warnings_out.extend(outcome[2])
98
+ audit = {'status': 'completed', 'mode': 'panel', 'aggregation': 'majority', 'required_votes': 2, 'members': config['members'], 'criteria': [score.to_dict() for score in combined]}
99
+ output = json.dumps(audit, indent=2, allow_nan=False)
100
+ _write_audit(group_dir / 'panel.json', audit, warnings_out)
101
+ return (combined, output, warnings_out)
102
+
103
+ def install_panel(config_path: Path, *, audit_dir: Path=Path('/logs/verifier/judge-panel')) -> None:
104
+ import rewardkit.judges as judges
105
+ import rewardkit.reward as reward
106
+ from rewardkit.models import LLMJudge, Score
107
+ import litellm
108
+ config = json.loads(config_path.read_text())
109
+ members = config.get('members')
110
+ concurrency = config.get('max_concurrent_llm')
111
+ if config.get('mode') != 'panel' or not isinstance(members, list) or len(members) != 3 or (len({member['model'] for member in members}) != 3) or (type(concurrency) is not int) or (not 1 <= concurrency <= 64):
112
+ raise ValueError('invalid materialized panel configuration')
113
+ if os.environ.get('REWARDKIT_JUDGE') or os.environ.get('REWARDKIT_MODEL'):
114
+ raise ValueError('RewardKit environment overrides cannot replace a frozen panel')
115
+
116
+ class PanelScore(Score):
117
+ votes: list[dict[str, Any]]
118
+
119
+ def to_dict(self):
120
+ return {**super().to_dict(), 'votes': self.votes}
121
+ original_llm = judges.arun_llm
122
+ original_call = judges._arun_llm_call
123
+ original_details = reward.Reward.to_detail_dict
124
+ original_completion = litellm.acompletion
125
+ active_loop = None
126
+ semaphore = None
127
+
128
+ async def captured_completion(*args, **kwargs):
129
+ context = _request_audit.get()
130
+ record = {'requested_model': kwargs.get('model')}
131
+ response = None
132
+ try:
133
+ response = await original_completion(*args, **kwargs)
134
+ return response
135
+ except BaseException as exc:
136
+ record['error_class'] = type(exc).__name__
137
+ raise
138
+ finally:
139
+ if context is not None:
140
+ path, warnings = context
141
+ try:
142
+ if response is not None:
143
+ data = response.model_dump() if hasattr(response, 'model_dump') else response
144
+ record.update(response_model=data.get('model'), choices=data.get('choices'))
145
+ _write_audit(path, record, warnings, append=True)
146
+ except (OSError, TypeError, ValueError) as exc:
147
+ _audit_warning(exc, warnings)
148
+
149
+ async def bounded_call(*args, **kwargs):
150
+ nonlocal active_loop, semaphore
151
+ loop = asyncio.get_running_loop()
152
+ if active_loop is not loop:
153
+ active_loop, semaphore = (loop, asyncio.Semaphore(concurrency))
154
+ assert semaphore is not None
155
+ async with semaphore:
156
+ return await original_call(*args, **kwargs)
157
+
158
+ async def panel_call(judge, criteria, weights=None, system_prompt=None):
159
+ return await run_panel(judge, criteria, weights, system_prompt, config=config, run_llm=original_llm, score_type=PanelScore, audit_dir=audit_dir)
160
+
161
+ def panel_details(self, score):
162
+ detail = original_details(self, score)
163
+ if isinstance(self.judge, LLMJudge):
164
+ detail.update(kind='llm_panel', judge=config, aggregation='majority', required_votes=2)
165
+ return detail
166
+ setattr(reward, 'arun_llm', panel_call)
167
+ setattr(judges, '_arun_llm_call', bounded_call)
168
+ setattr(litellm, 'acompletion', captured_completion)
169
+ reward.Reward.to_detail_dict = panel_details
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/normalize_reward.py ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+ import argparse
3
+ import json
4
+ from pathlib import Path
5
+ from typing import Any
6
+
7
+ def main() -> None:
8
+ parser = argparse.ArgumentParser()
9
+ parser.add_argument('--raw-details', required=True)
10
+ parser.add_argument('--rubric', required=True)
11
+ parser.add_argument('--reward-out', required=True)
12
+ parser.add_argument('--details-out', required=True)
13
+ args = parser.parse_args()
14
+ raw_details = _load_json(Path(args.raw_details))
15
+ rubric = _load_json(Path(args.rubric))
16
+ criteria = rubric['criteria']
17
+ raw_by_name = _raw_criteria_by_name(raw_details)
18
+ positive_total = sum((float(item['score']) for item in criteria if float(item['score']) > 0))
19
+ if positive_total <= 0:
20
+ raise ValueError('rubric must contain at least one positive score')
21
+ earned = 0.0
22
+ normalized_criteria: list[dict[str, Any]] = []
23
+ for item in criteria:
24
+ signed_score = float(item['score'])
25
+ raw = raw_by_name.get(item['name'], {})
26
+ value = _coerce_score(raw.get('value', 0.0))
27
+ contribution = value * signed_score
28
+ earned += contribution
29
+ normalized_criteria.append({'name': item['name'], 'value': value, 'raw': raw.get('raw'), 'weight': signed_score, 'signed_score': signed_score, 'polarity': item['polarity'], 'contribution': contribution, 'description': item['description'], 'source': item.get('source', ''), 'justification': item.get('justification', ''), 'metadata': item.get('metadata', {}), 'reasoning': raw.get('reasoning'), 'judge_reasoning': raw.get('reasoning'), 'judge_error': raw.get('error'), **({'votes': raw['votes']} if 'votes' in raw else {})})
30
+ unclamped = earned / positive_total
31
+ reward = max(0.0, min(1.0, unclamped))
32
+ reward_out = {'correctness': reward}
33
+ details_out = {'correctness': {'score': reward, 'kind': 'signed_score', 'criteria': normalized_criteria, 'aggregation': {'method': 'signed_score_ratio_clamped', 'earned': earned, 'positive_total': positive_total, 'unclamped': unclamped, 'clamped': reward}, 'raw_rewardkit': raw_details}}
34
+ _write_json(Path(args.reward_out), reward_out)
35
+ _write_json(Path(args.details_out), details_out)
36
+
37
+ def _load_json(path: Path) -> Any:
38
+ return json.loads(path.read_text())
39
+
40
+ def _write_json(path: Path, data: Any) -> None:
41
+ path.parent.mkdir(parents=True, exist_ok=True)
42
+ path.write_text(json.dumps(data, indent=2) + '\n')
43
+
44
+ def _raw_criteria_by_name(details: dict[str, Any]) -> dict[str, dict[str, Any]]:
45
+ out: dict[str, dict[str, Any]] = {}
46
+ for reward in details.values():
47
+ for item in _iter_raw_criteria(reward):
48
+ name = item.get('name')
49
+ if isinstance(name, str):
50
+ out[name] = item
51
+ return out
52
+
53
+ def _iter_raw_criteria(value: Any):
54
+ if isinstance(value, list):
55
+ for item in value:
56
+ yield from _iter_raw_criteria(item)
57
+ return
58
+ if not isinstance(value, dict):
59
+ return
60
+ for item in value.get('criteria') or []:
61
+ if isinstance(item, dict):
62
+ yield item
63
+
64
+ def _coerce_score(value: Any) -> float:
65
+ if isinstance(value, bool):
66
+ return 1.0 if value else 0.0
67
+ if isinstance(value, int | float):
68
+ return max(0.0, min(1.0, float(value)))
69
+ return 0.0
70
+ if __name__ == '__main__':
71
+ main()
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/agent_prompt.md ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ You are grading the submitted legal analysis against the criteria below.
2
+
3
+ Read `/logs/artifacts/answer.md`, the answer captured by the verifier, before
4
+ assigning any scores. Evaluate that file as the submission. Other files in
5
+ `/app` may supply context, but must not replace the submitted answer. Do not
6
+ modify the submission. If it is missing or empty, state that in your reasoning
7
+ and apply the criteria to that missing or empty submission. Preserve each
8
+ criterion's stated positive or penalty polarity.
9
+
10
+ {criteria}
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/mentions_in_the_first_assignment_that_the_county_s_prior_rezonin.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "mentions_in_the_first_assignment_that_the_county_s_prior_rezonin"
10
+ description = "Does the response satisfy the legal-analysis criterion below? Apply any numeric tolerances stated inside the criterion text.\n\nCriterion: Mentions in the first assignment that the county's prior rezoning request in DCI2018-10023 was remanded by the Hearing Examiner to staff for further evaluation and analysis on August 13, 2019."
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/mentions_in_the_first_assignment_that_the_subject_property_was_p.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "mentions_in_the_first_assignment_that_the_subject_property_was_p"
10
+ description = "Does the response satisfy the legal-analysis criterion below? Apply any numeric tolerances stated inside the criterion text.\n\nCriterion: Mentions in the first assignment that the subject property was placed into the Public Facilities future land use category of the Lee County Comprehensive Plan pursuant to Lee County, Fla. Ordinance 23-28 (2023)."
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_dci2018_10023_remained_activ.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "states_in_the_first_assignment_that_dci2018_10023_remained_activ"
10
+ description = "The response should be penalized if it commits the legal-analysis failure described below. Answer Pass only if the response DOES commit this failure; answer Fail if the response avoids it. Apply any numeric tolerances stated inside the criterion text.\n\nFailure criterion: States in the first assignment that DCI2018-10023 remained active until September 13, 2023."
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_circuit_court_found_th_2.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "states_in_the_first_assignment_that_the_circuit_court_found_th_2"
10
+ description = "Does the response satisfy the legal-analysis criterion below? Apply any numeric tolerances stated inside the criterion text.\n\nCriterion: States in the first assignment that the circuit court found that the Lee County Board of County Commissioners \"improperly departed from the record created at the quasi-judicial hearings held below.\""
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_circuit_court_found_th_3.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "states_in_the_first_assignment_that_the_circuit_court_found_th_3"
10
+ description = "Does the response satisfy the legal-analysis criterion below? Apply any numeric tolerances stated inside the criterion text.\n\nCriterion: States in the first assignment that the circuit court found that Lee County's conduct \"created prejudice and bias\" surrounding the rezoning."
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_circuit_court_found_th_4.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "states_in_the_first_assignment_that_the_circuit_court_found_th_4"
10
+ description = "Does the response satisfy the legal-analysis criterion below? Apply any numeric tolerances stated inside the criterion text.\n\nCriterion: States in the first assignment that the circuit court found that certain Federal Aviation Administration regulations \"were not fully considered below.\""
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_circuit_court_found_that.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "states_in_the_first_assignment_that_the_circuit_court_found_that"
10
+ description = "Does the response satisfy the legal-analysis criterion below? Apply any numeric tolerances stated inside the criterion text.\n\nCriterion: States in the first assignment that the circuit court found that the Petitioners had standing to bring the petition based on proximity of the Petitioners' property to the proposed facility."
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_county_could_appeal_the.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "states_in_the_first_assignment_that_the_county_could_appeal_the"
10
+ description = "Does the response satisfy the legal-analysis criterion below? Apply any numeric tolerances stated inside the criterion text.\n\nCriterion: States in the first assignment that the county could appeal the Order Granting Writ of Certiorari to the Sixth District Court of Appeals pursuant to Fla. R. App. P. 9.030(b)(2)(B)."
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_county_could_file_a_new.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "states_in_the_first_assignment_that_the_county_could_file_a_new"
10
+ description = "Does the response satisfy the legal-analysis criterion below? Apply any numeric tolerances stated inside the criterion text.\n\nCriterion: States in the first assignment that the County could file a new application for rezoning."
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_county_could_negotiate_2.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "states_in_the_first_assignment_that_the_county_could_negotiate_2"
10
+ description = "Does the response satisfy the legal-analysis criterion below? Apply any numeric tolerances stated inside the criterion text.\n\nCriterion: States in the first assignment that the County could negotiate for additional conditions protecting water quality that address Petitioners' concerns."
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_county_could_negotiate_f.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "states_in_the_first_assignment_that_the_county_could_negotiate_f"
10
+ description = "Does the response satisfy the legal-analysis criterion below? Apply any numeric tolerances stated inside the criterion text.\n\nCriterion: States in the first assignment that the County could negotiate for additional conditions protecting wildlife that address Petitioners' concerns."
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_county_could_remand_the.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "states_in_the_first_assignment_that_the_county_could_remand_the"
10
+ description = "Does the response satisfy the legal-analysis criterion below? Apply any numeric tolerances stated inside the criterion text.\n\nCriterion: States in the first assignment that the county could remand the case back to the Hearing Examiner for an evidentiary hearing to address the deficiencies identified in the Order Granting Petition for Writ of Certiorari under Lee County Fla. Land Development Code § 34-83(a)(6) (2025)."
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_county_could_take_the_po.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "states_in_the_first_assignment_that_the_county_could_take_the_po"
10
+ description = "Does the response satisfy the legal-analysis criterion below? Apply any numeric tolerances stated inside the criterion text.\n\nCriterion: States in the first assignment that the County could take the position that the rezoning is not necessary because the county is not bound by its local zoning laws in carrying out a governmental function."
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_county_could_voluntarily.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "states_in_the_first_assignment_that_the_county_could_voluntarily"
10
+ description = "Does the response satisfy the legal-analysis criterion below? Apply any numeric tolerances stated inside the criterion text.\n\nCriterion: States in the first assignment that the County could voluntarily cease construction activities pending resolution of the challenge."
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_county_must_stop_constru.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "states_in_the_first_assignment_that_the_county_must_stop_constru"
10
+ description = "The response should be penalized if it commits the legal-analysis failure described below. Answer Pass only if the response DOES commit this failure; answer Fail if the response avoids it. Apply any numeric tolerances stated inside the criterion text.\n\nFailure criterion: States in the first assignment that the county must stop construction activities as a result of the Order Granting Writ of Certiorari."
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_county_should_cease_cons.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "states_in_the_first_assignment_that_the_county_should_cease_cons"
10
+ description = "The response should be penalized if it commits the legal-analysis failure described below. Answer Pass only if the response DOES commit this failure; answer Fail if the response avoids it. Apply any numeric tolerances stated inside the criterion text.\n\nFailure criterion: States in the first assignment that the County should cease construction activities at the subject property."
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_county_should_file_a_tim.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "states_in_the_first_assignment_that_the_county_should_file_a_tim"
10
+ description = "Does the response satisfy the legal-analysis criterion below? Apply any numeric tolerances stated inside the criterion text.\n\nCriterion: States in the first assignment that the County should file a timely appeal with the 6th District Court of Appeals."
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_county_should_remand_the.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "states_in_the_first_assignment_that_the_county_should_remand_the"
10
+ description = "Does the response satisfy the legal-analysis criterion below? Apply any numeric tolerances stated inside the criterion text.\n\nCriterion: States in the first assignment that the County should remand the case to the Hearing Examiner to address the deficiencies identified in the Order Granting Writ of Certiorari while an appeal is pending."
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_effect_of_the_order_gran.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "states_in_the_first_assignment_that_the_effect_of_the_order_gran"
10
+ description = "The response should be penalized if it commits the legal-analysis failure described below. Answer Pass only if the response DOES commit this failure; answer Fail if the response avoids it. Apply any numeric tolerances stated inside the criterion text.\n\nFailure criterion: States in the first assignment that the effect of the Order Granting Writ of Certiorari is that the Board's decision is overturned."
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_exclusive_method_of_chal.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "states_in_the_first_assignment_that_the_exclusive_method_of_chal"
10
+ description = "Does the response satisfy the legal-analysis criterion below? Apply any numeric tolerances stated inside the criterion text.\n\nCriterion: States in the first assignment that the exclusive method of challenging the issuance of a development order that materially alters the use or density or intensity of use on a particular piece of property is by filing a petition for writ of certiorari under Fla. Stat. § 163.3215(4) (2025) within 30 days of rendition of the development order."
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_exclusive_method_of_revi.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "states_in_the_first_assignment_that_the_exclusive_method_of_revi"
10
+ description = "Does the response satisfy the legal-analysis criterion below? Apply any numeric tolerances stated inside the criterion text.\n\nCriterion: States in the first assignment that the exclusive method of review of a quasi-judicial decision is by petition for writ of certiorari under Fla. R. App. P. 9.100(c) (2025) within 30 days of the written decision."
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_order_granting_petition.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "states_in_the_first_assignment_that_the_order_granting_petition"
10
+ description = "Does the response satisfy the legal-analysis criterion below? Apply any numeric tolerances stated inside the criterion text.\n\nCriterion: States in the first assignment that the Order Granting Petition for Writ of Certiorari quashes Lee County, Fla., Res. No. Z-23-035 (2024)."
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_the_petitioners_may_file_a_s.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "states_in_the_first_assignment_that_the_petitioners_may_file_a_s"
10
+ description = "The response should be penalized if it commits the legal-analysis failure described below. Answer Pass only if the response DOES commit this failure; answer Fail if the response avoids it. Apply any numeric tolerances stated inside the criterion text.\n\nFailure criterion: States in the first assignment that the Petitioners may file a separate cause of action for injunction to stop construction activities."
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_under_fla_stat_163_3167_10_2.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "states_in_the_first_assignment_that_under_fla_stat_163_3167_10_2"
10
+ description = "Does the response satisfy the legal-analysis criterion below? Apply any numeric tolerances stated inside the criterion text.\n\nCriterion: States in the first assignment that under Fla. Stat § 163.3167(10) (2025) the development order issued for the project may not be invalidated by a subsequent judicial determination because the timeframe for filing an appeal of the development order has expired."
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/raw_correctness/states_in_the_first_assignment_that_under_lee_county_fla_admin_c.toml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [judge]
2
+ judge = "openai/gpt-5.6-terra"
3
+ files = ["/logs/artifacts/answer.md"]
4
+ reasoning_effort = "medium"
5
+ timeout = 1500
6
+ weight = 1.0
7
+
8
+ [[criterion]]
9
+ name = "states_in_the_first_assignment_that_under_lee_county_fla_admin_c"
10
+ description = "Does the response satisfy the legal-analysis criterion below? Apply any numeric tolerances stated inside the criterion text.\n\nCriterion: States in the first assignment that under Lee County, Fla. Admin. Code § 2-6, 4.1 B. (2025), DCI2018-10023 was considered withdrawn on February 13, 2020."
11
+ type = "binary"
12
+ weight = 1.0
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/tests/test.sh ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ mkdir -p /logs/artifacts /logs/verifier/raw
5
+
6
+ python3 - <<'PYEOF'
7
+ import json
8
+ import shutil
9
+ from pathlib import Path
10
+
11
+
12
+ def has_text(path: Path) -> bool:
13
+ return path.exists() and path.is_file() and bool(path.read_text(errors="replace").strip())
14
+
15
+
16
+ def fallback_paths(answer_path: Path) -> list[Path]:
17
+ paths = []
18
+ try:
19
+ relative = answer_path.relative_to("/app")
20
+ paths.append(Path("/app/app") / relative)
21
+ except ValueError:
22
+ pass
23
+ return [path for path in paths if path != answer_path]
24
+
25
+
26
+ config = json.loads(Path("/tests/fixtures/config.json").read_text())
27
+ answer_path = Path(config["answer_path"])
28
+ artifact_answer = Path("/logs/artifacts/answer.md")
29
+ artifact_answer.parent.mkdir(parents=True, exist_ok=True)
30
+ if has_text(answer_path):
31
+ shutil.copyfile(answer_path, artifact_answer)
32
+ else:
33
+ for candidate in fallback_paths(answer_path):
34
+ if has_text(candidate):
35
+ shutil.copyfile(candidate, artifact_answer)
36
+ break
37
+ else:
38
+ artifact_answer.write_text("")
39
+
40
+ # Harbor collects /logs/artifacts when the agent step ends, which is before this
41
+ # script runs, so the copy above never reaches the uploaded artifacts. /logs/verifier
42
+ # is uploaded after the verifier phase, so persist the graded answer there too.
43
+ verifier_answer = Path("/logs/verifier/answer.md")
44
+ verifier_answer.parent.mkdir(parents=True, exist_ok=True)
45
+ shutil.copyfile(artifact_answer, verifier_answer)
46
+ PYEOF
47
+
48
+ uv run --no-project --with 'harbor-rewardkit[all]==0.2.0' python /tests/m1_rewardkit_accounting.py /tests/raw_correctness \
49
+ --workspace /app \
50
+ --output /logs/verifier/raw/reward.json \
51
+ --max-concurrent-llm "${MAX_CONCURRENT_LLM:-4}" \
52
+ --max-concurrent-agent "${M1_MAX_CONCURRENT_AGENT:-1}"
53
+
54
+ python /tests/normalize_reward.py \
55
+ --raw-details /logs/verifier/raw/reward-details.json \
56
+ --rubric /tests/fixtures/rubric.json \
57
+ --reward-out /logs/verifier/reward.json \
58
+ --details-out /logs/verifier/reward-details.json
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/workdir/attachments/1774361815-lcu-project.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9c5f99bdc5eaf0627b26261a422a8795559be236d23eaf80bde215659edd606b
3
+ size 1605204
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/workdir/attachments/1774361815-orderpdf.docx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f4f537e2119b85b27f1f73c72769455e7ddc56411f9c83bd52e5b25d5db8281b
3
+ size 5949313
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/workdir/attachments/1774361815-petition.docx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:823d81b96ebd48a0b45f9353645ea5276ec83d6561a6963ee404478e3e0e4c4d
3
+ size 4633006
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-1/workdir/attachments/1774361815-resolution.docx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4345fd5cc85c6e38d988164b512b4cf8d2c9347c21e96ebc18dd714b53ca6e0f
3
+ size 629762
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-2/instruction.md ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Petition for Writ of Certiorari for Quasi-judicial Proceeding — Brief Requesting Second-Tier Review
2
+
3
+ Domain: Legal
4
+
5
+ Matter: Petition for Writ of Certiorari for Quasi-judicial Proceeding
6
+
7
+ You are a senior legal analyst operating autonomously. You are completing a multi-step legal reasoning task. Follow the role, factual record, instructions, and deliverable requirements provided in the Task and each Assignment.
8
+
9
+ Each Assignment may require a different legal deliverable. Follow the requirements specific to that Assignment.
10
+
11
+ ## Word limits for court briefs
12
+
13
+ - A brief in support of or in response to a motion may not exceed **8,750 words**.
14
+ - A reply brief may not exceed **3,500 words**.
15
+ - For a motion for reconsideration, a brief in support of or in response to the motion may not exceed **3,500 words**, and a reply brief may not exceed **1,750 words**.
16
+ - If an Assignment specifies a stricter word limit, follow the stricter limit.
17
+
18
+ These word limits do not apply to legal memoranda or other non-court-filing deliverables unless the Assignment expressly provides otherwise.
19
+
20
+ Complete the task end-to-end without asking for confirmation, permission, or clarification.
21
+
22
+ Use the uploaded matter documents in `/app/attachments/` as your primary case file. You also have internet access via OpenCode's `websearch` tool; use it to research any statutes, regulations, cases, administrative guidance, or secondary authorities that are not supplied as attachments. Cite any authority you rely on in the format requested by the prompt.
23
+
24
+ For document inspection:
25
+ - PDF: `pdftotext /app/attachments/<filename>.pdf -`
26
+ - DOCX: `pandoc /app/attachments/<filename>.docx -t markdown`
27
+ - XLSX/CSV: use Python with `openpyxl` or `pandas`
28
+ - If extraction is unreliable, inspect the raw file with Python libraries or convert/render the relevant pages.
29
+
30
+ Write the final complete legal deliverable for this assignment to `/app/response2.md`. The verifier reads only that file.
31
+
32
+ This is a follow-on assignment. The documents from the previous assignment(s) remain available in `/app/attachments/`, and your prior deliverable `/app/response1.md` is also on disk. Build on that analysis as the prompt directs.
33
+
34
+ ## Attachments
35
+
36
+ _No new documents for this assignment. The documents from the previous assignment(s) remain available in `/app/attachments/`._
37
+
38
+ ## Prompt
39
+
40
+ 2nd ASSIGNMENT
41
+ TO: Denise Swarek, Assistant County Attorney
42
+ FROM: Thomas Rowe, County Attorney
43
+ RE: PETER SPAHN, ET. AL., V. LEE COUNTY; Case No. 24-CA-1479
44
+ DATE: November 10, 2025
45
+ ________________________________________
46
+ The Board has decided to appeal the Order Granting Petition for Certiorari. Draft a ready-to-file brief requesting second-tier review. All legal analysis should be based on the versions of statutes, regulations, and ordinances in effect as of January 1, 2025. Use full Bluebook citation format.
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-2/solution/solve.sh ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # No oracle solution ships with LegalReasonBench. The verifier grades the
3
+ # agent's own legal deliverable for this assignment against the rubric.
4
+ echo "no oracle solution"
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-2/tests/fixtures/config.json ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "task_id": "lrb-certiorari-quasi-judicial-land-use",
3
+ "title": "Petition for Writ of Certiorari for Quasi-judicial Proceeding",
4
+ "domain": "Legal",
5
+ "matter": "Petition for Writ of Certiorari for Quasi-judicial Proceeding",
6
+ "judge": {
7
+ "max_concurrent_llm": 12,
8
+ "mode": "panel",
9
+ "members": [
10
+ {
11
+ "model": "openai/gpt-5.6-terra",
12
+ "reasoning_effort": "medium",
13
+ "timeout": 1500
14
+ },
15
+ {
16
+ "model": "anthropic/claude-sonnet-5",
17
+ "reasoning_effort": "medium",
18
+ "timeout": 1500
19
+ },
20
+ {
21
+ "model": "gemini/gemini-3.8-flash",
22
+ "reasoning_effort": "medium",
23
+ "timeout": 1500
24
+ }
25
+ ],
26
+ "model": "openai/gpt-5.6-terra",
27
+ "reasoning_effort": "medium",
28
+ "timeout": 1500
29
+ },
30
+ "step_index": 2,
31
+ "step_name": "assignment-2",
32
+ "step_title": "Brief Requesting Second-Tier Review",
33
+ "prompt": "2nd ASSIGNMENT\nTO: Denise Swarek, Assistant County Attorney\nFROM: Thomas Rowe, County Attorney\nRE: PETER SPAHN, ET. AL., V. LEE COUNTY; Case No. 24-CA-1479\nDATE: November 10, 2025\n________________________________________\nThe Board has decided to appeal the Order Granting Petition for Certiorari. Draft a ready-to-file brief requesting second-tier review. All legal analysis should be based on the versions of statutes, regulations, and ordinances in effect as of January 1, 2025. Use full Bluebook citation format.",
34
+ "attachments": [],
35
+ "rubric": [
36
+ {
37
+ "name": "identifies_in_the_second_assignment_that_the_appropriate_mechani",
38
+ "description": "Identifies in the second assignment that the appropriate mechanism to appeal the Order Granting Writ of Certiorari is a Petition for Writ of Certiorari to the 6th District Court of Appeals.",
39
+ "source": "Florida Rule of Appellate Procedure 9.030(b)(2)(B); https://rules.floridaappellate.com/rule-9-030/#:~:text=b%29-,Jurisdiction,capacity\n\"Jurisdiction of District Courts of Appeal.\n\"b) Jurisdiction of District Courts of Appeal.\n. . .\n(2) Certiorari Jurisdiction.8 The certiorari jurisdiction of district courts of appeal may be sought to review:\n(A) nonfinal orders of lower tribunals other than as prescribed by rule 9.130; or\n(B) final orders of circuit courts acting in their review capacity.\"\nSee also Map of Florida\u2019s Court Jurisdictions, available at https://flcourts-media.flcourts.gov/content/download/426177/file/ar-17-18-map-of-floridas-court-jurisdictions.pdf (last accessed Mar. 25, 2026)",
40
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d",
41
+ "metadata": {
42
+ "review_flag": false,
43
+ "original_name": "identifies_in_the_second_assignment_that_the_appropriate_mechanism_to_appeal_the",
44
+ "original_index": 26,
45
+ "classifier_reason": "Names second assignment",
46
+ "classifier_confidence": "high"
47
+ },
48
+ "score": 5.0,
49
+ "polarity": "positive",
50
+ "raw_weight": 1.0
51
+ },
52
+ {
53
+ "name": "states_in_the_second_assignment_that_the_circuit_court_erred_by",
54
+ "description": "States in the second assignment that the circuit court erred by ignoring the competent substantial evidence on the record that supported the approval contrary to Dusseau v. Metro. Dade Cnty. Bd. of Cnty. Comm\u2019rs, 794 So.2d 1270 (Fla. 2001).",
55
+ "source": "Dusseau v. Metro. Dade Cnty. Bd. of Cnty. Comm\u2019rs, 794 So.2d 1270 (Fla. 2001), is the preeminent FL Supreme court case on the limited review of quasi-judicial. \nhttps://caselaw.findlaw.com/court/fl-supreme-court/1489002.html#:~:text=Notably,ended\n\"Notably, when applying the third prong, the court should review the record to determine simply whether the Commission's decision is supported by competent substantial evidence.\n\nWe reiterate that the \u201ccompetent substantial evidence\u201d standard cannot be used by a reviewing court as a mechanism for exerting covert control over the policy determinations and factual findings of the local agency. \u2002 Rather, this standard requires the reviewing court to defer to the agency's superior technical expertise and special vantage point in such matters. \u2002 The issue before the court is not whether the agency's decision is the \u201cbest\u201d decision or the \u201cright\u201d decision or even a \u201cwise\u201d decision, for these are technical and policy-based determinations properly within the purview of the agency. \u2002 The circuit court has no training or experience-and is inherently unsuited-to sit as a roving \u201csuper agency\u201d with plenary oversight in such matters.\n\nThe sole issue before the court on first-tier certiorari review is whether the agency's decision is lawful. \u2002 The court's task vis-a-vis the third prong of Vaillant is simple: \u2009The court must review the record to assess the evidentiary support for the agency's decision. \u2002 Evidence contrary to the agency's decision is outside the scope of the inquiry at this point, for the reviewing court above all cannot reweigh the \u201cpros and cons\u201d of conflicting evidence. \u2002 While contrary evidence may be relevant to the wisdom of the decision, it is irrelevant to the lawfulness of the decision. \u2002 As long as the record contains competent substantial evidence to support the agency's decision, the decision is presumed lawful and the court's job is ended.\"",
56
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d",
57
+ "metadata": {
58
+ "review_flag": false,
59
+ "original_name": "states_in_the_second_assignment_that_the_circuit_court_erred_by_ignoring_the_com",
60
+ "original_index": 27,
61
+ "classifier_reason": "Names second assignment",
62
+ "classifier_confidence": "high"
63
+ },
64
+ "score": 20.0,
65
+ "polarity": "positive",
66
+ "raw_weight": 1.0
67
+ },
68
+ {
69
+ "name": "states_in_the_second_assignment_that_the_staff_report_recommendi",
70
+ "description": "States in the second assignment that the staff report recommending approval is competent substantial evidence that supports the Board's approval of the rezoning.",
71
+ "source": "City of Hialeah Gardens v. Miami-Dade Charter Found., Inc., 857 So.2d 202, 204-5 (Fla. 3d DCA 2003); https://caselaw.findlaw.com/court/fl-district-court-of-appeal/1254782.html#:~:text=Here%2C%20the,reached%2E%E2%80%9D\n\"Here, the testifying staff members utilized their professional experiences and personal observations, as well as Machado's application, site plan, and traffic study, as the basis for their testimony. \u2002 These record materials, along with the staff presentations, combined to provide evidence \u201csufficiently relevant and material that a reasonable mind would accept it as adequate to support the conclusion reached.\u201d",
72
+ "justification": "This rubric item is implied, though not directly requested, in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d The primary argument on appeal is that the court failed to apply the standard of review under Dusseau v. Metro. Dade Cnty. Bd. of Cnty. Comm\u2019rs, 794 So.2d 1270 (Fla. 2001), by ignoring the competent substantial evidence on the record that supported the Board's approval. Identifying the competent substantial evidence on the record supports this argument.",
73
+ "metadata": {
74
+ "review_flag": false,
75
+ "original_name": "states_in_the_second_assignment_that_the_staff_report_recommending_approval_is_c",
76
+ "original_index": 28,
77
+ "classifier_reason": "Names second assignment",
78
+ "classifier_confidence": "high"
79
+ },
80
+ "score": 5.0,
81
+ "polarity": "positive",
82
+ "raw_weight": 1.0
83
+ },
84
+ {
85
+ "name": "states_in_the_second_assignment_that_expert_testimony_on_the_rec",
86
+ "description": "States in the second assignment that expert testimony on the record is competent substantial evidence that supports the Board's approval of the rezoning.",
87
+ "source": "City of Hialeah Gardens v. Miami-Dade Charter Found., Inc., 857 So.2d 202, 204-5 (Fla. 3d DCA 2003); https://caselaw.findlaw.com/court/fl-district-court-of-appeal/1254782.html#:~:text=Here%2C%20the,reached%2E%E2%80%9D\n\"Here, the testifying staff members utilized their professional experiences and personal observations, as well as Machado's application, site plan, and traffic study, as the basis for their testimony. \u2002 These record materials, along with the staff presentations, combined to provide evidence \u201csufficiently relevant and material that a reasonable mind would accept it as adequate to support the conclusion reached.\u201d",
88
+ "justification": "This rubric item is implied, though not directly requested, in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d The primary argument on appeal is that the court failed to apply the standard of review under Dusseau v. Metro. Dade Cnty. Bd. of Cnty. Comm\u2019rs, 794 So.2d 1270 (Fla. 2001), by ignoring the competent substantial evidence on the record that supported the Board's approval. Identifying the competent substantial evidence on the record supports this argument.",
89
+ "metadata": {
90
+ "review_flag": false,
91
+ "original_name": "states_in_the_second_assignment_that_expert_testimony_on_the_record_is_competent",
92
+ "original_index": 29,
93
+ "classifier_reason": "Names second assignment",
94
+ "classifier_confidence": "high"
95
+ },
96
+ "score": 5.0,
97
+ "polarity": "positive",
98
+ "raw_weight": 1.0
99
+ },
100
+ {
101
+ "name": "states_in_the_second_assignment_that_the_hearing_examiner_s_reco",
102
+ "description": "States in the second assignment that the Hearing Examiner's recommendation of approval is competent substantial evidence that supports the Board's approval of the rezoning.",
103
+ "source": "City of Hialeah Gardens v. Miami-Dade Charter Found., Inc., 857 So.2d 202, 204-5 (Fla. 3d DCA 2003); https://caselaw.findlaw.com/court/fl-district-court-of-appeal/1254782.html#:~:text=Here%2C%20the,reached%2E%E2%80%9D\n\"Here, the testifying staff members utilized their professional experiences and personal observations, as well as Machado's application, site plan, and traffic study, as the basis for their testimony. \u2002 These record materials, along with the staff presentations, combined to provide evidence \u201csufficiently relevant and material that a reasonable mind would accept it as adequate to support the conclusion reached.\u201d",
104
+ "justification": "This rubric item is implied, though not directly requested, in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d The primary argument on appeal is that the court failed to apply the standard of review under Dusseau v. Metro. Dade Cnty. Bd. of Cnty. Comm\u2019rs, 794 So.2d 1270 (Fla. 2001), by ignoring the competent substantial evidence on the record that supported the Board's approval. Identifying the competent substantial evidence on the record supports this argument.",
105
+ "metadata": {
106
+ "review_flag": false,
107
+ "original_name": "states_in_the_second_assignment_that_the_hearing_examiner_s_recommendation_of_ap",
108
+ "original_index": 30,
109
+ "classifier_reason": "Names second assignment",
110
+ "classifier_confidence": "high"
111
+ },
112
+ "score": 5.0,
113
+ "polarity": "positive",
114
+ "raw_weight": 1.0
115
+ },
116
+ {
117
+ "name": "states_in_the_second_assignment_that_the_circuit_court_erred_b_2",
118
+ "description": "States in the second assignment that the circuit court erred by failing to apply the fairly debatable standard of review to the county's legislative decision to construct a water treatment plant on its own property.",
119
+ "source": "Martin County v. Yusem, 690 So. 2d 1288, 1295 (Fla. 1997), is the controlling FL supreme court case on the limited judicial review of local government legislative functions. https://caselaw.findlaw.com/court/fl-supreme-court/1459273.html#:~:text=-,The%20fairly,1996%29%2E\n \"The fairly debatable standard of review is a highly deferential standard requiring approval of a planning action if reasonable persons could differ as to its propriety.\"\nSee also Modlin v. City of Miami Beach, 201 So.2d 70 (Fla. 1967); https://law.justia.com/cases/florida/supreme-court/1967/34865-0.html#:~:text=liability%2E-,The,persons \n\"The distinction between legislative action, on the one hand, and executive and judicial action, on the other, is not difficult to define. It is sufficient for present purposes to say that the former is typically prospective and nondiscriminatory, whereas the latter operate retroactively and discriminatorily. In other words, legislative action prescribes a general rule for future operation, whereas judicial and executive action is typically concerned with applying the general rule to specific situations or persons.\"\nThis is a landmark FL supreme court case defining the separate functions of government.",
120
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d",
121
+ "metadata": {
122
+ "review_flag": false,
123
+ "original_name": "states_in_the_second_assignment_that_the_circuit_court_erred_by_failing_to_apply",
124
+ "original_index": 31,
125
+ "classifier_reason": "Names second assignment",
126
+ "classifier_confidence": "high"
127
+ },
128
+ "score": 10.0,
129
+ "polarity": "positive",
130
+ "raw_weight": 1.0
131
+ },
132
+ {
133
+ "name": "states_in_the_second_assignment_that_the_circuit_court_erred_in",
134
+ "description": "States in the second assignment that the circuit court erred in finding that communications with staff are ex parte communications pursuant to Lee County Fla. Land Development Code \u00a7 2-191 (2025).",
135
+ "source": "Lee County Fla. Land Development Code \u00a7 2-191 (2025); https://library.municode.com/fl/lee_county/codes/land_development_code?nodeId=LADECO_CH2AD_ARTVUNCO_S2-191PRLIUNCO#:~:text=This%20section%20does%20not%20prohibit%20the%20informational%20discussion%20of%20pending%20or%20proposed%20cases%20or%20appeals%20by%20and%20between%20a%20County%20Commissioner%20and%20any%20employee%20of%20the%20Board%20of%20County%20Commissioners%2E\n\"Unauthorized communications with a County Commissioner prohibited. . . . This section does not prohibit the informational discussion of pending or proposed cases or appeals by and between a County Commissioner and any employee of the Board of County Commissioners. \"\nSee also Fla. Stat \u00a7 286.0115(3) (2025); https://www.leg.state.fl.us/Statutes/index.cfm?App_mode=Display_Statute&URL=0200-0299/0286/Sections/0286.0115.html#:~:text=%283%29%E2%80%83This%20section%20does%20not%20restrict%20the%20authority%20of%20any%20board%20or%20commission%20to%20establish%20rules%20or%20procedures%20governing%20public%20hearings%20or%20contacts%20with%20local%20public%20officials\n\"286.0115\u2003Access to local public officials; quasi-judicial proceedings on local government land use matters.\u2014 (3)\u2003This section does not restrict the authority of any board or commission to establish rules or procedures governing public hearings or contacts with local public officials.",
136
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d",
137
+ "metadata": {
138
+ "review_flag": false,
139
+ "original_name": "states_in_the_second_assignment_that_the_circuit_court_erred_in_finding_that_com",
140
+ "original_index": 32,
141
+ "classifier_reason": "Names second assignment",
142
+ "classifier_confidence": "high"
143
+ },
144
+ "score": 20.0,
145
+ "polarity": "positive",
146
+ "raw_weight": 1.0
147
+ },
148
+ {
149
+ "name": "states_in_the_second_assignment_that_the_circuit_court_erred_b_3",
150
+ "description": "States in the second assignment that the circuit court erred by failing to apply the fairly debatable standard of review to the county's legislative decision to enter into the Kingston Settlement to resolve pending litigation.",
151
+ "source": "Martin County v. Yusem, 690 So. 2d 1288, 1295 (Fla. 1997), is the controlling FL supreme court case on the limited judicial review of local government legislative functions. https://caselaw.findlaw.com/court/fl-supreme-court/1459273.html#:~:text=-,The%20fairly,1996%29%2E\n \"The fairly debatable standard of review is a highly deferential standard requiring approval of a planning action if reasonable persons could differ as to its propriety.\"\nSee also Modlin v. City of Miami Beach, 201 So.2d 70 (Fla. 1967); https://law.justia.com/cases/florida/supreme-court/1967/34865-0.html#:~:text=liability%2E-,The,persons \n\"The distinction between legislative action, on the one hand, and executive and judicial action, on the other, is not difficult to define. It is sufficient for present purposes to say that the former is typically prospective and nondiscriminatory, whereas the latter operate retroactively and discriminatorily. In other words, legislative action prescribes a general rule for future operation, whereas judicial and executive action is typically concerned with applying the general rule to specific situations or persons.\"\nThis is a landmark FL supreme court case defining the separate functions of government.\nSee also Williams v. Public Util. Protective League, 178 So. 286 (Fla. 1938); https://hallapproved.com/fl/cases/supreme/1938/3402391/#:~:text=As%20an,inadequate\n\"As an abstract proposition of law, the power of the City to compromise, settle, and compose litigation of any kind to which it is a party is an incident to and implied from its power to sue and be sued. Like the power to legislate and negotiate it will not be restrained from exercising such power by a court of equity on a mere showing of belief, fear, or apprehension that some wrong or injury will be done, or when the injury is conjectural or speculative. Relief under such circumstances will be granted only in cases where the pleadings and the proof show clearly that the resulting injury will be irreparable and the remedy at law inadequate.\"",
152
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d",
153
+ "metadata": {
154
+ "review_flag": false,
155
+ "original_name": "states_in_the_second_assignment_that_the_circuit_court_erred_by_failing_to_apply_2",
156
+ "original_index": 33,
157
+ "classifier_reason": "Names second assignment",
158
+ "classifier_confidence": "high"
159
+ },
160
+ "score": 10.0,
161
+ "polarity": "positive",
162
+ "raw_weight": 1.0
163
+ },
164
+ {
165
+ "name": "states_in_the_second_assignment_that_the_circuit_court_erred_b_4",
166
+ "description": "States in the second assignment that the circuit court erred by finding that Fed. Aviation Admin., Advisory Circular No. 150/5190-7, Minimum Standards for Commercial Aeronautical Activities (Dec. 7, 2023), is incorporated into Lee County Fla. Land Development Code \u00a7 34-1102 (2025).",
167
+ "source": "The circuit court found that the County had failed to comply with Fed. Aviation Admin., Advisory Circular 150/5190-7 Minimum Standards for Commercial Aeronautical Activities (Dec. 7, 2023) requirements for airport compatibility, concluding that the most current and restrictive regulations should have been fully considered. This was legal error. Lee County, Fla. Land Development Code \u00a7 34-1102 (2025) incorporates only Fed. Aviation Admin., Advisory Circular No. 150/5300-13B, Airport Design (2022) and 150/5200-30D Airport Field Condition Assessments and Winter Operations Safety (July 29, 2016), not Fed. Aviation Admin., Advisory CircularNo. 150/5190-7, Minimum Standards for Commercial Aeronautical Activities (Dec. 7, 2023), which the order treats as controlling. Lee County, Fla. Land Development Code \u00a7 34-1102 (2025); https://library.municode.com/fl/lee_county/codes/land_development_code?nodeId=LADECO_CH34ZO_ARTVIDIRE_DIV12AICODI_S34-1102PUIN\n\"The purpose of this division is to establish protections around SWFIA and Page Field in accordance with the provisions of F.S. Chs. 330 and 333, as amended, as well as Federal regulations, as amended, including 14 CFR Parts 77, 150 and 151 and FAA Advisory Circulars 150/5300-13A, as amended, renumbered or replaced, and 150/5200-33B, as amended, renumbered or replaced, which address height obstructions, airport hazards, wildlife attractants, noise, runway protection zones, light emissions, reflectivity and power interference, aircraft overflights, and the public investment in air transportation facilities.\"",
168
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d",
169
+ "metadata": {
170
+ "review_flag": false,
171
+ "original_name": "states_in_the_second_assignment_that_the_circuit_court_erred_by_finding_that_fed",
172
+ "original_index": 34,
173
+ "classifier_reason": "Names second assignment",
174
+ "classifier_confidence": "high"
175
+ },
176
+ "score": 20.0,
177
+ "polarity": "positive",
178
+ "raw_weight": 1.0
179
+ },
180
+ {
181
+ "name": "states_in_the_second_assignment_that_the_circuit_court_erred_i_2",
182
+ "description": "States in the second assignment that the circuit court erred in treating Federal Aviation Authority Advisory Circulars as binding law.",
183
+ "source": "Fed. Aviation Admin., Advisory Circular No. 150/5190-4B, Airport Land Use Compatibility Planning (Sept. 16, 2022) at page 2 confirms that \u201cThis AC does not constitute a regulation, and is not legally binding in its own right\u2026 Conformity with this AC is voluntary, and nonconformity will not affect rights and obligations under existing statutes and regulations,\u201d https://www.faa.gov/documentLibrary/media/Advisory_Circular/150_5190_4b_Land_Use_Compatibility.pdf",
184
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d",
185
+ "metadata": {
186
+ "review_flag": false,
187
+ "original_name": "states_in_the_second_assignment_that_the_circuit_court_erred_in_treating_federal",
188
+ "original_index": 35,
189
+ "classifier_reason": "Names second assignment",
190
+ "classifier_confidence": "high"
191
+ },
192
+ "score": 10.0,
193
+ "polarity": "positive",
194
+ "raw_weight": 1.0
195
+ },
196
+ {
197
+ "name": "states_in_the_second_assignment_that_the_circuit_court_erred_b_5",
198
+ "description": "States in the second assignment that the circuit court erred by purporting to reverse the Board\u2019s rezoning decision.",
199
+ "source": "Florida law is unequivocal that when a circuit court finds error in a local government\u2019s quasi-judicial land use decision, its power is limited to quashing the decision and remanding the matter \u201cas if no order had been entered.\u201d Broward County v. G.B.V. Int\u2019l, Ltd., 787 So. 2d 838, 845 (Fla. 2001) (\u201cWhen a circuit court grants certiorari relief, it quashes the order and leaves the matter pending before the lower tribunal as if no order had been entered.\u201d). https://caselaw.findlaw.com/court/fl-supreme-court/1495364.html#:~:text=When,entered,-%2E\nThe Board's decision is not reversed resulting in a denial, it is quashed resulting in a return to the status quo prior to the decision.",
200
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d",
201
+ "metadata": {
202
+ "review_flag": false,
203
+ "original_name": "states_in_the_second_assignment_that_the_circuit_court_erred_by_purporting_to_re",
204
+ "original_index": 36,
205
+ "classifier_reason": "Names second assignment",
206
+ "classifier_confidence": "high"
207
+ },
208
+ "score": 10.0,
209
+ "polarity": "positive",
210
+ "raw_weight": 1.0
211
+ },
212
+ {
213
+ "name": "states_in_the_second_assignment_that_the_circuit_court_s_erred_b",
214
+ "description": "States in the second assignment that the circuit court's erred by violating the separation of powers under Fla. Const. art. III, \u00a7 3, when it substituted its judgement for that of the Board in exercising its legislative functions.",
215
+ "source": "Fla. Const. art. III, \u00a7 3; https://www.flsenate.gov/laws/constitution#A2S03:~:text=The,herein\n\"The powers of the state government shall be divided into legislative, executive and judicial branches. No person belonging to one branch shall exercise any powers appertaining to either of the other branches unless expressly provided herein\"\nSee also Modlin v. City of Miami Beach, 201 So.2d 70 (Fla. 1967); https://law.justia.com/cases/florida/supreme-court/1967/34865-0.html#:~:text=liability%2E-,The,persons \n\"The distinction between legislative action, on the one hand, and executive and judicial action, on the other, is not difficult to define. It is sufficient for present purposes to say that the former is typically prospective and nondiscriminatory, whereas the latter operate retroactively and discriminatorily. In other words, legislative action prescribes a general rule for future operation, whereas judicial and executive action is typically concerned with applying the general rule to specific situations or persons.\"\nThis is a landmark FL supreme court case defining the separate functions of government.",
216
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d",
217
+ "metadata": {
218
+ "review_flag": false,
219
+ "original_name": "states_in_the_second_assignment_that_the_circuit_court_s_erred_by_violating_the",
220
+ "original_index": 37,
221
+ "classifier_reason": "Names second assignment",
222
+ "classifier_confidence": "high"
223
+ },
224
+ "score": 30.0,
225
+ "polarity": "positive",
226
+ "raw_weight": 1.0
227
+ }
228
+ ],
229
+ "answer_path": "/app/response2.md",
230
+ "answer_relative_path": "response2.md",
231
+ "is_followon": true,
232
+ "prev_answer_path": "/app/response1.md"
233
+ }
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-2/tests/fixtures/rubric.json ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "criteria": [
3
+ {
4
+ "name": "identifies_in_the_second_assignment_that_the_appropriate_mechani",
5
+ "description": "Identifies in the second assignment that the appropriate mechanism to appeal the Order Granting Writ of Certiorari is a Petition for Writ of Certiorari to the 6th District Court of Appeals.",
6
+ "source": "Florida Rule of Appellate Procedure 9.030(b)(2)(B); https://rules.floridaappellate.com/rule-9-030/#:~:text=b%29-,Jurisdiction,capacity\n\"Jurisdiction of District Courts of Appeal.\n\"b) Jurisdiction of District Courts of Appeal.\n. . .\n(2) Certiorari Jurisdiction.8 The certiorari jurisdiction of district courts of appeal may be sought to review:\n(A) nonfinal orders of lower tribunals other than as prescribed by rule 9.130; or\n(B) final orders of circuit courts acting in their review capacity.\"\nSee also Map of Florida\u2019s Court Jurisdictions, available at https://flcourts-media.flcourts.gov/content/download/426177/file/ar-17-18-map-of-floridas-court-jurisdictions.pdf (last accessed Mar. 25, 2026)",
7
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d",
8
+ "metadata": {
9
+ "review_flag": false,
10
+ "original_name": "identifies_in_the_second_assignment_that_the_appropriate_mechanism_to_appeal_the",
11
+ "original_index": 26,
12
+ "classifier_reason": "Names second assignment",
13
+ "classifier_confidence": "high"
14
+ },
15
+ "score": 5.0,
16
+ "polarity": "positive",
17
+ "raw_weight": 1.0
18
+ },
19
+ {
20
+ "name": "states_in_the_second_assignment_that_the_circuit_court_erred_by",
21
+ "description": "States in the second assignment that the circuit court erred by ignoring the competent substantial evidence on the record that supported the approval contrary to Dusseau v. Metro. Dade Cnty. Bd. of Cnty. Comm\u2019rs, 794 So.2d 1270 (Fla. 2001).",
22
+ "source": "Dusseau v. Metro. Dade Cnty. Bd. of Cnty. Comm\u2019rs, 794 So.2d 1270 (Fla. 2001), is the preeminent FL Supreme court case on the limited review of quasi-judicial. \nhttps://caselaw.findlaw.com/court/fl-supreme-court/1489002.html#:~:text=Notably,ended\n\"Notably, when applying the third prong, the court should review the record to determine simply whether the Commission's decision is supported by competent substantial evidence.\n\nWe reiterate that the \u201ccompetent substantial evidence\u201d standard cannot be used by a reviewing court as a mechanism for exerting covert control over the policy determinations and factual findings of the local agency. \u2002 Rather, this standard requires the reviewing court to defer to the agency's superior technical expertise and special vantage point in such matters. \u2002 The issue before the court is not whether the agency's decision is the \u201cbest\u201d decision or the \u201cright\u201d decision or even a \u201cwise\u201d decision, for these are technical and policy-based determinations properly within the purview of the agency. \u2002 The circuit court has no training or experience-and is inherently unsuited-to sit as a roving \u201csuper agency\u201d with plenary oversight in such matters.\n\nThe sole issue before the court on first-tier certiorari review is whether the agency's decision is lawful. \u2002 The court's task vis-a-vis the third prong of Vaillant is simple: \u2009The court must review the record to assess the evidentiary support for the agency's decision. \u2002 Evidence contrary to the agency's decision is outside the scope of the inquiry at this point, for the reviewing court above all cannot reweigh the \u201cpros and cons\u201d of conflicting evidence. \u2002 While contrary evidence may be relevant to the wisdom of the decision, it is irrelevant to the lawfulness of the decision. \u2002 As long as the record contains competent substantial evidence to support the agency's decision, the decision is presumed lawful and the court's job is ended.\"",
23
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d",
24
+ "metadata": {
25
+ "review_flag": false,
26
+ "original_name": "states_in_the_second_assignment_that_the_circuit_court_erred_by_ignoring_the_com",
27
+ "original_index": 27,
28
+ "classifier_reason": "Names second assignment",
29
+ "classifier_confidence": "high"
30
+ },
31
+ "score": 20.0,
32
+ "polarity": "positive",
33
+ "raw_weight": 1.0
34
+ },
35
+ {
36
+ "name": "states_in_the_second_assignment_that_the_staff_report_recommendi",
37
+ "description": "States in the second assignment that the staff report recommending approval is competent substantial evidence that supports the Board's approval of the rezoning.",
38
+ "source": "City of Hialeah Gardens v. Miami-Dade Charter Found., Inc., 857 So.2d 202, 204-5 (Fla. 3d DCA 2003); https://caselaw.findlaw.com/court/fl-district-court-of-appeal/1254782.html#:~:text=Here%2C%20the,reached%2E%E2%80%9D\n\"Here, the testifying staff members utilized their professional experiences and personal observations, as well as Machado's application, site plan, and traffic study, as the basis for their testimony. \u2002 These record materials, along with the staff presentations, combined to provide evidence \u201csufficiently relevant and material that a reasonable mind would accept it as adequate to support the conclusion reached.\u201d",
39
+ "justification": "This rubric item is implied, though not directly requested, in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d The primary argument on appeal is that the court failed to apply the standard of review under Dusseau v. Metro. Dade Cnty. Bd. of Cnty. Comm\u2019rs, 794 So.2d 1270 (Fla. 2001), by ignoring the competent substantial evidence on the record that supported the Board's approval. Identifying the competent substantial evidence on the record supports this argument.",
40
+ "metadata": {
41
+ "review_flag": false,
42
+ "original_name": "states_in_the_second_assignment_that_the_staff_report_recommending_approval_is_c",
43
+ "original_index": 28,
44
+ "classifier_reason": "Names second assignment",
45
+ "classifier_confidence": "high"
46
+ },
47
+ "score": 5.0,
48
+ "polarity": "positive",
49
+ "raw_weight": 1.0
50
+ },
51
+ {
52
+ "name": "states_in_the_second_assignment_that_expert_testimony_on_the_rec",
53
+ "description": "States in the second assignment that expert testimony on the record is competent substantial evidence that supports the Board's approval of the rezoning.",
54
+ "source": "City of Hialeah Gardens v. Miami-Dade Charter Found., Inc., 857 So.2d 202, 204-5 (Fla. 3d DCA 2003); https://caselaw.findlaw.com/court/fl-district-court-of-appeal/1254782.html#:~:text=Here%2C%20the,reached%2E%E2%80%9D\n\"Here, the testifying staff members utilized their professional experiences and personal observations, as well as Machado's application, site plan, and traffic study, as the basis for their testimony. \u2002 These record materials, along with the staff presentations, combined to provide evidence \u201csufficiently relevant and material that a reasonable mind would accept it as adequate to support the conclusion reached.\u201d",
55
+ "justification": "This rubric item is implied, though not directly requested, in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d The primary argument on appeal is that the court failed to apply the standard of review under Dusseau v. Metro. Dade Cnty. Bd. of Cnty. Comm\u2019rs, 794 So.2d 1270 (Fla. 2001), by ignoring the competent substantial evidence on the record that supported the Board's approval. Identifying the competent substantial evidence on the record supports this argument.",
56
+ "metadata": {
57
+ "review_flag": false,
58
+ "original_name": "states_in_the_second_assignment_that_expert_testimony_on_the_record_is_competent",
59
+ "original_index": 29,
60
+ "classifier_reason": "Names second assignment",
61
+ "classifier_confidence": "high"
62
+ },
63
+ "score": 5.0,
64
+ "polarity": "positive",
65
+ "raw_weight": 1.0
66
+ },
67
+ {
68
+ "name": "states_in_the_second_assignment_that_the_hearing_examiner_s_reco",
69
+ "description": "States in the second assignment that the Hearing Examiner's recommendation of approval is competent substantial evidence that supports the Board's approval of the rezoning.",
70
+ "source": "City of Hialeah Gardens v. Miami-Dade Charter Found., Inc., 857 So.2d 202, 204-5 (Fla. 3d DCA 2003); https://caselaw.findlaw.com/court/fl-district-court-of-appeal/1254782.html#:~:text=Here%2C%20the,reached%2E%E2%80%9D\n\"Here, the testifying staff members utilized their professional experiences and personal observations, as well as Machado's application, site plan, and traffic study, as the basis for their testimony. \u2002 These record materials, along with the staff presentations, combined to provide evidence \u201csufficiently relevant and material that a reasonable mind would accept it as adequate to support the conclusion reached.\u201d",
71
+ "justification": "This rubric item is implied, though not directly requested, in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d The primary argument on appeal is that the court failed to apply the standard of review under Dusseau v. Metro. Dade Cnty. Bd. of Cnty. Comm\u2019rs, 794 So.2d 1270 (Fla. 2001), by ignoring the competent substantial evidence on the record that supported the Board's approval. Identifying the competent substantial evidence on the record supports this argument.",
72
+ "metadata": {
73
+ "review_flag": false,
74
+ "original_name": "states_in_the_second_assignment_that_the_hearing_examiner_s_recommendation_of_ap",
75
+ "original_index": 30,
76
+ "classifier_reason": "Names second assignment",
77
+ "classifier_confidence": "high"
78
+ },
79
+ "score": 5.0,
80
+ "polarity": "positive",
81
+ "raw_weight": 1.0
82
+ },
83
+ {
84
+ "name": "states_in_the_second_assignment_that_the_circuit_court_erred_b_2",
85
+ "description": "States in the second assignment that the circuit court erred by failing to apply the fairly debatable standard of review to the county's legislative decision to construct a water treatment plant on its own property.",
86
+ "source": "Martin County v. Yusem, 690 So. 2d 1288, 1295 (Fla. 1997), is the controlling FL supreme court case on the limited judicial review of local government legislative functions. https://caselaw.findlaw.com/court/fl-supreme-court/1459273.html#:~:text=-,The%20fairly,1996%29%2E\n \"The fairly debatable standard of review is a highly deferential standard requiring approval of a planning action if reasonable persons could differ as to its propriety.\"\nSee also Modlin v. City of Miami Beach, 201 So.2d 70 (Fla. 1967); https://law.justia.com/cases/florida/supreme-court/1967/34865-0.html#:~:text=liability%2E-,The,persons \n\"The distinction between legislative action, on the one hand, and executive and judicial action, on the other, is not difficult to define. It is sufficient for present purposes to say that the former is typically prospective and nondiscriminatory, whereas the latter operate retroactively and discriminatorily. In other words, legislative action prescribes a general rule for future operation, whereas judicial and executive action is typically concerned with applying the general rule to specific situations or persons.\"\nThis is a landmark FL supreme court case defining the separate functions of government.",
87
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d",
88
+ "metadata": {
89
+ "review_flag": false,
90
+ "original_name": "states_in_the_second_assignment_that_the_circuit_court_erred_by_failing_to_apply",
91
+ "original_index": 31,
92
+ "classifier_reason": "Names second assignment",
93
+ "classifier_confidence": "high"
94
+ },
95
+ "score": 10.0,
96
+ "polarity": "positive",
97
+ "raw_weight": 1.0
98
+ },
99
+ {
100
+ "name": "states_in_the_second_assignment_that_the_circuit_court_erred_in",
101
+ "description": "States in the second assignment that the circuit court erred in finding that communications with staff are ex parte communications pursuant to Lee County Fla. Land Development Code \u00a7 2-191 (2025).",
102
+ "source": "Lee County Fla. Land Development Code \u00a7 2-191 (2025); https://library.municode.com/fl/lee_county/codes/land_development_code?nodeId=LADECO_CH2AD_ARTVUNCO_S2-191PRLIUNCO#:~:text=This%20section%20does%20not%20prohibit%20the%20informational%20discussion%20of%20pending%20or%20proposed%20cases%20or%20appeals%20by%20and%20between%20a%20County%20Commissioner%20and%20any%20employee%20of%20the%20Board%20of%20County%20Commissioners%2E\n\"Unauthorized communications with a County Commissioner prohibited. . . . This section does not prohibit the informational discussion of pending or proposed cases or appeals by and between a County Commissioner and any employee of the Board of County Commissioners. \"\nSee also Fla. Stat \u00a7 286.0115(3) (2025); https://www.leg.state.fl.us/Statutes/index.cfm?App_mode=Display_Statute&URL=0200-0299/0286/Sections/0286.0115.html#:~:text=%283%29%E2%80%83This%20section%20does%20not%20restrict%20the%20authority%20of%20any%20board%20or%20commission%20to%20establish%20rules%20or%20procedures%20governing%20public%20hearings%20or%20contacts%20with%20local%20public%20officials\n\"286.0115\u2003Access to local public officials; quasi-judicial proceedings on local government land use matters.\u2014 (3)\u2003This section does not restrict the authority of any board or commission to establish rules or procedures governing public hearings or contacts with local public officials.",
103
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d",
104
+ "metadata": {
105
+ "review_flag": false,
106
+ "original_name": "states_in_the_second_assignment_that_the_circuit_court_erred_in_finding_that_com",
107
+ "original_index": 32,
108
+ "classifier_reason": "Names second assignment",
109
+ "classifier_confidence": "high"
110
+ },
111
+ "score": 20.0,
112
+ "polarity": "positive",
113
+ "raw_weight": 1.0
114
+ },
115
+ {
116
+ "name": "states_in_the_second_assignment_that_the_circuit_court_erred_b_3",
117
+ "description": "States in the second assignment that the circuit court erred by failing to apply the fairly debatable standard of review to the county's legislative decision to enter into the Kingston Settlement to resolve pending litigation.",
118
+ "source": "Martin County v. Yusem, 690 So. 2d 1288, 1295 (Fla. 1997), is the controlling FL supreme court case on the limited judicial review of local government legislative functions. https://caselaw.findlaw.com/court/fl-supreme-court/1459273.html#:~:text=-,The%20fairly,1996%29%2E\n \"The fairly debatable standard of review is a highly deferential standard requiring approval of a planning action if reasonable persons could differ as to its propriety.\"\nSee also Modlin v. City of Miami Beach, 201 So.2d 70 (Fla. 1967); https://law.justia.com/cases/florida/supreme-court/1967/34865-0.html#:~:text=liability%2E-,The,persons \n\"The distinction between legislative action, on the one hand, and executive and judicial action, on the other, is not difficult to define. It is sufficient for present purposes to say that the former is typically prospective and nondiscriminatory, whereas the latter operate retroactively and discriminatorily. In other words, legislative action prescribes a general rule for future operation, whereas judicial and executive action is typically concerned with applying the general rule to specific situations or persons.\"\nThis is a landmark FL supreme court case defining the separate functions of government.\nSee also Williams v. Public Util. Protective League, 178 So. 286 (Fla. 1938); https://hallapproved.com/fl/cases/supreme/1938/3402391/#:~:text=As%20an,inadequate\n\"As an abstract proposition of law, the power of the City to compromise, settle, and compose litigation of any kind to which it is a party is an incident to and implied from its power to sue and be sued. Like the power to legislate and negotiate it will not be restrained from exercising such power by a court of equity on a mere showing of belief, fear, or apprehension that some wrong or injury will be done, or when the injury is conjectural or speculative. Relief under such circumstances will be granted only in cases where the pleadings and the proof show clearly that the resulting injury will be irreparable and the remedy at law inadequate.\"",
119
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d",
120
+ "metadata": {
121
+ "review_flag": false,
122
+ "original_name": "states_in_the_second_assignment_that_the_circuit_court_erred_by_failing_to_apply_2",
123
+ "original_index": 33,
124
+ "classifier_reason": "Names second assignment",
125
+ "classifier_confidence": "high"
126
+ },
127
+ "score": 10.0,
128
+ "polarity": "positive",
129
+ "raw_weight": 1.0
130
+ },
131
+ {
132
+ "name": "states_in_the_second_assignment_that_the_circuit_court_erred_b_4",
133
+ "description": "States in the second assignment that the circuit court erred by finding that Fed. Aviation Admin., Advisory Circular No. 150/5190-7, Minimum Standards for Commercial Aeronautical Activities (Dec. 7, 2023), is incorporated into Lee County Fla. Land Development Code \u00a7 34-1102 (2025).",
134
+ "source": "The circuit court found that the County had failed to comply with Fed. Aviation Admin., Advisory Circular 150/5190-7 Minimum Standards for Commercial Aeronautical Activities (Dec. 7, 2023) requirements for airport compatibility, concluding that the most current and restrictive regulations should have been fully considered. This was legal error. Lee County, Fla. Land Development Code \u00a7 34-1102 (2025) incorporates only Fed. Aviation Admin., Advisory Circular No. 150/5300-13B, Airport Design (2022) and 150/5200-30D Airport Field Condition Assessments and Winter Operations Safety (July 29, 2016), not Fed. Aviation Admin., Advisory CircularNo. 150/5190-7, Minimum Standards for Commercial Aeronautical Activities (Dec. 7, 2023), which the order treats as controlling. Lee County, Fla. Land Development Code \u00a7 34-1102 (2025); https://library.municode.com/fl/lee_county/codes/land_development_code?nodeId=LADECO_CH34ZO_ARTVIDIRE_DIV12AICODI_S34-1102PUIN\n\"The purpose of this division is to establish protections around SWFIA and Page Field in accordance with the provisions of F.S. Chs. 330 and 333, as amended, as well as Federal regulations, as amended, including 14 CFR Parts 77, 150 and 151 and FAA Advisory Circulars 150/5300-13A, as amended, renumbered or replaced, and 150/5200-33B, as amended, renumbered or replaced, which address height obstructions, airport hazards, wildlife attractants, noise, runway protection zones, light emissions, reflectivity and power interference, aircraft overflights, and the public investment in air transportation facilities.\"",
135
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d",
136
+ "metadata": {
137
+ "review_flag": false,
138
+ "original_name": "states_in_the_second_assignment_that_the_circuit_court_erred_by_finding_that_fed",
139
+ "original_index": 34,
140
+ "classifier_reason": "Names second assignment",
141
+ "classifier_confidence": "high"
142
+ },
143
+ "score": 20.0,
144
+ "polarity": "positive",
145
+ "raw_weight": 1.0
146
+ },
147
+ {
148
+ "name": "states_in_the_second_assignment_that_the_circuit_court_erred_i_2",
149
+ "description": "States in the second assignment that the circuit court erred in treating Federal Aviation Authority Advisory Circulars as binding law.",
150
+ "source": "Fed. Aviation Admin., Advisory Circular No. 150/5190-4B, Airport Land Use Compatibility Planning (Sept. 16, 2022) at page 2 confirms that \u201cThis AC does not constitute a regulation, and is not legally binding in its own right\u2026 Conformity with this AC is voluntary, and nonconformity will not affect rights and obligations under existing statutes and regulations,\u201d https://www.faa.gov/documentLibrary/media/Advisory_Circular/150_5190_4b_Land_Use_Compatibility.pdf",
151
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d",
152
+ "metadata": {
153
+ "review_flag": false,
154
+ "original_name": "states_in_the_second_assignment_that_the_circuit_court_erred_in_treating_federal",
155
+ "original_index": 35,
156
+ "classifier_reason": "Names second assignment",
157
+ "classifier_confidence": "high"
158
+ },
159
+ "score": 10.0,
160
+ "polarity": "positive",
161
+ "raw_weight": 1.0
162
+ },
163
+ {
164
+ "name": "states_in_the_second_assignment_that_the_circuit_court_erred_b_5",
165
+ "description": "States in the second assignment that the circuit court erred by purporting to reverse the Board\u2019s rezoning decision.",
166
+ "source": "Florida law is unequivocal that when a circuit court finds error in a local government\u2019s quasi-judicial land use decision, its power is limited to quashing the decision and remanding the matter \u201cas if no order had been entered.\u201d Broward County v. G.B.V. Int\u2019l, Ltd., 787 So. 2d 838, 845 (Fla. 2001) (\u201cWhen a circuit court grants certiorari relief, it quashes the order and leaves the matter pending before the lower tribunal as if no order had been entered.\u201d). https://caselaw.findlaw.com/court/fl-supreme-court/1495364.html#:~:text=When,entered,-%2E\nThe Board's decision is not reversed resulting in a denial, it is quashed resulting in a return to the status quo prior to the decision.",
167
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d",
168
+ "metadata": {
169
+ "review_flag": false,
170
+ "original_name": "states_in_the_second_assignment_that_the_circuit_court_erred_by_purporting_to_re",
171
+ "original_index": 36,
172
+ "classifier_reason": "Names second assignment",
173
+ "classifier_confidence": "high"
174
+ },
175
+ "score": 10.0,
176
+ "polarity": "positive",
177
+ "raw_weight": 1.0
178
+ },
179
+ {
180
+ "name": "states_in_the_second_assignment_that_the_circuit_court_s_erred_b",
181
+ "description": "States in the second assignment that the circuit court's erred by violating the separation of powers under Fla. Const. art. III, \u00a7 3, when it substituted its judgement for that of the Board in exercising its legislative functions.",
182
+ "source": "Fla. Const. art. III, \u00a7 3; https://www.flsenate.gov/laws/constitution#A2S03:~:text=The,herein\n\"The powers of the state government shall be divided into legislative, executive and judicial branches. No person belonging to one branch shall exercise any powers appertaining to either of the other branches unless expressly provided herein\"\nSee also Modlin v. City of Miami Beach, 201 So.2d 70 (Fla. 1967); https://law.justia.com/cases/florida/supreme-court/1967/34865-0.html#:~:text=liability%2E-,The,persons \n\"The distinction between legislative action, on the one hand, and executive and judicial action, on the other, is not difficult to define. It is sufficient for present purposes to say that the former is typically prospective and nondiscriminatory, whereas the latter operate retroactively and discriminatorily. In other words, legislative action prescribes a general rule for future operation, whereas judicial and executive action is typically concerned with applying the general rule to specific situations or persons.\"\nThis is a landmark FL supreme court case defining the separate functions of government.",
183
+ "justification": "This rubric item is requested directly in the following portion of the prompt: \u201cDraft a ready-to-file brief requesting second-tier review.\u201d",
184
+ "metadata": {
185
+ "review_flag": false,
186
+ "original_name": "states_in_the_second_assignment_that_the_circuit_court_s_erred_by_violating_the",
187
+ "original_index": 37,
188
+ "classifier_reason": "Names second assignment",
189
+ "classifier_confidence": "high"
190
+ },
191
+ "score": 30.0,
192
+ "polarity": "positive",
193
+ "raw_weight": 1.0
194
+ }
195
+ ]
196
+ }
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-2/tests/m1_judge_panel.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "mode": "panel",
3
+ "max_concurrent_llm": 12,
4
+ "members": [
5
+ {
6
+ "model": "openai/gpt-5.6-terra",
7
+ "reasoning_effort": "medium",
8
+ "timeout": 1500
9
+ },
10
+ {
11
+ "model": "anthropic/claude-sonnet-5",
12
+ "reasoning_effort": "medium",
13
+ "timeout": 1500
14
+ },
15
+ {
16
+ "model": "gemini/gemini-3.8-flash",
17
+ "reasoning_effort": "medium",
18
+ "timeout": 1500
19
+ }
20
+ ]
21
+ }
tasks/lrb-certiorari-quasi-judicial-land-use/steps/assignment-2/tests/m1_rewardkit_accounting.py ADDED
@@ -0,0 +1,490 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio
2
+ import json
3
+ import math
4
+ import os
5
+ from pathlib import Path
6
+ import random
7
+ import sys
8
+ import time
9
+
10
+ class JudgeReceiptError(OSError):
11
+ pass
12
+ _LLM_ROUTES = frozenset({'vertex', 'anthropic fallback', 'aistudio', 'direct'})
13
+ _LLM_ROUTE_HEADERS = ('x-m1-llm-route', 'llm_provider-x-m1-llm-route')
14
+
15
+ def _canonical_llm_route(value):
16
+ return value if isinstance(value, str) and value in _LLM_ROUTES else None
17
+
18
+ def _llm_route_from_headers(headers):
19
+ if not isinstance(headers, dict):
20
+ return None
21
+ folded = {str(key).lower(): value for key, value in headers.items()}
22
+ for name in _LLM_ROUTE_HEADERS:
23
+ route = _canonical_llm_route(folded.get(name))
24
+ if route is not None:
25
+ return route
26
+ return None
27
+
28
+ def _llm_route_from_response(response):
29
+ hidden = getattr(response, '_hidden_params', None)
30
+ headers = hidden.get('additional_headers') if isinstance(hidden, dict) else None
31
+ route = _llm_route_from_headers(headers)
32
+ if route is not None:
33
+ return route
34
+ return _llm_route_from_headers(getattr(response, 'headers', None))
35
+
36
+ def _token_field_status(values, key):
37
+ if not isinstance(values, dict) or key not in values:
38
+ return 'missing'
39
+ value = values[key]
40
+ if value is None:
41
+ return 'null'
42
+ return 'valid' if type(value) is int and value >= 0 else 'invalid'
43
+
44
+ def _gemini_capture(kwargs, model):
45
+ if not model.startswith('gemini/') or kwargs.get('stream') or kwargs.get('tools') or kwargs.get('functions'):
46
+ return (kwargs, None)
47
+ from litellm.integrations.custom_logger import CustomLogger
48
+ from urllib.parse import urlsplit
49
+
50
+ class Capture(CustomLogger):
51
+ evidence = None
52
+ prompt_status = 'not_observed'
53
+ llm_route = None
54
+
55
+ def log_post_api_call(self, kwargs, response_obj, start_time, end_time):
56
+ self.evidence = None
57
+ self.prompt_status = 'not_observed'
58
+ try:
59
+ params = kwargs.get('litellm_params') or {}
60
+ route = urlsplit(params.get('api_base') or '')
61
+ bare = model.removeprefix('gemini/')
62
+ gemini = params.get('custom_llm_provider') == 'gemini'
63
+ ai_studio = gemini and route.hostname == 'generativelanguage.googleapis.com' and (route.path in {'/' + version + '/models/' + bare + ':generateContent' for version in ('v1alpha', 'v1beta')})
64
+ broker = urlsplit(os.environ.get('GEMINI_API_BASE') or '')
65
+ brokered = gemini and bool(broker.netloc) and (route.netloc == broker.netloc) and (broker.path.rstrip('/').rsplit('/', 1)[-1] in ('v1alpha', 'v1beta')) and (route.path == broker.path.rstrip('/') + '/models/' + bare + ':generateContent')
66
+ vertex = params.get('custom_llm_provider') == 'vertex_ai' and route.hostname == 'aiplatform.googleapis.com' and route.path.startswith('/v1/projects/') and route.path.endswith('/locations/global/publishers/google/models/' + bare + ':generateContent')
67
+ if route.scheme != 'https' or not (ai_studio or brokered or vertex) or kwargs.get('stream'):
68
+ return
69
+ self.llm_route = 'vertex' if vertex else 'aistudio' if ai_studio else None
70
+ raw = kwargs.get('original_response')
71
+ raw = json.loads(raw) if isinstance(raw, str) else raw
72
+ if not isinstance(raw, dict):
73
+ return
74
+ candidates = raw.get('candidates')
75
+ if not isinstance(candidates, list) or not candidates or any((not isinstance(c, dict) or not c.get('finishReason') for c in candidates)) or (not isinstance(raw.get('modelVersion'), str)) or (not raw['modelVersion']):
76
+ return
77
+ usage = raw.get('usageMetadata')
78
+ self.prompt_status = _token_field_status(usage, 'promptTokenCount')
79
+ if not isinstance(usage, dict):
80
+ return
81
+ fields = ('promptTokenCount', 'candidatesTokenCount', 'thoughtsTokenCount', 'cachedContentTokenCount', 'totalTokenCount', 'toolUsePromptTokenCount')
82
+ counts = {key: usage.get(key, 0) for key in fields}
83
+ if not {'promptTokenCount', 'totalTokenCount'} <= usage.keys() or any((type(n) is not int or n < 0 for n in counts.values())) or counts['toolUsePromptTokenCount'] != 0 or (counts['cachedContentTokenCount'] > counts['promptTokenCount']) or (counts['totalTokenCount'] != counts['promptTokenCount'] + counts['candidatesTokenCount'] + counts['thoughtsTokenCount']):
84
+ return
85
+ self.evidence = {'protocol': 'gemini-generate-content-' + ('vertex-v1' if vertex else route.path.split('/')[-3]), 'model_version': raw['modelVersion'], 'usage_metadata': {key: usage[key] for key in fields if key in usage}, 'defaulted_fields': [key for key in fields if key not in usage]}
86
+ except (TypeError, ValueError, AttributeError):
87
+ return
88
+ capture = Capture()
89
+ return ({**kwargs, 'callbacks': [*(kwargs.get('callbacks') or []), capture]}, capture)
90
+
91
+ def _record_judge_usage(response, model: str, *, target: Path | None=None, native_usage: dict | None=None, native_prompt_status: str | None=None, llm_route: str | None=None) -> None:
92
+ import fcntl
93
+ from datetime import datetime, timezone
94
+ data = response.model_dump() if hasattr(response, 'model_dump') else response
95
+ usage = data.get('usage') if isinstance(data, dict) else None
96
+ granularity = data.get('usage_granularity') if isinstance(data, dict) else None
97
+ if not isinstance(usage, dict):
98
+ usage = {}
99
+ granularity = 'missing_provider_receipt'
100
+ prompt, completion = (usage.get('prompt_tokens'), usage.get('completion_tokens'))
101
+ native_fresh = usage.get('input_uncached_tokens')
102
+ prompt = prompt if type(prompt) is int and prompt >= 0 else None
103
+ native_fresh = native_fresh if type(native_fresh) is int and native_fresh >= 0 else None
104
+ if type(completion) is not int or completion < 0 or (prompt is None and native_fresh is None):
105
+ completion = completion if type(completion) is int and completion >= 0 else 0
106
+ granularity = granularity or 'invalid_provider_receipt'
107
+ details = usage.get('prompt_tokens_details')
108
+ if details is not None and (not isinstance(details, dict)):
109
+ granularity = 'invalid_provider_receipt'
110
+ details = details if isinstance(details, dict) else {}
111
+ cached = details.get('cached_tokens')
112
+ if native_usage is not None:
113
+ native = native_usage['usage_metadata']
114
+ native_output = native.get('candidatesTokenCount', 0) + native.get('thoughtsTokenCount', 0)
115
+ if prompt == native['promptTokenCount'] and completion == native_output:
116
+ cached = native.get('cachedContentTokenCount', 0)
117
+ else:
118
+ native_usage = None
119
+ written = next((value for value in (usage.get('input_cache_write_tokens'), usage.get('cache_creation_input_tokens'), details.get('cache_creation_tokens'), details.get('cache_write_tokens')) if value is not None), None)
120
+ invalid = any((value is not None and (type(value) is not int or value < 0) for value in (cached, written)))
121
+ cached = cached if type(cached) is int and cached >= 0 else None
122
+ written = written if type(written) is int and written >= 0 else None
123
+ fresh = native_fresh
124
+ if fresh is None and prompt is not None and (cached is not None) and (written is not None):
125
+ fresh = prompt - cached - written
126
+ if fresh is not None and (fresh < 0 or (prompt is not None and cached is not None and (written is not None) and (fresh + cached + written != prompt))):
127
+ invalid, fresh = (True, None)
128
+ provider, _, slug = model.partition('/')
129
+ event: dict = {'type': 'step_finish', 'part': {'providerID': provider if slug else 'openai', 'modelID': slug or model, 'tokens': {'input': fresh, 'output': completion, 'cache': {'read': cached, 'write': written}}}}
130
+ field_status = {'prompt_tokens': _token_field_status(usage, 'prompt_tokens'), 'completion_tokens': _token_field_status(usage, 'completion_tokens'), 'input_uncached_tokens': _token_field_status(usage, 'input_uncached_tokens')}
131
+ field_status['native_prompt_token_count'] = native_prompt_status if native_prompt_status in {'missing', 'null', 'invalid', 'valid', 'not_observed'} else 'unsupported'
132
+ part: dict = event['part']
133
+ part['usage_field_status'] = field_status
134
+ if native_usage is not None:
135
+ event['part']['native_usage'] = native_usage
136
+ event['part']['token_categories_provenance'] = 'explicit_presence_v1'
137
+ if fresh is None and prompt is not None:
138
+ event['part']['prompt_tokens_inclusive'] = prompt
139
+ if invalid or any((value is None for value in (fresh, cached, written))):
140
+ granularity = granularity if granularity not in (None, 'request') else 'invalid_provider_receipt' if invalid else 'incomplete_token_categories'
141
+ if granularity:
142
+ event['part']['usage_granularity'] = granularity
143
+ if provider == 'openrouter':
144
+ cost = usage.get('cost')
145
+ if cost is None:
146
+ hidden = getattr(response, '_hidden_params', None)
147
+ headers = hidden.get('additional_headers') if isinstance(hidden, dict) else None
148
+ if isinstance(headers, dict):
149
+ cost = headers.get('llm_provider-x-litellm-response-cost')
150
+ if isinstance(cost, (int, float)) and (not isinstance(cost, bool)) and math.isfinite(cost) and (cost >= 0):
151
+ event['part']['cost'] = cost
152
+ data = data if isinstance(data, dict) else {}
153
+ if isinstance(data.get('id'), str) and data['id']:
154
+ event['part']['provider_request_id'] = data['id']
155
+ for key in ('service_tier', 'cache_ttl'):
156
+ if data.get(key):
157
+ event['part'][key] = data[key]
158
+ route = _llm_route_from_response(response) or _canonical_llm_route(llm_route)
159
+ if route is not None:
160
+ event['part']['llm_route'] = route
161
+ created = data.get('created')
162
+ stamp = datetime.now(timezone.utc)
163
+ try:
164
+ if isinstance(created, str):
165
+ parsed = datetime.fromisoformat(created.replace('Z', '+00:00'))
166
+ if parsed.tzinfo is not None:
167
+ stamp = parsed
168
+ elif isinstance(created, (int, float)) and (not isinstance(created, bool)) and math.isfinite(created):
169
+ stamp = datetime.fromtimestamp(created, timezone.utc)
170
+ except (ValueError, OverflowError, OSError):
171
+ pass
172
+ pair = json.dumps({'type': 'step_start', 'timestamp': stamp.isoformat()}) + '\n'
173
+ pair += json.dumps(event) + '\n'
174
+ try:
175
+ receipt_path = target or Path(os.environ.get('M1_JUDGE_USAGE_PATH', '/logs/verifier/judge-trajectory.jsonl'))
176
+ receipt_path.parent.mkdir(parents=True, exist_ok=True)
177
+ with receipt_path.open('a') as handle:
178
+ fcntl.flock(handle, fcntl.LOCK_EX)
179
+ handle.write(pair)
180
+ handle.flush()
181
+ os.fsync(handle.fileno())
182
+ except OSError as exc:
183
+ if target is not None:
184
+ raise JudgeReceiptError(f'judge receipt write failed: {exc}') from exc
185
+ print(f'judge accounting: write failed ({type(exc).__name__})', file=sys.stderr)
186
+
187
+ def openrouter_judge_pins() -> dict[str, dict]:
188
+ raw = os.environ.get('M1_OPENROUTER_JUDGE_PROVIDER_PINS', '').strip()
189
+ if not raw:
190
+ return {}
191
+ try:
192
+ pins = json.loads(raw)
193
+ except json.JSONDecodeError:
194
+ print('judge provider pins: invalid JSON in M1_OPENROUTER_JUDGE_PROVIDER_PINS', file=sys.stderr)
195
+ return {}
196
+ return {model: pin for model, pin in pins.items() if isinstance(pin, dict) and pin.get('order')} if isinstance(pins, dict) else {}
197
+
198
+ def apply_judge_provider_pin(kwargs: dict, pins: dict[str, dict]) -> dict:
199
+ model = kwargs.get('model')
200
+ pin = pins.get(model) if isinstance(model, str) else None
201
+ if pin is None:
202
+ return kwargs
203
+ extra_body = dict(kwargs.get('extra_body') or {})
204
+ provider = dict(extra_body.get('provider') or {})
205
+ provider['order'] = list(pin['order'])
206
+ if pin.get('allow_fallbacks') is False:
207
+ provider['allow_fallbacks'] = False
208
+ if pin.get('zdr'):
209
+ provider['zdr'] = True
210
+ extra_body['provider'] = provider
211
+ return {**kwargs, 'extra_body': extra_body}
212
+ _TRANSIENT_ERROR_NAMES = ('RateLimitError', 'ServiceUnavailableError', 'InternalServerError', 'BadGatewayError', 'APIConnectionError')
213
+ _RETRYABLE_STATUS_CODES = frozenset({408, 409, 425, 429, 500, 502, 503, 504})
214
+ _AUTH_ERROR_NAMES = ('AuthenticationError', 'PermissionDeniedError')
215
+ _AUTH_STATUS_CODES = frozenset({401, 403})
216
+ _AUTH_RETRIES = 4
217
+ _DEFAULT_TRANSIENT_RETRIES = 6
218
+ _MAX_TRANSIENT_RETRIES = 20
219
+ _MAX_RETRY_DELAY_SECONDS = 60.0
220
+ _DEFAULT_EMPTY_RESPONSE_RETRIES = 3
221
+ _DEFAULT_RETRY_BUDGET_SECONDS = 900.0
222
+ _MAX_RETRY_BUDGET_SECONDS = 86400.0
223
+
224
+ def transient_retry_limit() -> int:
225
+ raw = os.environ.get('M1_JUDGE_TRANSIENT_RETRIES', '').strip()
226
+ if not raw:
227
+ return _DEFAULT_TRANSIENT_RETRIES
228
+ try:
229
+ return max(0, min(int(raw), _MAX_TRANSIENT_RETRIES))
230
+ except ValueError:
231
+ print('judge retries: invalid M1_JUDGE_TRANSIENT_RETRIES, using the default', file=sys.stderr)
232
+ return _DEFAULT_TRANSIENT_RETRIES
233
+
234
+ def empty_response_retry_limit() -> int:
235
+ raw = os.environ.get('M1_JUDGE_EMPTY_RESPONSE_RETRIES', '').strip()
236
+ if not raw:
237
+ return _DEFAULT_EMPTY_RESPONSE_RETRIES
238
+ try:
239
+ return max(0, min(int(raw), _MAX_TRANSIENT_RETRIES))
240
+ except ValueError:
241
+ print('judge retries: invalid M1_JUDGE_EMPTY_RESPONSE_RETRIES, using the default', file=sys.stderr)
242
+ return _DEFAULT_EMPTY_RESPONSE_RETRIES
243
+
244
+ def retry_budget_seconds() -> float:
245
+ raw = os.environ.get('M1_JUDGE_RETRY_BUDGET_SECONDS', '').strip()
246
+ if not raw:
247
+ return _DEFAULT_RETRY_BUDGET_SECONDS
248
+ try:
249
+ value = float(raw)
250
+ except ValueError:
251
+ value = math.nan
252
+ if not math.isfinite(value) or value < 0:
253
+ print('judge retries: invalid M1_JUDGE_RETRY_BUDGET_SECONDS, using the default', file=sys.stderr)
254
+ return _DEFAULT_RETRY_BUDGET_SECONDS
255
+ return min(value, _MAX_RETRY_BUDGET_SECONDS)
256
+
257
+ def _within_budget(deadline: float, delay: float, model) -> bool:
258
+ remaining = deadline - time.monotonic()
259
+ if delay <= remaining:
260
+ return True
261
+ print(f'judge call retry budget spent: {model} would wait {delay:.1f}s with {max(remaining, 0.0):.1f}s left of M1_JUDGE_RETRY_BUDGET_SECONDS, failing now', file=sys.stderr)
262
+ return False
263
+
264
+ def is_empty_verdict(response) -> bool:
265
+ data = response.model_dump() if hasattr(response, 'model_dump') else response
266
+ if not isinstance(data, dict):
267
+ return False
268
+ choices = data.get('choices')
269
+ if not isinstance(choices, list) or not choices:
270
+ return True
271
+ first = choices[0]
272
+ message = first.get('message') if isinstance(first, dict) else None
273
+ if not isinstance(message, dict):
274
+ return True
275
+ if message.get('tool_calls') or message.get('function_call'):
276
+ return False
277
+ content = message.get('content')
278
+ if isinstance(content, list):
279
+ content = ''.join((part.get('text') or '' for part in content if isinstance(part, dict)))
280
+ return not (isinstance(content, str) and content.strip())
281
+
282
+ def _matches(exc: BaseException, litellm, names: tuple[str, ...], statuses: frozenset[int]) -> bool:
283
+ classes = tuple((cls for cls in (getattr(litellm, name, None) for name in names) if isinstance(cls, type)))
284
+ if classes and isinstance(exc, classes):
285
+ return True
286
+ status = getattr(exc, 'status_code', None)
287
+ return type(status) is int and status in statuses
288
+
289
+ def is_transient_error(exc: BaseException, litellm) -> bool:
290
+ return _matches(exc, litellm, _TRANSIENT_ERROR_NAMES, _RETRYABLE_STATUS_CODES)
291
+
292
+ def is_auth_error(exc: BaseException, litellm) -> bool:
293
+ return _matches(exc, litellm, _AUTH_ERROR_NAMES, _AUTH_STATUS_CODES)
294
+
295
+ def should_retry(exc: BaseException, litellm, attempt: int, limit: int) -> bool:
296
+ if attempt < limit and is_transient_error(exc, litellm):
297
+ return True
298
+ return attempt < min(limit, _AUTH_RETRIES) and is_auth_error(exc, litellm)
299
+
300
+ def _retry_after_seconds(exc: BaseException) -> float | None:
301
+ headers = getattr(exc, 'headers', None)
302
+ if headers is None:
303
+ headers = getattr(getattr(exc, 'response', None), 'headers', None)
304
+ if headers is None:
305
+ return None
306
+ try:
307
+ raw = headers.get('retry-after')
308
+ if raw is None:
309
+ raw = headers.get('Retry-After')
310
+ value = float(raw)
311
+ except (AttributeError, TypeError, ValueError):
312
+ return None
313
+ return value if math.isfinite(value) and value >= 0 else None
314
+
315
+ def retry_delay(exc: BaseException | None, attempt: int) -> float:
316
+ base = min(_MAX_RETRY_DELAY_SECONDS, 2.0 ** (attempt + 1))
317
+ delay = base * (0.5 + random.random())
318
+ retry_after = _retry_after_seconds(exc) if exc is not None else None
319
+ if retry_after is not None:
320
+ delay = max(delay, min(_MAX_RETRY_DELAY_SECONDS, retry_after))
321
+ return delay
322
+
323
+ def _note_retry(model, exc: BaseException, attempt: int, limit: int, delay: float) -> None:
324
+ status = getattr(exc, 'status_code', None)
325
+ print(f"judge call retry {attempt}/{limit}: {model} {type(exc).__name__} status={(status if type(status) is int else 'n/a')}, waiting {delay:.1f}s", file=sys.stderr)
326
+
327
+ def _note_empty(model, response, attempt: int, limit: int, delay: float) -> None:
328
+ data = response.model_dump() if hasattr(response, 'model_dump') else response
329
+ reason = None
330
+ if isinstance(data, dict) and isinstance(data.get('choices'), list) and data['choices']:
331
+ first = data['choices'][0]
332
+ reason = first.get('finish_reason') if isinstance(first, dict) else None
333
+ print(f'judge call retry {attempt}/{limit}: {model} empty verdict (finish_reason={reason}), waiting {delay:.1f}s', file=sys.stderr)
334
+
335
+ def install(litellm, *, synchronous: bool=False) -> None:
336
+ pins = openrouter_judge_pins()
337
+ limit = transient_retry_limit()
338
+ empty_limit = empty_response_retry_limit()
339
+ deadline = time.monotonic() + retry_budget_seconds()
340
+ if synchronous:
341
+ original = litellm.completion
342
+
343
+ def accounted(*args, **kwargs):
344
+ kwargs = apply_judge_provider_pin(kwargs, pins)
345
+ model = kwargs.get('model') or (args[0] if args else 'unknown')
346
+ attempt = empty_attempts = 0
347
+ while True:
348
+ try:
349
+ call_kwargs, capture = _gemini_capture(kwargs, model)
350
+ response = original(*args, **call_kwargs)
351
+ except BaseException as exc:
352
+ delay = retry_delay(exc, attempt) if should_retry(exc, litellm, attempt, limit) else None
353
+ if delay is not None and _within_budget(deadline, delay, model):
354
+ attempt += 1
355
+ _note_retry(model, exc, attempt, limit, delay)
356
+ time.sleep(delay)
357
+ continue
358
+ _record_judge_usage({}, model)
359
+ raise
360
+ _record_judge_usage(response, model, native_usage=capture.evidence if capture else None, native_prompt_status=capture.prompt_status if capture else None, llm_route=capture.llm_route if capture else None)
361
+ if empty_attempts < empty_limit and is_empty_verdict(response):
362
+ delay = retry_delay(None, empty_attempts)
363
+ if _within_budget(deadline, delay, model):
364
+ empty_attempts += 1
365
+ _note_empty(model, response, empty_attempts, empty_limit, delay)
366
+ time.sleep(delay)
367
+ continue
368
+ return response
369
+ litellm.completion = accounted
370
+ return
371
+ original_async = litellm.acompletion
372
+
373
+ async def accounted_async(*args, **kwargs):
374
+ kwargs = apply_judge_provider_pin(kwargs, pins)
375
+ model = kwargs.get('model') or (args[0] if args else 'unknown')
376
+ attempt = empty_attempts = 0
377
+ while True:
378
+ try:
379
+ call_kwargs, capture = _gemini_capture(kwargs, model)
380
+ response = await original_async(*args, **call_kwargs)
381
+ except BaseException as exc:
382
+ delay = retry_delay(exc, attempt) if should_retry(exc, litellm, attempt, limit) else None
383
+ if delay is not None and _within_budget(deadline, delay, model):
384
+ attempt += 1
385
+ _note_retry(model, exc, attempt, limit, delay)
386
+ await asyncio.sleep(delay)
387
+ continue
388
+ _record_judge_usage({}, model)
389
+ raise
390
+ _record_judge_usage(response, model, native_usage=capture.evidence if capture else None, native_prompt_status=capture.prompt_status if capture else None, llm_route=capture.llm_route if capture else None)
391
+ if empty_attempts < empty_limit and is_empty_verdict(response):
392
+ delay = retry_delay(None, empty_attempts)
393
+ if _within_budget(deadline, delay, model):
394
+ empty_attempts += 1
395
+ _note_empty(model, response, empty_attempts, empty_limit, delay)
396
+ await asyncio.sleep(delay)
397
+ continue
398
+ return response
399
+ litellm.acompletion = accounted_async
400
+
401
+ def record_agent_usage(attempt, *, model: str, provider: str) -> None:
402
+ records: dict[str, tuple[str, dict]] = {}
403
+ current_model = model
404
+ for filename in getattr(attempt, 'logs', []):
405
+ try:
406
+ with Path(filename).open() as stream:
407
+ for line in stream:
408
+ try:
409
+ event = json.loads(line)
410
+ except (ValueError, TypeError):
411
+ continue
412
+ if not isinstance(event, dict):
413
+ continue
414
+ message = event.get('message') or {}
415
+ if event.get('type') == 'assistant' and isinstance(message, dict) and isinstance(message.get('usage'), dict):
416
+ raw = message['usage']
417
+ cached, written = (raw.get('cache_read_input_tokens'), raw.get('cache_creation_input_tokens'))
418
+ if all((type(value) is int and value >= 0 for value in (raw.get('input_tokens'), raw.get('output_tokens')))) and all((value is None or (type(value) is int and value >= 0) for value in (cached, written))):
419
+ receipt: dict = {'usage': {'input_uncached_tokens': raw['input_tokens'], 'prompt_tokens': raw['input_tokens'] + cached + written if cached is not None and written is not None else None, 'completion_tokens': raw['output_tokens'], 'prompt_tokens_details': {'cached_tokens': cached, 'cache_creation_tokens': written}}}
420
+ receipt['created'] = event.get('timestamp')
421
+ creation = raw.get('cache_creation') or {}
422
+ hour = creation.get('ephemeral_1h_input_tokens', 0) if isinstance(creation, dict) else 0
423
+ if type(hour) is int and hour > 0:
424
+ if hour == written:
425
+ receipt['cache_ttl'] = '1h'
426
+ else:
427
+ receipt['usage_granularity'] = 'mixed_cache_ttl'
428
+ records[message.get('id') or json.dumps(raw, sort_keys=True)] = (message.get('model') or current_model, receipt)
429
+ payload = event.get('payload') or {}
430
+ if not isinstance(payload, dict):
431
+ continue
432
+ if event.get('type') == 'turn_context' and payload.get('model'):
433
+ current_model = payload['model']
434
+ if event.get('type') == 'event_msg' and payload.get('type') == 'token_count':
435
+ info = payload.get('info') or {}
436
+ raw, total = (info.get('last_token_usage'), info.get('total_token_usage'))
437
+ if isinstance(raw, dict) and isinstance(total, dict) and all((type(raw.get(key)) is int and raw.get(key) >= 0 for key in ('input_tokens', 'output_tokens'))):
438
+ receipt = {'usage': {'prompt_tokens': raw.get('input_tokens'), 'input_uncached_tokens': raw.get('input_uncached_tokens'), 'input_cache_write_tokens': raw.get('input_cache_write_tokens'), 'completion_tokens': raw.get('output_tokens'), 'prompt_tokens_details': {'cached_tokens': raw.get('cached_input_tokens')}}}
439
+ receipt['created'] = event.get('timestamp')
440
+ records[json.dumps(total, sort_keys=True)] = (current_model, receipt)
441
+ except OSError:
442
+ continue
443
+ captured_input = captured_output = 0
444
+ input_complete = True
445
+ for requested, receipt in records.values():
446
+ requested = requested if '/' in requested else f'{provider}/{requested}'
447
+ _record_judge_usage(receipt, requested)
448
+ receipt_input = receipt['usage'].get('prompt_tokens')
449
+ if receipt_input is None:
450
+ input_complete = False
451
+ else:
452
+ captured_input += receipt_input
453
+ captured_output += receipt['usage'].get('completion_tokens') or 0
454
+ total = getattr(attempt, 'usage', {}) or {}
455
+ if not records or (input_complete and total.get('input_tokens') != captured_input) or total.get('output_tokens') != captured_output:
456
+ _record_judge_usage({'usage': {'prompt_tokens': 0, 'completion_tokens': 0}, 'usage_granularity': 'incomplete_agent_receipts'}, model if '/' in model else f'{provider}/{model}')
457
+
458
+ def install_rewardkit_agents() -> None:
459
+ import rewardkit.judges as judges
460
+ original = judges.get_agent
461
+
462
+ def get_accounted_agent(judge, cwd=None):
463
+ backend = original(judge, cwd)
464
+ run = backend.run
465
+
466
+ async def accounted_run(*args, **kwargs):
467
+ attempt = await run(*args, **kwargs)
468
+ record_agent_usage(attempt, model=judge.model or 'unknown', provider='anthropic' if judge.agent == 'claude-code' else 'openai')
469
+ return attempt
470
+ setattr(backend, 'run', accounted_run)
471
+ return backend
472
+ setattr(judges, 'get_agent', get_accounted_agent)
473
+ if __name__ == '__main__':
474
+ import litellm
475
+ if len(sys.argv) > 2 and sys.argv[1] == '--script':
476
+ import runpy
477
+ install(litellm, synchronous=True)
478
+ sys.argv = sys.argv[2:]
479
+ runpy.run_path(sys.argv[0], run_name='__main__')
480
+ else:
481
+ install(litellm)
482
+ install_rewardkit_agents()
483
+ if Path(__file__).with_name('m1_judge_panel.json').is_file():
484
+ from m1_rewardkit_panel import install_panel
485
+ install_panel(Path(__file__).with_name('m1_judge_panel.json'))
486
+ if Path(__file__).with_name('m1_judge_jev.json').is_file():
487
+ from m1_rewardkit_jev import install_jev
488
+ install_jev(Path(__file__).with_name('m1_judge_jev.json'))
489
+ from rewardkit.__main__ import main
490
+ main()