How l0cka/caselaw-guard works
CaseLaw Guard extracts case-law citations from text, routes each citation to a configured legal-source adapter, and returns a fail-closed verification report through the CLI, REST API, or MCP server. Its Australian path supports offline lookups from a provenance-bearing local index, plus building, fetching, inspecting, and migrating indexes. CourtListener provides the U.S. lookup integration and optional result cache. Relationships among sampled modules are cited to source; documented entry points and index-fetch behavior are cited to the README. Other unsampled wiring is omitted.
Main entry points: verifier.py Verification orchestration · index_builder.py Index builder and migration · index_store.py Local index store · cli.py CLI
Components 23
User interfaces
- CLI
src/caselaw_guard/cli.py - REST API
src/caselaw_guard/api.py - MCP server
src/caselaw_guard/mcp_server.py
Verification core
- Citation extraction
src/caselaw_guard/extractors.py - Verification orchestration
src/caselaw_guard/verifier.py - Result contracts
src/caselaw_guard/models.py
Australian index
- Australian lookup service
src/caselaw_guard/australia/service.py - Citation normalization
src/caselaw_guard/australia/normalization.py - Court metadata
src/caselaw_guard/australia/courts.py - Local index store
src/caselaw_guard/australia/index_store.py - Index contracts
src/caselaw_guard/australia/models.py - Index builder and migration
src/caselaw_guard/australia/index_builder.py - Index fetcher
src/caselaw_guard/australia/index_fetcher.py
Lookup providers
- Adapter contract
src/caselaw_guard/adapters/base.py - Adapter configuration
src/caselaw_guard/adapters/__init__.py - CourtListener adapter
src/caselaw_guard/adapters/courtlistener.py - Australian adapter
src/caselaw_guard/adapters/australia.py
Other components
- Draft author or agent
- CourtListener service
- Open Australian Legal Corpus
- Versioned index release assets
- Local Australian index file
- Verification report
Connections 35
- Draft author or agent → CLI: submits text
README.md - Draft author or agent → REST API: posts text
README.md - Draft author or agent → MCP server: sends text
README.md - CLI → Verification orchestration: verifies text
src/caselaw_guard/cli.py - REST API → Verification orchestration: verifies text
src/caselaw_guard/api.py - MCP server → Verification orchestration: verifies text
src/caselaw_guard/mcp_server.py - Verification orchestration → Citation extraction: extracts citations
src/caselaw_guard/verifier.py - Verification orchestration → Adapter configuration: builds adapters
src/caselaw_guard/verifier.py - Verification orchestration → Adapter contract: dispatches lookup
src/caselaw_guard/verifier.py - Verification orchestration → Result contracts: returns report
src/caselaw_guard/verifier.py - Citation extraction → Result contracts: creates matches
src/caselaw_guard/extractors.py - Adapter configuration → CourtListener adapter: configures
src/caselaw_guard/adapters/__init__.py - Adapter configuration → Australian adapter: configures
src/caselaw_guard/adapters/__init__.py - CourtListener adapter → CourtListener service: queries
src/caselaw_guard/adapters/courtlistener.py - CourtListener adapter → Result contracts: maps results
src/caselaw_guard/adapters/courtlistener.py - Australian adapter → Australian lookup service: looks up citation
src/caselaw_guard/adapters/australia.py - Australian adapter → Result contracts: maps results
src/caselaw_guard/adapters/australia.py - Australian lookup service → Citation normalization: normalizes citation
src/caselaw_guard/australia/service.py - Australian lookup service → Local index store: queries index
src/caselaw_guard/australia/service.py - Local index store → Index contracts: validates entries
src/caselaw_guard/australia/index_store.py - Local index store → Citation normalization: normalizes legacy keys
src/caselaw_guard/australia/index_store.py - Local index store → Court metadata: resolves court codes
src/caselaw_guard/australia/index_store.py - Index builder and migration → Open Australian Legal Corpus: reads JSONL
src/caselaw_guard/australia/index_builder.py - Index builder and migration → Citation normalization: normalizes citations
src/caselaw_guard/australia/index_builder.py - Index builder and migration → Court metadata: resolves courts
src/caselaw_guard/australia/index_builder.py - Index builder and migration → Index contracts: creates index
src/caselaw_guard/australia/index_builder.py - Index builder and migration → Local index store: loads for migration
src/caselaw_guard/australia/index_builder.py - Index builder and migration → Local Australian index file: writes index
src/caselaw_guard/australia/index_builder.py - CLI → Index builder and migration: builds or migrates
src/caselaw_guard/cli.py - CLI → Local index store: inspects index
src/caselaw_guard/cli.py - CLI → Index fetcher: fetches release
src/caselaw_guard/cli.py - Index fetcher → Versioned index release assets: downloads assets
README.md - Index fetcher → Local Australian index file: replaces atomically
README.md - Australian lookup service → Verification report: returns lookup result
README.md - Verification orchestration → Verification report: returns JSON
README.md