RAGLaB
Interactive Visual Studio for Retrieval-Augmented Generation (RAG) in VS Code

Document (.md / .txt / .json / .csv)
│
▼
[ RAGLaB Studio ] ──▶ Inspect Metrics ──▶ Tune Chunking ──▶ Simulate Search ──▶ Check LLM Budget
│
▼
Clean, Optimized Chunks ──▶ Vector DB (pgvector / Chroma / Pinecone) ──▶ LLM Prompt
Why RAGLaB?
In Retrieval-Augmented Generation (RAG), the accuracy of your AI answers depends directly on how you chunk your documents. Poor chunking cuts sentences in half, destroys tables and code blocks, and degrades vector search results.
RAGLaB gives you an interactive, visual studio directly inside VS Code to inspect document metrics, tune chunking strategies with live sliders, preview splits on a minimap, and simulate search queries — 100% locally with zero cloud dependencies.
Highlights
- Interactive Visual Studio: Adjust chunk size, overlap, and parent context with live sliders and instant previews.
- 3 Smart Chunking Strategies:
- Parent-Document (Small-to-Big): Search small child chunks for high precision; supply large parent chunks to the LLM for complete context.
- Markdown & Structure: Keeps tables and code blocks completely intact without cutting them across chunks.
- Boundary-Aware: Clean splits along paragraph and sentence boundaries — never truncating in the middle of words.
- Interactive Document Minimap: A visual strip above your chunks that maps the entire document. Click any segment to jump directly to it.
- Local Retrieval Simulator: Test queries against your chunks using built-in TF-IDF relevance scoring before uploading to a vector database.
- LLM Context Headroom Gauge: Real-time color-coded meter tracking prompt tokens against 4K and 8K window limits.
- RAG Stack Scanner: One-click detection of vector databases (pgvector, Chroma, FAISS, Pinecone, etc.) and frameworks in your workspace.
- 100% Local & Private: No API keys, no external requests, and zero telemetry. All computations run on your machine.
Quick Start (Under 1 Minute)
- Open RAGLaB Studio:
- Click the beaker icon in the VS Code Activity Bar on the left, then click Launch Visual Workbench.
- Or press Ctrl+Shift+P (Cmd+Shift+P on macOS) and run
RAGLaB: Open Studio Dashboard.
- Load Your Document:
- Drag & drop any
.md, .txt, .json, or .csv file into the upload zone.
- Or click Load Active File to import whatever file is currently open in your editor.
- Or click Load Sample Document to test with built-in data immediately.
- Tune & Preview:
- Pick a preset (Factoid, Standard RAG, or Deep Context).
- Click Generate Chunks to visually explore chunks, search keywords, or run simulated retrieval queries!
Visual Feature Tour
1. Document Inspector
Get instant diagnostics on your source text before chunking:
- Core Metrics: Exact character count, word count, line count, and lexical density.
- Token Estimation: Fast BPE heuristic (~words × 1.3) so you can budget context early.
- Formatting Alerts: Automatically flags excessive blank lines or run-on blocks with actionable recommendations.
- Direct Dispatch: One click sends your analyzed text straight into the Chunking Studio.
2. Chunking Studio & Presets
Fine-tune your document splitting with visual controls and live parameter validation:
- Interactive Sliders: Adjust Chunk Size (50–3,000) and Overlap (0–500) in real time.
- One-Click Presets:
- Factoid (250 / 25): Compact partitions optimized for precise entity lookups and FAQ matching.
- Standard RAG (500 / 50): Balanced partitions for general technical documentation and articles.
- Deep Context (1,000 / 100): Broad partitions for narrative prose, legal briefs, and summaries.
- Live Validation: Immediate warnings if overlap is too high or parent size is smaller than child size.
3. Document Partition Minimap
A high-density visual strip located right above the chunk viewer:
- Proportional Map: Every chunk is rendered proportionally along the document track.
- Active Segment Glow: Highlights exactly which chunk is currently in view.
- Table & Code Badges: Segments containing preserved tables or code blocks feature bright green top indicators.
- Click-to-Jump: Click any segment on the minimap to instantly navigate to that chunk.
4. Chunk Explorer & In-Place Search
Inspect each chunk just as your vector index and LLM will see them:
- Dual-Mode View (Parent-Document): Toggle between viewing the Child Search Unit and the expanded Parent LLM Context (with the child slice highlighted).
- Keyboard Navigation: Use your keyboard Left and Right arrow keys to step through chunks sequentially.
- Live Search: Type any keyword to highlight all matches in real time (debounced at 120ms) and see total matching chunks.
- Export Options: Copy the current chunk, copy all chunks, or click Save to File (.json) to export your dataset directly to your workspace.
5. Local Retrieval Simulator & Context Gauge
Test retrieval viability before writing database code:
- Instant Query Scoring: Enter any search query (e.g., "How is chunk overlap calculated?") to inspect the Top-3 Matching Chunks with relevance percentages.
- Click-to-Inspect: Click any search result to jump straight to that chunk with matching keywords highlighted.
- LLM Context Headroom Gauge: Dynamically calculates token usage against 4K and 8K context limits:
- Green (< 40%): Safe context headroom with ample space for system prompts and output.
- Amber (40% – 75%): Moderate context utilization.
- Red (> 75%): High token load; risk of prompt truncation.
6. Workspace RAG Stack Scanner
Audit your project repository with one click:
- Dependency Detection: Detects vector databases (pgvector, Chroma, FAISS, Qdrant, Pinecone, Weaviate, Milvus), embedding models, and orchestration frameworks (LangChain, LlamaIndex, Haystack).
- Directory Audit: Identifies ingestion folders like
documents/, embeddings/, and data/.
- Export Report: Copy a clean diagnostic summary to your clipboard.
Chunking Strategies Explained
Choosing the right chunking strategy is the single most important decision in your RAG pipeline:
| Strategy |
Search Accuracy |
Context for LLM |
Best Suited For |
| Parent-Document (Small-to-Big) |
High Precision |
Full Context |
Mission-critical RAG, legal docs, complex Q&A |
| Markdown / Structural |
High |
High |
Technical docs, API specs, tables & code blocks |
| Recursive Boundary |
Balanced |
Good |
General prose, articles, customer notes, transcripts |
1. Parent-Document (Small-to-Big)
- The Problem: Small chunks give sharp vector search precision but lack context for the LLM. Large chunks give rich LLM context but dilute vector search precision.
- The Solution: RAGLaB creates small Child Chunks (250–300 chars) for vector indexing, and links them to larger Parent Chunks (1,200–1,500 chars). When a child chunk matches a query, the complete parent context is provided to the LLM prompt.
Document Text
│
├── Parent Chunk [#1](https://github.com/aroshwijesinghe/RAGLab/issues/1) (1,200 chars) [Sent to LLM Prompt]
│ ├── Child Chunk 1.1 (250 chars) [Indexed in Vector DB]
│ ├── Child Chunk 1.2 (250 chars) [Indexed in Vector DB]
│ └── Child Chunk 1.3 (250 chars) [Indexed in Vector DB]
│
└── Parent Chunk [#2](https://github.com/aroshwijesinghe/RAGLab/issues/2) (1,200 chars) [Sent to LLM Prompt]
├── Child Chunk 2.1 (250 chars) [Indexed in Vector DB]
└── Child Chunk 2.2 (250 chars) [Indexed in Vector DB]
2. Markdown & Structural Hierarchy
- Table Preservation: Markdown tables are treated as atomic units and are never split across chunks.
- Code Block Preservation: Fenced code blocks remain intact to avoid syntax errors.
- Heading Breadcrumbs: Prepends hierarchical headings (e.g.
[Docs > Setup > Config]) to chunk metadata so isolated chunks carry their domain origin.
3. Recursive Boundary-Aware
- Splits text hierarchically: first along Paragraphs (
\n\n), then Sentences (. ! ?), and finally Words. Words and semantic clauses are never severed mid-thought.
RAGLaB focuses on text-native formats for deterministic character boundaries and zero binary extraction artifacts:
| Format |
Extension |
Typical Use Case |
| Markdown |
.md, .markdown |
Documentation, technical guides, README files (preserves tables and code) |
| Plain Text |
.txt |
Unstructured notes, logs, transcripts, raw source text |
| Structured JSON |
.json |
Chat histories, schema records, conversational exports |
| Tabular CSV |
.csv |
Tabular data, inventory catalogs, tabular rows |
| Scratchpad |
Direct Paste |
Rapid testing, custom prompts, and ad-hoc chunking experiments |
Available Commands
Access every feature via the VS Code Command Palette (Ctrl+Shift+P / Cmd+Shift+P):
| Command |
Action |
RAGLaB: Open Studio Dashboard |
Opens the full visual studio workbench |
RAGLaB: Analyze Document |
Profiles file metrics and opens the inspector |
RAGLaB: Create Chunks |
Partitions a document and opens the chunking studio |
RAGLaB: Preview Chunks |
Quick chunk preview of the active editor file |
RAGLaB: Analyze Workspace |
Audits workspace dependencies and folders for RAG |
Configuration Settings
Customize defaults in VS Code Settings (Ctrl+, / Cmd+, → search RAGLaB):
| Setting |
Default |
Description |
ragHelper.defaultChunkSize |
500 |
Default chunk size in characters (10 – 10,000) |
ragHelper.defaultChunkOverlap |
50 |
Default overlap between adjacent chunks (0 – 5,000) |
ragHelper.maxFileSize |
5242880 |
Maximum file size in bytes allowed for analysis (5 MB) |
ragHelper.showNotifications |
true |
Show status notifications on operations |
Security & Privacy
- 100% Local: Everything runs inside your local VS Code extension process.
- Zero Network Calls: No data, files, or telemetry are ever transmitted externally.
- Zero API Keys: Operates completely offline without requiring third-party cloud accounts.
- Read-Only Safety: Source files are inspected safely in memory and are never modified on disk.
Development & Testing
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Run automated tests
npm test
# Package VSIX bundle
npm run package
License
Distributed under the MIT License.
| |