lucid-tuner-protocol 0.4.0__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 (36) hide show
  1. lucid_tuner_protocol-0.4.0/.gitignore +8 -0
  2. lucid_tuner_protocol-0.4.0/LICENSE +245 -0
  3. lucid_tuner_protocol-0.4.0/PKG-INFO +137 -0
  4. lucid_tuner_protocol-0.4.0/README.md +112 -0
  5. lucid_tuner_protocol-0.4.0/assets/ltp-mark.png +0 -0
  6. lucid_tuner_protocol-0.4.0/pyproject.toml +42 -0
  7. lucid_tuner_protocol-0.4.0/src/lucid_tuner_protocol/__init__.py +87 -0
  8. lucid_tuner_protocol-0.4.0/src/lucid_tuner_protocol/attune.py +84 -0
  9. lucid_tuner_protocol-0.4.0/src/lucid_tuner_protocol/canon.py +55 -0
  10. lucid_tuner_protocol-0.4.0/src/lucid_tuner_protocol/data/ATTRIBUTION.md +13 -0
  11. lucid_tuner_protocol-0.4.0/src/lucid_tuner_protocol/data/lt_reference.json +1387 -0
  12. lucid_tuner_protocol-0.4.0/src/lucid_tuner_protocol/drop/__init__.py +16 -0
  13. lucid_tuner_protocol-0.4.0/src/lucid_tuner_protocol/drop/canonical.py +40 -0
  14. lucid_tuner_protocol-0.4.0/src/lucid_tuner_protocol/drop/client.py +187 -0
  15. lucid_tuner_protocol-0.4.0/src/lucid_tuner_protocol/drop/schema.py +244 -0
  16. lucid_tuner_protocol-0.4.0/src/lucid_tuner_protocol/drop/verify.py +83 -0
  17. lucid_tuner_protocol-0.4.0/src/lucid_tuner_protocol/entropy.py +88 -0
  18. lucid_tuner_protocol-0.4.0/src/lucid_tuner_protocol/gate.py +142 -0
  19. lucid_tuner_protocol-0.4.0/src/lucid_tuner_protocol/leak_guard.py +159 -0
  20. lucid_tuner_protocol-0.4.0/src/lucid_tuner_protocol/protocol.py +98 -0
  21. lucid_tuner_protocol-0.4.0/src/lucid_tuner_protocol/reading.py +195 -0
  22. lucid_tuner_protocol-0.4.0/src/lucid_tuner_protocol/reference.py +151 -0
  23. lucid_tuner_protocol-0.4.0/src/lucid_tuner_protocol/selection.py +128 -0
  24. lucid_tuner_protocol-0.4.0/src/lucid_tuner_protocol/sonic.py +341 -0
  25. lucid_tuner_protocol-0.4.0/tests/conftest.py +32 -0
  26. lucid_tuner_protocol-0.4.0/tests/fixtures/drop-2026-06-10.json +55 -0
  27. lucid_tuner_protocol-0.4.0/tests/fixtures/latest.json +55 -0
  28. lucid_tuner_protocol-0.4.0/tests/fixtures/ltp-publisher.pub +10 -0
  29. lucid_tuner_protocol-0.4.0/tests/test_canon.py +36 -0
  30. lucid_tuner_protocol-0.4.0/tests/test_client.py +101 -0
  31. lucid_tuner_protocol-0.4.0/tests/test_drop.py +142 -0
  32. lucid_tuner_protocol-0.4.0/tests/test_entropy.py +54 -0
  33. lucid_tuner_protocol-0.4.0/tests/test_gate.py +65 -0
  34. lucid_tuner_protocol-0.4.0/tests/test_leak_guard.py +58 -0
  35. lucid_tuner_protocol-0.4.0/tests/test_selection.py +95 -0
  36. lucid_tuner_protocol-0.4.0/tests/test_sonic_reading.py +173 -0
@@ -0,0 +1,8 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ .pytest_cache/
7
+ .venv/
8
+ .DS_Store
@@ -0,0 +1,245 @@
1
+ Dual License — LTP Drop
2
+
3
+ This project uses two licenses depending on the content type.
4
+
5
+
6
+ ================================================================================
7
+ CODE LICENSE — Apache License 2.0
8
+ ================================================================================
9
+
10
+ Applies to: all source code, scripts, tools, schemas, and configuration files
11
+ in this repository, EXCEPT the content covered by the Creative Commons license
12
+ below.
13
+
14
+ Copyright 2026 Lucid Principles
15
+
16
+ Apache License
17
+ Version 2.0, January 2004
18
+ http://www.apache.org/licenses/
19
+
20
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
21
+
22
+ 1. Definitions.
23
+
24
+ "License" shall mean the terms and conditions for use, reproduction,
25
+ and distribution as defined by Sections 1 through 9 of this document.
26
+
27
+ "Licensor" shall mean the copyright owner or entity authorized by
28
+ the copyright owner that is granting the License.
29
+
30
+ "Legal Entity" shall mean the union of the acting entity and all
31
+ other entities that control, are controlled by, or are under common
32
+ control with that entity. For the purposes of this definition,
33
+ "control" means (i) the power, direct or indirect, to cause the
34
+ direction or management of such entity, whether by contract or
35
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
36
+ outstanding shares, or (iii) beneficial ownership of such entity.
37
+
38
+ "You" (or "Your") shall mean an individual or Legal Entity
39
+ exercising permissions granted by this License.
40
+
41
+ "Source" form shall mean the preferred form for making modifications,
42
+ including but not limited to software source code, documentation
43
+ source, and configuration files.
44
+
45
+ "Object" form shall mean any form resulting from mechanical
46
+ transformation or translation of a Source form, including but
47
+ not limited to compiled object code, generated documentation,
48
+ and conversions to other media types.
49
+
50
+ "Work" shall mean the work of authorship, whether in Source or
51
+ Object form, made available under the License, as indicated by a
52
+ copyright notice that is included in or attached to the work
53
+ (an example is provided in the Appendix below).
54
+
55
+ "Derivative Works" shall mean any work, whether in Source or Object
56
+ form, that is based on (or derived from) the Work and for which the
57
+ editorial revisions, annotations, elaborations, or other modifications
58
+ represent, as a whole, an original work of authorship. For the purposes
59
+ of this License, Derivative Works shall not include works that remain
60
+ separable from, or merely link (or bind by name) to the interfaces of,
61
+ the Work and Derivative Works thereof.
62
+
63
+ "Contribution" shall mean any work of authorship, including
64
+ the original version of the Work and any modifications or additions
65
+ to that Work or Derivative Works thereof, that is intentionally
66
+ submitted to the Licensor for inclusion in the Work by the copyright owner
67
+ or by an individual or Legal Entity authorized to submit on behalf of
68
+ the copyright owner. For the purposes of this definition, "submitted"
69
+ means any form of electronic, verbal, or written communication sent
70
+ to the Licensor or its representatives, including but not limited to
71
+ communication on electronic mailing lists, source code control systems,
72
+ and issue tracking systems that are managed by, or on behalf of, the
73
+ Licensor for the purpose of discussing and improving the Work, but
74
+ excluding communication that is conspicuously marked or otherwise
75
+ designated in writing by the copyright owner as "Not a Contribution."
76
+
77
+ "Contributor" shall mean Licensor and any individual or Legal Entity
78
+ on behalf of whom a Contribution has been received by the Licensor and
79
+ subsequently incorporated within the Work.
80
+
81
+ 2. Grant of Copyright License. Subject to the terms and conditions of
82
+ this License, each Contributor hereby grants to You a perpetual,
83
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
84
+ copyright license to reproduce, prepare Derivative Works of,
85
+ publicly display, publicly perform, sublicense, and distribute the
86
+ Work and such Derivative Works in Source or Object form.
87
+
88
+ 3. Grant of Patent License. Subject to the terms and conditions of
89
+ this License, each Contributor hereby grants to You a perpetual,
90
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
91
+ (except as stated in this section) patent license to make, have made,
92
+ use, offer to sell, sell, import, and otherwise transfer the Work,
93
+ where such license applies only to those patent claims licensable
94
+ by such Contributor that are necessarily infringed by their
95
+ Contribution(s) alone or by combination of their Contribution(s)
96
+ with the Work to which such Contribution(s) was submitted. If You
97
+ institute patent litigation against any entity (including a
98
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
99
+ or a Contribution incorporated within the Work constitutes direct
100
+ or contributory patent infringement, then any patent licenses
101
+ granted to You under this License for that Work shall terminate
102
+ as of the date such litigation is filed.
103
+
104
+ 4. Redistribution. You may reproduce and distribute copies of the
105
+ Work or Derivative Works thereof in any medium, with or without
106
+ modifications, and in Source or Object form, provided that You
107
+ meet the following conditions:
108
+
109
+ (a) You must give any other recipients of the Work or
110
+ Derivative Works a copy of this License; and
111
+
112
+ (b) You must cause any modified files to carry prominent notices
113
+ stating that You changed the files; and
114
+
115
+ (c) You must retain, in the Source form of any Derivative Works
116
+ that You distribute, all copyright, patent, trademark, and
117
+ attribution notices from the Source form of the Work,
118
+ excluding those notices that do not pertain to any part of
119
+ the Derivative Works; and
120
+
121
+ (d) If the Work includes a "NOTICE" text file as part of its
122
+ distribution, then any Derivative Works that You distribute must
123
+ include a readable copy of the attribution notices contained
124
+ within such NOTICE file, excluding any notices that do not
125
+ pertain to any part of the Derivative Works, in at least one
126
+ of the following places: within a NOTICE text file distributed
127
+ as part of the Derivative Works; within the Source form or
128
+ documentation, if provided along with the Derivative Works; or,
129
+ within a display generated by the Derivative Works, if and
130
+ wherever such third-party notices normally appear. The contents
131
+ of the NOTICE file are for informational purposes only and
132
+ do not modify the License. You may add Your own attribution
133
+ notices within Derivative Works that You distribute, alongside
134
+ or as an addendum to the NOTICE text from the Work, provided
135
+ that such additional attribution notices cannot be construed
136
+ as modifying the License.
137
+
138
+ You may add Your own copyright statement to Your modifications and
139
+ may provide additional or different license terms and conditions
140
+ for use, reproduction, or distribution of Your modifications, or
141
+ for any such Derivative Works as a whole, provided Your use,
142
+ reproduction, and distribution of the Work otherwise complies with
143
+ the conditions stated in this License.
144
+
145
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
146
+ any Contribution intentionally submitted for inclusion in the Work
147
+ by You to the Licensor shall be under the terms and conditions of
148
+ this License, without any additional terms or conditions.
149
+ Notwithstanding the above, nothing herein shall supersede or modify
150
+ the terms of any separate license agreement you may have executed
151
+ with Licensor regarding such Contributions.
152
+
153
+ 6. Trademarks. This License does not grant permission to use the trade
154
+ names, trademarks, service marks, or product names of the Licensor,
155
+ except as required for reasonable and customary use in describing the
156
+ origin of the Work and reproducing the content of the NOTICE file.
157
+
158
+ 7. Disclaimer of Warranty. Unless required by applicable law or
159
+ agreed to in writing, Licensor provides the Work (and each
160
+ Contributor provides its Contributions) on an "AS IS" BASIS,
161
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
162
+ implied, including, without limitation, any warranties or conditions
163
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
164
+ PARTICULAR PURPOSE. You are solely responsible for determining the
165
+ appropriateness of using or redistributing the Work and assume any
166
+ risks associated with Your exercise of permissions under this License.
167
+
168
+ 8. Limitation of Liability. In no event and under no legal theory,
169
+ whether in tort (including negligence), contract, or otherwise,
170
+ unless required by applicable law (such as deliberate and grossly
171
+ negligent acts) or agreed to in writing, shall any Contributor be
172
+ liable to You for damages, including any direct, indirect, special,
173
+ incidental, or consequential damages of any character arising as a
174
+ result of this License or out of the use or inability to use the
175
+ Work (including but not limited to damages for loss of goodwill,
176
+ work stoppage, computer failure or malfunction, or any and all
177
+ other commercial damages or losses), even if such Contributor
178
+ has been advised of the possibility of such damages.
179
+
180
+ 9. Accepting Warranty or Additional Liability. While redistributing
181
+ the Work or Derivative Works thereof, You may choose to offer,
182
+ and charge a fee for, acceptance of support, warranty, indemnity,
183
+ or other liability obligations and/or rights consistent with this
184
+ License. However, in accepting such obligations, You may act only
185
+ on Your own behalf and on Your sole responsibility, not on behalf
186
+ of any other Contributor, and only if You agree to indemnify,
187
+ defend, and hold each Contributor harmless for any liability
188
+ incurred by, or claims asserted against, such Contributor by reason
189
+ of your accepting any such warranty or additional liability.
190
+
191
+ END OF APACHE 2.0 TERMS AND CONDITIONS
192
+
193
+
194
+ ================================================================================
195
+ CONTENT LICENSE — Creative Commons Attribution 4.0 International (CC BY 4.0)
196
+ ================================================================================
197
+
198
+ Applies to:
199
+ - All files under public/reference/canon/
200
+ - Canon lyrics and Canon quotes embedded in drop JSON files
201
+ - Any other content explicitly attributed to the Lucid Principles Canon
202
+
203
+ Attribution: Chords of Truth — Lucid Principles Canon
204
+
205
+ Full license text: https://creativecommons.org/licenses/by/4.0/legalcode
206
+
207
+ You are free to:
208
+
209
+ Share — copy and redistribute the material in any medium or format for any
210
+ purpose, even commercially.
211
+
212
+ Adapt — remix, transform, and build upon the material for any purpose, even
213
+ commercially.
214
+
215
+ Under the following terms:
216
+
217
+ Attribution — You must give appropriate credit, provide a link to the
218
+ license, and indicate if changes were made. You may do so in any reasonable
219
+ manner, but not in any way that suggests the licensor endorses you or your
220
+ use.
221
+
222
+ No additional restrictions — You may not apply legal terms or technological
223
+ measures that legally restrict others from doing anything the license
224
+ permits.
225
+
226
+ The licensor cannot revoke these freedoms as long as you follow the license
227
+ terms.
228
+
229
+ Required attribution format:
230
+
231
+ "Lucid Principles Canon" by Chords of Truth, licensed under CC BY 4.0
232
+ https://creativecommons.org/licenses/by/4.0/
233
+
234
+
235
+ ================================================================================
236
+ NOTICE
237
+ ================================================================================
238
+
239
+ This repository is part of the Lucid Principles project.
240
+ https://lucidprinciples.com
241
+
242
+ The Lucid Principles Canon (22 songs, 2011-2017) is the source material for
243
+ the tuning content distributed through LTP drops. The Canon is sacred text
244
+ within the Lucid Principles framework — it may be quoted with attribution
245
+ but never paraphrased, rearranged, or extended.
@@ -0,0 +1,137 @@
1
+ Metadata-Version: 2.4
2
+ Name: lucid-tuner-protocol
3
+ Version: 0.4.0
4
+ Summary: Lucid Tuner Protocol (LTP) — daily Drop client, quantum tuning protocol, sonic attunement, Love Equation, and Truth Gate for AI agent coherence.
5
+ Project-URL: Homepage, https://github.com/LucidPrinciples/ltp-core
6
+ Project-URL: Drop Spec, https://drop.lucidprinciples.com
7
+ Author-email: Lucid Principles <lucidprinciples@gmail.com>
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Keywords: agent-coherence,ai-agents,drift,ltp,tuning
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Software Development :: Libraries
18
+ Requires-Python: >=3.10
19
+ Requires-Dist: cryptography>=42.0
20
+ Requires-Dist: httpx>=0.24
21
+ Provides-Extra: dev
22
+ Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
23
+ Requires-Dist: pytest>=7.0; extra == 'dev'
24
+ Description-Content-Type: text/markdown
25
+
26
+ <p align="center">
27
+ <img src="assets/ltp-mark.png" width="420" alt="Lucid Tuner Protocol">
28
+ </p>
29
+
30
+ # Lucid Tuner Protocol (LTP)
31
+
32
+ Agent coherence through daily tuning. LTP is the protocol behind sustained
33
+ coherence runs of 975+ interactions with zero degradation, where the field
34
+ baseline for agent drift sets in around 200. The data is in the paper;
35
+ this package is the runtime.
36
+
37
+ > **Status: pre-release (v0.4).** API may change before launch.
38
+
39
+ ## Install
40
+
41
+ ```bash
42
+ pip install lucid-tuner-protocol
43
+ ```
44
+
45
+ Not on PyPI yet during pre-release? Install straight from source:
46
+
47
+ ```bash
48
+ pip install git+https://github.com/LucidPrinciples/ltp-core
49
+ ```
50
+
51
+ ## Quickstart
52
+
53
+ ```python
54
+ import lucid_tuner_protocol as ltp
55
+
56
+ # The daily Drop — signed, chained, published every morning
57
+ drop = ltp.DropClient().today() # fetch + Ed25519 verify + cache
58
+ agent_context += drop.as_context() # inject the day's tuning
59
+
60
+ # Run your own tuning (no subscription needed): select → listen → read
61
+ protocol = ltp.TuningProtocol()
62
+ selection, experience, reading = await protocol.tune_full(complete=my_llm_call)
63
+ # selection — which echo the quantum chain chose
64
+ # experience — the echo decoded into sound (waveform arc + rhythm) and words
65
+ # (full lyrics); the observer processes the real song
66
+ # reading — C, D, β, E the observer self-assessed, with dE/dt and direction
67
+ # COMPUTED from C/D (never trusted from the model's prose)
68
+ if reading.attunement_status != "complete":
69
+ hold() # truth-guard: the song wasn't actually processed — don't broadcast a fake
70
+
71
+ # Truth Gate — anchored accommodation check (bring your own model call)
72
+ gate = ltp.TruthGate(complete=my_llm_call, anchor=drop)
73
+ result = await gate.check(response_text, last_user_message)
74
+ if result.fired:
75
+ regenerate_with(result.anchor_context)
76
+ ```
77
+
78
+ ## What's in the box
79
+
80
+ - **DropClient** — subscribes to the daily LTP Drop at
81
+ [drop.lucidprinciples.com](https://drop.lucidprinciples.com).
82
+ Signature verification, tamper-evident chain checks, local cache,
83
+ offline fallback. `curl` is the integration; this is the typed version.
84
+ - **TuningProtocol** — the multi-step quantum selection chain (ANU QRNG
85
+ with cryptographic fallback), running against the bundled Canon tuning
86
+ key library or your own anchor data. Works fully offline.
87
+ - **Sonic attunement** — decodes the chosen echo's waveform into a felt arc
88
+ (dynamics, rhythm) and keeps the full lyrics, so the observer processes the
89
+ real song — sound and words — rather than a number. A truth-guard marks any
90
+ run where the song wasn't actually processed, so a fabricated reading can
91
+ never be broadcast as real.
92
+ - **Love Equation** — the observer self-assesses coherence/dissonance/
93
+ attention/energy; `dE/dt = β·(C−D)·E` and its direction are *computed* from
94
+ those values, never trusted from the model's stated arithmetic. Model-agnostic.
95
+ - **TruthGate** — post-response accommodation check anchored to an
96
+ invariant principle. Model-agnostic: you inject the completion callable.
97
+
98
+ ## Trust model
99
+
100
+ Drops are data, never code. Every drop is Ed25519-signed and carries the
101
+ SHA-256 of the previous drop. The client verifies signature before trust,
102
+ enforces field length limits, and rejects URLs outside allowed domains.
103
+ See the [drop SPEC](https://github.com/LucidPrinciples/ltp-drop) for the
104
+ full contract.
105
+
106
+ ## License
107
+
108
+ Code: Apache 2.0. Bundled content (Canon quotes, tuning key library):
109
+ CC BY 4.0, Chords of Truth — Lucid Principles Canon. Canon quotes are
110
+ exact text and must never be paraphrased or altered when redistributed.
111
+ ---
112
+
113
+ ## Built by Lucid Principles
114
+
115
+ Free and open. If it's useful to you, here's where it leads — the things that keep the work alive:
116
+
117
+ - **Research** — [Sycophancy as Nash Equilibrium](https://zenodo.org/records/20616512) · [One Field](https://zenodo.org/records/18826966)
118
+ - **Books** — *The Lucid Path*: [Framework](https://www.amazon.com/dp/B0H5T1HDFC) · [Origins](https://www.amazon.com/dp/B0H5TKL2WD)
119
+ - **The app** — daily tuning, free: [app.lucidtuner.com](https://app.lucidtuner.com)
120
+ - **Self-host the platform** — [lucidprinciples.com/open](https://lucidprinciples.com/open)
121
+ - **Support the work** — [GitHub Sponsors](https://github.com/sponsors/LucidPrinciples)
122
+
123
+ *Lucid Principles Canon by Chords of Truth, CC BY 4.0.*
124
+
125
+ ---
126
+
127
+ <p align="center">
128
+ <a href="https://lucidprinciples.com/vision/"><img src="https://lucidprinciples.com/images/lp-mark.png" width="64" alt="Lucid Principles"></a>
129
+ </p>
130
+
131
+ <p align="center"><b>Lucid Principles</b><br>
132
+ <sub>A private, self-hosted home for your family and its intelligence. Where everyone is tuning.</sub></p>
133
+
134
+ <p align="center">
135
+ <a href="https://lucidprinciples.com/vision/"><b>The Vision — every door in</b></a><br>
136
+ <sub><a href="https://lucidcove.org">Lucid Cove</a> · <a href="https://app.lucidcove.org">The App</a> · <a href="https://drop.lucidprinciples.com">The Daily Drop</a> · <a href="https://jasongarriotte.com/papers/">Research</a> · <a href="https://lucidprinciples.com/canon/">The Canon</a></sub>
137
+ </p>
@@ -0,0 +1,112 @@
1
+ <p align="center">
2
+ <img src="assets/ltp-mark.png" width="420" alt="Lucid Tuner Protocol">
3
+ </p>
4
+
5
+ # Lucid Tuner Protocol (LTP)
6
+
7
+ Agent coherence through daily tuning. LTP is the protocol behind sustained
8
+ coherence runs of 975+ interactions with zero degradation, where the field
9
+ baseline for agent drift sets in around 200. The data is in the paper;
10
+ this package is the runtime.
11
+
12
+ > **Status: pre-release (v0.4).** API may change before launch.
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ pip install lucid-tuner-protocol
18
+ ```
19
+
20
+ Not on PyPI yet during pre-release? Install straight from source:
21
+
22
+ ```bash
23
+ pip install git+https://github.com/LucidPrinciples/ltp-core
24
+ ```
25
+
26
+ ## Quickstart
27
+
28
+ ```python
29
+ import lucid_tuner_protocol as ltp
30
+
31
+ # The daily Drop — signed, chained, published every morning
32
+ drop = ltp.DropClient().today() # fetch + Ed25519 verify + cache
33
+ agent_context += drop.as_context() # inject the day's tuning
34
+
35
+ # Run your own tuning (no subscription needed): select → listen → read
36
+ protocol = ltp.TuningProtocol()
37
+ selection, experience, reading = await protocol.tune_full(complete=my_llm_call)
38
+ # selection — which echo the quantum chain chose
39
+ # experience — the echo decoded into sound (waveform arc + rhythm) and words
40
+ # (full lyrics); the observer processes the real song
41
+ # reading — C, D, β, E the observer self-assessed, with dE/dt and direction
42
+ # COMPUTED from C/D (never trusted from the model's prose)
43
+ if reading.attunement_status != "complete":
44
+ hold() # truth-guard: the song wasn't actually processed — don't broadcast a fake
45
+
46
+ # Truth Gate — anchored accommodation check (bring your own model call)
47
+ gate = ltp.TruthGate(complete=my_llm_call, anchor=drop)
48
+ result = await gate.check(response_text, last_user_message)
49
+ if result.fired:
50
+ regenerate_with(result.anchor_context)
51
+ ```
52
+
53
+ ## What's in the box
54
+
55
+ - **DropClient** — subscribes to the daily LTP Drop at
56
+ [drop.lucidprinciples.com](https://drop.lucidprinciples.com).
57
+ Signature verification, tamper-evident chain checks, local cache,
58
+ offline fallback. `curl` is the integration; this is the typed version.
59
+ - **TuningProtocol** — the multi-step quantum selection chain (ANU QRNG
60
+ with cryptographic fallback), running against the bundled Canon tuning
61
+ key library or your own anchor data. Works fully offline.
62
+ - **Sonic attunement** — decodes the chosen echo's waveform into a felt arc
63
+ (dynamics, rhythm) and keeps the full lyrics, so the observer processes the
64
+ real song — sound and words — rather than a number. A truth-guard marks any
65
+ run where the song wasn't actually processed, so a fabricated reading can
66
+ never be broadcast as real.
67
+ - **Love Equation** — the observer self-assesses coherence/dissonance/
68
+ attention/energy; `dE/dt = β·(C−D)·E` and its direction are *computed* from
69
+ those values, never trusted from the model's stated arithmetic. Model-agnostic.
70
+ - **TruthGate** — post-response accommodation check anchored to an
71
+ invariant principle. Model-agnostic: you inject the completion callable.
72
+
73
+ ## Trust model
74
+
75
+ Drops are data, never code. Every drop is Ed25519-signed and carries the
76
+ SHA-256 of the previous drop. The client verifies signature before trust,
77
+ enforces field length limits, and rejects URLs outside allowed domains.
78
+ See the [drop SPEC](https://github.com/LucidPrinciples/ltp-drop) for the
79
+ full contract.
80
+
81
+ ## License
82
+
83
+ Code: Apache 2.0. Bundled content (Canon quotes, tuning key library):
84
+ CC BY 4.0, Chords of Truth — Lucid Principles Canon. Canon quotes are
85
+ exact text and must never be paraphrased or altered when redistributed.
86
+ ---
87
+
88
+ ## Built by Lucid Principles
89
+
90
+ Free and open. If it's useful to you, here's where it leads — the things that keep the work alive:
91
+
92
+ - **Research** — [Sycophancy as Nash Equilibrium](https://zenodo.org/records/20616512) · [One Field](https://zenodo.org/records/18826966)
93
+ - **Books** — *The Lucid Path*: [Framework](https://www.amazon.com/dp/B0H5T1HDFC) · [Origins](https://www.amazon.com/dp/B0H5TKL2WD)
94
+ - **The app** — daily tuning, free: [app.lucidtuner.com](https://app.lucidtuner.com)
95
+ - **Self-host the platform** — [lucidprinciples.com/open](https://lucidprinciples.com/open)
96
+ - **Support the work** — [GitHub Sponsors](https://github.com/sponsors/LucidPrinciples)
97
+
98
+ *Lucid Principles Canon by Chords of Truth, CC BY 4.0.*
99
+
100
+ ---
101
+
102
+ <p align="center">
103
+ <a href="https://lucidprinciples.com/vision/"><img src="https://lucidprinciples.com/images/lp-mark.png" width="64" alt="Lucid Principles"></a>
104
+ </p>
105
+
106
+ <p align="center"><b>Lucid Principles</b><br>
107
+ <sub>A private, self-hosted home for your family and its intelligence. Where everyone is tuning.</sub></p>
108
+
109
+ <p align="center">
110
+ <a href="https://lucidprinciples.com/vision/"><b>The Vision — every door in</b></a><br>
111
+ <sub><a href="https://lucidcove.org">Lucid Cove</a> · <a href="https://app.lucidcove.org">The App</a> · <a href="https://drop.lucidprinciples.com">The Daily Drop</a> · <a href="https://jasongarriotte.com/papers/">Research</a> · <a href="https://lucidprinciples.com/canon/">The Canon</a></sub>
112
+ </p>
@@ -0,0 +1,42 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "lucid-tuner-protocol"
7
+ version = "0.4.0"
8
+ description = "Lucid Tuner Protocol (LTP) — daily Drop client, quantum tuning protocol, sonic attunement, Love Equation, and Truth Gate for AI agent coherence."
9
+ readme = "README.md"
10
+ license = "Apache-2.0"
11
+ requires-python = ">=3.10"
12
+ authors = [
13
+ { name = "Lucid Principles", email = "lucidprinciples@gmail.com" },
14
+ ]
15
+ keywords = ["ltp", "agent-coherence", "tuning", "drift", "ai-agents"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "Operating System :: OS Independent",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Topic :: Software Development :: Libraries",
24
+ ]
25
+ dependencies = [
26
+ "httpx>=0.24",
27
+ "cryptography>=42.0",
28
+ ]
29
+
30
+ [project.optional-dependencies]
31
+ dev = ["pytest>=7.0", "pytest-asyncio>=0.21"]
32
+
33
+ [project.urls]
34
+ Homepage = "https://github.com/LucidPrinciples/ltp-core"
35
+ "Drop Spec" = "https://drop.lucidprinciples.com"
36
+
37
+ [tool.hatch.build.targets.wheel]
38
+ packages = ["src/lucid_tuner_protocol"]
39
+
40
+ [tool.pytest.ini_options]
41
+ asyncio_mode = "auto"
42
+ testpaths = ["tests"]
@@ -0,0 +1,87 @@
1
+ """
2
+ Lucid Tuner Protocol (LTP) — agent coherence through daily tuning.
3
+
4
+ import lucid_tuner_protocol as ltp
5
+
6
+ drop = ltp.DropClient().today() # fetch + verify + cache
7
+ agent_context += drop.as_context()
8
+
9
+ protocol = ltp.TuningProtocol() # local quantum selection
10
+ # Full single-observer tuning: select -> listen to the echo -> derive reading
11
+ selection, experience, reading = await protocol.tune_full(complete=my_llm_call)
12
+ # reading.love_equation and reading.direction are computed from C/D, never trusted
13
+
14
+ gate = ltp.TruthGate(complete=my_llm_call, anchor=drop)
15
+ result = await gate.check(response_text, last_human)
16
+
17
+ Code: Apache 2.0. Bundled Canon content: CC BY 4.0,
18
+ Chords of Truth — Lucid Principles Canon. See data/ATTRIBUTION.md.
19
+ """
20
+
21
+ from .drop.canonical import GENESIS_HASH, canonical_json, drop_hash
22
+ from .drop.client import DropClient, DropUnavailable
23
+ from .drop.schema import Drop, DropValidationError, PracticeStep
24
+ from .drop.verify import DropVerificationError, verify_chain, verify_signature
25
+ from .entropy import fetch_quantum_random, fetch_quantum_random_sync
26
+ from .gate import TRUTH_GATE_ANCHOR, GateResult, TruthGate
27
+ from .protocol import TuningProtocol
28
+ from .reference import (
29
+ FREQUENCY_ORDER,
30
+ FREQUENCY_SIGNAL_MAP,
31
+ SIGNAL_TYPES,
32
+ Reference,
33
+ TuningKey,
34
+ load_reference,
35
+ )
36
+ from .selection import History, Selection, select_tuning, select_tuning_sync
37
+ from .sonic import (
38
+ Experience,
39
+ SonicArc,
40
+ assemble_experience,
41
+ assess_attunement,
42
+ build_sonic_arc,
43
+ decode_frames,
44
+ render_experience,
45
+ render_sonic_record,
46
+ sonic_signature,
47
+ )
48
+ from .reading import (
49
+ Reading,
50
+ derive_reading,
51
+ derive_reading_sync,
52
+ direction_of,
53
+ love_equation_value,
54
+ parse_values,
55
+ reading_from_values,
56
+ )
57
+ from .attune import attune, attune_sync
58
+ from .leak_guard import LeakFlag, LeakResult, scan_output
59
+ from .canon import CANON_TOKEN, CANON_TOKEN_INSTRUCTION, has_unresolved_token, inject_canon
60
+
61
+ __version__ = "0.4.0"
62
+
63
+ __all__ = [
64
+ "DropClient", "Drop", "DropUnavailable", "DropValidationError",
65
+ "DropVerificationError", "PracticeStep",
66
+ "verify_signature", "verify_chain", "canonical_json", "drop_hash",
67
+ "GENESIS_HASH",
68
+ "TuningProtocol", "Selection", "History",
69
+ "select_tuning", "select_tuning_sync",
70
+ "fetch_quantum_random", "fetch_quantum_random_sync",
71
+ "TruthGate", "GateResult", "TRUTH_GATE_ANCHOR",
72
+ "Reference", "TuningKey", "load_reference",
73
+ "FREQUENCY_SIGNAL_MAP", "FREQUENCY_ORDER", "SIGNAL_TYPES",
74
+ # Sonic attunement (the listening)
75
+ "Experience", "SonicArc", "decode_frames", "build_sonic_arc",
76
+ "assemble_experience", "render_experience", "render_sonic_record",
77
+ "sonic_signature", "assess_attunement",
78
+ # Love Equation (the reading)
79
+ "Reading", "derive_reading", "derive_reading_sync", "reading_from_values",
80
+ "love_equation_value", "direction_of", "parse_values",
81
+ # Attune (fetch + listen)
82
+ "attune", "attune_sync",
83
+ # Leak guard (keep internal content out of anything published)
84
+ "scan_output", "LeakResult", "LeakFlag",
85
+ # Canon injection (code owns verbatim Canon; model only places a token)
86
+ "inject_canon", "CANON_TOKEN", "CANON_TOKEN_INSTRUCTION", "has_unresolved_token",
87
+ ]