Skip to main content
0Pirate Logo

0Pirate

Local redaction proxy and zero-knowledge middleware for AI-assisted coding

License: MIT


Overview

0Pirate is a local proxy that sits between your development environment and frontier AI models. It removes credentials, replaces proprietary business logic with structural placeholders, sends the sanitized code to the AI provider, and restores the original code locally when the response arrives.

The Problem

Engineering teams face a direct trade-off between AI coding performance and code privacy:

1. Local models fall short on complex code

Running local open-weight models through tools like Ollama keeps data on your machine, but smaller models (7B to 70B) cannot match the reasoning, context tracking, and multi-file refactoring abilities of frontier cloud models. For complex system design and hard bugs, local models often slow developers down.

2. Cloud models expose sensitive assets

Sending unredacted code to third-party endpoints creates exposure risks across three areas:

  • Credentials and secrets: API keys, database connection strings, SSH keys, authentication tokens.
  • Personal and infrastructure data: Internal hostnames, private IP addresses, employee emails, customer data in test fixtures.
  • Intellectual property: Proprietary algorithms, financial formulas, patented logic, and domain-specific business rules.

3. Traditional masking tools break code

Standard data loss prevention filters and regex rules treat code like plain text:

  • Regex replacements break Abstract Syntax Tree (AST) structures, scope boundaries, and language typing.
  • Simple masks do not hide the semantics of proprietary logic.
  • Text filters are one-way. When an AI returns a code patch, regex tools cannot automatically restore the original identifiers into working code.

How 0Pirate Works

0Pirate runs entirely on your local machine or private network:

  1. AST-level abstraction: Rather than using naive text replacement, 0Pirate parses the syntax tree. Proprietary functions, internal classes, and business variables are mapped to structurally valid placeholder tokens.
  2. Secret redaction: High-entropy strings, credential formats, and sensitive constants are detected and removed before any payload is sent.
  3. Model-agnostic routing: 0Pirate does not depend on a specific AI model. It works with any modern provider:
    • Anthropic: Claude 3.7 Sonnet, Claude 3.5 Sonnet, Claude Opus
    • OpenAI: GPT-4o, o1, o3-mini
    • DeepSeek: DeepSeek-R1, DeepSeek-V3
    • Google: Gemini 2.0 Flash, Gemini 1.5 Pro
    • Meta, Mistral, and custom endpoints via OpenRouter or OpenAI-compatible APIs
  4. Local rehydration: When the model returns generated code or a diff, 0Pirate maps all placeholders back to your original variable names, functions, and secrets in local memory. The remote provider never receives the raw IP.

Using with Agentic IDEs (Cursor and Claude Code)

0Pirate runs as a local Model Context Protocol (MCP) server. When an agent in Cursor or Claude Code requests project context, 0Pirate intercepts the file read, redacts the contents, and returns the safe version.

MCP Configuration

Add 0Pirate to your Cursor or Claude Desktop configuration file:

{
  "mcpServers": {
    "0pirate-secure-proxy": {
      "command": "python3",
      "args": ["/path/to/0pirate/cli/mcp_server.py"]
    }
  }
}

Once configured, the agent reads and writes code through the proxy without exposing your underlying secrets or proprietary identifiers.

Quickstart

Run the local stack:

Prerequisites

  • Docker and Docker Compose
  • Python 3.10 or newer

Setup

# Clone the repository
git clone https://github.com/Arunmadhavan28/0pirate.git
cd 0pirate

# Set up environment variables
cp .env.example .env

# Start local services
docker-compose up -d

# Install CLI and pre-commit hook
cd cli
pip install -r requirements.txt
python main.py install-hook

Services:

  • Backend proxy: http://localhost:5001
  • Frontend dashboard: http://localhost:3000
  • Pre-commit hook: checks git commits for accidental secret leakage

Documentation

Community

License

This project is licensed under the MIT License.

Metadata

Release files for 0pirate 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for 0pirate 0.2.0
File Size Uploaded Provenance
0pirate-0.2.0.tar.gz 4.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for 0pirate 0.2.0
File Interpreter ABI Platform
0pirate-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.3 kB

Release files / 0pirate-0.2.0.tar.gz

Download URL 0pirate-0.2.0.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b8549c6921f9dff84e91e9e03722fdbd866b7d17f8b25b9178cfdfc5b581a4f4
BLAKE2b-256 checksum
How to use checksums
8a024ae435e08bd98c3ff1f75eaf7b07982daf368ecd36b5c5e9223a0233466b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.13

Release files / 0pirate-0.2.0-py3-none-any.whl

Download URL 0pirate-0.2.0-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d8db58ae30af227e27502fd6eb81646c0aa0d78f54b60f363998daa9204da5d
BLAKE2b-256 checksum
How to use checksums
f21749840bd36ab5897fa8837c31bef6c35cdf7d6d8b56a803a882e4a36d123e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.13

Security for 0pirate 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page