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, --fix to add missing kids) |
knott types [--verbose] |
List discovered types (--verbose: attributes, nested shapes and relations) |
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, plus list, object and map built from them and nested to any depth. 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.
Structured attributes are checked at every level, and problems name their exact location, e.g. senses[1].ru:
attributes:
senses:
type: list
required: true
items:
type: object
fields:
id: {type: string, required: true}
ru: {type: string, required: true}
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.
Stable identity
knott validate --fix gives every entity a kid, a knott-managed UUID that survives moves and renames. A relation can then refer to it as kid:<uuid>. A schema can require one with kid: required. Markdown links stay the recommended form; use kid: where a reference must survive renames.
kid: 3f2b8c1e-9d4a-4c2e-b7f1-0a6d5e9c8b21
includes:
- kid:0192f4a1-7c3e-4b2a-9f10-3d5e8c2b4a61
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.4.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 | Provenance | |
|---|---|---|---|---|
| knott-0.4.0.tar.gz | 155.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| knott-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 205.5 kB
Release files / knott-0.4.0.tar.gz
| Download URL | knott-0.4.0.tar.gz |
|---|---|
| Size | 155.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f490a8330369605adbaa338dc935606e9c69d71973f879fe268b2f078940546e
|
|
BLAKE2b-256 checksum How to use checksums |
c39cf1b433f6cd260cb68c5535b3f43c663145024df17740f7bae79102c38fd3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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.4.0-py3-none-any.whl
| Download URL | knott-0.4.0-py3-none-any.whl |
|---|---|
| Size | 50.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b43f447d8557a37b70da104f874b0e0f27e86e0c0fe3002ade5d91298ef357a0
|
|
BLAKE2b-256 checksum How to use checksums |
78cccd6cbd76c59641f8dcf3601dbd972f6db83ea474ca8916e57da1837e932e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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}
|
Security for knott 0.4.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.