Tasks: ocrmd as a plug-in¶
Each task references
FR-*/NFR-*/AC-*IDs from spec.md. CI'sspec_validator.pyenforces that every requirement is referenced by at least one task.
Conventions¶
- Status:
[ ]todo /[~]in-progress /[x]done. - Owner: GitHub handle or
@copilot/@agent:<role>. - Each task lists exact files to touch and how to verify.
T-001 — The shared envelope, descriptor and embedded-scanner module¶
- Refs: FR-9, FR-11, NFR-SEC-1, NFR-AUDIT-1, AC-6, AC-8
- Owner: @agent:claude-code
- Status:
[x] - Files:
backend/law_ai/ingestionapp/services/ocrmd_plugin.py(new) - Steps:
Provenance/DocumentMeta/Envelope(extra ignored,textnon-empty),is_envelope,option/descriptor;enabled/installed/version/root/status;library()→ocrmd.api.Library(root, provider=None)orOcrmdUnavailable;scan_file→ envelopes with blank image/page URLs andstore_root, anocrmd_scanprovenance event. - Verify:
backend/tests/ingestion/test_ocrmd_plugin.py::TestEnvelopeModel,::TestStatus,::TestScanFile;mypy --strictclean.
T-002 — The LSAT door speaks the contract¶
- Refs: FR-1, FR-2, FR-3, NFR-HITL-1, AC-1, AC-2, AC-3
- Owner: @agent:claude-code
- Status:
[x] - Files:
backend/law_ai/lsat/services/ocr_intake.py,backend/law_ai/lsat/urls.py - Steps:
INTAKE_DESCRIPTOR;IngestScanRequest._accept_envelope(before) and_only_keyed_sections(after);ScanProvenancegainstool_version/unresolved/page_url/document_title;_summarisefillssummary/items/warnings;ScanIntakeView.get. - Verify:
backend/tests/lsat/test_ocr_intake_envelope.py; the extractor tests still pass.
T-003 — The matter door¶
- Refs: FR-4, FR-5, FR-6, NFR-AUDIT-1, AC-4, AC-5
- Owner: @agent:claude-code
- Status:
[x] - Files:
backend/law_ai/matters/services/scanned.py(new),backend/law_ai/matters/urls.py - Steps:
matter_descriptor,find_filed(page id + bbox),file_page(adocumentartifact,source="ocrmd", two provenance events),delivery(summary/items/warnings/artifact/created);MatterOcrmdIntakeViewon<slug>/intake/ocrmd. - Verify:
backend/tests/matters/test_ocrmd_intake.py;test_matters_api.pyunchanged and green.
T-004 — The upload door and the management command¶
- Refs: FR-9, FR-10, FR-11, NFR-PERF-1, NFR-SEC-1, AC-6, AC-7
- Owner: @agent:claude-code
- Status:
[x] - Files:
backend/law_ai/ingestionapp/urls.py,backend/law_ai/ingestionapp/management/commands/ocrmd_scan.py(new) - Steps:
OcrmdStatusView,OcrmdScanView(multipart;_plugin_gate,_parse_scan_request,_owned_matter,_route_page,_page_row); the command with--target/--user/--options/--json. - Verify:
backend/tests/ingestion/test_ocrmd_plugin.py::TestScanRoute,::TestCommand.
T-005 — Settings, packaging, the opt-in build¶
- Refs: FR-7, FR-8, NFR-SEC-1
- Owner: @agent:claude-code
- Status:
[x] - Files:
backend/law_ai/settings/base.py,.env.example,backend/pyproject.toml,backend/Dockerfile,docker-compose.yml - Steps: three settings declared and bound; the
ocrmdextra with licences noted;ARG INSTALL_OCRMD=0and a conditional layer adding libGL/glib and the extra; compose passes the arg tobackendandworker;ocrmd.*in the mypy ignore list. - Verify:
docker compose config --quiet; the default build is unchanged;INSTALL_OCRMD=1 docker compose build backendinstalls the extra (follow-up BL-20260907-25 exercises it with a real engine).
T-006 — Docs, gates, backlog¶
- Refs: NFR-DOCS-1, AC-9
- Owner: @agent:claude-code
- Status:
[x] - Files:
docs/data-sources.md,docs/architecture.md,CLAUDE.md,BACKLOG.md - Steps: the scanned-books row and section; the plug-in in the component table and its own subsection; the CLAUDE.md paragraph; follow-ups mirrored.
- Verify:
make lint-specs;make lint,make typecheck,make test-backendgreen.
Done-When (Definition of Done)¶
- All tasks
[x]. - All
AC-*fromspec.mdcovered by passing tests. make lint && make testgreen.- LegalBench delta recorded in PR description (n/a — no reasoning change).
- Provenance logging verified manually for new agent paths (no new agent; three event types added).
## Follow-ups Discoveredsection below populated.
Follow-ups Discovered¶
Append-only. Mirror each item into BACKLOG.md with a
BL-YYYYMMDD-NNid.
- BL-20260907-21 — feature, med — An image path through
law_ai.core.llm(LLMRequest.imagesacross the four transports), so ocrmd's vision cross-check can run inside Law AI through the §4 choke point instead of OCR-only. - BL-20260907-22 — feature, med — A frontend for the plug-in: an upload panel (
POST /api/ingestion/ocrmd/scan) on the LSAT Lab authoring tab and on a matter's documents, and a "scanned page" view that shows the scanner's provenance and caveats. - BL-20260907-23 — feature, low — A
:SourceDocumentnode (orPendingReviewkindscanned_page) so a scanned source can be cited from an analysis with graph-level provenance; needs its own spec, a licence posture per source, and HITL. - BL-20260907-24 — infra, low — Pin the
ocrmdextra to a release tag once ocrmd publishes one (or to PyPI), and consider installing it in the default image if the opencv system libraries are acceptable there. - BL-20260907-25 — test-gap, med — An
integration-marked test that runsscan_fileagainst a real RapidOCR engine in anINSTALL_OCRMD=1image, nightly, so the embedded path is exercised end to end. - BL-20260907-26 — doc-gap, low — Regenerate
frontend/__tests__/fixtures/api-schema.jsonwithIngestScanRequest/IngestScanResultand the ocrmdEnvelopeonce the frontend consumes them (make manage CMD=export_api_schema).