MARK GARASLEGAL AI & SOFTWARE

Legal ↔ Technical / Architecture map

Clinical Counsel Workroom

See how a synthetic hospital legal task becomes a result, a review record and a verified download.

Workflow SVG ↓Project case study ↗

Current workflow review / 31 October 2026

All 963 engine and viewer tests passed on 31 October 2026. A fresh synthetic counsel-selection run ranked two eligible firms, excluded two, and kept an unchecked conflict visible. Its simulated review decision was bound to the result; the suite also covers missing and altered export artifacts.

Read the updated case study ↗Current verification record ↓
The map below describes its original snapshot. The note above covers later fixes and checks; older results below still belong to the earlier version.

01 / Workflow

How the work moves through the system.

Read from left to right. Open a step to see why it matters, how it works, and where to find the code.

Process or decisionEvidence or data exchange

01Documents & context

implemented

Supply a closed demo case

The developer chooses public snapshots and synthetic case records. The module validates the allowed fields so unknown or incomplete input cannot silently become a legal fact.

Legal ↔ Technical
Legal purpose

Unknown facts remain explicit.

How it works

JSON schemas, field allowlists and provenance references.

  • src/legal_kernel/jsonschema.py:32_type_ok
  • src/legal_kernel/facts.py:16read_fact
implemented

Load the versioned policy pack

The shared kernel checks the selected demonstration rule pack’s status, dates and source hashes. Expired, revoked or inconsistent instructions cannot quietly govern the run.

Legal ↔ Technical
Legal purpose

A demonstration policy is not institutional authority.

How it works

Source manifests, lifecycle validation and integrity hashes.

  • src/legal_kernel/sourcepack.py:85load_manifest
  • src/legal_kernel/rulepack.py:31verify_pack_lifecycle

02Application & processing

implemented

Run the bounded module

One of nine terminal modules applies deterministic rules to rank, screen or classify the record. Refusals stay in the result so a reviewer can see what remains unresolved.

Legal ↔ Technical
Legal purpose

Ranking and documentation status are advisory outputs.

How it works

Domain engines use shared validation, provenance and hashing primitives.

  • src/uf_counsel_ranker/engine.py:58evaluate
  • src/legal_disclosure_gate/engine.py:65evaluate
  • src/legal_reg_screen/engine.py:123evaluate
implemented

Fix the run artifacts

The engine saves an immutable result, readable reports and a source/output manifest. A later reviewer can inspect the same result.

Legal ↔ Technical
Legal purpose

A fixed record preserves the scope of the check.

How it works

Canonical result hash, manifest and append-only hash-chained audit.

  • src/uf_counsel_ranker/engine.py:154"output_hashes"
  • src/legal_kernel/runrecord.py:27verify_run

03Review & decisions

implemented

Inspect the work queue

The local viewer reads files written by the engine. It shows their status, origins and reports, with evidence behind each flag.

Legal ↔ Technical
Legal purpose

Presentation does not create or infer a substantive result.

How it works

Artifact APIs and gate/register/ranked renderers.

  • frontend/serve.py:116scan_runs
  • frontend/assets/module.js:178loadRun
implemented

Record the human review

The permitted command bridge sends the reviewer’s chosen action to the module. The module rechecks the run and links the review receipt to the exact result hash.

Legal ↔ Technical
Legal purpose

A demo role label does not establish real identity or institutional authorization.

How it works

Existing CLI review/verify operations, shell-free subprocess and hash-bound receipts.

  • frontend/serve.py:528_handle_api_cli
  • src/legal_kernel/audit.py:103apply_review

04Records & handoff

implemented

Download a verified review bundle

The module must verify that the required files are unchanged before download. The bundle includes the result, reports, receipts and an index of file hashes.

Legal ↔ Technical
Legal purpose

Retention of review evidence is distinct from permission to act.

How it works

Bounded snapshot comparison, CLI verification and deterministic ZIP.

  • frontend/serve.py:456_handle_review_bundle
  • frontend/assets/review.js:87bundleLink.textContent
implemented

Make the real decision elsewhere

A qualified person must decide and carry out any real engagement, disclosure, hold, payment or notice outside this demonstration.

Legal ↔ Technical
Legal purpose

No engine or viewer path performs an external legal action.

How it works

No external-action connector; DEMO_ONLY boundaries stay visible.

  • README.md:3It never sends notices
  • frontend/assets/run-view.js:49buildBoundaryNotice
Read the connections as a list
  • Supply a closed demo case → Load the versioned policy packChoose demo scope
  • Load the versioned policy pack ⇢ Run the bounded modulePinned policy and sources
  • Run the bounded module → Fix the run artifactsWrite represented result
  • Fix the run artifacts ⇢ Inspect the work queueResult, manifest and audit
  • Inspect the work queue → Record the human reviewInspect and review
  • Record the human review ⇢ Download a verified review bundleAppend bound receipt
  • Download a verified review bundle → Make the real decision elsewhereHuman decision outside tool

02 / Implementation traces

Follow an action into the code.

8 grouped traces. The model and retrieval entries show which integrations run, which use local rules, and which are only configured.

implemented

Outside counsel ranked view and CLI

Compare eligible synthetic firms while retaining unknown engagement authority.

Interface / command
frontend/assets/ranked.js; uf_counsel_ranker/cli.py:build_parser
Call
local evaluate|review|verify|report; GET /api/run
Service / backend
uf_counsel_ranker/engine.py:evaluate; gates.py; scoring.py; tiebreak.py
Rules & validation
Load closed matter/firm inputs, enforce eligibility and policy gates, use Decimal scoring and traced tie-breaking; unknown mandatory facts refuse ranking.
Model / provider
none
Prompt
none
Retrieval / sources
none
Persistence
out/uf_counsel_ranker/{run}/ result.json, reports, manifest and audit
Review & permissions
Allowlisted review roles; review is separate from ranking and does not engage a firm.
Output
Ranked, conditional and excluded firm records with reasons.
  • src/uf_counsel_ranker/cli.py:39build_parser
  • src/uf_counsel_ranker/engine.py:58evaluate
  • src/uf_counsel_ranker/gates.py:313evaluate_firm
implemented

Document intake and matter triage

Route a supplied document or synthetic matter to the appropriate reviewer without interpreting or deciding it.

Interface / command
frontend/assets/gate.js and ranked.js; module CLI evaluate
Call
local legal_doc_intake evaluate; legal_matter_triage evaluate
Service / backend
legal_doc_intake/engine.py:evaluate; legal_matter_triage/engine.py:triage_item
Rules & validation
Match explicitly represented clauses/facts and demo policy conditions; elevate unknowns, risks and route constraints rather than fill missing facts.
Model / provider
none
Prompt
none
Retrieval / sources
none
Persistence
Module-specific result, reports, manifest and review audit
Review & permissions
Reviewer assesses source text, privilege and suggested route.
Output
Clause screening and advisory triage/urgency records.
  • src/legal_doc_intake/engine.py:101evaluate
  • src/legal_doc_intake/engine.py:74_clause_result
  • src/legal_matter_triage/engine.py:111triage_item
implemented

Obligations, policy register and litigation holds

Track stated obligations, policy versions and hold records with explicit missing evidence.

Interface / command
frontend/assets/register.js; three module CLIs
Call
local legal_obligations|legal_policy_register|legal_hold_tracker evaluate|review|verify
Service / backend
Module engine classify/evaluate functions
Rules & validation
Classify supplied records against versioned demo rules and deterministic as-of dates; retain unknown, expired, superseded or review-required states.
Model / provider
none
Prompt
none
Retrieval / sources
none
Persistence
Separate module run directories and source-linked row results
Review & permissions
Humans own deadlines, policy legal effect and issuing/releasing holds.
Output
Reviewable registers and unresolved-record queues.
  • src/legal_obligations/engine.py:53classify
  • src/legal_policy_register/engine.py:85classify
  • src/legal_hold_tracker/engine.py:91classify
implemented

Disclosure review gate

Prepare a source-linked review record while denying any automated release authority.

Interface / command
frontend/assets/gate.js; legal_disclosure_gate/cli.py
Call
local evaluate|review|verify; viewer GET /api/run
Service / backend
legal_disclosure_gate/engine.py:evaluate
Rules & validation
Run a demonstration checklist; privilege true/unknown forces human-only review even if all checklist items are evidenced; result vocabulary contains no permit state.
Model / provider
none
Prompt
none
Retrieval / sources
none
Persistence
Disclosure result, checklist evidence, manifest and audit receipts
Review & permissions
Authorized human decides any real disclosure elsewhere.
Output
REVIEW_READY or REVIEW_REQUIRED_ONLY; never a release permit.
  • src/legal_disclosure_gate/engine.py:65evaluate
  • src/legal_disclosure_gate/engine.py:85privilege_clear =
implemented

Invoice review

Expose billing exceptions for a human payment reviewer.

Interface / command
frontend/assets/ranked.js; legal_invoice_review CLI
Call
local evaluate|review|verify
Service / backend
legal_invoice_review/engine.py:compute_findings
Rules & validation
Apply deterministic demo invoice checks with Decimal money arithmetic and recorded narrative matches; unrepresented legal judgment remains outside the engine.
Model / provider
none
Prompt
none
Retrieval / sources
none
Persistence
Invoice findings, reports and hash-bound review artifacts
Review & permissions
Human controls payment authorization; no payment integration.
Output
Line-level billing findings and unresolved facts.
  • src/legal_invoice_review/engine.py:103compute_findings
  • src/legal_invoice_review/engine.py:48_dec
implemented

Regulatory documentation screen

Show whether represented arrangement documentation is complete without declaring legal compliance.

Interface / command
frontend/assets/gate.js; legal_reg_screen CLI
Call
local evaluate|review|verify
Service / backend
legal_reg_screen/engine.py:_screen_arrangement
Rules & validation
Evaluate a closed demonstration checklist and forcing rules; documentation_complete requires all required items and no forcing condition.
Model / provider
none
Prompt
none
Retrieval / sources
none
Persistence
Arrangement results with item provenance, source pack and audit
Review & permissions
Counsel evaluates applicability, exceptions and real regulatory consequences.
Output
Documentation completeness or review-required records.
  • src/legal_reg_screen/engine.py:107_screen_arrangement
  • src/legal_reg_screen/engine.py:52forcing_rules
implemented

Home, module pages, reports and command bridge

Inspect every module through one artifact-driven work queue.

Interface / command
frontend/index.html; module.html; assets/home.js; assets/module.js
Call
GET /api/runs; GET /api/run?module=...&id=...; POST /api/cli; GET /out/.../report.html
Service / backend
frontend/serve.py:scan_runs / build_handler / _handle_api_cli
Rules & validation
Closed module and verb allowlists, module-specific supported verbs, bounded JSON body, constrained run paths and shell=False invocation; browser evaluation is excluded.
Model / provider
none
Prompt
none
Retrieval / sources
none
Persistence
Reads module run artifacts; review commands append existing module receipts
Review & permissions
No authentication; localhost-only viewer; role labels enforced by module demonstration rules.
Output
Read-only states/reports, verification stdout and review receipt results.
  • frontend/serve.py:39MODULE_ALLOWLIST =
  • frontend/serve.py:261_prepare_cli_args
  • frontend/serve.py:528_handle_api_cli
  • frontend/assets/module.js:178loadRun
implemented

Verified review bundle download

Retain a verified artifact snapshot for a subsequent reviewer.

Interface / command
frontend/assets/review.js:mountReviewControls
Call
GET /api/review-bundle?module=...&id=...
Service / backend
frontend/serve.py:_handle_review_bundle
Rules & validation
Resolve one allowlisted module/run, reject unsafe paths or artifacts over limits, verify via the real CLI, compare before/after bytes, then zip only the five required files and a hash receipt.
Model / provider
none
Prompt
none
Retrieval / sources
none
Persistence
Download response only; no result or review state is rewritten
Review & permissions
No bundle is emitted when verification fails, files change or a required artifact is unsafe.
Output
Deterministic ZIP with result, manifest, audit, HTML/text reports and file hashes.
  • frontend/serve.py:456_handle_review_bundle
  • frontend/assets/review.js:87bundleLink.textContent
  • frontend/tests/test_review_bundle.py:33test_tampered_or_missing_run_never_exports
Which parts of the app are mapped

All nine terminal modules and the reachable localhost viewer groups were inspected. Related register/intake traces are grouped without treating shared rendering as shared domain logic.

13 mapped0 partial0 unmapped
  • Outside counselimplemented

    Module evaluate/review/verify and corresponding gate/register/ranked view mapped; outside counsel also exposes report.

  • Document intakeimplemented

    Module evaluate/review/verify and corresponding gate/register/ranked view mapped; outside counsel also exposes report.

  • Obligationsimplemented

    Module evaluate/review/verify and corresponding gate/register/ranked view mapped; outside counsel also exposes report.

  • Disclosure reviewimplemented

    Module evaluate/review/verify and corresponding gate/register/ranked view mapped; outside counsel also exposes report.

  • Invoice reviewimplemented

    Module evaluate/review/verify and corresponding gate/register/ranked view mapped; outside counsel also exposes report.

  • Policy registerimplemented

    Module evaluate/review/verify and corresponding gate/register/ranked view mapped; outside counsel also exposes report.

  • Litigation holdsimplemented

    Module evaluate/review/verify and corresponding gate/register/ranked view mapped; outside counsel also exposes report.

  • Matter triageimplemented

    Module evaluate/review/verify and corresponding gate/register/ranked view mapped; outside counsel also exposes report.

  • Regulatory documentation screenimplemented

    Module evaluate/review/verify and corresponding gate/register/ranked view mapped; outside counsel also exposes report.

  • Suite overview and module selectionimplemented

    Artifact census and selected-run rendering.

  • Raw engine reports and artifact APIimplemented

    Read result, manifest, audit and engine-authored HTML/text reports.

  • Command bridge and review dialogimplemented

    Allowlisted module verbs and engine-owned review semantics.

  • Verified bundle downloadimplemented

    New engine-verified, bounded artifact export.

03 / Review and permissions

What needs to happen before the next step?

implemented

Rules keep their source and status

Source manifests and rule-pack lifecycle checks retain hashes, effective windows and demonstration status; source text is not promoted into institutional authority.

Code references
  • src/legal_kernel/sourcepack.py:85load_manifest
  • src/legal_kernel/rulepack.py:31verify_pack_lifecycle
implemented

Refuse required unknowns

Closed schemas and explicit UNKNOWN values prevent missing material facts from silently becoming positive results.

Code references
  • src/legal_kernel/facts.py:16read_fact
  • src/legal_disclosure_gate/engine.py:85privilege_clear =
implemented

Review binds to one result

Review re-verifies the run and appends a receipt tied to its output hash; stale review and audit inconsistency are reported.

Code references
  • src/legal_kernel/audit.py:103apply_review
  • src/legal_kernel/runrecord.py:27verify_run
implemented

Browser cannot evaluate new matters

The bridge exposes only permitted review/verify/report operations with a closed module/argument allowlist and shell-free invocation.

Code references
  • frontend/serve.py:54VERB_ALLOWLIST =
  • frontend/serve.py:261_prepare_cli_args
implemented

Bundle refusal and local trust limit

Export requires stable artifact bytes and successful module verification. It does not authenticate a reviewer, anchor a whole replaced directory, or establish legal validity.

Code references
  • frontend/serve.py:456_handle_review_bundle
  • src/legal_kernel/runrecord.py:7coordinated replacement

04 / Completion work

What changed in this snapshot.

Implemented change

Verified review bundle

Added a bounded download endpoint and review-control link. It captures required artifact bytes, invokes the selected module verify command, refuses nonzero verification or changed/symlinked/missing artifacts, and produces a deterministic ZIP with a SHA-256 file receipt.

The viewer could inspect reports and invoke verification but lacked a single retained packet containing the result, source/output manifest, review receipts and reports; engine evaluation remains terminal-only.

Options considered
  • Add institutional authentication to the local viewer.
  • Add a verified review bundle for retaining the result and review history together.
  • Allow browser-side evaluation of new matters.
Files changed
  • frontend/serve.py
  • frontend/assets/review.js
  • frontend/tests/test_review_bundle.py
  • README.md

Validation

passedpython3 -m pytest frontend/tests/test_review_bundle.py frontend/tests/test_cli_bridge.py -q

32 passed using bundled Python; real synthetic ranker runs, repeatable ZIP bytes, tamper refusal, missing run and symlink refusal.

passedpython3 -m pytest tests/ frontend/tests/ -q

963 passed in 44.15s using bundled Python; local synthetic engine and viewer suite.

Scope of the tool

  • DEMO_ONLY public or synthetic inputs; no patient, protected health, privileged or real matter records.
  • Nine deterministic modules use no model, vector database, external API or network retrieval in their decision paths.
  • Reviewer role labels are allowlisted demonstration roles, not authenticated identities.
  • Disclosure review has no release-permission path; the software sends no notices, engages no counsel, pays no invoice and issues/releases no litigation hold.
  • Local hashes detect inconsistent alteration; coordinated replacement of the whole run remains outside the integrity guarantee.

Unfinished work and gaps in the map

  • Role labels are not authenticated identities; no production institutional access control is claimed.
  • Only public snapshots and synthetic inputs were examined; no hospital adoption or real-matter validation is established.
  • The bundle excludes original inputs, and a coordinated replacement of a whole consistent run directory is outside local-hash integrity guarantees.
  • The home reviewed indicator detects that a review event exists; it should not be treated as current substantive approval or a real-world legal authorization.
  • No legal authority was refreshed in this implementation. Demonstration policy coverage is not a statement that current hospital law is complete.
  • Bundle verification assumes trusted local files. Before/after comparisons are not atomic protection against a malicious local filesystem writer.
  • Original input files are excluded; the ZIP cannot independently re-establish source authenticity without the original source environment.
  • The viewer remains a localhost demonstration with no identity authentication.
  • The selected-module verify command validates local integrity, not legal correctness or professional approval.
Implementation snapshot

These maps explain the software, its sources, and who reviews the results. Local and synthetic tests do not establish legal accuracy or readiness for production. The technical traces identify configured integrations and unfinished paths.