knott
A local, file-first knowledge layer for AI agents.
Markdown files are the source of truth. Knott adds structure (typed entities), semantics (relations between them), and validation, without turning your notes into an opaque database. A Knott vault stays useful without Knott: browse it in a file manager, read it in any editor, open it in Obsidian, diff it in Git.
Install
uvx knott --help # run without installing
uv add knott # or add it to a project
Requires Python 3.12+.
Quick start
mkdir my-vault && knott init my-vault
Define a type in my-vault/.knott/schemas/script.yaml:
type: script
description: A script for a recorded episode.
attributes:
title:
type: string
required: true
and one that relates to it, .knott/schemas/transcript.yaml:
type: transcript
relations:
derived_from:
target: script
Write entities as ordinary Markdown with frontmatter, anywhere in the vault:
---
type: transcript
title: Episode 42 transcript
derived_from: "[Episode 42](../scripts/foo.md)"
---
# Transcript
Then validate:
$ knott validate
✓ 2 schemas
✓ 2 entities
✓ 1 relation
✓ vault is valid
Commands
| Command | Purpose |
|---|---|
knott init [PATH] |
Create .knott/schemas/ and .knott/config.yaml |
knott validate [PATH...] |
Check all schemas, plus all entities or those under PATH (--format json for agents) |
knott types [--verbose] |
List discovered types |
knott view [PATH] |
Draw the ontology as an HTML page and open it (-o FILE, --no-open) |
knott version |
Print the installed version |
knott skill install [PATH] |
Install the bundled Agent Skill to .claude/skills and/or .agents/skills (--claude, --agents; asks interactively without flags) |
Exit codes: 0 valid, 1 validation issues, 2 usage or configuration error.
Schemas
Schemas live in .knott/schemas/**/*.yaml, one type per file. Attribute types: string, integer, number, boolean, date, datetime. Typing is strict: an unquoted no is a boolean, not a string. Relations name a target type and are stored only on the source entity.
Relations
A relation value is a relative path or a quoted Markdown link, or a list of them, resolved relative to the containing file:
derived_from: ../scripts/episode-42.md
derived_from: "[Episode 42 script](../scripts/episode-42.md)"
Wikilinks, URLs, #fragments, and absolute paths are rejected. Matching is case-sensitive on every OS.
Obsidian
Markdown links in properties are clickable in Obsidian 1.11+ and are updated on rename. Use these settings:
- Files & links → New link format: Relative path to file
- Use [[Wikilinks]]: off
Python API
from knott import Knott
vault = Knott.open(".") # walks up to the vault root
result = vault.validate() # or vault.validate(["transcripts/foo.md"])
result.ok, result.issues, result.stats
vault.types() # ["script", "transcript"]
vault.ontology() # Ontology(vault, types, schema_issues)
Validation problems come back as data; only usage errors raise (KnottError subclasses).
For agents
Knott ships an Agent Skill describing how to read schemas, write entities and relations, and validate (SKILL.md). Install it into a project:
knott skill install # pick targets interactively
knott skill install --claude # .claude/skills/knott/ (Claude Code)
knott skill install --agents # .agents/skills/knott/ (Codex and other agents)
Development
uv sync
uv run pytest
uv run ruff check src tests
uv run mypy
Metadata
Release files for knott 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| knott-0.3.0.tar.gz | 125.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| knott-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 165.3 kB
Release files / knott-0.3.0.tar.gz
| Download URL | knott-0.3.0.tar.gz |
|---|---|
| Size | 125.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
70799f8834b0f11bc7f265bff4f88f8d8f14a24f36e717403a636827b7914ee8
|
|
BLAKE2b-256 checksum How to use checksums |
c53e3f936a6b8a112ac8bdcdbb4cdf945d7ad4ba9600fd121ee861fbfe4eb028
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / knott-0.3.0-py3-none-any.whl
| Download URL | knott-0.3.0-py3-none-any.whl |
|---|---|
| Size | 40.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0cf3f80d267088f14c80db8e335444dd8bd9048f32de5271b6a385669bfc0db9
|
|
BLAKE2b-256 checksum How to use checksums |
25b5174321eb17dc874dd00255d9da9890ab9773102525f0ea06d0f6847dc629
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|