Edge-Native
Sovereign Stack
Zero servers. Zero npm dependencies. Three worker modules totaling ~2,000 lines of pure JavaScript running on Cloudflare's global edge — backed by XRPL mainnet blockchain anchoring and IPFS content-addressed storage.
System Diagram
6-Agent AI Pipeline
Every document passes through a multi-agent chain — each agent is purpose-built with its own system prompt, temperature, and validation logic.
Extractor
Reads raw document text, extracts ALL structured fields into clean JSON — parties, dates, financial terms, risk flags, jurisdiction.
Drafter
Generates professional legal documents from 13 templates with company profile injection, governing law, signature blocks, and compliance language.
Compliance
Reviews against ESIGN, UETA, SEC Reg D, FINRA rules, KYC/AML, CCPA/GDPR. Max 8 findings, CRITICAL-first severity ordering.
Reviewer
Final quality pass — catches issues other agents missed. Checks completeness, internal consistency, legal soundness, and enforceability.
Chat
Conversational interface with full RAG context. Answers questions about uploaded documents, explains clauses, suggests improvements.
Capital Compliance
Specialized banking & trade finance review. Validates against UCC Article 5/9, ICC UCP 600, ISP98, URDG 758, Basel III/IV, SEC 144/144A, ISDA, Dodd-Frank, AML/BSA, OFAC.
Contract Anchoring — 8 Steps
Every generated contract is cryptographically fingerprinted and anchored to the XRPL mainnet blockchain. Immutable. Verifiable. Sovereign.
| # | Stage | Operation | Output |
|---|---|---|---|
| 01 | Input | Accept PDF upload, text input, or template selection via AI Hub | Raw Content |
| 02 | AI Generate | Drafter Agent produces document from template + company profile + instructions | Contract Text |
| 03 | Compliance | Compliance Agent reviews for ESIGN/UETA/SEC/FINRA — flags issues by severity | Reviewed |
| 04 | SHA-256 Hash | Deterministic fingerprint of contract content → 64-char hex hash | Hash + Contract ID |
| 05 | XRPL Anchor | AccountSet transaction with structured Memo (v2 format) signed via Ed25519 | TX Hash |
| 06 | KV Store | Dual-indexed proof record: by contract_id and by hash (reverse lookup) | Proof Record |
| 07 | IPFS Pin | Content-addressed push to Kubo node via Cloudflare Tunnel | CID |
| 08 | Verify | Public verification via /api/contract/verify?id= or ?hash= — full proof chain | Immutable |
3 Worker Modules · ~2,000 Lines · Zero Dependencies
API Router
20+ endpoint handlers, CORS, request routing, cron self-healing queue, health monitoring. Routes: /api/health, /api/ai/generate, /api/ai/extract, /api/ai/comply, /api/ai/chat, /api/batch, /api/contract/verify, /api/contract/list, /api/company/*, /api/anchor/*, and more.
AI Agent System
6 agents (Extractor, Drafter, Compliance, Reviewer, Chat, Capital Compliance), 13 document templates (8 standard + 5 capital instruments), RAG pipeline with embeddings, company profiles, contract hashing + proof storage, capital compliance review with banking/UCC/ICC/Basel expertise.
XRPL Blockchain
Pure JavaScript XRPL binary codec + Ed25519 signing. Zero npm dependencies. Builds, signs, and submits AccountSet transactions with structured Memo payloads to XRPL mainnet. Self-contained cryptographic stack.
13 Document Templates
Each template defines required fields and injects company profile data automatically.
| Template | Description | Key Fields |
|---|---|---|
| Standard Templates | ||
| NDA | Non-Disclosure Agreement | parties, effective_date, confidentiality_period, jurisdiction |
| LOI | Letter of Intent | parties, transaction_description, exclusivity_period, due_diligence |
| SUBSCRIPTION | Securities Subscription (Reg D) | investment_amount, security_type, accreditation_status, risk_acknowledgment |
| CONSULTING | Professional Services Engagement | scope_of_work, compensation, term, ip_ownership, non_compete |
| TERM_SHEET | Investment / Deal Terms | valuation, investment_amount, equity_percentage, liquidation_preference |
| SIDE_LETTER | Supplemental Agreement | reference_agreement, modifications, effective_date |
| BROKER_AGREEMENT | Commission / Referral Arrangement | commission_rate, payment_terms, exclusivity, finra_disclosures |
| OPERATING_AGREEMENT | LLC Governance | members, capital_contributions, profit_distribution, management_structure |
| 🏦 Capital Instruments | ||
| SBLC | Standby Letter of Credit | issuing_bank, beneficiary, amount, expiry_date, icc_reference |
| MTN | Medium Term Note | issuer, face_value, coupon_rate, maturity_date, isin |
| CAPITAL_TERM_SHEET | Pre-Funding Capital Terms | instrument_type, principal_amount, yield, term, governing_law |
| FUNDING_RIDER | Supplemental Funding Mechanics | funding_source, disbursement_schedule, conditions_precedent |
| COLLATERAL_VERIFICATION | Third-Party Asset Verification | asset_description, custodian, verification_method, valuation_date |
All Edge. All Serverless.
| Service | Technology | Exposure |
|---|---|---|
| Worker API | Cloudflare Workers · doc-intel-api v2.2.0 | docs.unykorn.org/api/* |
| Pages Frontend | Cloudflare Pages · 12 static HTML pages | docs.unykorn.org |
| Workers AI | Llama 3.1 8B (chat) · BGE Base v1.5 (embed) | Internal binding |
| KV Store | Cloudflare KV · DOC_INTEL_KV | Internal binding |
| XRPL Mainnet | Pure JS Ed25519 · AccountSet + Memo | s1.ripple.com (submit) |
| IPFS Node | Kubo v0.39.0 · Docker · gtp_ipfs | Cloudflare Tunnel |
| Cron Trigger | */5 * * * * · Self-healing anchor queue | Internal trigger |
No origin servers. No npm dependencies. No Docker in production. The Worker runs entirely on Cloudflare's global edge network. IPFS node is tunneled through Cloudflare for sovereignty anchoring only.
20+ Endpoints
| Method | Endpoint | Purpose |
|---|---|---|
| GET | /api/health | System health, version, service connectivity |
| POST | /api/ai/generate | Generate document + auto-anchor to XRPL |
| POST | /api/ai/extract | AI extraction of structured fields from document |
| POST | /api/ai/comply | Compliance review (ESIGN/UETA/SEC/FINRA) — auto-routes capital types |
| POST | /api/ai/capital-comply | Capital compliance (UCC/ICC/Basel/ISDA/OFAC) |
| POST | /api/ai/chat | Conversational chat with RAG context |
| POST | /api/batch | Batch document generation + per-doc anchoring |
| GET | /api/contract/verify | Verify contract proof by ID or hash |
| GET | /api/contract/list | List all anchored contract proofs |
| POST | /api/company | Save company profile for template injection |
| GET | /api/company/:id | Retrieve company profile |
| POST | /api/anchor | Direct XRPL anchor (manual) |
| POST | /api/anchor/ipfs | IPFS pin + XRPL dual anchor |