Back to Portfolio
Self-Directed R&D — 5D Method Validation
5D Detect in Practice: Pre-Execution Guardrails for AI Coding Agents
Creator & Sole Developer|
June 2026
43/43 passing (23 BLOCK + 20 ALLOW)
Test cases
39
Repos deployed
0
False-positive complaints
0
External dependencies
The Challenge
AI coding agents execute shell commands with zero pre-execution checks. Some commands are irreversible — file overwrites, recursive deletes, force-pushes, production database drops. System prompts are suggestions. Post-execution audits are too late.
The Approach
Applied the 5D Detect stage to build a deterministic PreToolUse hook for Claude Code. Pure regex pattern matching intercepts every shell command before execution and blocks irreversible operations. Four tiers of protection validated by a 43-case regression matrix where 47% of tests verify that safe commands pass through cleanly.
Key Learnings
- ALLOW tests are harder than BLOCK tests — false positives kill adoption faster than false negatives
- Escape hatches are a feature, not a bug — guards without overrides get circumvented in worse ways
- Deterministic regex beats probabilistic LLM for safety layers — boring and predictable is exactly what you want