Briefcase Core
The core Rust library for Briefcase AI — high-performance AI observability, replay, and decision tracking.
Features
- AI Decision Tracking — Capture inputs, outputs, and context for every AI decision
- Deterministic Replay — Reproduce AI decisions exactly with full context preservation
- Drift Detection — Monitor model performance and behavior changes
- Cost Calculation — Track and estimate model usage costs
- Data Sanitization — Built-in PII redaction with regex patterns
- Token Counting — Estimate token usage via tiktoken
- Flexible Storage — SQLite backend with VCS provider protocol for custom backends
Installation
[]
= "3.0"
Quick Start
use *;
use json;
async
Feature Flags
| Feature | Default | Description |
|---|---|---|
recording |
Yes | Baseline decision capture |
async |
Yes | Tokio async runtime support |
storage |
Yes | SQLite storage backend |
replay |
No | Deterministic replay engine |
drift |
No | Drift detection + cost calculation |
sanitize |
No | PII sanitization |
otel |
No | OpenTelemetry instrumentation |
tokens |
No | Token counting (tiktoken) |
networking |
No | HTTP client (reqwest) |
compression |
No | zstd + flate2 compression |
vcs-storage |
No | VCS provider protocol |
Storage
// In-memory
let storage = in_memory?;
// File-based
let storage = new?;
Custom Storage
Implement the StorageBackend trait:
use StorageBackend;
use async_trait;
;
Custom VCS Provider
Implement the VcsProvider trait for version-controlled storage:
use ;
// Implement VcsProvider, then wrap:
let backend = new;
License
Apache-2.0 — see LICENSE file for details.