Definition
The Automated Loan File Auditor is a headless agentic system designed to audit residential and commercial mortgage loan applications for regulatory compliance (e.g., TRID, HMDA), fraud indicators, and document completeness before manual underwriting review.
It implements the Hub-and-Spoke architecture to parallelize specialized verification tasks and uses Deterministic Hooks to ensure strict data integrity.
Architectural Workflow
1. Trigger (Runtime)
The system is launched as a Headless Runtime (e.g., a Node.js worker on Cloud Run) whenever a loan file is marked "Submitted" in the Loan Origination System (LOS).
- Command:
claude -p "Audit Loan Case #RE-8821 for TRID compliance" --output-format json - Environment: A secure VPC with access to an Encompass/LOS MCP Server.
2. The Coordinator (Hub)
The Coordinator agent (Claude 3.5 Sonnet) reads the loan application metadata and the list of uploaded documents.
- Role: It identifies which subagents are required based on the loan type (e.g., FHA vs. Conventional). It does not perform the audit; it orchestrates the specialists.
3. Subagent Delegation (Spokes)
The Coordinator spawns specialized subagents with restricted tools:
- Income Verifier: Analyzes uploaded 1040s and W2s (via Docling Markdown extraction) to calculate qualifying income.
- Compliance Auditor: Checks the "Loan Estimate" (LE) against the "Closing Disclosure" (CD) for fee tolerance violations.
- Fraud Detector: Compares the subject property address across the appraisal, title report, and insurance binder to identify inconsistencies.
4. Deterministic Enforcement (Hooks)
The host process implements a PreToolUse Hook to prevent unauthorized record modification.
- Policy: If the Compliance Auditor subagent attempts to trigger a
waive_feetool, the hook blocks the call. - Result: The agent can only flag errors or calculate variances; it is physically blocked by code from altering financial records.
Technical Stack
- Orchestration: Node.js + Claude Agent SDK.
- Normalization: Docling or Unstructured.io for converting scanned PDF tax returns into structured Markdown tables.
- Integration: Custom LOS MCP Server exposing tools like
fetch_loan_file,list_documents, andpost_audit_flag. - Validation: Zod schema enforcement to ensure the final audit report contains mandatory fields (e.g.,
risk_score,missing_docs_list).
Use Case: Fee Tolerance Violation Detection
- Event: A loan file has an Appraisal Fee increase of $200 between the initial LE and the final CD.
- Detection: The Compliance Auditor subagent identifies the increase exceeds the 0% tolerance limit for provider-selected fees.
- Reporting: The Coordinator flags the file as "High Risk - Potential TRID Violation."
- Action: The system automatically adds an audit note to the LOS and alerts the Underwriting Manager to process a cure.