treering 0.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. treering-0.0.2/.claude-plugin/marketplace.json +14 -0
  2. treering-0.0.2/.claude-plugin/plugin.json +10 -0
  3. treering-0.0.2/.github/workflows/ci.yml +24 -0
  4. treering-0.0.2/.github/workflows/docs.yml +40 -0
  5. treering-0.0.2/.github/workflows/release.yml +22 -0
  6. treering-0.0.2/.gitignore +15 -0
  7. treering-0.0.2/CITATION.cff +63 -0
  8. treering-0.0.2/CONTRIBUTING.md +26 -0
  9. treering-0.0.2/LICENSE +201 -0
  10. treering-0.0.2/PKG-INFO +565 -0
  11. treering-0.0.2/README.md +536 -0
  12. treering-0.0.2/SECURITY.md +19 -0
  13. treering-0.0.2/docs/concepts.md +82 -0
  14. treering-0.0.2/docs/faq.md +50 -0
  15. treering-0.0.2/docs/index.md +60 -0
  16. treering-0.0.2/docs/ko.md +66 -0
  17. treering-0.0.2/docs/manifest.md +82 -0
  18. treering-0.0.2/docs/media/demo.tape +19 -0
  19. treering-0.0.2/docs/media/hook.gif +0 -0
  20. treering-0.0.2/docs/media/hook.tape +23 -0
  21. treering-0.0.2/docs/principles.md +40 -0
  22. treering-0.0.2/docs/related-work.md +37 -0
  23. treering-0.0.2/docs/roadmap.md +50 -0
  24. treering-0.0.2/docs/robots.txt +3 -0
  25. treering-0.0.2/docs/threat-model.md +32 -0
  26. treering-0.0.2/examples/meeting_notes.yaml +11 -0
  27. treering-0.0.2/hooks/hooks.json +29 -0
  28. treering-0.0.2/hooks/treering-hook.sh +9 -0
  29. treering-0.0.2/integrations/opencode/treering.ts +49 -0
  30. treering-0.0.2/llms.txt +34 -0
  31. treering-0.0.2/mkdocs.yml +73 -0
  32. treering-0.0.2/pyproject.toml +68 -0
  33. treering-0.0.2/src/treering/__init__.py +30 -0
  34. treering-0.0.2/src/treering/cli.py +264 -0
  35. treering-0.0.2/src/treering/demo.py +168 -0
  36. treering-0.0.2/src/treering/hook.py +154 -0
  37. treering-0.0.2/src/treering/hookdemo.py +87 -0
  38. treering-0.0.2/src/treering/init.py +230 -0
  39. treering-0.0.2/src/treering/manifest.py +143 -0
  40. treering-0.0.2/src/treering/opencode_plugin.ts +52 -0
  41. treering-0.0.2/src/treering/policy.py +314 -0
  42. treering-0.0.2/src/treering/provenance.py +44 -0
  43. treering-0.0.2/src/treering/py.typed +0 -0
  44. treering-0.0.2/src/treering/report.py +88 -0
  45. treering-0.0.2/src/treering/ringlog.py +237 -0
  46. treering-0.0.2/src/treering/runtime.py +270 -0
  47. treering-0.0.2/src/treering/schemas.py +31 -0
  48. treering-0.0.2/src/treering/timeline.py +63 -0
  49. treering-0.0.2/tests/__init__.py +0 -0
  50. treering-0.0.2/tests/test_hook.py +89 -0
  51. treering-0.0.2/tests/test_hookdemo.py +21 -0
  52. treering-0.0.2/tests/test_init.py +176 -0
  53. treering-0.0.2/tests/test_log_cli.py +79 -0
  54. treering-0.0.2/tests/test_manifest.py +76 -0
  55. treering-0.0.2/tests/test_policy.py +206 -0
  56. treering-0.0.2/tests/test_report.py +69 -0
  57. treering-0.0.2/tests/test_ringlog.py +43 -0
  58. treering-0.0.2/tests/test_runtime.py +115 -0
  59. treering-0.0.2/tests/test_seal_anchor.py +187 -0
  60. treering-0.0.2/tests/test_usability.py +54 -0
  61. treering-0.0.2/uv.lock +831 -0
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "jiwoomap-treering",
3
+ "owner": { "name": "jiwoomap" },
4
+ "metadata": {
5
+ "description": "TreeRing: a tamper-evident record of what your coding agent did."
6
+ },
7
+ "plugins": [
8
+ {
9
+ "name": "treering",
10
+ "source": "./",
11
+ "description": "Record every tool call in a tamper-evident log and read back what the agent did."
12
+ }
13
+ ]
14
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "treering",
3
+ "version": "0.0.2",
4
+ "description": "Reverse-engineer what your coding agent did: every tool call becomes a ring in a tamper-evident log, and `treering report` reads it back.",
5
+ "author": { "name": "jiwoomap", "url": "https://github.com/jiwoomap" },
6
+ "homepage": "https://github.com/jiwoomap/treering",
7
+ "repository": "https://github.com/jiwoomap/treering",
8
+ "license": "Apache-2.0",
9
+ "keywords": ["audit", "security", "observability", "hooks"]
10
+ }
@@ -0,0 +1,24 @@
1
+ name: ci
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ python: ["3.11", "3.12"]
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: astral-sh/setup-uv@v5
17
+ with:
18
+ python-version: ${{ matrix.python }}
19
+ - run: uv sync
20
+ - run: uv run ruff check .
21
+ - run: uv run ruff format --check .
22
+ - run: uv run pytest -q
23
+ - run: uv run treering validate examples/meeting_notes.yaml
24
+ - run: uv run treering demo
@@ -0,0 +1,40 @@
1
+ name: docs
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ paths: ["docs/**", "mkdocs.yml", "uv.lock", ".github/workflows/docs.yml"]
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+ pages: write
12
+ id-token: write
13
+
14
+ concurrency:
15
+ group: pages
16
+ cancel-in-progress: true
17
+
18
+ jobs:
19
+ build:
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ - uses: astral-sh/setup-uv@v5
24
+ with:
25
+ python-version: "3.12"
26
+ - run: uv sync --group docs
27
+ - run: uv run mkdocs build --strict
28
+ - uses: actions/upload-pages-artifact@v3
29
+ with:
30
+ path: site
31
+
32
+ deploy:
33
+ needs: build
34
+ runs-on: ubuntu-latest
35
+ environment:
36
+ name: github-pages
37
+ url: ${{ steps.deployment.outputs.page_url }}
38
+ steps:
39
+ - id: deployment
40
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,22 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ pypi:
12
+ runs-on: ubuntu-latest
13
+ environment: pypi
14
+ permissions:
15
+ id-token: write
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: astral-sh/setup-uv@v5
19
+ - run: uv sync
20
+ - run: uv run pytest -q
21
+ - run: uv build
22
+ - run: uv publish
@@ -0,0 +1,15 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ .idea/
5
+ .DS_Store
6
+ dist/
7
+ *.egg-info/
8
+ .pytest_cache/
9
+ site/
10
+
11
+ # local ring logs
12
+ rings.jsonl
13
+ *.jsonl.key
14
+ *.jsonl.key.tmp
15
+ anchors.jsonl
@@ -0,0 +1,63 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use TreeRing, please cite it as below."
3
+ type: software
4
+ title: "TreeRing: least-knowledge security layer for LLM agents"
5
+ abstract: >-
6
+ TreeRing is an open-source security layer for LLM agents that defends against
7
+ prompt injection by isolation rather than detection. A privileged planner never
8
+ sees untrusted data, quarantined readers have no tools, values between modules
9
+ are restricted to declared schemas and carry provenance tags, and every decision
10
+ is appended to a tamper-evident hash-chained audit log with human-in-the-loop
11
+ approval where policy requires it. The design is inspired by tree rings
12
+ (dendrochronology), which record each year's conditions as a by-product of growth.
13
+ authors:
14
+ - name: "jiwoomap"
15
+ email: "jiwoomap@gmail.com"
16
+ version: 0.0.2
17
+ date-released: 2026-09-30
18
+ license: Apache-2.0
19
+ repository-code: "https://github.com/jiwoomap/treering"
20
+ url: "https://github.com/jiwoomap/treering"
21
+ keywords:
22
+ - AI agent security
23
+ - LLM security
24
+ - prompt injection
25
+ - information flow control
26
+ - capability-based security
27
+ - least privilege
28
+ - provenance
29
+ - audit log
30
+ - tamper-evident log
31
+ - human-in-the-loop
32
+ - AI safety
33
+ - AI governance
34
+ - Model Context Protocol
35
+ references:
36
+ - type: article
37
+ title: "Defeating Prompt Injections by Design (CaMeL)"
38
+ authors:
39
+ - family-names: Debenedetti
40
+ given-names: Edoardo
41
+ year: 2025
42
+ url: "https://arxiv.org/abs/2503.18813"
43
+ - type: article
44
+ title: "Progent: Securing AI Agents with Privilege Control"
45
+ authors:
46
+ - family-names: Shi
47
+ given-names: Tianneng
48
+ year: 2025
49
+ url: "https://arxiv.org/abs/2504.11703"
50
+ - type: article
51
+ title: "AI Control: Improving Safety Despite Intentional Subversion"
52
+ authors:
53
+ - family-names: Greenblatt
54
+ given-names: Ryan
55
+ year: 2024
56
+ url: "https://arxiv.org/abs/2312.06942"
57
+ - type: article
58
+ title: "Chain of Thought Monitorability: A New and Fragile Opportunity for AI Safety"
59
+ authors:
60
+ - family-names: Korbak
61
+ given-names: Tomek
62
+ year: 2025
63
+ url: "https://arxiv.org/abs/2507.11473"
@@ -0,0 +1,26 @@
1
+ # Contributing
2
+
3
+ Thanks for taking a look. TreeRing is early; the most valuable contributions right now are:
4
+
5
+ - **Attacks.** A manifest + fake extractor that gets untrusted data into the privileged module, or an action past the provenance check, is worth more than a feature. Open it as an issue with a failing test.
6
+ - **LLM adapters** for the `Planner` and `Extractor` protocols (OpenAI, Anthropic, local models via structured output).
7
+ - **Schemas** for common quarantined outputs beyond `EmailSummary`.
8
+ - **Docs and translations.**
9
+
10
+ ## Setup
11
+
12
+ ```sh
13
+ uv sync
14
+ uv run pytest
15
+ uv run ruff check . && uv run ruff format --check .
16
+ uv run treering demo
17
+ ```
18
+
19
+ ## Rules of the road
20
+
21
+ - Every security-relevant change needs a test that fails without it.
22
+ - No LLM in the enforcement path. LLMs propose; code decides.
23
+ - Keep the ring log single-writer. Modules never write their own entries.
24
+ - Public APIs get a docstring; everything else should read without comments.
25
+
26
+ By contributing you agree your work is licensed under Apache-2.0.
treering-0.0.2/LICENSE ADDED
@@ -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 a 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 jiwoomap
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.