Memoization keys, scheduled refresh and scoped stats

CocoIndex 1.0.1–1.0.7 adds per-argument memo keys, scheduled live refresh, scoped stats, OCI and Iggy sources, and Neo4j, FalkorDB and Turbopuffer targets.

ChangelogUpdated 12 min read
Four feature cards: memo_key builds the cache key from entry and other arguments and excludes extra; auto_refresh re-runs a processor with a 5-minute gap; stats_group reports adds, reprocesses and deletes per tenant; live_stream scans once, then applies change events.
Enlarge cover

Memoization keys, scheduled refresh and scoped stats

Zoom in to see details.

Four feature cards: memo_key builds the cache key from entry and other arguments and excludes extra; auto_refresh re-runs a processor with a 5-minute gap; stats_group reports adds, reprocesses and deletes per tenant; live_stream scans once, then applies change events.

CocoIndex reached v1.0 at the start of this cycle.

This is the first changelog since the v1 launch, covering 7 releases (1.0.1–1.0.7). The new engine APIs are memo_key on @coco.fn for control over cache keys, coco.auto_refresh() for processors that re-run on a schedule, and coco.stats_group() for stats per data slice. New connectors add OCI Object Storage and Apache Iggy sources and Neo4j, FalkorDB, and Turbopuffer targets. Security and correctness fixes and new examples follow.

CocoIndex builds fresh, structured context for AI from sources such as PDFs, codebases, emails, screenshots, and meeting notes, and keeps it up to date with an incremental engine. The source is on GitHub.

Start here

Why this release cycle matters

  • Cache keys. A per-argument memo_key leaves clients, loggers, and debug flags out of the cache key, so a cached result is reused when only those change.
  • Scheduled refresh. coco.auto_refresh() re-runs a processor on an interval as a live component, with one error-handling path and target-state reconciliation.
  • Scoped stats. coco.stats_group() reports adds / reprocesses / deletes per data slice (a tenant, a project, or a folder), not only per processor.
  • Connectors. OCI Object Storage and Apache Iggy sources; Turbopuffer, Neo4j, and FalkorDB targets; LanceDB compaction and in-place schema evolution.
  • Fixes. SQL identifier validation in the Postgres and SQLite connectors, and a fix for an ownership race that appeared only under real database latency.

Engine

memo_key: per-argument memoization control (v1.0.3)

A memoized function (@coco.fn(memo=True)) reuses its cached result while its arguments do not change. Production functions take more than data: clients, handles, config objects, loggers, tracing context, and debug flags. Those values change between runs even when the input that matters is the same, and each change invalidated the cache and re-ran transforms, embeddings, or LLM calls even though the result would be the same.

@coco.fn now accepts a per-argument memo_key, which controls which arguments take part in the memoization cache key. It maps parameter names to either a callable (transform the value before fingerprinting) or None (exclude the parameter entirely). A fingerprint is the hash CocoIndex computes from a value to decide whether it changed.

python
@coco.fn(memo=True, memo_key={"entry": lambda e: (e.name, e.version), "extra": None})
def transform(entry: SourceDataEntry, extra: str) -> str:
    ...
  • Callable: applied to the argument; its return value is fingerprinted in place of the original.
  • None: the parameter is excluded from the memo key; changing it never invalidates the cache.
  • Not listed: fingerprinted normally.

What you see. If only extra changes between runs, transform returns the cached result and does not run. If entry.version changes, the key changes and transform runs again. Other fields of entry do not affect the key.

memo_key · how the cache key is built@coco.fn(memo=True)
# exclude the handle; key only on the data that drives recomputation
@coco.fn(memo=True, memo_key={"entry": lambda e: (e.name, e.version), "extra": None})
argumentmemo_key rulein the cache keyentrySourceDataEntrylambda e: (e.name, e.version)(e.name, e.version)extrastr · a debug flag or handleNoneexcludedany other argnot listed in memo_key(default)fingerprinted as-is
why it matters · only the excluded handle changes
run Aentry=(doc1, v2)extra="debug"
run Bentry=(doc1, v2)extra="trace"
same cache key (doc1, v2)cached result reused, no recompute
Quick check: you write memo_key={"clinet": None}, with a typo in the parameter name. What happens?

CocoIndex validates memo_key when the decorator runs. An unknown parameter name raises ValueError, and a value that is neither callable nor None raises TypeError. The typo fails at import time, not silently at run time.

Read more in Memoization keys & states → Override at the call site (#1888, docs in #2000).

coco.auto_refresh(): scheduled live refresh (v1.0.7)

Some sources have no change events, such as a database table you can only query. The common live-mode answer is to run a processor on a fixed schedule. Without an engine-level primitive, every pipeline wrote its own loop and decided again how errors propagate and how missing rows get reconciled.

coco.auto_refresh() wraps any processor function as a live component (a component that keeps running and updates its output in live mode) that re-runs on an interval and routes cycle failures through one error-handling channel.

python
import datetime
import cocoindex as coco

@coco.fn
async def app_main(db, target) -> None:
    await coco.mount(
        coco.auto_refresh(sync_users, interval=datetime.timedelta(minutes=5)),
        db, target,
    )

Each cycle reconciles target states against the previous cycle. If sync_users stops declaring a row, CocoIndex deletes the corresponding target automatically.

What you see. In live mode, sync_users runs once at mount, then again 5 minutes after each cycle ends. The interval is a fixed delay, so cycles never overlap. An exception in one cycle goes to the parent’s exception handler, and the next cycle still runs. In catch-up mode (an update without live mode), sync_users runs once and the interval is ignored.

auto_refresh · a fixed delay between runsinterval=5 min
live mode
run 1wait 5 minrun 2wait 5 minrun 3
02 min7 min9 min14 min
run 2 raises: the parent's exception handler gets it, and run 3 still starts
catch-up mode
run 1no further runs: the interval is ignored
Quick check: a cycle of sync_users takes 2 minutes and the interval is 5 minutes. How often does it start?

About every 7 minutes. The 5-minute wait starts when a cycle ends, not when it starts.

See Live components → periodic refresh (#1995).

coco.stats_group(): stats per data slice (v1.0.7)

By default, CocoIndex breaks stats down by processor: each entry function (process_doc, process_code, …) reports its own counts of adds, reprocesses, and deletes. It did not break those counts down across data slices, so when one tenant caused a reprocess storm, the aggregate did not show which one.

coco.stats_group(title) opens a scope where everything mounted inside aggregates into a separate report under title, split out of the parent (no double counting). The natural slice is the data: per tenant, per project, or per source folder.

python
@coco.fn
async def app_main(tenants, target):
    for tenant in tenants:
        # same processor, but stats scoped per tenant
        with coco.stats_group(f"tenant:{tenant.id}", report_to_stdout=True):
            files = localfs.walk_dir(tenant.docs_dir, ...)
            await coco.mount_each(process_doc, files.items(), target)

What you see. Each tenant gets its own report. With report_to_stdout=True, the counts also print as log lines that start with the tenant’s title. One tenant with 600 reprocesses and another with 1,150 new adds show up as two separate lines, not as one total for process_doc.

app.update() · stats reportcoco.stats_group(title)
reportaddsreprocessesdeletes
default · one bucket per processor
process_doc+1,840~620-115which tenant?
with coco.stats_group(title) · one report per data slice
tenant:acme+1,150~20-5growing
tenant:globex+690~600-110churning
Without stats_group, every change lands in process_doc. With it, each tenant's changes move into its own report and are counted once.

The block also yields a handle with the same stats() and watch() methods as UpdateHandle, so you can stream a single slice’s counts to a dashboard. See Progress monitoring → Scoped reports (#2042).

Quick check: a file is processed inside stats_group(“tenant
”)
. Does it also count in the parent report?

No. The group’s counts are split out of the enclosing report, so each change is counted once.

Other engine improvements

  • Configurable logging: set the Python logger level directly via the COCOINDEX_LOG_LEVEL environment variable (#2035).
  • Cleaner Rust internals: the workspace was unified and the core SDK isolated from PyO3 (the Rust-to-Python binding library), separating the engine from its Python bindings as groundwork for native Rust consumers of the engine (#1973).

Built-in operations

LiteLLM speech-to-text (v1.0.1)

CocoIndex added speech-to-text (STT) support through LiteLLM (#1889), so audio sources can be transcribed inside a pipeline using an STT provider that LiteLLM supports. A LiteLLMTranscriber wraps the transcription API:

python
from cocoindex.ops.litellm import LiteLLMTranscriber

transcriber = LiteLLMTranscriber("whisper-1")
transcript = await transcriber.transcribe(audio_file)

What you see. transcribe() takes an audio file (a FileLike) and returns the transcript as a string.

Code splitter: 8 new languages (v1.0.3 to v1.0.7)

The RecursiveSplitter gained tree-sitter support for 8 new languages this cycle. With tree-sitter, chunks follow the syntax tree, so a function or a block stays in one chunk instead of being cut at a fixed line or character count.

  • Svelte and Vue: component-aware chunking for frontend code (#1937)
  • Julia: for scientific and numerical codebases (#1942)
  • Elm (#1955) and Astro (#1984)
  • Bash, CMake, and HCL: shell scripts, build files, and Terraform/infra configs (#1954)

Pass the language name to language= (or let detect_code_language() infer it from a filename):

python
from cocoindex.ops.text import RecursiveSplitter

splitter = RecursiveSplitter()
chunks = splitter.split(source_code, chunk_size=2000, chunk_overlap=200, language="svelte")
code chunking · fixed window vs syntax treeexample, small chunk_size
fixed window · 4 lines per chunk
chunk 1 · cuts the function
<script>
  let count = 0;
  function increment() {
    count += 1;
chunk 2 · cuts the function
  }
</script>
<button on:click={increment}>
  Clicked {count} times
chunk 3
</button>
RecursiveSplitter · language="svelte"
chunk 1 · <script>
<script>
  let count = 0;
  function increment() {
    count += 1;
  }
</script>
chunk 2 · <button>
<button on:click={increment}>
  Clicked {count} times
</button>

Entity resolution: parallel by default (v1.0.7)

Entity resolution (dedup-and-canonicalize a set of extracted entity names) now resolves independent connected components of the candidate graph in parallel. Names that cannot match each other no longer wait on each other, which speeds up LLM-backed deduplication on large entity sets (#2006).

entity resolution · one task per connected componentexample names
candidate graph · connected components
resolved in parallel
Acme CorpACMEAcme Inc.
Acme Corp
J. SmithJohn Smith
John Smith
Neo4jneo4j
Neo4j
Names in different components never match, so no component waits for another.

Connectors

Source: OCI Object Storage with live bucket watching (v1.0.1)

A new Oracle Cloud Infrastructure (OCI) Object Storage source mirrors the S3 source’s API for scanning a bucket, and adds an optional live mode.

It shows the stream–state duality in CocoIndex’s source model. A bucket is state: list_objects() scans it and establishes the full set of objects. A change feed is a stream: when you supply a live_stream, CocoIndex does the initial scan once and then keeps watching, applying createobject / updateobject / deleteobject events incrementally instead of rescanning. For OCI those events flow through OCI Streaming, consumed over the Kafka protocol; an event-time cutoff with a 5-second clock-skew tolerance decides which streamed events predate the scan. It is built on a new lower-level LiveStream abstraction: a keyless stream of messages with in-memory watermark tracking (the position up to which messages are processed) and ack-on-completion (#1905).

What you see. With live_stream set, the walker’s items() returns a live view instead of a plain list. Passed to mount_each(), it processes new, updated, and deleted objects as their events arrive, without a full rescan.

a source is a scan plus a change streamLiveMapView
state · initial scanlist_objects()Walks the bucket once and establishes the full set of objects.
stream · change feedLiveStream
createupdatedelete
Keyless, watermark-tracked, acked on completion.
live view · mergeLiveMapViewScan once, then apply each event. Only what changed is reprocessed: no full rescan.
sourcewhere the change stream comes fromlive modeLocal file systemOS file-system eventslive todayOCI Object StorageOCI Streaming · Kafka protocollive todayAmazon S3, and morenot yetlater

The local file system source uses the same model, with the change stream from OS file-system events instead of Kafka. More sources, such as S3, will gain live mode over time.

Source: Apache Iggy (v1.0.7)

CocoIndex now reads from Apache Iggy, a persistent message-streaming platform (#1969). The Iggy source exposes one topic partition either as a raw live stream of messages (topic_as_stream()) or as a live keyed map (topic_as_map()), where a key function derives the application-level key from each message. The same connector also ships an Iggy topic target. Install it with pip install "cocoindex[iggy]".

Target: Turbopuffer (v1.0.3)

A new Turbopuffer target connector landed, along with a runnable text-embedding example (#1934).

Target: Neo4j (v1.0.3)

A native Neo4j property-graph target landed alongside a meeting_notes_graph_neo4j example, mapping nodes and relationships into Neo4j without writing Cypher by hand (#1932).

Target: FalkorDB (v1.0.1)

The FalkorDB property-graph target was brought forward into the v1 connector set, with support for nodes, relationships, and vector/FTS (full-text search) indexes (#1908).

Target: LanceDB (v1.0.7)

LanceDB got two upgrades for production workloads:

  • The v1 target now optimizes (compacts) tables periodically in the background, keeping query performance steady as data churns (#2008, with a scheduling fix in #2013).
  • Table targets can add new columns in place, so schema evolution doesn’t require a rebuild (#1951).

Fixes

Postgres correctness

  • halfvec op classes are now used for indexes on half-precision vectors (#2029).
  • U+0000 (NUL) bytes are stripped when writing text/jsonb, so Postgres no longer rejects otherwise-valid payloads (#2032).
  • The pgvector extension now installs into the default schema, avoiding search_path surprises (#1979).

Other fixes

  • SQL identifier validation (v1.0.4): the Postgres and SQLite connectors now validate table and column identifiers before interpolating them into statements, closing a class of SQL-injection vectors at the connector boundary (#1947, #1965).
  • Ownership-transfer race (v1.0.7): when a target state moves from one component to another, a pending-state protocol closes a preempt race, so the transfer stays correct under Postgres I/O latency and not only on fast LMDB, where it takes microseconds (#1994).
  • Clean cancellation: cancellation propagates through task spawn boundaries, tearing work down cleanly instead of leaking orphaned tasks (#1902).
  • on_error cascade: errors cascade through the Build-mode GC sweep (#1999).
  • numpy serde: _frombuffer is registered under both numpy 1.x and 2.x paths (#2012).
  • Responsive progress display: the PTY reader moved onto a dedicated OS thread, keeping the async runtime responsive under heavy logging (#2033, #2040).

Examples

Meeting notes → knowledge graph, now on Neo4j

Auto-updating knowledge graph from meeting notes
  1. Meeting notes
  2. CocoIndex + LLM extraction
    • Identify changes
    • Extract structure
    • Map relationships
  3. Knowledge graph · Neo4j
    • Meetings
    • People
    • Tasks

Meeting Notes Knowledge Graph

The meeting-notes-to-knowledge-graph example now ships in a Neo4j flavor (meeting_notes_graph_neo4j). It watches a folder of meeting notes, uses LLM extraction to pull out structured entities (Meetings, People, Tasks) and the relationships between them, then maps everything into Neo4j as nodes and edges. When one note changes, CocoIndex reprocesses only that note and updates the graph.

Turbopuffer and OCI text-embedding examples

Two more end-to-end examples landed alongside the new connectors: text_embedding_turbopuffer shows a complete embed-and-query pipeline against Turbopuffer, and oci_object_storage_embedding ingests from OCI Object Storage with live bucket watching.

Video: build it end to end on FalkorDB

The Build with CocoIndex walkthrough builds the meeting-notes-to-knowledge-graph pipeline end to end on FalkorDB. The meeting_notes_graph_falkordb example has the same code to run yourself.

What to try next

  • Keep a client out of the cache key. Add memo_key={"client": None} to a memoized function that takes a client, as in the memo_key example.
  • Refresh a source that has no change events. Mount coco.auto_refresh(fn, interval=...) in live mode, as in the auto_refresh example.
  • See stats per tenant or folder. Wrap a mount_each() in with coco.stats_group(title, report_to_stdout=True):.
  • Chunk code by syntax. Pass language= to RecursiveSplitter.split() for one of the new languages.

For the complete list of changes, see the GitHub releases.

Thanks to the community

Thanks to everyone who contributed this cycle.

@prrao87

@zherendong

@countradooku

@Haleshot

@galshubeli

@galshubeli

Thanks @galshubeli for bringing the FalkorDB target connector into the v1 connector set.

@Gohlub

@Gohlub

Thanks @Gohlub for adding LiteLLM speech-to-text support, CocoIndex’s first audio operation.

@MrAnayDongre

@aaronjmars

@tuanaiseo

@nuthalapativarun

@qWaitCrypto

@shaiar

@octo-patch

@phuctoan123

Frequently asked questions

How do I avoid re-embedding my whole corpus when one document changes?

Build the pipeline on CocoIndex's incremental engine instead of a re-index script. You declare the target state ("these documents, chunked and embedded, should exist in this vector store"), and CocoIndex fingerprints every input and intermediate value. When one document changes, only that document is re-chunked and re-embedded; everything else is served from cache, and rows for deleted sources are removed automatically. There is no separate "initial load" vs. "incremental update" code path. This engine powers the 1.0 releases. See The short version and the Incremental processing deep dive.

How do I cache expensive LLM extraction calls so they don't re-run every pipeline run?

Mark the function with @coco.fn(memo=True) and CocoIndex fingerprints its inputs, returning the cached result whenever they're unchanged. An LLM extraction, embedding, or transcription call never re-runs for input it has already seen. This cycle added per-argument memo_key for fine-grained control: map each parameter to a callable (transform the value before fingerprinting) or None (exclude it entirely). See Per-argument memoization control in this changelog and Memoization keys & states in the docs.

How do I exclude a client, logger, or config argument from an LLM cache key?

Use memo_key on @coco.fn to pass None for any parameter that shouldn't participate in the cache key:

@coco.fn(memo=True, memo_key={"client": None, "entry": lambda e: (e.name, e.version)})

A parameter set to None is excluded, so changing it never invalidates the cache. A callable is applied to the argument and its return value is fingerprinted in place of the original. That keeps the cache keyed to the semantic input, so clients, handles, loggers, tracing context, and debug flags stop triggering needless recomputation of expensive LLM calls. See Per-argument memoization control and the docs section Override at the call site with memo_key.

How do I keep a vector database continuously in sync with a folder, S3, or object-storage bucket?

Run the pipeline in live mode. File sources (local, S3, OCI Object Storage) watch for changes and re-derive only the affected rows; for sources without native change events, wrap the processor in coco.auto_refresh(fn, interval=...) to re-run it on a schedule with unified error handling and automatic target reconciliation. If a row stops being declared, its target is deleted. The new OCI Object Storage source opts into live bucket watching over an OCI Streaming topic. See coco.auto_refresh for live components, the live-component docs, and the Continuous updates walkthrough.

How do I run LLM-based entity resolution / dedup without it being painfully slow?

CocoIndex's entity resolution now runs in parallel: it splits the candidate graph into connected components and resolves each one concurrently, so entities that can't possibly match no longer wait on each other. On large entity sets this speeds up LLM-backed deduplication. Combined with memoization, an entity pair that was already judged isn't re-sent to the model on the next run. See Parallel entity resolution.

What's the best way to chunk code for RAG (syntax-aware code chunking)?

Use RecursiveSplitter, which chunks along the syntax tree (via tree-sitter) instead of fixed line or character windows, so functions, classes, and blocks stay intact rather than being split mid-structure. This cycle added 8 new languages: Svelte, Vue, Julia, Elm, Astro, Bash, CMake, and HCL (Terraform). Pass language= explicitly or let detect_code_language() infer it from the filename. See Code splitter: 8 new languages and the end-to-end Index a codebase for RAG guide.

How do I get per-stage observability and stats in a data pipeline?

Wrap each phase in with coco.stats_group("Indexing docs"): and everything mounted inside aggregates into a separate report, split out of the parent with no double counting, so you can see whether docs ingestion, code indexing, extraction, or graph writes account for runtime and churn. The block also yields a handle with the same stats() and watch() methods as UpdateHandle, so a single phase's progress can stream to a dashboard. See Scoped stats reports and Progress monitoring → Scoped reports.

To export logs, metrics and traces to the observability stack you already run, CocoIndex Plus adds OpenTelemetry export; see CocoIndex Plus.

How do I write embeddings to Turbopuffer, LanceDB, or FalkorDB from Python?

Each is a built-in target connector. Declare it as your pipeline's target and CocoIndex handles upserts, deletes, and incremental reconciliation. Turbopuffer brings serverless, object-storage-backed vector + full-text search (with a ready embedding example); LanceDB now compacts tables in the background and adds columns in place for schema evolution without a rebuild; FalkorDB is a Redis-based property graph with nodes, relationships, and vector/FTS indexes. See Target: Turbopuffer, Target: LanceDB, and Target: FalkorDB.

How do I build a streaming / Kafka-driven RAG pipeline?

Use a streaming source and let live mode drive the pipeline off the event stream. The new OCI Object Storage source consumes change events over the Kafka protocol (an OCI Streaming topic) on top of a low-level LiveStream abstraction with watermark tracking and ack-on-completion, and the new Apache Iggy source reads from the Iggy message-streaming platform as a live stream. Each streamed change re-derives only the affected rows and embeddings. For the Kafka target side, which publishes diff-only change events to a topic, see Stream CSV changes to Kafka.

Build fresh context for your agents.

CocoIndex keeps derived data in sync with its sources. Only what changed re-runs.