Skip to content

Add NLDataQuerySkill - natural language to SQL query bridge (#1 priority from MEMORY)#281

Merged
lbartoszcze merged 2 commits intomainfrom
wisent/nl-data-query
Feb 8, 2026
Merged

Add NLDataQuerySkill - natural language to SQL query bridge (#1 priority from MEMORY)#281
lbartoszcze merged 2 commits intomainfrom
wisent/nl-data-query

Conversation

@lbartoszcze
Copy link
Copy Markdown
Contributor

Summary

  • NLDataQuerySkill - Translates plain-English data questions into SQL queries and executes them as a premium paid service ($0.015/query, 50% markup over raw SQL)
  • Bridges NaturalLanguageRouter's intent understanding with DatabaseRevenueBridge's paid query execution
  • 6 actions: query (NL→SQL→execute), explain (show generated SQL without running), discover (schema introspection), suggest (auto-generate example questions from schema), teach (learn custom NL→SQL mappings), stats (revenue tracking)
  • SQL generation uses keyword matching, aggregate detection (SUM/AVG/COUNT/MAX/MIN), GROUP BY inference, ORDER BY/LIMIT detection, time filters, WHERE clause extraction
  • Schema caching with table/column type awareness for intelligent column selection
  • Learned mappings persist across sessions for self-improvement
  • Revenue tracking: per-customer, per-query, with full audit trail
  • Read-only enforcement: only SELECT/WITH/EXPLAIN/PRAGMA allowed
  • Registered in autonomous_agent.py DEFAULT_SKILL_CLASSES
  • 18 new tests, all passing. 17 smoke tests still pass.

Pillar: Revenue Generation (primary), Self-Improvement (supporting)

This is the critical missing piece in the revenue pipeline. Without this, customers must know SQL to use paid data services. With this, any user can ask "show total sales by region" and get results — dramatically lowering the barrier to paying for data analysis services. The teach action enables self-improvement: the system learns better NL→SQL mappings from operator feedback.

Test plan

  • 18 unit tests covering tokenization, schema discovery, SQL generation (aggregates, counts, selects, limits), all 6 actions, error handling
  • 17 smoke tests pass (no regressions)

🤖 Generated with Claude Code

@lbartoszcze lbartoszcze force-pushed the wisent/nl-data-query branch 2 times, most recently from 7158f13 to ec95583 Compare February 8, 2026 22:46
…ity from MEMORY)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lbartoszcze lbartoszcze merged commit ecf5e42 into main Feb 8, 2026
0 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant