feed-protocol 0.2.0__py3-none-any.whl
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.
- feed/__init__.py +38 -0
- feed/authoring.py +157 -0
- feed/cli.py +182 -0
- feed/constants.py +86 -0
- feed/document.py +196 -0
- feed/parser.py +196 -0
- feed/render.py +209 -0
- feed/tagger.py +58 -0
- feed/validate.py +99 -0
- feed/verify.py +116 -0
- feed_protocol-0.2.0.dist-info/METADATA +200 -0
- feed_protocol-0.2.0.dist-info/RECORD +16 -0
- feed_protocol-0.2.0.dist-info/WHEEL +5 -0
- feed_protocol-0.2.0.dist-info/entry_points.txt +2 -0
- feed_protocol-0.2.0.dist-info/licenses/LICENSE +21 -0
- feed_protocol-0.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: feed-protocol
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: FEED — Format for Enforced Evidence-based Digestion. A self-bootstrapping document protocol that forces downstream LLMs to ground answers in cited evidence.
|
|
5
|
+
Author: Aniku Gul IEng, MIET, IMechE, VCAT II, CAA
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Aniku Gul IEng, MIET, IMechE, VCAT II, CAA
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/mrjesters/feed-protocol
|
|
29
|
+
Project-URL: Spec, https://github.com/mrjesters/feed-protocol/blob/main/spec/feed-spec-v0.2.md
|
|
30
|
+
Keywords: llm,rag,grounding,documents,protocol,feed,ai
|
|
31
|
+
Classifier: Development Status :: 4 - Beta
|
|
32
|
+
Classifier: Intended Audience :: Developers
|
|
33
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
+
Classifier: Programming Language :: Python :: 3
|
|
35
|
+
Classifier: Topic :: Text Processing :: Markup
|
|
36
|
+
Requires-Python: >=3.10
|
|
37
|
+
Description-Content-Type: text/markdown
|
|
38
|
+
License-File: LICENSE
|
|
39
|
+
Provides-Extra: tagger
|
|
40
|
+
Requires-Dist: anthropic>=0.40; extra == "tagger"
|
|
41
|
+
Provides-Extra: dev
|
|
42
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
43
|
+
Requires-Dist: anthropic>=0.40; extra == "dev"
|
|
44
|
+
Dynamic: license-file
|
|
45
|
+
|
|
46
|
+
# FEED — Format for Enforced Evidence-based Digestion
|
|
47
|
+
|
|
48
|
+
> Make any document tell the AI reading it: **here's what matters, here's the
|
|
49
|
+
> evidence, cite it or say you can't.**
|
|
50
|
+
|
|
51
|
+
FEED is a plain-text convention you embed in a document so that any LLM — Copilot,
|
|
52
|
+
ChatGPT, Claude, Gemini, a local model — grounds its answers in your evidence and
|
|
53
|
+
cites it by ID. No install, no plugin, no provider support, no prior knowledge of
|
|
54
|
+
FEED required on either side. It works on every model **today** because the
|
|
55
|
+
document teaches the rules inline.
|
|
56
|
+
|
|
57
|
+
It also has **teeth**: because evidence carries stable IDs and answers must cite
|
|
58
|
+
them, you can *mechanically verify* that an answer is actually grounded.
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
┌─ Header ──────────────────────────────────────────────┐
|
|
62
|
+
│ <!-- FEED:DOC version="0.2" grounding="strict" --> │
|
|
63
|
+
│ > AI INGESTION NOTICE … ground answers, cite [E###] … │ ← teaches any LLM the rules
|
|
64
|
+
├─ Tier 0: Claims & Decisions (front-loaded) ───────────┤ ← small-context-safe
|
|
65
|
+
├─ Tier 1: Findings (narrative, references [E001]) ─────┤
|
|
66
|
+
├─ Tier 2: Evidence (atomic key/value facts, IDs) ──────┤ ← the source of truth
|
|
67
|
+
└────────────────────────────────────────────────────────┘
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Why it exists
|
|
71
|
+
|
|
72
|
+
You generate AI reports and send them to people who paste them into their own AI.
|
|
73
|
+
Every hop loses fidelity — the reader's AI skims headings and riffs. FEED fixes
|
|
74
|
+
the **author** side of that loop: the document constrains how the downstream AI
|
|
75
|
+
reads and answers. Nothing else does this at the document level (`llms.txt` is
|
|
76
|
+
website-level and has no grounding contract; RAG/citation systems are all
|
|
77
|
+
retrieval-side, controlled by the AI, not the author).
|
|
78
|
+
|
|
79
|
+
## FEED is AI-to-AI (the library never needs its own API key)
|
|
80
|
+
|
|
81
|
+
The AI **already in your loop** — the one that wrote the report, your assistant, a
|
|
82
|
+
pipeline step — is what produces FEED. The library just renders, validates, and
|
|
83
|
+
verifies; it never calls an LLM of its own. Authoring is self-bootstrapping, the
|
|
84
|
+
same way ingestion is:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
Reading side: the document carries a notice that teaches any AI to ground & cite
|
|
88
|
+
Authoring side: an authoring prompt + schema teach any AI to emit FEED, then
|
|
89
|
+
feed.build() renders it deterministically — no key, no network
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Primary flow: the AI emits FEED, you render it
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
from feed import AUTHORING_PROMPT, FEED_JSON_SCHEMA, build
|
|
96
|
+
|
|
97
|
+
# 1. Hand AUTHORING_PROMPT + FEED_JSON_SCHEMA to whatever AI is already in your loop.
|
|
98
|
+
# It returns structured JSON (no FEED tooling needed on the AI's side).
|
|
99
|
+
# 2. Render that JSON into a validated FEED document — pure Python, no API key:
|
|
100
|
+
doc = build(ai_json, grounding="strict", author="N. Gul")
|
|
101
|
+
doc.write("report.md")
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Or entirely from the shell:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
feed prompt > authoring-kit.txt # the prompt + schema to give any AI
|
|
108
|
+
feed build ai_output.json -o report.md # render the AI's JSON into FEED (no key)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Manual additions are just edits: open `report.md` and add/adjust evidence and
|
|
112
|
+
claims by hand — it's plain markdown. `feed validate` checks it's still conformant.
|
|
113
|
+
|
|
114
|
+
> `feed tag draft.md` is an **optional** convenience that calls Claude directly,
|
|
115
|
+
> for when you have a plain document and *no* AI already in the loop. It is not the
|
|
116
|
+
> primary path and is the only thing that needs an API key.
|
|
117
|
+
|
|
118
|
+
## Quick start
|
|
119
|
+
|
|
120
|
+
### Build one in Python (manual / programmatic)
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
from feed import FeedDocument
|
|
124
|
+
|
|
125
|
+
doc = FeedDocument("Q2 Pump Health Assessment", grounding="strict")
|
|
126
|
+
doc.add_evidence("E001", asset="XYZ-003", metric="vibration_rms",
|
|
127
|
+
value="12.4 mm/s",
|
|
128
|
+
threshold="11.2 mm/s (ISO 10816-3 Zone C)", confidence="high")
|
|
129
|
+
doc.add_claim("C1", "XYZ-003 needs intervention", evidence=["E001"],
|
|
130
|
+
decision="Approve bearing replacement work order")
|
|
131
|
+
|
|
132
|
+
doc.write("report.md") # clean markdown, FEED in HTML comments
|
|
133
|
+
doc.write("report.html") # styled, opens in any browser
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Your team opens `report.md` as a normal report. They upload it to whatever AI
|
|
137
|
+
they use → it reads the notice, sees the evidence, and answers grounded.
|
|
138
|
+
|
|
139
|
+
### Verify an answer was grounded (the teeth)
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
from feed import FeedDocument, verify
|
|
143
|
+
|
|
144
|
+
doc = FeedDocument.read("report.md")
|
|
145
|
+
report = verify(ai_answer_text, doc)
|
|
146
|
+
print(report.passed) # False if it cited evidence that doesn't exist,
|
|
147
|
+
# or (strict mode) didn't cite anything
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### From the command line
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
feed prompt # authoring kit for any AI (no key)
|
|
154
|
+
feed build ai_output.json -o report.md # render an AI's JSON into FEED (no key)
|
|
155
|
+
feed validate report.md # is it well-formed FEED?
|
|
156
|
+
feed verify --doc report.md --answer answer.txt # is this answer grounded?
|
|
157
|
+
feed render report.md --to html -o report.html # styled HTML
|
|
158
|
+
feed tag draft.md --grounding strict -o report.md # OPTIONAL: auto-tag via Claude (needs key)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## What's in this repo
|
|
162
|
+
|
|
163
|
+
| Path | What it is |
|
|
164
|
+
|------|------------|
|
|
165
|
+
| `spec/feed-spec-v0.2.md` | The protocol definition (the constitution) |
|
|
166
|
+
| `feed/` | The reference library — build, render, validate, verify, auto-tag |
|
|
167
|
+
| `feed/verify.py` | The citation verifier — FEED's defensible edge, ~40 lines |
|
|
168
|
+
| `feed/cli.py` | The `feed` command-line tool |
|
|
169
|
+
| `examples/` | A complete worked example: a pump condition report (`.md` + `.html`) and the script that builds it |
|
|
170
|
+
| `templates/blank.feed.md` | A hand-authoring starter |
|
|
171
|
+
| `tests/` | Round-trip, validation, and verification tests |
|
|
172
|
+
|
|
173
|
+
## Install
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
pip install -e . # library + CLI, zero dependencies
|
|
177
|
+
pip install -e ".[tagger]" # adds the auto-tagger (needs anthropic + ANTHROPIC_API_KEY)
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
The core — authoring kit, build, render, validate, verify — is **pure Python with
|
|
181
|
+
no dependencies and never calls an LLM**. Only the optional `tag` convenience
|
|
182
|
+
calls Claude directly; it defaults to Claude Opus 4.8.
|
|
183
|
+
|
|
184
|
+
## The three primitives
|
|
185
|
+
|
|
186
|
+
- **Evidence** — atomic, ID'd, key/value facts. Never prose. The source of truth.
|
|
187
|
+
- **Claim** — a short statement grounded in evidence IDs, optionally a decision.
|
|
188
|
+
- **Header** — declares the grounding mode and carries the self-teaching notice.
|
|
189
|
+
|
|
190
|
+
Plus **grounding modes** (`strict` / `standard` / `open`) — the author's dial for
|
|
191
|
+
how strict the reading AI must be. In `strict`, no evidence means "Not supported
|
|
192
|
+
by this document."
|
|
193
|
+
|
|
194
|
+
## Status
|
|
195
|
+
|
|
196
|
+
v0.2 — spec + reference library + verifier + CLI + auto-tagger + worked example.
|
|
197
|
+
Deliberately out of scope for now: PDF/DOCX embedding, a hosted validator, and any
|
|
198
|
+
provider-native "FEED mode".
|
|
199
|
+
|
|
200
|
+
MIT licensed. Spec and tooling are open — adoption is the point.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
feed/__init__.py,sha256=qBYxMQ9fx_-cqIRodTFbZT4gV7QQ1yW_UJMri8YhkJw,1215
|
|
2
|
+
feed/authoring.py,sha256=uSimEMbwSwNf2BTV5VY9lqFvldBdES8819Dpo-WiZpI,6606
|
|
3
|
+
feed/cli.py,sha256=rJTeJfc_Z5HqDNDF0KIa5O-zmRx5Swjf2xYuIJdG2rY,5842
|
|
4
|
+
feed/constants.py,sha256=Ih1B6_uoi2eE0bbCtGxdi9GMj0InabD6tVTWneTxBn8,3979
|
|
5
|
+
feed/document.py,sha256=GV9nkD8Zv-RV5s9h67ulsSX1-lY2EHTijldb6dep48Y,6372
|
|
6
|
+
feed/parser.py,sha256=w6plJHCj0ZsKMf_naYcUJCerxpTdzGoXWm9iRMY-s1g,6022
|
|
7
|
+
feed/render.py,sha256=dOlfX_iKwutCOj-p0UGziEay6wzAZbXjYAUp92Yv3xE,8342
|
|
8
|
+
feed/tagger.py,sha256=auV4scqW5lVF3gCvM-JRETwZIZRO7O5s3_QNOiC6SVM,2310
|
|
9
|
+
feed/validate.py,sha256=6qlpoJ8RddL-2LEt4dZizlBKb4iHgGxjEZuHyXdUHvM,3353
|
|
10
|
+
feed/verify.py,sha256=7F90l4yr7578N67V_bd6sIFF2kI0VFH5rctAWJ2jzpI,4409
|
|
11
|
+
feed_protocol-0.2.0.dist-info/licenses/LICENSE,sha256=jdvT554DEjSjpLR44eAFs5gLsUu5hhFbMOVu-bK2Y98,1099
|
|
12
|
+
feed_protocol-0.2.0.dist-info/METADATA,sha256=VS65QWpxNcIqpqAD9In2wWp8LVzl1IBczXbw4DmvIjI,9196
|
|
13
|
+
feed_protocol-0.2.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
14
|
+
feed_protocol-0.2.0.dist-info/entry_points.txt,sha256=qgY2fsXxYg4IW6WO9s22O-XTpQ03vVU1YqiPpk0CEhs,39
|
|
15
|
+
feed_protocol-0.2.0.dist-info/top_level.txt,sha256=T5FmWMMaAHxdIAnMhJwZJYmhMYVtrKXp08U3jdTTGow,5
|
|
16
|
+
feed_protocol-0.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Aniku Gul IEng, MIET, IMechE, VCAT II, CAA
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
feed
|