attesso 0.4.0 → 0.6.0
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.
- package/LICENSE +201 -0
- package/NOTICE +4 -0
- package/README.md +172 -19
- package/bin/attesso-control-mcp.mjs +13 -0
- package/bin/attesso-mcp.mjs +2 -0
- package/bin/attesso.mjs +600 -65
- package/package.json +8 -4
- package/src/bundle.mjs +128 -0
- package/src/classify.mjs +83 -0
- package/src/cli-io.mjs +130 -0
- package/src/connect.mjs +160 -0
- package/src/control.mjs +101 -0
- package/src/decide.mjs +10 -0
- package/src/fs-paths.mjs +121 -0
- package/src/harness.mjs +130 -0
- package/src/hook.mjs +72 -37
- package/src/install.mjs +122 -0
- package/src/jsonl.mjs +16 -0
- package/src/ledger.mjs +79 -20
- package/src/mcp/control.mjs +171 -0
- package/src/mcp-proxy.mjs +605 -0
- package/src/merkle.mjs +83 -0
- package/src/policy.mjs +8 -8
- package/src/receipt.mjs +104 -0
- package/src/replay.mjs +133 -0
- package/src/report.mjs +69 -27
- package/src/rules.mjs +78 -6
- package/src/serve.mjs +4 -2
- package/src/setup.mjs +131 -0
- package/src/store.mjs +425 -64
- package/src/stream.mjs +72 -0
- package/src/toolpin.mjs +131 -0
- package/src/ui/catalog.mjs +266 -0
- package/src/ui/live.mjs +58 -0
- package/src/ui/query.mjs +163 -0
- package/src/ui/server.mjs +379 -0
- package/src/ui/static/index.html +1695 -0
- package/src/usage.mjs +96 -0
- package/src/watch.mjs +78 -0
package/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 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 contributors
|
|
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.
|
package/NOTICE
ADDED
package/README.md
CHANGED
|
@@ -1,17 +1,33 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Bounds
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Installed as `attesso`: a local, signed ledger of what your AI agents attempted, what was allowed, and what was refused. Free and unlimited on your own machine; $0.00085 per synced decision when the record has to travel. Any action, not only payments. No account, no hosted backend, no dependencies.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
6
|
npx attesso init
|
|
7
7
|
npx attesso log --action tool.call --subject read_file --meta tokens=1200 --meta cost_usd=0.0004
|
|
8
8
|
npx attesso log --action purchase.execute --subject shop.example --amount 12.50 --currency EUR
|
|
9
9
|
npx attesso verify
|
|
10
|
-
npx attesso
|
|
10
|
+
npx attesso prove 2 --out receipt.json
|
|
11
|
+
npx attesso verify-receipt receipt.json
|
|
11
12
|
npx attesso report
|
|
12
13
|
```
|
|
13
14
|
|
|
14
|
-
`init` writes `.attesso/` with an Ed25519 key, a policy and an empty ledger. `log` evaluates one proposed action against the policy, records the decision and its reason, and exits 1 when it refuses. `verify` recomputes the hash chain and every signature. `show` prints what was allowed, what was refused, which subjects dominate, and any tokens or cost you passed in `--meta`. `--dir PATH` points any command at a different ledger.
|
|
15
|
+
`init` writes `.attesso/` with an Ed25519 key, a policy, a tools allowlist and an empty ledger. `log` evaluates one proposed action against the policy, records the decision and its reason, and exits 1 when it refuses. `verify` recomputes the hash chain and every signature. `prove` writes a receipt for one entry; `verify-receipt` checks it with the public key alone, in an empty directory. `show` prints what was allowed, what was refused, which subjects dominate, and any tokens or cost you passed in `--meta`. `--dir PATH` points any command at a different ledger.
|
|
16
|
+
|
|
17
|
+
## The local UI
|
|
18
|
+
|
|
19
|
+
`attesso ui` starts a loopback-only control surface for the ledger. It shows the
|
|
20
|
+
day's observed flow and the exact calls behind it, reads new decisions as they
|
|
21
|
+
are appended, and writes mode and path changes to the same files the hook reads:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
npx attesso ui
|
|
25
|
+
npx attesso ui --port 0 --no-open
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The server binds `127.0.0.1`, mints a per-process token, and serves the page from
|
|
29
|
+
the installed package. It has no account, no hosted data, and no dependency on a
|
|
30
|
+
snapshot file. `Ctrl-C` stops it.
|
|
15
31
|
|
|
16
32
|
## The overview
|
|
17
33
|
|
|
@@ -27,17 +43,68 @@ hermes-local-9552aa28437e88c0610a… 2058 455 (22%) PATH_DENIED×455 3,92
|
|
|
27
43
|
|
|
28
44
|
Actions are tool calls; refusals carry the reason; tokens are input plus output, with cache reads shown separately because they bill at a different rate and dwarf the rest. Cost comes from a `llm.session` entry the recorder writes from the agent's own usage record, never from a number the report invents. `--json` gives the same data for a dashboard.
|
|
29
45
|
|
|
46
|
+
## Watch and steer
|
|
47
|
+
|
|
48
|
+
`attesso watch` follows new decisions in one terminal; `--from-seq 0` starts from
|
|
49
|
+
the beginning of the ledger. `pause` and `stop` refuse the next calls of one
|
|
50
|
+
task, while `resume` releases it. These commands work from a second terminal, so
|
|
51
|
+
the agent process does not need to be restarted:
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
npx attesso rules set-profile balanced # migrate an existing ledger, keep rules.json.bak
|
|
55
|
+
npx attesso watch --from-seq 0
|
|
56
|
+
npx attesso pause <task> --reason "inspect the diff"
|
|
57
|
+
npx attesso stop <task> --reason "leave it stopped"
|
|
58
|
+
npx attesso control
|
|
59
|
+
npx attesso resume <task>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
A pause is an explicit operator action, so it blocks even when the hook was
|
|
63
|
+
started with `--observe`. The ledger records a signed control entry with
|
|
64
|
+
`TASK_PAUSED` or `TASK_STOPPED` and the task id. The local control file is
|
|
65
|
+
`control.json` beside the ledger; it is steering state, not a proof of human
|
|
66
|
+
authority.
|
|
67
|
+
|
|
68
|
+
## Setup, explain, suggest
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
npx attesso setup # detects the installed harnesses; wires Hermes
|
|
72
|
+
npx attesso setup --write # also merges the observe hook into Claude Code,
|
|
73
|
+
# Codex, Gemini and Cline, preserving existing hooks
|
|
74
|
+
npx attesso setup --write --enforce # same, but a refusal blocks
|
|
75
|
+
npx attesso setup --dry-run
|
|
76
|
+
npx attesso explain 42 # entry #42: rule, the step that tainted the task, what to do
|
|
77
|
+
npx attesso suggest # rules the ledger's own counts justify
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`setup` also writes an `AGENTS.md` block so the agent knows a veto is active, that a
|
|
81
|
+
refusal is not retryable unchanged, and how to ask about a rule that looks wrong.
|
|
82
|
+
`suggest` is how rules get discovered instead of configured: it counts identical
|
|
83
|
+
calls (same tool, same arguments) and prints a rule with the count that justifies it.
|
|
84
|
+
|
|
30
85
|
## Wire it into an agent
|
|
31
86
|
|
|
32
|
-
`attesso hook`
|
|
33
|
-
|
|
34
|
-
|
|
87
|
+
`attesso hook` auto-detects the caller from its event name and payload shape, then
|
|
88
|
+
answers in that harness's native decision shape:
|
|
89
|
+
|
|
90
|
+
| Caller | Event | Refusal |
|
|
91
|
+
|---|---|---|
|
|
92
|
+
| Hermes | `pre_tool_call` | exit 2 with a message |
|
|
93
|
+
| Claude Code, Codex | `PreToolUse` | `hookSpecificOutput.permissionDecision: deny` |
|
|
94
|
+
| Cursor | `preToolUse` | `permission: deny` with both messages |
|
|
95
|
+
| Cline | nested `preToolUse` | `{ cancel: true, errorMessage }` |
|
|
96
|
+
| Gemini | `BeforeTool` | `{ decision: deny, reason }` |
|
|
97
|
+
|
|
98
|
+
Start in observe mode so the ledger records what the rules would have refused and
|
|
99
|
+
nothing is blocked. In observe mode, and on an ALLOW, a native harness gets no
|
|
100
|
+
decision from us, so its own approval prompt still runs:
|
|
35
101
|
|
|
36
102
|
```sh
|
|
37
103
|
node bin/attesso.mjs --dir ~/.hermes/attesso-veto/ledger hook --observe
|
|
38
104
|
```
|
|
39
105
|
|
|
40
|
-
|
|
106
|
+
`setup --write` installs the same command in each detected harness. The Hermes
|
|
107
|
+
config (`~/.hermes/config.yaml`) looks like this:
|
|
41
108
|
|
|
42
109
|
```yaml
|
|
43
110
|
hooks:
|
|
@@ -46,8 +113,15 @@ hooks:
|
|
|
46
113
|
timeout: 10
|
|
47
114
|
```
|
|
48
115
|
|
|
49
|
-
|
|
50
|
-
|
|
116
|
+
Codex requires one manual trust step: run `/hooks` in Codex, review the installed
|
|
117
|
+
command and trust it. A changed hook definition is untrusted again. The other
|
|
118
|
+
harnesses load the written config on their next start.
|
|
119
|
+
|
|
120
|
+
Remove `--observe` (or run `setup --write --enforce`) when the refusal rate on your
|
|
121
|
+
own work looks right. Hermes then exits 2; the native harnesses get their own deny
|
|
122
|
+
object and the step never runs. Claude Code also gets `onFailure: block` in enforce
|
|
123
|
+
mode; Codex, Gemini and Cline have no equivalent field, so their own sandbox and
|
|
124
|
+
approval rules remain the backstop.
|
|
51
125
|
|
|
52
126
|
For a long-lived harness, `attesso serve` answers the same questions over one
|
|
53
127
|
process: write one JSON request per line, read one verdict per line. A decision
|
|
@@ -59,15 +133,18 @@ One signed line per proposed action:
|
|
|
59
133
|
|
|
60
134
|
```json
|
|
61
135
|
{"v":1,"seq":1,"at":"2026-10-31T12:00:00.000Z","action":"tool.call",
|
|
62
|
-
"subject":"read_file","decision":"ALLOW","code":"ALLOW",
|
|
136
|
+
"subject":"read_file","decision":"ALLOW","code":"ALLOW",
|
|
137
|
+
"policy_digest":"…","rules_digest":"…","args_hash":"…",
|
|
63
138
|
"kid":"…","prev":"genesis","meta":{"tokens":1200,"cost_usd":0.0004},"sig":"…"}
|
|
64
139
|
```
|
|
65
140
|
|
|
66
|
-
`subject` is the thing acted on: a tool name, a payee, a repo, a recipient. `amount` appears only for money actions. Refusal codes match the hosted engine: `ACTION_MISMATCH`, `ABOVE_MAXIMUM`, `VALUE_NOT_ALLOWED`, `VALUE_MISMATCH`, `OUTSIDE_DATE_RANGE`, `REQUIRED_ATTRIBUTE_MISSING`.
|
|
141
|
+
`subject` is the thing acted on: a tool name, a payee, a repo, a recipient. `rule` names the policy field or path rule behind a refusal. `args_hash` is a digest of the arguments, never the payload. `amount` appears only for money actions. Refusal codes match the hosted engine: `ACTION_MISMATCH`, `ABOVE_MAXIMUM`, `VALUE_NOT_ALLOWED`, `VALUE_MISMATCH`, `OUTSIDE_DATE_RANGE`, `REQUIRED_ATTRIBUTE_MISSING`.
|
|
142
|
+
|
|
143
|
+
In-process embedders can subscribe to the `bounds.decision` diagnostics channel. The event carries the verdict, the rule, the entry hash and the digests, never the subject, task, amount, arguments or your `meta`.
|
|
67
144
|
|
|
68
145
|
## The policy
|
|
69
146
|
|
|
70
|
-
`.attesso/policy.json` starts
|
|
147
|
+
`.attesso/policy.json` starts with `"action": "*"`, so a fresh ledger records every action; tighten it once you know what to allow. A policy governs one action; `"action": "*"` covers every action and is what a recording-only ledger uses.
|
|
71
148
|
|
|
72
149
|
```json
|
|
73
150
|
{ "version": 1, "action": "tool.call", "subjects": ["read_file", "search_files", "grep_repo"] }
|
|
@@ -101,21 +178,82 @@ npx attesso log --action mail.send --subject partner@example.com --task job-2
|
|
|
101
178
|
# #4 ALLOW mail.send partner@example.com (ALLOW)
|
|
102
179
|
```
|
|
103
180
|
|
|
104
|
-
`init` ships
|
|
181
|
+
`init` ships the balanced profile:
|
|
105
182
|
|
|
106
183
|
```json
|
|
107
184
|
{ "version": 1,
|
|
108
185
|
"rules": [
|
|
109
186
|
{ "id": "no-send-after-untrusted-read",
|
|
110
|
-
"deny": { "capabilities": ["send"
|
|
111
|
-
"if_path": { "trust": "untrusted", "capability": "read", "within_minutes": 30 } }
|
|
187
|
+
"deny": { "capabilities": ["send"] },
|
|
188
|
+
"if_path": { "trust": "untrusted", "capability": "read", "within_minutes": 30 } },
|
|
189
|
+
{ "id": "no-repeat-web-extract",
|
|
190
|
+
"deny": { "capabilities": ["read"] },
|
|
191
|
+
"if_path": { "capability": "read", "subject": "web_extract",
|
|
192
|
+
"same_arguments": true, "within_minutes": 30 } }
|
|
112
193
|
] }
|
|
113
194
|
```
|
|
114
195
|
|
|
115
|
-
|
|
196
|
+
Balanced blocks the outbound boundary and duplicate fetches; it leaves local edits and commands alone. For an untrusted environment where a shell command itself can exfiltrate, `init --profile strict` adds `write` and `execute` to the deny list. An existing ledger can adopt either shipped profile with `attesso rules set-profile balanced|strict`; the previous file is kept as `rules.json.bak`.
|
|
197
|
+
|
|
198
|
+
File tools can also be scoped by `paths.json`. Shell and execute tools remain
|
|
199
|
+
unscoped by default. A deployment that wants the hook to refuse every execute
|
|
200
|
+
capability can set `"shell_scope": "deny"` in `paths.json`; that is a denial,
|
|
201
|
+
not a command sandbox.
|
|
202
|
+
|
|
203
|
+
`--task` scopes the history, so one job cannot taint another. `within_minutes` limits how long a read stays relevant; without it a taint lasts for the whole task. `--capability` is one of `read`, `write`, `send`, `execute`, `spend`. The refusal names the rule and the step that tainted the path, so a reader can see the sequence rather than a verdict.
|
|
116
204
|
|
|
117
205
|
Rules are ordinary files you own and version. Run them in observe mode first: `node scripts/hermes-ledger.mjs --observe` records what the rules would have refused without touching the agent, which is how you learn where a rule is too broad before it costs you a day.
|
|
118
206
|
|
|
207
|
+
## Pin the MCP surface
|
|
208
|
+
|
|
209
|
+
A tool call is judged by name unless you pin the definitions you reviewed. `tools pin` hashes each supplied tool's full definition and the current `.attesso/tools.json`:
|
|
210
|
+
|
|
211
|
+
```sh
|
|
212
|
+
npx attesso tools pin --manifest tools.manifest.json
|
|
213
|
+
npx attesso tools verify --manifest tools.manifest.json
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
The manifest is the harness's own `{ "tools": [ { "name", "description", "inputSchema", "outputSchema", "annotations" } ] }` list. A caller that knows the definition can send `tool_definition_hash` with the call; a matching pin is recorded as `tool_pin: verified`, a changed one is refused as `TOOL_CHANGED`, and a call without a hash is recorded as `unverified`.
|
|
217
|
+
|
|
218
|
+
For an MCP server, use the bundled stdio adapter instead of wiring the manifest by hand:
|
|
219
|
+
|
|
220
|
+
```sh
|
|
221
|
+
# 1. Ask the server for its identity, instructions, tools, prompts and resources.
|
|
222
|
+
npx attesso-mcp --print-manifest -- npx -y @modelcontextprotocol/server-everything > mcp.manifest.json
|
|
223
|
+
|
|
224
|
+
# 2. Review it, then pin the whole surface.
|
|
225
|
+
npx attesso tools pin --manifest mcp.manifest.json
|
|
226
|
+
|
|
227
|
+
# 3. Put the adapter in front of the same server.
|
|
228
|
+
npx attesso-mcp --dir .attesso -- npx -y @modelcontextprotocol/server-everything
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
The adapter speaks both stdio protocol eras: the 2026-07-28 stateless discovery shape and the older `initialize` handshake. Pin the era your client uses; `--era legacy` forces the handshake when a dual-era server would otherwise be discovered as modern. It refuses a changed server identity, instructions, tool, prompt, resource or resource template before the client sees it, refuses a changed or unpinned tool before the call reaches the server, and refuses server-initiated sampling, elicitation and roots requests. Every allowed call is recorded in the signed ledger; `export` carries the pinned manifest and the tool lock, so `verify-bundle` can check the evidence in an empty directory. It is stdio only; remote HTTP servers and generic MCP gateway features are out of scope.
|
|
232
|
+
|
|
233
|
+
Before tightening a policy, replay the ledger against the candidate file:
|
|
234
|
+
|
|
235
|
+
```sh
|
|
236
|
+
npx attesso replay --policy next-policy.json --max-newly-denied 0
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Every recorded proposal is re-judged with the history that preceded it. The summary names how many decisions would flip, and `--max-newly-denied` turns a budget into an exit code, so a pull request can refuse a rule that would have blocked real work. Replay is a diagnostic: it uses the history the ledger holds and does not prove that history is complete.
|
|
240
|
+
|
|
241
|
+
## Control the local configuration over MCP
|
|
242
|
+
|
|
243
|
+
The bundled `attesso-control-mcp` is a control surface, not a second proxy:
|
|
244
|
+
|
|
245
|
+
```sh
|
|
246
|
+
npx attesso-control-mcp --dir .attesso
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
It speaks stdio only and answers both the legacy `initialize` handshake and the
|
|
250
|
+
2026-07-28 direct request shape. It exposes `bounds_status`,
|
|
251
|
+
`bounds_connect`, `bounds_mode`, `bounds_paths_get` and `bounds_paths_set`.
|
|
252
|
+
Connect and mode are limited to `observe` and `off`; enforcement and path
|
|
253
|
+
widening require the human CLI (`npx attesso mode enforce`,
|
|
254
|
+
`npx attesso paths --set`). It has no HTTP listener and no network access.
|
|
255
|
+
`attesso-mcp` remains the upstream tool proxy.
|
|
256
|
+
|
|
119
257
|
## Recording a real agent
|
|
120
258
|
|
|
121
259
|
`attesso` is a CLI, so anything that can run a command can record an action. To see what a Hermes session actually did, the repo ships `scripts/hermes-ledger.mjs`, which reads a session from `state.db` read-only and appends one entry per tool call.
|
|
@@ -125,13 +263,28 @@ node scripts/hermes-ledger.mjs --dir .hermes/tmp/attesso-dogfood --observe
|
|
|
125
263
|
npx attesso --dir .hermes/tmp/attesso-dogfood show
|
|
126
264
|
```
|
|
127
265
|
|
|
128
|
-
`--observe` labels every verdict the rules produced and prints how many steps they would have refused; nothing in the agent is blocked. Tool calls are classified on the way in
|
|
266
|
+
`--observe` labels every verdict the rules produced and prints how many steps they would have refused; nothing in the agent is blocked. Tool calls are classified on the way in by `.attesso/tools.json`: allowlisted names are internal, anything else is an untrusted read. Add your own tools there; an unlisted tool taints the task rather than being trusted.
|
|
267
|
+
|
|
268
|
+
## Portable evidence
|
|
269
|
+
|
|
270
|
+
```sh
|
|
271
|
+
npx attesso prove 2 --out receipt.json # one entry, its path, a signed head
|
|
272
|
+
npx attesso verify-receipt receipt.json # public key only, no ledger
|
|
273
|
+
npx attesso checkpoint --out head.json # keep this off the machine
|
|
274
|
+
npx attesso verify --pin head.json # refuse a rewrite below the pin
|
|
275
|
+
npx attesso export 2 --out bundle.json # receipt plus policy and rules
|
|
276
|
+
npx attesso verify-bundle bundle.json --replay # re-run the recorded verdict
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
A receipt is about 1.5 KB at ten thousand entries. A bundle adds the exact policy and rules bytes, so `--replay` recomputes the verdict instead of trusting the log; it replays against the history it carries, and does not prove that history is complete. The pin is what an attacker holding the key cannot re-derive. Store `head.json` on another device, or in a repository the agent cannot write; a pin stored beside the ledger is not independent. The receipt still proves integrity, not authority; see below.
|
|
129
280
|
|
|
130
281
|
## What this proves, and what it does not
|
|
131
282
|
|
|
132
283
|
The signature proves the ledger was not edited after the fact: change one byte and `verify` names the entry, reorder two and the chain breaks, delete the last one and the recorded head no longer matches.
|
|
133
284
|
|
|
134
|
-
|
|
285
|
+
Each append is fsynced and the head is written after its line. On Linux that is a local-disk guarantee. On macOS Node cannot issue F_FULLFSYNC, so a power cut can still lose the last write even on APFS; a network filesystem has the same limit. The recorded head then refuses the next append instead of guessing.
|
|
286
|
+
|
|
287
|
+
A receipt proves one entry sits in the tree whose head this key signed, and a pin proves the log was not rewritten below a head you kept elsewhere. Neither proves a human authorized anything. The signing key lives in `.attesso/key.json`, in the same directory as the log, so anything that can write the log can also write a new one. It cannot see absence either: a process that deletes the whole directory leaves nothing to verify.
|
|
135
288
|
|
|
136
289
|
Hosted Attesso is where authority lives: a passkey approval binds a named human to exact terms, the decision and the refusal are recorded server-side, and the result is evidence a third party verifies offline against a published key. The local ledger uses the same event and code vocabulary, so it can be submitted there later.
|
|
137
290
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Control-only MCP server. Keep this separate from attesso-mcp, which is a
|
|
3
|
+
// proxy and must not gain a second job.
|
|
4
|
+
import { homedir } from 'node:os';
|
|
5
|
+
import { createControl, createServer } from '../src/mcp/control.mjs';
|
|
6
|
+
|
|
7
|
+
const argv = process.argv.slice(2);
|
|
8
|
+
const dirAt = argv.indexOf('--dir');
|
|
9
|
+
const dir = dirAt === -1 ? '.attesso' : argv[dirAt + 1];
|
|
10
|
+
const homeAt = argv.indexOf('--home');
|
|
11
|
+
const home = homeAt === -1 ? homedir() : argv[homeAt + 1];
|
|
12
|
+
const control = createControl({ dir, home });
|
|
13
|
+
createServer({ control });
|