Product desk
Ten intents, twelve APIs, eighteen services, ten operations, twelve security domains, one production diagram, eight incident phases, ten attorney-review stages, twelve threat categories, ten UX stages, ten audit layers, twelve business-logic domains, ten schema domains, fourteen API wiring rows, twelve event streams, twelve performance domains, ten recovery layers, twelve cost domains, ten deploy layers, twenty V–Z governance layers, four live desks. LegalLens picks the engine. Worksheets are not a filing. Not legal advice.
Reason
DeepSeek-R1 + record neighbours
Appeals, case law, and eligibility questions. Cites stored LegalLens records only.
Draft
Calme LegalKit
Motions, letters, contract review, and legal summaries via Calme LegalKit.
Forms
Form Filler worksheets
USCIS and DOS worksheets with official instructions, jurisdiction checks, and human review. Questions can show in your language; filing answers stay English.
Translate
Argos + standing rules
Official-document translation with standing rules. Argos first, never the parse box.
Routing matrix
Form filling
Form Filler · Instruction catalog · Rule engine
Legal reasoning
DeepSeek-R1 · pgvector records · Rule engine
Immigration eligibility
N-400/I-130 grid · Rule engine · DeepSeek-R1
Document upload
Parse extract · Document Studio · Rule engine
Instruction watch
Diff the Law · Heading NLP · Rule extract
Regulation watch
Diff the Law · Heading NLP · Rule extract
Case law watch
Diff the Law · Heading NLP · News embeddings
Multilingual
Argos · Standing rules · English canonical instructions
Evidence checklist
Instruction catalog · Rule engine
Attorney review
Form Filler review · Audit trail · Risk flags
System architecture
Production architecture
Seven bands on the hosts that already run. Catalog stays frozen. Crawls do not retrain. User data is not training data.
User clients
API gateway
Core desks
Model layer
Data and storage
Security and compliance
DevOps and deployment
User clients
Attorneys • Paralegals • Clients /profile
|
API gateway
Auth • Routing • Rate limit • Log POST /api/system
|
Core desks
Auth /profile
Ingest • Version • NLP • Changes /diff-the-law
Rules • Schema • Forms • Risk /form-filler
Evidence • Reuse • Review /form-filler
RAG /like-cases
Reasoning /chat
Translate Argos
Scan /document-scanner
|
Model layer
DeepSeek-R1 then Saul then Vistral POST /api/chat
Crawls do not retrain
|
Storage
Supabase Postgres + pgvector 1024-d
Parse droplet extract-only
|
Security
Signed-in AI • BotID • TLS GET /api/system/security
Frozen catalog • no auto-file
|
DevOps
encoding + python-backend GET /api/system/ops
Vercel production legallens.newsSystem APIs
Twelve contracts on the desks that already run. Catalog stays frozen until a person reviews a Diff the Law change.
Auth
Supabase Auth. Signed-in users and admin. Attorney, paralegal, and client are signed-in roles on the same account, not a second login host.
Document ingestion
Diff the Law crawls USCIS, DOS, Federal Register, and court pages. User PDFs go to the parse droplet for extract only.
Document versioning
SHA-256 snapshots. A new hash writes a change row. Catalog is not rewritten.
NLP processing
Heading NLP (heading-nlp-v1) segments official pages and extracts eligibility, skip, and evidence rules onto change_stats.
Change detection
Line and section diffs for instructions, regulations, and case-law pages. Feeds news embeddings. Never auto-updates form_instructions.
Rule engine
Frozen instruction catalog plus evaluateFormCompliance. Human review writes rules. Crawls do not POST /rules/update.
Form schema
Official field lists and instruction JSON. Version is the frozen catalog date. POST /forms/update is a human catalog edit, never a crawl.
RAG
Gemini 1024-d embeddings in Supabase pgvector. Like cases and system reason retrieve stored records.
Reasoning
DeepSeek-R1, then Saul, then Vistral. Hard rule engine stays in front of the models. Signed-in only.
Form filling
Field validation, skip logic, instruction compliance. Finalize needs humanReviewed and no blocking flags. No auto-file.
Multilingual
Argos plus standing rules. Display can be Arabic; official answers stay English. Never the parse box.
Attorney review
Human review, risk flags, and worksheet export. Arrests and stale catalogs block finalize until a person reviews.
System services
Eighteen services on the same four desks. Each can be updated in place. Catalog stays frozen until a person reviews a Diff the Law change.
Gateway
Next.js entry. BotID, requireAuthenticatedUser, and the shared AI tool rate limit run before any model call.
Auth and identity
Supabase Auth. Admin is isAdminUser. Attorney, paralegal, and client share the signed-in account.
Document ingestion
Diff the Law crawls USCIS, DOS, Federal Register, and court pages. User PDFs go to the parse droplet for extract only.
Document versioning
SHA-256 snapshots. A new hash writes a change row. Catalog is not rewritten.
NLP processing
Heading NLP (heading-nlp-v1) segments official pages and writes eligibility, skip, and evidence rules onto change_stats.
Change detection
Line and section diffs for instructions, regulations, and opinions. Feeds news embeddings. Never auto-updates form_instructions.
Rule engine
Frozen catalog plus evaluateFormCompliance. Human review writes rules. Crawls do not update the catalog.
Form schema
Official field lists and instruction JSON. Version is the frozen catalog date.
RAG
Gemini 1024-d embeddings in Supabase pgvector. Like cases and system reason retrieve stored records.
Reasoning
DeepSeek-R1, then Saul, then Vistral. Hard rules stay in front of the models. Signed-in only.
Form filling
Skip logic, instruction compliance, and finalize checks. Finalize needs humanReviewed. No auto-file.
Multilingual
Argos plus standing rules. Display can be Arabic; official answers stay English. Never the parse box.
Risk flag
Arrests, inconsistent dates, and stale catalogs block export until a person reviews. evaluateFormCompliance writes the flags.
Evidence checklist
Evidence rules from heading NLP on Diff the Law, then the Form Filler checklist. Catalog stays frozen.
Data reuse
Profile and draft facts fill known fields. formEconomy asks only what is still missing.
Attorney review
Human review, risk flags, and worksheet export. Arrests and stale catalogs block finalize.
Notification
Digest, smart alerts, and case-follow mail. Change rows on Diff the Law can feed the next digest.
Orchestration
legalSystemRouter classifies ten intents and hands each to a live desk. GET /api/system/contract maps the APIs.
Operations
Ten operations on Vercel, GitHub Actions, and Supabase. Encoding and python-backend gate every merge. Catalog stays frozen. Crawls do not retrain models.
Infrastructure
Next.js on Vercel. Postgres and pgvector on Supabase. Argos and the extract-only parse droplet on DigitalOcean. One product host.
CI/CD
GitHub Actions. Merge gates are encoding and python-backend. Vercel deploys main to production after the squash. Preview apps ship on every pull request.
Model deployment
DeepSeek-R1, then Saul, then Vistral on Hugging Face. General chat may use Claude Haiku last. Crawls do not retrain or promote a new model.
Data pipeline
Diff the Law daily at 04:15 UTC. State court opinions every three hours. Change rows and heading NLP write training JSON. Catalog stays frozen until a person reviews.
Monitoring
Prometheus scrape at /api/metrics (token or cron secret). Vercel runtime logs. Form Filler records blocking flags. No second metrics host.
Logging and audit
Signed-in system job log. Form Filler humanReviewed and blocking findings. Chat is signed-in only. Worksheets are not a filing.
Security
Supabase Auth, BotID, AI tool rate limits, Diff the Law SSRF guards, and Vercel TLS. Admin is isAdminUser. Secrets stay in Vercel and GitHub.
Environments
Local, Vercel preview on every pull request, and production on main. Production aliases are legallens.news after READY. No direct skip of encoding and python-backend.
Backup and recovery
Supabase holds Postgres and the 1024-d embeddings. Point-in-time recovery is on that project. Parse and Argos stay extract/translate only.
Performance and scaling
Vercel serverless scales with traffic. Warm-desks every ten minutes. Chat and form-assistant cap duration. No extra model GPU host on this product.
Security and compliance
Twelve controls on the hosts that already run. Chat is signed-in. User data is not training data. Catalog stays frozen. No auto-file.
Zero-trust
Mutating AI routes require requireAuthenticatedUser, BotID, and the shared AI tool rate limit before any model call.
Encryption
Vercel serves HTTPS. Supabase encrypts Postgres and the 1024-d embeddings at rest. Parse and Argos stay TLS to their droplets.
Identity and access
Supabase Auth. Admin is isAdminUser. Attorney, paralegal, and client share the signed-in account. Sessions expire with refresh tokens.
Secrets
Secrets live in Vercel encrypted env and GitHub Actions secrets. They are not committed. Cron and metrics tokens stay off the public scrape.
Audit logging
Signed-in system job log. Form Filler records humanReviewed and blocking findings. Diff the Law stores hashed snapshots and change rows.
Model security
Hard rules sit in front of DeepSeek-R1, Saul, and Vistral. Crawls do not retrain. User worksheets are not training data.
Privacy and confidentiality
Chat and form fill are signed-in. Criminal, immigration, and identity answers stay on the worksheet. No auto-file. Not legal advice.
Compliance frameworks
Aligns with ABA confidentiality, OWASP Top 10 guards in CI, and GDPR/CCPA minimization. This is not a certification claim.
Threat detection
Vercel DDoS and WAF, BotID on AI routes, AI tool 429s, and Diff the Law SSRF guards. Suspicious bots never reach a model.
Network security
Postgres is not public. The service role stays on the server. Rate limits wrap chat, system, and form-assistant.
Backup and recovery
Supabase holds Postgres and embeddings with point-in-time recovery. Parse stays extract-only. Argos stays translate-only.
Official-source compliance
Diff the Law versions USCIS, DOS, Federal Register, and court pages. Form Filler uses the frozen catalog until a person reviews. No auto-file.
Incident response
Eight phases on live controls. Classify on POST /api/system/incident. That call does not isolate hosts, rotate secrets, or file.
1. Detection and alerting
BotID, AI tool 429s, Vercel runtime logs, and /api/metrics. Three failed logins is suspicious. Ten is brute force.
2. Classification
Level 4 is privileged-data breach, intrusion, or model poisoning. Level 3 is stolen credentials, exfiltration attempt, or rule/schema corruption. POST classifies. It does not isolate hosts.
3. Containment
Form finalize already needs humanReviewed and no blocking flags. Catalog stays frozen. Rate limits wrap AI routes. This playbook does not rotate secrets by itself.
4. Forensic analysis
Signed-in job log, Diff the Law SHA-256 snapshots, and Form Filler findings. Last-72-hour scope is the job log plus Vercel logs.
5. Eradication
Frozen catalog plus evaluateFormCompliance. Crawls do not rewrite instructions. Models are not retrained from user worksheets.
6. Recovery
Supabase point-in-time recovery. Encoding and python-backend gate every return to production. npm run test:n400-i130 and test:form-compliance.
7. Notification and compliance
Level 3: attorneys within 24 hours. Level 4: attorneys and clients within 12 hours. Digest and case-follows carry product alerts. This route does not send the notice.
8. Post-incident review
Review within 72 hours on /system. Update Diff the Law watch, Form Filler human review, and the security map. Not a certification claim.
Attorney review
Ten stages on Form Filler, Document Scanner, and Argos. Three outcomes: approved, approved with conditions, rejected. POST /api/system/review classifies. It does not set humanReviewed, export, or file.
1. Intake and pre-review
Form Filler collects answers, skip logic, and instruction flags. The attorney sees answers, flags, inconsistencies, evidence, translations, and form, rule, and model versions.
2. Identity verification
Document Scanner OCR and extract. Parse droplet stays PDF extract. Attorney compares names, dates, and documents.
3. Rule compliance
Frozen instruction catalog plus jurisdiction profiles. Sources stay USCIS instructions, DOS FAM, INA, and CFR as published. Crawls do not rewrite the catalog.
4. Risk-flag review
evaluateFormCompliance writes the flags. Attorney can clear, request more evidence, or mark critical. Arrests and CIMT block worksheet export until a person reviews.
5. Evidence review
Form Filler checklist from frozen instructions: identity, immigration history, marriage, criminal records, travel, and employment.
6. Inconsistency detection
Form Filler contradiction findings. Attorney corrects, requests clarification, or rejects. This route does not rewrite answers.
7. Multilingual verification
Argos plus standing rules. Display can be Arabic. Official answers stay English. Critical check: criminal history, immigration violations, marriage history, eligibility rules.
8. Final rule-engine validation
evaluateFormCompliance on Form Filler. A failed rule keeps canExportWorksheet false. This catalog does not export and does not file.
9. Attorney approval
Three outcomes. POST classifies. It does not set humanReviewed. Live export stays on Form Filler after humanReviewed and no blocking flags.
10. Finalization and audit trail
Signed-in job log plus Form Filler findings. isFinal stays false. Worksheets are not a filing. This route does not write the log by itself.
Threat model
Twelve attack surfaces on the hosts that already run. POST /api/system/threat classifies. It does not lock accounts, rotate secrets, crawl, retrain, isolate, or file.
Unauthorized access
requireAuthenticatedUser, BotID, and the shared AI tool rate limit run before any model call. Three failed logins is suspicious. Ten is brute force. This route does not lock the account.
Data exfiltration
Embeddings stay 1024-d in Supabase pgvector. Service role is server-only. Chat and Form Filler are signed-in. This route does not scan outbound copies.
Model poisoning
Crawls write change rows for a person to review. Models are not retrained from those rows. User worksheets are not training data. Heading NLP stays heading-nlp-v1.
RAG manipulation
Retrieval is Gemini 1024-d neighbours in pgvector. Story chat answers from the stored record. Flagged form answers still need humanReviewed. This route does not reindex.
Rule-engine tampering
Official English instructions stay canonical. Crawls never rewrite the catalog. A person reviews Diff the Law before anyone files. This route does not approve a rule change.
Form schema corruption
Export needs ready_for_human, humanReviewed, and no blocking flags. Stale catalogs block unsigned export. This route does not roll back a schema.
API abuse
Rate limits wrap AI routes. BotID wraps mutating system posts. This route does not change WAF rules.
Host compromise
Three hosts: Vercel, extract-only parse, Argos translate. DOCUMENT_PARSE_URL and LEGAL_TRANSLATE_URL stay different. This route does not rebuild a droplet.
Supply chain
Merges wait for encoding and python-backend. Direct push to main is rejected. This route does not scan an SBOM or sign an image.
Insider threats
Admin is isAdminUser. Worksheet export still needs a person. The job log records routed work. This route does not record a session video.
Data privacy
Criminal, immigration, and identity answers stay on the signed-in worksheet. Argos never runs on the parse box. Worksheets are not a filing. Not legal advice.
Official-source update failures
Scheduled crawls hash official pages. They never rewrite form_instructions. A person reviews Diff the Law before anyone files. This route does not roll back a version.
User experience
Ten stages from welcome through filing guidance. POST /api/system/ux classifies. It does not create profiles, set humanReviewed, export, or file.
1. Welcome and intake
Home language plus signed-in profile. Form Filler loads after the category is known. This route does not create an account.
2. Smart form selection
classifyLegalSystemIntent plus canonicalFormId. Latest USCIS or DOS text stays on Diff the Law. The worksheet catalog is frozen until a person reviews.
3. Guided interview
Form Filler applies skip logic and instruction constraints. Answers stay structured JSON on the signed-in worksheet. This route does not write those answers.
4. Real-time validation
evaluateFormCompliance on Form Filler. Like-cases can explain a stored record. Flags stay on the worksheet until a person reviews.
5. Evidence collection
Document Scanner OCR plus Form Filler checklist from frozen instructions. Parse stays PDF extract. This route does not classify fraud by itself.
6. Multilingual review
Argos plus standing rules. Display can be Arabic, Somali, or Urdu. Official answers stay English. This route does not rewrite the worksheet language.
7. Risk summary
Form Filler findings plus POST /api/system/review outcomes. CIMT and arrests stay red until a person reviews. This route does not escalate to an attorney inbox.
8. Attorney review portal
The ten-stage attorney-review catalog. Three outcomes: approved, approved with conditions, rejected. POST classifies. It does not set humanReviewed.
9. Finalization and export
Live export stays on Form Filler after ready_for_human, humanReviewed, and no blocking flags. isFinal stays false. This catalog does not export or file.
10. Filing guidance
Frozen instruction catalog plus Diff the Law hashes of official pages. Crawls never rewrite fees or filing addresses. A person reviews before anyone files.
Audit trail
Ten layers on the job log, Diff the Law hashes, Form Filler findings, and attorney review. POST /api/system/audit classifies. It does not insert a job, seal a hash chain, export, or file.
1. Immutable log storage
Diff the Law stores SHA-256 snapshots of official pages. Signed-in job rows are inserts. This route does not seal a daily hash chain or delete a row.
2. Multi-channel logging
Signed-in GET /api/system lists jobs. BotID and AI rate limits write security 429s. Vercel hosts the function logs. Parse and Argos stay on separate droplets. This route does not tail those hosts.
3. Legal event logging
Diff the Law change rows plus Form Filler findings plus POST /api/system/review outcomes. Crawls never rewrite the catalog. Events stay timestamped on those desks.
4. Version tracking
Frozen form_instructions carry a version. Heading NLP stays heading-nlp-v1. Embeddings stay 1024-d. Attorney-review and UX catalogs publish SYSTEM_REVIEW_VERSION and SYSTEM_UX_VERSION. This route does not bump a version.
5. Chain of custody
Document Scanner extract plus signed-in worksheets. humanReviewed is the approval gate. This route does not record a viewer list.
6. Model traceability
Like-cases and story chat return the model id that answered. DeepSeek-R1, Saul, and Vistral stay named. User worksheets are not training data. This route does not write an inference row.
7. Rule-engine traceability
evaluateFormCompliance findings name the rule and whether it blocks export. Official English instructions stay the source. This route does not insert a rule log.
8. Attorney-review audit trail
POST /api/system/review classifies approved, approved with conditions, or rejected. It does not set humanReviewed. Live export stays on Form Filler after humanReviewed and no blocking flags.
9. Export and filing audit
canExportWorksheet stays on Form Filler after ready_for_human, humanReviewed, and no blocking flags. isFinal stays false. This catalog does not export or file.
10. Compliance and retention
trainsOnUserData stays false. Chat and forms are signed-in. Apply the signed-in job log SQL. This route does not set a retention clock or transmit worksheets off-host.
Business logic
Twelve domains from intent through audit. Schema mismatch never rewrites the catalog. POST /api/system/logic classifies. It does not write answers, set humanReviewed, export, or file.
User input → Intent → Form schema → Skip logic → Rule engine → Validation → Evidence → Multilingual → RAG → Reasoning → Risk flags → Attorney review → Audit → Worksheet (not a filing)
1. User intent
classifyLegalSystemIntent plus the ten UX stages. Signed-in POST /api/system routes. This route does not write a job.
2. Form schema
Mismatch writes a Diff the Law change row and outdated_source. form_instructions stay frozen until a person reviews. This route does not rewrite the catalog.
3. Skip logic
Form Filler skip logic from frozen instructions. This route does not save an answer.
4. Rule engine
evaluateFormCompliance. Blocking findings keep canExportWorksheet false until a person reviews.
5. Validation
Form Filler findings. Marriage date before birth date is an inconsistency. This route does not rewrite answers.
6. Evidence
Form Filler checklist plus Document Scanner OCR. Parse stays PDF extract. This route does not classify fraud by itself.
7. Multilingual
Argos plus standing rules. Display can be Arabic. Official answers stay English. This route does not rewrite the worksheet language.
8. RAG retrieval
Gemini 1024-d neighbours in Supabase pgvector. Story chat answers from the stored record. This route does not reindex.
9. Reasoning
Hard rules stay in front of the models. Chat is signed-in. This route does not invent a statute.
10. Risk flags
CIMT, arrests, and blocking flags stay red until a person reviews. This route does not escalate to an attorney inbox.
11. Attorney review
POST /api/system/review classifies. It does not set humanReviewed. Live export stays on Form Filler after humanReviewed and no blocking flags.
12. Audit
The ten audit layers. POST classifies. It does not insert a job, seal a hash chain, export, or file.
Database schema
Ten domains mapped onto Diff the Law, frozen form_instructions, article_embeddings, profiles, and Form Filler. POST /api/system/schema classifies. It does not create a table, migrate, reindex, export, or file.
1. Official documents
Diff the Law stores SHA-256 hashes of USCIS, DOS, court, and Federal Register pages. Crawls never rewrite form_instructions. This route does not ingest a page.
2. NLP extraction
Heading NLP stays heading-nlp-v1 on Diff the Law snapshots. Extracted rules stay in the frozen catalog until a person reviews. This route does not parse a document.
3. Form schemas
Frozen form_instructions plus the code catalog. Mismatch writes outdated_source. This route does not add a field or rewrite skip logic.
4. Rule engine
evaluateFormCompliance on Form Filler. Rule versions live on Diff the Law change rows. This route does not insert a rule.
5. RAG vectors
Gemini 1024-d neighbours in article_embeddings. User worksheets are not training data. This route does not reindex.
6. User answers and sessions
Signed-in profiles plus Form Filler worksheets. Worksheets are not a filing. This route does not save an answer.
7. Evidence
Document Scanner OCR plus Form Filler checklist. Parse stays PDF extract. This route does not store a blob.
8. Risk flags
evaluateFormCompliance findings: CIMT, fraud, INA, marriage, naturalization. Blocking flags keep export closed until a person reviews. This route does not insert a flag row.
9. Attorney review
POST /api/system/review classifies pending, approved, approved with conditions, or rejected. It does not set humanReviewed.
10. Audit and logging
Ten audit layers plus Diff the Law hashes plus the signed-in job log. Apply the job log SQL. This route does not insert a log row.
API wiring
Fourteen dump endpoints mapped onto live desks, business logic, and stores. POST /api/system/wiring classifies. It does not crawl, retrain, write answers, set humanReviewed, export, or file.
API Gateway → API Endpoint → Business Logic Layer → Live desks → Frozen catalog / RAG / DeepSeek-R1 → Postgres + pgvector → Audit catalog
1. Auth → identity
Supabase Auth plus GET /api/profile. Attorney, paralegal, and client share the signed-in account. This route does not create a session.
2. Ingest → NLP + versioning
Diff the Law hashes USCIS, DOS, court, and Federal Register pages. Heading NLP stays heading-nlp-v1. A change row waits for a person. Catalog is never auto-updated. Models are never retrained from a crawl. This route does not ingest a page.
3. Version → change detection
SHA-256 snapshots on law_page_snapshots. A new hash writes law_page_changes. This route does not compare a page.
4. NLP → extraction
heading-nlp-v1 writes structured rules onto change_stats. Frozen form_instructions stay frozen until a person reviews. This route does not extract a rule.
5. Changes → update pipeline
Mismatch writes a Diff the Law change row and outdated_source. form_instructions stay frozen. Models are never retrained from a crawl. This route does not rewrite the catalog.
6. Rules → evaluation
Form Filler compliance on the frozen catalog. Blocking findings keep export closed until a person reviews. This route does not insert a rule.
7. Form schema → form logic
Frozen form_instructions plus the code catalog. This route does not add a field or rewrite skip logic.
8. RAG → retrieval
Gemini 1024-d neighbours in article_embeddings. User worksheets are not training data. This route does not reindex.
9. Reasoning → DeepSeek-R1 + rules
Hard rules stay in front of DeepSeek-R1, then Saul, then Vistral. Chat is signed-in. This route does not invent a statute.
10. Form fill → validation
POST /api/form-assistant. Export stays on Form Filler after ready_for_human, humanReviewed, and no blocking flags. This route does not save an answer, export, or file.
11. Translate → alignment
Argos plus standing rules. Display can be Arabic. Official answers stay English. This route does not rewrite the worksheet language.
12. Risk → flags
Form Filler findings: CIMT, fraud, INA, marriage, naturalization. Blocking flags keep export closed until a person reviews. This route does not insert a flag.
13. Attorney review → human-in-the-loop
POST /api/system/review classifies pending, approved, approved with conditions, or rejected. It does not set humanReviewed. isFinal stays false.
14. Audit → trail
Ten audit layers plus Diff the Law hashes. This route does not insert a log row, export, or file.
Event streams
Twelve dump streams mapped onto Diff the Law hashes, frozen form_instructions, Form Filler findings, and attorney review. POST /api/system/events classifies. It does not emit a bus event, crawl, retrain, rewrite the catalog, export, or file.
Official page hash → DocumentIngested → heading-nlp-v1 + snapshot → ChangeDetected (person reviews) → Catalog stays frozen / modelRetrain stays false → User answers → Form Filler findings → Risk flags until a person reviews → Attorney review classifies → Worksheet (not a filing)
1. Document ingested
Diff the Law hashes USCIS, DOS, court, and Federal Register pages. Heading NLP stays heading-nlp-v1. This route does not ingest a page.
2. Document version created
SHA-256 snapshots on law_page_snapshots. A new hash writes law_page_changes. This route does not write a snapshot.
3. Change detected
Mismatch writes a change row and outdated_source. form_instructions stay frozen until a person reviews. Models are never retrained from a crawl. This route does not rewrite the catalog.
4. Form schema updated
Frozen form_instructions plus the code catalog. Crawls never POST a schema update. This route does not add a field.
5. Rule updated
Form Filler compliance on the frozen catalog. Human review writes rules. This route does not insert a rule.
6. Model retrain requested
A change row waits for a person. Models are never retrained from a crawl. heading-nlp-v1 stays heading-nlp-v1. This route does not start training.
7. Model retrained
No model is promoted from a crawl. RAG stays Gemini 1024-d neighbours. This route does not swap a model.
8. Embeddings updated
Gemini 1024-d neighbours in article_embeddings. User worksheets are not training data. This route does not reindex.
9. User answer saved
Form Filler findings. This route does not save an answer, export, or file.
10. Evidence uploaded
Document Scanner OCR. Parse stays PDF extract. This route does not classify fraud by itself.
11. Risk flag raised
CIMT, fraud, INA, marriage, and naturalization findings. Blocking flags keep export closed until a person reviews. This route does not insert a flag.
12. Attorney review completed
POST /api/system/review classifies pending, approved, approved with conditions, or rejected. It does not set humanReviewed. isFinal stays false. There is no auto-file step.
Performance
Twelve dump domains mapped onto Vercel, Supabase, Upstash, and frozen form_instructions. POST /api/system/performance classifies. It does not retune indexes, autoscale, reindex, crawl, retrain, export, or file.
Caching → frozen catalog + Vercel Batching → like-cases neighbours Scaling → Vercel serverless Rate limits → Upstash Inference → DeepSeek-R1 then Saul then Vistral RAG → 1024-d pgvector Rules → Form Filler Updates → Diff the Law hashes Attorney review → classify only Audit → catalog Postgres → Supabase Global → production aliases
1. API gateway
Next.js on Vercel. BotID and Upstash rate limits run before model calls. This route does not change a rate limit.
2. Microservice caching
Frozen form_instructions stay in the code catalog. Crawls never rewrite that catalog. This route does not add a cache host.
3. Database
Supabase Postgres plus pgvector. Diff the Law snapshots and article_embeddings already live there. This route does not migrate or retune an index.
4. RAG retrieval
Gemini 1024-d neighbours in article_embeddings. User worksheets are not training data. This route does not reindex.
5. Model inference
Hugging Face router on the Next.js host. heading-nlp-v1 stays heading-nlp-v1. This route does not start training or add a GPU node.
6. Rule engine
Form Filler compliance on the frozen catalog. Blocking findings keep export closed until a person reviews. This route does not insert a rule.
7. Form filling
Export stays on Form Filler after ready_for_human, humanReviewed, and no blocking flags. This route does not save an answer, export, or file.
8. Update pipeline
Diff the Law SHA-256 snapshots. Mismatch writes a change row. Catalog stays frozen. This route does not emit a bus event.
9. Attorney review
POST /api/system/review classifies. It does not set humanReviewed. isFinal stays false.
10. Audit logging
Ten audit layers plus Diff the Law hashes. This route does not insert a log row, export, or file.
11. Scaling
Vercel scales with traffic. Warm-desks every ten minutes. No extra model GPU host on this product. This route does not change an autoscale rule.
12. Global resilience
legallens.news and www.legallens.news after production READY. Preview ships on every pull request. This route does not fail over a region.
Disaster recovery
Ten dump layers mapped onto Vercel aliases, Supabase point-in-time recovery, frozen form_instructions, and Diff the Law hashes. POST /api/system/recovery classifies. It does not fail over a region, promote a replica, reindex, crawl, retrain, export, or file.
Vercel production aliases → Supabase Postgres + point-in-time recovery → pgvector 1024-d → Document Scanner + parse extract → DeepSeek-R1 then Saul then Vistral → Frozen form_instructions → Diff the Law hashes → Vercel serverless → Incident playbook → Audit catalog (not a filing)
1. Production aliases
Vercel production aliases after READY. Preview ships on every pull request. This route does not fail over a region.
2. Database continuity
Supabase holds Postgres. Point-in-time recovery is on that project. This route does not promote a replica or migrate a table.
3. RAG continuity
Gemini 1024-d neighbours in article_embeddings. This route does not reindex or sync a second vector store.
4. Evidence and documents
Parse stays PDF extract. Official USCIS and DOS pages live as Diff the Law hashes. This route does not copy a blob to a second region.
5. Model continuity
Hugging Face router on the Next.js host. Models are never retrained from a crawl. This route does not promote a model snapshot.
6. Rule and schema continuity
form_instructions stay frozen until a person reviews. This route does not rewrite skip logic or insert a rule.
7. Update pipeline continuity
Diff the Law hashes keep official pages. This route does not emit a bus event or miss a hash because a region is down.
8. Compute continuity
Vercel scales with traffic. Warm-desks every ten minutes. This route does not reschedule a node or run a blue-green cutover.
9. Recovery runbook
Eight incident phases already on the System desk. This route does not freeze writes or promote a secondary region.
10. Audit preservation
Official page hashes plus the audit catalog. This route does not seal a hash chain, export, or file.
Cost
Twelve dump domains mapped onto Vercel serverless, Hugging Face chat, Supabase, Upstash, and frozen form_instructions. POST /api/system/cost classifies. It does not autoscale, reindex, crawl, retrain, export, or file.
Compute → Vercel serverless Inference → DeepSeek-R1 then Saul then Vistral RAG → 1024-d pgvector Database → Supabase Evidence → Document Scanner Updates → Diff the Law hashes Audit → catalog Network → Upstash + BotID DevOps → encoding + python-backend Lifecycle → frozen catalog Global → production aliases
1. Compute
Next.js on Vercel. No extra GPU node on this product. This route does not add a node pool.
2. Microservice scaling
Vercel scales with traffic. Warm-desks every ten minutes. This route does not change an autoscale rule.
3. Model inference
Cheaper Hugging Face models first. Haiku is last. This route does not start training or add a GPU node.
4. RAG
Gemini 1024-d neighbours in article_embeddings. This route does not reindex or prune a second vector store.
5. Database
One Postgres project. This route does not partition a table, add a replica, or migrate.
6. Evidence storage
Parse stays PDF extract. Official pages stay hashes. This route does not move evidence to a cool tier.
7. Update pipeline
Diff the Law hashes. This route does not emit a bus event or compact a topic.
8. Audit logging
Audit catalog plus official page hashes. This route does not insert a log row, archive, export, or file.
9. Network
Vercel plus Upstash rate limits. This route does not peer a virtual network or add a CDN host.
10. DevOps
Merge gates stay encoding and python-backend. This route does not add a pipeline host.
11. Storage lifecycle
form_instructions stay in code. This route does not archive a session or move evidence to a deep archive.
12. Global deployment
Production aliases after READY. This route does not fail over a region or stand up active-passive ingestion.
Deployment automation
Ten dump layers mapped onto GitHub Actions, Vercel preview then production, Hugging Face chat, and frozen form_instructions. POST /api/system/deploy classifies. It does not apply a plan, sync a cluster, reindex, crawl, retrain, export, or file.
Infrastructure → Vercel + Supabase Source of truth → GitHub Packaging → Next.js routes Release → preview then production READY GitOps → encoding + python-backend Regions → legallens.news aliases Models → DeepSeek-R1 then Saul then Vistral RAG → 1024-d pgvector Recovery → catalog
1. Infrastructure
One product host. This route does not provision a cluster or add a node pool.
2. Source of truth
GitHub holds the tree. This route does not lock remote state or apply a plan.
3. Service packaging
Desks stay Next.js routes. This route does not apply a chart.
4. Release strategy
Preview then production after READY. This route does not start a canary or a shadow model.
5. GitOps sync
GitHub then Vercel. This route does not sync a cluster or enforce a desired cluster state.
6. GitOps workflow
Merge gates stay encoding and python-backend. This route does not build an image or rewrite a values file.
7. Regions
Production aliases after READY. This route does not stand up a second region or a cold standby.
8. Model rollout
Cheaper Hugging Face models first. This route does not package a model, run a canary, or promote a registry tag.
9. RAG index
Gemini 1024-d neighbours in article_embeddings. This route does not generate embeddings, reindex, or archive an index.
10. Disaster recovery
Recovery catalog plus production aliases. This route does not fail over a region or rebuild a primary.
V–Z governance
Twenty dump layers from monitoring, security, compliance, reliability, and AI safety, mapped onto /api/metrics, Supabase Auth, BotID, frozen form_instructions, and attorney review. POST /api/system/governance classifies. It does not scrape, page, inject a fault, rotate a secret, reindex, crawl, retrain, export, or file.
V monitoring → GET /api/metrics W security → GET /api/system/security X compliance → POST /api/system/audit Y reliability → GET /api/system/recovery Z safety → POST /api/system/review Chat → DeepSeek-R1 then Saul then Vistral RAG → 1024-d pgvector Rules → frozen form_instructions NLP → heading-nlp-v1 Merge → encoding + python-backend
V.1 Metrics
Prometheus text at /api/metrics. This route does not add a second metrics host or invent dump histogram names.
V.2 Structured logs
Audit catalog plus Vercel logs. This route does not ship a log index or move logs to a cold tier.
V.3 Traces
Fourteen wiring rows are the live trace map. This route does not open a trace backend.
V.4 Dashboards
Grafana already scrapes /api/metrics. This route does not create a dashboard or annotate a deploy.
V.5 Alerts
Incident playbook is the live alert map. This route does not page an on-call or open a ticket.
W.6 Zero-trust identity
Signed-in chat, BotID, and the shared AI rate limit. This route does not issue a mesh certificate.
W.7 Secrets
Secrets live in Vercel and Supabase. This route does not rotate a secret or open a vault.
W.8 Network isolation
Edge BotID plus HTTPS. This route does not segment a subnet or attach a private endpoint.
W.9 RBAC
Supabase Auth and isAdminUser. This route does not grant evidence access or mint a new role.
X.10 SOC2
Audit catalog plus merge gates. This route does not emit a SOC2 evidence pack.
X.11 ISO 27001
Security and threat catalogs are the live asset list. This route does not open a risk register.
X.12 ABA ethics
Attorney-review stages stay on Form Filler. This route does not show evidence to a model trainer.
X.13 GDPR/CCPA
This route classifies. It does not export a session or delete a row.
Y.14 Resilience
Chat fallback and recovery catalog. This route does not trip a circuit breaker.
Y.15 Chaos
Incident catalog classifies dump scenarios. This route does not kill a service or drop a message.
Y.16 Load testing
Performance catalog plus warm-desks. This route does not run a k6 burst.
Y.17 Auto-healing
Vercel plus the recovery catalog. This route does not reschedule a pod or replace a node.
Z.18 Alignment
Official instructions stay canonical. This route does not score a hallucination or rewrite a rule.
Z.19 Model lifecycle
Cheaper Hugging Face models first. This route does not start shadow inference or pin a registry tag.
Z.20 Safety filters
Attorney review is the live safety gate. This route does not auto-file or set humanReviewed.
Job log
Routed work will appear here after you sign in. Apply the system jobs SQL if the log stays empty.
Hide sidebars and newsletter prompts while reading.