Skip to main content

Canonia

A git-backed, MCP-served knowledge graph for AI coding agents — one canonical source of truth that many repositories reference instead of copying.

Status: pre-alpha (v0.1 feature-complete). Working today: the concept schema, the graph gates (schema + dangling-reference), the importer (canonia import), the MCP server (canonia serve), the optional local semantic index (canonia index), and the static site (canonia build). Governance/access control is a deliberate future module — until then, serve a canon privately (see docs/deploying.md).

The idea

Knowledge that AI agents (and humans) rely on tends to get copied into every repository's CLAUDE.md / AGENTS.md / docs — and then drifts out of sync. Canonia inverts that:

  • One canon — a git repository of small, single-concept Markdown files (the source of truth). Versioned, mergeable, authored by humans and agents.
  • Reference, not copy — each consuming repo holds a concept id, not a duplicated copy.
  • Fetch on demand over MCP — agents query the Canonia MCP server for a concept when they need it, and write updates back so every other session and repo inherits them.
  • A graph, not a tree — concepts link to concepts; backlinks and a browsable web view come for free.
  • Versioning & authorship from git — every change is a commit, so history and "who (human or agent) changed what" are built in.
 producers            serving layer                consumers
 ─────────            ─────────────                ─────────
 Claude / agents ─▶  Canonia MCP server  ─▶  reference a concept id
 you (git commit) ─▶  (search·get·write)  ─▶  read-only web view (graph)
                          │
                    your canon (git repo = source of truth) ─▶ GitHub

Quickstart

The end-to-end path: install → create a canon → seed it from docs you already have → make it searchable → point your agent at it → browse it. Each step links to its full guide.

# 1. Install (the [semantic] extra adds local embedding search; omit for a lean install)
pip install 'canonia[semantic]'

# 2. Create a canon (a git repo of concepts) and version it
canonia init my-canon --domains process,infra,ops
cd my-canon && git init

# 3. Seed it from markdown you already have — dry-run first, then --commit
canonia import --zero-config ../my-existing-notes --domain process        # preview
canonia import --zero-config ../my-existing-notes --domain process --commit
canonia validate            # schema + dangling-reference gates must pass

# 4. Build the semantic index (enables hybrid keyword+semantic search)
canonia index build

# 5. Point your LLM/agent at the canon over MCP (see the guide for your client)
canonia serve --canon .     # stdio MCP server: search / get / create / update / …

# 6. Browse the graph as a static site (open offline, or serve privately)
canonia build && open site/index.html
  • installing — requirements, install options, canonia init.
  • importing — zero-config vs curated mapping.yml, dry-run, duplicate detection, and --prune reconciliation.
  • using with agents — connect and instruct your LLM (Claude Code, Claude Desktop, Cursor, and other MCP clients) to actually use the canon.
  • indexing — the offline semantic index and hybrid search.
  • deploying — serve the canon privately (no built-in auth yet).

What each command does

Command Purpose Guide
canonia init scaffold a canon (canonia.yml, concepts/, .gitignore) installing
canonia import seed a canon from existing repos (curated or zero-config; --prune to reconcile) importing
canonia validate run the schema + dangling-reference gates maintaining
canonia index build the local semantic index; search / find duplicates indexing
canonia serve run the MCP server agents read/write concepts through using with agents
canonia build generate the static site (browsable graph + backlinks) deploying

Configuration for all of them lives in one file, canonia.yml (configuring). Concepts retire without breaking links (Wikipedia-style deprecate / merge / archive) — see lifecycle.

Design notes

  • Reference, not copy — two link layers: references: frontmatter (the authoritative graph the gate enforces) + [[id]] inline links in prose.
  • No locking — git merge / optimistic concurrency instead, so async agent sessions never block each other.
  • Permissive writes, strict gate — agents can create a concept that references one that doesn't exist yet (a warning); canonia validate is the hard gate for CI.
  • Fully offline & private — the semantic index runs a local ONNX model; a private canon never leaves your machine. The site makes zero external requests.
  • Governance is a future module — a no-op access seam (access.py) is wired now and will scope humans and LLM identities later.

Contributing / from source

git clone https://github.com/canonia/canonia && cd canonia
pip install -e ".[dev]"     # editable install + test/lint deps
pytest -q                   # test suite
ruff check src tests && mypy # lint + type gate (also enforced in CI)

License

Apache-2.0 © 2026 André Lopes

Metadata

Release files for canonia 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 canonia 0.1.0
File Size Uploaded Provenance
canonia-0.1.0.tar.gz 68.5 kB With provenance Details

Built distribution (wheel)

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

Total release size: 132.1 kB

Release files / canonia-0.1.0.tar.gz

Download URL canonia-0.1.0.tar.gz
Size 68.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0428e6d3915d9a9ec2f582e448a6b3e0ef5228143804a1a35dab514b49eb1b3d
BLAKE2b-256 checksum
How to use checksums
7992f963d93c8b7c19021479288f7041cb5ede54a7807e311e03f4038ab2ede9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 7, 2026.

Transparency log

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

Download URL canonia-0.1.0-py3-none-any.whl
Size 63.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aed7ef1bf3f6881ab1586ed2241ddd8c2ba210910262cf54c4c20aa4ba60d716
BLAKE2b-256 checksum
How to use checksums
e969281fd76660b8ba4c6127feadb15fa41d7f3e4b19219c46b2c82d7fea33ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 7, 2026.

Transparency log

Security for canonia 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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for canonia-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 7, 2026.

Transparency log

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 Full 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