ChatIndex
by
VectifyAI

Description: ChatIndex: Tree indexing and retrieval for long conversational memory

View on GitHub ↗

Summary Information

Updated 1 hour ago
Added to GitGenius on January 31st, 2026
Created on November 14th, 2025
Open Issues & Pull Requests: 0 (+0)
Number of forks: 24
Total Stargazers: 150 (+0)
Total Subscribers: 1 (+0)

Issue Activity (beta)

Open issues: 0
New in 7 days: 0
Closed in 7 days: 0
Avg open age: N/A days
Stale 30+ days: 0
Stale 90+ days: 0

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

No label distribution available yet.

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

ChatIndex is a Python-based context management system designed to address a critical challenge in long conversational AI: how to efficiently preserve and retrieve information from extended conversation histories without losing fidelity or suffering from context degradation. The repository implements a hierarchical tree-based indexing approach that enables large language models to navigate long conversations intelligently while maintaining access to the complete raw dialogue.

The core innovation of ChatIndex is its Context Tree structure, which combines the completeness of traditional indexing systems with the flexibility of hierarchical memory architectures. Rather than relying solely on lossy memory compression techniques that inevitably discard information, ChatIndex preserves the entire original conversation at leaf nodes while layering a multi-resolution topic hierarchy on top. Leaf nodes store raw conversational message exchanges, while internal nodes contain topic summaries that abstract and represent their child nodes. This creates a multi-level topic hierarchy where higher nodes represent broader themes and lower nodes convey increasingly specific details.

The retrieval mechanism operates through top-down tree traversal guided by LLM reasoning. When a query arrives, the system evaluates whether each node's summary contains sufficient information to answer the query. If a summary provides adequate detail, traversal stops and that higher-level summary is returned. If more specificity is needed, the system continues downward until it reaches either a more detailed summary or the raw conversation itself. This design delivers dynamic retrieval resolution by returning only as much detail as necessary, maintains lossless fallback by keeping raw conversations always accessible, and enables efficient reasoning by reducing large contexts to minimally sufficient subsets.

ChatIndex extends concepts from PageIndex, a tree-based indexing system for documents, but adapts them specifically for conversational contexts. Two key differences distinguish the conversational approach: documents are static and indexed once before downstream tasks, while conversations are dynamic and require incremental tree generation; documents possess natural structural elements like tables of contents, while conversations are unstructured message lists requiring structure definition. The system draws inspiration from topic modeling approaches like Latent Dirichlet Allocation and Hierarchical Dirichlet Process, using LLMs to detect topic switches and generate trees with nodes representing distinct topics. Unlike traditional hierarchical topic models, ChatIndex's Context Tree maintains temporal ordering, allowing new topics to branch only from the current topic or its ancestors.

The architectural design borrows efficiency principles from B+ trees used in database systems. Like B+ trees, ChatIndex uses leaf nodes to store full records (conversation messages) and internal nodes as routing keys (summaries) that guide traversal. Both structures maintain bounded fan-out through a max_children parameter to keep trees shallow and traversal efficient. The critical difference lies in lookup mechanisms: B+ trees use numeric or lexicographic key comparisons, while ChatIndex employs reasoning-based navigation using contextual relevance judged by an LLM to determine which branch to follow.

The repository includes comprehensive documentation covering tree building and querying phases, with a complete workflow demonstrated in included code examples. The implementation supports streaming responses for real-time interaction and provides direct tool access for advanced usage patterns. The roadmap indicates active development with completed features including hierarchical tree indexing, LLM-guided retrieval, and streaming support, while planned enhancements include offline tree optimization, multi-LLM support, incremental updates, and vector search integration for hybrid retrieval approaches.

ChatIndex
by
VectifyAIVectifyAI/ChatIndex

Repository Details

Fetching additional details & charts...