skills/safety-guardrails/SKILL.md
# Safety Guardrails — Reference ## When this skill activates This skill is the canonical reference for PDLC's safety model. It is consulted by: - The PreToolUse guardrails hook (`hooks/pdlc-guardrails.js`) on every Bash, Edit, and Write tool call. - The `/override` command, when a user wants to bypass the deploy-before-Operation block. - Every other PDLC skill, when surfacing intent before a potentially-dangerous action (see "Agent norms" below). When in doubt about what the guardrails hook
npx skillsauth add pdlc-os/pdlc skills/safety-guardrailsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill is the canonical reference for PDLC's safety model. It is consulted by:
hooks/pdlc-guardrails.js) on every Bash, Edit, and Write tool call./override command, when a user wants to bypass the deploy-before-Operation block.When in doubt about what the guardrails hook will do — check this document first.
There are exactly two enforced rules.
A Bash command that matches a known deploy pattern is blocked when docs/pdlc/memory/STATE.md says the project's current phase is anything other than Operation.
Trigger patterns: fly deploy, vercel deploy, npm run deploy, yarn deploy, pnpm deploy, heroku ... deploy, aws ... deploy, gcloud ... deploy, docker ... push, kubectl apply, terraform apply, pulumi up, cdk deploy, eb deploy, sam deploy, serverless deploy.
Block message: the user sees a red banner naming the blocked command and the override path.
Bypass: run /override "<the blocked command>". The override prompts for a single confirmation, executes the command, and records the bypass to docs/pdlc/memory/DECISIONS.md as a new ADR.
Fallback: if STATE.md is missing or doesn't contain a ## Current Phase block, the hook gives benefit of the doubt and allows the command. This avoids breaking fresh repos that haven't run /setup yet.
Why this rule exists: PDLC's Ship flow runs smoke tests, UX Verify, security checks, and writes deployment provenance to DEPLOYMENTS.md and the episode file. A direct fly deploy from the terminal skips all of that. The block nudges the user toward /ship while leaving an explicit escape hatch for emergencies.
Any direct Edit, Write, or Bash-redirection (sed / awk / tee / mv / cp / cat / > / >>) targeting a file under docs/pdlc/memory/ whose basename is one of:
CONSTITUTION.mdDECISIONS.mdSTATE.mdROADMAP.mdINTENT.mdOVERVIEW.mdCHANGELOG.md…emits a passive log line of the form:
⚠️ Logged: <ToolName> on PDLC memory file <basename>
The action proceeds normally — there is no halt, no confirmation prompt, no override required. The log surfaces in the tool-call transcript so /diagnose can reconcile unexpected drift later.
Scoped to memory path: the rule only fires when the file path contains docs/pdlc/memory/. Files merely named CONSTITUTION.md elsewhere on disk (test fixtures, unrelated user notes) are not flagged.
The hook checks for <cwd>/docs/pdlc/memory/ at startup. If it doesn't exist, the hook returns allow immediately. Sessions in non-PDLC projects pay roughly 1ms per tool call and receive no enforcement.
The deploy-pattern regex would false-positive on a git commit -m "added gcloud deploy step to docs" or a gh release create --notes "...terraform apply..." — the commit body legitimately describes a deploy without executing it. To avoid this, the following outer commands short-circuit the deploy check:
git commitgit tag -m / git tag -agh release ... / gh pr ... / gh issue ...gh api ...The memory-file logging rule is not short-circuited — these commands legitimately mention memory file names in commit bodies, but they don't write to those files via the bash command itself, so the file-write regex won't match.
When docs/pdlc/memory/pdlc-night-shift.json has active: true, the deploy-gate hard block is downgraded to a passive log:
⚠️ [night-shift bypass] Deploy command would normally be blocked outside Operation phase — action allowed: <command>
The action proceeds. Production deploys are still blocked by the three-layer ban in hooks/pdlc-night-shift.js — that ban does not route through this guardrails hook.
Why the bypass exists: the deploy block normally prompts for /override, which requires a human at the keyboard. In /night-shift mode there is no human; halting the hook would turn a safety mechanism into a hang. Runtime safety is enforced by three independent layers, not by this hook:
abort_conditions. The Completion Contract drafted at Step ② enumerates abort triggers the run owns: Phantom Critical security findings, P0 UX findings from Ship Verify Step 11.5, smoke-test failures, merge conflicts, stagnation, wall-clock/token caps. These are detected by the driver and the evaluator.hooks/pdlc-night-shift.js. None of that flow routes through the PreToolUse guardrails.Every PDLC agent (Pulse, Neo, Atlas, Phantom, Echo, Bolt, Muse, Jarvis, Sentinel) should pause and surface intent before taking any of the following actions. These are not blocked by the guardrails hook. Claude Code's native permission system prompts on most of them in default mode. In bypassPermissions mode (superclaude, /night-shift), agents are expected to exercise judgment.
main or masterrm -rf outside the project directory, or anywhere with files not on the current branchgit reset --hard on a branch with un-pushed workDROP TABLE or any destructive DDL without a migration file already committednpm audit or equivalent)"Surface intent" means: print one line stating what you're about to do, then proceed. In bypassPermissions mode this is the only check standing between the action and execution, so the line matters — make it specific. ("About to force-push origin/main to overwrite the merge conflict at commit abc123" beats "force-pushing now.")
The /override command (alias for /override) bypasses the deploy gate. It is the only hook-enforced rule that has an override path.
The protocol is in skills/override/SKILL.md. Summary:
/override "<the blocked command>".DECISIONS.md and executes the command.The override is permanently logged in DECISIONS.md. It cannot be hidden, deleted, or batch-confirmed.
STATE.md phase, not by context or intent. A fly deploy from a Construction-phase project is blocked even if the user says "it's fine."/decide writing to DECISIONS.md). The log is descriptive, not punitive./diagnose reconciles them against expected PDLC command activity.STATE.md (corrupt, malformed, missing ## Current Phase header), it defaults to "Operation" — benefit of the doubt. The trade-off: fresh / broken repos don't break, at the cost of a missed block in a corrupt-state edge case./override./night-shift, the deploy gate does not block — see the Night-shift bypass section above. Every bypassed event is logged with [night-shift bypass] so the morning audit can see what fired.PDLC v2.x originally enforced a three-tier system (hard block / pause-and-confirm / logged warning) covering force-push, rm -rf, git reset --hard, prod DB writes, external API write calls, DROP TABLE, and protected-file edits. The trim that produced the current model removed everything Claude Code's native permission system already handles, leaving only the rules that encode genuinely-PDLC-specific semantics (phase-gated deploys, memory-file drift detection).
The agent-norms list above is the replacement for the dropped hook rules: same coverage, enforced by agent discipline + Claude Code permissions rather than a regex hook. This avoids false-positives on commit messages, test fixtures, and non-PDLC sessions, and keeps the hook small enough to read in one sitting.
data-ai
Run a feature autonomously from approved-PRD to shipped, evaluated by a per-turn Sentinel hook. Requires bypass-permissions mode and Agent Teams mode.
development
# Variant Convergence **Topic slug:** `variant-convergence` **Triggers:** - **Inception path — Brainstorm Design Step 10.7:** after Step 10.6 (Design-Laws Audit) completes, before Step 11 (PRD design-doc link updates) and the Step 12 design approval gate. Variants are HTML mockups Muse generates. - **Construction path — Build Review Step 12.5:** after Party Review (Step 12) writes its review file and Muse appends the *As-Built Audit* section to `ux-review.md`, before the Step 13 Review approval
data-ai
Force-release a stuck roadmap-level feature claim (admin command)
devops
Bypass the deploy-before-Operation guardrails block with a single confirmation