cairn-core
The local-first file-organization engine behind the Cairn harness.
Pure Python, standard library only. A workspace is just a directory; the
.uni document format is plain JSON with tags stored in-file. Everything the
harness can do — list, read, search, grep, edit, move, tag, retrieve — is a
plain function over a Workspace, so the MCP server, a CLI, or a web backend
are each thin adapters over this one package.
from cairn_core import Workspace, FileService, tags, retrieval
ws = Workspace("~/Documents/notes")
fs = FileService(ws)
fs.create_file("", "hello.uni", "Hello world")
fs.get_tree()
tags.set_tags(ws, "hello.uni", ["greeting"])
retrieval.semantic_retrieve(ws, "hello", k=3)
Importing real documents
The core is stdlib-only, but the optional convert extra adds parsers to turn
.docx/.pdf/.pptx/.csv/.xlsx/.md files into editable .uni docs:
pip install "cairn-core[convert]"
fs.import_file("report.docx") # -> report.uni (original kept)
fs.import_tree() # import every convertible file under the workspace
Missing a parser raises a ConversionError with an install hint — nothing
crashes silently.
Semantic retrieval
retrieval.semantic_retrieve is lexical by default (zero-dep). Install the
embeddings extra and configure any OpenAI-compatible endpoint to upgrade it to
vector search — documents are embedded into a local SQLite index under
<workspace>/.cairn/ (incremental by mtime), and ranked by cosine similarity:
pip install "cairn-core[embeddings]"
export CAIRN_EMBED_API_KEY=sk-... # or OPENAI_API_KEY
export CAIRN_EMBED_BASE_URL=https://api.openai.com/v1 # or a local server
export CAIRN_EMBED_MODEL=text-embedding-3-small
Same call, better ranking — and it silently falls back to lexical if the endpoint is unreachable. Nothing leaves your machine unless you configure an endpoint.
No database, no object store, no cloud. The filesystem is the source of truth.
Metadata
Release files for cairn-core 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cairn_core-0.3.1.tar.gz | 115.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cairn_core-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 179.9 kB
Release files / cairn_core-0.3.1.tar.gz
| Download URL | cairn_core-0.3.1.tar.gz |
|---|---|
| Size | 115.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b059d90a27fd836810141e13c602c2e7b371a932c6a73d6a1252e5891ce33d2
|
|
BLAKE2b-256 checksum How to use checksums |
05e9f67d5e016f47258fff5280e8561895f839272deb5297dba3e949235e6c31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / cairn_core-0.3.1-py3-none-any.whl
| Download URL | cairn_core-0.3.1-py3-none-any.whl |
|---|---|
| Size | 64.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9a39afe7f7b116b702735d38a828b82ce566ef40d5fcf23b9ac4b1cda58e87cb
|
|
BLAKE2b-256 checksum How to use checksums |
d3549c6b59d3fe6f1c2ce3e2a918ad0cde4236afc71bc2ee69dd087ec4ae0362
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|