Skip to content

Add session-gated hooks to reduce permission prompts#1

Draft
luqs1 wants to merge 1 commit into
mainfrom
hooks/auto-allow-learning-session
Draft

Add session-gated hooks to reduce permission prompts#1
luqs1 wants to merge 1 commit into
mainfrom
hooks/auto-allow-learning-session

Conversation

@luqs1
Copy link
Copy Markdown
Owner

@luqs1 luqs1 commented Apr 2, 2026

Summary

  • Claude Code: Adds PreToolUse hooks that auto-allow tools during active learning sessions using a marker file (~/.claude/learning/.session-active)
    • Write/Edit to ~/.claude/learning/ — always allowed (path-checked)
    • Bash session lifecycle commands (mkdir, touch, rm on marker) — always allowed (pattern-matched)
    • Research tools (WebSearch, WebFetch, Read, Grep, Glob, Agent) — allowed only when session marker exists
  • OpenCode: Config hook declares webfetch: "allow" (only permission type available at plugin level)
  • Skill update: learn skill now creates marker at session start and removes it at session end

Test plan

  • Pipe test JSON into hooks/learning_allow_hook.py for each scenario (Write to learning dir, Write elsewhere, research tools with/without marker, Bash lifecycle commands, arbitrary Bash)
  • Run a full learning session and verify no permission prompts for research tools
  • Verify non-learning tool calls still prompt normally when marker is absent
  • Verify OpenCode webfetch works without prompts

🤖 Generated with Claude Code

…g learning

Claude Code: PreToolUse hooks auto-allow Write/Edit to ~/.claude/learning/,
session lifecycle Bash commands, and research tools (WebSearch, WebFetch, Read,
Grep, Glob, Agent) only when a .session-active marker file exists.

OpenCode: config hook declares webfetch as auto-allowed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to 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