jetbriefcheck
CLAUDE.md2 starsChanged 4 months agoMITView on GitHub
Checks appellate brief PDFs for compliance with North Dakota Rules of Appellate Procedure. Analyzes formatting (margins, fonts, spacing, page limits) and semantic content (required sections). Produces HTML compliance reports with recommendations: Accept, Correction Letter, or Reject. Runs as a Claude skill (Claude Code and Cowork) under the user's subscription; there is no API-key path and no web app. - Python 3.9+, PyMuPDF >= 1.24.0 - Measurement pitfalls (see README "Known measurement pitfalls" for detail): - FMT-006 font size — splits…
- Installs packages
In this repositoryOne other file it gives its agents.
- jetbriefcheckSkill
The file
We split this CLAUDE.md into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 95
Never trigger on invisible render mode by itself: Every OCR'd scan carries a full render-mode-3 layer over the page image, and that text …
- Very specific: line 119
Test data in test-data/ (gitignored.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
Checks appellate brief PDFs for compliance with North Dakota Rules of Appellate Procedure. Analyzes formatting (margins, fonts, spacing, page limits) and semantic content (required sections). Produces HTML compliance reports with recommendations: Accept, Correction Letter, or Reject. Runs as a Claude skill (Claude Code and Cowork) under the user's subscription; there is no API-key path and no web app.
Commands
# Setup (skill/requirements.txt is PyMuPDF only; tests also need pytest)
uv venv && uv pip install -r skill/requirements.txt pytest
source .venv/bin/activate
# Deploy as Claude Code skill
python deploy_skill.py
# Run tests (also checks the vendored check_model.py for drift)
make test
# Confirm bundled rules are current against ndcourts.gov (bypasses the 90-day cache)
python3 skill/scripts/check_rule_freshness.pyArchitecture
skill/— Deployable skill content (symlinked to~/.claude/skills/jetbriefcheck/):SKILL.md— Claude Code skill workflow definitioncore/— Analysis engine:pdf_extract.py— Extract text/images, measure formatting via PyMuPDFhidden_text.py— Concealed-content scan (text a machine reads that a person cannot see)brief_classifier.py— Detect brief type (appellant, appellee, reply, cross-appeal, amicus, amicus on rehearing, petition for rehearing; writ petitions have no type and classify UNKNOWN)checks_mechanical.py— Paper size, margins, fonts, spacing, page limitssemantic_definitions.py— Inventory of the semantic checks Claude evaluates (pure data)report_builder.py— Generate HTML compliance reportmodels.py— Data structures for checks and resultsrecommender.py— Accept/Correction Letter/Reject by hard rules; names undetermined checks in the reasoning
scripts/— CLI entry points for skill pipelinereferences/rules/— Bundled rule text: N.D.R.App.P. 14, 21, 28, 29, 30, 32, 34, 40; N.D.R.Ct. 3.4, 11.6
Key Details
- Python 3.9+, PyMuPDF >= 1.24.0
- Measurement pitfalls (see README "Known measurement pitfalls" for detail):
- FMT-006 font size — splits document-wide undersize (predominant size itself below 12pt) from scattered spans; leading/font ratio rules out page scaling but cannot prove it (see
_explain_document_wide_undersize). Headers/footers/superscripts/small caps are categorized and downgraded already - FMT-009 line spacing — measured across split blocks since v1.6.0; failures are usually real. Reports measurement coverage, and returns undetermined below
MIN_SPACING_COVERAGE_PCT(50%) instead of the old "assumed compliant". Also counts single-spaced runs (_find_single_spaced_runs) and reports them without scoring — Rule 32(a)(5) permits single-spaced headings and quotations, so a run is evidence, not a finding; never wire these into the verdict - FMT-005 / FMT-011 / FMT-012 — share one page-number footer recognizer (
_page_number_valueinpdf_extract.py), but two zones:_MARGIN_FOOTER_ZONE(0.90) for what may sit inside the bottom margin,_PAGE_NUMBER_ZONE(0.85) for what counts as numbering. FMT-011/012 report undetermined (applicable=False, so it cannot drive the recommendation) when the footer holds an image or unreadable text — never "unnumbered"
- FMT-006 font size — splits document-wide undersize (predominant size itself below 12pt) from scattered spans; leading/font ratio rules out page scaling but cannot prove it (see
- Semantic checks run in the session, never through the API. SKILL.md has Claude evaluate
the checks directly and write
<stem>-semantic.json;build_report.pymerges it with the intermediate JSON fromcheck_brief.py. The Flask web app, the Anthropic-API semantic path (checks_semantic.py), and the model "weighting" pass in the recommender were removed in 2.8.0 so the check guidance lives in one place (SKILL.md / check-definitions.md) and nothing needs an API key. Do not reintroduce ananthropicimport:skill/requirements.txtis PyMuPDF only, andtest_skill_path_reconciliation.pyguards it. For batch or unattended runs, drive the skill headlessly withclaude -prather than adding an API client. - The recommendation is hard rules only (
core/recommender.py, used bybuild_report.py): same findings, same result. Undetermined checks never drive it, but are named in the reasoning. - COV-001 (cover color) is structurally undeterminable — Rule 32(a)(2) governs the physical cover, which a PDF does not record. It reports undetermined on every brief and must never be marked passed; the message still names the required color so the manual check is actionable.
- FMT-010 (footnote spacing) is retired, not missing. Rule 32(a)(5) imposes no requirement on footnotes
distinct from the body — footnotes are part of "the text" — so FMT-006/008/009 measuring all text cover it.
See "Retired Check IDs" in
check-definitions.md; do not reassign the id. - On both paths, a check that was not evaluated is reported undetermined
(
applicable=False), never passed — omitted from the semantic JSON on the skill path, or unparseable/absent from the API response on the other. Never reintroduce apassed=Truefallback for unevaluated checks; the "Passed Checks" list must not contain fiction. - Brief-type classification (
brief_classifier.py): a cover names the trial-court role first and the appellate role last, so a compound designation resolves on its trailing role (_designation_role); "respondent - appellant" is an appellant brief. The "brief of X" window takes no closing delimiter —_normalizecollapses newlines, so requiring one silently failed on plain "BRIEF OF APPELLANT".UNKNOWNis a real outcome, not a bug: the caption names both parties, so with no title line the classifier declines rather than guessing. When the type is UNKNOWN the 16 type-gated semantic checks plus PG-001/REC-001 report not determined, never "not applicable" — usegated_check_result(semantic_definitions.py), which both execution paths share. - Citation grounding (
core/citations.py, SKILL.md Phase 2C): verification is ndlawcheck_draftwithchecks=["citations","quotations"]— it carries jetcite and the corpus, so do not rebuild extraction or per-citation verification here; an earlier version did and missed findings check_draft catches. This module only does what check_draft cannot know it needs:clean_draft_text(page numbers extraction leaves inside quotations → false misquotation flags),name_drift_is_real(ndlaw captions carry bookkeeping like "(Confidential)" / "(cross-reference w/…)"; comparing raw scores a correct "Lucas v. Lucas" at 0.491), and paragraph attribution. Scope is existence + identity + quotation only. Advisory — aCitationReviewonComplianceReport, neverCheckResults, loaded after the recommendation is fixed. When ndlaw is absent, write"ndlaw_available": false, never skip the file. - Concealed text (
core/hidden_text.py, SKILL.md Phase 1): scans for text a machine reads that a reader of the page cannot see. Visibility is the trigger; structural signals only explain a finding. Two independent tests, and both are needed — a glyph test (WCAG contrast of the span's colour against the region's modal background, plus opacity) and a region test (does any ink appear in the span's bbox at all). Region-ink alone misses a white payload laid over live body text, because the neighbouring words supply the ink; colour alone misses black text covered by a white rectangle. Independent triggers: type belowMIN_LEGIBLE_PT, and off-page placement.- Never trigger on invisible render mode by itself. Every OCR'd scan carries a full
render-mode-3 layer over the page image, and that text is visible. Three briefs in
test-data/ are such scans; triggering on the mode flagged 100% of their spans (21,867 in one).
A page whose spans are
OCR_LAYER_PAGE_FRACTIONrender-mode-3 is an OCR layer: reported as context, and the sub-legible trigger is suppressed there because OCR assigns nonsense point sizes to specks. - Calibrated over test-data/'s 23 filed briefs (50,735 spans): 22 report nothing; the 23rd is a
misassembled scan, flagged
text_layer_unreliablewith its findings kept — suppressing them is precisely what an attacker would engineer.measurement_bboxexcludes whitespace and pads for glyphs that paint outside their box (an underscore does, and unpadded every signature line read as concealed). Findings must clear bothMIN_CONCEALED_CHARSandMIN_CONCEALED_ALNUMafter adjacent runs are merged, so a payload split per character to duck the floor still reaches it. - Advisory, like
CitationReview— aHiddenTextReviewonComplianceReport, neverCheckResults, loaded inbuild_report.pyafter the recommendation is fixed. Concealed text violates no rule this checker enforces; court staff assess it. Renders above the compliance findings when found, as a one-line statement of coverage when not. A scan that ran and found nothing and a scan that never ran say different things —HiddenTextReview.unavailable()keeps them distinct, and fallback mode (no PyMuPDF) is the latter. - Payload routing is deliberate. Full text goes only to
<stem>-hiddentext.jsonand the HTML report, both read by people. The intermediate JSON — read by the model writing the analysis — getssummary_dict(): locations, counts, digests, no text. Concealed passages and sub-legible type are also stripped fromfull_textbyredact_concealedbefore any pass reads it, so the analysis sees the document a person sees. Never widen what reaches the model.
- Never trigger on invisible render mode by itself. Every OCR'd scan carries a full
render-mode-3 layer over the page image, and that text is visible. Three briefs in
test-data/ are such scans; triggering on the mode flagged 100% of their spans (21,867 in one).
A page whose spans are
- Test data in
test-data/(gitignored; 23 filed briefs, 2 synthetic hidden-text fixtures, and generated reports and JSON). Several tests read it;check_brief.pywrites its JSON next to the PDF unless given--output-dir, so point that elsewhere to keep the stored JSON intact - Distribution: primarily a plugin via the jet-hub marketplace, which pins to the latest published GitHub
release — pushing
mainships nothing;make releasetags, publishes, and verifies the zips. The standalone skill zip anddeploy_skill.py(copiesskill/to~/.claude/skills/jetbriefcheck/) remain supported. - Rule amendments touch more than the rule file: the inline copy in
SKILL.md, the check guidance, the effective dates and hashes, and the version. README "Rule Freshness Checking" has the checklist.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

