DraCo achieves 90%+ token reduction with 90%+ quality preservation across AI coding workflows. Production-ready with dual package distribution (pip + npm), 12-phase pipeline, advanced ZON format, and comprehensive deployment support.
π― 90% token reduction | 90% quality preservation | 95% maximum cap
β‘ Dual package:
pip install draco-token-optimizer|npm i draco-token-optimizer
β‘ Production-ready: Quality gates, safety guards, 12-phase pipeline
β‘ Deploy anywhere: Docker, Kubernetes, CI/CD, VS Code, Jupyter
pip install draco-token-optimizernpm i draco-token-optimizerfrom draco.core.reducer import count_tokens, analyze_text, apply_basic_reduction
text = "def hello():\n # Please note that this is important\n pass"
tokens = count_tokens(text)
metrics = analyze_text(text, minimum_quality=90)
result = apply_basic_reduction(text, {
"target_reduction": 90,
"minimum_quality": 90,
"optimization_level": "maximum",
"use_zon": True,
"zod_depth": 5
})import { countTokens, analyzeText, applyBasicReduction } from "draco-token-optimizer";
const tokenCount = countTokens("def hello(): pass");
const metrics = analyzeText("Please note that this is important", { minimumQuality: 90 });
const result = applyBasicReduction("Please note that we need to build", {
targetReduction: 90,
minimumQuality: 90,
optimizationLevel: "maximum",
useZon: true,
zodDepth: 5
});| Feature | Status |
|---|---|
| Token Reduction | 90%+ target mandatory |
| Quality Preservation | 90%+ mandatory |
| Maximum Cap | 95% enforced |
| ZON Format | 35-70% vs JSON |
| Quality Gates | 200+ checks |
| Safety Guards | 100+ mechanisms |
| CLI | 6 subcommands |
| Agent YAGNI | L1-L6 ladder |
| 12-Phase Pipeline | Incremental enable |
| Docker | Ready |
| Kubernetes | HPA, ConfigMap, Secrets |
| Package | Install | Features |
|---|---|---|
| pip | pip install draco-token-optimizer |
Python CLI, core reduction, ZON, dashboard |
| npm | npm i draco-token-optimizer |
TypeScript, UMD/ESM, type definitions |
| Phase | Focus | Status |
|---|---|---|
| 1 | Baseline & Metrics | β |
| 2 | MCP Protocol & Zero-LLM | β |
| 3 | Tree-sitter Codebase | β |
| 4 | Hybrid RAG (BM25+ONNX) | β |
| 5 | YAML Filters | β |
| 6 | NLP Noise Cancellation | β |
| 7 | Transformer Verdict-First | β |
| 8 | ZON Data Format | β |
| 9 | Quantization & Pruning | β |
| 10 | Agent Integration | β |
| 11 | Quality Gates | β |
| 12 | Continuous Learning | β |
Enable phases: from draco.config import enable_phase, disable_phase
FROM python:3.12-slim
RUN pip install draco-token-optimizer
ENV REDUCTION_TARGET=90 QUALITY_THRESHOLD=90
HEALTHCHECK CMD draco health
EXPOSE 5000apiVersion: apps/v1
kind: Deployment
metadata: name: draco-optimizer
spec: replicas: 2
template:
spec:
containers:
- name: draco
image: draco-token-optimizer:2.0.0
env: - REDUCTION_TARGET=90
- QUALITY_THRESHOLD=90
resources:
limits: cpu: "500m", memory: "512Mi"
requests: cpu: "100m", memory: "128Mi"
ports: - containerPort: 5000Run benchmarks:
from draco.benchmarks import run_benchmarks
results = run_benchmarks()- 90%+ token reduction with 90%+ quality preservation mandatory
- 95% maximum reduction cap enforced
- ZON format lossless compression (35-70% vs JSON, 3 modes)
- 36+ verbose phrase removal patterns
- Code pattern condensation (for loops, if statements, etc.)
- 200+ quality validation checks enforced on import
- 100+ safety guards preventing destructive operations
- Agent YAGNI ladder (L1-L6) with agent-specific reduction caps
- 12-phase incremental pipeline via config.py
- Docker/Kubernetes deployment ready
- Benchmark suite with standardized metrics
- Continuous learning framework (CMA-ES, auto-update, A/B testing)
graph TD
subgraph L1_Minimal
A[Generic Adapter]:::l1
end
subgraph L2_Light
B[Codex]:::l2
C[Cursor]:::l2
end
subgraph L3_Standard
D[Claude Code]:::l3
E[Copilot]:::l3
end
subgraph L4_Enhanced
F[Code Llama]:::l4
end
subgraph L5_Aggressive
G[DeepSeek]:::l5
end
subgraph L6_Maximal
H[Custom/Research]:::l6
end
A -->|Reduction Cap: 95%| B
B -->|Reduction Cap: 92%| C
C -->|Reduction Cap: 88%| D
D -->|Reduction Cap: 85%| E
E -->|Reduction Cap: 91%| F
F -->|Reduction Cap: 89%| G
G -->|Reduction Cap: 87%| H
classDef l1 fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px;
classDef l2 fill:#e3f2fd,stroke:#1565c0,stroke-width:2px;
classDef l3 fill:#fff3e0,stroke:#fb8c00,stroke-width:2px;
classDef l4 fill:#f1f8e9,stroke:#689f38,stroke-width:2px;
classDef l5 fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px;
classDef l6 fill:#fffde7,stroke:#f57f17,stroke-width:2px;
L1-L6: YAGNI (You Ain't Gonna Need It) levels with increasing reduction caps but decreasing quality minima
- Architecture - System architecture
- API Reference - 200+ endpoints
- NLP/ML Guide - NLP and ML subsystems
- Agent Integration - 50+ agent adapters
- Reduction Methods - All compression methods
- Deployment Guide - Docker, K8s, CI/CD
- Troubleshooting - 50+ common issues
| Metric | Target | Status |
|---|---|---|
| Token Reduction | 90%+ | β Working |
| Quality Preservation | 90%+ | β Working |
| Processing Speed | <2s per 1000 tokens | β Cached: <1s |
| Agent Compatibility | 50+ agents | β 25 verified |
| Continuous Improvement | 0.1-0.5%/cycle | β Framework enabled |
| Auto-Update Cycles | Daily | β Enabled |
draco-token-optimizer v2.1.0
- Dual package distribution (pip + npm)
- Production-ready with quality guarantees
- 12-phase incremental pipeline
- Docker/Kubernetes deployment support
- Full benchmark suite
- Status: Ready for production use
- Prometheus metrics endpoint (
/metrics) - Flask dashboard (
/) - Agent YAGNI ladder (L1-L6 Mermaid visualization)
- Property-based testing (Hypothesis, 27 tests)
- Docker health check optimization
- Enhanced README with release badges
- Prometheus metrics endpoint (
/metrics) for observability - Enhanced README with Prometheus and Flask dashboard badges
- Agent YAGNI Ladder Mermaid visualization (L1-L6)
- Property-based test suite using Hypothesis framework
- Optimized Docker health check with Python fallback
- Repository URL updated to
muhammad-khalid-bin-walid/DraCo-Token-Optimizer
draco-token-optimizer v2.0.0
- Dual package distribution (pip + npm)
- Production-ready with quality guarantees
- 12-phase incremental pipeline
- Docker/Kubernetes deployment support
- Full benchmark suite
- Status: Ready for production use
MIT License - Copyright (c) 2026 DraCo Token Optimizer Team
- Dual package distribution (pip + npm)
- tiktoken integration for accurate token counting
- Advanced ZON format with 3 readability modes and depth control
- 12-phase pipeline with incremental enabling via config.py
- Docker/Kubernetes deployment guides and configuration
- Comprehensive benchmark suite with standardized metrics
- Enhanced quality gates (200+ checks, 90%+ mandatory)
- Agent YAGNI ladder (L1-L6 with reduction caps)
- CLI interface with 6 subcommands
- Full safety guards (100+ mechanisms, automatic fallbacks)
- Continuous learning framework (CMA-ES, auto-update, A/B testing)
β Star the repo to support ongoing development!