paiml-mcp-agent-toolkit

作者 paiml已验证

Pragmatic AI Labs MCP Agent Toolkit - An MCP Server designed to make code with agents more deterministic

163
Stars
27
Forks
Rust
语言
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/paiml/paiml-mcp-agent-toolkit

快速入门

使用 paiml-mcp-agent-toolkit 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

PMAT

PMAT

Zero-configuration AI context generation for any codebase


Table of Contents

What is PMAT?

PMAT (Pragmatic Multi-language Agent Toolkit) provides everything needed to analyze code quality and generate AI-ready context:

  • Context Generation - Deep analysis for Claude, GPT, and other LLMs
  • Technical Debt Grading - A+ through F scoring with 6 orthogonal metrics
  • Mutation Testing - Test suite quality validation (85%+ kill rate)
  • Repository Scoring - Quantitative health assessment (0-289 scale, 11 categories)
  • Git History RAG - Semantic search across commit history with RRF fusion
  • Semantic Search - Natural language code discovery
  • Compliance Governance - 157 checks across code quality, best practices, and reproducibility
  • Design by Contract - Toyota Way contract profiles with checkpoint validation and rescue protocols
  • Autonomous Kaizen - Toyota Way continuous improvement with auto-fix and commit
  • MCP Integration - 16 tools for Claude Code, Cline, and AI agents, validated end-to-end for concurrent multi-agent (ultracode) workflows
  • Quality Gates - Pre-commit hooks, CI/CD integration, .pmat-gates.toml config
  • 20+ Languages - Rust, TypeScript, Python, Go, Java, C/C++, Lua, Lean, and more

Part of the PAIML Stack, following Toyota Way quality principles (Jidoka, Genchi Genbutsu, Kaizen).

Annotated Code Search

pmat query annotated output

pmat query "cache invalidation" --churn --duplicates --entropy --faults

Every result includes TDG grade, Big-O complexity, git churn, code clones, pattern diversity, fault annotations, call graph, and syntax-highlighted source.

Installation

# Install from crates.io
cargo install pmat

Note for macOS Users: If you experience issues installing via rustup, we recommend installing/updating Rust using Homebrew: brew install rust before running cargo install pmat.

Or from source (latest)

git clone https://github.com/paiml/paiml-mcp-agent-toolkit cd paiml-mcp-agent-toolkit && cargo install --path .


## Usage

```bash
# Generate AI-ready context
pmat context --output context.md --format llm-optimized

# Analyze code complexity
pmat analyze complexity

# Grade technical debt (A+ through F)
pmat analyze tdg

# Score repository health
pmat repo-score .

# Pre-flight verify before committing (CI-faithful: fmt + complexity + satd + clippy + tests)
pmat verify --format json

# Run mutation testing
pmat mutate --target src/

# Start MCP server (stdio) for Claude Code, Cline, etc.
MCP_VERSION=2024-11-05 pmat

Autonomous-agent pre-flight (pmat verify)

pmat verify runs the exact gate set CI enforces — format, complexity, satd, clippy, tests — fail-fast, with machine-readable output, so an agent gets "green here ⇒ green in CI" before committing. The canonical loop: edit → pmat verify --format json → fix on red → commit on green. See docs/agent-instructions/autonomous-verify-loop.md.

Ultracode validated

PMAT releases are dogfooded with ultracode — Claude Code's multi-agent dynamic-workflow orchestration — as both the test harness and the target workload:

  • Full CLI sweep: 111 commands exercised by parallel agent fleets per release
  • MCP surface: all 16 tools validated over stdio JSON-RPC — per-tool calls with schema-derived arguments, 8-way concurrent server sessions against one working tree (zero lock errors, zero scratch leftovers), and byte-level framing checks (stdout is exclusively JSON-RPC)
  • Determinism: TDG baselines and penalty attributions serialize byte-identically across runs, so independent agents converge instead of diverging on ordering noise
  • Concurrency-safe caches: PID-unique scratch files with atomic rename-into-place and stale-orphan sweeping; advisory-locked metric recording

Findings from each sweep are adversarially re-verified by skeptic agents before they drive fixes — see the release case studies in the pmat book.

Features

Context Generation

Generate comprehensive context for AI assistants:

pmat context                           # Basic analysis
pmat context --format llm-optimized    # AI-optimized output
pmat context --include-tests           # Include test files

Technical Debt Grading (TDG)

Six orthogonal metrics for accurate quality assessment:

pmat analyze tdg                       # Project-wide grade
pmat analyze tdg --include-components  # Per-component breakdown
pmat tdg baseline create               # Create quality baseline
pmat tdg check-regression              # Detect quality degradation

Grading Scale:

  • A+/A: Excellent quality, minimal debt
  • B+/B: Good quality, manageable debt
  • C+/C: Needs improvement
  • D/F: Significant technical debt

Mutation Testing

Validate test suite effectiveness:

pmat mutate --target src/lib.rs        # Single file
pmat mutate --target src/ --threshold 85  # Quality gate
pmat mutate --failures-only            # CI optimization

Supported Languages: Rust, Python, TypeScript, JavaScript, Go, C/C++, C#, Lua, Lean, Java, Kotlin, Ruby, Swift, PHP, Bash, SQL, Scala, YAML, Markdown + MLOps model formats (GGUF, SafeTensors, APR)

Repository Health Scoring

Evidence-based quality metrics (0-289 scale, 11 categories):

pmat rust-project-score                # Fast mode (~3 min)
pmat rust-project-score --full         # Comprehensive (~10-15 min)
pmat repo-score . --deep               # Full git history

Workflow Prompts

Pre-configured AI prompts enforcing EXTREME TDD:

pmat prompt --list                     # Available prompts
pmat prompt code-coverage              # 85%+ coverage enforcement
pmat prompt debug                      # Five Whys analysis
pmat prompt quality-enforcement        # All quality gates

Git History RAG

Search git history by intent using TF-IDF semantic embeddings:

# Fuse git history into code search
pmat query "fix memory leak" -G

# Search with churn, clones, entropy, faults
pmat query "error handling" --churn --duplicates --entropy --faults
# Run the example
cargo run --example git_history_demo

Git Hooks

Automatic quality enforcement:

pmat hooks install                     # Install pre-commit hooks
pmat hooks install --tdg-enforcement   # With TDG quality gates
pmat hooks status                      # Check hook status

Compliance Governance (pmat comply)

157 automated checks across code quality, best practices, and governance:

pmat comply check                      # Run all compliance checks
pmat comply check --strict             # Exit non-zero on failure
pmat comply check --format json        # Machine-readable output
pmat comply migrate                    # Update to latest version

Key Checks:

  • CB-200: TDG Grade Gate — blocks on definitions below the minimum grade (default A). Reads the index pmat query built; it never builds or rewrites one, and reports Skip / "Not measured" when .pmat/context.db is absent
  • CB-304: Dead code percentage enforcement
  • CB-400: Shell/Makefile quality via bashrs
  • CB-500: Rust best practices (30+ patterns)
  • CB-600: Lua best practices
  • CB-900: Markdown link validation
  • CB-1000: MLOps model quality

Provable-Contracts Enforcement (CB-1200..1210):

  • CB-1208: Binding existence — verifies binding.yaml functions exist in src/, detects ghost bindings (L0-L3 enforcement levels)
  • CB-1209: Contract trait enforcement — checks tests/contract_traits.rs for compiler-verified trait impls (13 kernel traits)
  • CB-1210: Precondition quality — flags mass-generated boilerplate and missing postconditions

Configure via .pmat.yaml:

comply:
  thresholds:
    min_tdg_grade: "A"          # CB-200 floor; `.pmat-gates.toml` [tdg] min_grade overrides this
    pv_lint_is_error: true        # CB-1201: FAIL on pv lint failure
    min_binding_existence: 95     # CB-1208: 95% binding verification
    require_all_traits: true      # CB-1209: 13/13 traits required
    min_kani_coverage: 20         # CB-1206: minimum Kani proof %

Infrastructure Score (pmat infra-score)

CI/CD quality scoring (0-100 + 10 bonus for provable-contracts):

pmat infra-score                       # Text output
pmat infra-score --format json         # Machine-readable
pmat infra-score -v --failures-only    # Show only failing checks

Categories: Workflow Architecture (25pts), Build Reliability (25pts), Quality Pipeline (20pts), Deployment & Release (15pts), Supply Chain (15pts), Provable Contracts bonus (10pts).

Document Search (pmat query --docs)

Search documentation files (Markdown, text, YAML) alongside code:

pmat query "authentication" --docs          # Code + docs results
pmat query "deployment" --docs-only         # Only documentation
pmat query "API endpoints" --no-docs        # Exclude docs (default)

Autonomous Kaizen (pmat kaizen)

Toyota Way continuous improvement — scan, auto-fix, commit:

pmat kaizen --dry-run                  # Scan only (no changes)
pmat kaizen                            # Apply safe auto-fixes
pmat kaizen --commit --push            # Fix, commit, and push
pmat kaizen --format json -o report.json  # CI/CD integration

# Cross-stack mode: scan all batuta stack crates in one invocation
pmat kaizen --cross-stack --dry-run    # Scan all crates
pmat kaizen --cross-stack --commit     # Fix and commit per-crate
pmat kaizen --cross-stack -f json      # Grouped JSON report

Function Extraction (pmat extract)

Extract function boundaries with metadata:

pmat extract src/lib.rs                # Extract functions from file
pmat extract --list src/               # List all functions with imports and visibility

Examples

Generate Context for AI

# For Claude Code
pmat context --output context.md --format llm-optimized

# With semantic search
pmat embed sync ./src
pmat semantic search "error handling patterns"

CI/CD Integration

# Add to your CI pipeline
steps:
  - uses: actions/checkout@v4
  - run: cargo install pmat
  - run: pmat analyze tdg --fail-on-violation --min-grade B
  - run: pmat mutate --target src/ --threshold 80

Quality Baseline Workflow

# 1. Create baseline
pmat tdg baseline create --output .pmat/baseline.json

# 2. Check for regressions
pmat tdg check-regression \
  --baseline .pmat/baseline.json \
  --max-score-drop 5.0 \
  --fail-on-regression

Architecture

pmat/
├── src/
│   ├── cli/          Command handlers and dispatchers
│   ├── services/     Analysis engines (TDG, SATD, complexity, agent context)
│   ├── mcp_server/   MCP protocol server
│   ├── mcp_pmcp/     PMCP protocol integration
│   └── models/       Configuration and data models
├── examples/         89 runnable examples
└── docs/
    └── specifications/  Technical specs

Quality

MetricValue
Tests21,200+ passing
Coverage99.66%
Mutation Score>80%
Languages20 supported + MLOps model formats
MCP Tools16 available

Falsifiable Quality Commitments

Per Popper's demarcation criterion, all claims are measurable and testable:

CommitmentThresholdVerification Method
Context Generation< 5 seconds for 10K LOC projecttime pmat context on test corpus
Memory Usage< 500 MB for 100K LOC analysisMeasured via heaptrack in CI
Test Coverage≥ 85% line coveragecargo llvm-cov (CI enforced)
Mutation Score≥ 80% killed mutantspmat mutate --threshold 80
Build Time< 3 minutes incrementalcargo build --timings
CI Pipeline< 15 minutes totalGitHub Actions workflow timing
Binary Size< 50 MB release binaryls -lh target/release/pmat
Language ParsersAll 20 languages parse without panicFuzz testing in CI

How to Verify:

# Run self-assessment with Popper Falsifiability Score
pmat popper-score --verbose

# Individual commitment verification
cargo llvm-cov --html        # Coverage ≥85%
pmat mutate --threshold 80   # Mutation ≥80%
cargo build --timings        # Build time <3min

Failure = Regression: Any commitment violation blocks CI merge.

Benchmark Results (Statistical Rigor)

All benchmarks use Criterion.rs with proper statistical methodology:

OperationMean95% CIStd DevSample Size
Context (1K LOC)127ms[124, 130]±12.3msn=1000 runs
Context (10K LOC)1.84s[1.79, 1.90]±156msn=500 runs
TDG Scoring156ms[148, 164]±18.2msn=500 runs
Complexity Analysis23ms[22, 24]±3.1msn=1000 runs

Comparison Baselines (vs. Alternatives):

MetricPMATctagstree-sitterEffect Size
10K LOC parsing1.84s0.3s0.8sd=0.72 (medium)
Memory (10K LOC)287MB45MB120MB-
Semantic depthFullSyntax onlyAST only-

See docs/BENCHMARKS.md for complete statistical analysis.

ML/AI Reproducibility

PMAT uses ML for semantic search and embeddings. All ML operations are reproducible:

Random Seed Management:

  • Embedding generation uses fixed seed (SEED=42) for deterministic outputs
  • Clustering operations use fixed seed (SEED=12345)
  • Seeds documented in docs/ml/REPRODUCIBILITY.md

Model Artifacts:

  • Pre-trained models from HuggingFace (all-MiniLM-L6-v2)
  • Model versions pinned in Cargo.toml
  • Hash verification on download

Dataset Sources

PMAT does not train models but uses these data sources for evaluation:

DatasetSourcePurposeSize
CodeSearchNetGitHub/MicrosoftSemantic search benchmarks2M functions
PMAT-benchInternalRegression testing500 queries

Data provenance and licensing documented in docs/ml/REPRODUCIBILITY.md.

Sovereign Stack

PMAT is built on the PAIML Sovereign Stack - pure-Rust, SIMD-accelerated libraries:

LibraryPurposeVersion
aprenderML library (text similarity, clustering, topic modeling)0.41
aprender-graphCSR graph database (PageRank, Louvain)0.41
aprender-dbColumnar analytics database (lib trueno_db)0.41
aprender-ragRAG pipeline with VectorStore0.41
aprender-vizTerminal graph visualization0.41
aprender-computeSIMD/GPU compute for matrix operations (lib trueno)0.41
aprender-zram-coreSIMD LZ4/ZSTD compression (optional)0.41
aprender-contractsProvable contracts (with aprender-contracts-macros)0.49
pmcpMCP protocol SDK2.9
pmatCode analysis toolkit3.19.2

Key Benefits:

  • Pure Rust (no C dependencies, no FFI)
  • SIMD-first (AVX2, AVX-512, NEON auto-detection)
  • 2-4x speedup on graph algorithms via aprender adapter

Documentation

Contributing

See CONTRIBUTING.md for development setup, testing, and pull request guidelines.

See Also

License

MIT License - see LICENSE for details.


Built with Extreme TDD | Part of PAIML

常见问题

What is paiml-mcp-agent-toolkit?

paiml-mcp-agent-toolkit is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by paiml. Pragmatic AI Labs MCP Agent Toolkit - An MCP Server designed to make code with agents more deterministic. It has 163 GitHub stars.

Is paiml-mcp-agent-toolkit safe to use?

Yes. paiml-mcp-agent-toolkit passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install paiml-mcp-agent-toolkit?

Clone the repository with "git clone https://github.com/paiml/paiml-mcp-agent-toolkit" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is paiml-mcp-agent-toolkit written in?

paiml-mcp-agent-toolkit is primarily written in Rust. It is open-source under paiml on GitHub, so you can review or fork the full source.

Are there alternatives to paiml-mcp-agent-toolkit?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh paiml-mcp-agent-toolkit against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI 智能体
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情