Skip to main content

Local-first file-organization engine (the .uni format + file tools). Standard library only.

Project description

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.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

cairn_core-0.2.0-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cairn_core-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 24.8 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 319313442e2fb3091bd4e44ce9647d6f2616928e6f1ed53aa94f8d1247317f24
MD5 f892423c422a726f665bacc450ff989d
BLAKE2b-256 f684d0c6919946f8af41449d439e6d6b3aef72528b48ed941a86582060c95ec9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page