git-ots/AGENTS.md

1.7 KiB

AI Agent Instructions

Quick reference for AI agents installing OpenTimestamp hooks.

When to Use

Use this skill when the user wants to:

  • Add tamper-evident timestamps to git commits
  • Create cryptographic proof of commit history
  • Anchor commits to Bitcoin blockchain via OpenTimestamp

Self-contained hooks - No external dependencies:

# 1. Install prerequisites
pipx install opentimestamps-client

# 2. Install hooks (single command)
./hooks/install.sh .

# 3. Commit proofs to repository
git add .ots/ .gitignore
git commit -m "Add OpenTimestamp proofs for commit history"

Installation (Manual)

Copy hook files directly:

cp hooks/post-commit .git/hooks/
cp hooks/pre-commit .git/hooks/
chmod +x .git/hooks/post-commit .git/hooks/pre-commit

.gitignore:

.ots/.attestation-cache

Key Files

File Purpose Version?
generate-proof.sh Creates proof for commit Yes
backfill-proofs.sh Upgrades all historical proofs Yes
install-ots-hook.sh Installs both hooks Yes
.ots/*.ots Binary proofs Yes
.ots/commit-chain.txt Commit chain Yes
.ots/.attestation-cache Local cache No

Verification

# Check if proof is attested
ots info .ots/<commit-hash>.ots | grep -c "PendingAttestation"
# 0 = attested, >0 = pending

# Verify proof
ots verify .ots/<commit-hash>.ots

Notes

  • Proofs take ~10 min to become Bitcoin-attested
  • Cache avoids redundant calendar calls (1-hour validity)
  • Pre-commit backfill adds ~10-15s to commit time
  • Safe to commit .ots/ directory (binary proofs are small: ~500B each)