Metadata-Version: 2.5
Name: fugacity
Version: 0.1.0
Summary: Agent Flight Recorder: tamper-evident records of AI agent actions (early development)
Author: Cody Hickerson
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: agents,ai,audit,insurance,logging,tamper-evident
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Security
Classifier: Topic :: System :: Logging
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# Fugacity

**Agent Flight Recorder: tamper evident records of what AI agents actually do.**

> Status: v0.1.0, alpha. The record format follows the draft spec in [docs/spec.md](docs/spec.md) (AFR-ES-001) and may still change.

When an AI agent buys something, signs something, or moves money, someone eventually asks: what happened, and who is responsible? Fugacity records every action an agent takes in a hash-chained log that no one can quietly edit afterward, including the people who run the agent.

## Quick start

Requires Python 3.10 or later. There are no other dependencies.

```
git clone https://github.com/TheQuantumCowboy/fugacity.git
cd fugacity
pip install .
python examples/tamper_demo.py
```

If you only want the library and the `fugacity verify` command, `pip install fugacity` is enough. The examples live in the repository, not in the package.

The demo records a simulated agent buying a laptop for $412.50 (the worked session in Appendix C of the spec), saves the record's head hash, then tampers with copies of the record in three acts. In act 1, someone changes the payment to $41.25; the hash chain breaks and the limit checks no longer match the amount, so `verify` fails. In act 2, a more careful attacker changes the agreed condition grade from A to C and then recomputes every hash, and the file passes `verify` on its own: a file can't vouch for itself against someone who can rewrite all of it. In act 3, the same rewritten file is checked against the head hash saved when the session ended, which seals the whole record, and the rewrite is caught.

To see the full purchase record, event by event, run `python examples/appendix_c.py`.

To check any session file:

```
fugacity verify session.jsonl
fugacity verify session.jsonl --profile profile.json --expect-head sha256:...
```

## What v0.1.0 does

- **Agent profiles:** declare the pinned model version, tools, and hard limits an agent runs under. Any change produces a new profile ID.
- **Event chain:** every tool call, external input, approval, commitment, and payment, each one hashing the last, written as JSON Lines.
- **Limit checks:** spending caps and approval thresholds enforced in code, outside the model. Every check is recorded, and a failed check blocks the action.
- **Verification:** `fugacity verify` checks the schema, the sequence, the hash chain, the limit checks, and the profile, and prints pass or fail for each.

## Planned

- Ed25519 signatures on events and profiles
- Anchoring head hashes to a public transparency log (Sigstore Rekor, RFC 3161)
- Encryption and redaction of payloads
- The counterparty handshake, an MCP proxy, and framework integrations

## Why "Fugacity"

In thermodynamics, fugacity measures how far a real system strays from ideal behavior. This project measures how far a real agent strays from what it was authorized to do.

## License

Apache 2.0
