RFTSystems commited on
Commit
b1c76c3
·
verified ·
1 Parent(s): 125d7d8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +70 -14
README.md CHANGED
@@ -10,18 +10,18 @@ pinned: false
10
  license: other
11
  short_description: Tamper-evident, hash-chained event logging for AI/agent runs
12
  ---
13
- # RFT Agent Flight Recorder — Black Box Behaviour Trace
14
 
15
  A proof-first flight recorder for AI/agent runs. This Space writes an **append-only, hash-chained event log** so you can verify **what happened, when it happened, and what triggered it**—without taking anyone’s word for it.
16
 
17
- It’s built to be boringly audit-friendly: deterministic hashing, optional Ed25519 signatures, session verification, and exportable proof bundles that third parties can check.
18
 
19
  ---
20
 
21
  ## What this Space does
22
 
23
  ### ✅ Records a tamper-evident timeline
24
- Each action becomes an **event** (JSON) written to `flightlog.jsonl`:
25
 
26
  - `prompt`
27
  - `output`
@@ -35,28 +35,34 @@ Each action becomes an **event** (JSON) written to `flightlog.jsonl`:
35
  Every event includes:
36
 
37
  - `seq` (monotonic step number)
38
- - `ts_utc` (timestamp)
39
  - `prev_event_hash_sha256` (links to previous event)
40
  - `event_hash_sha256` (hash of this event)
41
  - optional `signature_ed25519` (Ed25519 signature)
42
 
43
  If any event is edited, removed, or reordered, verification fails.
44
 
 
 
 
 
 
 
45
  ### ✅ Verifies sessions end-to-end
46
- The verifier recomputes hashes and confirms the chain is intact. Optionally, it can require a valid signature on every event.
47
 
48
  ### ✅ Exports proof bundles
49
  Exports `rft_flight_bundle_<session_id>.zip` containing:
50
 
51
- - `<session_id>_events.jsonl` (the session timeline)
52
- - `<session_id>_verify_report.txt` (verification report)
53
 
54
  ### ✅ Imports and verifies third-party bundles
55
  Upload a bundle and verify it locally. Optionally store PASSed events into your local `flightlog.jsonl`.
56
 
57
  ---
58
 
59
- ## How to use
60
 
61
  ### 1) Generate keys (optional)
62
  Go to **Keys** → **Generate Keypair**.
@@ -64,11 +70,11 @@ Go to **Keys** → **Generate Keypair**.
64
  - **Private key** signs events (keep it private).
65
  - **Public key** verifies signatures (safe to share).
66
 
67
- > demo note: don’t paste production private keys here.
68
 
69
  ### 2) Start a session
70
  Go to **Start Session** → **Start New Session**.
71
- Copy the `session_id`.
72
 
73
  ### 3) Record events
74
  Go to **Record Event** and append events as they occur.
@@ -85,16 +91,16 @@ Go to **Timeline** → **Load timeline**.
85
  ### 5) Verify
86
  Go to **Verify Session** → **Verify**.
87
 
88
- Enable Require signatures only if you signed every event.
89
 
90
  ### 6) Finalise + Export
91
  Go to **Finalise + Export**:
92
- - **Finalise session** creates a session anchor.
93
  - **Export session bundle** produces the ZIP proof bundle.
94
 
95
  ### 7) Import bundle (third-party verification)
96
  Go to **Import Bundle**, upload `rft_flight_bundle_*.zip`, and verify.
97
- If you want to retain verified sessions, tick **Store imported events**.
98
 
99
  ---
100
 
@@ -113,7 +119,57 @@ If you want to retain verified sessions, tick **Store imported events**.
113
  "payload": { "tool": "search", "input": { "q": "…" } },
114
  "meta": { "model_id": "audit-demo", "run_mode": "deterministic" },
115
  "event_hash_sha256": "…",
116
- "signature_ed25519": "…" // optional
 
 
 
 
 
 
 
 
 
 
 
 
117
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
 
 
119
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
10
  license: other
11
  short_description: Tamper-evident, hash-chained event logging for AI/agent runs
12
  ---
13
+ # RFT Agent Flight Recorder — Black Box Trace + Third-Party Verification
14
 
15
  A proof-first flight recorder for AI/agent runs. This Space writes an **append-only, hash-chained event log** so you can verify **what happened, when it happened, and what triggered it**—without taking anyone’s word for it.
16
 
17
+ It’s designed to be boringly audit-friendly: **canonical JSON hashing**, optional **Ed25519 signatures**, **session verification**, and **exportable proof bundles** that third parties can check.
18
 
19
  ---
20
 
21
  ## What this Space does
22
 
23
  ### ✅ Records a tamper-evident timeline
24
+ Each action becomes an **event** (one JSON object per line) written to `flightlog.jsonl`:
25
 
26
  - `prompt`
27
  - `output`
 
35
  Every event includes:
36
 
37
  - `seq` (monotonic step number)
38
+ - `ts_utc` (UTC timestamp)
39
  - `prev_event_hash_sha256` (links to previous event)
40
  - `event_hash_sha256` (hash of this event)
41
  - optional `signature_ed25519` (Ed25519 signature)
42
 
43
  If any event is edited, removed, or reordered, verification fails.
44
 
45
+ ### ✅ Concurrency-safe writes (public Space reality)
46
+ Multiple users can click around at the same time. The log is protected with a **file lock** so “two tabs / two users” don’t corrupt the chain.
47
+
48
+ ### ✅ Refuses writes after finalisation
49
+ Once a session records `session_end`, the recorder **refuses any further writes** to that session. No silent “post-hoc edits”.
50
+
51
  ### ✅ Verifies sessions end-to-end
52
+ The verifier recomputes hashes and confirms the chain is intact. Optionally, it can require a valid signature on every event (only enable this if you signed every event).
53
 
54
  ### ✅ Exports proof bundles
55
  Exports `rft_flight_bundle_<session_id>.zip` containing:
56
 
57
+ - `<session_id>_events.jsonl` (the full session timeline)
58
+ - `<session_id>_verify_report.txt` (human-readable verification report)
59
 
60
  ### ✅ Imports and verifies third-party bundles
61
  Upload a bundle and verify it locally. Optionally store PASSed events into your local `flightlog.jsonl`.
62
 
63
  ---
64
 
65
+ ## How to use (step-by-step)
66
 
67
  ### 1) Generate keys (optional)
68
  Go to **Keys** → **Generate Keypair**.
 
70
  - **Private key** signs events (keep it private).
71
  - **Public key** verifies signatures (safe to share).
72
 
73
+ **Public demo note:** don’t paste production private keys here.
74
 
75
  ### 2) Start a session
76
  Go to **Start Session** → **Start New Session**.
77
+ Copy the `session_id` (the UI fans it out across tabs).
78
 
79
  ### 3) Record events
80
  Go to **Record Event** and append events as they occur.
 
91
  ### 5) Verify
92
  Go to **Verify Session** → **Verify**.
93
 
94
+ Enable **Require signatures** only if you signed every event you expect to verify.
95
 
96
  ### 6) Finalise + Export
97
  Go to **Finalise + Export**:
98
+ - **Finalise session** appends `session_end` with a **session anchor**.
99
  - **Export session bundle** produces the ZIP proof bundle.
100
 
101
  ### 7) Import bundle (third-party verification)
102
  Go to **Import Bundle**, upload `rft_flight_bundle_*.zip`, and verify.
103
+ If you want to retain verified sessions, tick **Store imported events** (only stores on PASS).
104
 
105
  ---
106
 
 
119
  "payload": { "tool": "search", "input": { "q": "…" } },
120
  "meta": { "model_id": "audit-demo", "run_mode": "deterministic" },
121
  "event_hash_sha256": "…",
122
+ "signature_ed25519": "…"
123
+ }
124
+ Session anchor (what finalisation commits to)
125
+
126
+ Finalisation creates an anchor that describes the pre-end chain (so it doesn’t depend on itself):
127
+ {
128
+ "spec": "rft-flight-session-root-v0",
129
+ "session_id": "…",
130
+ "first_event_hash_sha256": "…",
131
+ "last_event_hash_sha256": "…",
132
+ "event_count": 42,
133
+ "root_hash_sha256": "…",
134
+ "signature_ed25519": "…"
135
  }
136
+ Brutal tests (included)
137
+
138
+ This repo includes brutal_test.py with two hard tests:
139
+
140
+ Two-tab spam test: concurrent writers attempt to append hundreds of events; the session must still verify PASS.
141
+
142
+ Tamper ZIP test: modifies an exported event payload without updating hashes; import verification must FAIL.
143
+
144
+ Run locally:
145
+
146
+ python brutal_test.py
147
+
148
+ Expected:
149
+
150
+ both tests PASS
151
+
152
+ tampered bundle fails verification as intended
153
+
154
+ Security / limitations (read this)
155
+
156
+ This Space is a public demo. Treat anything you paste as public.
157
+
158
+ The log file is shared by all users of the Space instance.
159
+
160
+ Signatures prove authorship by a key, not “truth”. If you sign lies, you still signed lies—this tool proves integrity and provenance, not honesty.
161
+
162
+ Files
163
+
164
+ app.py — Gradio UI
165
+
166
+ rft_flightrecorder.py — recorder + verification library
167
+
168
+ brutal_test.py — stress + tamper tests
169
+
170
+ flightlog.jsonl — append-only log (created at runtime)
171
+
172
+ licence
173
 
174
+ ::contentReference[oaicite:0]{index=0}
175
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference