Request routing, CORS, cron self-healing, health monitoring. Endpoints for AI, batch, contract verify/list, company profiles, anchor operations.
Architecture specification
Document Intelligence stack
Edge-hosted document governance within XXXIII.io. Static Pages frontend, Worker API, Workers AI agents, KV proof store, and optional XRPL/IPFS anchoring. No origin servers in the production path.
System topology
CLOUDFLARE EDGE
docs.unykorn.org (Pages) doc-intel-api (Worker)
| |
+----------------+-------------------+
|
+---------------+---------------+
| | |
Workers AI DOC_INTEL_KV XRPL / IPFS
(6 agents) (proof index) (optional anchor)
| Component | Implementation | Exposure | Status |
|---|---|---|---|
| Pages frontend | Static HTML — overview, workspace, generate, verify | docs.unykorn.org | LIVE |
| Worker API | api.js router — health, AI, contract, company, anchor | docs.unykorn.org/api/* | LIVE |
| Workers AI | Llama 3.1 8B · BGE Base v1.5 embeddings | Internal binding | LIVE |
| KV store | DOC_INTEL_KV — proofs, profiles, embeddings | Internal binding | LIVE |
| XRPL anchor | Pure JS Ed25519 · AccountSet + Memo | s1.ripple.com submit | PARTIAL |
| IPFS pin | Kubo via Cloudflare Tunnel | Tunnel-dependent | PARTIAL |
| Cron recovery | */5 * * * * anchor queue retry | Internal trigger | LIVE |
Worker modules
Three JavaScript modules, approximately 2,000 lines total, zero npm dependencies on the worker runtime.
Six agents, thirteen templates, RAG pipeline, company profile injection, contract hashing and proof storage.
Binary codec and Ed25519 signing for AccountSet transactions with structured Memo payloads.
Six-agent pipeline
Structured field extraction from raw document text.
Template-based agreement generation with profile injection.
ESIGN, UETA, Reg D, FINRA, KYC/AML review.
Final QA — completeness and enforceability.
RAG-backed document Q&A.
UCC, ICC, Basel, ISDA for banking instruments.
Eight-step proof record
| # | Stage | Operation | Output |
|---|---|---|---|
| 01 | Input | PDF, text, or template via workspace | Raw content |
| 02 | Draft | Drafter agent + company profile | Contract text |
| 03 | Compliance | Compliance agent review | Reviewed draft |
| 04 | Hash | SHA-256 deterministic fingerprint | Hash + contract_id |
| 05 | XRPL | AccountSet + Memo when configured | Transaction hash |
| 06 | Store | Dual-index KV record | Proof record |
| 07 | IPFS | CID pin via Kubo tunnel | Content ID |
| 08 | Verify | Public /api/contract/verify | Verification result |
Template catalog (13)
| Template | Class | Primary fields |
|---|---|---|
| NDA | Standard | parties, confidentiality period, jurisdiction |
| LOI | Standard | transaction description, exclusivity, due diligence |
| SUBSCRIPTION | Standard | investment amount, accreditation, risk acknowledgment |
| CONSULTING | Standard | scope, compensation, IP ownership |
| TERM_SHEET | Standard | valuation, equity percentage, liquidation preference |
| SIDE_LETTER | Standard | reference agreement, modifications |
| BROKER_AGREEMENT | Standard | commission rate, FINRA disclosures |
| OPERATING_AGREEMENT | Standard | members, capital contributions, management |
| SBLC | Capital | issuing bank, beneficiary, ICC reference |
| MTN | Capital | face value, coupon, maturity, ISIN |
| CAPITAL_TERM_SHEET | Capital | instrument type, principal, yield, term |
| FUNDING_RIDER | Capital | disbursement schedule, conditions precedent |
| COLLATERAL_VERIFICATION | Capital | asset description, custodian, valuation date |
EDITORIAL catalog maintained in worker; human review required before execution
API surface
| Method | Endpoint | Purpose |
|---|---|---|
| GET | /api/health | System health and version |
| POST | /api/ai/generate | Generate document and anchor proof |
| POST | /api/ai/extract | Structured field extraction |
| POST | /api/ai/comply | Compliance review |
| POST | /api/ai/capital-comply | Capital instrument review |
| POST | /api/ai/chat | RAG-backed chat |
| POST | /api/batch | Batch generation and anchoring |
| GET | /api/contract/verify | Verify proof by id or hash |
| GET | /api/contract/list | List anchored proofs |
| POST | /api/company | Save company profile |
| GET | /api/company/:id | Retrieve company profile |
| POST | /api/anchor | Manual XRPL anchor |
| POST | /api/anchor/ipfs | IPFS pin + dual anchor |
XXXIII.io integration
Document Intelligence shares protocol conventions with GMIIE and routes settlement through x402 where metered. LPS-1 remains the authority for author-edition roots; this stack does not merge literary IP with agreement records.