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

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.2.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.2.0
File Size Uploaded
knott-0.2.0.tar.gz 104.0 kB Details

Built distribution (wheel)

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

Total release size: 132.6 kB

Release files / knott-0.2.0.tar.gz

Download URL knott-0.2.0.tar.gz
Size 104.0 kB
Tags Source
SHA-256 checksum
How to use checksums
be929ff167e060e2c840cffdb833a4eba213d973c4106df80961ddba2222eb23
BLAKE2b-256 checksum
How to use checksums
6b2c2107b58b257d971db1cccad71d67a2ef18e0dfe192557ea1c48507467401
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.2.0-py3-none-any.whl

Download URL knott-0.2.0-py3-none-any.whl
Size 28.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17e62cd91cef09afe50610a61e2d8c3afe4407a6b2a3a96083fbfe62a795cf3a
BLAKE2b-256 checksum
How to use checksums
87731b1babac19d0508c25c06ea8b1a432e0b433798c6d81e418fcde27fe6f39
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

This release

0.2.0 This release

2 release files

0.1.0

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