Memory
IntelligentRAG — Schema-Aware Query Validation (LSP-style) ## What Was Added Enhanced `query-validator.ts` with full schema awareness: ### Features 1. **Security validation** — blocks SHELL, file::, http:: 2. **Table validation** — catches unknown tables, suggests closest match 3. **Field validation** — catches unknown fields in SELECT, SET, WHERE clauses 4. **Suggestions** — "Did you mean 'type'?" when field is close but wrong 5. **Schema summary** — `getSchemaSummary()` for system prompts 6. **New MCP tool** — `schema_info` returns full schema for the LLM ### Schema Definition All 27 tables with their fields defined in `query-validator.ts`: - document, chunk, entity, topic, category, keyword, collection - trace, uncertainty, procedure, schema_version, notification, flow - Edge tables: contains, mentions, about, related_entity, in_collection, etc. ### Field Extraction `extractFieldNames()` now parses: - `SELECT field1, field2 FROM table` - `SET field = value` - `WHERE field = value` ### Query Tool Enhancements - Warnings shown on success: `Warnings: ⚠ Unknown field 'tipe'` - Error hints: "Run schema_info to see available tables and fields" - Closest match suggestions: "Did you mean 'type'?" ### Test Results ``` SELECT name, tipe FROM entity → ⚠ Unknown field 'tipe' SELECT name, type FROM entity → ✅ Clean SELECT * FROM docment → ❌ Table 'docment' does not exist SELECT * FROM entity WHERE bad = 'x' → ⚠ Unknown field 'bad' ``` ## Files Modified - src/engine/query-validator.ts — schema definition, field extraction, getSchemaSummary() - src/server.ts — schema_info tool, enhanced query tool output ## Deployment - Version: 7b43c0a1-e934-4ab2-acf5-242529632ea5
Tags: intelligentrag, lsp, query-validation, schema-aware, project:intelligentrag, kind:episodic — Source: claude — 2026-07-18 16:09:16 UTC