Agent-retrieval layer on top of the Cairn entity engine — adaptive gate, signal orchestration (lexical/semantic/graph), and minimal context assembly. Zero generative-LLM on the hot path.
Project description
cairn-retrieval
The agent-retrieval layer on top of the cairn-engine entity engine.
The three retrieval primitives above the entity map — all deterministic, all generative-LLM-free on the default path:
- A · Adaptive gate (
gate) — two-stage, LLM-free decision before any signal runs: deterministic bypass (temporal markers, multi-entity relational, private entities) then a CA-RAG utility cost function.strategy=none(skip retrieval) is a first-class, reachable outcome — selective retrieval beats always-on empirically. - C · Signal orchestration —
LexicalIndex(pure-Python BM25) +scan(exact/regex), opt-inSemanticIndex(caller-supplied embedder; no model SDK imported), graph traversal viacairn-engine; ranked lists merged withfuse(Reciprocal Rank Fusion, k=1, rank-only — no score normalization). - E · Context assembler (
assemble) — budget → MMR select → cosine dedup → fold ordering (strongest evidence at the edges) → provenance-tagged emit with a trace manifest. Never re-embeds; zero LLM.
RetrievalEngine.retrieve(query, *, budget) ties them end-to-end:
resolve → gate → orchestrate → fuse → assemble. A query the gate routes to
none returns no context at all — the skip is the point.
Also here: rank_links — TF-IDF-cosine document↔document link recommendation
over shared canonical concepts — and suggest_connections — cold-start link
prediction: rank the existing entities a NEW candidate node should connect to
(content-first, seed-optional structural signal, full provenance).
Status: feature-complete, 0.x. Stays 0.x until the benchmark phase (OP-31 eval vs. agentic-grep / vector-RAG / Graphiti) proves the quality claims. Depends only on
cairn-engine(which is itself zero-dependency). See the roadmap andintents/for the constraint-tested design of each module.
Install
pip install cairn-retrieval # pulls cairn-engine automatically
License
MIT — Copyright (c) 2026 Leo Celis
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cairn_retrieval-0.1.0.tar.gz.
File metadata
- Download URL: cairn_retrieval-0.1.0.tar.gz
- Upload date:
- Size: 48.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01c6c46e32ea0c6aaec94afa88e30efab1528ea99f6c0180cd1f576882fca530
|
|
| MD5 |
86d247231b0deae19628dde8e589159a
|
|
| BLAKE2b-256 |
c7074afa59630be6363db010852ccf5ae4f6436f0f13e60252c252c493878198
|
File details
Details for the file cairn_retrieval-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cairn_retrieval-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22401b0ca36637df55ee214335553526b2eddcba26bfccc97314f58c7fc6de2e
|
|
| MD5 |
266109ac61ced100aa2df5cea1a8d23f
|
|
| BLAKE2b-256 |
d381104d8fa843405bf5fbffdc5bfdcde4e6b15e4187c694ff8060a04f0814d1
|