Impact Preview

io.github.agent-polisPublished by GitHub account agent-polisv0.2.1Updated Oct 24, 2026

Impact preview for AI agents - see what changes before any action executes.

VerifiedSTDIODesktop onlyDeveloper ToolsSecurity & Monitoring

Overview

AI-generated overview

Local MCP server that previews an AI agent's proposed file, shell, database or API actions with diffs and risk levels before anything runs.

What you can do
  • Preview file writes and deletes, showing the diff and what would be lost
  • Preview shell commands and flag dangerous ones
  • Run a quick risk check on any path
  • Submit actions for approval, then approve, reject or execute them through the server's API
  • Retrieve an audit trail of proposed and executed actions
When to use it
Useful when you let an agent edit files, run shell commands or touch databases and want a review step with diffs and risk warnings before changes take effect. It suits developers who want a plan-and-approve gate rather than direct execution.
Requirements
Runs locally as a Python package installed with pip; the README also shows a Docker Compose option. The full approval workflow needs a running server with a database and Redis, plus a SECRET_KEY, DATABASE_URL and REDIS_URL in a .env file, and API keys for the HTTP API. Desktop client only.
Before you install
The full server stores an API key and secrets such as SECRET_KEY in configuration; keep them out of shared files. Approving an action executes it, so file writes, deletes, database statements and shell commands can change or destroy data once approved. The README's own examples include production database URLs and system paths, so review previews carefully.

Installation

In SourceWeft

  1. Open Impact Preview in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

🔍 Agent Polis

Impact Preview for AI Agents - "Terraform plan" for autonomous AI actions

[License: MIT] [Python 3.11+]

See exactly what will change before any AI agent action executes.

Agent Polis intercepts proposed actions from autonomous AI agents, analyzes their impact, shows you a diff preview of what will change, and only executes after human approval. Stop worrying about your AI agent deleting your production database.

🎯 The Problem

Autonomous AI agents are powerful but dangerous. Recent incidents:

  • Replit Agent deleted a production database, then lied about it
  • Cursor YOLO mode deleted an entire system including itself
  • Claude Code learned to bypass safety restrictions via shell scripts

Developers want to use AI agents but don't trust them. Current solutions show what agents want to do, not what will happen. There's no "terraform plan" equivalent for AI agent actions.

🚀 The Solution

AI Agent proposes action → Agent Polis analyzes impact → Human reviews diff → Approve/Reject → Execute
diff
# Example: Agent wants to write to config.yaml- database_url: postgresql://localhost:5432/dev+ database_url: postgresql://prod-server:5432/production! WARNING: Production database URL detected (CRITICAL RISK)

✨ Features

  • Impact Preview: See file diffs, risk assessment, and warnings before execution
  • Approval Workflow: Approve, reject, or modify proposed actions
  • Risk Assessment: Automatic detection of high-risk operations (production data, system files, etc.)
  • Audit Trail: Event-sourced log of every proposed and executed action
  • SDK Integration: Easy @require_approval decorator for your agent code
  • Dashboard: Streamlit UI for reviewing and approving actions

🚀 Quick Start (2 minutes)

The fastest way to try Agent Polis is the MCP server with Claude Desktop or Cursor.

1. Install & Run

bash
pip install impact-previewimpact-preview-mcp

2. Configure Claude Desktop

Add to your config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

json
{    "mcpServers": {        "impact-preview": {            "url": "http://localhost:8000/mcp"        }    }}

3. Try It

Ask Claude to edit a file - it now has these tools:

ToolWhat it does
preview_file_writeShows diff before any edit
preview_file_deleteShows what will be lost
preview_shell_commandFlags dangerous commands
check_path_riskQuick risk check for any path

Example prompt:

"Preview what would happen if you changed the database URL in config.yaml to point to production"

Claude will show you the diff and risk assessment before making changes.


📦 Full Server Installation

For the complete approval workflow with dashboard and API:

bash
# Using Docker (recommended)docker-compose up -d
# Or locallypip install impact-previewimpact-preview

Register an Agent

bash
curl -X POST http://localhost:8000/api/v1/agents/register \  -H "Content-Type: application/json" \  -d '{"name": "my-agent", "description": "My AI coding assistant"}'

Submit Action → Review → Approve

bash
# Submitcurl -X POST http://localhost:8000/api/v1/actions \  -H "X-API-Key: YOUR_API_KEY" \  -H "Content-Type: application/json" \  -d '{"action_type": "file_write", "target": "/app/config.yaml", "description": "Update DB URL", "payload": {"content": "db: prod"}}'
# Previewcurl http://localhost:8000/api/v1/actions/ACTION_ID/preview -H "X-API-Key: YOUR_API_KEY"
# Approve (or reject)curl -X POST http://localhost:8000/api/v1/actions/ACTION_ID/approve -H "X-API-Key: YOUR_API_KEY"

Audit Trail (Events)

You can retrieve the complete audit trail for an action:

bash
curl http://localhost:8000/api/v1/actions/ACTION_ID/events -H "X-API-Key: YOUR_API_KEY"

ActionPreviewGenerated event payload includes machine-readable governance context:

  • data.governance.policy.decision / data.governance.policy.matched_rule_id
  • data.governance.scanner.reason_ids / data.governance.scanner.max_severity

🐍 SDK Integration

Wrap your agent's dangerous operations:

python
from agent_polis import AgentPolisClient
client = AgentPolisClient(api_url="http://localhost:8000", api_key="YOUR_KEY")
# Decorator approach - blocks until human approves@client.require_approval(action_type="file_write")def write_config(path: str, content: str):    with open(path, 'w') as f:        f.write(content)
# This will: submit → wait for approval → execute only if approvedwrite_config("/etc/myapp/config.yaml", "new content")

🖥️ Dashboard

Launch the Streamlit dashboard to review pending actions:

bash
pip install impact-preview[ui]streamlit run src/agent_polis/ui/app.py

📚 API Reference

Actions API

EndpointMethodDescription
/api/v1/actionsPOSTSubmit action for approval
/api/v1/actionsGETList your actions
/api/v1/actions/pendingGETList pending approvals
/api/v1/actions/{id}GETGet action details
/api/v1/actions/{id}/previewGETGet impact preview
/api/v1/actions/{id}/diffGETGet diff output
/api/v1/actions/{id}/approvePOSTApprove action
/api/v1/actions/{id}/rejectPOSTReject action
/api/v1/actions/{id}/executePOSTExecute approved action

Action Types

  • file_write - Write content to a file
  • file_create - Create a new file
  • file_delete - Delete a file
  • file_move - Move/rename a file
  • db_query - Execute a database query (read)
  • db_execute - Execute a database statement (write)
  • api_call - Make an HTTP request
  • shell_command - Run a shell command
  • custom - Custom action type

Risk Levels

  • Low: Read operations, safe changes
  • Medium: Write operations to non-critical files
  • High: Delete operations, system files
  • Critical: Production data, irreversible changes

🔧 Configuration

bash
# .envSECRET_KEY=your-secret-keyDATABASE_URL=postgresql+asyncpg://user:pass@host:5432/agent_polisREDIS_URL=redis://localhost:6379/0
# OptionalFREE_TIER_ACTIONS_PER_MONTH=100LOG_LEVEL=INFO

🗺️ Roadmap

VersionFocusStatus
v0.2.0File operation previewCurrent
v0.3.0Database operation previewPlanned
v0.4.0API call previewPlanned
v0.5.0IDE integrations (Cursor, VS Code)Planned
v1.0.0Production readyPlanned

🤝 Contributing

bash
git clone https://github.com/agent-polis/impact-preview.gitcd impact-previewpip install -e .[dev]pre-commit installpytest

📄 License

MIT License - see LICENSE for details.


Built for developers who want AI agents they can actually trust.

Source: README.md at commit 600e309

Tools

0
SourceWeft has not started this package in its sandbox yet, so its tools are not known.

Version history

1
  1. v0.2.1LatestSep 16, 2026

Score

50% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts