मुख्य सामग्री पर जाएं
failproofai 30 built-in policies के साथ आता है जो common agent failure modes को catch करते हैं। प्रत्येक policy एक specific hook event type और tool name पर fire होती है। नौ policies parameters स्वीकार करती हैं जो आपको code लिखे बिना उनके behavior को tune करने देती हैं। चार workflow policies एक commit → push → PR → CI pipeline को enforce करती हैं जिसे Claude को stop करने से पहले पूरा करना होता है।

Overview

Policies को categories में grouped किया गया है:
CategoryPoliciesHook type
Dangerous commandsblock-sudo, block-rm-rf, block-curl-pipe-sh, block-failproofai-commandsPreToolUse
Secrets (sanitizers)sanitize-jwt, sanitize-api-keys, sanitize-connection-strings, sanitize-private-key-content, sanitize-bearer-tokensPostToolUse
Environmentblock-env-files, protect-env-varsPreToolUse
File accessblock-read-outside-cwd, block-secrets-writePreToolUse
Gitblock-push-master, block-work-on-main, block-force-push, warn-git-amend, warn-git-stash-drop, warn-all-files-stagedPreToolUse
Databasewarn-destructive-sql, warn-schema-alterationPreToolUse
Warningswarn-large-file-write, warn-package-publish, warn-background-process, warn-global-package-installPreToolUse
Workflowrequire-commit-before-stop, require-push-before-stop, require-pr-before-stop, require-ci-green-before-stopStop
  • block- — agent को proceed करने से रोकता है।
  • warn- — agent को additional context देता है ताकि वह self-correct कर सके।
  • sanitize- — tool output से sensitive data को scrub करता है इससे पहले कि agent को दिया जाए।
  • require- — Stop event को block करता है जब तक conditions पूरी न हो जाएं।

हर policy policyParams में एक optional hint field को support करती है। Hint को deny या instruct message में append किया जाता है जो Claude देखता है, actionable guidance देते हुए बिना policy code को modify किए। Built-in, custom, और convention policies के साथ काम करता है। विस्तार के लिए Configuration → hint देखें।

Dangerous commands

Agents को उन operations से रोकें जो undo करने में मुश्किल हैं या host system को damage कर सकते हैं।

block-sudo

Event: PreToolUse (Bash)
Default: किसी भी sudo command को deny करता है।
Invocations को block करता है जिनमें sudo keyword शामिल होता है। Pattern matching को shell operator injection के through bypass को रोकने के लिए raw string पर नहीं, parsed command tokens पर किया जाता है। Parameters:
ParamTypeDefaultDescription
allowPatternsstring[][]Exact command prefixes जो permitted हैं। प्रत्येक entry को parsed argv tokens के against match किया जाता है।
Example:
{
  "policyParams": {
    "block-sudo": {
      "allowPatterns": ["sudo systemctl status", "sudo journalctl"]
    }
  }
}
इस config के साथ, sudo systemctl status nginx को allow किया जाता है, लेकिन sudo rm /etc/hosts को deny किया जाता है।
Patterns को raw command string पर नहीं, parsed tokens के against match किया जाता है। यह appended shell operators के through bypass को रोकता है (उदाहरण के लिए sudo systemctl status x; rm -rf / को sudo systemctl status * से match नहीं किया जाता)।

block-rm-rf

Event: PreToolUse (Bash)
Default: rm -rf, rm -fr, और similar recursive deletion forms को deny करता है।
Parameters:
ParamTypeDefaultDescription
allowPathsstring[][]Paths जो recursively delete करने के लिए safe हैं (जैसे /tmp)।
Example:
{
  "policyParams": {
    "block-rm-rf": {
      "allowPaths": ["/tmp", "/var/cache"]
    }
  }
}

block-curl-pipe-sh

Event: PreToolUse (Bash)
Default: curl <url> | bash, curl <url> | sh, wget <url> | bash, और similar patterns को deny करता है।
कोई parameters नहीं।

block-failproofai-commands

Event: PreToolUse (Bash)
Default: उन commands को deny करता है जो failproofai को uninstall या disable करेंगे (जैसे npm uninstall failproofai, failproofai policies --uninstall)।
कोई parameters नहीं।

Secrets (sanitizers)

Agents को अपने context या output में credentials leak करने से रोकें। Sanitizer policies PostToolUse events पर fire होती हैं। जब Claude एक Bash command run करता है, एक file read करता है, या कोई भी tool call करता है, ये policies output को inspect करती हैं इससे पहले कि वह Claude को return किया जाए। अगर secret pattern detect होता है, तो policy एक deny decision return करती है जो output को pass back होने से रोकता है।

sanitize-jwt

Event: PostToolUse (सभी tools)
Default: JWT tokens को redact करता है (तीन base64url segments को . से separated)।
कोई parameters नहीं।

sanitize-api-keys

Event: PostToolUse (सभी tools)
Default: Common API key formats को redact करता है: Anthropic (sk-ant-), OpenAI (sk-), GitHub PATs (ghp_), AWS access keys (AKIA), Stripe keys (sk_live_, sk_test_), और Google API keys (AIza)।
Parameters:
ParamTypeDefaultDescription
additionalPatterns{ regex: string; label: string }[][]Additional regex patterns को secrets मानने के लिए।
Example:
{
  "policyParams": {
    "sanitize-api-keys": {
      "additionalPatterns": [
        { "regex": "myco_[A-Za-z0-9]{32}", "label": "MyCo internal API key" },
        { "regex": "pat_[0-9a-f]{40}", "label": "Internal PAT" }
      ]
    }
  }
}

sanitize-connection-strings

Event: PostToolUse (सभी tools)
Default: Database connection strings को redact करता है जिनमें embedded credentials होते हैं (जैसे postgresql://user:password@host/db)।
कोई parameters नहीं।

sanitize-private-key-content

Event: PostToolUse (सभी tools)
Default: PEM blocks को redact करता है (-----BEGIN PRIVATE KEY-----, -----BEGIN RSA PRIVATE KEY-----, आदि)।
कोई parameters नहीं।

sanitize-bearer-tokens

Event: PostToolUse (सभी tools)
Default: Authorization: Bearer <token> headers को redact करता है जहां token 20 या उससे ज्यादा characters है।
कोई parameters नहीं।

Environment

Agents द्वारा sensitive environment configuration को read या expose किए जाने से बचाएं।

block-env-files

Event: PreToolUse (Bash, Read)
Default: .env files को read करने को deny करता है जैसे cat .env, .env को file path के रूप में Read tool calls, आदि।
.envrc या अन्य environment-adjacent files को block नहीं करता — केवल exactly .env नाम की files। कोई parameters नहीं।

protect-env-vars

Event: PreToolUse (Bash)
Default: उन commands को deny करता है जो environment variables को print करते हैं: printenv, env, echo $VAR
कोई parameters नहीं।

File access

Agents को project boundaries के अंदर काम करने और sensitive files से दूर रहने के लिए रखें।

block-read-outside-cwd

Event: PreToolUse (Read, Bash)
Default: Current working directory (project root) के बाहर files को read करने को deny करता है।
Parameters:
ParamTypeDefaultDescription
allowPathsstring[][]Absolute path prefixes जो permitted हैं भले ही cwd के बाहर हों।
Example:
{
  "policyParams": {
    "block-read-outside-cwd": {
      "allowPaths": ["/shared/data", "/opt/company/config"]
    }
  }
}

block-secrets-write

Event: PreToolUse (Write, Edit)
Default: Private keys और certificates के लिए commonly used files में writes को deny करता है: id_rsa, id_ed25519, *.key, *.pem, *.p12, *.pfx
Parameters:
ParamTypeDefaultDescription
additionalPatternsstring[][]Additional filename patterns (glob-style) को block करने के लिए।
Example:
{
  "policyParams": {
    "block-secrets-write": {
      "additionalPatterns": [".token", ".secret"]
    }
  }
}

Git

Accidental pushes, force-pushes, और branch mistakes को रोकें जो undo करने में मुश्किल हैं।

block-push-master

Event: PreToolUse (Bash)
Default: git push origin main और git push origin master को deny करता है।
Parameters:
ParamTypeDefaultDescription
protectedBranchesstring[]["main", "master"]Branch names जिन्हें directly push नहीं किया जा सकता।
Example:
{
  "policyParams": {
    "block-push-master": {
      "protectedBranches": ["main", "master", "release", "prod"]
    }
  }
}
सभी branches में push करने की allow करने के लिए (effectively इस policy को enabledPolicies से remove किए बिना disable करने के लिए), protectedBranches: [] set करें।

block-work-on-main

Event: PreToolUse (Bash)
Default: main या master branches को directly checkout करने को deny करता है।
Parameters:
ParamTypeDefaultDescription
protectedBranchesstring[]["main", "master"]Branch names जिन्हें directly checkout नहीं किया जा सकता।

block-force-push

Event: PreToolUse (Bash)
Default: git push --force और git push -f को deny करता है।
कोई policy-specific parameters नहीं। Cross-cutting hint का उपयोग करके alternatives suggest करें:
{
  "policyParams": {
    "block-force-push": {
      "hint": "अपने current HEAD से एक नई branch बनाएं (जैसे `git checkout -b <new-branch>`) और इसके बजाय उसे push करें।"
    }
  }
}

warn-git-amend

Event: PreToolUse (Bash)
Default: Claude को carefully proceed करने के लिए instruct करता है जब git commit --amend run करता है। Command को block नहीं करता।
कोई parameters नहीं।

warn-git-stash-drop

Event: PreToolUse (Bash)
Default: Claude को confirm करने के लिए instruct करता है git stash drop run करने से पहले। Command को block नहीं करता।
कोई parameters नहीं।

warn-all-files-staged

Event: PreToolUse (Bash)
Default: Claude को review करने के लिए instruct करता है कि वह क्या stage कर रहा है जब git add -A या git add . run करता है। Command को block नहीं करता।
कोई parameters नहीं।

Database

Destructive SQL operations को execute होने से पहले catch करें आपके database के against।

warn-destructive-sql

Event: PreToolUse (Bash)
Default: Claude को confirm करने के लिए instruct करता है DROP TABLE, DROP DATABASE, या DELETE (बिना WHERE clause के) containing SQL run करने से पहले।
कोई parameters नहीं।

warn-schema-alteration

Event: PreToolUse (Bash)
Default: Claude को confirm करने के लिए instruct करता है ALTER TABLE statements run करने से पहले।
कोई parameters नहीं।

Warnings

Agents को potentially risky लेकिन non-destructive operations से पहले extra context दें।

warn-large-file-write

Event: PreToolUse (Write)
Default: Claude को confirm करने के लिए instruct करता है 1024 KB से बड़ी files write करने से पहले।
Parameters:
ParamTypeDefaultDescription
thresholdKbnumber1024File size threshold kilobytes में जिसके ऊपर warning issue की जाती है।
Example:
{
  "policyParams": {
    "warn-large-file-write": {
      "thresholdKb": 256
    }
  }
}
Hook handler payloads पर 1 MB stdin limit को enforce करता है। इस policy को small content के साथ test करने के लिए, thresholdKb को 1024 से well below value पर set करें।

warn-package-publish

Event: PreToolUse (Bash)
Default: Claude को confirm करने के लिए instruct करता है npm publish run करने से पहले।
कोई parameters नहीं।

warn-background-process

Event: PreToolUse (Bash)
Default: Claude को careful रहने के लिए instruct करता है जब nohup, &, disown, या screen के through background processes launch करते हैं।
कोई parameters नहीं।

warn-global-package-install

Event: PreToolUse (Bash)
Default: Claude को confirm करने के लिए instruct करता है npm install -g, yarn global add, या pip install (virtual environment के बिना) run करने से पहले।
कोई parameters नहीं।

AI behavior

Detect करें जब agents stuck हो जाएं या unexpectedly behave करें।

warn-repeated-tool-calls

Event: PreToolUse (सभी tools)
Default: Claude को reconsider करने के लिए instruct करता है जब same tool को 3+ times identical parameters के साथ call किया जाता है — एक common sign कि agent loop में stuck है।
कोई parameters नहीं।

Workflow

एक disciplined end-of-session workflow को enforce करें। ये policies Stop event पर fire होती हैं और Claude को stop करने को deny करती हैं जब तक कि प्रत्येक condition पूरी न हो जाए। वे एक natural dependency chain follow करते हैं: commit → push → PR → CI। अगर एक policy deny करती है, तो chain में later policies को skip किया जाता है (deny short-circuits)। सभी workflow policies fail-open हैं: अगर required tool available नहीं है (जैसे gh installed नहीं, no git remote), policy एक informational message के साथ allow करती है जो explain करता है कि check को क्यों skip किया गया।

require-commit-before-stop

Event: Stop
Default: Uncommitted changes (modified, staged, या untracked files) होने पर stopping को deny करता है। Working directory clean होने पर informational message return करता है।
कोई parameters नहीं।

require-push-before-stop

Event: Stop
Default: Unpushed commits होने पर या जब current branch के पास no remote tracking branch हो तो stopping को deny करता है। अगर जरूरत पड़े तो tracking branch बनाने के लिए git push -u suggest करता है। अगर no remote configured है तो fail open होता है।
Parameters:
ParamTypeDefaultDescription
remotestring"origin"Remote name जिसे push करना है।
Example:
{
  "policyParams": {
    "require-push-before-stop": {
      "remote": "upstream"
    }
  }
}

require-pr-before-stop

Event: Stop
Default: जब current branch के लिए कोई pull request exist न हो, या जब existing PR closed/merged हो तो stopping को deny करता है। Claude को gh pr create के साथ PR बनाने के लिए instruct करता है।
कोई parameters नहीं।
इस policy को GitHub CLI (gh) को installed और authenticated होना आवश्यक है। gh auth login को एक personal access token के साथ run करें जिसके पास repo scope हो pull requests के लिए read access के लिए। अगर gh installed नहीं है या authenticated नहीं है, तो policy fail open होती है और reason को Claude को report करती है।

require-ci-green-before-stop

Event: Stop
Default: जब CI checks current branch पर failing या still running हों तो stopping को deny करता है। GitHub Actions workflow runs और third-party bot checks (जैसे CodeRabbit, SonarCloud, Codecov) दोनों को check करता है। skipped conclusions को success मानता है। सभी checks pass होने पर informational message return करता है।
कोई parameters नहीं।
इस policy को GitHub CLI (gh) को installed और authenticated होना आवश्यक है। gh auth login को एक personal access token के साथ run करें जिसके पास repo scope हो Actions workflow runs और Checks API के लिए read access के लिए। अगर gh installed नहीं है या authenticated नहीं है, तो policy fail open होती है और reason को Claude को report करती है।


Individual policies को disable करना

अपने config में enabledPolicies से एक specific policy को remove करें, या dashboard के Policies tab में इसे toggle off करें।
{
  "enabledPolicies": [
    "block-rm-rf",
    "sanitize-api-keys"
  ]
}
Policies जो enabledPolicies में listed नहीं हैं, run नहीं होती हैं, भले ही उनके लिए policyParams entries exist करें।