Skip to content

Commit 72346f2

Browse files
docs: update readme
1 parent 7a692a0 commit 72346f2

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,26 @@ Each entry includes: timestamp, contract name, rules applied, rules failed, fail
193193

194194
---
195195

196+
## Trend analysis
197+
198+
`ContractTrendAnalyzer` reads an existing JSONL audit log and computes per-contract pass-rate trends across workflow runs. Use it to detect reliability regressions before they become incidents.
199+
200+
```python
201+
from pathlib import Path
202+
from gateframe.audit.trend import ContractTrendAnalyzer
203+
204+
analyzer = ContractTrendAnalyzer(Path("audit.jsonl"), window=20)
205+
report = analyzer.analyze()
206+
207+
if report.any_regression:
208+
for ct in report.regressions:
209+
print(f"{ct.contract_name}: {ct.direction} (slope={ct.slope:.4f})")
210+
```
211+
212+
The `window` parameter controls how many most-recent workflow runs are included. A contract is flagged as regressing when its pass-rate slope falls below `-0.02` (two percentage points per run) by default.
213+
214+
---
215+
196216
## When to use gateframe
197217

198218
Use it when:
@@ -243,6 +263,9 @@ gateframe inspect contracts.py
243263

244264
# Replay an audit log
245265
gateframe replay audit.jsonl
266+
267+
# Detect pass-rate regressions across workflow runs
268+
gateframe trend audit.jsonl --window 20
246269
```
247270

248271
---

0 commit comments

Comments
 (0)