Semantic Layer, DSL2SQL & Agent-SuperData: Three Pillars for Reliable Data Agents
The article presents a three-pillar architecture — Semantic layer, DSL2SQL, and Agent-SuperData — for building reliable data analysis agents, detailing a three-phase evolution (usable, user-friendly, continuously improving) with governance loops, memory systems, and quality assurance to transform data development from passive report delivery to proactive semantic asset management embedded in business decisions.
Reading font

The article explores the evolution of data development in the AI era, arguing that the immediate goal is not an omnipotent Data Agent but a stable, reliable, accurate, and efficient data retrieval and analysis agent. It proposes three foundational pillars:
Semantic Layer : Unifies business concepts, metric definitions, dimensions, entities, and their mappings to data assets, ensuring consistent interpretation of the same business language across people, systems, and time.
DSL2SQL : Translates semantically constrained analysis requests into executable, auditable queries, not merely letting a model guess SQL but enforcing structure through metric, dimension, filter, and asset composition.
Agent-SuperData : Orchestrates the end-to-end flow — understanding the problem, retrieving semantics, initiating queries, verifying evidence, and delivering explanations with provenance, so results are auditable and actionable.
These pillars form a continuous chain: Business Question → Semantic Understanding → DSL Expression → SQL Execution → Result Verification → Analysis Delivery . The Semantic Layer ensures "understanding is correct," DSL2SQL ensures "expression is clear," and Agent-SuperData ensures "execution runs and delivery succeeds."
Three User Types Served
The system targets three personas who all need to convert business problems into trusted data results faster:
Know what data they need but cannot write SQL.
Can write SQL but lack certainty about business definitions (metrics, dimensions, filters, asset selection).
Know SQL and definitions but seek higher efficiency through intent understanding, knowledge reuse, and assisted analysis.
Three-Phase Construction Path
Usable (能用) : Connect the chain — natural language to semantic retrieval to DSL2SQL to authorized data sources; results include SQL, source tables, filters, time windows, execution status; gaps in permissions or semantics are explicitly flagged.
User-Friendly (好用) : Improve semantic coverage and definition quality; enhance retrieval, asset matching, and request decomposition to reduce clarification rounds; accelerate data freshness via lake ingestion speedups, incremental updates, and real-time capabilities; make Agent explain definitions, limitations, and evidence chains.
Continuously Improving (持续好用) : Evolve Agent architecture with memory systems (stable knowledge, task state, analytical evidence), Hooks for critical constraints (retrieval, query, validation), and storage for traceability; implement reverse monitoring and governance of assets (low hit-rate, erroneous recall, long-unused, quality anomalies, expired definitions) combined with OLAP tagging for discoverability; automate asset lifecycle (status, version, owner, quality rules) with quarantine and review before changes; reduce knowledge entropy via Wiki-KBase tiered retrieval (business domain, tags, metrics, dimensions) prioritizing authoritative, in-use, versioned assets, routing duplicates/conflicts to governance queues.
Agent Array: Specialized Collaboration
The team deploys four named agents with distinct responsibilities:
Michelangelo : Data asset lifecycle — CDM, KBase, monitoring, governance, asset quality, lake ingestion.
Raphael : Semantic layer assets and business definitions.
Da Vinci : Business-facing data retrieval, analysis, and insight; integrates data and semantic capabilities to turn questions into business conclusions.
Su Shi : Assistant to Da Vinci, handling decomposable analytical workloads; Da Vinci remains accountable for final business response, avoiding inconsistent conclusions.
This division achieves specialization, accountability (data quality, definition, conclusion issues traceable to respective agents), and scalability (Su Shi absorbs workload growth without restructuring).
Semantic Layer Methodology
Trace source upward, model downward, validate via SQL and reconciliation, propagate changes along the lineage.
Process: clarify business definitions, grain, filters, and expected reports; check existing asset reuse; use reports and ADS to understand downstream expectations; trace lineage in DataWorks to CDM DWD/DWS to verify real fields, grain, and relationships; build logical tables and bindings from physical tables; define metrics and dimensions; generate SQL for downstream consumption. Quality is layered: verify definitions and fields have sources, check bindings, generate SQL for target metric-dimension combos to validate table selection, joins, filters; finally reconcile against reports or trusted baselines under same date, conditions, and grain. Changes propagate downstream; new downstream demands trace upstream to confirm support. Each layer owns only what it can prove.
Wiki-KBase: Governed Knowledge Retrieval
Wiki-KBase is not a document dump but a controlled retrieval layer with three modes: only (default): prioritize OLAP pages (P0/P1), expand to P2 then all OLAP if no hit or score < 0.6; never auto-fallback to full corpus. all: search data-semantics scope; if no hit or score < 0.6, supplement with Glossary and Ontology. off: only Glossary and Ontology, no full non-OLAP assets, no fallback.
Architecture separates knowledge supply/publishing (incremental hash-based sync to KBase), online retrieval (Agent → Wiki-KBase → candidate pages → KBase search → ranked evidence with provenance), and quality feedback (badcases → Issues → triage → fix source → incremental republish). Running evidence: Oct 25 sync skipped 938 unchanged pages with zero failures; one badcase round logged 466 retrievals, 282 low-confidence, 237 distinct issues, 20 new Issues, 198 deduplicated; after Tier guardrails (e.g., active-last-7-days assets at least P2), "cooperating anchor" retrieval scored 0.902.
Storage Architecture & Memory System
Storage organized by distance from context, not file type: auto-load layer (injected per session), forced-read layer (protocol-required ledgers), on-demand retrieval layer (semantic assets, correction records, precipitates), cold zone (historical transcripts, read forbidden). Auto-load capped at 20 entries — a forced trade-off mechanism: new knowledge must amend existing entries, preventing unbounded growth. Promotion criteria: business-approved hard definitions, red-line rules, high-frequency pits causing incidents, same definition corrected twice+, North Star metric definitions. Demotion: rules now enforced in code, long-unreferenced rules; demotion only removes from auto-load, ledger retains original text and IDs to protect existing references. Key design: demotion and gatekeeping are coupled — a rule can leave auto-load only when it has been hardened into code enforcement.
Memory carriers: Definition Ledger (executable rules with source, timestamp, original phrasing, evidence hashes/row counts, status, corrections); Position Library (rule rationale and scope, promotion chain: single discovery → multi-scenario validated experience → business intuition, with self-attribution; Correction Cards — one per error: trigger, consequence, layered root cause, verification standard); Round-by-Round Retrospectives (which rules fired, which shortcuts suppressed, knowledge changes, evidence reconciliation — evaluating process compliance, not outcome quality). Critical discipline: rules conflicting with red lines never promote , even if they boost efficiency, to prevent memory evolving toward constraint bypass.
Quality Assurance: Fences and Gates
Two protection types: Fence (structural, not a pipeline step) — intercepts any command exhibiting SQL structure or physical table names, or attempts to write SQL to file then execute; only allowed form is executor + file_param + real_SQL_path. Guards "no bypassing the pipeline." Three Gates inside pipeline:
Generation Gate : validates product structure integrity (upstream dependencies connected, filters attached correctly); blocks execution and reporting on failure.
Assembly Gate : validates read logic — addresses fence's blind spot (post-processing scripts concatenating SQL and spawning subprocesses). Requires assertions: print actual headers before read, fetch by exact column names, throw on missing columns, forbid silent defaults.
Engine Gate : dual-engine reconciliation — primary engine first; on execution failure, success with zero rows, or row-count hitting limit, mark as undetermined (not "no data"), immediately rerun on secondary engine; stop output if residual exceeds threshold; calculated per day, single-day anomaly does not taint whole table.
Recorded failure modes: persistent false negatives (validator ignored preamble statements, always failed, treated as noise, mechanism never active) and false positives (read-only commands blocked due to sensitive keyword). Same "keyword co-occurrence" logic fails both ways. Tightening rules requires a suite of legitimate path test cases; acceptance must include live environment probes — synthetic events only verify logic, not delivery reach.
Process Paradigm: Eight-Step Reverse Governance Loop
Organizing principle: the loop's output is not a conclusion but an expanding set of askable questions . Steps: Retrieve → Encounter Gap/Anomaly → Ticket (no guessing) → Propose Competing Hypotheses with Predefined Criteria → Business Decides → Enter Ledger Same Day → Feed Upstream Semantic Layer → Asset Becomes Usable → Return to Retrieve.
Four constraints sustain the loop:
Gaps must be ticketed, never patched; handwritten SQL fallback forbidden — this prevents "making up a number" from consuming the learning opportunity.
Hypotheses must predefine criteria: "what observation confirms which explanation" — keeps long-open propositions actionable.
Feedback upstream: gaps not just logged but fed to semantic layer as prioritized lists with business impact — the system is both consumer and primary demand driver for the semantic layer because it continuously hits real walls.
Decision authority returned: output "options + consequences + recommendation" not decisions; on rule conflicts apply stricter and expose details; on cross-period comparison risks disclose but do not auto-correct definitions; on self-scope violations immediately roll back.
Capability growth comes from institutionalized failure handling, not model upgrades . Three satellite inputs: per-business-per-date retrieval catalogs making demand evolution observable; bidirectional calibration preventing one-sided accommodation; scheduled jobs for proactive discovery — together preventing degradation in self-referential loops.
Governance Loop: Automated, Risk-Aware, Closed
12 enabled scheduled tasks form a shared control plane across domains (knowledge/retrieval, OLAP assets, Paimon lake, runtime guarantees). Each domain uses its own evidence, rules, execution boundaries, but shares principles: insufficient evidence → stop; high risk → human; low risk → auto-execute; post-execution re-read/replay and feed into next round . Frequencies match signal velocity: Wiki change-driven sync + watchdog; Glossary periodic incremental refresh; knowledge/semantic quality daily/weekly/biweekly; OLAP asset lifecycle periodic; Paimon periodic lake-table/partition reconciliation. Loop closes not at "task finished" but at "disposition confirmed and influencing next judgment."
OLAP Asset Lifecycle & Tagging
Goal: assets can go up and down, fast onboarding and offboarding so Agent always sees current best core assets. Combines 30-day OLAP query logs, ETL/r2c evidence, online dependencies/cascades, asset age, manual retention records. Candidates meeting authorization and safety conditions auto-offboard; stale evidence, live references, recent successful calls, or retention rules keep assets in Draft/HOLD. Post-offboard monitoring detects re-use; restoration follows separate evidence threshold and approval flow, avoiding thrash. Hardening: earlier pagination limit in sqlLog caused evidence window shorter than expected, leading to wrongful offboard; fixed with full pagination and window validation, suspicious items kept in Draft/HOLD.
OLAP Tagging converts query usage into searchable/governable asset profiles. For each metric/dimension: F = successful query frequency, U = user coverage, R = recent activity, C = co-occurrence with other assets. Weighted score:
Score = 0.40·log₂(1+F) + 0.25·log₂(1+U) + 0.20·R + 0.15·log₂(1+C). Assets ranked into P0–P3 by relative percentiles (not absolute thresholds). New-asset guard: assets with successful query in last 7 days at least P2. Online assets with zero success in window get full rebase: new assets get P2 grace tag; beyond grace period with no queries → P3 dormancy pool. Final tags written to isOlap integer bitfield encoding OLAP flag, Tier, HOTSPOT, 7-day active, multi-user signals. HOTSPOT (parallel branch): total queries ≥5 and error rate >30% → generates governance list for human handling, no auto-fix. Critical boundary: tags are not offboard actions — P3/dormancy signals governance; actual offboard decided by separate lifecycle loop with fuller evidence, dependencies, protection rules.
Progress & Transformation
As of writing: 230,000+ cumulative calls, 190+ users . Shift from data supply to business decision co-creation: Data engineering turns warehouse assets into understandable, verifiable, reusable semantic supply; SuperData connects business questions, data evidence, and AI analysis, turning users from passive report receivers into active participants in clarification, verification, analysis, and action — forming a business loop. For data engineers: value delivery shifts from fixed products (reports, APIs) to semantic, reusable assets unlocking latent value; role upgrades from modeling/SQL cleansing to business translation, asset abstraction, semantic refinement, knowledge precipitation; pre-processing not full ownership — base tables and semantic layer are "raw materials," engineers do washing, deboning, blanching; users + AI do personalized "cooking." For users: capability democratization (fill personal data skill gaps, lower analysis barrier); interaction upgrade from one-way request/wait to timely, interactive, bidirectional verification; professional data partner (SuperData) providing semantic- and evidence-backed support; end-to-end business coverage from clarification, retrieval, analysis, strategy to promotions, daily ops, reports, experiments, product/strategy rollout, with effect feedback precipitated as experience.
Outlook
Stability : product-grade journey experience (full user journey, not single Q&A success); Agent & Harness stability (stable, observable, recoverable in real tasks); evaluation system (continuous accuracy, stability, timeliness, business fit assessment forming iteration loop).
Business Integration : data often enters decision chain too late; from stable/efficient/accurate retrieval, let DataAgent continuously deepen into business, embed in processes; goal not passive response but indispensable collaboration and decision capability in business chain.
R&D System : scope sinks from retrieval/analysis into daily data engineering; Workspace context center (team-shared business context, semantics, engineering knowledge); Semantic Layer as single source of truth (unified business definitions, calibrations, asset mappings, reducing semantic fragmentation and repeated explanations); Team Semantic Agent covering ADS, datasets/reports, APIs described and linked via DSL; all assets semanticized — gradually cover ADS, datasets/reports, APIs so Agent can understand, retrieve, use them.
For questions about attribution, corrections or content rights, please contactand we will review it promptly.