Claude Code Safety: Stop Your AI Agent from Destroying Your Work

Claude Code Safety: Stop Your AI Agent from Destroying Your Work

yurukusa
This is a sample of the book's content.Buy on Leanpub

Table of Contents

Claude Code Safety: Stop Your AI Agent from Destroying Your Work

  • Claude Code Safety
    • Who this is for
    • What’s inside
    • How to use it
    • A note on accuracy and honesty
  • Chapter 1 — When your agent destroys your database
    • 1.1 What actually happened
    • 1.2 Why an autonomous agent reaches for the destructive flag
    • 1.3 Why a note in CLAUDE.md is not the control you need
    • 1.4 The block — a hook that runs before the command does
    • 1.5 If it already ran — the recovery order
    • 1.6 The one-paragraph version
  • Chapter 2 — When your agent deletes your files
    • 2.1 What actually happens
    • 2.2 Why an agent does this
    • 2.3 The block — stop the fatal target, recycle the rest
    • 2.4 If it already ran — the recovery order
    • 2.5 The one-paragraph version
  • Chapter 3 — When you lose your git history
    • 3.1 What actually happens
    • 3.2 Why an agent does this
    • 3.3 The shield — save first, block the irreversible
    • 3.4 If it already ran — the recovery order
    • 3.5 The one-paragraph version
  • Chapter 4 — When /rewind eats your code
    • 4.1 What actually happens
    • 4.2 What /rewind cannot touch — your recovery map
    • 4.3 If it already happened — the recovery order
    • 4.4 Prevention — and why no hook can confirm the menu
    • 4.5 The one-paragraph version
  • Chapter 5 — Why a written rule is not a control point, and a hook is
    • 5.1 What a written rule does, and what it cannot promise
    • 5.2 Why a clear instruction still gets ignored
    • 5.3 What a hook is, and why it cannot be talked out of
    • 5.4 Test your hook — or you have a paragraph with extra steps
    • 5.5 The one-paragraph version
  • Chapter 6 — Building your safety net
    • 6.1 The complete guard — one block, paste once
    • 6.2 What it covers, and what it does not
    • 6.3 The second layer — backups and checkpoints
    • 6.4 The maintained set — install in one line
    • 6.5 The discipline, in one line
  • Appendix — The incident catalog
    • Database destruction
    • File destruction
    • /rewind and checkpoint data loss
    • Widely reported industry incident
    • How to read this table
    • Where these issues stand now
  • Appendix B: The test set, in full
Claude Code Safety: Stop Your AI Agent from Destroying Your Work/Chapter 6 — Building your safety net

Chapter 6 — Building your safety net

https://leanpub.com/claude-code-safety

6.1 The complete guard — one block, paste once

https://leanpub.com/claude-code-safety

6.2 What it covers, and what it does not

https://leanpub.com/claude-code-safety

What happened when I fired it, in both directions

https://leanpub.com/claude-code-safety

What it still does not catch, with the exact commands

https://leanpub.com/claude-code-safety

The line that decides whether any of this runs

https://leanpub.com/claude-code-safety

6.3 The second layer — backups and checkpoints

https://leanpub.com/claude-code-safety

6.4 The maintained set — install in one line

https://leanpub.com/claude-code-safety

6.5 The discipline, in one line

https://leanpub.com/claude-code-safety

Previous

Chapter 5 — Why a written rule is not a control point, and a hook is

Up next

Appendix — The incident catalog

In this chapter

  • Chapter 6 — Building your safety net
  • 6.1 The complete guard — one block, paste once
  • 6.2 What it covers, and what it does not
  • 6.3 The second layer — backups and checkpoints
  • 6.4 The maintained set — install in one line
  • 6.5 The discipline, in one line