Receipt Pattern banner
vinceglakas vinceglakas

Receipt Pattern

AI community

Description

The Receipt Pattern — auditable AI agent actions in 10 lines. Every agent action leaves a receipt.

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

The Receipt Pattern

**Agents can't be trusted because they don't leave receipts.**

You let an AI agent loose on your codebase. It ran for 4 minutes. It says "Done!" You ask what it did. It gives you a vague summary. You check git diff — 47 files changed. Some of them you didn't ask for. One of them is your production config.

Sound familiar?

The Problem

AI agents are black boxes. They do things — write files, call APIs, modify databases, send emails — and you have no structured record of what happened. Logs exist, but they're streams of consciousness, not actionable records.

When something breaks at 2am, you need to know: what did the agent do, in what order, and can I undo it?

The Solution

**After every significant action, the agent writes a receipt.** A structured JSON file that records exactly what happened, when, and whether it can be rolled back.

That's it. That's the pattern.

{
  "id": "rcpt_1709641200_a3f8b2",
  "agentId": "claude-code",
  "sessionId": "sess_20260305_143200",
  "timestamp": "2026-03-05T14:35:22.847Z",
  "trigger": "manual",
  "status": "completed",
  "durationMs": 12847,
  "actions": [
    {
      "sequence": 1,
      "type": "file:write",
      "target": "src/auth/middleware.ts",
      "summary": "Added rate limiting middleware — 100 req/min per IP",
      "status": "success",
      "isRollbackEligible": true,
      "durationMs": 340,
      "timestamp": "2026-03-05T14:35:10.102Z"
    },
    {
      "sequence": 2,
      "type": "file:write",
      "target": "src/auth/middleware.test.ts",
      "summary": "Added 6 tests for rate limiting edge cases",
      "status": "success",
      "isRollbackEligible": true,
      "durationMs": 520,
      "timestamp": "2026-03-05T14:35:15.430Z"
    },
    {
      "sequence": 3,
      "type": "shell:exec",
      "target": "npm test -- --grep 'rate limit'",
      "summary": "Ran rate limiting tests — 6/6 passed",
      "status": "success",
      "isRollbackEligible": false,
      "dura