MARK GARASLEGAL AI & SOFTWARE

Legal ↔ Technical / Architecture map

Pre-Filing Integrity Gate

Follow a draft through local source checks, decisions on material issues and an internal review packet tied to the approved content.

Workflow SVG ↓Project case study ↗

Current workflow review / 31 October 2026

A fresh synthetic replay reached a checksum-verified internal packet after issue dispositions and content-bound approval were simulated. Seven material issues remained traceable through the recorded process. The combined application suite exercises state transitions, content changes, ownership and packet integrity.

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

Save the draft

An authorized owner saves the draft with matter, court and jurisdiction details. Its text and hashes remain fixed so the review refers to that version.

Legal ↔ Technical
Legal purpose

Preserve what the lawyer actually reviewed.

How it works

Owner-scoped draft API, original/normalized hashes and D1 persistence; local memory is explicitly labeled.

  • app/prefiling/page.tsx:168createDraft
  • app/api/v1/prefiling/drafts/route.ts:28POST
  • lib/prefiling/store.ts:153PrefilingDraftRecord
implemented

Resolve local evidence

The resolver uses a local synthetic collection of authorities, records and court rules. It retains each source’s identity, version and applicability information for review.

Legal ↔ Technical
Legal purpose

Show where support came from and where coverage is unknown.

How it works

Local fixture lookup, source hashes and a material court-rule-coverage issue for an uncovered court.

  • lib/prefiling/tools.ts:421createPrefilingRegistry
  • lib/prefiling/fixtures.ts:32FIXTURE_AUTHORITIES
  • lib/prefiling/fixtures.ts:140FIXTURE_COURT_RULES

02Application & processing

implemented

Find review units

Deterministic tools split the draft into passages and identify supported citation, quotation, proposition, fact and record-reference patterns for checking.

Legal ↔ Technical
Legal purpose

Turn specific draft text into reviewable issues without claiming exhaustive extraction.

How it works

Versioned workflow steps call ingest_draft and extract_review_units through an allowlisted registry.

  • lib/prefiling/workflow.ts:71buildPrefilingWorkflow
  • lib/prefiling/tools.ts:176extractReviewUnits
implemented

Assemble the findings

Checks cover citations, quotations, pinpoints, jurisdiction and record support. A hashed packet brings the findings and limitations beside the relevant draft passages and sources.

Legal ↔ Technical
Legal purpose

Keep issue flags distinct from the lawyer’s legal conclusions.

How it works

Deterministic comparisons and heuristic overlap signals feed an immutable packet with counts and lineage.

  • lib/prefiling/tools.ts:421createPrefilingRegistry
  • lib/prefiling/workflow.ts:211getAssembleOutput
  • app/prefiling/page.tsx:311sourceExcerpt

03Review & decisions

implemented

Decide each material issue

The lawyer records a decision and reason for each material finding. Unresolved, escalated or blocked issues, and corrections only promised, cannot silently pass the sealing check.

Legal ↔ Technical
Legal purpose

A proposed fix requires a revised draft and a new review; accepting risk requires a recorded rationale.

How it works

Issue-keyed sequenced dispositions and computeSealBlockReasons feed the content-bound approval preview.

  • lib/prefiling/workflow.ts:254recordDisposition
  • lib/prefiling/tools.ts:404computeSealBlockReasons
  • lib/prefiling/store.ts:127dispositionsFromEvidence
implemented

Approve and seal

After material issues are resolved, the lawyer approves the displayed content digest. The engine rechecks the evidence and seals only if the approval and review state are still current.

Legal ↔ Technical
Legal purpose

Record a decision about exact content rather than a blanket approval.

How it works

Workflow/tool version hashes, fenced execution and a guarded integrity transition bind the package to its evidence and human approval.

  • lib/orchestrator/engine.ts:484createEngine
  • lib/prefiling/store.ts:494readIntegritySnapshot
  • lib/prefiling/store.ts:573commitIntegrityTransition

04Records & handoff

implemented

Keep the internal package

The completed packet is stored in an immutable envelope. Its human owner can download the exact bytes after current-seal, checksum and snapshot checks pass.

Legal ↔ Technical
Legal purpose

Retain the review record inside the authorized matter workspace.

How it works

Export bytes live in reserved owner-scoped checkpoint storage; the new read-only route returns JSON with private no-store headers.

  • lib/prefiling/tools.ts:421createPrefilingRegistry
  • lib/prefiling/download.ts:7prepareInternalPackageDownload
  • app/api/v1/prefiling/runs/[id]/download/route.ts:6GET
Read the connections as a list
  • Save the draft → Find review unitsStart a version-bound run
  • Find review units → Assemble the findingsReview units
  • Resolve local evidence ⇢ Assemble the findingsSource evidence and coverage
  • Assemble the findings → Decide each material issueInspect findings
  • Decide each material issue → Approve and sealHuman dispositions and digest
  • Approve and seal → Keep the internal packageSeal and internal export
  • Save the draft ⇢ Approve and sealDraft fingerprint
  • Resolve local evidence ⇢ Approve and sealSource and rule commitments

02 / Implementation traces

Follow an action into the code.

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

implemented

/prefiling draft form; draft list/detail APIs

Record a matter-scoped draft without mutating the reviewed version.

Interface / command
app/prefiling/page.tsx:PrefilingConsole / createDraft
Call
GET/POST /api/v1/prefiling/drafts; GET /api/v1/prefiling/drafts/[id]
Service / backend
Draft route → PrefilingStore.createDraft/getDraft/listDrafts
Rules & validation
Validates bounded text/metadata, normalizes text, hashes original and normalized bytes and stores an immutable draft.
Model / provider
none
Prompt
none
Retrieval / sources
none
Persistence
prefiling_drafts via D1PrefilingStore; explicitly permitted local memory fallback
Review & permissions
Platform human identity or configured service authorization; owner scope enforced in the store.
Output
Draft summaries and a source-bound version.
  • app/prefiling/page.tsx:168createDraft
  • app/api/v1/prefiling/drafts/route.ts:28POST
  • lib/prefiling/d1-store.ts:67D1PrefilingStore
implemented

Start/list reviews; Continue review stage list

Advance a fixed review process over the exact saved draft.

Interface / command
app/prefiling/page.tsx:startRun / act
Call
GET/POST /api/v1/prefiling/drafts/[id]/runs; POST /api/v1/prefiling/runs/[id]/actions {action:advance}
Service / backend
context.ts:makeDraftEngine → buildPrefilingWorkflow → createEngine
Rules & validation
Draft id is in the workflow definition; tool definitions and inputs are hash-bound, allowlisted, validated and executed in dependency order with bounded retries/leases.
Model / provider
none
Prompt
none
Retrieval / sources
none
Persistence
workflow_runs, workflow_steps, workflow_attempts, checkpoints and audit events
Review & permissions
Owner-scoped run lookup; consequential seal step requires human content-bound approval.
Output
Per-step status, evidence and explicit failure/recovery state.
  • app/prefiling/page.tsx:225startRun
  • app/api/v1/prefiling/context.ts:66makeDraftEngine
  • lib/prefiling/workflow.ts:71buildPrefilingWorkflow
  • lib/orchestrator/engine.ts:484createEngine
implemented

Findings, filters and draft-versus-source panels

Inspect a suspected support or accuracy problem at its draft location.

Interface / command
app/prefiling/page.tsx:PrefilingConsole / sourceExcerpt
Call
GET /api/v1/prefiling/runs/[id]
Service / backend
buildRunView → createPrefilingRegistry tools
Rules & validation
Regex-style extraction, fixture citation identity, quote/pinpoint/jurisdiction comparisons and record word-overlap heuristics produce issue flags; uncovered court rules generate an issue.
Model / provider
none
Prompt
none
Retrieval / sources
Deterministic local synthetic corpus only; resolve_authorities is the integration seam.
Persistence
Run evidence, attempt outputs and hashed assembled packet
Review & permissions
Lawyer reviews the original span and the cited source; no automated good-law conclusion.
Output
Issue matrix, source excerpts, court-rule applicability, limitations and coverage counts.
  • app/prefiling/page.tsx:311sourceExcerpt
  • lib/prefiling/workflow.ts:434buildRunView
  • lib/prefiling/tools.ts:176extractReviewUnits
  • lib/prefiling/tools.ts:354overlapRatio
  • lib/prefiling/fixtures.ts:32FIXTURE_AUTHORITIES
implemented

Finding decision form and decision history

Record a separate professional decision for each material issue.

Interface / command
app/prefiling/page.tsx:submitDisposition
Call
GET/POST /api/v1/prefiling/runs/[id]/dispositions
Service / backend
workflow.ts:recordDisposition → PrefilingStore.commitIntegrityTransition
Rules & validation
Only a human principal may disposition. Decisions are keyed to issue id and ordered by committed sequence; accepted findings require a rationale. A corrected flag still blocks this unchanged draft.
Model / provider
none
Prompt
none
Retrieval / sources
none
Persistence
prefiling_dispositions plus committed run evidence
Review & permissions
Authenticated human owner; every material issue needs its own resolving decision.
Output
Reviewer, rationale, chronology and updated seal blockers.
  • app/prefiling/page.tsx:262submitDisposition
  • app/api/v1/prefiling/runs/[id]/dispositions/route.ts:22POST
  • lib/prefiling/workflow.ts:254recordDisposition
  • lib/prefiling/store.ts:127dispositionsFromEvidence
implemented

Approve sealing, Revoke approval, sealed-package status

Authorize a specific package and invalidate it when its approval-bound state changes.

Interface / command
app/prefiling/page.tsx:act and Seal approval panel
Call
POST /api/v1/prefiling/runs/[id]/actions {action:approve|revoke}; GET /api/v1/prefiling/packages
Service / backend
createEngine.approve/revoke; seal_review_package; guarded integrity coordinator
Rules & validation
Approves the digest shown in the preview, checks material issue resolution, binds evidence/tool/source state and commits seal or invalidation under one guarded boundary. Terminal runs reject user revocation.
Model / provider
none
Prompt
none
Retrieval / sources
none
Persistence
workflow_approvals, prefiling_packages and reserved integrity checkpoints
Review & permissions
Human owner must supply expectedBoundHash; service/worker identities cannot approve.
Output
Content-bound seal, approval history and stale-package state.
  • app/api/v1/prefiling/runs/[id]/actions/route.ts:9POST
  • lib/prefiling/workflow.ts:395assertSealApprovable
  • lib/prefiling/workflow.ts:361createPrefilingIntegrityCoordinator
  • lib/prefiling/store.ts:494readIntegritySnapshot
implemented

Save internal package and new Download my internal review package link

Retrieve the exact reviewed record without filing or delivering it externally.

Interface / command
app/prefiling/page.tsx:Sealed package panel
Call
POST /api/v1/prefiling/runs/[id]/actions {action:export}; GET /api/v1/prefiling/runs/[id]/download
Service / backend
export_internal_package; download.ts:prepareInternalPackageDownload
Rules & validation
Export commits envelope bytes and checksum/index together. Download checks human owner, completed run, current seal/grant, exact hash/length, envelope identities and unchanged snapshot before returning the original JSON.
Model / provider
none
Prompt
none
Retrieval / sources
none
Persistence
Reserved prefiling-export checkpoint and evidence_artifacts checksum index; existing D1 tables
Review & permissions
Current sealed package and granted human approval required; wrong owners receive no state details.
Output
Internal JSON envelope with packet, decisions, source commitments, workflow/tool identities, approval, seal and limitations.
  • lib/prefiling/tools.ts:421createPrefilingRegistry
  • lib/prefiling/store.ts:205EXPORT_CHECKPOINT_LABEL_PREFIX
  • lib/prefiling/download.ts:7prepareInternalPackageDownload
  • app/api/v1/prefiling/runs/[id]/download/route.ts:6GET
implemented

Cancel review; Recover and retry; error/persistence notices

Recover from failures without confusing an accepted request with completed work.

Interface / command
app/prefiling/page.tsx:act / describeOutcome
Call
POST /api/v1/prefiling/runs/[id]/actions {action:cancel|recover}
Service / backend
createEngine lifecycle; context.ts:getPrefiling/storeUnavailable
Rules & validation
Translates actual engine outcomes, refuses silent production-memory fallback, exposes explicitly allowed local memory and retains unknown-outcome/recovery states.
Model / provider
none
Prompt
none
Retrieval / sources
none
Persistence
Run lifecycle, attempts and redacted audit events
Review & permissions
Owner authorization and engine state-transition rules; settled runs cannot be cancelled.
Output
Honest status, guarded retry and persistence warnings.
  • app/prefiling/page.tsx:190describeOutcome
  • app/api/v1/prefiling/runs/[id]/actions/route.ts:9POST
  • app/api/v1/prefiling/context.ts:51getPrefiling
  • app/api/v1/persistence-policy.ts:25memoryPersistenceAllowed
Which parts of the app are mapped

The /prefiling console and all eight grouped product route families, including the new download endpoint. The shared /agent and career dashboard are mapped in the Career Command Center companion.

9 mapped0 partial0 unmapped
  • /prefilingimplemented

    Draft intake, stage actions, findings/filtering, source comparison, dispositions, approval/revocation, save/download and notices.

  • GET/POST /api/v1/prefiling/draftsimplemented

    Owner-scoped collection and intake.

  • GET /api/v1/prefiling/drafts/[id]implemented

    Owner-scoped immutable version.

  • GET/POST /api/v1/prefiling/drafts/[id]/runsimplemented

    List or start draft-bound runs.

  • GET /api/v1/prefiling/runs/[id]implemented

    View, package, steps and approval preview.

  • POST /api/v1/prefiling/runs/[id]/actionsimplemented

    Advance, approve, revoke, cancel, recover, export.

  • GET/POST /api/v1/prefiling/runs/[id]/dispositionsimplemented

    Human issue decisions and history.

  • GET /api/v1/prefiling/packagesimplemented

    Owner-scoped package status list.

  • GET /api/v1/prefiling/runs/[id]/downloadimplemented

    Human-owner current-envelope retrieval.

03 / Review and permissions

What needs to happen before the next step?

implemented

Owner and human decision rights

Routes trust the platform-injected identity convention; stores independently filter owners. Human principals alone may approve, disposition or use the new download route.

Code references
  • app/api/v1/prefiling/context.ts:16authorized
  • app/api/v1/prefiling/context.ts:27callerKind
  • lib/prefiling/store.ts:546PrefilingStore
  • app/api/v1/prefiling/runs/[id]/download/route.ts:6GET
implemented

Atomic review boundary

Memory and D1 implementations use the same integrity snapshot contract so dispositions, revocation, seals, exports and completion cannot commit over stale approval-bound state.

Code references
  • lib/prefiling/store.ts:494readIntegritySnapshot
  • lib/prefiling/store.ts:573commitIntegrityTransition
  • lib/prefiling/d1-store.ts:260commitIntegrityTransition
implemented

Source and capability scope

The corpus is synthetic, currentness is not automatically refreshed, unknown court coverage creates a material issue, and exported limitations retain the absence of good-law checking, AI detection and filing capability.

Code references
  • lib/prefiling/fixtures.ts:140FIXTURE_COURT_RULES
  • lib/prefiling/tools.ts:63PACKET_LIMITATIONS
implemented

Persistence and no silent success

Production storage failure returns an error; export retrieval verifies saved bytes. Download repeats byte/currentness checks and sets private no-store headers.

Code references
  • app/api/v1/prefiling/context.ts:150storeUnavailable
  • lib/prefiling/download.ts:7prepareInternalPackageDownload
  • app/api/v1/prefiling/runs/[id]/download/route.ts:6GET
implemented

No model or external authority calls

The prefiling registry operates on local fixtures. A test counts zero fetch calls through ingest, seal, export and retrieval; this does not create a licensed legal research service.

Code references
  • lib/prefiling/tools.ts:45PREFILING_TOOL_NAMES
  • tests/domain/prefiling-export-envelope.test.ts:146the COMPLETE export flow reaches the network exactly zero times

04 / Completion work

What changed in this snapshot.

Implemented change

Authenticated, byte-verified owner download of the sealed internal review envelope.

Added a human-owner GET download route and console link. Retrieval verifies completed run state, the current sealed package and granted approval, exact checksum/length, envelope seal/approval identity, and an unchanged integrity snapshot across the read. It returns the original bytes with private no-store headers and never invokes a filing or delivery tool.

The prior workflow persisted and verified export bytes but only displayed a save receipt; the reviewer could not retrieve the retained package from the console.

Options considered
  • Connect a licensed citator and live standing-order sources.
  • Add a Word add-in with span annotations.
  • Complete owner retrieval of the already persisted internal package.
Files changed
  • lib/prefiling/download.ts
  • app/api/v1/prefiling/runs/[id]/download/route.ts
  • app/prefiling/page.tsx
  • tests/domain/prefiling-download.test.ts
  • tests/domain/prefiling-download-route.test.ts
  • README.md

Validation

passednode --import tsx --test tests/domain/prefiling-download.test.ts tests/domain/prefiling-download-route.test.ts

7 domain and 4 route tests cover exact bytes, owner isolation before integrity reads, stale/revoked/missing/corrupt state, a state change during retrieval, unfinished review, authentication, service refusal and unavailable production storage.

passednpm run test:unit

347 tests passed across the shared career/orchestrator/prefiling repository; baseline was 332 tests.

passednpm run lint

ESLint completed with exit 0.

passednode node_modules/typescript/bin/tsc --noEmit

TypeScript completed with zero errors.

passednpm run build

Vinext production build completed; route static-analysis classification warnings are framework notices.

passedgit diff --check

No whitespace errors; pre-existing dirty files remain intact.

failednode --test tests/rendered-html.test.mjs

Both rendered checks stopped before assertions because the existing local dev-preview startup did not complete within the harness window. Retried with local-port permission and CLOUDFLARE_CF_FETCH_ENABLED=false; no assertions or deadlines were weakened.

Scope of the tool

  • The shipped authorities, record pages and court rules are synthetic fixtures, not a current court-rules feed.
  • Extraction, citation checks and word-overlap support signals are deterministic heuristics; they are not exhaustive legal review.
  • No good-law/citator determination, AI-authorship detection, signature, certification, court filing or third-party delivery is implemented.
  • The signing lawyer decides what is accurate and appropriate; a sealed software record is not a filing certification.

Unfinished work and gaps in the map

  • No licensed citator, live court/judge standing-order source or general legal-entailment model is connected.
  • Extraction and support signals can miss issues or flag benign text; the signing lawyer must independently review the draft.
  • The platform must inject and protect identity headers; the repository does not implement its own identity provider.
  • D1 behavior has local SQL/contract tests; no production deployment or privileged matter trial was run.
  • The console has no React component-test infrastructure. New route/domain tests are automated; graphical app usability was not measured.
  • Owner identity relies on the hosting gateway enforcing its injected authentication header; upstream gateway enforcement was outside the bounded download review.
  • Real authority and court-rule integration still requires licensing, provenance and currentness controls.
  • The owner downloads an internal record; separate authorized human action is still needed for any external use.
  • A download is a snapshot at retrieval time; later changes cannot retroactively update a saved file.

Source references

U.S. Courts: Federal Rules of Civil Procedure ↗ livingOfficial rules index verified 26 October 2026. Background for lawyer responsibility; this map does not state that synthetic court-rule fixtures are current law or that the app satisfies Rule 11.

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.