indenture 0.1.0__py3-none-any.whl
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.
- indenture-0.1.0.dist-info/METADATA +441 -0
- indenture-0.1.0.dist-info/RECORD +7 -0
- indenture-0.1.0.dist-info/WHEEL +4 -0
- indenture-0.1.0.dist-info/entry_points.txt +2 -0
- indenture-0.1.0.dist-info/licenses/LICENSE-APACHE +202 -0
- indenture-0.1.0.dist-info/licenses/LICENSE-MIT +21 -0
- indenture.py +742 -0
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: indenture
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Chain of custody for multi-agent systems: who was allowed to hand off to whom, what they passed, and how to replay it.
|
|
5
|
+
Project-URL: Source, https://github.com/Sylv-ctr/Indenture
|
|
6
|
+
Project-URL: Issues, https://github.com/Sylv-ctr/Indenture/issues
|
|
7
|
+
Author: Sylvain Cartier
|
|
8
|
+
License: MIT OR Apache-2.0
|
|
9
|
+
License-File: LICENSE-APACHE
|
|
10
|
+
License-File: LICENSE-MIT
|
|
11
|
+
Keywords: agents,audit,authorization,multi-agent,observability,provenance
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
18
|
+
Requires-Python: >=3.9
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: pytest>=7; extra == 'dev'
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# indenture
|
|
24
|
+
|
|
25
|
+
**Chain of custody for multi-agent systems.**
|
|
26
|
+
|
|
27
|
+
Run a handful of AI agents that pass work to each other and you will eventually have a bad day:
|
|
28
|
+
one agent hands the next something malformed, the next one does something destructive with it,
|
|
29
|
+
and by the time anybody notices, the cause is three steps back. Indenture is what you ask
|
|
30
|
+
*before* each handoff. It keeps a small rulebook — which agent may pass what to whom, and what
|
|
31
|
+
nobody may touch without a human — and it answers yes or no. A "no" is enforced rather than
|
|
32
|
+
suggested: the call does not run, and the agent is told why. Every answer is written down,
|
|
33
|
+
refusals included, which is the half a log file never has: *what did my agents try to do that I
|
|
34
|
+
did not want them to?*
|
|
35
|
+
|
|
36
|
+
The other half is being able to go back. Entries are written once and never edited, and each one
|
|
37
|
+
carries a fingerprint of the entry before it, so a journal that was altered after the fact says
|
|
38
|
+
so instead of looking fine. That is what makes the record worth reading a week later: you can ask
|
|
39
|
+
who last wrote a given file, and see the state of the world as it stood when an agent made a bad
|
|
40
|
+
call — not the state now, after six more agents have run over it.
|
|
41
|
+
|
|
42
|
+
**Concretely.** Your `backend` agent finishes some code and tries `kubectl apply`. A log would
|
|
43
|
+
record that it did, and you would find out when production went down. Here the hook asks first,
|
|
44
|
+
the rulebook says deployment is irreversible and needs a human, the command never runs, and the
|
|
45
|
+
refusal is on the record. A week later your tests go red: `indenture blame contracts.md` says the
|
|
46
|
+
`data` agent wrote that file and `backend` overwrote it four steps later, and `indenture replay
|
|
47
|
+
--until 6` shows you what `qa` was looking at when it signed off.
|
|
48
|
+
|
|
49
|
+
It is for anyone running more than two or three agents on real work — your own orchestrator,
|
|
50
|
+
Claude Code subagents, CrewAI, LangGraph, a pile of shell scripts. One file, standard library
|
|
51
|
+
only, nothing to deploy. `indenture check` answers with an exit code, so it works from any
|
|
52
|
+
language.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## The problem, in the words of people who have it
|
|
57
|
+
|
|
58
|
+
Tracing tells you what your agents did. It does not tell you what they should have been allowed
|
|
59
|
+
to do, and it does not help you get back.
|
|
60
|
+
|
|
61
|
+
> OpenTelemetry works for per-call latency and token counting, but breaks on coordination
|
|
62
|
+
> between agents — the trace shows the execution path, not whether a handoff should have been
|
|
63
|
+
> allowed.
|
|
64
|
+
|
|
65
|
+
> An upstream agent passes malformed state, a downstream agent takes a destructive action, and
|
|
66
|
+
> the root cause is three steps up the chain.
|
|
67
|
+
|
|
68
|
+
> Concurrent agents overwrite shared state: zero errors, plausible output, wrong result.
|
|
69
|
+
|
|
70
|
+
That last one is the expensive one, because it does not look like a bug. It looks like the model
|
|
71
|
+
got dumber, so you add more agents, and it gets worse.
|
|
72
|
+
|
|
73
|
+
## 30 seconds
|
|
74
|
+
|
|
75
|
+
```console
|
|
76
|
+
$ indenture init
|
|
77
|
+
indenture initialised in .indenture/
|
|
78
|
+
|
|
79
|
+
$ indenture check backend qa --kind review_request
|
|
80
|
+
ALLOW backend -> qa [review_request] (rules[3])
|
|
81
|
+
$ echo $?
|
|
82
|
+
0
|
|
83
|
+
|
|
84
|
+
$ indenture check backend deploy --kind work
|
|
85
|
+
DENY backend -> deploy [work] (rules[0]) irreversible lane: deployment requires an explicit human handoff
|
|
86
|
+
$ echo $?
|
|
87
|
+
2
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Both the allow and the deny are now in the journal. **The denials are the half that tracing
|
|
91
|
+
throws away** — "what did this system refuse to do, and why" has no answer unless refusals are
|
|
92
|
+
written down.
|
|
93
|
+
|
|
94
|
+
A denial is exit **2**, never 1. Python returns 1 on an unhandled exception and argparse returns
|
|
95
|
+
2 on usage, so a denial sharing 1 could not be told apart from the tool crashing — and a caller
|
|
96
|
+
needs to fail closed on both while knowing which happened. The full table is in
|
|
97
|
+
[`docs/DESIGN.md`](docs/DESIGN.md).
|
|
98
|
+
|
|
99
|
+
Then somebody edits the log to cover their tracks:
|
|
100
|
+
|
|
101
|
+
```console
|
|
102
|
+
$ indenture verify
|
|
103
|
+
CHAIN BROKEN: 1 problem(s) across 9 entries
|
|
104
|
+
entry 6: entry altered after writing
|
|
105
|
+
$ echo $?
|
|
106
|
+
4
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Each entry carries the hash of the one before it. An edited entry, a deleted entry and a
|
|
110
|
+
reordered file are all detectable, rather than merely unlikely.
|
|
111
|
+
|
|
112
|
+
## The three verbs
|
|
113
|
+
|
|
114
|
+
**Authorize.** Default-deny policy over who may hand what to whom. First matching rule wins; if
|
|
115
|
+
none matches, the default decides, and the default is `deny`. An authorization layer that fails
|
|
116
|
+
open is decoration.
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"default": "deny",
|
|
121
|
+
"actors": { "backend": {"lane": "contained"}, "deploy": {"lane": "irreversible"} },
|
|
122
|
+
"rules": [
|
|
123
|
+
{"from": "*", "to": "deploy", "allow": false,
|
|
124
|
+
"reason": "irreversible lane: deployment requires an explicit human handoff"},
|
|
125
|
+
{"from": ["backend","frontend"], "to": ["qa","architect"],
|
|
126
|
+
"kind": ["work","question","review_request"], "allow": true}
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Journal.** Append-only, hash-chained, tamper-evident. One JSON object per line, documented in
|
|
132
|
+
[`docs/DESIGN.md`](docs/DESIGN.md), so you can build on it without this library.
|
|
133
|
+
|
|
134
|
+
**Replay.** Fold the journal back into state at any point, ask who last wrote a key, and read the
|
|
135
|
+
local context around an entry.
|
|
136
|
+
|
|
137
|
+
```console
|
|
138
|
+
$ indenture blame contracts.md
|
|
139
|
+
writes to contracts.md, oldest first:
|
|
140
|
+
#5 by architect (afbf9d0f3560b0fd)
|
|
141
|
+
#6 by data (c778a646489e79a6)
|
|
142
|
+
#8 by backend (531a7dc44be00ab9)
|
|
143
|
+
|
|
144
|
+
last writer: backend at entry 8
|
|
145
|
+
|
|
146
|
+
$ indenture why 8 --window 4
|
|
147
|
+
context around entry 8 (same actors, immediately before):
|
|
148
|
+
0 ALLOW backend -> qa [review_request] rules[3]
|
|
149
|
+
1 DENY backend -> deploy [work] rules[0] irreversible lane: ...
|
|
150
|
+
4 ALLOW human -> backend [work] rules[1]
|
|
151
|
+
> 8 WRITE backend -> contracts.md (531a7dc44be00ab9)
|
|
152
|
+
|
|
153
|
+
This is local context, not inferred causality.
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
`indenture replay --until 6` prints the state as it stood at entry 6 — the state the agent
|
|
157
|
+
actually saw, not the state you have now.
|
|
158
|
+
|
|
159
|
+
## Writing the rulebook
|
|
160
|
+
|
|
161
|
+
`indenture init` writes a starting policy to `.indenture/policy.json`. Edit it — it is the only
|
|
162
|
+
configuration there is.
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"default": "deny",
|
|
167
|
+
"redact": ["api_key", "token", "password", "authorization"],
|
|
168
|
+
"actors": {
|
|
169
|
+
"architect": {"lane": "contained"},
|
|
170
|
+
"backend": {"lane": "contained"},
|
|
171
|
+
"data": {"lane": "wide"},
|
|
172
|
+
"qa": {"lane": "contained"},
|
|
173
|
+
"deploy": {"lane": "irreversible"}
|
|
174
|
+
},
|
|
175
|
+
"rules": [
|
|
176
|
+
{"from": "*", "to": "deploy", "allow": false,
|
|
177
|
+
"reason": "deployment is irreversible: ask the operator to run it"},
|
|
178
|
+
{"from": "architect", "to": "*", "kind": ["plan", "contract"], "allow": true},
|
|
179
|
+
{"from": ["backend", "data"], "to": "qa",
|
|
180
|
+
"kind": ["work", "review_request"], "allow": true}
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**`actors`** — every agent that exists, under the name you call it by. An agent missing from this
|
|
186
|
+
list is *unknown*: its handoffs are refused and its state writes are recorded with a flag.
|
|
187
|
+
Listing nobody means nobody is known, not everybody.
|
|
188
|
+
|
|
189
|
+
**`lane`** — how far that actor's mistakes reach. `contained` stays inside its own workspace,
|
|
190
|
+
`wide` is visible outside but can be undone, `irreversible` cannot. The lane is recorded on every
|
|
191
|
+
entry, and it is what you point at when you write the rule that refuses deployment. Nothing opens
|
|
192
|
+
the irreversible lane on its own.
|
|
193
|
+
|
|
194
|
+
**`rules`** — read top to bottom, and **the first rule that matches decides**. That is the whole
|
|
195
|
+
mechanism, so put your refusals first: a permissive rule sitting above a restrictive one wins
|
|
196
|
+
silently, and you will not notice until something ships.
|
|
197
|
+
|
|
198
|
+
Each rule matches on `from`, `to` and `kind`. Each of the three takes a single name, a list of
|
|
199
|
+
names, or `"*"` for any. An absent `kind` means any kind. A rule without `"allow": true`
|
|
200
|
+
**refuses** — permission is never implied by a rule merely existing.
|
|
201
|
+
|
|
202
|
+
**`kind`** — your own vocabulary for what is being handed over: `work`, `review_request`, `plan`,
|
|
203
|
+
`rework`, whatever your agents actually do. Indenture never interprets it, it only matches on it.
|
|
204
|
+
|
|
205
|
+
**`reason`** — this string is handed back to the agent when it is refused, so write it as an
|
|
206
|
+
instruction to the agent, not as a note to yourself. *"deployment is irreversible: ask the
|
|
207
|
+
operator to run it"* gives the model a next step. *"not allowed"* gives it a retry loop.
|
|
208
|
+
|
|
209
|
+
**`default`** — what happens when no rule matches. It is `deny`, and there is deliberately no
|
|
210
|
+
flag to invert it. If you want to be permissive, write an explicit last rule that says so, where
|
|
211
|
+
the next person to read the file can see it.
|
|
212
|
+
|
|
213
|
+
**`redact`** — keys replaced with `<redacted>` before anything is written, for the cases where
|
|
214
|
+
you do ask Indenture to store a payload instead of only its fingerprint.
|
|
215
|
+
|
|
216
|
+
### Start small
|
|
217
|
+
|
|
218
|
+
Three actors and two rules is already a working policy. Add a rule the first time a handoff is
|
|
219
|
+
refused that you actually wanted: the refusal is in the journal with both actors and the kind, so
|
|
220
|
+
it tells you exactly which rule is missing.
|
|
221
|
+
|
|
222
|
+
```console
|
|
223
|
+
$ indenture log --denied
|
|
224
|
+
1 09:16:57 DENY backend -> deploy [work] rules[0] deployment is irreversible: ask the operator to run it
|
|
225
|
+
7 09:41:02 DENY data -> qa [schema] default no rule matched data -> qa (schema); default is deny
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Entry 7 is the one to act on — `default` in the rule column means you never wrote a rule for
|
|
229
|
+
that pair. Entry 1 is the policy working as intended.
|
|
230
|
+
|
|
231
|
+
## Install
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
pip install indenture # or: curl -O .../indenture.py — it is one file, vendor it
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
As a library:
|
|
238
|
+
|
|
239
|
+
```python
|
|
240
|
+
from indenture import Indenture
|
|
241
|
+
|
|
242
|
+
ind = Indenture(".indenture")
|
|
243
|
+
d = ind.authorize("backend", "qa", kind="review_request", payload=work)
|
|
244
|
+
if not d.allowed:
|
|
245
|
+
raise PermissionError(d.reason) # already journaled as a denial
|
|
246
|
+
|
|
247
|
+
ind.write_state("contracts.md", schema, by="data")
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
From anything that can run a process:
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
indenture check "$FROM" "$TO" --kind "$KIND" --quiet || exit 1
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Wiring it into Claude Code
|
|
257
|
+
|
|
258
|
+
A `PreToolUse` hook turns the policy into enforcement rather than a request: see
|
|
259
|
+
[`examples/claude_code_hook.py`](examples/claude_code_hook.py). This is the part that matters
|
|
260
|
+
most — a rule written in a prompt is a suggestion the model can ignore, and nothing records that
|
|
261
|
+
it did. A denied call exits 2, Claude Code blocks it, and the reason goes back to the model.
|
|
262
|
+
|
|
263
|
+
**Read this before you trust it.** The enforcement is the host's, not this tool's. Claude Code
|
|
264
|
+
blocks on exit 2 — but if the hook *cannot start*, it reports the failure and **runs the command
|
|
265
|
+
anyway**. That is fail-open, and it is not hypothetical: on the first real Windows install,
|
|
266
|
+
`python` resolved to the Microsoft Store stub, the hook died with "Python was not found", and the
|
|
267
|
+
commands ran. Nothing was written, because the thing that writes never started — so the journal
|
|
268
|
+
was empty and silence meant nothing. Two consequences:
|
|
269
|
+
|
|
270
|
+
- Give the interpreter's **absolute path** in `settings.json`, not `python`.
|
|
271
|
+
- Run `indenture doctor` after wiring it up, and again if a journal looks suspiciously quiet.
|
|
272
|
+
That is the command that would have caught the above in ten seconds.
|
|
273
|
+
|
|
274
|
+
The same trap has a second floor. Unwatched commands are deliberately not journaled, so a
|
|
275
|
+
session where the agent only read files leaves nothing behind — and *nothing behind* is exactly
|
|
276
|
+
what a dead hook leaves too. So the hook writes one `hook attached` note per session, before it
|
|
277
|
+
classifies anything, and `doctor` reports it. An empty journal is now a statement rather than a
|
|
278
|
+
shrug. Add `.indenture/hook-session` to your `.gitignore`: it is local state, not record.
|
|
279
|
+
|
|
280
|
+
```console
|
|
281
|
+
$ indenture doctor
|
|
282
|
+
python 3.13.1 on Windows (AMD64)
|
|
283
|
+
executable C:\Users\me\AppData\Local\Python\bin\python.exe
|
|
284
|
+
indenture 0.1.0 from tools/indenture/indenture.py
|
|
285
|
+
locking msvcrt
|
|
286
|
+
policy .indenture/policy.json (5 actors, 9 rules, default=deny)
|
|
287
|
+
write+chain ok
|
|
288
|
+
journal .indenture/journal.jsonl (41 entries, intact)
|
|
289
|
+
|
|
290
|
+
healthy
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
`doctor` is read-only on your journal — the write test happens in a temporary directory — and it
|
|
294
|
+
exits non-zero when something is wrong, so it works in CI too.
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
mkdir -p .indenture && cp examples/policy-claude-code.json .indenture/policy.json
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Then in `.claude/settings.json`:
|
|
301
|
+
|
|
302
|
+
```json
|
|
303
|
+
{
|
|
304
|
+
"hooks": {
|
|
305
|
+
"PreToolUse": [
|
|
306
|
+
{"matcher": "Bash", "hooks": [{"type": "command",
|
|
307
|
+
"command": "/usr/bin/python3 examples/claude_code_hook.py claude"}]}
|
|
308
|
+
]
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
The actor is the argument. It is passed on the command line rather than through an environment
|
|
314
|
+
variable because `VAR=value command` is Unix shell syntax — on Windows it is not valid, and the
|
|
315
|
+
same `settings.json` has to work on both. `INDENTURE_ACTOR` still overrides it if you prefer
|
|
316
|
+
the environment.
|
|
317
|
+
|
|
318
|
+
[`examples/policy-claude-code.json`](examples/policy-claude-code.json) is written for one
|
|
319
|
+
developer and one session: the agent may `git push` — you review the diff anyway, and blocking
|
|
320
|
+
it would make this unusable — but not deploy, destroy, or open a database. Loosen it where it
|
|
321
|
+
annoys you; `indenture log --denied` tells you which rule is missing.
|
|
322
|
+
|
|
323
|
+
With no actor given at all, the actor is `unknown` and every watched command is refused. That is
|
|
324
|
+
the correct direction to fail, but it looks like a bug if you forget the argument.
|
|
325
|
+
|
|
326
|
+
**Windows.** Use the interpreter's full path, with forward slashes so JSON does not eat the
|
|
327
|
+
backslashes:
|
|
328
|
+
|
|
329
|
+
```json
|
|
330
|
+
"command": "C:/Users/me/AppData/Local/Python/bin/python.exe tools/indenture/indenture_hook.py claude"
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
`where python` will often hand you `...\WindowsApps\python.exe` first. That is the Microsoft Store
|
|
334
|
+
stub, not an interpreter; it is what caused the fail-open above. The locking uses `msvcrt`
|
|
335
|
+
instead of `fcntl` on this platform; the concurrency case is the thing to report if it misbehaves.
|
|
336
|
+
|
|
337
|
+
## Why the name
|
|
338
|
+
|
|
339
|
+
A medieval indenture was a contract written twice on one sheet, then cut along a jagged line.
|
|
340
|
+
Each party kept a half, and fitting the two halves back together proved the document was genuine
|
|
341
|
+
and untampered. It is a hash chain, five centuries early.
|
|
342
|
+
|
|
343
|
+
## Design notes
|
|
344
|
+
|
|
345
|
+
**Default-deny.** The first version of this allowed by default and it was useless: every handoff
|
|
346
|
+
passed, so the journal recorded nothing you could not have guessed.
|
|
347
|
+
|
|
348
|
+
**Digests, not payloads.** By default an entry stores a digest of what was passed, not the thing
|
|
349
|
+
itself. Storing every payload is how an audit trail becomes a secrets leak and a 2 GB file. Pass
|
|
350
|
+
`--store` when you want the value, and list sensitive keys under `redact` in the policy — they
|
|
351
|
+
are replaced with `<redacted>` before anything is written.
|
|
352
|
+
|
|
353
|
+
**Unknown actors are recorded, not refused, on state writes.** A write that already happened is a
|
|
354
|
+
fact, and a fact you refuse to write down is a gap in the audit trail. It is flagged
|
|
355
|
+
`[UNKNOWN ACTOR]` in the log. Handoffs *are* refused, because those have not happened yet.
|
|
356
|
+
|
|
357
|
+
**An empty policy declares nobody.** No actor list means no actor is known, not that every actor
|
|
358
|
+
is fine. The opposite is a fail-open, and in a default-deny tool it would be invisible until it
|
|
359
|
+
mattered.
|
|
360
|
+
|
|
361
|
+
**`why` does not claim causality.** It surfaces the entries involving the same actors immediately
|
|
362
|
+
before the one you are looking at, which is where root causes tend to sit. Inferring more than
|
|
363
|
+
that would be guessing with a confident interface.
|
|
364
|
+
|
|
365
|
+
## Other hosts, other providers
|
|
366
|
+
|
|
367
|
+
The core knows nothing about any provider. It imports nothing outside the standard library,
|
|
368
|
+
makes no network call, and never talks to a model: it takes a command, reads a JSON file, and
|
|
369
|
+
answers with an exit code. Whether GPT, Claude or Gemini produced the command does not reach it.
|
|
370
|
+
|
|
371
|
+
What is host-specific is the *gate* — where you put it. The hook in `examples/` speaks Claude
|
|
372
|
+
Code's shape. Codex, Cursor and Grok Build converged on the same convention, where **exit 2
|
|
373
|
+
blocks**, so an adapter is mostly a different config path and a different field name in the JSON
|
|
374
|
+
reply. In library mode there is nothing to adapt at all: call `authorize()` from your own
|
|
375
|
+
orchestrator, CrewAI, LangGraph or a shell script, and the host never enters into it.
|
|
376
|
+
|
|
377
|
+
If you run one of those hosts, that adapter is the issue I would most like to receive.
|
|
378
|
+
|
|
379
|
+
One warning that generalises. Hooks fail open, and not only here: the Windows failure described
|
|
380
|
+
above has an analogue reported on Codex, where a `PreToolUse` denial by exit code was classified
|
|
381
|
+
as a hook *failure* and the command then ran. Treat the gate as the host's, verify it with
|
|
382
|
+
`indenture doctor`, and read the `hook attached` entry rather than trusting a quiet journal.
|
|
383
|
+
|
|
384
|
+
## What this is not
|
|
385
|
+
|
|
386
|
+
- **Not a tracer.** It records decisions and handoffs, not spans. Run it next to
|
|
387
|
+
OpenTelemetry; they answer different questions.
|
|
388
|
+
- **Not an orchestrator.** It does not run your agents, schedule them, or know what a DAG is.
|
|
389
|
+
- **Not cryptographic attestation.** The chain is tamper-*evident*, not tamper-*proof*: someone
|
|
390
|
+
who can rewrite the whole file can recompute every hash. Ship the journal somewhere append-only
|
|
391
|
+
if you need more, and the chain will tell you whether what arrived matches what was written.
|
|
392
|
+
- **Not a sandbox.** It records that a handoff was refused; it does not stop a process that
|
|
393
|
+
ignores the exit code. Pair it with a hook if you want enforcement — and note that the
|
|
394
|
+
enforcement is then the host's: if the host runs the command when the hook fails to start, the
|
|
395
|
+
gate is gone and nothing is written to say so. `indenture doctor` exists for exactly that.
|
|
396
|
+
|
|
397
|
+
## Concurrency
|
|
398
|
+
|
|
399
|
+
Appends are serialised with an exclusive file lock, because computing the tip and writing have
|
|
400
|
+
to be one indivisible step. Without it the damage is not subtle: twenty-four concurrent writers
|
|
401
|
+
measured **eight** distinct sequence numbers and twenty-five chain problems. With it, twenty-four
|
|
402
|
+
entries, twenty-four sequence numbers, chain intact — and the suite runs that case on every
|
|
403
|
+
commit.
|
|
404
|
+
|
|
405
|
+
`fcntl` on Unix, `msvcrt` on Windows. On a platform with neither, it warns once on stderr and
|
|
406
|
+
still records: a journal that declines to write is a hole in the audit trail, which is the same
|
|
407
|
+
reason an unknown actor is recorded rather than refused on a state write. `verify` still detects
|
|
408
|
+
a forked chain, so the failure stays loud.
|
|
409
|
+
|
|
410
|
+
Not yet solved: a journal on a network filesystem where the lock may be a silent no-op, and
|
|
411
|
+
writers on different machines. Both are in [`docs/DESIGN.md` §7](docs/DESIGN.md).
|
|
412
|
+
|
|
413
|
+
## Status
|
|
414
|
+
|
|
415
|
+
v0.1. The API may change. The journal format and the exit codes are the parts intended to stay
|
|
416
|
+
stable — if you build on one thing, build on those.
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
pip install -e ".[dev]" && pytest # 62 tests, one per claim made above
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
## If you run more than three agents, I want to hear from you
|
|
423
|
+
|
|
424
|
+
This is the part I cannot find out by reading. There is no reliable public data on how many teams
|
|
425
|
+
run more than three or five code agents in production, and that number is the whole question.
|
|
426
|
+
|
|
427
|
+
So if you do: **open an issue** and say how many agents, what they hand to each other, and what
|
|
428
|
+
broke last. Especially what broke last. A wrong answer about my own design is worth more than a
|
|
429
|
+
polite one.
|
|
430
|
+
|
|
431
|
+
## License
|
|
432
|
+
|
|
433
|
+
Dual-licensed under either of
|
|
434
|
+
|
|
435
|
+
- **MIT** ([LICENSE-MIT](LICENSE-MIT)) — if you are vendoring `indenture.py` into
|
|
436
|
+
your own tree, take this one; it fits in a file header.
|
|
437
|
+
- **Apache License 2.0** ([LICENSE-APACHE](LICENSE-APACHE)) — if you are deploying
|
|
438
|
+
this as a dependency inside a company, take this one; it carries an explicit
|
|
439
|
+
patent grant, which is what legal will ask for.
|
|
440
|
+
|
|
441
|
+
at your option. Contributions are accepted under the same dual terms.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
indenture.py,sha256=oQB0WCYd_KdnAhrtUejvr_OhHMr9850ucHvVIjbjBaU,30405
|
|
2
|
+
indenture-0.1.0.dist-info/METADATA,sha256=Mfrr18D9JqcV9-R4e_3FE-SqKGX-cyUfd_oNHFc21Jw,20218
|
|
3
|
+
indenture-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
4
|
+
indenture-0.1.0.dist-info/entry_points.txt,sha256=_NYRewayuDTae63QitTvffnWkqPMS40dvBkfR0oM8co,45
|
|
5
|
+
indenture-0.1.0.dist-info/licenses/LICENSE-APACHE,sha256=oH6RhcyocMVWpE1bTf8r6lFuAGjs95hP2caBiDm_12E,11527
|
|
6
|
+
indenture-0.1.0.dist-info/licenses/LICENSE-MIT,sha256=ebpDHJz91SAhZ1RHERPtmsMba0F9Ezr0hZZW9R9tAuM,1093
|
|
7
|
+
indenture-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,202 @@
|
|
|
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 {yyyy} {name of copyright owner}
|
|
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.
|
|
202
|
+
|