A manager system for Claude Code that intercepts and supervises tool actions using OpenRouter LLMs
Project description
dangerously-prompt-permissions
Supervisor system for Claude Code that intercepts and reviews tool actions using an OpenRouter LLM.
Overview
This library adds an automated permission layer to Claude Code (Agent SDK). A supervisor LLM reviews every tool call before execution and can automatically answer questions, creating a fully autonomous coding agent with configurable safety policies.
Key Features
- Automated Permission Management: PreToolUse hooks intercept and review all tool calls
- Auto-Answering: Supervisor automatically answers
AskUserQuestionprompts - OpenRouter Integration: Use any LLM as supervisor (Grok, Claude, GPT-4, etc.)
- Customizable Policies: Define supervision behavior via system prompts
- Zero Manual Intervention: Fully autonomous after configuration
Installation
# From source
git clone https://github.com/smarsx/dangerously-prompt-permissions.git
cd dangerously-prompt-permissions
pip install -e .
Quick Start
Get API keys from OpenRouter and Anthropic, then set environment variables:
export OPENROUTER_API_KEY='your-openrouter-key'
export ANTHROPIC_API_KEY='your-anthropic-key'
Then use the library:
import asyncio
from dangerously_prompt_permissions import OpenRouterManager
async def main():
# Uses default models: Grok (supervisor) + Claude Haiku (worker)
manager = OpenRouterManager(
manager_policy="""You are a security-focused code supervisor.
Review all tool calls and:
- ALLOW safe file reads and harmless operations
- DENY destructive operations without explicit user consent
- DENY commands that could expose secrets
- For AskUserQuestion, choose the most secure default
"""
)
await manager.run(
code_prompt="Create a Python script that prints 'Hello World'",
root_dir="/path/to/workspace"
)
if __name__ == "__main__":
asyncio.run(main())
How It Works
- Worker makes tool call → Edit file, run bash command, etc.
- PreToolUse hook intercepts → Before execution
- Supervisor LLM reviews → Analyzes intent and safety
- Decision applied → ALLOW (execute), DENY (block), or auto-answer
- Execution continues → Worker receives result or error
For AskUserQuestion calls, the supervisor automatically selects appropriate answers based on the policy, enabling fully autonomous operation.
API Reference
OpenRouterManager
OpenRouterManager(
manager_model: str = "x-ai/grok-code-fast-1", # Supervisor model
manager_policy: str = "",
openrouter_url: str = "https://openrouter.ai/api/v1/chat/completions",
verbose: bool = False
)
Default Models:
- Supervisor (Manager):
x-ai/grok-code-fast-1- Fast, cost-effective code review - Worker (Agent):
claude-haiku-4-5- Fast Claude model for code execution
Environment Variables (Required):
OPENROUTER_API_KEY- Get at https://openrouter.ai/ANTHROPIC_API_KEY- Get at https://console.anthropic.com/
run()
await manager.run(
code_prompt: str, # Task description for worker
root_dir: str, # Workspace directory
model: str = "claude-haiku-4-5", # Worker model
system_prompt: str = None, # Custom worker instructions
permission_mode: str = "default",
setting_sources: list = ["project"]
)
Security Considerations
Important: The supervisor LLM is not infallible. This is a research/development tool, not a production security solution.
- Supervisor can make mistakes or be misled by clever prompts
- Always review automated decisions in sensitive contexts
- Use restrictive policies by default
- Monitor logs for unexpected behavior
- Test policies thoroughly before autonomous operation
License
MIT License - see LICENSE for details.
Acknowledgments
- Built on Claude Code (Agent SDK) by Anthropic
- Uses OpenRouter for LLM access
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dangerously_prompt_permissions-0.1.0.tar.gz.
File metadata
- Download URL: dangerously_prompt_permissions-0.1.0.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49e7b6894ad408210bd4a4589567d05790b02a8cbbee6dea2366488bd1d93ec0
|
|
| MD5 |
a4a0d6578709245bd012e721fbdb862e
|
|
| BLAKE2b-256 |
39f08f8c82de33bf34153af9c57c041f2874363dbd378cb1cc7ef263f32895cc
|
File details
Details for the file dangerously_prompt_permissions-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dangerously_prompt_permissions-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a201cc869a5a209545ad28f789253b81f4b99254340ee0afebb72280bcb9ca4e
|
|
| MD5 |
2b654ad853ce141a7d6fe35e7d36537a
|
|
| BLAKE2b-256 |
85ccd609bb3a368d45b5c2dc290905ae0cfd918a5eeab00b2afccbe98b5c0ca8
|