Skip to main content

A toolkit for the agent-facing documentation of a repository: the coding rules, feature docs and skills that agents read while they work.

Lorecraft keeps that documentation consistent as it grows. A repository declares the shape each kind of document must have, and Lorecraft checks every document against it, locally or in CI. It checks the repository's agent skills too, against the Agent Skills specification. Its own agent skills cover the rest, guiding an agent as it writes and reviews those documents.

Installation

lorecraft requires Python 3.12 or later.

With uv, install the lorecraft command as a tool, or run it on demand without installing it:

uv tool install lorecraft
uvx lorecraft check

To pin it to a uv project instead, add it as a development dependency and run it through the project's environment:

uv add --dev lorecraft
uv run lorecraft check

Or install it in an isolated environment with pipx:

pipx install lorecraft

Confirm which build you are running with lorecraft version. Every command also runs as lc, a shorter name for lorecraft.

Installing from the Git repository

To run a commit that has not been released yet, install from the repository:

uv tool install "git+https://github.com/lnsd/lorecraft"

pipx install takes the same URL. It builds from the default branch. Append @<tag>, @<branch> or @<commit> to the repository URL to install a specific revision instead. The version is derived from the repository's git tags, so a build between two releases reports a development version, such as 0.2.1.dev3+g93b1ed1fb.

Quickstart

Write your coding rules as documents in docs/code/, and describe what a rule document looks like in docs/__meta__/:

docs/
├── __meta__/
│   ├── code.md                     # what every rule document looks like, in prose
│   ├── code.spec.json              # its frontmatter, sections, word caps and token budget
│   ├── code-python.md              # narrower rules for the python-* documents
│   └── code-python.spec.json       # the frontmatter and sections they add
└── code/
    ├── logging.md                  # governed_by: [code]
    ├── python-modules.md           # governed_by: [code, code-python]
    ├── python-typing.md            # governed_by: [code, code-python]
    └── tests-functions.md          # governed_by: [code]

Each specification is a pair of files that share a specification name, such as code: the prose, <name>.md, and the structure specification, <name>.spec.json, which the checks apply. code governs every document in docs/code/, and code-python adds its rules to the python-* documents.

Keep the rule documents in shape, from the repository root:

lorecraft inspect  # which specifications govern which rule document
lorecraft check    # check every rule document against them, and every agent skill
lorecraft rule     # every rule, in code order; `lorecraft rule OUT006` explains one

lorecraft check exits 0 when it reports no error, 1 when it reports one, and 2 when it could not run, so it can gate a CI job as it is. Both commands take --format json for a script to read.

Then let your agent use them, through the skills: /code-rules loads the rules that apply before it writes code, and /code-rules-check checks its changes against them. This repository's own docs/code/ is a working example.

Skills

The skills/ directory holds agent skills that put the rules to work:

  • During development, code-rules loads the coding rules that apply before the agent writes code, and docs-rules does the same for your documents.
  • During review, code-rules-check checks a change for compliance with those same rules, and docs-rules-check does the same for your documents.
  • When authoring the rules, docs-rules-creator helps the agent write the specifications that govern your documents.
  • When writing agent skills, skills-check guides the agent through the Agent Skills specification and checks your skills against it with lorecraft check.

Install the skills with Vercel's skills CLI:

npx skills add https://github.com/lnsd/lorecraft/tree/main/skills

Or copy them into your agent's skills directory, such as .claude/skills/ or .agents/skills/.

Contributing

Read CONTRIBUTING.md before opening a pull request. Pull requests opened by autonomous agents are closed without review.

License

Licensed under either of Apache License, Version 2.0 or MIT License, at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project, as defined in the Apache-2.0 license, shall be dual-licensed as above, without any additional terms or conditions.

Metadata

Release files for lorecraft 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lorecraft 0.3.1
File Size Uploaded
lorecraft-0.3.1.tar.gz 2.0 MB Details

Built distribution (wheel)

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

Total release size: 4.1 MB

Release files / lorecraft-0.3.1.tar.gz

Download URL lorecraft-0.3.1.tar.gz
Size 2.0 MB
Tags Source
SHA-256 checksum
How to use checksums
e63b01641ab5efd4d91080a336ed69c681cdb2345d3098db1da6b255034c5bd0
BLAKE2b-256 checksum
How to use checksums
154df458a10b309422f14d93a00f7de00338f7bc06a7b53343810bf02d4cd58e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / lorecraft-0.3.1-py3-none-any.whl

Download URL lorecraft-0.3.1-py3-none-any.whl
Size 2.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
960598adec988c468952d9dd0c72d5eff918425e4d07090a1090f5721c38eac9
BLAKE2b-256 checksum
How to use checksums
9b3e11097cb905f5599b0d9fb093fe2eb57f9a487ecff4c0379fc2042987b643
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

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