chat-context-index (Python import: cci)
Persistent conversation memory for RAG chats and agents. Save original messages in SQLite, then prepare recent context plus retrieved older evidence for your application's model.
Pre-release candidate. Python 3.11–3.14 is required. Install a locally built wheel with
python -m pip install /path/to/chat_context_index-0.1.0-py3-none-any.whl.
New stores use schema version 2. For an existing version-1 store, stop all writer processes
and run await HistoryStore.migrate("conversation.db", backup_path="/absolute/path/conversation.before-v2.db")
before opening it. The backup path must be absolute and new. See
migration and recovery.
import asyncio
from cci import HistoryStore
from cci.ingest import ingest
from cci.memory import prepare_context
from cci.models import InputMessage
async def main():
async with await HistoryStore.open("conversation.db", config={"cache_backend": "none"}) as memory:
await ingest(memory, memory.history_id,
[InputMessage(role="user", content="Deploy the service in Oslo.")],
source_id="chat", idempotency_key="turn-1")
# This can run in a later process using the same durable file.
async with await HistoryStore.open("conversation.db", config={"cache_backend": "none"}) as memory:
context = await prepare_context(memory, "Oslo", max_chars=2000)
print(context.text) # Pass this history alongside your instructions, documents, and question.
asyncio.run(main())
Without a provider, retrieval uses local keyword search. For tree retrieval, explicitly build
the index with cci.index.index and pass a cci.provider.MemoizedProvider to indexing and
prepare_context. The host supplies the provider adapter; importing the package makes no
model calls. Context limits include rendered source labels; an optional tokenizer callback
can enforce a model-specific memory token budget.
Python's default cache_backend="sqlite" can memoize eligible indexing and tree-navigation
calls when the host passes the store's cache to its provider wrapper:
from cci.index import index
from cci.provider import MemoizedProvider
async def index_with_cache(memory, my_adapter):
provider = MemoizedProvider(my_adapter, memory.config, cache=memory.cache,
usage_log=memory.usage_log)
return await index(memory, provider=provider)
Open with cache_backend="redis", application_namespace, and redis_url to use Redis with
SQLite fallback after installing chat-context-index[redis]. cci.stats.stats(memory) reports
Redis errors and fallback lookups/hits. Answer synthesis is never cached. See the
Redis example.
Use one owning application process per history on durable local storage. The host controls authentication, history ownership, turn scheduling, and execution checkpoints. Conversation memory does not resume unfinished tools. A source-selection gap in an earlier wheel is fixed in development tests; current held-out answer quality and total dollar savings remain unverified. See the evaluation report.
Integration example and source repository. Licensed under Apache-2.0; license text and upstream attribution are included in the wheel.
Release files for chat-context-index 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| chat_context_index-0.1.0.tar.gz | 64.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| chat_context_index-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 142.5 kB
Release files / chat_context_index-0.1.0.tar.gz
| Download URL | chat_context_index-0.1.0.tar.gz |
|---|---|
| Size | 64.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d191e282413cd692338db30d407787737950ad2a70a8d5a6a626558f372dc32
|
|
BLAKE2b-256 checksum How to use checksums |
a12cef1a5f90026f54f94339f6021f80b5aa6f2f36e2c6b863cb1106272712e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / chat_context_index-0.1.0-py3-none-any.whl
| Download URL | chat_context_index-0.1.0-py3-none-any.whl |
|---|---|
| Size | 78.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
411e7b8ee432baf6d38e8af4cc75ee9b1d718e4bd29d87ec08f8f3351e544b55
|
|
BLAKE2b-256 checksum How to use checksums |
f6f1f56d4c646e1ef270131045f0be36fada71bbd137049f448baf24426dcb4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency log