Learning HubACFS Academy
Progress
0%
0 of 3333 remaining
  • 1
    Welcome & Overview5 min
  • 2
    Linux Navigation8 min
  • 3
    SSH & Persistence6 min
  • 4
    tmux Basics7 min
  • 5
    Git Essentials10 min
  • 6
    GitHub CLI8 min
  • 7
    Agent Commands10 min
  • 8
    NTM Command Center8 min
  • 9
    NTM Prompt Palette6 min
  • 10
    The Flywheel Loop10 min
  • 11
    Keeping Updated4 min
  • 12
    UBS: Code Quality Guardrails8 min
  • 13
    Agent Mail Coordination10 min
  • 14
    CASS: Learning from History8 min
  • 15
    The Memory System8 min
  • 16
    Beads: Issue Tracking8 min
  • 17
    Safety Tools: SLB & CAAM6 min
  • 18
    The Art of Agent Direction12 min
  • 19
    Case Study: cass-memory15 min
  • 20
    Case Study: SLB12 min
  • 21
    RU: Multi-Repo Mastery10 min
  • 22
    DCG: Pre-Execution Safety8 min
    NOW
  • 23
    Meta Skill: Local Skills10 min
  • 24
    SRPS: System Protection8 min
  • 25
    JFP: Prompt Library6 min
  • 26
    APR: Automated Plan Reviser8 min
  • 27
    PT: Process Triage6 min
  • 28
    XF: X Archive Search6 min
  • 29
    RCH: Remote Compilation8 min
  • 30
    WA: WezTerm Automata8 min
  • 31
    Brenner Bot: Research10 min
  • 32
    GIIL: Cloud Image Downloads6 min
  • 33
    S2P: Source to Prompt6 min
Back to Home
Back
22/33
Lesson 22
8 min

DCG: Pre-Execution Safety

Block dangerous commands before they cause damage

New to ACFS?

Complete the setup wizard first to get the most from these lessons.

Go to Choose Your OS
Goal

Use DCG to block destructive commands before they do damage.

What Is DCG?

DCG (Destructive Command Guard) is a Claude Code hook that blocks dangerous commands before they execute. It protects your repos from hard resets, recursive deletes, destructive database commands, and more.

Think of it as a safety interlock: if a command looks destructive, DCG stops it and suggests a safer alternative.

Pre-Execution Blocking

Stops damage before it happens

Protection Packs

Git, filesystem, database, cloud, and more

Allow-Once Codes

Explicit bypass when you know it is safe

Fail-Open Design

Errors never block your workflow

How DCG Intercepts Commands

DCG runs as a PreToolUse hook inside Claude Code. Every command is checked against a set of rules before it runs.

bash
# Example: test a command before running it
$ dcg test "git reset --hard" --explain
> BLOCKED: git.reset.hard
> Why: hard reset discards uncommitted work
> Safer: git restore --staged .
Warning
If DCG blocks a command, slow down and read the explanation. It is showing you the dangerous part and a safer path.

Essential Commands

Check if a command would be blocked
Explain why a command is unsafe
List available protection packs
Register the Claude Code hook
Remove the hook (use --purge for full removal)
Bypass for a single approved command
Check installation and hook status

Uninstalling DCG

If you need to remove DCG, you can uninstall the hook and optionally purge the binary and config. You can always re-enable it later with dcg install.

bash
# Remove hook only (keeps dcg installed)
$ dcg uninstall
# Full removal (hook + binary + config)
$ dcg uninstall --purge
# Verify removal
$ dcg doctor
$ claude /hooks
Note
If you still want command safety but fewer blocks, prefer adjusting packs instead of uninstalling.

Protection Packs

Packs let you enable or disable rules based on your workflow. Keep the ones you need to avoid false positives.

config.toml
# ~/.config/dcg/config.toml
[packs]
enabled = ["git", "filesystem", "database.postgresql", "containers.docker"]
Note
Start with git and filesystem packs. Add database or cloud packs only when you use those tools.

When You See a Block

A block is a warning, not a dead end. Use it as a checkpoint:

  • Read the explanation carefully.
  • Prefer the safer alternative when possible.
  • Use allow-once only if you are confident.
  • Document the decision in your commit or notes.

DCG + SLB

DCG blocks obvious destructive commands instantly. SLB handles contextual risk that needs human approval. Together, they form a layered safety system.

Ready to level up?

Mark complete to track your learning progress.

Previous
RU: Multi-Repo Mastery
Next
Meta Skill: Local Skills