lekton 0.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. lekton-0.0.2/.github/workflows/publish.yml +49 -0
  2. lekton-0.0.2/.github/workflows/tests.yml +42 -0
  3. lekton-0.0.2/.gitignore +6 -0
  4. lekton-0.0.2/AGENTS.md +72 -0
  5. lekton-0.0.2/CLAUDE.md +1 -0
  6. lekton-0.0.2/LICENSE +202 -0
  7. lekton-0.0.2/PKG-INFO +257 -0
  8. lekton-0.0.2/README.md +234 -0
  9. lekton-0.0.2/assets/logo-dark.svg +8 -0
  10. lekton-0.0.2/assets/logo-light.svg +10 -0
  11. lekton-0.0.2/assets/mark.svg +7 -0
  12. lekton-0.0.2/docs/README.md +13 -0
  13. lekton-0.0.2/docs/agents.md +79 -0
  14. lekton-0.0.2/docs/reference.md +144 -0
  15. lekton-0.0.2/docs/template-format.md +135 -0
  16. lekton-0.0.2/examples/README.md +15 -0
  17. lekton-0.0.2/examples/check_model_output.py +58 -0
  18. lekton-0.0.2/examples/define_a_kind.py +61 -0
  19. lekton-0.0.2/examples/kinds.yaml +27 -0
  20. lekton-0.0.2/examples/kinds_from_yaml.py +62 -0
  21. lekton-0.0.2/examples/read_a_foreign_claim.py +44 -0
  22. lekton-0.0.2/examples/thought_to_decision.py +55 -0
  23. lekton-0.0.2/lekton/__init__.py +41 -0
  24. lekton-0.0.2/lekton/check.py +233 -0
  25. lekton-0.0.2/lekton/declare.py +234 -0
  26. lekton-0.0.2/lekton/kinds.py +34 -0
  27. lekton-0.0.2/lekton/promote.py +45 -0
  28. lekton-0.0.2/lekton/py.typed +0 -0
  29. lekton-0.0.2/lekton/registry.py +16 -0
  30. lekton-0.0.2/lekton/relations.py +76 -0
  31. lekton-0.0.2/lekton/thought.py +214 -0
  32. lekton-0.0.2/llms.txt +25 -0
  33. lekton-0.0.2/pyproject.toml +41 -0
  34. lekton-0.0.2/skills/lekton/SKILL.md +68 -0
  35. lekton-0.0.2/tests/__init__.py +0 -0
  36. lekton-0.0.2/tests/conftest.py +78 -0
  37. lekton-0.0.2/tests/test_check.py +162 -0
  38. lekton-0.0.2/tests/test_declare.py +106 -0
  39. lekton-0.0.2/tests/test_examples.py +36 -0
  40. lekton-0.0.2/tests/test_promote.py +50 -0
  41. lekton-0.0.2/tests/test_thought.py +90 -0
  42. lekton-0.0.2/uv.lock +450 -0
@@ -0,0 +1,49 @@
1
+ name: Publish to PyPI
2
+
3
+ # The only way into PyPI. Publishing a GitHub release starts this job.
4
+ # It uses PyPI trusted publishing, so no token is stored in this repository:
5
+ # PyPI trusts this workflow, in this repository, in the `pypi` environment.
6
+ on:
7
+ release:
8
+ types: [published]
9
+
10
+ permissions:
11
+ contents: read
12
+ id-token: write
13
+
14
+ jobs:
15
+ pypi-publish:
16
+ name: Upload lekton to PyPI
17
+ runs-on: ubuntu-latest
18
+ environment: pypi
19
+ timeout-minutes: 10
20
+
21
+ steps:
22
+ - name: Checkout
23
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
24
+ with:
25
+ persist-credentials: false
26
+
27
+ - name: Install uv
28
+ uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
29
+
30
+ # A version on PyPI can never be replaced, so refuse a release whose
31
+ # tag and package version disagree.
32
+ - name: Check the tag matches the package version
33
+ run: |
34
+ version=$(python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
35
+ if [ "v$version" != "$GITHUB_REF_NAME" ]; then
36
+ echo "Tag $GITHUB_REF_NAME does not match the package version $version."
37
+ exit 1
38
+ fi
39
+
40
+ - name: Run tests
41
+ run: |
42
+ uv sync
43
+ uv run pytest
44
+
45
+ - name: Build
46
+ run: uv build
47
+
48
+ - name: Publish
49
+ run: uv publish -v dist/lekton-*.tar.gz dist/lekton-*.whl
@@ -0,0 +1,42 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: ["main"]
6
+ pull_request:
7
+ workflow_dispatch:
8
+
9
+ # Only newer revisions of the same pull request supersede a run.
10
+ concurrency:
11
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
12
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
13
+
14
+ permissions:
15
+ contents: read
16
+
17
+ jobs:
18
+ test:
19
+ name: Python ${{ matrix.python-version }}
20
+ runs-on: ubuntu-latest
21
+ timeout-minutes: 10
22
+ strategy:
23
+ fail-fast: false
24
+ matrix:
25
+ # The oldest version the package supports, and the newest.
26
+ python-version: ["3.10", "3.13"]
27
+
28
+ steps:
29
+ - name: Checkout
30
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
31
+ with:
32
+ persist-credentials: false
33
+
34
+ - name: Install uv
35
+ uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
36
+
37
+ - name: Install dependencies
38
+ run: uv sync --python ${{ matrix.python-version }}
39
+
40
+ # The suite also runs every script in examples/.
41
+ - name: Run tests
42
+ run: uv run pytest
@@ -0,0 +1,6 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.egg-info/
4
+ dist/
5
+ .pytest_cache/
6
+ .claude/
lekton-0.0.2/AGENTS.md ADDED
@@ -0,0 +1,72 @@
1
+ # lekton development guidelines
2
+
3
+ > **Audience**: coding agents and human developers working on this repository. To *use* lekton, read [`llms.txt`](llms.txt) and [`skills/lekton/SKILL.md`](skills/lekton/SKILL.md).
4
+
5
+ lekton is a small Python library (Python 3.10 or later, Pydantic v2) for defining kinds of claims from one primitive, the thought.
6
+
7
+ ## Workflow
8
+
9
+ ```bash
10
+ uv sync
11
+ ```
12
+
13
+ ```bash
14
+ uv run pytest
15
+ ```
16
+
17
+ Run the tests before you call anything done. They also run every script in `examples/`.
18
+
19
+ ## Repository structure
20
+
21
+ | Path | Contents |
22
+ |---|---|
23
+ | `lekton/` | The package. `thought.py` is the primitive, `kinds.py` the shipped kinds, `check.py` the structural check, `declare.py` the template format |
24
+ | `tests/` | pytest suite |
25
+ | `examples/` | Runnable scripts, one idea each |
26
+ | `docs/` | Markdown documentation |
27
+ | `skills/` | Skills for agents that use lekton |
28
+ | `assets/` | Logo files |
29
+ | `llms.txt` | Index of the docs for agents |
30
+
31
+ ## What the library is for
32
+
33
+ It fixes the shape of a claim and reports what is missing. It does not police how carefully anyone uses it.
34
+
35
+ | | What the library does |
36
+ |---|---|
37
+ | Shape | Enforces it |
38
+ | Completeness | Reports it, never blocks |
39
+ | Diligence | Stays out of it |
40
+
41
+ Hold to this when you add anything. Do not add a strict mode, a quality score, or a check that rejects a claim for being incomplete.
42
+
43
+ ## Rules
44
+
45
+ - **`check` is the authority.** A class name or a `kind` key is a label. Decide what a claim is by its structure.
46
+ - **A kind adds; it never redefines.** The library raises on a subclass that changes an inherited field. Keep it that way.
47
+ - **`Thought`, `Question`, and `Decision` are the opinionated core.** Do not change their fields without the maintainer's say.
48
+ - **Required edges are owed, not gates.** A missing edge belongs in `Report.owed`.
49
+ - **Defaults must not overclaim.** `modality` defaults to `unstated` for this reason.
50
+ - **Docs and examples must be true.** If you change behavior, update `docs/reference.md`, the README, and any example it touches. Add an example to `llms.txt` when you add one.
51
+ - **This is a public repository.** Do not add names of private projects, customers, or people.
52
+
53
+ ## Code standards
54
+
55
+ - Type hints on everything public. The package ships `py.typed`.
56
+ - Comments say why, not what.
57
+ - Export public names from `lekton/__init__.py` and list them in `__all__`.
58
+ - Test names read as sentences: `test_a_decision_without_a_question_is_a_decision_that_owes_one`.
59
+
60
+ ## Commits and pull requests
61
+
62
+ - Conventional commit messages: `feat:`, `fix:`, `docs:`, `chore:`.
63
+ - Work on a branch and open a pull request into `main`.
64
+
65
+ ## Releases
66
+
67
+ A published GitHub release is the only way into PyPI. `.github/workflows/publish.yml` builds and uploads it with trusted publishing, so no token is stored in the repository.
68
+
69
+ 1. Set `version` in `pyproject.toml` and run `uv sync` so `uv.lock` matches. Merge that to `main`.
70
+ 2. Publish a GitHub release tagged `v<version>` on `main`. The workflow refuses a tag that does not match the package version.
71
+
72
+ A version on PyPI can never be replaced. The README is the PyPI page, so its links and images use full URLs.
lekton-0.0.2/CLAUDE.md ADDED
@@ -0,0 +1 @@
1
+ @AGENTS.md
lekton-0.0.2/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Wayne Grigsby
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
lekton-0.0.2/PKG-INFO ADDED
@@ -0,0 +1,257 @@
1
+ Metadata-Version: 2.5
2
+ Name: lekton
3
+ Version: 0.0.2
4
+ Summary: Claim kinds built from one primitive: a thought, and what you add to it.
5
+ Project-URL: Repository, https://github.com/griggz/lekton
6
+ Project-URL: Documentation, https://github.com/griggz/lekton/tree/main/docs
7
+ Author: Wayne Grigsby
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Keywords: agents,claims,knowledge graph,llm,ontology,pydantic
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Classifier: Typing :: Typed
19
+ Requires-Python: >=3.10
20
+ Requires-Dist: pydantic>=2.6
21
+ Requires-Dist: pyyaml>=6.0
22
+ Description-Content-Type: text/markdown
23
+
24
+ <p align="center">
25
+ <picture>
26
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/griggz/lekton/main/assets/logo-dark.svg">
27
+ <img src="https://raw.githubusercontent.com/griggz/lekton/main/assets/logo-light.svg" alt="lekton: what can be said" width="400">
28
+ </picture>
29
+ </p>
30
+
31
+ # lekton
32
+
33
+ Claim kinds built from one primitive.
34
+
35
+ A thought is the primitive. Every other kind of claim is a thought plus something, and there are only three ways to add:
36
+
37
+ | Relation | Meaning | In code |
38
+ |---|---|---|
39
+ | is-a | The kind adds fields to its parent and never removes any | Subclass it |
40
+ | made-of | The kind is composed of two or more other claims | `composed_of(...)` |
41
+ | requires | The kind owes an edge to another claim | `requires(...)` |
42
+
43
+ The name is Stoic. A *lekton* is "what can be said": the content of an utterance, apart from its words. The Stoics sorted lekta into kinds (assertions, questions, commands) about 2,300 years ago.
44
+
45
+ The mark is a lambda, the first letter of λεκτόν, drawn as two strokes: a thought, and what you add to it.
46
+
47
+ Status: v0. The shape of the shipped kinds may still change.
48
+
49
+ ```bash
50
+ pip install lekton
51
+ ```
52
+
53
+ ## Background
54
+
55
+ `lekton` makes the nodes of a knowledge graph easier to define, generate, and curate. It treats claims as separate from things. A person, a company, or a tool is a thing. What someone decided or believed about it is a claim. Every claim is about at least one thing, and every claim has an author and a time.
56
+
57
+ Things already have standards. schema.org and Wikidata describe people, organizations, and places, and individual fields keep their own ontologies, such as the Open Energy Ontology for energy systems. Those standards exist because the world mostly agrees on what a person or a power plant is.
58
+
59
+ I have not found an open standard for how to structure a claim. Nanopublications, Wikidata's statement model, and PROV-O cover who said something and when. Nothing covers the kinds. Claims are more complex than things, and one person structures a claim differently than the next.
60
+
61
+ So `lekton` builds claims in layers of abstraction. A thought is the most basic claim. The first layer above it holds kinds that add something to a thought, such as a question or a decision. Layers above that combine kinds from the first, so one claim can be made of others.
62
+
63
+ The open work is defining that first layer: which kinds belong in it, and what each one adds. The library ships a question and a decision as the start.
64
+
65
+ Everything past the first layer should become standard by adoption, not decree. Nobody decreed schema.org. Usage made it the standard.
66
+
67
+ The longer argument is in [From Knowledge to Context](https://griggz.com/writing/from-knowledge-to-context).
68
+
69
+ ## What this library is for
70
+
71
+ It gives you the building blocks to programmatically define the kinds of claims you make.
72
+
73
+ - **Compose.** A person or an agent can build a kind from a few parts, then build larger kinds out of those, until they have an ontology of claims.
74
+ - **Deconstruct.** Any kind can be taken apart into its parent, the fields it adds, the claims it is made of, and the edges it owes. That includes someone else's, so you can see what makes their ontology theirs.
75
+ - **Test.** A kind is structure, so a claim can be checked against it in code. You can write tests against your claims.
76
+
77
+ It does not police how you use them.
78
+
79
+ | | What the library does | Example |
80
+ |---|---|---|
81
+ | Shape | Enforces it | A thought is about at least one thing. A composite has two or more parts |
82
+ | Completeness | Reports it, never blocks | A decision with no question is `owed`, not rejected |
83
+ | Diligence | Stays out of it | Whether your extractor worked hard on modality |
84
+
85
+ The library makes claims comparable. Whether they are good is up to the system you build around it. There is no strict mode, on purpose.
86
+
87
+ ## A thought
88
+
89
+ ```python
90
+ from lekton import Thought, Question, Decision, Record, Assertion
91
+
92
+ thought = Thought(
93
+ record=Record(author="wayne", captured_from="working session"),
94
+ body="I do not think I ever use the traverse tool.",
95
+ about=[{"thing": "traverse tool", "role": "subject"}, "Postgres port"],
96
+ assertion=Assertion(
97
+ predicate="is never used by me", modality="hypothesis", basis="stated"
98
+ ),
99
+ )
100
+ ```
101
+
102
+ - `record` holds facts about the thought: who, when, out of what, which version. Nobody has to agree with a claim to agree on its record.
103
+ - `body` is what was said, verbatim.
104
+ - `about` is everything it touches. There must be at least one.
105
+ - `assertion` is optional: the body reduced to one statement someone can agree or disagree with.
106
+
107
+ ### Modality
108
+
109
+ An assertion carries the speaker's footing. The statement stays the same; the footing changes how much weight it can bear.
110
+
111
+ | Modality | The footing |
112
+ |---|---|
113
+ | `asserted` | I am telling you it is so |
114
+ | `hypothesis` | My guess, not checked |
115
+ | `forecast` | About the future; nobody can check it yet |
116
+ | `reported` | Someone else's word, passed along |
117
+ | `unstated` | Nobody said, and it could not be told. The default |
118
+
119
+ `unstated` is the default so that a claim nobody examined never passes as a firm one. A question's assertion stays `unstated`: nothing is asserted until its blank is filled.
120
+
121
+ `basis` says how the modality is known: `stated` when the speaker's own words carried it ("I think", "Dave told me"), `inferred` when whoever recorded the claim read it in. An `unstated` modality has no basis.
122
+
123
+ Modality is not confidence. It is the kind of footing, not how sure the speaker is.
124
+
125
+ ## Your own kinds
126
+
127
+ ```python
128
+ from lekton import composed_of
129
+
130
+ class Risk(Thought): # is-a
131
+ likelihood: str
132
+ impact: str
133
+
134
+ class Bet(Thought): # made-of
135
+ thesis: str
136
+ parts = composed_of(Decision, Risk)
137
+ ```
138
+
139
+ `Question` and `Decision` ship with the library because we hold an opinion about what they are. Everything else is yours to define.
140
+
141
+ ## Structure decides, not the label
142
+
143
+ `check` reports what a claim is by what it carries. It never raises on a claim that falls short.
144
+
145
+ ```python
146
+ from lekton import check, promote
147
+
148
+ decision = promote(
149
+ thought, Decision,
150
+ chosen="Retire it, with no replacement",
151
+ alternatives=["A read-only SQL tool with the same gating"],
152
+ rationale="Unused, and already off on shared instances.",
153
+ )
154
+
155
+ report = check(decision)
156
+ report.fits # True: it names a choice and an alternative
157
+ report.complete # False
158
+ report.owed # ('resolves: question',)
159
+ ```
160
+
161
+ A report separates four things:
162
+
163
+ | Field | Meaning |
164
+ |---|---|
165
+ | `missing` | Fields or parts it lacks. Without them it is not this kind |
166
+ | `owed` | Required edges not in place. It is this kind, but incomplete |
167
+ | `unverified` | Edges that exist but point at claims that could not be looked up |
168
+ | `revised` | Linked claims that now have a newer version than the one pinned |
169
+
170
+ Related functions:
171
+
172
+ - `promote(thought, Kind, **adds)` makes a new claim with its own record and an `evolved_from` edge. The thought is left alone.
173
+ - `qualifies(claim)` returns the most specific kinds a claim's structure fits.
174
+ - `read(data)` builds a claim as the most specific known kind. A kind this process has never seen comes back as its nearest known ancestor, extra fields intact.
175
+ - `status(question, claims)` returns `open` or `answered`. It is worked out from edges every time and never stored.
176
+
177
+ ## Kinds as data
178
+
179
+ A kind can be written out as a template and built back from one, with no code.
180
+
181
+ ```python
182
+ from lekton import to_yaml, load_kinds
183
+
184
+ print(to_yaml(Question, Decision))
185
+ ```
186
+
187
+ ```yaml
188
+ question:
189
+ specializes: thought
190
+ adds:
191
+ settled_by: text
192
+ owner: text?
193
+ decision:
194
+ specializes: thought
195
+ adds:
196
+ chosen: text
197
+ alternatives: [text]
198
+ rationale: text
199
+ requires:
200
+ resolves: question
201
+ ```
202
+
203
+ ```python
204
+ built = load_kinds("""
205
+ hazard:
206
+ specializes: thought
207
+ adds:
208
+ likelihood: low|medium|high
209
+ impact: text
210
+ """)
211
+ Hazard = built["hazard"]
212
+ ```
213
+
214
+ Types: `text`, `integer`, `number`, `boolean`, `date`, `datetime`, a list `[text]`, or a choice `a|b|c`. A trailing `?` marks a field optional. A required text or list field must not be empty.
215
+
216
+ ## Rules the library enforces
217
+
218
+ 1. A claim is about at least one thing.
219
+ 2. A kind adds to its parent. Redefining an inherited field is an error.
220
+ 3. A composite has two or more parts.
221
+ 4. A required edge is a completeness check, not a gate. A decision with no question is still a decision.
222
+ 5. A kind that adds nothing required cannot be told from its parent by structure, so `qualifies` and `read` never guess it.
223
+ 6. An `unstated` modality carries no basis.
224
+
225
+ ## Not here yet
226
+
227
+ - Storage, a graph, or an MCP server. This is the model layer only.
228
+ - Versioning beyond the pin on an edge.
229
+ - Namespaces for kinds, and versions of a kind's own definition.
230
+ - Reference types (`person`, `thing`, `source`). They are plain text for now.
231
+
232
+ ## For agents
233
+
234
+ lekton is meant to be picked up by an agent working for a person, as much as by the person.
235
+
236
+ | If you are | Start here |
237
+ |---|---|
238
+ | An agent that needs the docs | [`llms.txt`](https://github.com/griggz/lekton/blob/main/llms.txt), an index of every page as Markdown |
239
+ | An agent recording claims for someone | [`skills/lekton/SKILL.md`](https://github.com/griggz/lekton/blob/main/skills/lekton/SKILL.md) |
240
+ | Wiring lekton into tool calls or structured output | [Using lekton from an agent](https://github.com/griggz/lekton/blob/main/docs/agents.md) |
241
+ | Working on this repository | [`AGENTS.md`](https://github.com/griggz/lekton/blob/main/AGENTS.md) |
242
+
243
+ More in [`docs/`](https://github.com/griggz/lekton/tree/main/docs), and runnable scripts in [`examples/`](https://github.com/griggz/lekton/tree/main/examples).
244
+
245
+ ## Development
246
+
247
+ ```bash
248
+ uv sync
249
+ ```
250
+
251
+ ```bash
252
+ uv run pytest
253
+ ```
254
+
255
+ ## License
256
+
257
+ Apache-2.0. See [LICENSE](https://github.com/griggz/lekton/blob/main/LICENSE).