Skip to main content

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cairn_core-0.3.1.tar.gz (115.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cairn_core-0.3.1-py3-none-any.whl (64.3 kB view details)

Uploaded Python 3

File details

Details for the file cairn_core-0.3.1.tar.gz.

File metadata

  • Download URL: cairn_core-0.3.1.tar.gz
  • Upload date:
  • Size: 115.6 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for cairn_core-0.3.1.tar.gz
Algorithm Hash digest
SHA256 1b059d90a27fd836810141e13c602c2e7b371a932c6a73d6a1252e5891ce33d2
MD5 0002d2da1b11a6e2f69bd219ef682286
BLAKE2b-256 05e9f67d5e016f47258fff5280e8561895f839272deb5297dba3e949235e6c31

See more details on using hashes here.

File details

Details for the file cairn_core-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: cairn_core-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 64.3 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for cairn_core-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9a39afe7f7b116b702735d38a828b82ce566ef40d5fcf23b9ac4b1cda58e87cb
MD5 fc18c168bc573b19aee37396920e03af
BLAKE2b-256 d3549c6b59d3fe6f1c2ce3e2a918ad0cde4236afc71bc2ee69dd087ec4ae0362

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 files

0.2.0

2 files

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