Zero-configuration AI context generation system with extreme quality enforcement and Toyota Way standards. Analyze any codebase instantly through CLI, MCP, or HTTP interfaces. Built by Pragmatic AI Labs.
🎉 v2.12.0 Release: Enhanced Ruchy Analysis! Advanced analysis capabilities for the Ruchy programming language:
- 🧮 Halstead Metrics: Volume, difficulty, effort, time, and bug estimations
- 💀 Dead Code Detection: Unused functions and variables identification
- 🎯 Type Inference: Automatic type analysis for literals and operations
- 🎭 Actor Analysis: Message flow tracking and deadlock detection
- 🌟 Pattern Matching: Enhanced complexity scoring for match expressions
- 📦 Dependency Tracking: Import/export analysis with module relationships
🚀 v2.10.0: Claude Code Agent Mode - "Always Working" Achievement! Transform PMAT into a persistent background quality agent:
- 🤖 Claude Code Integration: Native MCP server for seamless Claude Code integration
- 💾 Persistent State: Monitoring state maintained across restarts with auto-save
- ⚙️ Production Ready: Environment-specific configs for dev, prod, and CI/CD
- 📊 Real-time Monitoring: Continuous quality tracking with file system watching
- 🏗️ Service Architecture: Systemd deployment with health checks and auto-restart
🎯 v2.9.0: Universal Demo "Just Works" Achievement! Complete AI-powered repository intelligence with multi-language analysis:
- 🤖 AI-Powered Recommendations: Framework-aware repository recommendations with complexity-based learning tiers
- 🌍 Multi-Language Intelligence: Advanced polyglot analysis with cross-language dependency detection
- 🏛️ Architecture Pattern Recognition: Microservices, Layered, Event-driven pattern detection with confidence scoring
- 📚 Repository Showcase Gallery: Curated collection of 8+ repositories across languages and complexity levels
- ⚡ Universal Demo: Any GitHub repository URL → Complete analysis with AI recommendations
- 🌐 Enhanced Web Demo: Interactive visualizations with 3 new API endpoints (/api/recommendations, /api/polyglot, /api/showcase)
- Toyota Way Excellence: Zero compilation defects maintained throughout development
Choose your preferred installation method - PMAT is available across all major package ecosystems:
cargo install pmat
# macOS/Linux - Homebrew
brew install pmat
# Windows - Chocolatey
choco install pmat
# Ubuntu/Debian - APT
sudo apt install pmat # (via PPA - coming soon)
# Arch Linux - AUR
yay -S pmat
# Node.js - npm (global)
npm install -g pmat-agent
# Latest version
docker run --rm -v $(pwd):/workspace paiml/pmat:latest pmat --version
# Interactive analysis
docker run --rm -v $(pwd):/workspace -w /workspace paiml/pmat:latest pmat context
git clone https://github.com/paiml/paiml-mcp-agent-toolkit
cd paiml-mcp-agent-toolkit
make build
# Linux/macOS Quick Install
curl -sSfL https://raw.githubusercontent.com/paiml/paiml-mcp-agent-toolkit/master/scripts/install.sh | sh
# Windows PowerShell
# Download from: https://github.com/paiml/paiml-mcp-agent-toolkit/releases
# Analyze current directory
pmat context
# Get complexity metrics
pmat analyze complexity --top-files 10
# Find technical debt
pmat analyze satd
# Run quality gates
pmat quality-gate --strict
# Start MCP server
pmat mcp
# Analyze any GitHub repository with AI recommendations
cargo run --example analyze_github_repo -- --url https://github.com/rust-lang/rust-clippy
# Compare multiple repositories across languages
cargo run --example compare_repos
# Run quality gates on GitHub repositories
cargo run --example quality_gate_github -- https://github.com/owner/repo
# Start interactive web demo
pmat demo --serve
# Then visit http://localhost:8080 for:
# • AI-powered repository recommendations
# • Multi-language project intelligence
# • Repository showcase gallery
# • Interactive analysis visualizations
# Setup quality enforcement (one-time)
make setup-quality
# Start development with quality checks
make dev
# Create quality-enforced commit
make commit
# Verify sprint quality
make sprint-close
- Complexity Analysis: McCabe cyclomatic & cognitive complexity with AST precision
- Dead Code Detection: Graph-based reachability analysis across 30+ languages
- SATD Detection: Self-admitted technical debt with severity classification
- Technical Debt Gradient: Multi-factor composite scoring with time-decay modeling
- Deep Context Generation: Multi-dimensional analysis optimized for AI agents
- Smart Recommendations: Framework-aware repository suggestions with complexity matching
- Polyglot Analysis: Cross-language dependency detection and architecture pattern recognition
- Repository Showcase: Curated gallery with learning pathways from beginner to expert
- Integration Points: Risk assessment of multi-language project coupling with mitigation strategies
- Quality Gates: Zero-tolerance enforcement (complexity ≤20, SATD=0, coverage >80%)
- Quality Proxy: AI code interceptor with 7-stage validation pipeline
- PDMT Integration: Deterministic todo generation with embedded quality requirements
- Refactoring Engine: State machine-based code transformation with ACID snapshots
- MCP Protocol: 18 tools via unified pmcp SDK 1.2.0 server
- HTTP API: RESTful with Server-Sent Events streaming
- CLI Interface: 47 commands with POSIX-compliant exit semantics
- Complete Specification - Unified source of truth (36 sections)
- API Reference - Service APIs and integration patterns
- CLI Reference - Complete command documentation
- Toyota Way Guide - Development workflow and standards
- Sprint Management - Task tracking and execution DAG
- Quality Gates - Enforcement mechanisms
- MCP Integration - Model Context Protocol setup
- PDMT Guide - Deterministic todo generation
- CI/CD Integration - Pipeline integration
PMAT implements Toyota Production System principles through rigorous static analysis:
- Kaizen (改善): Iterative file-by-file improvement with measurable ΔQ metrics
- Genchi Genbutsu (現地現物): Direct AST traversal, no heuristics
- Jidoka (自働化): Automated quality gates with fail-fast semantics
- Zero SATD Policy: Compile-time enforcement of zero technical debt
// Unified service layer with dependency injection
pub trait Service: Send + Sync {
type Input: Serialize + DeserializeOwned;
type Output: Serialize + DeserializeOwned;
async fn process(&self, input: Self::Input) -> Result<Self::Output, Self::Error>;
}
// All protocols use unified request/response
#[derive(Serialize, Deserialize)]
pub struct UnifiedRequest {
pub operation: Operation,
pub params: Value,
pub context: RequestContext,
}
- Startup: 4ms hot, 127ms cold (mmap'd grammar cache)
- Analysis: 487K LOC/s single-thread, 3.9M LOC/s multi-core
- Memory: 47MB base + 312KB per KLOC
- SIMD: 43% vectorized paths, 2.7x AVX2 speedup
- Rust 1.80.0+
- Git (for repository analysis)
git clone https://github.com/paiml/paiml-mcp-agent-toolkit
cd paiml-mcp-agent-toolkit
# Setup Toyota Way quality enforcement
make setup-quality
# Build and test
make build
make validate
# Run examples
make examples
[dependencies]
pmat = "2.5"
use pmat::services::code_analysis::CodeAnalysisService;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let service = CodeAnalysisService::new();
// Generate AI-optimized context
let context = service.generate_context(".", None).await?;
// Analyze complexity with Toyota Way standards
let complexity = service.analyze_complexity(".", Some(10)).await?;
Ok(())
}
- Rust: Full cargo integration with syn AST
- TypeScript/JavaScript: SWC-based parsing
- Python: RustPython AST analysis
- C/C++: Tree-sitter with goto tracking
- Ruchy: v1.5.0 support with advanced analysis
- Full AST parsing with 35+ token types
- Halstead metrics (volume, difficulty, effort, time, bugs)
- Dead code detection (unused functions/variables)
- Type inference for literals and binary operations
- Actor message flow analysis with deadlock detection
- Enhanced pattern matching complexity scoring
- Import/export dependency tracking
- Kotlin: Tree-sitter based analysis
- 30+ Languages: Via tree-sitter grammar support
PMAT provides 18 MCP tools via unified pmcp SDK server:
# Start MCP server (auto-detects transport)
pmat mcp
# Test with Claude Code
cargo run --example mcp_server_pmcp
cargo run --example test_pmcp_server
analyze_complexity
- Complexity metricsanalyze_satd
- Technical debt detectionanalyze_dead_code
- Unused code analysisquality_gate
- Comprehensive quality validationrefactor_start
- Begin refactoring workflowpdmt_deterministic_todos
- Generate quality todosgithub_create_issue
- Create GitHub issues- NEW: AI recommendation tools for intelligent repository analysis
- And 11 more...
Transform PMAT into a persistent background quality agent that continuously monitors your codebase:
# Start agent as MCP server for Claude Code
pmat agent mcp-server
# Configure in Claude Code settings.json:
{
"mcpServers": {
"pmat": {
"command": "pmat",
"args": ["agent", "mcp-server"],
"env": {}
}
}
}
# Start monitoring a project
pmat agent start --project-path /path/to/project
# Check monitoring status
pmat agent status
# Stop monitoring
pmat agent stop
- Real-time Monitoring: File system watching with instant quality feedback
- Persistent State: Maintains metrics across restarts with auto-save
- Toyota Way Compliance: Enforces ≤20 complexity with zero SATD tolerance
- Production Ready: Systemd service with health checks and auto-restart
- MCP Native: Seamless Claude Code integration via stdio transport
start_quality_monitoring
- Begin monitoring a projectstop_quality_monitoring
- Stop monitoringget_quality_status
- Current quality metricsrun_quality_gates
- Execute quality checksanalyze_complexity
- Complexity analysishealth_check
- Agent health status
See Claude Code Agent Guide for detailed setup and deployment instructions.
# AI-powered repository recommendations
GET /api/recommendations
# Multi-language project intelligence
GET /api/polyglot
# Repository showcase gallery
GET /api/showcase
# Core analysis APIs
GET /api/summary
GET /api/metrics
GET /api/hotspots
GET /api/dag
PMAT enforces extreme quality standards:
- Complexity: ≤20 cyclomatic, ≤15 cognitive
- Technical Debt: 0 SATD comments allowed
- Test Coverage: >80% with property-based testing
- Code Quality: 0 lint warnings, 0 dead code
- Documentation: Synchronized with every commit
# Run comprehensive quality analysis
pmat quality-gate --strict
# CI/CD integration
pmat analyze complexity --fail-on-violation
pmat analyze satd --fail-on-violation
pmat quality-gate --strict --fail-on-violation
PMAT follows Toyota Way development principles:
- Setup quality enforcement:
make setup-quality
- Start development:
make dev
- Make changes with documentation updates
- Quality-enforced commit:
make commit
- Sprint verification:
make sprint-close
All contributions must meet:
- Zero SATD comments
- Complexity ≤20 per function
- Full test coverage
- Documentation updates
See CONTRIBUTING.md for detailed guidelines.
Licensed under the MIT License. See LICENSE for details.
Built with ❤️ by Pragmatic AI Labs