DMPS - Dual-Mode Prompt System
A secure, enterprise-grade Python package for AI prompt optimization using the 4-D methodology (Deconstruct, Develop, Design, Deliver).
Features
Core Optimization
- Intent Detection: Automatically classifies prompt intent (creative, technical, educational, analytical)
- Gap Analysis: Identifies missing information and optimization opportunities
- 4-D Optimization: Systematic optimization using proven methodologies
- Dual Output Modes: Conversational and structured JSON formats
- Platform Support: Optimized for Claude, ChatGPT, Gemini, and generic platforms
Security & Performance (v0.2.0)
- Enterprise Security: Path traversal protection, RBAC, input sanitization
- Token Tracking: Cost estimation and usage monitoring
- Context Engineering: Performance evaluation and optimization metrics
- Observability: Real-time monitoring and alerting dashboard
- Code Quality: Pre-commit hooks, automated testing, type safety
Installation
From PyPI (Recommended)
pip install dmps==0.2.0
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
-
Clone the repository:
git clone https://github.com/MrBinnacle/dmps.git cd dmps
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: .\venv\Scripts\activate
-
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)
# Access optimization metadata
print(f"Token reduction: {result.metadata['token_metrics']['token_reduction']}")
print(f"Quality score: {result.metadata['evaluation']['overall_score']}")
print(result.optimized_prompt)
Token Tracking & Observability
from dmps.observability import dashboard
from dmps.token_tracker import token_tracker
# Monitor performance
dashboard.print_session_summary()
# Export metrics
dashboard.export_metrics("metrics.json")
# Get performance alerts
alerts = dashboard.get_performance_alerts()
for alert in alerts:
print(f"Alert: {alert}")
🛡️ Enterprise Security (v0.2.0)
DMPS includes comprehensive security protections:
- CWE-22 Protection: Path traversal attack prevention
- Input Sanitization: XSS and code injection prevention
- RBAC Authorization: Role-based access control for all operations
- Rate Limiting: Protection against abuse and DoS attacks
- Secure Error Handling: Information leak prevention
- Audit Logging: Complete security event tracking
- Token Validation: Secure API token management
Security Compliance: Follows OWASP guidelines and enterprise security standards.
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
# Show performance metrics
dmps "Optimize this" --metrics
# Export metrics to file
dmps "Test prompt" --export-metrics metrics.json
# Help
dmps --help
Security Features:
- Automatic path traversal protection
- Input sanitization and validation
- RBAC-controlled command access
- Rate limiting and session management
- Secure file operations with extension validation
Development
Setup Development Environment
# Install development tools and pre-commit hooks
python setup-dev.py
# Run quality checks
python scripts/format.py
Running Tests
python -m pytest tests/ -v
Code Quality
# Automated formatting and linting
black src/
isort src/
flake8 src/
mypy src/
# Security scanning
bandit -r src/
safety check
Quality Guardrails
- Pre-commit hooks: Automatic code quality validation
- CI/CD pipeline: Automated testing and security scanning
- Type checking: Full mypy integration
- Security scanning: Bandit and safety checks
See DEVELOPMENT.md for complete guidelines.
What's New in v0.2.0
- Enterprise Security: Complete security hardening with CWE-22 protection
- Token Tracking: Cost estimation and usage monitoring
- Observability Dashboard: Real-time performance monitoring
- Code Quality Guardrails: Pre-commit hooks and automated validation
- Enhanced Performance: 3-5x improvement in pattern matching
- Type Safety: Full mypy integration and type annotations
See CHANGELOG.md for complete release notes.
Contributing
Contributions are welcome! Please read DEVELOPMENT.md for guidelines.
- Fork the repository
- Create a feature branch
- Run quality checks:
python scripts/format.py - Submit a Pull Request
All contributions must pass security and quality checks.
Links
- PyPI: https://pypi.org/project/dmps/
- GitHub: https://github.com/MrBinnacle/dmps
- Documentation: docs/
- Security Guide: docs/SECURITY_GUIDE.md
- Development Guide: DEVELOPMENT.md
License
This project is licensed under the MIT License - see the LICENSE file for details.
DMPS v0.2.0 - Enterprise-grade AI prompt optimization with comprehensive security and observability.
Metadata
Release files for dmps 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| dmps-0.2.1.tar.gz | 63.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dmps-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 100.4 kB
Release files / dmps-0.2.1.tar.gz
| Download URL | dmps-0.2.1.tar.gz |
|---|---|
| Size | 63.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b4c6bc05436428408e7854de72eba619ae61ff6f5cc7b54e35479127a3a5622f
|
|
BLAKE2b-256 checksum How to use checksums |
7fced437b8573137c2d1eaa6d405eb0466ea00167d2fd0ae8098e79af46c0e68
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.1
|
Release files / dmps-0.2.1-py3-none-any.whl
| Download URL | dmps-0.2.1-py3-none-any.whl |
|---|---|
| Size | 37.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5cc3321fe41ef7b89d8e4fe6a230ce726972d24c0d3a9716e28d73e567df5461
|
|
BLAKE2b-256 checksum How to use checksums |
06456c93ae633615d47bf459d04ede2586072e07ec4d5f2ad601ee124a0aa742
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.1
|
Security for dmps 0.2.1
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.