Skip to main content

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-in SemanticIndex (caller-supplied embedder; no model SDK imported), graph traversal via cairn-engine; ranked lists merged with fuse (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 and intents/ for the constraint-tested design of each module.

Install

pip install cairn-retrieval   # pulls cairn-engine automatically

License

MIT — Copyright (c) 2026 Leo Celis

Metadata

Release files for cairn-retrieval 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cairn-retrieval 0.1.0
File Size Uploaded Provenance Actions
cairn_retrieval-0.1.0.tar.gz 48.0 kB Without provenance Details for cairn_retrieval-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cairn-retrieval 0.1.0
File Interpreter ABI Platform Actions
cairn_retrieval-0.1.0-py3-none-any.whl Python 3 none any Details for cairn_retrieval-0.1.0-py3-none-any.whl

Total release size: 69.4 kB

Release files / cairn_retrieval-0.1.0.tar.gz

Download URL cairn_retrieval-0.1.0.tar.gz
Size 48.0 kB
Tags Source
SHA-256 checksum
How to use checksums
01c6c46e32ea0c6aaec94afa88e30efab1528ea99f6c0180cd1f576882fca530
BLAKE2b-256 checksum
How to use checksums
c7074afa59630be6363db010852ccf5ae4f6436f0f13e60252c252c493878198
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Release files / cairn_retrieval-0.1.0-py3-none-any.whl

Download URL cairn_retrieval-0.1.0-py3-none-any.whl
Size 21.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
22401b0ca36637df55ee214335553526b2eddcba26bfccc97314f58c7fc6de2e
BLAKE2b-256 checksum
How to use checksums
d381104d8fa843405bf5fbffdc5bfdcde4e6b15e4187c694ff8060a04f0814d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Security for cairn-retrieval 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page