npm package: @safetnsr/agent-receipt
Description: Human-readable receipts for agent sessions — audit every action your AI took
Author: safetnsr
Latest version: 0.1.1
Deprecated: merged into @safetnsr/vet — use: npx @safetnsr/vet receipt

# agent-receipt

Human-readable receipts for agent sessions — audit every action your AI took.

## Install

```bash
npx @safetnsr/agent-receipt
```

Or install globally:

```bash
npm install -g @safetnsr/agent-receipt
```

## Usage

```bash
# Generate receipt from latest Claude Code session
npx @safetnsr/agent-receipt

# Specify a session file
npx @safetnsr/agent-receipt --session ~/.claude/projects/myproject/abc123.jsonl

# Output as JSON (for agent pipelines)
npx @safetnsr/agent-receipt --json

# Save receipt to file
npx @safetnsr/agent-receipt --save receipts/

# Verify a receipt hasn't been tampered with
npx @safetnsr/agent-receipt --verify receipts/receipt.txt
```

### Sample Output

```
╔══════════════════════════════════════════════╗
║          AGENT SESSION RECEIPT               ║
╠══════════════════════════════════════════════╣
║ Session:  abc123def456...                    ║
║ Date:     2026-02-28 14:30:00 UTC            ║
║ Duration: 12m 34s                            ║
╠══════════════════════════════════════════════╣
║ FILES CREATED (1)                            ║
║   README.md                                  ║
║                                              ║
║ FILES MODIFIED (3)                           ║
║   src/index.ts                               ║
║   package.json                               ║
║   tsconfig.json                              ║
║                                              ║
║ COMMANDS RUN (2)                             ║
║   npm install express                        ║
║   npm test                                   ║
║                                              ║
║ URLS FETCHED (1)                             ║
║   https://api.example.com/data               ║
║                                              ║
║ PACKAGES INSTALLED (1)                       ║
║   express                                    ║
║                                              ║
║ FILES DELETED (0)                            ║
║   (none)                                     ║
╠══════════════════════════════════════════════╣
║ SHA256: a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4... ║
║ Verify: npx @safetnsr/agent-receipt          ║
║         --verify receipt.txt                 ║
╚══════════════════════════════════════════════╝
```

## Flags

| Flag | Description |
|------|-------------|
| `--session <path\|latest>` | Session file path or "latest" (default: latest) |
| `--json` | Output as JSON |
| `--md` | Output as Markdown |
| `--save <dir>` | Save receipt to directory |
| `--verify <file>` | Verify a receipt file's SHA256 integrity |
| `--help` | Show help |
| `--version` | Show version |

## Agent Interface (`--json`)

```json
{
  "actions": {
    "session_id": "abc123",
    "start_time": "2026-02-28T14:30:00Z",
    "end_time": "2026-02-28T14:42:34Z",
    "duration_seconds": 754,
    "files_modified": ["src/index.ts", "package.json"],
    "files_deleted": [],
    "files_created": ["README.md"],
    "commands_run": ["npm install express", "npm test"],
    "urls_fetched": ["https://api.example.com/data"],
    "packages_installed": ["express"]
  },
  "sha256": "a1b2c3d4...",
  "generated_at": "2026-02-28T14:45:00Z"
}
```

## How It Works

1. Reads Claude Code JSONL session logs (`~/.claude/projects/**/*.jsonl`)
2. Extracts all `tool_use` blocks from the session
3. Groups actions into categories: files created/modified/deleted, commands run, URLs fetched, packages installed
4. Renders a tamper-evident receipt with SHA256 hash
5. `--verify` re-computes the hash to detect modifications

## Pair With

- [`@safetnsr/vibe-check`](https://github.com/safetnsr/vibe-check) — rate your codebase vibes
- [`@safetnsr/ai-ready`](https://github.com/safetnsr/ai-ready) — AI-compatibility score for your code
- [`@safetnsr/pinch`](https://github.com/safetnsr/pinch) — track AI API costs

## License

MIT