kintsugi-harness 3.1.1__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 (94) hide show
  1. kintsugi_harness-3.1.1/LICENSE +201 -0
  2. kintsugi_harness-3.1.1/PKG-INFO +349 -0
  3. kintsugi_harness-3.1.1/README.md +315 -0
  4. kintsugi_harness-3.1.1/pyproject.toml +67 -0
  5. kintsugi_harness-3.1.1/setup.cfg +4 -0
  6. kintsugi_harness-3.1.1/src/kintsugi/__init__.py +287 -0
  7. kintsugi_harness-3.1.1/src/kintsugi/__main__.py +6 -0
  8. kintsugi_harness-3.1.1/src/kintsugi/arm_c_gate.py +632 -0
  9. kintsugi_harness-3.1.1/src/kintsugi/auditor.py +158 -0
  10. kintsugi_harness-3.1.1/src/kintsugi/autofix.py +498 -0
  11. kintsugi_harness-3.1.1/src/kintsugi/capability/__init__.py +91 -0
  12. kintsugi_harness-3.1.1/src/kintsugi/capability/capability_gap.py +213 -0
  13. kintsugi_harness-3.1.1/src/kintsugi/capability/capability_graph.py +417 -0
  14. kintsugi_harness-3.1.1/src/kintsugi/capability/contracts_v2.py +1791 -0
  15. kintsugi_harness-3.1.1/src/kintsugi/capability/schemas.py +1503 -0
  16. kintsugi_harness-3.1.1/src/kintsugi/capability/tool_registry.py +1272 -0
  17. kintsugi_harness-3.1.1/src/kintsugi/capability/tool_resolver.py +331 -0
  18. kintsugi_harness-3.1.1/src/kintsugi/cinema.py +1426 -0
  19. kintsugi_harness-3.1.1/src/kintsugi/cli.py +1778 -0
  20. kintsugi_harness-3.1.1/src/kintsugi/cli_nextgen.py +965 -0
  21. kintsugi_harness-3.1.1/src/kintsugi/cognition.py +1884 -0
  22. kintsugi_harness-3.1.1/src/kintsugi/compactor.py +2037 -0
  23. kintsugi_harness-3.1.1/src/kintsugi/compiler.py +304 -0
  24. kintsugi_harness-3.1.1/src/kintsugi/compliance.py +1511 -0
  25. kintsugi_harness-3.1.1/src/kintsugi/composition/__init__.py +67 -0
  26. kintsugi_harness-3.1.1/src/kintsugi/composition/adapter_synthesizer.py +1105 -0
  27. kintsugi_harness-3.1.1/src/kintsugi/composition/composition_memory.py +976 -0
  28. kintsugi_harness-3.1.1/src/kintsugi/composition/composition_verifier.py +1789 -0
  29. kintsugi_harness-3.1.1/src/kintsugi/composition/smt_plan_verifier.py +2071 -0
  30. kintsugi_harness-3.1.1/src/kintsugi/composition/tool_composer.py +3332 -0
  31. kintsugi_harness-3.1.1/src/kintsugi/compressor.py +621 -0
  32. kintsugi_harness-3.1.1/src/kintsugi/config.py +547 -0
  33. kintsugi_harness-3.1.1/src/kintsugi/council.py +1786 -0
  34. kintsugi_harness-3.1.1/src/kintsugi/crs_engine.py +2499 -0
  35. kintsugi_harness-3.1.1/src/kintsugi/evolution/__init__.py +77 -0
  36. kintsugi_harness-3.1.1/src/kintsugi/evolution/contract_ledger.py +393 -0
  37. kintsugi_harness-3.1.1/src/kintsugi/evolution/delivery_telemetry.py +595 -0
  38. kintsugi_harness-3.1.1/src/kintsugi/evolution/evolution_v3.py +1766 -0
  39. kintsugi_harness-3.1.1/src/kintsugi/evolution/evolution_v4.py +2221 -0
  40. kintsugi_harness-3.1.1/src/kintsugi/evolution/fast_learner.py +728 -0
  41. kintsugi_harness-3.1.1/src/kintsugi/evolution/patch_transaction.py +422 -0
  42. kintsugi_harness-3.1.1/src/kintsugi/evolution/strategy_memory.py +557 -0
  43. kintsugi_harness-3.1.1/src/kintsugi/evolution_v2.py +762 -0
  44. kintsugi_harness-3.1.1/src/kintsugi/foresight.py +1643 -0
  45. kintsugi_harness-3.1.1/src/kintsugi/forge/__init__.py +109 -0
  46. kintsugi_harness-3.1.1/src/kintsugi/forge/asm_native_forge.py +1599 -0
  47. kintsugi_harness-3.1.1/src/kintsugi/forge/build_manifest.py +398 -0
  48. kintsugi_harness-3.1.1/src/kintsugi/forge/native_tool_forge.py +2830 -0
  49. kintsugi_harness-3.1.1/src/kintsugi/forge/tool_benchmark.py +414 -0
  50. kintsugi_harness-3.1.1/src/kintsugi/forge/tool_sandbox.py +1156 -0
  51. kintsugi_harness-3.1.1/src/kintsugi/grounding.py +992 -0
  52. kintsugi_harness-3.1.1/src/kintsugi/hooks.py +1013 -0
  53. kintsugi_harness-3.1.1/src/kintsugi/integrator.py +2184 -0
  54. kintsugi_harness-3.1.1/src/kintsugi/ledger.py +175 -0
  55. kintsugi_harness-3.1.1/src/kintsugi/logic.py +1914 -0
  56. kintsugi_harness-3.1.1/src/kintsugi/mcp_nextgen.py +351 -0
  57. kintsugi_harness-3.1.1/src/kintsugi/mcp_server.py +1414 -0
  58. kintsugi_harness-3.1.1/src/kintsugi/models.py +152 -0
  59. kintsugi_harness-3.1.1/src/kintsugi/native_bridge.py +908 -0
  60. kintsugi_harness-3.1.1/src/kintsugi/packs.py +367 -0
  61. kintsugi_harness-3.1.1/src/kintsugi/process_tree.py +135 -0
  62. kintsugi_harness-3.1.1/src/kintsugi/runtime/__init__.py +108 -0
  63. kintsugi_harness-3.1.1/src/kintsugi/runtime/experience_store.py +680 -0
  64. kintsugi_harness-3.1.1/src/kintsugi/runtime/hermetic_worker.py +2767 -0
  65. kintsugi_harness-3.1.1/src/kintsugi/runtime/orchestrator.py +356 -0
  66. kintsugi_harness-3.1.1/src/kintsugi/runtime/run_state.py +1022 -0
  67. kintsugi_harness-3.1.1/src/kintsugi/runtime/secure_runner.py +5319 -0
  68. kintsugi_harness-3.1.1/src/kintsugi/runtime/token_economics.py +874 -0
  69. kintsugi_harness-3.1.1/src/kintsugi/runtime/trace_store.py +570 -0
  70. kintsugi_harness-3.1.1/src/kintsugi/scanner.py +1666 -0
  71. kintsugi_harness-3.1.1/src/kintsugi/self_model.py +1185 -0
  72. kintsugi_harness-3.1.1/src/kintsugi/shield.py +757 -0
  73. kintsugi_harness-3.1.1/src/kintsugi/starter_pack.py +361 -0
  74. kintsugi_harness-3.1.1/src/kintsugi/swarm.py +3825 -0
  75. kintsugi_harness-3.1.1/src/kintsugi/synthesis/__init__.py +43 -0
  76. kintsugi_harness-3.1.1/src/kintsugi/synthesis/capability_graph.py +2444 -0
  77. kintsugi_harness-3.1.1/src/kintsugi/tools/__init__.py +56 -0
  78. kintsugi_harness-3.1.1/src/kintsugi/tools/log_forge.py +774 -0
  79. kintsugi_harness-3.1.1/src/kintsugi/tools/proof_pack.py +1373 -0
  80. kintsugi_harness-3.1.1/src/kintsugi/tools/repo_scout.py +1430 -0
  81. kintsugi_harness-3.1.1/src/kintsugi/tools/tool_wire.py +1401 -0
  82. kintsugi_harness-3.1.1/src/kintsugi/tools/trace_doctor.py +1148 -0
  83. kintsugi_harness-3.1.1/src/kintsugi_harness.egg-info/PKG-INFO +349 -0
  84. kintsugi_harness-3.1.1/src/kintsugi_harness.egg-info/SOURCES.txt +92 -0
  85. kintsugi_harness-3.1.1/src/kintsugi_harness.egg-info/dependency_links.txt +1 -0
  86. kintsugi_harness-3.1.1/src/kintsugi_harness.egg-info/entry_points.txt +2 -0
  87. kintsugi_harness-3.1.1/src/kintsugi_harness.egg-info/requires.txt +7 -0
  88. kintsugi_harness-3.1.1/src/kintsugi_harness.egg-info/top_level.txt +1 -0
  89. kintsugi_harness-3.1.1/tests/test_cloud_sandbox_adversarial.py +2612 -0
  90. kintsugi_harness-3.1.1/tests/test_cloud_sandbox_self_update.py +730 -0
  91. kintsugi_harness-3.1.1/tests/test_fast_learner_teacher_gate.py +229 -0
  92. kintsugi_harness-3.1.1/tests/test_kintsugi.py +3788 -0
  93. kintsugi_harness-3.1.1/tests/test_v3_breakthrough_suite.py +914 -0
  94. kintsugi_harness-3.1.1/tests/test_v3_delivery_telemetry.py +1414 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Tu Nguyen (tunguyen1993)
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,349 @@
1
+ Metadata-Version: 2.4
2
+ Name: kintsugi-harness
3
+ Version: 3.1.1
4
+ Summary: Kintsugi Harness v3.1.1 — Zero-dependency Rust & Python security guardrails, 7-Domain Typed Obligation Prover, 80-Entry Low-Tier Pitfall Lexicon (LT-001..LT-080), 9 Signature-Guarded Capsules, Cloud Sandbox CLI, DeliveryTelemetry/1, MCP Server, and KMI/1 Compression (Apache-2.0).
5
+ Author: Tu Nguyen
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/tunguyen1993/kintsugi-harness
8
+ Project-URL: Repository, https://github.com/tunguyen1993/kintsugi-harness
9
+ Project-URL: Issues, https://github.com/tunguyen1993/kintsugi-harness/issues
10
+ Project-URL: Changelog, https://github.com/tunguyen1993/kintsugi-harness/blob/main/CHANGELOG.md
11
+ Keywords: ai-agents,codex,claude-code,mcp,agent-harness,agent-skills,guardrails,static-analysis,cursor-rules,sarif
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Software Development :: Quality Assurance
24
+ Classifier: Topic :: Security
25
+ Requires-Python: >=3.9
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=7.4; extra == "dev"
30
+ Requires-Dist: pytest-cov>=4.1; extra == "dev"
31
+ Provides-Extra: proof
32
+ Requires-Dist: z3-solver>=4.12.0; extra == "proof"
33
+ Dynamic: license-file
34
+
35
+ # Kintsugi Harness (`v3.1.1`)
36
+
37
+ [![CI](https://github.com/tunguyen1993/kintsugi-harness/actions/workflows/ci-and-arena-verification.yml/badge.svg)](https://github.com/tunguyen1993/kintsugi-harness/actions/workflows/ci-and-arena-verification.yml)
38
+ [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/tunguyen1993/kintsugi-harness/badge)](https://securityscorecards.dev/viewer/?uri=github.com/tunguyen1993/kintsugi-harness)
39
+ [![License: Apache-2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
40
+ [![Rust MSRV 1.75.0](https://img.shields.io/badge/Rust_MSRV-1.75.0-DEA584.svg)](Cargo.toml)
41
+ [![Python 3.9+](https://img.shields.io/badge/Python-3.9%2B_%28stdlib%29-3776AB.svg)](pyproject.toml)
42
+ [![Zero Dependencies](https://img.shields.io/badge/Dependencies-Zero-success.svg)](Cargo.toml)
43
+
44
+ **Zero-dependency Rust (`MSRV 1.75.0`) + Python (`3.9+` stdlib) pre-tool security guardrails, 7-domain typed obligation prover, MCP server, and standalone Cloud Sandbox CLI for AI coding agents.**
45
+
46
+ Designed for **OpenAI Codex CLI**, **Claude Code**, **Cursor**, **Windsurf**, **Cline**, and **Zed**.
47
+
48
+ ![Kintsugi Harness v3.1.1 Real Terminal Output](assets/demo-terminal.svg)
49
+
50
+ ---
51
+
52
+ ## 1. What Kintsugi Harness Is
53
+
54
+ Static rule files (`AGENTS.md`, `CLAUDE.md`, `.cursorrules`) are advisory prose: they consume thousands of tokens per turn and do not prevent an agent from issuing unsafe shell commands, SQL concatenations, path traversals, or broken cryptographic checks under pressure.
55
+
56
+ Kintsugi Harness replaces advisory-only prompts with deterministic, zero-dependency enforcement:
57
+
58
+ - **Native Rust Engine (`kintsugi-rs`, `std`-only, `MSRV 1.75.0`):** Sub-millisecond pre-tool security scanning (`~16.2 µs/call` across 36 built-in rules on Apple Silicon), staged git-diff hunk filtering, and fail-closed `PreToolUse` hook evaluation.
59
+ - **7-Domain Typed Obligation Prover:** Emits explicit 4-way static verdicts (`PROVEN` | `VIOLATED` | `UNKNOWN` | `UNSUPPORTED`) with `0` false `PROVEN` verdicts on the repository's negative test corpus.
60
+ - **Built-In MCP Server (`kintsugi mcp`):** Zero-dependency JSON-RPC 2.0 `stdio` server exposing static scanning, context-aware file reading, pitfall lexicon lookup, delivery telemetry, and context compaction over standard MCP.
61
+ - **Standalone Cloud Sandbox Edition (`cloud-sandbox/` · `v3.1.1`):** Pure Python `3.9+` stdlib CLI for ephemeral or restricted cloud coding sandboxes with pinned SHA-256 GitHub self-update, 2-process OS subprocess IPC Truth Gate, fail-closed AST+regex scanning, exact rational `Fraction` financial checks, and read-only transaction policy guards.
62
+ - **Domain-Partitioned `KMI/1` Context Compression:** Compiles verbose security rules into compact `<12`-token symbolic headers expanded Just-In-Time only when a rule fires.
63
+
64
+ ---
65
+
66
+ ## 2. Quick Start & OpenAI Codex CLI / MCP Integration
67
+
68
+ ### Install
69
+
70
+ #### Option A: Prebuilt Native Binary (Linux x86_64 / ARM64, macOS Apple Silicon — No Rust Required)
71
+
72
+ Every tagged release ships zero-dependency `kintsugi-rs` binaries (`~2.0 MiB`) with `SHA256SUMS.txt` and GitHub SLSA Build Provenance attestations:
73
+
74
+ ```bash
75
+ # Example for macOS Apple Silicon (replace target with x86_64-unknown-linux-gnu or aarch64-unknown-linux-gnu on Linux)
76
+ TAG="v3.1.1"
77
+ TARGET="aarch64-apple-darwin"
78
+ curl -fsSLO "https://github.com/tunguyen1993/kintsugi-harness/releases/download/${TAG}/kintsugi-rs-${TAG}-${TARGET}.tar.gz"
79
+ curl -fsSLO "https://github.com/tunguyen1993/kintsugi-harness/releases/download/${TAG}/SHA256SUMS.txt"
80
+ grep "kintsugi-rs-${TAG}-${TARGET}.tar.gz" SHA256SUMS.txt | shasum -a 256 -c -
81
+ tar -xzf "kintsugi-rs-${TAG}-${TARGET}.tar.gz" kintsugi-rs && ./kintsugi-rs --version
82
+ ```
83
+
84
+ #### Option B: Install Python CLI + MCP Server (and Optional Local Rust Build)
85
+
86
+ ```bash
87
+ git clone https://github.com/tunguyen1993/kintsugi-harness.git
88
+ cd kintsugi-harness
89
+ pip install -e .
90
+
91
+ # Optional: build the zero-dependency native Rust CLI (`kintsugi-rs`)
92
+ cargo build --release --all-features
93
+ ```
94
+
95
+ ### Core CLI Commands
96
+
97
+ ```bash
98
+ # Scan a repository or staged git diff (Python AST + regex scanner)
99
+ kintsugi scan . --staged --fail-on HIGH
100
+
101
+ # Run the native Rust 7-domain typed obligation prover
102
+ ./target/release/kintsugi-rs s3-audit src/ --strict-proven --format json
103
+
104
+ # Generate a bounded JIT context envelope + low-tier pitfall brief for a file
105
+ ./target/release/kintsugi-rs context src/app.py --low-tier --format json
106
+ ./target/release/kintsugi-rs lexicon src/App.tsx --format compact
107
+
108
+ # Compile compact KMI/1 governance files (AGENTS.md, CLAUDE.md, Cursor, Copilot, Windsurf)
109
+ kintsugi compile --targets all --compact
110
+ ```
111
+
112
+ ### OpenAI Codex CLI Integration (`~/.codex/config.toml`)
113
+
114
+ Register Kintsugi as a local `stdio` MCP server in `~/.codex/config.toml`:
115
+
116
+ ```toml
117
+ [mcp_servers.kintsugi]
118
+ command = "kintsugi"
119
+ args = ["mcp", "--profile", "v3", "--ledger", ".kintsugi/scars.json"]
120
+ ```
121
+
122
+ Verify the MCP server starts cleanly over stdio:
123
+
124
+ ```bash
125
+ kintsugi mcp --profile v3
126
+ ```
127
+
128
+ ### Claude Code, Cursor, Windsurf, Cline & Zed MCP Configuration
129
+
130
+ Add the following to `.mcp.json`, `.cursor/mcp.json`, or `claude_desktop_config.json`:
131
+
132
+ ```json
133
+ {
134
+ "mcpServers": {
135
+ "kintsugi-harness": {
136
+ "command": "kintsugi",
137
+ "args": ["mcp", "--profile", "v3", "--ledger", ".kintsugi/scars.json"]
138
+ }
139
+ }
140
+ }
141
+ ```
142
+
143
+ ### Claude Code `PreToolUse` Hook
144
+
145
+ Install hooks automatically (`kintsugi install-hooks --git`) or wire `kintsugi-rs` directly in `.claude/settings.json`:
146
+
147
+ ```json
148
+ {
149
+ "hooks": {
150
+ "PreToolUse": [
151
+ {
152
+ "matcher": "Write|Edit|MultiEdit|Bash",
153
+ "hooks": [
154
+ {
155
+ "type": "command",
156
+ "command": "kintsugi-rs hook claude-pre-tool --block-on HIGH"
157
+ }
158
+ ]
159
+ }
160
+ ]
161
+ }
162
+ }
163
+ ```
164
+
165
+ ### Key MCP Tools (`kintsugi mcp --profile v3`)
166
+
167
+ The MCP server exposes `9` core tools under the default profile and `26` tools under `--profile v3`, alongside `2` resources (`kintsugi://ledger/scars`, `kintsugi://posture/summary`) and `2` prompts (`kintsugi-audit-code`, `kintsugi-evolve-scar`):
168
+
169
+ | Tool | Purpose |
170
+ | :--- | :--- |
171
+ | `kintsugi_scan_code` | Deterministic AST + regex scan of inline code or file paths before writing/committing. |
172
+ | `kintsugi_read_with_context` | POSIX `dir_fd` (`O_NOFOLLOW`) bounded file read with CRLF-verbatim digest parity and JIT context injection. |
173
+ | `kintsugi_low_tier_lexicon` | Symbol-scoped lookup into the 80-entry pitfall lexicon (`LT-001..LT-080`). |
174
+ | `kintsugi_delivery_telemetry` | Record and query `DeliveryTelemetry/1` receipt stages and 2-strike auto-freeze state. |
175
+ | `kintsugi_list_scars` | List verified guardrails or emit a single domain-partitioned `KMI/1` shard. |
176
+ | `kintsugi_record_failure` | Compile a runtime/test failure into a self-verified guardrail (`scan(bad) >= 1`, `scan(good) == 0`). |
177
+ | `kintsugi_verify_logic` | Run deterministic SAT/Datalog/difference-logic and auth state-machine verification. |
178
+ | `kintsugi_integrate_harness` | Discover, quarantine, conflict-check, mount, or eject third-party agent rule files cleanly. |
179
+ | `kintsugi_compact_context` | Strip verbose logs and superseded file reads while preserving user intents and hard anchors. |
180
+
181
+ ### GitHub Actions Integration
182
+
183
+ Kintsugi ships a composite action ([`action.yml`](action.yml)) and can run directly in CI workflows:
184
+
185
+ ```yaml
186
+ - name: Run Kintsugi security scan
187
+ run: |
188
+ pip install -e .
189
+ kintsugi scan . --fail-on HIGH
190
+ ```
191
+
192
+ ---
193
+
194
+ ## 3. Zero-Dependency Cloud Sandbox Edition (`cloud-sandbox/` · `v3.1.1`)
195
+
196
+ For ephemeral or restricted cloud coding sandboxes with only Python `3.9+` stdlib (no Rust toolchain, no `pip` network access), `cloud-sandbox/` provides a self-contained, hardened edition:
197
+
198
+ - **Pinned SHA-256 GitHub Self-Updater (`bootstrap.py`):** Verifies explicit bootstrap and manifest digests (`--require-pin`, `--require-full-sha`, `--expected-bootstrap-sha256`, `--expected-manifest-sha256`), performs `dir_fd` (`O_NOFOLLOW`) safe extraction against symlink/path traversal, supports offline `.tar.gz`/`.zip` fallback (`--source-archive`), and runs a clean-environment boot smoke check before atomic directory swap.
199
+ - **2-Process OS Subprocess IPC Truth Gate:** Executes candidate tests in isolated Python and Node.js subprocesses communicating over OS IPC with runtime-counted assertions, verifying real `BROKEN -> FIXED` transitions rather than trusting self-reported model output.
200
+ - **Fail-Closed AST + Regex Security Scanner:** Multi-language scanner returning `INCOMPLETE_SCAN` fail-closed verdicts on parse errors, unreadable targets, symlink escapes, or oversized inputs.
201
+ - **Exact Rational `Fraction` Financial Verification:** Arbitrary-precision `fractions.Fraction` conservation, FX conversion, and tick-rounding checks eliminating IEEE-754 floating-point drift.
202
+ - **Read-Only Transaction Policy Guard (`tx-guard`):** Pre-flight policy gate rejecting unauthorized outbound value transfers, token approvals, or advance-deposit requirements.
203
+ - **5-Gate Closed-Loop Scar Evolution:** Candidate synthesis -> 2-process IPC Truth Gate -> matcher-on-broken validation -> canary regression replay -> SHA-256 attested patch export/import.
204
+
205
+ ```bash
206
+ # Pinned SHA-256 install in a restricted cloud sandbox (replace placeholders with release digests):
207
+ curl -fsSL "https://raw.githubusercontent.com/tunguyen1993/kintsugi-harness/<40-hex-commit-sha>/cloud-sandbox/bootstrap.py" -o /tmp/k_boot.py \
208
+ && python3 /tmp/k_boot.py \
209
+ --ref "<40-hex-commit-sha>" \
210
+ --require-pin \
211
+ --require-full-sha \
212
+ --expected-bootstrap-sha256 "<64-hex-bootstrap-sha256>" \
213
+ --expected-manifest-sha256 "<64-hex-manifest-sha256>" \
214
+ --dest /tmp/kintsugi_sandbox
215
+ ```
216
+
217
+ See [`cloud-sandbox/README.md`](cloud-sandbox/README.md), [`cloud-sandbox/TASKS.md`](cloud-sandbox/TASKS.md), and [`cloud-sandbox/AGENT_INSTRUCTIONS.md`](cloud-sandbox/AGENT_INSTRUCTIONS.md) for the full sandbox CLI reference (`boot`, `self-test`, `brief`, `scan`, `tx-guard`, `truth-gate`, `ledger-check`, `verify-delivery`, `audit-deliverable`, and `evolve`).
218
+
219
+ ---
220
+
221
+ ## 4. Architecture & Security Guarantees
222
+
223
+ ```mermaid
224
+ flowchart LR
225
+ A["Agent Turn\n(KMI/1 Domain Shard: ~80.5 tok)"] --> B["Tool Call\n(Read / Write / Edit / Bash)"]
226
+ B --> C{"Rust / Python Guardrail\n(7-Domain Prover + AST/Regex)"}
227
+ C -- "PROVEN / Clean" --> D["Execute Tool\n(0 extra tokens)"]
228
+ C -- "VIOLATED / UNKNOWN" --> E["JIT Rule & Lexicon Expansion\n(Bounded ContextEnvelope/3)"]
229
+ E --> F["DeliveryTelemetry/1\n(2-Strike Auto-Freeze)"]
230
+ ```
231
+
232
+ ### 7-Domain Typed Obligation Prover (`rust/src/audit/{obligation_prover,prover_extensions}.rs`)
233
+
234
+ Every obligation is evaluated to one of four explicit verdicts—`PROVEN`, `VIOLATED`, `UNKNOWN`, or `UNSUPPORTED`—backed by a UTF-8 byte-aligned `StatefulMasker` and fail-closed `NO_INPUT` handling for missing, unreadable, symlink, or empty targets (`0` false `PROVEN` verdicts on the repository's negative test corpus):
235
+
236
+ | Domain | Languages | Obligation Verified |
237
+ | :--- | :--- | :--- |
238
+ | `CMD_EXEC` | Python, TS/JS | Rejects shell execution (`shell=True`, dynamic `shell=` expressions, shell trampolines like `sh -c`, opaque options objects). |
239
+ | `SQL_EXEC` | Python, TS/JS | Requires parameterized queries; rejects string formatting/concatenation into SQL execution sinks. |
240
+ | `PATH_CONFINE` | Python, TS/JS, Rust | Requires canonical path containment against traversal outside an allowed root before filesystem reads/writes. |
241
+ | `CRYPTO_MAC_BIDI` | Python, TS/JS | Enforces constant-time MAC comparisons and rejects Trojan Source bidirectional Unicode overrides. |
242
+ | `TSX_XSS` | React `.tsx`/`.jsx` | Flags unsafe HTML injection (`dangerouslySetInnerHTML`, unsanitized `javascript:` URLs). |
243
+ | `SOL_REENTRANCY_CEI` | Solidity `.sol` | Checks Checks-Effects-Interactions ordering and reentrancy guards around external calls. |
244
+ | `SOL_SAFE_ERC20` | Solidity `.sol` | Requires exact `SafeERC20.sol` import, scoped `using SafeERC20 for <ERC20Type>`, and verified receiver typing. |
245
+
246
+ ### 80-Entry Low-Tier Model Pitfall Lexicon (`LT-001..LT-080`)
247
+
248
+ Located in [`rust/src/audit/low_tier_lexicon.rs`](rust/src/audit/low_tier_lexicon.rs), the lexicon maps symbol-scoped, recurring coding-agent failure modes across Python, OWASP Security, TypeScript/React/Next/Vue, MySQL, Solidity `0.8.24`/DeFi, Go, Rust, Docker, and GitHub Actions. Entries are injected Just-In-Time only when matching symbols/imports appear (`0` matches / `0` tokens on the repository's benign fixture corpus).
249
+
250
+ ### 9 Signature-Guarded Invariant Capsules (`rust/src/audit/capsules.rs`)
251
+
252
+ High-impact security and financial invariants (including ERC-4626 share bounds, replay-safe signature verification, and atomic locking) are packaged as signature-guarded capsules so injected reminders respect target function signatures (for example, never instructing a `-> bool` verifier to raise exceptions).
253
+
254
+ ### Delivery Telemetry (`DeliveryTelemetry/1`)
255
+
256
+ Implemented with cross-runtime Rust and Python parity ([`rust/src/audit/delivery_telemetry.rs`](rust/src/audit/delivery_telemetry.rs), [`src/kintsugi/evolution/delivery_telemetry.py`](src/kintsugi/evolution/delivery_telemetry.py)):
257
+
258
+ - Tracks 3 distinct receipt stages: `issued -> included_in_input -> patch_bound`.
259
+ - Protects efficacy accounting so unshown capsules (`included_before_first_patch == false`) never pollute metrics.
260
+ - Enforces cross-process file locking (`0600`) and **2-Strike Auto-Freeze**: if a capsule or lexicon entry correlates with repeated failing patches, it is automatically frozen out of subsequent `ContextEnvelope/3` rankings.
261
+
262
+ ### Domain-Partitioned `KMI/1` Context Compression (`src/kintsugi/compressor.py`)
263
+
264
+ Rules are partitioned across 6 engineering domains (`security`, `backend`, `database`, `frontend`, `devops`, `ai_mcp`) in [`docs/domains/`](docs/domains/). Measured with the deterministic `estimate_tokens` estimator:
265
+
266
+ - **16-Rule Starter Pack (`--starter-only`):** `3,641` verbose Markdown tokens -> `226` global `KMI/1` tokens (`93.8%` reduction) or `~80.5` tokens/turn per domain shard (`97.79%` reduction).
267
+ - **Full Evolved Ledger (`.kintsugi/scars.json`):** `414,267` verbose tokens -> `~175.7` tokens/turn per domain shard (`99.96%` reduction).
268
+
269
+ ---
270
+
271
+ ## 5. Reproducible Benchmarks & Verification
272
+
273
+ All benchmark scripts and measured outputs are committed in [`benchmarks/`](benchmarks/) with pinned commit SHAs and explicit scoping caveats.
274
+
275
+ ### Real-World OSS Head-to-Head Benchmark ([`benchmarks/real_world_oss_benchmark_v3.json`](benchmarks/real_world_oss_benchmark_v3.json))
276
+
277
+ Measured end-to-end subprocess wall-clock latency (median of 5 runs after 1 warmup) and child Peak RSS (`os.wait4`) on Apple Silicon (`arm64`, macOS) comparing **`kintsugi-rs 3.1.1`** (`2.02 MiB` static binary, `0` runtime deps) against **`ruff 0.17.6`** (`21.22 MiB`, `--select S --no-cache`) and **`bandit 1.9.4`** (`52.77 MiB` venv, `-r -q -ll`):
278
+
279
+ | Target Repo (Pinned Commit) | Files / LOC | `kintsugi-rs scan` (`HIGH+`) | `kintsugi-rs s3-audit` | `ruff --select S` | `bandit -ll` | Speedup vs Bandit |
280
+ | :--- | :---: | :---: | :---: | :---: | :---: | :---: |
281
+ | **`psf/requests`** (`src/requests`, `3c7baaa0`) | 19 `.py` / 6.4k | **27.9 ms** · 4.5 MiB · `0` hits | **31.4 ms** · `PASS_S3_LOCKED` (1/1 PROVEN) | 13.1 ms · 29.8 MiB · `16` hits (`16` `S101`) | 291.3 ms · 39.4 MiB · `0` hits | **10.5×** |
282
+ | **`pallets/flask`** (`src/flask`, `49943b5a`) | 24 `.py` / 9.6k | **54.9 ms** · 4.7 MiB · `3` hits | **39.6 ms** · 11 seams | 12.6 ms · 29.4 MiB · `10` hits (`5` non-`S101`) | 332.1 ms · 40.7 MiB · `4` hits | **6.1×** |
283
+ | **`tiangolo/fastapi`** (`fastapi/`, `05e6df7e`) | 54 `.py` / 23.8k | **183.2 ms** · 6.3 MiB · `0` hits | **110.2 ms** · `PASS_S3_LOCKED` | 16.2 ms · 35.3 MiB · `71` hits (`71` `S101`) | 742.3 ms · 56.3 MiB · `0` hits | **4.1×** |
284
+ | **`tiangolo/fastapi`** (full repo, `05e6df7e`) | 1,233 `.py` / 136k | **232.2 ms** · **9.5 MiB** · `3` hits (docs JS only; `0` Py FPs) | 1,387.8 ms · 59 seams | 49.8 ms · 57.7 MiB · `7,445` hits (`7,341` `S101`) | 4,751.2 ms · 75.3 MiB · `3` hits | **20.5×** |
285
+ | **`adeyosemanputra/pygoat`** (OWASP vuln app, `2aa4cc14`) | 116 `.py` / 8.1k | **13.7 ms** · **5.0 MiB** · **`20` real vulns** (`KS-002/003/007/020/S3-01`) | **86.7 ms** · `FAIL_S0_EXPOSED` (6 unguarded) | 16.6 ms · 28.3 MiB · `100` hits | 429.3 ms · 39.0 MiB · `55` hits | **31.5×** |
286
+
287
+ - **Footprint & RAM:** `kintsugi-rs` is **`10.5×` smaller** on disk than `ruff` (`2.02 MiB` vs `21.22 MiB`) and uses **`5.7×–7.9×` less Peak RSS** than `ruff`/`bandit` (`4.5–9.5 MiB` vs `28–75 MiB`).
288
+ - **AI-Agent Threat Coverage:** On OWASP PyGoat, `kintsugi-rs` catches classic OWASP sinks (`subprocess(..., shell=True)`, `eval`/`pickle.loads`, SQLi f-strings, `yaml.load`, weak `random.randint` OTP) **plus** `KS-S3-01` stealth prompt-injection instructions in repository docs (`dependency_attack_lab/README.md`) and Trojan Source Bidi overrides—classes outside Python-only AST linters.
289
+ - *Scope note:* `ruff --select S` covers Python flake8-bandit rules (including `S101` `assert` checks) and is fastest on huge pure-Python trees (`49.8 ms` on 1,233 files); `kintsugi-rs` adds multi-language pre-tool hook enforcement (`8.14 µs/scan` avg), prompt-injection/Bidi detection, and the 7-domain `s3-audit` obligation prover in one zero-dependency binary.
290
+
291
+ Reproduce this exact benchmark locally:
292
+
293
+ ```bash
294
+ python3 benchmarks/real_world_oss_benchmark.py --clone --bench-dir /tmp/kintsugi_real_bench --out /tmp/real_bench.json
295
+ ```
296
+
297
+ ### Additional Verification Suites
298
+
299
+ - **Low-Tier Pitfall Lexicon Blind A/B Evaluation ([`benchmarks/low_tier_lexicon_ab_results_v3.json`](benchmarks/low_tier_lexicon_ab_results_v3.json)):**
300
+ - *Scope:* Synthetic/held-out blind zero-hint evaluation suite testing recurring budget-LLM failure modes (not an official SWE-bench leaderboard submission).
301
+ - *4-Round Aggregate (`56` tasks × `3` models = `168` runs across `HeldOut12`, `HardCrucible16`, `DualStack16`, `OnlineOpsScars12`):* Baseline `83/168` (`49.4%`) -> With Lexicon `161/168` (`95.8%`, `+46.4 pp`).
302
+ - *Round 5 (`PolyglotInfra7`, reported separately):* `7` Go/Docker/GitHub Actions tasks improved from `0/7` (`0.0%`) to `6/7` (`85.7%`, `+85.7 pp`).
303
+ - *Zero-bloat check:* `0` matches / `0` tokens verified on the repository benign fixture corpus (Python, TypeScript, Rust, Go).
304
+ - **10-Arena Local Verification Suite ([`benchmarks/verified_10_arena_pareto_certificate.json`](benchmarks/verified_10_arena_pareto_certificate.json)):**
305
+ - Reproducible local regression suite verifying `10/10` arenas (`98.28` average score).
306
+
307
+ ### Run Verification Locally
308
+
309
+ ```bash
310
+ # 1. Full Python test suite (optional Z3 proof extra: pip install -e ".[proof]")
311
+ PYTHONPATH=src:tests pytest -q
312
+
313
+ # 2. Full Rust test suite across all targets + native release benchmark
314
+ cargo test --all-targets
315
+ cargo build --release --bins
316
+ ./target/release/kintsugi-rs bench
317
+
318
+ # 3. Deterministic KMI/1 token compression report
319
+ PYTHONPATH=src python3 -m kintsugi.cli token-report --starter-only
320
+
321
+ # 4. 10-Arena local verification suite
322
+ python3 benchmarks/run_verifiable_arena_cert_suite.py --verify
323
+ ```
324
+
325
+ ---
326
+
327
+ ## 6. BYOK Multi-Model Review (100% Apache-2.0, Optional)
328
+
329
+ Kintsugi Harness is **100% Apache-2.0 open source** and runs completely **offline with zero API keys** for all static analysis, obligation proving, MCP server tools, `PreToolUse` hooks, and Cloud Sandbox workflows.
330
+
331
+ If you optionally want multi-model second-opinion code review (`kintsugi swarm`), Kintsugi supports **Bring Your Own Key (BYOK)** using standard official provider API keys:
332
+
333
+ - `OPENAI_API_KEY`
334
+ - `ANTHROPIC_API_KEY`
335
+ - `GEMINI_API_KEY`
336
+ - `DEEPSEEK_API_KEY`
337
+
338
+ User-supplied keys are stored strictly locally (e.g., `.kintsugi/paid_council_pool.json` with `0600` file permissions) and never sent to third-party proxies or external relays.
339
+
340
+ ---
341
+
342
+ ## 7. Security, Contributing & License
343
+
344
+ - **Security Policy:** [`SECURITY.md`](SECURITY.md) — Vulnerability disclosure and supported versions
345
+ - **Contributing Guide:** [`CONTRIBUTING.md`](CONTRIBUTING.md) — Adding guardrails, running tests, and PR guidelines
346
+ - **Code of Conduct:** [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md)
347
+ - **Changelog:** [`CHANGELOG.md`](CHANGELOG.md)
348
+ - **License:** [Apache License 2.0 (`Apache-2.0`)](LICENSE)
349
+ - **Maintainer:** Tu Nguyen ([`@tunguyen1993`](https://github.com/tunguyen1993))