← Back to Interaction Rule Set

CE-D03: Sequenced Claude Workflow

CONFIDENTIAL. PreFi, Inc. / Purpose Technology, Inc. d/b/a Purlend.

CLARITY ENGINE

Sequenced Claude Workflow Underwriting Brain + Trust Layer Build Process

PreFi, Inc. / Purpose Technology, Inc. d/b/a Purlend Operations Reference | Architecture + Build Team Version 1.0 | March 2026

CONFIDENTIAL

1. PURPOSE & AUDIENCE

This document is the operating guide for running the Clarity Engine's four-prompt Claude workflow. It tells every team member — BIX engineers, AI architects, mortgage SMEs, underwriting reviewers, and Claude skill builders — how to execute the workflow, what to produce at each step, who reviews it, what they check for, and when to advance to the next phase.

The goal is to convert the Clarity Engine vision into a set of structured, validated artifacts that feed directly into engineering sprints, Claude skill files, and agent architecture. This is not a one-time exercise — it is a repeatable pipeline.

1.1 Audience

Role Primary Sections What They Own David Kawata (CEO / Mortgage SME) All sections Final sign-off at every gate BIX Engineering (Pedro, Eduardo, Helio) Sections 3, 7, 8 Sprint backlog, schema implementation, test harness Krishna Malyala (CTO candidate) Sections 3, 4, 5, 8 Architecture integrity, skill/agent design, gate decisions Sydney Bocik (Chief of Staff) Sections 2, 6, 9 Workflow coordination, artifact tracking, gate scheduling Ben Sizemore (CIO / InfoSec) Sections 5, 6 Lineage security, data model, audit trail Mortgage SME / Underwriter Reviewer Sections 3, 4, 6 Rule correctness, family separation, formula validation Charlie Gann (Design) Section 7 (Nova / explanation layer) Borrower-facing output quality

2. WORKFLOW OVERVIEW

The workflow has four generation prompts and one red-team pass per major output. The phases must run in order. Gate reviews are mandatory — the team does not move forward without explicit sign-off.

Phase Prompts Output Gate A — Underwriting Brain Prompt 1 + Prompt 2 (red-team) Validated master PRD across all 4 loan families Gate 1: Underwriting Integrity B — AI Architecture Prompt 3 Skill registry, agent architecture, schemas, sprint plan Gate 2: Architecture Integrity C — Trust Layer Prompt 4 + Prompt 4 red-team Decision Lineage Engine spec, Trust API, Clarity Ledger Gate 3: Trust Integrity D — Build Packaging Extraction pass Rules, formulas, schemas, skills, agents, tests broken out Engineering intake review E — Sprint Planning Conversion pass BIX sprint backlog by module Sprint 1 kickoff

Dependency: Phases run in strict sequence. Prompt 3 cannot start until Gate 1 passes. Prompt 4 cannot start until Gate 2 passes. BIX sprint planning cannot start until Gate 3 passes.

3. EXECUTION STEPS

PHASE A Underwriting Brain

Step 1 — Run Prompt 1: Build the Underwriting Brain Generate the full underwriting and optimization architecture across all four loan families.

Scope

Expected Output

Save Artifact As 01_clarity_engine_master_prd.md

Review Team Reviewer What to Check David (mortgage SME) Family separation is clean. No blended rules. VA treated as VA, not as agency. Krishna (AI architect) Structure supports skill decomposition. No freeform reasoning in rule sections. Pedro / Eduardo (BIX) Data model is buildable. Formulas are explicit, not described.

Mandatory Checks Before Advancing to Step 2

Step 2 — Run Prompt 2: Red-Team the Underwriting Brain Stress-test the Prompt 1 output against the standards of GSE auditors, STRATMOR, Rocket, UWM, loanDepot, and regulated AI reviewers.

Expected Output

Save Artifacts As 02_red_team_findings_underwriting.md 03_clarity_engine_master_prd_revised.md

What the Red-Team Pass Must Cover Category Check Ambiguous rules Any rule that could be interpreted two ways must be disambiguated with explicit logic Missing formulas Any decision that references math without providing the formula must be flagged and fixed Hard stop vs conditional Every denial must be labeled: hard stop (no path forward) vs conditional (path exists with compensating factors) Source hierarchy Every rule must trace to a named source: Fannie Mae Selling Guide, HUD 4000.1, VA Pamphlet 26-7, lender overlay, etc. Family contamination Any place where logic from one family could be misconstrued to apply to another must be isolated Explanation risk Any decision explanation that could confuse or mislead a borrower must be rewritten

GATE 1 — Underwriting Integrity Gate: Gate 1 sign-off required before moving to Step 3. David must confirm family logic is clean, formulas are complete, and source hierarchy is explicit. This gate cannot be skipped.

PHASE B AI Architecture

Step 3 — Run Prompt 3: Convert to AI Architecture Convert the revised PRD into a build-ready AI system architecture. This is where the mortgage rules become Claude skills, agents, and JSON schemas.

Expected Output

Save Artifact As 04_clarity_engine_ai_architecture.md

Architecture Integrity Checks Check Correct Pattern Failure Pattern Skill scope Each skill handles one family's rules or one function Single skill covering multiple families or multiple functions Deterministic separation Formulas, eligibility checks, DTI computation = deterministic services Formulas delegated to freeform LLM reasoning Agent constraints Agents propose; control validates; execution executes Agents with open-ended action authority Schema buildability Every schema has typed fields, validation rules, and examples Schemas described in prose without structure Sprint order Core schemas first, then formulas, then family rules, then optimization, then lineage Lineage or optimization before core data objects

GATE 2 — Architecture Integrity Gate: Gate 2 sign-off required before moving to Step 4. Krishna must confirm skill boundaries are clean, deterministic decisions stay deterministic, and schemas are implementable. David confirms mortgage accuracy is preserved through the conversion.

PHASE C Trust Layer

Step 4 — Run Prompt 4: Design the Decision Lineage Engine Design the Clarity Ledger — the full decision provenance and trust layer for the Clarity Engine. Every recommendation must have traceable mathematical, policy, explanation, and override provenance.

Purlend-Specific Context — Prepend Before Prompt 4 Add this block at the top of Prompt 4 before running:

PURLEND CONTEXT:

Decision Lineage Engine internal name: Clarity Ledger Primary data primitive: Borrower Intelligence Ledger (persistent, not point-in-time) State machine: Always Approved (Approved / Conditional / Not Yet) — Lineage must record every state transition, triggering rule, and inputs Agent architecture: agents propose / control validates / execution executes — Record which layer produced each object and which validated it Blockchain roadmap: Phase 1 (now): SHA-256 hash every ledger event Phase 2 (12-24 months): Anchor events to blockchain Phase 3 (24+ months): Smart contract execution on state changes Family separation: absolute — Conventional / FHA / VA / DSCR cannot cross Trust API external name: Clarity Ledger API — Partners query decision provenance without accessing raw borrower data VA Module PRD v1.0 = reference implementation for worked examples

Expected Output

Save Artifact As 05_decision_lineage_engine_spec.md

Step 5 — Run Prompt 4 Red-Team Pass Stress-test the Clarity Ledger spec against the hardest trust and compliance failure scenarios.

Save Artifacts As 06_red_team_findings_lineage.md 07_decision_lineage_engine_spec_revised.md

Trust Layer Red-Team Checks Category Check Provenance completeness Every decision object links back to a rule, formula, table, or human override — no orphan decisions Replay feasibility Given only the lineage record, can any past decision be reproduced exactly? Always Approved state transitions Every state change (Approved → Conditional, etc.) has recorded inputs, triggering rule, and agent/human attribution Overlay versioning Every overlay is versioned — changing an overlay does not silently alter past decisions Agent handoff constraints Agent-to-agent handoffs are logged with explicit scope transfer Explanation drift risk Can a future explanation claim conflict with the lineage record? Must be impossible. Blockchain Phase 1 coverage Every ledger event has a deterministic hash that will survive anchoring in Phase 2 without re-architecting Partner API safety Trust API returns provenance without exposing PII or raw borrower data

GATE 3 — Trust Integrity Gate: Gate 3 sign-off required before any implementation work begins. Krishna + Ben Sizemore confirm lineage is complete and replay is feasible. David confirms operational realism. This gate unlocks the build.

4. FINAL ARTIFACT STACK

At the end of the workflow, the team produces seven core documents. These become the source material for everything that follows.

Artifact File Name Primary Consumer Status Master PRD (original) 01_clarity_engine_master_prd.md Review input Gate 1 input Red-team findings — underwriting 02_red_team_findings_underwriting.md SME review Gate 1 review Master PRD (revised) 03_clarity_engine_master_prd_revised.md BIX, Krishna Gate 1 output → Gate 2 input AI architecture 04_clarity_engine_ai_architecture.md BIX, Krishna Gate 2 output → Gate 3 input Decision Lineage Engine spec (original) 05_decision_lineage_engine_spec.md Review input Gate 3 input Red-team findings — lineage 06_red_team_findings_lineage.md Krishna, Ben Gate 3 review Decision Lineage Engine spec (revised) 07_decision_lineage_engine_spec_revised.md BIX, Krishna, Ben Gate 3 output → Build input

5. KNOWLEDGE REPOSITORY STRUCTURE

All artifacts from the workflow feed into this folder structure. BIX and future Claude skill builders must maintain this structure — it is the knowledge repository the Clarity Engine's agents query.

/clarity-engine /docs /prd 01_clarity_engine_master_prd.md 03_clarity_engine_master_prd_revised.md /architecture 04_clarity_engine_ai_architecture.md /trust 05_decision_lineage_engine_spec.md 07_decision_lineage_engine_spec_revised.md /reviews 02_red_team_findings_underwriting.md 06_red_team_findings_lineage.md

/rules /conventional /fha /va /dscr /overlays

/formulas /common /conventional /fha /va /dscr

/schemas borrower.json deal.json program_rule.json constraint.json optimization_move.json scenario.json recommendation.json explanation.json audit_event.json lineage_event.json overlay.json

/skills borrower_profile_skill.md property_intelligence_skill.md conventional_underwriting_skill.md fha_underwriting_skill.md va_underwriting_skill.md dscr_underwriting_skill.md constraint_detection_skill.md optimization_skill.md scenario_generation_skill.md ranking_skill.md explanation_skill.md audit_trace_skill.md mortgage_math_skill.md [COMPLETE — v1.0 delivered]

/agents intake_agent.md qualification_agent.md optimization_agent.md scenario_agent.md recommendation_agent.md explanation_agent.md audit_agent.md compliance_agent.md

/lineage rule_reference_schema.md formula_reference_schema.md table_reference_schema.md scenario_trace_schema.md explanation_trace_schema.md overlay_trace_schema.md human_decision_trace_schema.md agent_trace_schema.md

/ledger event_taxonomy.md decision_ledger_spec.md

/replay replay_engine_spec.md

/tests /unit /formula /family_separation /scenario /overlays /lineage /regression

Already Delivered: The following are complete and stored in /skills: va_underwriting_skill.md (Clarity_Engine_VA_Module_SKILL.md) and mortgage_math_skill.md (Clarity_Engine_Math_SKILL.md). These are the reference implementations. All future skill files follow the same pattern.

6. GATE REVIEW CHECKLISTS

Gate reviews are mandatory. Each gate has a sign-off checklist. All items must be checked before the phase advances. David signs off at every gate.

Gate 1 — Underwriting Integrity # Check Item Owner Pass / Fail 1 Conventional, FHA, VA, and DSCR rules are in separate sections with no cross-contamination David

2 All core formulas (DTI, GMI, LTV, PITI, DSCR, residual income) are expressed as pseudocode David + BIX

3 Ginnie Mae appears in securitization context only — zero borrower underwriting rules David

4 VA DTI 41% is labeled as benchmark (triggers residual income test), not hard stop David

5 FHA MIP cancellation rules are correct (not 80% LTV — based on origination LTV) David

6 DSCR qualification uses property PITIA, not borrower personal DTI David

7 Overlays are documented separately from base program rules David

8 Every hard stop is labeled as such; every conditional has an explicit override path David + Krishna

9 Source hierarchy is explicit for every rule (Fannie Mae, HUD 4000.1, VA 26-7, lender overlay) David

10 Red-team findings from Prompt 2 are all addressed in the revised PRD David + Krishna

Gate 2 — Architecture Integrity # Check Item Owner Pass / Fail 1 Each Claude skill handles exactly one family's rules or one cross-family function Krishna

2 Formula computation is a deterministic service — not delegated to freeform LLM reasoning Krishna

3 Agent architecture follows: propose → validate → execute (no open-ended agent action authority) Krishna

4 VA Module PRD v1.0 is the reference implementation — new skills follow its structure exactly Krishna + David

5 All schemas have typed fields, validation rules, and at least one worked example BIX

6 Sprint order follows: schemas → formulas → family rules → optimization → lineage BIX

7 Clarity Ledger integration points are specified (not TBD) before sprints begin Krishna + Ben

8 Mortgage accuracy is preserved through the PRD-to-architecture conversion (no logic dropped) David

Gate 3 — Trust Integrity # Check Item Owner Pass / Fail 1 Every decision object has traceable provenance (rule, formula, table, or human override) Krishna

2 The Always Approved state machine transitions are fully recorded in the lineage layer Krishna + Ben

3 Given only the lineage record, any past decision can be replayed and reproduced exactly Krishna

4 Overlays are versioned — a changed overlay does not alter past decision records Ben

5 Every ledger event has a deterministic SHA-256 hash compatible with Phase 2 blockchain anchoring Ben

6 Trust API (Clarity Ledger API) returns provenance without exposing PII or raw borrower data Ben + Krishna

7 Agent-to-agent handoffs are logged with explicit scope transfer records Krishna

8 Red-team findings from Prompt 4 are all addressed in the revised lineage spec Krishna + David

7. CLAUDE SKILL FILE DESIGN STANDARD

After Gate 3, the team extracts individual skill files from the architecture documents. Every skill file follows the same structure. The VA Module Skill (Clarity_Engine_VA_Module_SKILL.md) and Mortgage Math Skill (Clarity_Engine_Math_SKILL.md) are the reference implementations.

7.1 Required Sections in Every Skill File

Section Contents Why Required

SKILL PURPOSE

One-paragraph description of what the skill does and what it does not do Prevents scope creep and misuse

ALLOWED SCOPE

Explicit list of what the skill is permitted to compute or decide Constrains agent invocation

FORBIDDEN SCOPE

Explicit list of what the skill cannot do, with cross-references to the correct skill Prevents family contamination

INPUTS

Typed field list, validation rules, and source (which agent or data object provides this) Enables deterministic invocation

RULE FAMILIES ALLOWED

Which mortgage families this skill may reference Hard family separation enforcement

OUTPUTS

Typed field list, rounding policy, and format for each output value Clarity Ledger lineage compatibility

VALIDATIONS REQUIRED

Input checks that must pass before execution Prevents bad-input propagation

LINEAGE EVENTS EMITTED

List of Clarity Ledger events this skill must emit on every invocation Audit and replay compliance

WORKED EXAMPLES

At least 2 fully traced examples with intermediate steps BIX test vector source

GUARDRAILS

Things the skill must never do regardless of inputs Safety and compliance

7.2 Skill Registry — Target State

Skill File Status Reference Implementation mortgage_math_skill.md

COMPLETE — v1.0

Clarity_Engine_Math_SKILL.md va_underwriting_skill.md

COMPLETE — v1.0

Clarity_Engine_VA_Module_SKILL.md conventional_underwriting_skill.md PENDING — Gate 1 required Build from revised PRD Section: Conventional fha_underwriting_skill.md PENDING — Gate 1 required Build from revised PRD Section: FHA dscr_underwriting_skill.md PENDING — Gate 1 required Build from revised PRD Section: DSCR constraint_detection_skill.md PENDING — Gate 2 required Build from AI architecture doc optimization_skill.md PENDING — Gate 2 required Build from AI architecture doc scenario_generation_skill.md PENDING — Gate 2 required Build from AI architecture doc ranking_skill.md PENDING — Gate 2 required Build from AI architecture doc explanation_skill.md PENDING — Gate 2 required Build from AI architecture doc audit_trace_skill.md PENDING — Gate 3 required Build from lineage spec borrower_profile_skill.md PENDING — Gate 2 required Build from AI architecture doc property_intelligence_skill.md PENDING — Gate 2 required Build from AI architecture doc

8. ENGINEERING SPRINT PLAN

This is the 12-sprint sequence for BIX. The order is non-negotiable — later sprints have hard dependencies on earlier ones. Do not move a sprint forward until its predecessors have passed their gate reviews.

Sprint Focus Deliverable Gate Dependency Sprint 1 Core schemas and canonical data objects All /schemas/*.json files implemented and validated Gate 2 Sprint 2 Formula library and math module Clarity_Engine_Math_BIX_Implementation_Guide v1.0 — all 21 functions, all 10 test vectors passing

COMPLETE

Sprint 3 Rule registry and family module scaffolding Family module shell for each of Conv, FHA, VA, DSCR with routing logic Gate 1 Sprint 4 Conventional + FHA underwriting modules conv_rule_engine.v1, fha_rule_engine.v1 — all test cases passing Gate 1 + Sprint 3 Sprint 5 VA underwriting module va_rule_engine.v1 — all 10 VA workbook test cases passing (TC01–TC10) COMPLETE — VA Module PRD v1.0 delivered Sprint 6 DSCR configurable module dscr_rule_engine.v1 — configurable overlay parameters, DSCR tier logic Gate 1 + Sprint 3 Sprint 7 Constraint detection + optimization moves constraint_engine.v1, optimization_move_registry.v1 Gate 2 + Sprint 4 Sprint 8 Scenario generation + ranking scenario_engine.v1, ranking_engine.v1 Gate 2 + Sprint 7 Sprint 9 Explanation layer (Nova) explanation_engine.v1 — plain language output for all 4 families Gate 2 + Sprint 8 Sprint 10 Decision Lineage Engine (Clarity Ledger) clarity_ledger.v1 — all 14 lineage objects, SHA-256 hashing Gate 3 Sprint 11 Trust API + replay engine clarity_ledger_api.v1, replay_engine.v1 Gate 3 + Sprint 10 Sprint 12 Regression harness + agent integration Full test suite across all families; agent handoff integration All prior sprints

Sprint 2 Note: The Math Module (Sprint 2) is already delivered — Clarity_Engine_Math_BIX_Implementation_Guide_v1.docx and Clarity_Engine_Math_SKILL.md are complete. Sprint 5 VA module is also delivered via VA Module PRD v1.0. BIX can begin both sprints immediately without waiting for any gate.

9. TEAM ROLES DURING THE WORKFLOW

Role Workflow Responsibilities Review Focus David Kawata (CEO / Mortgage SME) Runs all four prompts with Krishna present. Signs off at every gate. Final word on mortgage rule accuracy. Rule correctness, edge cases, family separation, operational realism, source hierarchy Krishna Malyala (CTO candidate) Co-runs architecture session. Owns Gate 2 and Gate 3 sign-off. Produces skill and agent specs. Skill boundaries, deterministic vs generative separation, schema quality, sprint order, agent scope BIX (Pedro, Eduardo, Helio) Implements sprint backlog against all delivered specifications. Produces test vectors. Implementation feasibility, schema buildability, test coverage, service boundaries Sydney Bocik (Chief of Staff) Coordinates gate scheduling. Tracks artifact completion. Routes documents to reviewers. Artifact completeness, reviewer availability, gate readiness Ben Sizemore (CIO / InfoSec) Reviews lineage security at Gate 3. Confirms SHA-256 hash design. Reviews Trust API data exposure. Traceability, audit logging, PII controls, override logic, blockchain roadmap compatibility Charlie Gann (Design) Reviews Nova explanation outputs after Sprint 9. Confirms borrower-facing language meets design standards. Explanation clarity, tone, borrower experience, explanation drift risk

10. HOW TO REVIEW CLAUDE OUTPUTS WELL

The most common mistake teams make with AI-generated architecture is asking 'does this sound smart?' That is the wrong question.

The Right Questions Reviewer Right Question Engineer Can I build from this without guessing at anything? Underwriter / SME Can I find where this is wrong, and is the error surface visible? QA / Test engineer Can I write a test case for every decision this system makes? Compliance / auditor Can I trace every decision back to a source and a human or rule? AI architect Is it clear what is deterministic vs what is AI-generated? Is the boundary enforced? Agent designer Can a future agent consume this safely without misinterpreting its scope?

Production Handoff Rule Claude generates: Architecture, schemas, rules, tests, explanations, and lineage design. These are starting points for human review.

Humans validate: Product family logic, source mapping, formula accuracy, exceptions, overlays, and production feasibility. Nothing ships without this step.

Engineers implement: Deterministic services, registries, APIs, ledgers, and test harnesses. Against the validated spec — not directly from Claude output.

CRITICAL RULE: Claude outputs do not go straight into production logic. Ever. The workflow exists precisely because the gap between 'sounds correct' and 'is correct' matters in mortgage lending.

11. WHAT COMES NEXT

After Gate 3, the team extracts and packages build artifacts. This is Phase D.

Phase D — Build Packaging Extract From Extract To Artifacts Revised PRD (artifact 03) /rules/ and /formulas/ Mortgage family modules, formulas, rule matrices, baseline eligibility logic Revised PRD (artifact 03) /decision_trees/ Scenario outputs, optimization move logic, explanation templates AI Architecture (artifact 04) /skills/ Skill registry — one .md file per skill per the Section 7 standard AI Architecture (artifact 04) /agents/ Agent definitions — one .md file per agent AI Architecture (artifact 04) /schemas/ All 11 JSON schemas with typed fields and examples AI Architecture (artifact 04) /roadmap/ 12-sprint backlog in engineering-ready format Lineage Spec (artifact 07) /lineage/ and /ledger/ and /replay/ All lineage schemas, event taxonomy, decision ledger spec, replay engine spec Lineage Spec (artifact 07) /trust_api/ Clarity Ledger API spec for institutional partners

Recommended Next Artifact The highest-value next artifact after this workflow guide is the Master Review Checklist — a scoreable quality gate document the team uses to assess each Claude output before advancing. It should score:

— End of Document — CONFIDENTIAL — PreFi, Inc. / Purpose Technology, Inc. d/b/a Purlend