import os import sys from pathlib import Path # Add the src directory to the Python path sys.path.insert(0, str(Path(__file__).parent / "src")) from timmy.memory_system import memory_store def index_research_documents(): research_dir = Path("docs/research") if not research_dir.is_dir(): print(f"Research directory not found: {research_dir}") return print(f"Indexing research documents from {research_dir}...") indexed_count = 0 for file_path in research_dir.glob("*.md"): try: content = file_path.read_text() topic = file_path.stem.replace("-", " ").title() # Derive topic from filename print(f"Storing '{topic}' from {file_path.name}...") # Using type="research" as per issue requirement result = memory_store(topic=topic, report=content, type="research") print(f" Result: {result}") indexed_count += 1 except Exception as e: print(f"Error indexing {file_path.name}: {e}") print(f"Finished indexing. Total documents indexed: {indexed_count}") if __name__ == "__main__": index_research_documents()