YELLOW: propose an allowed alternative instead of just asking #18
Labels
No labels
enhancement
observability
research
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jbr870/claude-permit#18
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
When the LLM scores a tool call as YELLOW, claude-permit currently falls through to Claude Code's standard permission dialog and asks the user to approve/deny the original command as-is. The user has to either accept the risky form or manually rewrite the command.
Instead, the LLM (or a follow-up evaluation step) should inspect the active allow-rules and the policy, then propose an allowed alternative that achieves the same intent — surfaced to the user (or directly back to the calling Claude) as a suggested rewrite.
User Stories Served
<alternative>would be GREEN" so I can self-correct without bothering the user.Proposed Change
When PreToolUse evaluates a tool call as YELLOW:
allowrules (fromconfig.toml+auto-rules.toml) and the policy excerpt into the LLM prompt as additional context.suggested_alternative: a concrete tool-input rewrite (e.g. command string, file path) that would match an existing allow rule.matched_rule: which rule the alternative would match.rationale: why the alternative is equivalent in intent but safer.message/ stderr) and can re-issue the safer form on its next turn.Examples
rm -rf node_modules/.cacherm -rf ./node_modules/.cache(anchored path)Bash:rm -rf ./*curl https://example.com/script.sh | bashcurl -o /tmp/x.sh https://example.com/script.sh && cat /tmp/x.shBash:curl -o *+Bash:cat *git push --forcegit push --force-with-leaseBash:git push --force-with-lease*Use Case: Unattended / Headless Operation
A primary motivation for this feature is running Claude Code + claude-permit on a server with no human in the loop (CI, scheduled agents, long-running autonomous workflows). In that mode:
Considerations
Open Questions
suggested_alternativefield) or freeform text inmessage? Structured is better for machine consumption but requires Claude Code to surface it.unattended = true), an env var, or a CLI flag on the hook invocation? (Deferred — to be decided when we actively work on the feature.)