Create LLM Content Context Builder #102

Open
opened 2025-10-03 22:26:35 +00:00 by tegwick · 0 comments
Owner

Priority: HIGH | Effort: 3 days | Dependencies: OpenRouter Client Infrastructure

User Story

As a user, I want the LLM to have relevant context from my MarkiTect content when answering questions so that responses are accurate and cite my actual documents.

Description

Build a smart context builder that extracts relevant content from the MarkiTect database, uses FTS search for content discovery, and constructs context within token limits while maintaining source citations.

Technical Implementation

  • New Files: markitect/llm/context_builder.py, markitect/llm/content_selector.py, tests/test_context_builder.py

Acceptance Criteria

  • ContextBuilder class with intelligent content selection
  • Integration with existing FTS search capabilities
  • Token-aware context truncation and optimization
  • Source tracking and citation generation
  • Relevance scoring for content ranking
  • Support for different context strategies (recent, relevant, comprehensive)
  • Performance optimization for large content repositories
  • Unit tests with mock database content

Core component for Issue #98 (OpenRoute Integration).

**Priority**: HIGH | **Effort**: 3 days | **Dependencies**: OpenRouter Client Infrastructure ## User Story As a user, I want the LLM to have relevant context from my MarkiTect content when answering questions so that responses are accurate and cite my actual documents. ## Description Build a smart context builder that extracts relevant content from the MarkiTect database, uses FTS search for content discovery, and constructs context within token limits while maintaining source citations. ## Technical Implementation - **New Files**: markitect/llm/context_builder.py, markitect/llm/content_selector.py, tests/test_context_builder.py ## Acceptance Criteria - [ ] ContextBuilder class with intelligent content selection - [ ] Integration with existing FTS search capabilities - [ ] Token-aware context truncation and optimization - [ ] Source tracking and citation generation - [ ] Relevance scoring for content ranking - [ ] Support for different context strategies (recent, relevant, comprehensive) - [ ] Performance optimization for large content repositories - [ ] Unit tests with mock database content ## Related Issues Core component for Issue #98 (OpenRoute Integration).
tegwick added the type:featurepriority:high labels 2025-10-03 22:26:35 +00:00
tegwick added this to the LLM Chat and Agent Assistance project 2025-10-03 22:28:30 +00:00
Sign in to join this conversation.