From 630893f0473b0346f89210b51998cb2c88f7132c Mon Sep 17 00:00:00 2001 From: OpenCode Test Date: Wed, 7 Jan 2026 10:32:04 -0800 Subject: [PATCH] Add conditional RAG reindex after session summarization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When summarize-transcript.py extracts items to memory files, it now triggers index_personal.py to update the RAG search index. Only runs when items were actually added (total_added > 0) to avoid unnecessary reindexing on trivial sessions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- hooks/scripts/summarize-transcript.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/hooks/scripts/summarize-transcript.py b/hooks/scripts/summarize-transcript.py index 29e75ce..694f2c0 100755 --- a/hooks/scripts/summarize-transcript.py +++ b/hooks/scripts/summarize-transcript.py @@ -378,6 +378,29 @@ def main(): log(f"Summarization complete: {total_added} total items added") + # Reindex RAG if we added items + if total_added > 0: + log("Triggering RAG reindex...") + try: + reindex_result = subprocess.run( + [ + str(Path.home() / ".claude/skills/rag-search/venv/bin/python"), + str(Path.home() / ".claude/skills/rag-search/scripts/index_personal.py"), + "--quiet" + ], + capture_output=True, + text=True, + timeout=120 + ) + if reindex_result.returncode == 0: + log("RAG reindex completed successfully") + else: + log(f"RAG reindex failed: {reindex_result.stderr[:200]}") + except subprocess.TimeoutExpired: + log("RAG reindex timed out after 120s") + except Exception as e: + log(f"RAG reindex error: {e}") + if __name__ == "__main__": main()