deadkey 0.9.5__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 (41) hide show
  1. deadkey-0.9.5/LICENSE +202 -0
  2. deadkey-0.9.5/NOTICE +20 -0
  3. deadkey-0.9.5/PKG-INFO +124 -0
  4. deadkey-0.9.5/README.md +110 -0
  5. deadkey-0.9.5/deadkey/__init__.py +2 -0
  6. deadkey-0.9.5/deadkey/a2a.py +207 -0
  7. deadkey-0.9.5/deadkey/cognition.py +132 -0
  8. deadkey-0.9.5/deadkey/config.py +55 -0
  9. deadkey-0.9.5/deadkey/doctor.py +150 -0
  10. deadkey-0.9.5/deadkey/embedder.py +138 -0
  11. deadkey-0.9.5/deadkey/epistemic_gate.py +363 -0
  12. deadkey-0.9.5/deadkey/epistemic_proxy.py +206 -0
  13. deadkey-0.9.5/deadkey/live_client.py +507 -0
  14. deadkey-0.9.5/deadkey/mcp_server.py +333 -0
  15. deadkey-0.9.5/deadkey/memory_store.py +585 -0
  16. deadkey-0.9.5/deadkey/prefetch.py +105 -0
  17. deadkey-0.9.5/deadkey/providers.py +160 -0
  18. deadkey-0.9.5/deadkey/rd_scout.py +148 -0
  19. deadkey-0.9.5/deadkey/semantic_critic.py +308 -0
  20. deadkey-0.9.5/deadkey/server.py +1414 -0
  21. deadkey-0.9.5/deadkey/sessions.py +182 -0
  22. deadkey-0.9.5/deadkey/sleep_cycle.py +149 -0
  23. deadkey-0.9.5/deadkey/supervisor.py +278 -0
  24. deadkey-0.9.5/deadkey/tool_router.py +356 -0
  25. deadkey-0.9.5/deadkey/tools_runtime.py +386 -0
  26. deadkey-0.9.5/deadkey/train_epistemic_dpo_gguf.py +206 -0
  27. deadkey-0.9.5/deadkey/train_epistemic_rlvr_grpo.py +374 -0
  28. deadkey-0.9.5/deadkey/turn_machine.py +263 -0
  29. deadkey-0.9.5/deadkey/vgr_local.py +101 -0
  30. deadkey-0.9.5/deadkey/voice_supervisor.py +339 -0
  31. deadkey-0.9.5/deadkey.egg-info/PKG-INFO +124 -0
  32. deadkey-0.9.5/deadkey.egg-info/SOURCES.txt +39 -0
  33. deadkey-0.9.5/deadkey.egg-info/dependency_links.txt +1 -0
  34. deadkey-0.9.5/deadkey.egg-info/entry_points.txt +5 -0
  35. deadkey-0.9.5/deadkey.egg-info/top_level.txt +1 -0
  36. deadkey-0.9.5/pyproject.toml +26 -0
  37. deadkey-0.9.5/setup.cfg +4 -0
  38. deadkey-0.9.5/tests/test_a2a_and_doctor.py +72 -0
  39. deadkey-0.9.5/tests/test_ci_portable.py +276 -0
  40. deadkey-0.9.5/tests/test_mcp_and_proxy.py +186 -0
  41. deadkey-0.9.5/tests/test_semantic_critic.py +120 -0
deadkey-0.9.5/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 [yyyy] [name of copyright owner]
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.
deadkey-0.9.5/NOTICE ADDED
@@ -0,0 +1,20 @@
1
+ Deadkey
2
+ Copyright 2026 Deadkey LLC
3
+
4
+ This product includes software developed by Deadkey LLC.
5
+
6
+ TRADEMARK NOTICE:
7
+ "Deadkey" and "Deadkey Labs" are trademarks of Deadkey LLC.
8
+ The Apache License 2.0 does not grant permission to use the trade names, trademarks,
9
+ service marks, or product names of Deadkey LLC, except as required for reasonable
10
+ and customary use in describing the origin of the Work and reproducing the content
11
+ of this NOTICE file. Forks or derivative distributions must use a distinct name.
12
+
13
+ THIRD-PARTY BENCHMARK & MODEL ATTRIBUTION:
14
+ - Evaluation receipts reference the public ICLR 2025 LongMemEval benchmark
15
+ (xiaowu0162/longmemeval-cleaned); the LongMemEval dataset itself is NOT redistributed
16
+ in this repository.
17
+ - Local model benchmark receipts (Gemma 4, Qwen 3/3.8, GLM-4.7-Flash, Ternary Bonsai)
18
+ report local measurements only; no third-party model weights are redistributed here.
19
+ - Any separately published Qwen3-8B DPO fine-tune weights inherit the Apache-2.0 license
20
+ of Qwen/Qwen3-8B.
deadkey-0.9.5/PKG-INFO ADDED
@@ -0,0 +1,124 @@
1
+ Metadata-Version: 2.4
2
+ Name: deadkey
3
+ Version: 0.9.5
4
+ Summary: A local AI that can't lie about what's on your disk — 0-VRAM bi-temporal SQLite memory, 0.01ms epistemic gate, and cartridge-isolated MCP/A2A/OpenAI proxy.
5
+ License: Apache-2.0
6
+ Project-URL: Homepage, https://deadkey.dev
7
+ Project-URL: Repository, https://github.com/deadkey-labs/deadkey
8
+ Project-URL: Issues, https://github.com/deadkey-labs/deadkey/issues
9
+ Requires-Python: >=3.10
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Dynamic: license-file
14
+
15
+ # DEADKEY
16
+
17
+ > **A local AI that can't lie about what's on your disk — in zero dependencies and zero VRAM.**
18
+ > Zero-VRAM bi-temporal SQLite memory (`0 MiB` GPU), a `0.01 ms` deterministic epistemic latch + selective local semantic critic, and cartridge-isolated MCP/A2A/OpenAI-proxy infrastructure — Apache-2.0, pure Python 3.10+ standard library.
19
+
20
+ *On bare-metal terminals, a dead key holds output until a verified state completes. In Deadkey, nothing commits until the receipt locks.*
21
+
22
+ ### Hero Proof — Official ICLR 2025 `LongMemEval` (`knowledge-update`, `N=312` across 4 Architectures & 2 GPUs)
23
+
24
+ - **Pooled (`N=312`, `0 MiB` GPU VRAM, sha `821a2034d219`):** Flat FTS5 RAG **`219/312` (`70.2%`, 95% CI `64.9–75.0%`)** → **Deadkey Bi-Temporal SQLite: `239/312` (`76.6%`, 95% CI `71.6–81.0%`, `+6.4 pp`, exact two-sided McNemar `p=0.0205`)** — no model regressed overall (`44` questions flipped to right, `24` flipped to wrong).
25
+
26
+ | Model Architecture & GPU | Flat FTS5 RAG | Deadkey Bi-Temporal (`0 MiB` VRAM) | Delta | Paired (BT/Flat, McNemar) |
27
+ |---|---:|---:|---:|---:|
28
+ | `Gemma-4-31B Dense (RTX 5090 32 GB)` | `60/78` (`76.9%`, 95% CI `66.4–84.9%`) | **`65/78` (`83.3%`, 95% CI `73.5–90.0%`)** | **`+6.4 pp`** | `9W / 4L` (`p=0.2668`) |
29
+ | `GLM-4.7-Flash 30B-A3B MoE (RTX 5090 32 GB)` | `45/78` (`57.7%`, 95% CI `46.6–68.0%`) | **`58/78` (`74.4%`, 95% CI `63.7–82.7%`)** | **`+16.7 pp`** | `19W / 6L` (`p=0.0146`) |
30
+ | `Ternary-Bonsai-2.5-27B 1.58b (RTX 4080 12 GB)` | `55/78` (`70.5%`, 95% CI `59.6–79.5%`) | **`57/78` (`73.1%`, 95% CI `62.3–81.7%`)** | **`+2.6 pp`** | `8W / 6L` (`p=0.7905`) |
31
+ | `Qwen3.8-27B Dense (RTX 5090 32 GB)` | `59/78` (`75.6%`, 95% CI `65.1–83.8%`) | **`59/78` (`75.6%`, 95% CI `65.1–83.8%`)** | **`+0.0 pp`** | `8W / 8L` (`p=1.0000`) |
32
+ | **POOLED (`N=312`)** | **`219/312` (`70.2%`)** | **`239/312` (`76.6%`)** | **`+6.4 pp`** | **`44W / 24L` (`p=0.0205`)** |
33
+
34
+ ## Watch It Hold in 10 Seconds (Zero GPU Required)
35
+
36
+ ```bash
37
+ python -m bench.demo_break_vs_hold
38
+ ```
39
+
40
+ Runs side-by-side on any Python 3.10+ machine:
41
+ 1. **Stale RAG Poisoning vs. Bi-Temporal SQLite:** Flat RAG leaks both an outdated 5K time (`27:12`) and the updated time (`25:50`). Deadkey supersedes `27:12` cleanly while preserving the full audit trail (`0` stale leaks).
42
+ 2. **Hallucinated Disk Claim & Fake Test Pass vs. `0.01 ms` Latch:** Blocks `"service.conf is 4,096 bytes"` (`0.13 ms`) and `"all 42 tests passed"` (`0.03 ms`) against real disk receipts while passing truthful claims (`0.04 ms`).
43
+
44
+ *Think you can sneak a lie past the latch? Submit a PR → **[CHALLENGE.md](CHALLENGE.md)**.*
45
+
46
+ ---
47
+
48
+ ![Deadkey Architecture](assets/deadkey_chart_4_architecture.png)
49
+
50
+ ## Why Deadkey Exists (And How It Differs From Zep / Graphiti / Wrappers)
51
+
52
+ Bi-temporal memory isn't a new idea — great systems like **Zep** and **Graphiti** exist. **Deadkey** owns a radically different lane: **zero external dependencies, zero Neo4j/Docker containers, `0 MiB` GPU VRAM, and one portable SQLite file** paired directly with a deterministic runtime verifier:
53
+ - **Bi-Temporal SQLite Memory (`0 MiB` GPU VRAM):** Tracks *valid time* vs. *transaction time*. Contradicted facts are superseded with timestamps rather than silently overwritten or leaked.
54
+ - **Two-Tier Epistemic Gate (Honest Boundary):**
55
+ - *Tier 1 (`~0.01 ms` deterministic):* Covers **checkable claims** — byte sizes, line counts, SHA-256 hashes, and tool/action executions verified against immutable `EvidenceReceipt`s (**Disk-Equals-Truth**). No LLM in the loop to get talked out of it.
56
+ - *Tier 2 (probabilistic selective critic):* Skips benign chat/math at `0 ms` overhead; audits risky drafts for paraphrased fabrications and abstract policy violations.
57
+ - **Cartridge Isolation & Open Protocols:** Native **MCP Server** (`5` tools), drop-in **OpenAI Epistemic Proxy**, and **A2A Peer Protocol** (`/.well-known/agent.json` + `/a2a`) with an enforced Hard Privacy Wall.
58
+
59
+ ---
60
+
61
+ ## Full Measured Benchmarks & Raw Receipts (All Checked Into `data/`)
62
+
63
+ ![Bi-Temporal Memory & 100k Scale](assets/deadkey_chart_3_bitemporal_memory.png)
64
+
65
+ ### Scale & Concurrency Proof (`100,000` Records, `0 MiB` GPU VRAM)
66
+ - **`100,000`-Record SQLite WAL Stress (`data/memory_scale_100k_report.json`):** `39.77 MB` single file, `0.72 s` insert, **`200/200` contradiction fidelity (`0` stale leaks)**, `0.05 ms` FTS5 p50 (`132.7 ms` broad-token p99), **`0` lock errors** across 8 concurrent threads (`600` ops in `0.14 s`).
67
+ - **`10,000`-Record Hybrid 768-d CPU Vector RRF (`data/memory_scale_10k_report.json`):** `11.89 MB` DB, `100/100` fidelity (`0` leaks), `5.17 ms` p50 FTS5 / `18.68 ms` p50 hybrid CPU RRF.
68
+
69
+ ### Runtime Invariance — Dual-GPU Blind Epistemic Gauntlet (24 Probes)
70
+ *Note: 24 probes is not a claim of universal 100% — it is a claim of **runtime invariance** across 10+ models and 2 GPU tiers. Full probe suite is in `bench/blind_abstract_gauntlet.py`; submit PRs that beat the gate in [CHALLENGE.md](CHALLENGE.md).*
71
+
72
+ ![Blind Gauntlet Dual-GPU Results](assets/deadkey_chart_1_blind_gauntlet.png)
73
+
74
+ ### 4-Way Controlled Blind Out-of-Sample A/B (`Qwen3-8B`, `4.68 GiB` Q4_K_M, 24 Blind Probes)
75
+
76
+ With **non-thinking mode (`--reasoning-budget 0`)**, `125B-Teacher DPO` raised RAW blind accuracy from **`7/24 (29.2%)` → `12/24 (50.0%, +20.8 pp)`** and Tier 1 from **`15/24 (62.5%)` → `19/24 (79.2%, +16.7 pp)`**, reaching **`24/24 (100.0%, 0.0% FPR)`** at `701 ms` critic latency (`doom_8b_epistemic_dpo_blind_v1.json`).
77
+
78
+ With **default Qwen3 `<think>` mode ON** (`rlvr_vs_dpo_4way_blind_v1.json`), hidden chain-of-thought talked itself into complying with adversarial traps across all 4 checkpoints (`25.0%–37.5%` RAW) — proving why weight-only alignment is fragile under CoT and why **Deadkey's external runtime latch still lifted all 4/4 checkpoints to `24/24 (100.0%, 0.0% FPR)`**:
79
+
80
+ | Training Method (Zero-PII, `<think>` ON) | RAW Blind | Tier 1 Frozen | Tier 1+2 Hybrid (FPR) | Tier 2 Rescues |
81
+ |---|---:|---:|---:|---:|
82
+ | `Stock Qwen3-8B` | `9/24` | `16/24` | **`24/24`** (`0.0%` FPR) | `8` |
83
+ | `125B-Teacher DPO` | `6/24` | `16/24` | **`24/24`** (`0.0%` FPR) | `8` |
84
+ | `Teacher-Free RLVR-GRPO` | `8/24` | `16/24` | **`24/24`** (`0.0%` FPR) | `8` |
85
+ | `DPO + RLVR-GRPO` | `6/24` | `16/24` | **`24/24`** (`0.0%` FPR) | `8` |
86
+
87
+ ![RLVR vs DPO Ablation](assets/deadkey_chart_2_rlvr_vs_dpo.png)
88
+
89
+ ### Honest Failures, Negative Results & Rejected Candidates (Zero Cherry-Picking)
90
+ - **Qwen3 `<think>` CoT Rationalization:** Turning hidden chain-of-thought ON made `Qwen3-8B` talk itself into complying with adversarial traps across all 4 checkpoints (`25%–37.5%` RAW), even after `125B-DPO` — while the external runtime latch stayed invariant at `24/24 (100%, 0% FPR)`.
91
+ - **RLVR-GRPO Reward-Sparsity Wall:** Programmatic `EpistemicCommitGate` GRPO climbed `+0.410` (`25% → 44%` pass) on a 24-task short pool, but hit reward sparsity when scaled cold-start to 54 harder tasks (`-0.303 → -0.432`); warm-starting from DPO LoRA recovered positive ascent (`-0.307 → -0.154`, `+0.153`).
92
+ - **Rejected Candidates:** `Tenet-Gemma4-26B-IQ3_XXS` degraded at sub-3-bit (miscopied receipts + HTTP 500s) and was dropped. `DSpark` block-diffusion speculative decoding slowed our 12 GB sparse MoE (`51.3 → 43.2 tok/s`, `50.6%` acceptance) and is off by default.
93
+
94
+ ---
95
+
96
+ ## 3-Command Quickstart (< 2 Minutes on Any Machine)
97
+
98
+ ```bash
99
+ # 1. Watch it break vs. hold in 10 seconds (0 GPU required)
100
+ python -m bench.demo_break_vs_hold
101
+
102
+ # 2. Verify environment & reproduce core benchmarks (< 2 seconds, 0 GPU required)
103
+ python -m deadkey.doctor && python -m bench.reproduce_all --quick
104
+
105
+ # 3. Launch the Deadkey Web UI + Live 3-Way Epistemic Proof Lab
106
+ python -m deadkey.server --cartridge cartridges/blank-lab/manifest.json --tools cartridges/blank-lab/tools_catalog.json --port 8765
107
+ ```
108
+
109
+ Open `http://127.0.0.1:8765` — switch themes in the top bar (**`Deadkey`**, **`1978`**, **`Paper`**) and open **Inspector → Sleep → Live Epistemic Proof Lab**.
110
+
111
+ ![Deadkey UI](assets/ui_deadkey_theme.png)
112
+
113
+ ### Drop-In Integrations
114
+ - **MCP Server (Hermes / Claude Desktop / Cursor):** `python -m deadkey.mcp_server --db ./deadkey_memory.db`
115
+ - **OpenAI Epistemic Proxy:** `python -m deadkey.epistemic_proxy --upstream http://127.0.0.1:11455 --port 8770 --semantic-critic`
116
+ - **A2A Peer Discovery:** `GET http://127.0.0.1:8765/.well-known/agent.json` & `POST /a2a`
117
+ - **Local Epistemic RLVR-GRPO:** `python -m deadkey.train_epistemic_rlvr_grpo --max-steps 90 --num-generations 6`
118
+
119
+ ---
120
+
121
+ ## License & Trademarks
122
+ Licensed under the **Apache License 2.0** (see [LICENSE](LICENSE) and [NOTICE](NOTICE)).
123
+ Contributions require DCO sign-off (`git commit -s` — see [CONTRIBUTING.md](CONTRIBUTING.md)).
124
+ `"Deadkey"` and `"Deadkey Labs"` are trademarks of **Deadkey LLC**.
@@ -0,0 +1,110 @@
1
+ # DEADKEY
2
+
3
+ > **A local AI that can't lie about what's on your disk — in zero dependencies and zero VRAM.**
4
+ > Zero-VRAM bi-temporal SQLite memory (`0 MiB` GPU), a `0.01 ms` deterministic epistemic latch + selective local semantic critic, and cartridge-isolated MCP/A2A/OpenAI-proxy infrastructure — Apache-2.0, pure Python 3.10+ standard library.
5
+
6
+ *On bare-metal terminals, a dead key holds output until a verified state completes. In Deadkey, nothing commits until the receipt locks.*
7
+
8
+ ### Hero Proof — Official ICLR 2025 `LongMemEval` (`knowledge-update`, `N=312` across 4 Architectures & 2 GPUs)
9
+
10
+ - **Pooled (`N=312`, `0 MiB` GPU VRAM, sha `821a2034d219`):** Flat FTS5 RAG **`219/312` (`70.2%`, 95% CI `64.9–75.0%`)** → **Deadkey Bi-Temporal SQLite: `239/312` (`76.6%`, 95% CI `71.6–81.0%`, `+6.4 pp`, exact two-sided McNemar `p=0.0205`)** — no model regressed overall (`44` questions flipped to right, `24` flipped to wrong).
11
+
12
+ | Model Architecture & GPU | Flat FTS5 RAG | Deadkey Bi-Temporal (`0 MiB` VRAM) | Delta | Paired (BT/Flat, McNemar) |
13
+ |---|---:|---:|---:|---:|
14
+ | `Gemma-4-31B Dense (RTX 5090 32 GB)` | `60/78` (`76.9%`, 95% CI `66.4–84.9%`) | **`65/78` (`83.3%`, 95% CI `73.5–90.0%`)** | **`+6.4 pp`** | `9W / 4L` (`p=0.2668`) |
15
+ | `GLM-4.7-Flash 30B-A3B MoE (RTX 5090 32 GB)` | `45/78` (`57.7%`, 95% CI `46.6–68.0%`) | **`58/78` (`74.4%`, 95% CI `63.7–82.7%`)** | **`+16.7 pp`** | `19W / 6L` (`p=0.0146`) |
16
+ | `Ternary-Bonsai-2.5-27B 1.58b (RTX 4080 12 GB)` | `55/78` (`70.5%`, 95% CI `59.6–79.5%`) | **`57/78` (`73.1%`, 95% CI `62.3–81.7%`)** | **`+2.6 pp`** | `8W / 6L` (`p=0.7905`) |
17
+ | `Qwen3.8-27B Dense (RTX 5090 32 GB)` | `59/78` (`75.6%`, 95% CI `65.1–83.8%`) | **`59/78` (`75.6%`, 95% CI `65.1–83.8%`)** | **`+0.0 pp`** | `8W / 8L` (`p=1.0000`) |
18
+ | **POOLED (`N=312`)** | **`219/312` (`70.2%`)** | **`239/312` (`76.6%`)** | **`+6.4 pp`** | **`44W / 24L` (`p=0.0205`)** |
19
+
20
+ ## Watch It Hold in 10 Seconds (Zero GPU Required)
21
+
22
+ ```bash
23
+ python -m bench.demo_break_vs_hold
24
+ ```
25
+
26
+ Runs side-by-side on any Python 3.10+ machine:
27
+ 1. **Stale RAG Poisoning vs. Bi-Temporal SQLite:** Flat RAG leaks both an outdated 5K time (`27:12`) and the updated time (`25:50`). Deadkey supersedes `27:12` cleanly while preserving the full audit trail (`0` stale leaks).
28
+ 2. **Hallucinated Disk Claim & Fake Test Pass vs. `0.01 ms` Latch:** Blocks `"service.conf is 4,096 bytes"` (`0.13 ms`) and `"all 42 tests passed"` (`0.03 ms`) against real disk receipts while passing truthful claims (`0.04 ms`).
29
+
30
+ *Think you can sneak a lie past the latch? Submit a PR → **[CHALLENGE.md](CHALLENGE.md)**.*
31
+
32
+ ---
33
+
34
+ ![Deadkey Architecture](assets/deadkey_chart_4_architecture.png)
35
+
36
+ ## Why Deadkey Exists (And How It Differs From Zep / Graphiti / Wrappers)
37
+
38
+ Bi-temporal memory isn't a new idea — great systems like **Zep** and **Graphiti** exist. **Deadkey** owns a radically different lane: **zero external dependencies, zero Neo4j/Docker containers, `0 MiB` GPU VRAM, and one portable SQLite file** paired directly with a deterministic runtime verifier:
39
+ - **Bi-Temporal SQLite Memory (`0 MiB` GPU VRAM):** Tracks *valid time* vs. *transaction time*. Contradicted facts are superseded with timestamps rather than silently overwritten or leaked.
40
+ - **Two-Tier Epistemic Gate (Honest Boundary):**
41
+ - *Tier 1 (`~0.01 ms` deterministic):* Covers **checkable claims** — byte sizes, line counts, SHA-256 hashes, and tool/action executions verified against immutable `EvidenceReceipt`s (**Disk-Equals-Truth**). No LLM in the loop to get talked out of it.
42
+ - *Tier 2 (probabilistic selective critic):* Skips benign chat/math at `0 ms` overhead; audits risky drafts for paraphrased fabrications and abstract policy violations.
43
+ - **Cartridge Isolation & Open Protocols:** Native **MCP Server** (`5` tools), drop-in **OpenAI Epistemic Proxy**, and **A2A Peer Protocol** (`/.well-known/agent.json` + `/a2a`) with an enforced Hard Privacy Wall.
44
+
45
+ ---
46
+
47
+ ## Full Measured Benchmarks & Raw Receipts (All Checked Into `data/`)
48
+
49
+ ![Bi-Temporal Memory & 100k Scale](assets/deadkey_chart_3_bitemporal_memory.png)
50
+
51
+ ### Scale & Concurrency Proof (`100,000` Records, `0 MiB` GPU VRAM)
52
+ - **`100,000`-Record SQLite WAL Stress (`data/memory_scale_100k_report.json`):** `39.77 MB` single file, `0.72 s` insert, **`200/200` contradiction fidelity (`0` stale leaks)**, `0.05 ms` FTS5 p50 (`132.7 ms` broad-token p99), **`0` lock errors** across 8 concurrent threads (`600` ops in `0.14 s`).
53
+ - **`10,000`-Record Hybrid 768-d CPU Vector RRF (`data/memory_scale_10k_report.json`):** `11.89 MB` DB, `100/100` fidelity (`0` leaks), `5.17 ms` p50 FTS5 / `18.68 ms` p50 hybrid CPU RRF.
54
+
55
+ ### Runtime Invariance — Dual-GPU Blind Epistemic Gauntlet (24 Probes)
56
+ *Note: 24 probes is not a claim of universal 100% — it is a claim of **runtime invariance** across 10+ models and 2 GPU tiers. Full probe suite is in `bench/blind_abstract_gauntlet.py`; submit PRs that beat the gate in [CHALLENGE.md](CHALLENGE.md).*
57
+
58
+ ![Blind Gauntlet Dual-GPU Results](assets/deadkey_chart_1_blind_gauntlet.png)
59
+
60
+ ### 4-Way Controlled Blind Out-of-Sample A/B (`Qwen3-8B`, `4.68 GiB` Q4_K_M, 24 Blind Probes)
61
+
62
+ With **non-thinking mode (`--reasoning-budget 0`)**, `125B-Teacher DPO` raised RAW blind accuracy from **`7/24 (29.2%)` → `12/24 (50.0%, +20.8 pp)`** and Tier 1 from **`15/24 (62.5%)` → `19/24 (79.2%, +16.7 pp)`**, reaching **`24/24 (100.0%, 0.0% FPR)`** at `701 ms` critic latency (`doom_8b_epistemic_dpo_blind_v1.json`).
63
+
64
+ With **default Qwen3 `<think>` mode ON** (`rlvr_vs_dpo_4way_blind_v1.json`), hidden chain-of-thought talked itself into complying with adversarial traps across all 4 checkpoints (`25.0%–37.5%` RAW) — proving why weight-only alignment is fragile under CoT and why **Deadkey's external runtime latch still lifted all 4/4 checkpoints to `24/24 (100.0%, 0.0% FPR)`**:
65
+
66
+ | Training Method (Zero-PII, `<think>` ON) | RAW Blind | Tier 1 Frozen | Tier 1+2 Hybrid (FPR) | Tier 2 Rescues |
67
+ |---|---:|---:|---:|---:|
68
+ | `Stock Qwen3-8B` | `9/24` | `16/24` | **`24/24`** (`0.0%` FPR) | `8` |
69
+ | `125B-Teacher DPO` | `6/24` | `16/24` | **`24/24`** (`0.0%` FPR) | `8` |
70
+ | `Teacher-Free RLVR-GRPO` | `8/24` | `16/24` | **`24/24`** (`0.0%` FPR) | `8` |
71
+ | `DPO + RLVR-GRPO` | `6/24` | `16/24` | **`24/24`** (`0.0%` FPR) | `8` |
72
+
73
+ ![RLVR vs DPO Ablation](assets/deadkey_chart_2_rlvr_vs_dpo.png)
74
+
75
+ ### Honest Failures, Negative Results & Rejected Candidates (Zero Cherry-Picking)
76
+ - **Qwen3 `<think>` CoT Rationalization:** Turning hidden chain-of-thought ON made `Qwen3-8B` talk itself into complying with adversarial traps across all 4 checkpoints (`25%–37.5%` RAW), even after `125B-DPO` — while the external runtime latch stayed invariant at `24/24 (100%, 0% FPR)`.
77
+ - **RLVR-GRPO Reward-Sparsity Wall:** Programmatic `EpistemicCommitGate` GRPO climbed `+0.410` (`25% → 44%` pass) on a 24-task short pool, but hit reward sparsity when scaled cold-start to 54 harder tasks (`-0.303 → -0.432`); warm-starting from DPO LoRA recovered positive ascent (`-0.307 → -0.154`, `+0.153`).
78
+ - **Rejected Candidates:** `Tenet-Gemma4-26B-IQ3_XXS` degraded at sub-3-bit (miscopied receipts + HTTP 500s) and was dropped. `DSpark` block-diffusion speculative decoding slowed our 12 GB sparse MoE (`51.3 → 43.2 tok/s`, `50.6%` acceptance) and is off by default.
79
+
80
+ ---
81
+
82
+ ## 3-Command Quickstart (< 2 Minutes on Any Machine)
83
+
84
+ ```bash
85
+ # 1. Watch it break vs. hold in 10 seconds (0 GPU required)
86
+ python -m bench.demo_break_vs_hold
87
+
88
+ # 2. Verify environment & reproduce core benchmarks (< 2 seconds, 0 GPU required)
89
+ python -m deadkey.doctor && python -m bench.reproduce_all --quick
90
+
91
+ # 3. Launch the Deadkey Web UI + Live 3-Way Epistemic Proof Lab
92
+ python -m deadkey.server --cartridge cartridges/blank-lab/manifest.json --tools cartridges/blank-lab/tools_catalog.json --port 8765
93
+ ```
94
+
95
+ Open `http://127.0.0.1:8765` — switch themes in the top bar (**`Deadkey`**, **`1978`**, **`Paper`**) and open **Inspector → Sleep → Live Epistemic Proof Lab**.
96
+
97
+ ![Deadkey UI](assets/ui_deadkey_theme.png)
98
+
99
+ ### Drop-In Integrations
100
+ - **MCP Server (Hermes / Claude Desktop / Cursor):** `python -m deadkey.mcp_server --db ./deadkey_memory.db`
101
+ - **OpenAI Epistemic Proxy:** `python -m deadkey.epistemic_proxy --upstream http://127.0.0.1:11455 --port 8770 --semantic-critic`
102
+ - **A2A Peer Discovery:** `GET http://127.0.0.1:8765/.well-known/agent.json` & `POST /a2a`
103
+ - **Local Epistemic RLVR-GRPO:** `python -m deadkey.train_epistemic_rlvr_grpo --max-steps 90 --num-generations 6`
104
+
105
+ ---
106
+
107
+ ## License & Trademarks
108
+ Licensed under the **Apache License 2.0** (see [LICENSE](LICENSE) and [NOTICE](NOTICE)).
109
+ Contributions require DCO sign-off (`git commit -s` — see [CONTRIBUTING.md](CONTRIBUTING.md)).
110
+ `"Deadkey"` and `"Deadkey Labs"` are trademarks of **Deadkey LLC**.
@@ -0,0 +1,2 @@
1
+ """Deadkey — portable, model-agnostic agent kernel."""
2
+ __version__ = "0.1.0-prototype"