MENTENSOR: edge monolith, deterministic AI intake and agent discovery
Production architecture powering mentensor.eu on Cloudflare Workers with Static Assets, D1 SQL telemetry, Workers AI fallback and machine-readable agent discovery protocols.
[ 01. BUSINESS CONTEXT ]
What needed to change
An engineering practice focused on edge infrastructure and deterministic AI should demonstrate those architectural decisions in its own production environment rather than through static claims alone. The system needed to serve a bilingual static interface with zero origin server maintenance, handle structured prospect inquiries without pricing or scope hallucinations, log edge telemetry in real time, and expose clean, low-token representations to external AI crawlers and in-browser agents.
[ 02. SYSTEM ARCHITECTURE ]
How the system fits together
[ Client / Browser / External AI Agent ]
│
[ Cloudflare Edge Worker (run_worker_first) ]
├── Accept: text/markdown → serves /index.md + RFC 8288 Link headers
├── Static routes → Astro 5 SSG via env.ASSETS + Speculation Rules
├── /api/telemetry → Anycast POP diagnostics + Cloudflare D1 logging
├── /api/contact → Brief validation + structured terminal receipt
└── /api/inquiry → Deterministic Intake Engine (JEV SEIA)
├── Domain boundary filter (rejects off-topic requests)
├── Verified knowledge base match (0 LLM tokens)
└── Fallback classification → Workers AI (Llama 3.1 8B) [ 03. ARCHITECTURAL DECISIONS ]
Scope and key decisions
1. Unify static delivery and edge APIs in one deployment unit. Migrating from separate static hosting to Cloudflare Workers with Static Assets put routing, security headers, D1 database bindings and Workers AI inference into a single edge monolith. 2. Prevent hallucinations on commercial and technical questions. The inquiry engine checks domain boundaries and matches verified knowledge base entries first. Generative AI (Llama 3.1 8B on Workers AI) is invoked only when a question requires fallback classification or synthesis. 3. Serve both human visitors and autonomous agents. Middleware inspects the Accept header to return pure Markdown for AI agents, attaches RFC 8288 / RFC 9727 discovery headers (.well-known/agent-card.json, mcp/server-card.json, llms.txt), and registers WebMCP tools in the browser context. 4. Keep main-thread work predictable. Below-the-fold sections use CSS content-visibility containment, navigation uses the Speculation Rules API, and interactive scripts yield to the main thread.
[ 04. RESULTS & DELIVERY STATUS ]
What the work delivered
When this approach applies
Relevant when a B2B technology company wants its public platform to handle high-speed global delivery, deterministic inquiry qualification and structured discoverability for AI search and autonomous agents.
[ 05. TECHNOLOGIES & TOOLS ]
Discuss your system
Describe the process, current constraints and result you need.