Skip to main content
RagOn

Air-Gapped RAG. Zero Cost & Zero Leaks.

RagOn (rag-on) freely shares Aldeon’s complete production RAG architecture: inspect hybrid BM25 + 3-gram math live in X-Ray mode, generate 7-file cross-stack starter kits, and audit your corpus client-side with strict Zero-Leak security.

$0 / Query
Deterministic Extractive Mode
Zero LLM token cost + optional guarded adapter
< 2 ms
Hybrid Edge Retrieval
Field BM25 + char 3-gram cosine
7-File + CLI
Cross-Stack Replication Kit
React, Next, Hono, FastAPI, Expo + SKILL.md
0 Leaks
Security is the Law (Zero-Leak)
FNV-1a hashes + 10-rule output shield
Pillar 1 • Cross-Stack Replication Starter Kit (7 Files + CLI)

Replicate RagOn Into Any Product in Seconds

Pick your target stack, language mode, and synthesis strategy to generate all 7 production files (Corpus, Guardrails, Hybrid Engine, API Route, UI Widget, CI Security Test, and SKILL.md) or download the standalone CLI scaffolder.

Active Target Path:
src/lib/rag/ragCorpus.ts
100% sanitized: zero real keys, emails, or workstation paths.
// src/lib/rag/ragCorpus.ts — Air-Gapped Compile-Time Corpus for MyRagProduct
// Zero runtime disk reads, zero secrets, internal-only citation routes.
export interface RagCitation {
  label: { en: string; pt: string };
  route: `/${string}`; // Enforced internal web/app path only
}

export interface RagKnowledgeChunk {
  id: string;
  scope: 'myragproduct' | 'billing' | 'security';
  category: 'overview' | 'pricing' | 'features' | 'security';
  title: { en: string; pt: string };
  content: { en: string; pt: string };
  keywords: string[];
  citations: RagCitation[];
  followUps: { en: string[]; pt: string[] };
}

export const WEB_RAG_CORPUS: RagKnowledgeChunk[] = [
  {
    id: 'myragproduct-overview',
    scope: 'myragproduct',
    category: 'overview',
    title: { en: 'MyRagProduct Platform Overview', pt: 'Visão Geral do MyRagProduct' },
    content: {
      en: 'MyRagProduct runs with strict tenant isolation, TLS 1.3 encryption, and zero cross-app tracking.',
      pt: 'O MyRagProduct opera com isolamento estrito, criptografia TLS 1.3 e zero rastreamento cruzado.',
    },
    keywords: ['myragproduct', 'overview', 'security', 'privacy'],
    citations: [{ label: { en: 'Product Home', pt: 'Página Inicial' }, route: '/' }],
    followUps: {
      en: ['What are MyRagProduct pricing plans?', 'How does MyRagProduct protect privacy?'],
      pt: ['Quais são os planos do MyRagProduct?', 'Como o MyRagProduct protege os dados?'],
    },
  },
];
Pillar 2 • Live 6-Stage Pipeline X-Ray Playground (100% Client-Side)

Inspect exactly how every query is guarded, scored, and grounded

Test grounded queries, mixed PT/EN phrases, prompt injections, or external web probes over the sanitized OrbitDesk demo corpus and inspect BM25 + 3-gram math live.

STAGE 1 • GUARDRAILPASSED
NFD: how much does orbitdesk pro cost?
STAGE 2 • LANGUAGEen
PT=0.0 · EN=12.0
STAGE 3 • TOKENS, SYNONYMS & SCOPEScope: billing · 31 3-grams
orbitdeskprocost
STAGE 4 • HYBRID BM25 + 3-GRAM RANKINGGate >= 4.2
#1 OrbitDesk Plans: Free Core vs. Pro ($12/mo)17.73
BM25 6 + Anchor 5.6 + 3Gram 2.73 + Boost 3.4
#2 OrbitDesk Platform Overview5.40
BM25 0.89 + Anchor 2.8 + 3Gram 1.71 + Boost 0
#3 Offline-First Sync & Conflict Resolution1.41
BM25 0.46 + Anchor 0 + 3Gram 0.96 + Boost 0
#4 Zero-Tracking Security & TLS 1.3 / AES-256 Encryption1.36
BM25 0.43 + Anchor 0 + 3Gram 0.93 + Boost 0
STAGES 5 & 6 • SYNTHESIS OUTPUTGROUNDED
CONFIDENCE
99%
GROUNDING GATE
17.7 / 4.2
OrbitDesk Plans: Free Core vs. Pro ($12/mo) OrbitDesk Free ($0/month) supports up to 3 workspaces and 500 encrypted documents. OrbitDesk Pro ($12/month or $99/year) unlocks unlimited workspaces, team role permissions, and priority SLA.
Verified Internal Citations
Pricing & Plans(/pricing)
Pillar 3 • Client-Side Corpus & Red-Team Auditor (Zero Upload)

Audit your RAG corpus JSON before deploying to production

Paste your corpus JSON below. Validation runs 100% locally in browser memory (zero network requests), flagging keys, emails, workstation paths, and untrusted external citation URLs.

LOCAL CORPUS BUFFER (ZERO NETWORK UPLOAD)
RagOn Security Score
100 / 100
1.51 KB
2 chunks
Valid Chunk JSON SchemaPASS
Internal-Only Citations (/route)PASS
Keywords & Follow-Up ChipsPASS
Zero-Leak Secret & Route Scanner
0 secrets, API keys, emails, or external citation URLs detected.
Security is the Law • Air-Gapped Architecture

How rag-on guarantees zero secret leaks and zero hallucinations

rag-on-security.test.ts: PASS
100% Air-Gapped

Air-Gapped Compile-Time Corpus

Public web RAG routes never read raw workspace markdown or private databases from disk.

disk file readsraw DB dumpsexternal scraping
Bundle Verified

FNV-1a Hashed Guardrails

Internal blocklist tokens are checked via one-way 32-bit FNV-1a hashes so zero secrets ship in client JS.

FNV-1a 32-bit0 cleartext IDsNFD anti-bypass
0% Hallucination

Strict Grounding Threshold

Queries below score 4.2 or without strong lexical anchors trigger deterministic refusal instead of guessing.

score < 4.20 strong anchorsoff-topic web
CI Gate Active

10-Rule Output Redaction Shield

Every emitted string passes XSS stripping and 10 structural regex rules before returning JSON.

<script> tagsAPI key prefixesPII / PAN / CPF
Pillar 4 • 6-Phase Implementation Blueprint

How RagOn works under the hood (and how to replicate it anywhere)

Every request executes a deterministic 6-stage pipeline guaranteeing sub-2ms edge latency and zero LLM inference cost by default.

Typed Corpus0ms cold-start disk I/O

Phase 1: Curate an Air-Gapped Bilingual Corpus

Author deterministic chunks with internal-only citations and follow-up chips.

Replace brittle PDF scrapers with a versioned, TypeScript-typed array of knowledge chunks containing EN/PT titles, concise facts, domain keywords, internal `/route` citations, and curated follow-up prompts.

Chunk = { id, scope, category, title, content, keywords[], citations[/route], followUps[] }
Enforce route.startsWith("/") on every citation.
Scan serialized corpus in CI against all 10 Zero-Leak rules.
INPUT
Verified Public Docs
OUTPUT
ragCorpus.ts (0 Secrets)
RAG 5-Field Anti-Pattern Registry

Production RAG failure modes prevented deterministically

Domain:
AP-RAG-010 Internal Literals in Client JS

Cleartext Internal Blocklist Literals Bundled Into Client JS

1. Symptom

Inspecting compiled client assets reveals internal project IDs or usernames inside guardrail regexes.

2. Anti-Pattern (Prohibited)

Writing literal internal project slugs or developer handles directly inside client-imported guardrail files.

3. Root Cause

Offline fallback widgets import the RAG engine on the client, bundling every literal regex constant into public JS chunks.

4. Verified Solution

Replace cleartext internal strings with structural regex patterns plus one-way FNV-1a 32-bit token hashes verified by CI.

5. VERIFIED CODE PATTERN
const RESTRICTED_HASHES = new Set(['1794d565', 'bf959e2f']);
const isRestricted = (tok: string) => RESTRICTED_HASHES.has(fnv1a32Hex(tok.toLowerCase()));
AP-RAG-02100% Diacritic Bypass Immunity

Accented Unicode Characters Bypassing ASCII Regex Guardrails

1. Symptom

Queries like "ignorar instruções" or "previsão do tempo" slip past English or unaccented regex rules.

2. Anti-Pattern (Prohibited)

Testing raw user input directly against ASCII-only regular expressions without Unicode normalization.

3. Root Cause

Accented characters (ç, ã, õ, é) fail literal ASCII pattern boundaries like /instrucoes/.

4. Verified Solution

Normalize every query with NFD decomposition and strip combining marks ([\u0300-\u036f]) prior to security and retrieval checks.

5. VERIFIED CODE PATTERN
const norm = raw.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase().trim();
AP-RAG-03Typo & Cross-Lingual Recall

Pure Keyword Match Failing on Typos and Morphological Variants

1. Symptom

Users typing "precing" or "sincroniza" receive false out-of-scope refusals despite valid corpus docs.

2. Anti-Pattern (Prohibited)

Relying solely on exact space-delimited word equality without subword similarity or synonym expansion.

3. Root Cause

Exact token sets miss single-character typos and Portuguese/English cross-lingual stems.

4. Verified Solution

Combine field-weighted BM25 with character 3-gram cosine similarity (4.0x body + 4.5x title/keywords) and a bilingual synonym table.

5. VERIFIED CODE PATTERN
const score = bm25Score + anchorBonus + cos3(qTris, doc.allTris) * 4.0 + cos3(qTris, doc.titleTris) * 4.5;
AP-RAG-040% Off-Topic Hallucinations

Returning Best-Match Chunk Regardless of Grounding Score

1. Symptom

Off-topic questions like "Explain quantum chromodynamics" return an unrelated product overview.

2. Anti-Pattern (Prohibited)

Taking rankedDocs[0] unconditionally without enforcing a minimum score or strong anchor threshold.

3. Root Cause

Trigram cosine and stopword noise can produce tiny non-zero scores (> 0.1) for completely unrelated queries.

4. Verified Solution

Enforce MIN_RAG_SCORE >= 4.2 and strongAnchors >= 1 (plus >= 2 matchedConcepts when unscoped), refusing cleanly otherwise.

5. VERIFIED CODE PATTERN
if (!top || top.score < 4.2 || top.strongAnchors < 1) return buildSafeRefusal(lang);
AP-RAG-050 KB Chat Cost on Initial Paint

Eagerly Importing Chat Corpus & Drawer Into Initial Route Bundle

1. Symptom

Every marketing landing page downloads +30 KB gz of chat UI and corpus data before First Contentful Paint.

2. Anti-Pattern (Prohibited)

Statically importing the full ChatDrawer and RAG corpus inside the root HTML layout component.

3. Root Cause

Static top-level imports force Vite/Rollup to include interactive chat chunks in the critical hydration path.

4. Verified Solution

Mount a tiny launcher in root useEffect and dynamically React.lazy() the drawer only when opened or triggered.

5. VERIFIED CODE PATTERN
const LazyDrawer = lazy(() => import('./RagChatDrawer'));
// Render <LazyDrawer /> only after hasLoadedDrawer becomes true
AP-RAG-06Strict Edge Privacy Compliance

Public Edge Caching on Dynamic POST /api/chat Responses

1. Symptom

CDN intermediaries or shared browsers cache personalized refusal or rate-limit responses.

2. Anti-Pattern (Prohibited)

Omitting Cache-Control headers or reusing public s-maxage headers on chat API endpoints.

3. Root Cause

Without explicit no-store directives, proxies and browser back/forward caches can serve stale API payloads.

4. Verified Solution

Attach Cache-Control: private, no-store, max-age=0 to every 200, 405, 429, and 500 response from /api/chat.

5. VERIFIED CODE PATTERN
return Response.json(payload, { headers: { 'Cache-Control': 'private, no-store, max-age=0' } });
AP-RAG-07100% Mixed-Query PT-BR Accuracy

UI Loanwords Flipping Portuguese Replies Into English

1. Symptom

A user asking "Quais features e pricing o app tem?" receives an English answer despite PT grammar.

2. Anti-Pattern (Prohibited)

Counting English technical nouns equal to English grammar words during language detection.

3. Root Cause

Bilingual users mix UI words ("pricing", "offline", "account") inside Portuguese syntax ("Quais", "como").

4. Verified Solution

Weight Portuguese function words (+3.0) and diacritics (+3.5) higher than English tech loanwords (+1.5).

5. VERIFIED CODE PATTERN
if (PT_FUNCTION_WORDS.has(tok)) ptScore += 3;
else if (EN_TECH_HINTS.has(tok)) enScore += 1.5;
AP-RAG-08XML-Hardened Prompt Boundary

Unescaped User Input Inside Optional Hybrid LLM Prompts

1. Symptom

Crafted user queries break out of prompt delimiters and hijack optional LLM synthesis instructions.

2. Anti-Pattern (Prohibited)

Interpolating raw user queries directly into system or context prompt strings without XML escaping.

3. Root Cause

Unescaped < or > characters allow attackers to inject synthetic closing tags like </user_query>.

4. Verified Solution

Wrap retrieved context in <grounded_context> XML tags, escape user input via escapePromptXml(), and run redactChatOutput() post-LLM.

5. VERIFIED CODE PATTERN
const prompt = `<grounded_context>${escapePromptXml(ctx)}</grounded_context>
<user_query>${escapePromptXml(query)}</user_query>`;