Skip to content

Receipt Pattern

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

Install

$git clone https://github.com/vinceglakas/receipt-pattern

Install command taken from the project's README or registry entry. Always review code before running it.

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,
      "durationMs": 4200,
      "timestamp": "2026-03-05T14:35:18.700Z"
    }
  ],
  "anomalies": [],
  "rollbackAvailable": true,
  "sdkVersion": "receipt-pattern/1.0.0"
}

You open the receipts folder. You see exactly what happened. You can audit it. You can roll it back. You can sleep at night.

Quick Start

1. Install the skill

Claude Code / Codex — Drop SKILL.md into your project root or .claude/skills/:

curl -o .claude/skills/receipt-pattern.md https://raw.githubusercontent.com/vinceglakas/receipt-pattern/main/SKILL.md

OpenClaw — Install as a skill:

openclaw skill install https://github.com/vinceglakas/receipt-pattern

Any agent — Just add this to your system prompt:

After every significant action (file write, API call, database change, deployment), write a receipt to receipts/ following the schema in SKILL.md.

2. Let your agent work

The agent will now write a receipt after every session. Receipts land in:

receipts/
  2026-03-05-14-35-22-file-write.json
  2026-03-05-15-12-08-api-call.json
  2026-03-05-16-44-31-deploy.json

3. Review

# What did the agent do today?
ls receipts/2026-03-05*

# Any failures?
grep -l '"status": "failed"' receipts/*.json

# Any anomalies?
grep -l '"anomalies": \[{' receipts/*.json

What Counts as a Receipt-Worthy Action

Similar plugs

Turn any codebase, with its docs, SQL schemas, configs, and PDFs, into a queryable knowledge graph. A /graphify skill for Claude Code, Cursor, Codex, and Gemini CLI: local…

Why use many token when few token do trick. Viral skill + proxy for coding agents that cuts 65% of tokens by talking like a caveman.

The 1st Collaborative AI Design Agent Workspace. Local-first and open source. Create prototypes, websites, apps, dashboards, presentations, images, and videos with your team…

Explore related