Skip to main content

Dual-Mode Prompt System for AI prompt optimization using 4-D methodology

Project description

DMPS - Dual-Mode Prompt System

License: MIT Python Version

A Python package for AI prompt optimization using the 4-D methodology (Deconstruct, Develop, Design, Deliver).

Features

  • Intent Detection: Automatically classifies prompt intent (creative, technical, educational, complex)
  • Gap Analysis: Identifies missing information in prompts
  • 4-D Optimization: Applies systematic optimization techniques
  • Dual Output Modes: Conversational and structured JSON formats
  • Platform Support: Optimized for Claude, ChatGPT, and other AI platforms

Installation

From PyPI (Recommended)

pip install dmps

From Source

# Clone the repository
git clone https://github.com/MrBinnacle/dmps.git
cd dmps

# Install in development mode
pip install -e .

Prerequisites

  • Python 3.8+
  • pip (Python package manager)

Development Installation

  1. Clone the repository:

    git clone https://github.com/MrBinnacle/dmps.git
    cd dmps
    
  2. Create and activate a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: .\venv\Scripts\activate
    
  3. Install the package in development mode:

    pip install -e .
    

Usage

Quick Start

from dmps import optimize_prompt

# Simple optimization with automatic security validation
result = optimize_prompt("Write a story about AI")
print(result)

Advanced Usage

from dmps import PromptOptimizer

optimizer = PromptOptimizer()
result, validation = optimizer.optimize(
    "Explain machine learning",
    mode="conversational",
    platform="claude"
)

# Check for security warnings
if validation.warnings:
    print("Security warnings:", validation.warnings)

print(result.optimized_prompt)

🛡️ Security Features

DMPS includes comprehensive security protections:

  • Path Traversal Protection: Automatic blocking of dangerous file paths
  • Input Sanitization: XSS and code injection prevention
  • RBAC: Role-based access control for commands
  • Rate Limiting: Protection against abuse
  • Secure Error Handling: No information leakage

See Security Guide for complete details.

CLI Usage

# Basic usage with automatic security validation
dmps "Your prompt here" --mode conversational --platform claude

# File input/output (automatically validates paths)
dmps --file input.txt --output results.txt

# Interactive mode with security monitoring
dmps --interactive

# REPL shell mode with RBAC protection
dmps --shell

# Help
dmps --help

Security Notes:

  • File paths are automatically validated for safety
  • Input is sanitized to prevent injection attacks
  • Only safe file extensions (.txt, .json) are allowed for output
  • Rate limiting prevents abuse in interactive modes

Development

Running Tests

python -m pytest tests/

Code Quality

# Type checking
pyright src/

# Linting
flake8 src/

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dmps-0.2.0.tar.gz (61.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dmps-0.2.0-py3-none-any.whl (36.0 kB view details)

Uploaded Python 3

File details

Details for the file dmps-0.2.0.tar.gz.

File metadata

  • Download URL: dmps-0.2.0.tar.gz
  • Upload date:
  • Size: 61.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for dmps-0.2.0.tar.gz
Algorithm Hash digest
SHA256 130a70df6abb0a191abc371c66f794885259808c1043c2a63f8b0bcc084f5580
MD5 f7b8a9c595a47d963febbf0ef10aa585
BLAKE2b-256 26f00c8173bcc27f87593048610c513b8e8d47b3d9a51d40297234401c9d60d2

See more details on using hashes here.

File details

Details for the file dmps-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: dmps-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 36.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for dmps-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1cd1442640282fdec1acfcbf5bb6e5e077f02a66a86cce863f1039bdbb6e7f76
MD5 789e7e5a3daa983ecb254d0a22c39bd9
BLAKE2b-256 ea4aa636f3ebcfef76f66a3deeeb670fc2b84b277fe8fd500c4c7fe767275a5b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page