Skip to content

feat: configurable hint in policyParams for deny/instruct messages - #90

Closed
NiveditJain wants to merge 1 commit into
mainfrom
luv-88-hint
Closed

feat: configurable hint in policyParams for deny/instruct messages#90
NiveditJain wants to merge 1 commit into
mainfrom
luv-88-hint

Conversation

@NiveditJain

Copy link
Copy Markdown
Member

Summary

  • Adds a cross-cutting hint field to policyParams that appends custom guidance to deny and instruct messages sent back to Claude
  • Works with all policy types: built-in, custom (custom/), and convention (convention/)
  • Non-string and empty values are silently ignored (backward-compatible)

Example config:

{
"policyParams": {
"block-force-push": {
"hint": "Try creating a fresh branch instead."
}
}
}

Claude sees: "Force-pushing is blocked. Try creating a fresh branch instead."

Changes

FileChange
src/hooks/policy-evaluator.tsAppend hint to reason for deny/instruct decisions
__tests__/hooks/policy-evaluator.test.ts13 unit tests for hint behavior
__tests__/e2e/hooks/policy-params.e2e.test.ts5 e2e tests for hint with real policies
docs/configuration.mdxDocument hint field under Field Reference
docs/custom-policies.mdxMention hint works for custom/convention policies
README.mdAdd hint examples to policyParams config
CHANGELOG.mdAdd feature entry

Test plan

  • All 859 unit tests pass (bun run test:run)
  • All 192 e2e tests pass (bun run test:e2e)
  • CI passes (quality, test, build, test-e2e)

🤖 Generated with Claude Code

Allow users to append custom guidance to deny and instruct messages by
adding a `hint` string to any policy's policyParams config. The hint is
appended to the reason before it's sent back to Claude, giving actionable
next steps without modifying the policy itself.
Works with built-in, custom, and convention policies. Non-string and
empty values are silently ignored for backward compatibility.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

Copy link
Copy Markdown

Warning

Rate limit exceeded

@NiveditJain has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 46 minutes and 51 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 46 minutes and 51 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9eb3caf9-0c9f-4c39-b6ee-6e942a2637ec

📥 Commits

Reviewing files that changed from the base of the PR and between e78f028 and 98d55c7.

📒 Files selected for processing (7)
  • CHANGELOG.md
  • README.md
  • __tests__/e2e/hooks/policy-params.e2e.test.ts
  • __tests__/hooks/policy-evaluator.test.ts
  • docs/configuration.mdx
  • docs/custom-policies.mdx
  • src/hooks/policy-evaluator.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch luv-88-hint

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@NiveditJain

Copy link
Copy Markdown
MemberAuthor

Superseded by #91 (combined PR with #89)

NiveditJain added a commit that referenced this pull request Apr 14, 2026
- Remove duplicate policyParams hint test suite, merge unique sanitize-jwt test
- Fix CHANGELOG PR references from #89/#90 to #91
- Extract appendHint() helper to trim/normalize hint concatenation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
NiveditJain added a commit that referenced this pull request Apr 14, 2026
- Remove duplicate policyParams hint test suite, merge unique sanitize-jwt test
- Fix CHANGELOG PR references from #89/#90 to #91
- Extract appendHint() helper to trim/normalize hint concatenation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
NiveditJain added a commit that referenced this pull request Apr 14, 2026
…olicyParams (#91)
* feat: convention-based policy auto-discovery from .failproofai/policies/
Add git-hooks-like auto-discovery: drop *policies.{js,mjs,ts} files into
.failproofai/policies/ at project or user level and they're loaded
automatically — no --custom flag or config changes needed.
- Add discoverPolicyFiles() and loadAllCustomHooks() to custom-hooks-loader
- Convention hooks registered with "convention/" prefix for telemetry
- PostHog telemetry: convention_policies_loaded event, is_convention_policy
flag on hook_policy_triggered
- listHooks() shows discovered convention policies
- CLI help updated with CONVENTION POLICIES section
- 6 new unit tests, 16 new e2e tests covering discovery, union loading,
fail-open, file filtering, coexistence with --custom
- Example files in examples/convention-policies/
- Mintlify docs and README updated
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address CodeRabbit review feedback
- Fix PR number reference in CHANGELOG (#88#89)
- Add `text` language identifier to fenced code block in README
- Track convention hooks by object reference instead of name to prevent
mis-tagging explicit hooks that share a convention hook name
- Use `basename()` instead of `file.split("/")` for cross-platform paths
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: configurable `hint` in policyParams for deny/instruct messages
Allow users to append custom guidance to deny and instruct messages by
adding a `hint` string to any policy's policyParams config. The hint is
appended to the reason before it's sent back to Claude, giving actionable
next steps without modifying the policy itself.
Works with built-in, custom, and convention policies. Non-string and
empty values are silently ignored for backward compatibility.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: add missing vitest expect import in policy-params e2e test
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address CodeRabbit review feedback (round 2)
- Remove duplicate policyParams hint test suite, merge unique sanitize-jwt test
- Fix CHANGELOG PR references from #89/#90 to #91
- Extract appendHint() helper to trim/normalize hint concatenation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@NiveditJain
NiveditJain deleted the luv-88-hint branch April 21, 2026 01:30
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@NiveditJain