hermes-tenuo 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. hermes_tenuo-0.1.0/LICENSE +201 -0
  2. hermes_tenuo-0.1.0/PKG-INFO +367 -0
  3. hermes_tenuo-0.1.0/README.md +336 -0
  4. hermes_tenuo-0.1.0/hermes_tenuo/__init__.py +186 -0
  5. hermes_tenuo-0.1.0/hermes_tenuo/_config.py +193 -0
  6. hermes_tenuo-0.1.0/hermes_tenuo/_guard.py +184 -0
  7. hermes_tenuo-0.1.0/hermes_tenuo/_home.py +68 -0
  8. hermes_tenuo-0.1.0/hermes_tenuo/audit.py +115 -0
  9. hermes_tenuo-0.1.0/hermes_tenuo/cli.py +566 -0
  10. hermes_tenuo-0.1.0/hermes_tenuo/demo.py +233 -0
  11. hermes_tenuo-0.1.0/hermes_tenuo/hermes_guard.py +711 -0
  12. hermes_tenuo-0.1.0/hermes_tenuo/kanban.py +172 -0
  13. hermes_tenuo-0.1.0/hermes_tenuo/skills/tenuo-scope/SKILL.md +237 -0
  14. hermes_tenuo-0.1.0/hermes_tenuo.egg-info/PKG-INFO +367 -0
  15. hermes_tenuo-0.1.0/hermes_tenuo.egg-info/SOURCES.txt +29 -0
  16. hermes_tenuo-0.1.0/hermes_tenuo.egg-info/dependency_links.txt +1 -0
  17. hermes_tenuo-0.1.0/hermes_tenuo.egg-info/entry_points.txt +5 -0
  18. hermes_tenuo-0.1.0/hermes_tenuo.egg-info/requires.txt +6 -0
  19. hermes_tenuo-0.1.0/hermes_tenuo.egg-info/top_level.txt +1 -0
  20. hermes_tenuo-0.1.0/pyproject.toml +66 -0
  21. hermes_tenuo-0.1.0/setup.cfg +4 -0
  22. hermes_tenuo-0.1.0/tests/test_audit.py +143 -0
  23. hermes_tenuo-0.1.0/tests/test_cli.py +215 -0
  24. hermes_tenuo-0.1.0/tests/test_config.py +306 -0
  25. hermes_tenuo-0.1.0/tests/test_demo.py +40 -0
  26. hermes_tenuo-0.1.0/tests/test_directory_plugin.py +57 -0
  27. hermes_tenuo-0.1.0/tests/test_hermes.py +546 -0
  28. hermes_tenuo-0.1.0/tests/test_home.py +133 -0
  29. hermes_tenuo-0.1.0/tests/test_integration_smoke.py +679 -0
  30. hermes_tenuo-0.1.0/tests/test_public_surface.py +70 -0
  31. hermes_tenuo-0.1.0/tests/test_security_invariants.py +558 -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 Tenuo AI
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,367 @@
1
+ Metadata-Version: 2.4
2
+ Name: hermes-tenuo
3
+ Version: 0.1.0
4
+ Summary: Tenuo authorization plugin for Hermes Agent
5
+ Author: Tenuo AI
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/tenuo-ai/hermes-tenuo
8
+ Project-URL: Documentation, https://github.com/tenuo-ai/hermes-tenuo#readme
9
+ Project-URL: Repository, https://github.com/tenuo-ai/hermes-tenuo
10
+ Project-URL: Issues, https://github.com/tenuo-ai/hermes-tenuo/issues
11
+ Keywords: hermes,authorization,agents,security,warrants,tenuo
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Security
21
+ Classifier: Topic :: Software Development :: Libraries
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: tenuo>=0.3.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest>=7.0; extra == "dev"
28
+ Requires-Dist: pytest-asyncio; extra == "dev"
29
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ # hermes-tenuo
33
+
34
+ [![CI](https://github.com/tenuo-ai/hermes-tenuo/actions/workflows/ci.yml/badge.svg)](https://github.com/tenuo-ai/hermes-tenuo/actions/workflows/ci.yml)
35
+
36
+ **Give each Hermes agent a signed, expiring permission slip. Nothing outside it runs.**
37
+
38
+ A [Tenuo](https://github.com/tenuo-ai/tenuo) warrant sits in front of every
39
+ Hermes tool call. Each call is checked at the argument level before the
40
+ handler runs. A `delegate_task` child is a grant from the parent warrant,
41
+ verified as a chain. Gateway users each carry their own warrant. Keys,
42
+ warrants, and decisions stay local.
43
+
44
+ See it without installing Hermes or talking to a model:
45
+
46
+ ```bash
47
+ pip install "git+https://github.com/tenuo-ai/hermes-tenuo.git"
48
+ hermes-tenuo demo
49
+ ```
50
+
51
+ ```text
52
+ Give each Hermes agent a signed, expiring permission slip.
53
+ Nothing outside it runs. No Hermes process, no API key.
54
+
55
+ == Cron ==
56
+ Nightly job: read /data/reports, write /tmp/nightly, then stop.
57
+ ALLOW read_file path=/data/reports/q3.csv
58
+ ALLOW write_file path=/tmp/nightly/report.md
59
+ DENY read_file path=/etc/passwd
60
+ Constraint 'path' not satisfied: value does not match constraint
61
+ DENY terminal command=ls
62
+ Tool 'terminal' is not authorized
63
+
64
+ == delegate_task ==
65
+ Orchestrator grants web_search to the researcher. The chain is verified.
66
+ [orchestrator] ALLOW read_file path=/data/input.csv
67
+ [orchestrator] ALLOW delegate_task task=research q3 context=web_search only
68
+ [researcher] ALLOW web_search query=AI papers 2026
69
+ [researcher] DENY write_file path=/data/output/x.md
70
+ Tool 'write_file' is not authorized
71
+
72
+ == Gateway ==
73
+ Analyst and viewer on the same server, different warrants.
74
+ [analyst] ALLOW read_file path=/data/reports/q1.csv
75
+ [analyst] DENY write_file path=/data/output/x.txt
76
+ Tool 'write_file' is not authorized
77
+ [viewer] ALLOW read_file path=/data/public/faq.md
78
+ [viewer] DENY read_file path=/data/reports/q1.csv
79
+ Constraint 'path' not satisfied: value does not match constraint
80
+ ```
81
+
82
+ That `DENY` line is the tool result Hermes gives the model. The handler
83
+ never runs:
84
+
85
+ ```text
86
+ read_file path=/etc/passwd
87
+ Constraint 'path' not satisfied: value does not match constraint
88
+ ```
89
+
90
+ ## Install into Hermes
91
+
92
+ **1. Install.**
93
+
94
+ ```bash
95
+ # into the venv Hermes uses (pulls in tenuo):
96
+ pip install "git+https://github.com/tenuo-ai/hermes-tenuo.git"
97
+
98
+ # or as a directory plugin under ~/.hermes/plugins:
99
+ hermes plugins install tenuo-ai/hermes-tenuo
100
+ pip install "tenuo>=0.3.0" # Hermes does not install plugin dependencies
101
+ ```
102
+
103
+ Requires Hermes Agent 0.20 or newer (tested against upstream, September 2026).
104
+ The pip route installs `tenuo>=0.3.0` for you; the directory route needs the
105
+ extra `pip install` line above.
106
+
107
+ **2. Mint a warrant.** This generates a key pair and a warrant, and prints
108
+ the exact config block to paste.
109
+
110
+ ```bash
111
+ hermes-tenuo mint --ttl 1h \
112
+ --allow read_file:path=/data \
113
+ --allow web_search
114
+ ```
115
+
116
+ ```yaml
117
+ # ~/.hermes/config.yaml (printed by the command above)
118
+ plugins:
119
+ enabled:
120
+ - hermes-tenuo
121
+ entries:
122
+ hermes-tenuo:
123
+ warrant: <base64> # or a path to a .warrant file
124
+ trusted_root: <base64> # the public key that signed it
125
+ signing_key_env: TENUO_SIGNING_KEY
126
+ ```
127
+
128
+ ```bash
129
+ export TENUO_SIGNING_KEY=<printed by mint>
130
+ ```
131
+
132
+ **3. Check the wiring, then run Hermes.**
133
+
134
+ ```bash
135
+ hermes-tenuo doctor
136
+ hermes
137
+ ```
138
+
139
+ Ask the agent to read `/etc/passwd`. It gets the same denial as the tool
140
+ result. Load `skill_view("hermes-tenuo:tenuo-scope")` to mint a warrant
141
+ for a cron job, a `delegate_task` child, or a gateway session.
142
+
143
+ ## Scoping arguments
144
+
145
+ Each `--allow` names a tool and, optionally, constraints on its arguments.
146
+ A tool with no constraints is allowed with any arguments.
147
+
148
+ | Syntax | Meaning | Example |
149
+ |---|---|---|
150
+ | `tool` | any arguments | `--allow web_search` |
151
+ | `tool:arg=/path` | argument must be that path or under it (traversal-safe) | `--allow read_file:path=/data` |
152
+ | `tool:arg=glob*` | argument must match the glob | `--allow web_search:query=acme*` |
153
+ | `tool:arg=a\|b\|c` | argument must be one of the choices | `--allow git:action=status\|diff\|log` |
154
+ | `tool:arg=value` | argument must match exactly | `--allow write_file:mode=w` |
155
+ | `tool:arg=*` | that argument may be anything | `--allow memory:action=*` |
156
+ | `tool:a=..,b=..` | several constraints on one tool | `--allow write_file:path=/tmp/out,mode=w` |
157
+
158
+ Any argument the warrant does not name is unconstrained for that tool. The
159
+ `--ttl` flag takes `30m`, `1h`, `7d`, and so on (default `24h`).
160
+
161
+ For anything the flag syntax cannot express, mint in Python with the full
162
+ constraint set (numeric ranges, case-insensitive paths, and more):
163
+
164
+ ```python
165
+ import base64, os
166
+ from tenuo import SigningKey, Warrant, Subpath, Pattern, Range
167
+
168
+ control_key = SigningKey.generate() # keep private; its public key is trusted_root
169
+ agent_key = SigningKey.generate() # export its secret as TENUO_SIGNING_KEY
170
+
171
+ warrant = (
172
+ Warrant.mint_builder()
173
+ .holder(agent_key.public_key)
174
+ .capability("read_file", path=Subpath("/data"))
175
+ .capability("web_search", query=Pattern("acme*"))
176
+ .capability("scale_cluster", replicas=Range.max_value(10))
177
+ .ttl(3600)
178
+ .mint(control_key)
179
+ )
180
+
181
+ path = os.path.expanduser("~/.hermes/tenuo/warrant")
182
+ os.makedirs(os.path.dirname(path), exist_ok=True)
183
+ with open(path, "w") as f:
184
+ f.write(base64.b64encode(warrant.to_bytes()).decode())
185
+ ```
186
+
187
+ Point `warrant:` at that file. Set `trusted_root` to the base64 of
188
+ `control_key.public_key.to_bytes()` and `TENUO_SIGNING_KEY` to the base64 of
189
+ `agent_key.secret_key_bytes()`.
190
+
191
+ ## What it unlocks
192
+
193
+ | Scenario | What you do | What you get |
194
+ |---|---|---|
195
+ | **Cron and scheduled agents** | Mint with `--ttl` matching the job window | The job cannot keep acting after it should be done, even if it is still running |
196
+ | **Subagents via `delegate_task`** | Grant from the parent (`grant_builder`) | The child hop is verified as a chain; a researcher cannot suddenly `write_file` |
197
+ | **Multi-user gateways** | Call `guard.set_session_warrant(session_id, warrant)` when a session starts | Per-user permissions, isolated per session, cleared on session end |
198
+ | **Kanban workers** | Drop `~/.hermes/tenuo/warrants/<task_id>.warrant` | The worker loads its own warrant; a denial auto-blocks the task on the board |
199
+ | **Fleet rollout** | Pin `warrant`, `trusted_root`, `on_denial` in managed scope | Users cannot loosen them from `~/.hermes/config.yaml` |
200
+
201
+ Runnable versions of the first three live in
202
+ [`examples/`](https://github.com/tenuo-ai/hermes-tenuo/tree/main/examples).
203
+
204
+ ## See what your agent actually calls
205
+
206
+ Every decision is appended to a local JSONL audit log, on by default at
207
+ `~/.hermes/tenuo/audit.jsonl` (profile-aware under `HERMES_HOME`). No account
208
+ needed.
209
+
210
+ ```bash
211
+ hermes-tenuo audit --last 20 # one line per tool call
212
+ hermes-tenuo audit --denied # only what the warrant blocked
213
+ hermes-tenuo audit --json | jq ... # raw records
214
+ ```
215
+
216
+ ```text
217
+ 2026-09-12 10:00:00 ALLOW read_file path=/data/q3.md
218
+ 2026-09-12 10:00:01 DENY terminal command=ls — Tool 'terminal' is not authorized
219
+ ```
220
+
221
+ Not sure what to allow yet? Set `on_denial: log`. Every call is still
222
+ checked and recorded, but nothing is blocked. Run the agent, read the denied
223
+ lines, tighten the warrant, then remove the line (the default is `block`).
224
+
225
+ ```yaml
226
+ plugins:
227
+ entries:
228
+ hermes-tenuo:
229
+ warrant: ~/.hermes/tenuo/warrant
230
+ trusted_root: <base64>
231
+ on_denial: log
232
+ ```
233
+
234
+ ## How it works
235
+
236
+ | Hermes hook | What hermes-tenuo does there |
237
+ |---|---|
238
+ | `pre_tool_call` | Verifies the tool name and arguments against the session's warrant. On denial, returns `{"action": "block", "message": ...}`; the handler never runs. |
239
+ | `post_tool_call` | Adds timing to the recorded decision and writes the audit record. |
240
+ | `subagent_start` | Hands the `child_warrant` to the new child session. |
241
+ | `on_session_end` | Clears any per-session warrant set with `guard.set_session_warrant()`, so gateway users never share one. |
242
+
243
+ The decision itself runs in Tenuo's Rust core: signature, expiry, holder
244
+ proof-of-possession, and every argument constraint. The plugin holds only the
245
+ issuer's **public** key. It never sees the key that minted the warrant.
246
+
247
+ Denials are returned to the model as the tool result, so the agent can
248
+ explain what it was not allowed to do. Raise the `hermes_tenuo` logger level
249
+ to see the same lines as an operator.
250
+
251
+ ## Coverage
252
+
253
+ On upstream Hermes, enforcement runs at `pre_tool_call`. That covers every
254
+ tool call made through the agent loop, including the tools `run_agent.py`
255
+ handles before the registry (`todo`, `memory`, `session_search`,
256
+ `delegate_task`). It does not cover:
257
+
258
+ - callers that pass `skip_pre_tool_call_hook=True`;
259
+ - plugins that call `registry.dispatch()` directly;
260
+ - the `execute_code` sandbox's internal tool dispatch.
261
+
262
+ A registry-level hook that closes all three is proposed upstream in
263
+ [hermes-agent#32719](https://github.com/NousResearch/hermes-agent/pull/32719).
264
+ The plugin detects it at load time and uses it automatically, and
265
+ `hermes-tenuo doctor` reports which path is active.
266
+
267
+ Neither path inspects what an `execute_code` script does on its own, such as
268
+ `subprocess.run(...)`. Use a container backend (Docker, Modal, Daytona) for
269
+ that threat model.
270
+
271
+ ## CLI
272
+
273
+ ```bash
274
+ hermes-tenuo demo # local allow/deny transcript (no Hermes process)
275
+ hermes-tenuo mint --allow TOOL[:ARG=VALUE,...] [--allow ...] [--ttl 1h] [--output full|yaml|env]
276
+ hermes-tenuo status # what the plugin will load from config and env
277
+ hermes-tenuo verify # decode and check the current warrant
278
+ hermes-tenuo doctor # end-to-end install check
279
+ hermes-tenuo audit [--last N] [--denied] [--json] [--path FILE]
280
+ ```
281
+
282
+ Run `doctor` from the same venv Hermes uses. It checks plugin discovery,
283
+ config wiring, warrant validity, that the signing key matches the warrant
284
+ holder, and which enforcement path is active. Run it after every install.
285
+
286
+ ## Configuration reference
287
+
288
+ All keys live under `plugins.entries.hermes-tenuo`. Each has an environment
289
+ variable equivalent.
290
+
291
+ | Key | Env | Meaning |
292
+ |---|---|---|
293
+ | `warrant` | `TENUO_WARRANT` | Base64 warrant, or a path to a file containing one. Required for enforcement. |
294
+ | `trusted_root` | `TENUO_TRUSTED_ROOT` | Base64 public key of the issuer. Warrants signed by anything else are rejected. |
295
+ | `signing_key_env` | | Name of the env var holding the agent's Ed25519 secret key. Default `TENUO_SIGNING_KEY`. |
296
+ | `child_warrant` | `TENUO_CHILD_WARRANT` | Warrant handed to sessions spawned by `delegate_task`. |
297
+ | `on_denial` | | `block` (default) or `log`. |
298
+ | `audit_log` | `TENUO_AUDIT_LOG` | Path of the JSONL audit log, or `false` to disable. Default `$HERMES_HOME/tenuo/audit.jsonl`. |
299
+
300
+ Keep secret key material in env vars or a secrets manager, never in
301
+ `config.yaml`.
302
+
303
+ ## Things to know
304
+
305
+ - **Enabled but unconfigured is a no-op.** Without a `warrant`, the plugin
306
+ loads, logs a warning, and enforces nothing. `doctor` fails that check.
307
+ - **Multiplexed profiles.** Under `gateway.multiplex_profiles`, `TENUO_*`
308
+ values are read through Hermes `get_secret`, so put each profile's keys in
309
+ that profile's `.env`. A secondary profile does not inherit the launch
310
+ profile's credentials.
311
+ - **Rotate by re-minting.** The control key is not saved by `mint`. To change
312
+ scope, mint a new warrant and replace the config values; the old warrant
313
+ stops being accepted when you change `trusted_root`, or when its TTL ends.
314
+
315
+ ## Managed scope (fleet and multi-user)
316
+
317
+ Hermes overlays a root-owned `/etc/hermes/config.yaml` on every user's
318
+ config. hermes-tenuo reads its keys through the same loader, so an
319
+ administrator can pin the warrant and trust anchor for the whole fleet:
320
+
321
+ ```yaml
322
+ # /etc/hermes/config.yaml (root-owned)
323
+ plugins:
324
+ entries:
325
+ hermes-tenuo:
326
+ warrant: /etc/hermes/tenuo/fleet.warrant
327
+ trusted_root: <base64>
328
+ on_denial: block
329
+ ```
330
+
331
+ Pin `warrant`, `trusted_root`, and `on_denial`. Leave `signing_key_env` to
332
+ the environment. Override the managed directory with `HERMES_MANAGED_DIR` for
333
+ containers or non-standard layouts.
334
+
335
+ ## Connecting a control plane (optional)
336
+
337
+ Everything above runs from files and environment variables on one machine.
338
+ That is the right shape for one developer and a handful of agents. Once you
339
+ run a fleet of Hermes agents, cron jobs, and gateway users, the hard part
340
+ stops being the check itself and becomes operating the authority around it:
341
+ who may mint production warrants, how keys rotate, how a bad warrant is
342
+ pulled back before its TTL ends, and where you look when something was
343
+ denied at 3 a.m. A Tenuo control plane takes that over.
344
+
345
+ When `TENUO_CONNECT_TOKEN` is set, the Tenuo SDK inside this plugin connects
346
+ on its own and every allow and deny decision from every Hermes agent streams
347
+ there, with nothing else to configure. On top of that stream the control
348
+ plane gives you:
349
+
350
+ - **Revocation before expiry.** Pull a warrant, a key, or an agent the moment
351
+ something looks wrong instead of waiting for the TTL. Revocation lists are
352
+ published to every verifier.
353
+ - **Central issuance and rotation.** Mint per-job warrants from policy rather
354
+ than by hand, and rotate root and holder keys on a schedule without
355
+ touching each agent's environment.
356
+ - **Human approval gates.** Route calls to sensitive tools to a person, so
357
+ the agent can proceed only with a signed approval.
358
+ - **One searchable audit trail.** Signed receipts from every agent, session,
359
+ and profile in one place, instead of one `audit.jsonl` per machine.
360
+
361
+ Tenuo Cloud is the managed version of that control plane. See
362
+ [tenuo.ai](https://tenuo.ai) for access, or the Tenuo repo for running your
363
+ own.
364
+
365
+ ## License
366
+
367
+ Apache-2.0