chore(conductor): Add new track 'RAG Support'

This commit is contained in:
2026-03-08 14:04:18 -04:00
parent fbee82e6d7
commit 20f5c34c4b
5 changed files with 102 additions and 1 deletions

View File

@@ -13,11 +13,15 @@ This file tracks all major tracks for the project. Each track has its own detail
*Link: [./tracks/external_mcp_support_20260308/](./tracks/external_mcp_support_20260308/)*
*Goal: Add support for external MCP servers (Local Stdio and Remote SSE/WS) with flexible configuration and lifecycle management (including auto-start on project load).*
2. [ ] **Track: RAG Support**
*Link: [./tracks/rag_support_20260308/](./tracks/rag_support_20260308/)*
*Goal: Add support for RAG (Retrieval-Augmented Generation) using local vector stores (Chroma/Qdrant), native vendor retrieval, and external RAG APIs. Implement indexing pipeline and retrieval UI.*
---
### GUI Overhauls & Visualizations
2. [ ] **Track: Advanced Log Management and Session Restoration**
3. [ ] **Track: Advanced Log Management and Session Restoration**
*Link: [./tracks/log_session_overhaul_20260308/](./tracks/log_session_overhaul_20260308/)*
*Goal: Centralize log management, improve session restoration reliability with full-UI replay mode, and optimize log size via external script/output referencing. Implement transient diagnostic logging for system warnings.*

View File

@@ -0,0 +1,5 @@
# Track rag_support_20260308 Context
- [Specification](./spec.md)
- [Implementation Plan](./plan.md)
- [Metadata](./metadata.json)

View File

@@ -0,0 +1,8 @@
{
"track_id": "rag_support_20260308",
"type": "feature",
"status": "new",
"created_at": "2026-03-08T14:04:00Z",
"updated_at": "2026-03-08T14:04:00Z",
"description": "Add support for RAG (Retrieval-Augmented Generation) using local vector stores, native vendor retrieval, and external RAG APIs."
}

View File

@@ -0,0 +1,46 @@
# Implementation Plan: RAG Support
## Phase 1: Foundation & Vector Store Integration
- [ ] Task: Define the RAG architecture and configuration schema.
- [ ] Update `src/models.py` to include `RAGConfig` and `VectorStoreConfig`.
- [ ] Implement configuration loading/saving in `AppController`.
- [ ] Task: Integrate a local vector store.
- [ ] Add `chromadb` or `qdrant-client` to `requirements.txt`.
- [ ] Create `src/rag_engine.py` to manage the vector database lifecycle (init, add, search, delete).
- [ ] Task: Implement embedding providers.
- [ ] Implement Gemini embedding wrapper in `src/rag_engine.py`.
- [ ] Implement local embedding wrapper (e.g., using `sentence-transformers`) in `src/rag_engine.py`.
- [ ] Task: Write unit tests for vector store operations and embedding generation.
- [ ] Task: Conductor - User Manual Verification 'Phase 1: Foundation & Vector Store' (Protocol in workflow.md)
## Phase 2: Indexing & Retrieval Logic
- [ ] Task: Implement the indexing pipeline.
- [ ] Implement file chunking strategies (e.g., character-based, AST-aware) in `src/rag_engine.py`.
- [ ] Create a background indexing task in `AppController`.
- [ ] Implement auto-indexing logic triggered by Context Hub changes.
- [ ] Task: Implement the retrieval pipeline.
- [ ] Implement similarity search with configurable top-k and threshold.
- [ ] Implement "Native Retrieval" logic for Gemini (leveraging `ai_client.py`).
- [ ] Task: Update `ai_client.py` to support RAG.
- [ ] Add a `retrieve_context()` step to the `send()` loop.
- [ ] Format and inject retrieved fragments into the model's system prompt or context block.
- [ ] Task: Write integration tests for the indexing and retrieval flow.
- [ ] Task: Conductor - User Manual Verification 'Phase 2: Indexing & Retrieval Logic' (Protocol in workflow.md)
## Phase 3: GUI Integration & Visualization
- [ ] Task: Implement the RAG Settings panel in `src/gui_2.py`.
- [ ] Add UI controls for choosing the RAG source, embedding model, and retrieval parameters.
- [ ] Add a "Rebuild Index" button and status progress bar.
- [ ] Task: Implement retrieval visualization in the Discussion history.
- [ ] Display "Retrieved Context" blocks with expandable summaries.
- [ ] Add "Source" buttons to each block that open the file at the specific chunk's location.
- [ ] Task: Implement auto-start/indexing status indicators in the GUI.
- [ ] Task: Write visual regression tests or simulation scripts to verify the RAG UI components.
- [ ] Task: Conductor - User Manual Verification 'Phase 3: GUI Integration & Visualization' (Protocol in workflow.md)
## Phase 4: Refinement & Advanced RAG
- [ ] Task: Implement support for external RAG APIs/MCP servers.
- [ ] Create a bridge in `src/rag_engine.py` to call external RAG tools via the MCP interface.
- [ ] Task: Optimize indexing performance for large projects (e.g., incremental updates, parallel chunking).
- [ ] Task: Perform a final end-to-end verification with a large codebase.
- [ ] Task: Conductor - User Manual Verification 'Phase 4: Refinement & Advanced RAG' (Protocol in workflow.md)

View File

@@ -0,0 +1,38 @@
# Specification: RAG Support
## Overview
This track introduces Retrieval-Augmented Generation (RAG) capabilities to Manual Slop. It allows agents to search and retrieve relevant information from large local codebases, project documentation, or external knowledge bases, overcoming context window limitations and reducing hallucination.
## Functional Requirements
- **Multi-Source Retrieval:**
- **Local Vector Store:** Integrate a local vector database (e.g., Chroma or Qdrant) for indexing and searching local project files.
- **Native Retrieval:** Support vendor-specific retrieval features (e.g., Gemini's file search/caching mechanisms).
- **External RAG APIs:** Provide a generic interface to connect to external RAG services or specialized MCP servers.
- **Configurable Indexing:**
- Support both **Manual Indexing** (triggering index builds for specific folders/files) and **Auto-Indexing** (indexing files added to the Context Hub).
- Users can configure indexing preferences (e.g., which extensions to include, chunking strategy) in `config.toml` or `manual_slop.toml`.
- **Embedding Support:**
- Support for **Gemini** embeddings and **Local** embedding models (e.g., via HuggingFace/Sentence-Transformers).
- **Retrieval UI & Visualization:**
- **Retrieved Blocks:** Display retrieved context fragments directly in the **Discussion History** before the agent's response.
- **Source Links:** Provide clickable links/buttons to jump to the original source file and line for each retrieved chunk.
- **Retrieval Settings:** A dedicated panel in **AI Settings** to adjust retrieval parameters (top-k, similarity threshold, active RAG source).
- **Agent Integration:**
- Update `ai_client.py` to perform a retrieval step before sending the final prompt to the model.
- Ensure retrieved context is properly formatted and injected into the agent's context window.
## Non-Functional Requirements
- **Performance:** Indexing should be performed in a background thread to avoid GUI freezing. Retrieval must be fast enough to not noticeably delay agent response times.
- **Scalability:** The RAG system should handle codebases with thousands of files efficiently.
- **Privacy:** Ensure that local indexing stays local and sensitive data is not inadvertently sent to external embedding providers without user consent.
## Acceptance Criteria
- [ ] Users can index their local project using Gemini or local embeddings.
- [ ] Agents can successfully retrieve and use information from indexed files that were not part of the active context window.
- [ ] Retrieved context is displayed in the GUI with links back to the source code.
- [ ] Users can switch between local, native, and external RAG sources in the settings.
- [ ] Auto-indexing works when files are added or modified in the Context Hub.
## Out of Scope
- Building a complex web crawler for RAG (focusing on local files and specific documentation URLs).
- Support for advanced semantic search beyond standard vector similarity (e.g., knowledge graphs) in this initial track.