A git-backed, MCP-served knowledge graph for AI coding agents.
Project description
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--prunereconciliation. - 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 validateis 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file canonia-0.1.0.tar.gz.
File metadata
- Download URL: canonia-0.1.0.tar.gz
- Upload date:
- Size: 68.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0428e6d3915d9a9ec2f582e448a6b3e0ef5228143804a1a35dab514b49eb1b3d
|
|
| MD5 |
ad778416583dda18a31612cf7b928f06
|
|
| BLAKE2b-256 |
7992f963d93c8b7c19021479288f7041cb5ede54a7807e311e03f4038ab2ede9
|
Provenance
The following attestation bundles were made for canonia-0.1.0.tar.gz:
Publisher:
publish.yml on canonia/canonia
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
canonia-0.1.0.tar.gz -
Subject digest:
0428e6d3915d9a9ec2f582e448a6b3e0ef5228143804a1a35dab514b49eb1b3d - Sigstore transparency entry: 2108896395
- Sigstore integration time:
-
Permalink:
canonia/canonia@c8e8e734b34abea208603c48edce6a4786ed7a9c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/canonia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c8e8e734b34abea208603c48edce6a4786ed7a9c -
Trigger Event:
release
-
Statement type:
File details
Details for the file canonia-0.1.0-py3-none-any.whl.
File metadata
- Download URL: canonia-0.1.0-py3-none-any.whl
- Upload date:
- Size: 63.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aed7ef1bf3f6881ab1586ed2241ddd8c2ba210910262cf54c4c20aa4ba60d716
|
|
| MD5 |
5ab9321a310cd982bd55c3b439dfdbaa
|
|
| BLAKE2b-256 |
e969281fd76660b8ba4c6127feadb15fa41d7f3e4b19219c46b2c82d7fea33ca
|
Provenance
The following attestation bundles were made for canonia-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on canonia/canonia
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
canonia-0.1.0-py3-none-any.whl -
Subject digest:
aed7ef1bf3f6881ab1586ed2241ddd8c2ba210910262cf54c4c20aa4ba60d716 - Sigstore transparency entry: 2108896475
- Sigstore integration time:
-
Permalink:
canonia/canonia@c8e8e734b34abea208603c48edce6a4786ed7a9c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/canonia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c8e8e734b34abea208603c48edce6a4786ed7a9c -
Trigger Event:
release
-
Statement type: