Skip to main content

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 version Print the installed version

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"]

Validation problems come back as data; only usage errors raise (KnottError subclasses).

For agents

See skills/knott/SKILL.md, an Agent Skill describing how to read schemas, write entities and relations, and validate.

Development

uv sync
uv run pytest
uv run ruff check src tests
uv run mypy

Metadata

Release files for knott 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 knott 0.1.0
File Size Uploaded
knott-0.1.0.tar.gz 91.0 kB Details

Built distribution (wheel)

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

Total release size: 114.5 kB

Release files / knott-0.1.0.tar.gz

Download URL knott-0.1.0.tar.gz
Size 91.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5598bb02e9b2ff647a2a2a7064edf9b5b2b443771b4780425380bb75a9e74d83
BLAKE2b-256 checksum
How to use checksums
553ea4f4420e2f4e95c04f5d618014351135c281b0de0bb736455e4bee53e1c8
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.1.0-py3-none-any.whl

Download URL knott-0.1.0-py3-none-any.whl
Size 23.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a76efc7d00b6354ad7b762111e3cee9e01569294f0514fe094ec63a28cd615c6
BLAKE2b-256 checksum
How to use checksums
9edf8af0af0fed551b02cb3ff41a7a05dd284eb5e1868d84c0f55b616c4d0895
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 history Release notifications | RSS feed

0.3.0

2 release files

0.2.0

2 release files

This release

0.1.0 This release

2 release files

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